From f11a414645484d3c217dc925cfe720ac7348df16 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 27 Aug 2024 16:52:11 -0700 Subject: [PATCH] nir/algebraic: Remove incorrect bfi of iand pattern The comment says, "This expands to (b & 3) & ~0xc which is (b & 3) & 3." This is not correct. ~0xc is actually 0xfffffff3. Reviewed-by: Rhys Perry Closes: #11695 Fixes: 1c7e35d4e00 ("nir/algebraic: Optimize some bit operation nonsense observed in some shaders") Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index ee33786c732..4e4f5f2309f 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1893,10 +1893,6 @@ optimizations.extend([ (('bfi', 0xffff0000, ('pack_half_2x16_split', a, b), ('pack_half_2x16_split', c, d)), ('pack_half_2x16_split', c, a)), - # Part of the BFI operation is src2&~src0. This expands to (b & 3) & ~0xc - # which is (b & 3) & 3. - (('bfi', 0x0000000c, a, ('iand', b, 3)), ('bfi', 0x0000000c, a, b)), - # The important part here is that ~0xf & 0xfffffffc = ~0xf. (('iand', ('bfi', 0x0000000f, '#a', b), 0xfffffffc), ('bfi', 0x0000000f, ('iand', a, 0xfffffffc), b)),