nir: Add a bunch of b2[if] optimizations

Graphics / Mesa 3D Graphics Library / Mesa - Jason Ekstrand [intel.com] - 11 October 2018 20:21 EDT

The b2f and b2i conversions always produce zero or one which are both representable in every type and size. Since b2i and b2f support all bit sizes, we can just get rid of the conversion opcode.

total instructions in shared programs: 15089335 -> 15084368 (-0.03%) instructions in affected programs: 212564 -> 207597 (-2.34%) helped: 896 HURT: 0

total cycles in shared programs: 369831123 -> 369826267 (<.01%) cycles in affected programs: 2008647 -> 2003791 (-0.24%) helped: 693 HURT: 216

d7e0d47b9d nir: Add a bunch of b2[if] optimizations
src/compiler/nir/nir_opt_algebraic.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

Upstream: cgit.freedesktop.org


  • Share