nir/algebraic: Only lower ufind_msb with 32-bit sources
The 31-ufind_msb_rev(x) lowering only produces the correct result for 32-bit sources. ufind_msb_rev can also have 64-bit sources, and most platforms are expected to lower this to 32-bit instructions with extra logic operations. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19042>
This commit is contained in:
@@ -2035,11 +2035,11 @@ optimizations.extend([
|
||||
('isub', 31, ('uclz', ('ixor', 'value', ('ishr', 'value', 31)))),
|
||||
'options->lower_ifind_msb_to_uclz'),
|
||||
|
||||
(('ufind_msb', 'value'),
|
||||
('bcsel', ('ige', ('ufind_msb_rev', 'value'), 0),
|
||||
('isub', 31, ('ufind_msb_rev', 'value')),
|
||||
('ufind_msb_rev', 'value')),
|
||||
'options->lower_find_msb_to_reverse'),
|
||||
(('ufind_msb', 'value@32'),
|
||||
('bcsel', ('ige', ('ufind_msb_rev', 'value'), 0),
|
||||
('isub', 31, ('ufind_msb_rev', 'value')),
|
||||
('ufind_msb_rev', 'value')),
|
||||
'options->lower_find_msb_to_reverse'),
|
||||
|
||||
(('uclz', a), ('umin', 32, ('ufind_msb_rev', a)), 'options->lower_uclz'),
|
||||
|
||||
|
Reference in New Issue
Block a user