nir: add lowering for idiv/udiv/umod
authorRob Clark <robclark@freedesktop.org>
Tue, 31 Mar 2015 21:03:39 +0000 (17:03 -0400)
committerRob Clark <robclark@freedesktop.org>
Sun, 5 Apr 2015 13:20:35 +0000 (09:20 -0400)
commitf2ecc95e44c5798a15cde4aa67887bc562756ccd
tree758dd975963306bd196bc7f962f32b800cf72143
parent7880bea2fb587871faead78f624920ad5e8b89f7
nir: add lowering for idiv/udiv/umod

Based on the algo from NV50LegalizeSSA::handleDIV() and handleMOD().
See also trans_idiv() in freedreno/ir3/ir3_compiler.c (which was an
adaptation of the nv50 code from Ilia Mirkin).

A python/numpy script which implements the same algorithm (and is
possibly useful for debugging or analysis) can be found here:

  http://people.freedesktop.org/~robclark/div-lowering.py

I've tested this on i965 hacked up to insert the idiv lowering pass,
and on freedreno with NIR frontend.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Eric Anholt <eric@anholt.net> (vc4)
src/glsl/Makefile.sources
src/glsl/nir/nir.h
src/glsl/nir/nir_lower_idiv.c [new file with mode: 0644]