[Mesa-dev] [PATCH] gallium/r600: Replace ALIGN_DIVUP with DIV_ROUND_UP
Nicolai Hähnle
nhaehnle at gmail.com
Wed Jan 6 13:12:31 PST 2016
Pushed.
On 06.01.2016 12:10, Krzysztof A. Sobiecki wrote:
> Nicolai Hähnle <nhaehnle at gmail.com> writes:
>
>> On 30.12.2015 13:44, Krzysztof A. Sobiecki wrote:
>>> Nicolai Hähnle <nhaehnle at gmail.com> writes:
>>>
>>>> On 30.12.2015 08:42, Krzysztof A. Sobiecki wrote:
>>>>> Nicolai Hähnle <nhaehnle at gmail.com> writes:
>>>>>
>>>>>> On 29.12.2015 14:27, Krzysztof A. Sobiecki wrote:
>>>>>>> From: Krzysztof Sobiecki <sobkas at gmail.com>
>>>>>>>
>>>>>>> ALIGN_DIVUP is a driver specific(r600g) macro that duplicates DIV_ROUND_UP functionality.
>>>>>>> Replacing it with DIV_ROUND_UP eliminates this problems.
>>>>>>
>>>>>> Those macros are actually slightly different, and the assembly
>>>>>> generated by the ALIGN_DIVUP looks clearly better to me.
>>>>>>
>>>>>> I remember seeing a very long thread about this not so long ago - what
>>>>>> was the resolution there?
>>>>>>
>>>>>> Cheers,
>>>>>> Nicolai
>>>>>>
>>>>> I would like to remove ALIGN_DIVUP first and then debate with
>>>>> implementation DIV_ROUND_UP should use.
>>>>>
>>>>> btw. I prefer 1 + ((x - 1) / y)
>>>>
>>>> That produces an incorrect result when x is an unsigned type and equal
>>>> to 0 -- and that is something that existing code definitely relies on.
>>>>
>>>> Cheers,
>>>> Nicolai
>>>>
>>> Then what about (x / y) + (i % y != 0)
>>
>> Generates similar assembly to the DIV_ROUND_UP version.
>>
>> Anyway, now that I look at it again I'd say just go ahead and add my
>> R-b. Yes, the assembly looks slightly worse, but only slightly, and
>> avoiding surprises with overflows down the line seems like a good
>> idea.
>>
>> Cheers,
>> Nicolai
>>
> I don't have commit access, can you push it, sorry.
>
More information about the mesa-dev
mailing list