From 1f3c97547acf8be0a8851e3f3581060922e4c2da Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 4 Nov 2024 10:23:48 -0400 Subject: [PATCH] nir/builder: use amul over ishl on agx ishl can wrap, amul cannot. so we need amul in the backend, or otherwise we would need to introduce an ashl opcode instead. that doesn't seem better. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Karol Herbst Part-of: --- src/compiler/nir/nir_builder.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 5e07f588b4a..9d7071e2cf5 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -974,6 +974,8 @@ _nir_mul_imm(nir_builder *build, nir_def *x, uint64_t y, bool amul) return x; } else if ((!build->shader->options || !build->shader->options->lower_bitops) && + !(amul && (!build->shader->options || + build->shader->options->has_amul)) && util_is_power_of_two_or_zero64(y)) { return nir_ishl(build, x, nir_imm_int(build, ffsll(y) - 1)); } else if (amul) {