Commit 1403c3a7 authored by Daniel Schürmann's avatar Daniel Schürmann Committed by Daniel Schürmann

nir/algebraic: Use unsigned comparison when lowering bitfield insert/extract

This lets us use the optimization pattern
(('ult', 31, ('iand', b, 31)), False) to remove the
bcsel instruction for code originating in D3D shaders.
Reviewed-by: Connor Abbott's avatarConnor Abbott <>
parent 4eeb49ea
...@@ -782,7 +782,7 @@ optimizations.extend([ ...@@ -782,7 +782,7 @@ optimizations.extend([
(('usub_borrow@32', a, b), ('b2i', ('ult', a, b)), 'options->lower_usub_borrow'), (('usub_borrow@32', a, b), ('b2i', ('ult', a, b)), 'options->lower_usub_borrow'),
(('bitfield_insert', 'base', 'insert', 'offset', 'bits'), (('bitfield_insert', 'base', 'insert', 'offset', 'bits'),
('bcsel', ('ilt', 31, 'bits'), 'insert', ('bcsel', ('ult', 31, 'bits'), 'insert',
('bfi', ('bfm', 'bits', 'offset'), 'insert', 'base')), ('bfi', ('bfm', 'bits', 'offset'), 'insert', 'base')),
'options->lower_bitfield_insert'), 'options->lower_bitfield_insert'),
(('ihadd', a, b), ('iadd', ('iand', a, b), ('ishr', ('ixor', a, b), 1)), 'options->lower_hadd'), (('ihadd', a, b), ('iadd', ('iand', a, b), ('ishr', ('ixor', a, b), 1)), 'options->lower_hadd'),
...@@ -800,7 +800,7 @@ optimizations.extend([ ...@@ -800,7 +800,7 @@ optimizations.extend([
'options->lower_bitfield_insert_to_shifts'), 'options->lower_bitfield_insert_to_shifts'),
(('ibitfield_extract', 'value', 'offset', 'bits'), (('ibitfield_extract', 'value', 'offset', 'bits'),
('bcsel', ('ilt', 31, 'bits'), 'value', ('bcsel', ('ult', 31, 'bits'), 'value',
('ibfe', 'value', 'offset', 'bits')), ('ibfe', 'value', 'offset', 'bits')),
'options->lower_bitfield_extract'), 'options->lower_bitfield_extract'),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment