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 <pendingchaos02@gmail.com>
Closes: #11695
Fixes: 1c7e35d4e0 ("nir/algebraic: Optimize some bit operation nonsense observed in some shaders")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30913>
This commit is contained in:
Ian Romanick 2024-08-27 16:52:11 -07:00 committed by Marge Bot
parent 0b010b357d
commit f11a414645

View file

@ -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)),