[Mesa-dev] [PATCH] nir: Optimize double-precision lower_round_even()

Erik Faye-Lund erik.faye-lund at collabora.com
Tue Jan 29 09:10:51 UTC 2019


On Mon, 2019-01-28 at 09:31 -0800, Matt Turner wrote:
> Use the trick of adding and then subtracting 2**52 (52 is the number
> of
> explicit mantissa bits a double-precision floating-point value has)
> to
> implement round-to-even.
> 
> Cuts the number of instructions on SKL of the piglit test
> fs-roundEven-double.shader_test from 109 to 21.

Won't this approach only work for "small" values, that is values equal
to or smaller than DBL_MAX - 2**52? Once you add 2**52, you'll get
infinity, and you can't subtract 2**52 away again without being stuck
with infinity, no...




More information about the mesa-dev mailing list