[Mesa-dev] MR: NIR: Partial redundancy elimination for compares

Roland Scheidegger sroland at vmware.com
Mon Dec 17 22:27:47 UTC 2018


Am 17.12.18 um 23:07 schrieb Ilia Mirkin:
> On Mon, Dec 17, 2018 at 5:05 PM Ian Romanick <idr at freedesktop.org> wrote:
>>
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fmesa%2Fmesa%2Fmerge_requests%2F22&data=02%7C01%7Csroland%40vmware.com%7C5773f37aa397417e6beb08d6646c24c6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636806812986635916&sdata=z2ev4sVJEW8Kw2hsoNWfYHh6FkSwSy%2B5CdTItxoh%2FPE%3D&reserved=0
>>
>> This series adds a new optimization pass that tries to replace code
>> sequences like
>>
>> if (x < y) {
>>     z = y - x;
>>     ...
>> }
>>
>> with a sequence like
>>
>> t = x - y;
>> if (t < 0) {
>>     z = -t;
>>     ...
>> }
> 
> Is it worth worrying about infinities? e.g. if x = -Infinity, y =
> Infinity, "x < y" will be true, but "x - y < 0" will not be (pretty
> sure it'll be a NaN, which is not < 0).

I was wondering the same, but I think this should still work.
-Inf - Inf = -Inf, so no problem there.

Roland


>   -ilia


More information about the mesa-dev mailing list