diff options
author | Matt Turner <[email protected]> | 2016-02-03 14:28:31 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2016-03-04 11:52:34 -0800 |
commit | 905ff861982450831a56d112036f68a751337441 (patch) | |
tree | d9c5cbe152f71d02d2490e5d2cdea48856aafd4f /src/compiler/nir | |
parent | 76289fbfa84a06ef4db8ad44ea0eb88ad0be8d5c (diff) |
nir: Recognize open-coded extract_u16.
No shader-db changes, but does recognize some extract_u16 which enables
the next patch to optimize some code.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index dd26805e1a8..39be85f639e 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -163,6 +163,7 @@ optimizations = [ (('ushr', 0, a), 0), (('ushr', a, 0), a), (('iand', 0xff, ('ushr', a, 24)), ('ushr', a, 24)), + (('iand', 0xffff, ('ushr', a, 16)), ('ushr', a, 16)), # Exponential/logarithmic identities (('fexp2', ('flog2', a)), a), # 2^lg2(a) = a (('flog2', ('fexp2', a)), a), # lg2(2^a) = a @@ -220,6 +221,10 @@ optimizations = [ (('iand', 0xff, ('ushr', a, 8)), ('extract_u8', a, 1), '!options->lower_extract_byte'), (('iand', 0xff, a), ('extract_u8', a, 0), '!options->lower_extract_byte'), + # Word extraction + (('ushr', a, 16), ('extract_u16', a, 1), '!options->lower_extract_word'), + (('iand', 0xffff, a), ('extract_u16', a, 0), '!options->lower_extract_word'), + # Subtracts (('fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)), (('isub', a, ('isub', 0, b)), ('iadd', a, b)), |