nir: Optimize double-precision lower_round_even()
authorMatt Turner <mattst88@gmail.com>
Sun, 27 Jan 2019 20:38:19 +0000 (12:38 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 29 Jan 2019 23:02:23 +0000 (15:02 -0800)
commit9de90caca82c6c5b459724dc73534dff28bd8841
treea19df94201235e7461ff01cd0636391076724125
parent3e249b853ebb679656975b48aca91f76fc1d2fd2
nir: Optimize double-precision lower_round_even()

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.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/compiler/nir/nir_lower_double_ops.c