summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2019-02-27 20:15:32 -0800
committerIan Romanick <[email protected]>2019-03-08 22:24:19 -0800
commit18e4bf65de2be6c20faa09985e7db55b1b8813bf (patch)
treedaa59bfe36681e6e91d36ead059b9b5db1f3331e /src
parent55c1ac4b753d48fa2d97172216202264313e76b7 (diff)
nir/algebraic: Add missing 16-bit extract_[iu]8 patterns
No shader-db changes on any Intel platform. v2: Use a loop to generate patterns. Suggested by Jason. Reviewed-by: Matt Turner <[email protected]> [v1] Reviewed-by: Dylan Baker <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index d77f38f0761..218dacf4031 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -604,8 +604,10 @@ optimizations = [
('unpack_64_2x32_split_y', a)), a),
# Byte extraction
+ (('ushr', 'a@16', 8), ('extract_u8', a, 1), '!options->lower_extract_byte'),
(('ushr', 'a@32', 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),
(('ushr', 'a@64', 56), ('extract_u8', a, 7), '!options->lower_extract_byte'),
+ (('ishr', 'a@16', 8), ('extract_i8', a, 1), '!options->lower_extract_byte'),
(('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')
@@ -623,6 +625,7 @@ optimizations.extend([(('extract_u8', ('extract_u16', a, 1), 0), ('extract_u8',
# After the ('extract_[iu]8', a, 3) patterns, above, trigger, there will be
# patterns like those below.
for op in ('extract_u8', 'extract_i8'):
+ optimizations.extend([((op, ('ishl', 'a@16', 8), 1), ('extract_u8', a, 0))])
optimizations.extend([((op, ('ishl', 'a@32', 24 - 8 * i), 3), ('extract_u8', a, i)) for i in range(2, -1, -1)])
optimizations.extend([((op, ('ishl', 'a@64', 56 - 8 * i), 7), ('extract_u8', a, i)) for i in range(6, -1, -1)])