nir: Optimize integer division and modulus with 1

Graphics / Mesa 3D Graphics Library / Mesa - Ian Romanick [intel.com] - 19 October 2016 16:25 UTC

The previous power-of-two rules didn't catch idiv (because i965 doesn't set lower_idiv) and imod cases. The udiv and umod cases should have been caught, but I included them for orthogonality.

This fixes silly code observed from compute shaders with local_size_[xy]
= 1.

4d35683 nir: Optimize integer division and modulus with 1
src/compiler/nir/nir_opt_algebraic.py | 4 ++++
1 file changed, 4 insertions(+)

Upstream: cgit.freedesktop.org


  • Share