nir/algebraic: add bit-size check to extract_u8 pattern

This only worked when "a" was 16-bit because a pattern above replaced the
shift.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31762>
This commit is contained in:
Rhys Perry
2024-10-18 17:01:46 +01:00
committed by Marge Bot
parent b318fe47e9
commit da5c5a3edd
+3 -2
View File
@@ -1804,8 +1804,9 @@ optimizations.extend([
(('ishr', 'a@32', 24), ('extract_i8', a, 3), '!options->lower_extract_byte'),
(('ishr', 'a@64', 56), ('extract_i8', a, 7), '!options->lower_extract_byte'),
(('iand', 0xff, a), ('extract_u8', a, 0), '!options->lower_extract_byte'),
(('ishr', ('iand', a, 0x0000ff00), 8), ('extract_u8', a, 1), '!options->lower_extract_byte'),
(('ishr', ('iand', a, 0x00ff0000), 16), ('extract_u8', a, 2), '!options->lower_extract_byte'),
(('ishr', ('iand', 'a@32', 0x0000ff00), 8), ('extract_u8', a, 1), '!options->lower_extract_byte'),
(('ishr', ('iand', 'a@64', 0x0000ff00), 8), ('extract_u8', a, 1), '!options->lower_extract_byte'),
(('ishr', ('iand', a, 0x00ff0000), 16), ('extract_u8', a, 2), '!options->lower_extract_byte'),
# Common pattern in many Vulkan CTS tests that read 8-bit integers from a
# storage buffer.