mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
nir/lower_idiv: Use ilt instead of bit twiddling
The previous code was creating a boolean by doing an arithmetic right- shift by 31 which produces a boolean which is true if the argument is negative. This is the same as the expression r < 0 which is much simpler and doesn't depend on NIR's representation of booleans. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
2977c77758
commit
e17426058c
1 changed files with 1 additions and 1 deletions
|
|
@ -101,7 +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_ishr(bld, r, nir_imm_int(bld, 31));
|
||||
r = nir_ilt(bld, r, nir_imm_int(bld, 0));
|
||||
b = nir_ineg(bld, q);
|
||||
q = nir_bcsel(bld, r, b, q);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue