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

Ilia Mirkin imirkin at alum.mit.edu
Mon Dec 17 22:07:59 UTC 2018


On Mon, Dec 17, 2018 at 5:05 PM Ian Romanick <idr at freedesktop.org> wrote:
>
> https://gitlab.freedesktop.org/mesa/mesa/merge_requests/22
>
> 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).

  -ilia


More information about the mesa-dev mailing list