nir/algebraic: check bit sizes in lowered unpack(pack()) optimization

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Fixes: 894f7f4387 ("nir_opt_algebraic: Add a couple optimizations for lowered unpack(pack())")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32157>
This commit is contained in:
Rhys Perry
2024-11-15 15:11:39 +00:00
committed by Marge Bot
parent ecd6ae12fb
commit 327e5465fc

View File

@@ -1987,8 +1987,11 @@ optimizations.extend([
(('bcsel', a, ('b2i16', 'b@1'), ('b2i16', 'c@1')), ('b2i16', ('bcsel', a, b, c))),
# Lowered pack followed by lowered unpack, for the high bits
(('u2u32', ('ushr', ('ior', ('ishl', a, 32), ('u2u64', b)), 32)), ('u2u32', a)),
(('u2u16', ('ushr', ('ior', ('ishl', a, 16), ('u2u32', b)), 16)), ('u2u16', a)),
(('u2u32', ('ushr', ('ior', ('ishl', a, 32), ('u2u64', 'b@8')), 32)), ('u2u32', a)),
(('u2u32', ('ushr', ('ior', ('ishl', a, 32), ('u2u64', 'b@16')), 32)), ('u2u32', a)),
(('u2u32', ('ushr', ('ior', ('ishl', a, 32), ('u2u64', 'b@32')), 32)), ('u2u32', a)),
(('u2u16', ('ushr', ('ior', ('ishl', a, 16), ('u2u32', 'b@8')), 16)), ('u2u16', a)),
(('u2u16', ('ushr', ('ior', ('ishl', a, 16), ('u2u32', 'b@16')), 16)), ('u2u16', a)),
])
# After the ('extract_u8', a, 0) pattern, above, triggers, there will be