summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2019-02-27 20:08:38 -0800
committerIan Romanick <[email protected]>2019-03-28 15:35:52 -0700
commitbc17f5a2a3b2340f46de709d4364b845a8f4cb5f (patch)
tree722c24c1549b4ff80b9b741152f396fd60a3b8ff /src/compiler
parentc152672e68d7dacee50ab93e4bf176f6db2d49fb (diff)
nir/algebraic: Remove redundant extract_[iu]8 patterns
No shader-db changes on any Intel platform. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index cb47a4bbba3..70720efe048 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -611,22 +611,13 @@ optimizations = [
('unpack_64_2x32_split_y', a)), a),
# Byte extraction
- (('ushr', ('ishl', 'a@32', 24), 24), ('extract_u8', a, 0), '!options->lower_extract_byte'),
- (('ushr', ('ishl', 'a@32', 16), 24), ('extract_u8', a, 1), '!options->lower_extract_byte'),
- (('ushr', ('ishl', 'a@32', 8), 24), ('extract_u8', a, 2), '!options->lower_extract_byte'),
(('ushr', 'a@32', 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),
- (('ishr', ('ishl', 'a@32', 24), 24), ('extract_i8', a, 0), '!options->lower_extract_byte'),
- (('ishr', ('ishl', 'a@32', 16), 24), ('extract_i8', a, 1), '!options->lower_extract_byte'),
- (('ishr', ('ishl', 'a@32', 8), 24), ('extract_i8', a, 2), '!options->lower_extract_byte'),
(('ishr', 'a@32', 24), ('extract_i8', a, 3), '!options->lower_extract_byte'),
- (('iand', 0xff, ('ushr', a, 16)), ('extract_u8', a, 2), '!options->lower_extract_byte'),
- (('iand', 0xff, ('ushr', a, 8)), ('extract_u8', a, 1), '!options->lower_extract_byte'),
(('iand', 0xff, a), ('extract_u8', a, 0), '!options->lower_extract_byte')
]
-# The ('extract_u8', a, 0) pattern, above, can trigger in cases where the
-# shift count is based on a loop induction variable. Once the loop is
-# unrolled, constant folding will generate patterns like those below.
+# After the ('extract_u8', a, 0) pattern, above, triggers, there will be
+# patterns like those below.
for op in ('ushr', 'ishr'):
optimizations.extend([(('extract_u8', (op, 'a@16', 8), 0), ('extract_u8', a, 1))])
optimizations.extend([(('extract_u8', (op, 'a@32', 8 * i), 0), ('extract_u8', a, i)) for i in range(1, 4)])
@@ -634,9 +625,8 @@ for op in ('ushr', 'ishr'):
optimizations.extend([(('extract_u8', ('extract_u16', a, 1), 0), ('extract_u8', a, 2))])
-# The ('extract_[iu]8', a, 3) patterns, above, can trigger in cases where the
-# shift count is based on a loop induction variable. Once the loop is
-# unrolled, constant folding will generate patterns like those below.
+# 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@32', 24 - 8 * i), 3), (op, a, i)) for i in range(2, -1, -1)])