[Mesa-dev] [PATCH] nir: Avoid an extra NIR op in integer divide lowering.
Kenneth Graunke
kenneth at whitecape.org
Mon Nov 14 07:16:07 UTC 2016
On Monday, November 7, 2016 12:28:34 PM PST Eric Anholt wrote:
> NIR bools are ~0 for true, so ((unsigned)a >> 31) != 0 -> ((int)a >> 31).
> ---
> src/compiler/nir/nir_lower_idiv.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/compiler/nir/nir_lower_idiv.c b/src/compiler/nir/nir_lower_idiv.c
> index b1e7aeb03c8a..6726b718aaa5 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);
> }
>
Yep.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161113/ed38a50f/attachment.sig>
More information about the mesa-dev
mailing list