diff options
author | Eric Anholt <[email protected]> | 2016-11-07 10:34:01 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2016-11-16 19:45:01 -0800 |
commit | 80786a67cf64f9d3ae21b42ab7690255105a66db (patch) | |
tree | f5cc72ded13826a7e3b786b6232252db47c436a3 /src/compiler/nir | |
parent | 7f27ad55974d0bdac4c94a4523a4d42cc75334d5 (diff) |
nir: Avoid an extra NIR op in integer divide lowering.
NIR bools are ~0 for true, so ((unsigned)a >> 31) != 0 -> ((int)a >> 31).
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_lower_idiv.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_lower_idiv.c b/src/compiler/nir/nir_lower_idiv.c index b1e7aeb03c8..6726b718aaa 100644 --- a/src/compiler/nir/nir_lower_idiv.c +++ b/src/compiler/nir/nir_lower_idiv.c @@ -101,8 +101,7 @@ convert_instr(nir_builder *bld, nir_alu_instr *alu) if (is_signed) { /* fix the sign: */ r = nir_ixor(bld, numer, denom); - r = nir_ushr(bld, r, nir_imm_int(bld, 31)); - r = nir_i2b(bld, r); + r = nir_ishr(bld, r, nir_imm_int(bld, 31)); b = nir_ineg(bld, q); q = nir_bcsel(bld, r, b, q); } |