nir/lower_bit_size: fix bitz/bitnz

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 6585209cdd ("nir/lower_bit_size: mask bitz/bitnz src1 like shifts")
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35770>
(cherry picked from commit 08859cbe50)
This commit is contained in:
Rhys Perry 2025-06-26 17:13:55 +01:00 committed by Eric Engestrom
parent dd65919d84
commit a20567eead
2 changed files with 4 additions and 3 deletions

View file

@ -844,7 +844,7 @@
"description": "nir/lower_bit_size: fix bitz/bitnz",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "6585209cdd938b24418b606b1c4de68753f89dc7",
"notes": null

View file

@ -69,8 +69,9 @@ lower_alu_instr(nir_builder *bld, nir_alu_instr *alu, unsigned bit_size)
op == nir_op_bitz || op == nir_op_bitz8 || op == nir_op_bitz16 ||
op == nir_op_bitz32 || op == nir_op_bitnz || op == nir_op_bitnz8 ||
op == nir_op_bitnz16 || op == nir_op_bitnz32)) {
assert(util_is_power_of_two_nonzero(dst_bit_size));
src = nir_iand(bld, src, nir_imm_int(bld, dst_bit_size - 1));
unsigned src0_bit_size = alu->src[0].src.ssa->bit_size;
assert(util_is_power_of_two_nonzero(src0_bit_size));
src = nir_iand(bld, src, nir_imm_int(bld, src0_bit_size - 1));
}
srcs[i] = src;