[Mesa-dev] [PATCH 13/14] FIXUP: nir/opt_algebraic: Add suffixes to some x2b opcodes
Jason Ekstrand
jason at jlekstrand.net
Fri Nov 9 03:46:18 UTC 2018
Many of the x2b optimizations in nir_opt_algebraic can be handled by the
generic untyped conversion opcodes we just added. However, there are a
few that still need an explicit size for some reason.
---
src/compiler/nir/nir_opt_algebraic.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index aeed5a8e4da..14c41ae7124 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -438,7 +438,7 @@ optimizations = [
(('fsat', ('fadd', ('b2f', 'a at 32'), ('b2f', 'b at 32'))), ('b2f', ('ior', a, b))),
(('iand', 'a at bool', 1.0), ('b2f', a), '!options->lower_b2f'),
# True/False are ~0 and 0 in NIR. b2i of True is 1, and -1 is ~0 (True).
- (('ineg', ('b2i at 32', 'a at 32')), a),
+ (('ineg', ('b2i32', 'a at 32')), a),
(('flt', ('fneg', ('b2f', 'a at 32')), 0), a), # Generated by TGSI KILL_IF.
(('flt', ('fsub', 0.0, ('b2f', 'a at 32')), 0), a), # Generated by TGSI KILL_IF.
# Comparison with the same args. Note that these are not done for
@@ -530,15 +530,15 @@ optimizations = [
(('fcsel', a, b, b), b),
# Conversions
- (('i2b', ('b2i', 'a at 32')), a),
- (('i2b', 'a at bool'), a),
+ (('i2b32', ('b2i', 'a at 32')), a),
+ (('i2b32', 'a at bool'), a),
(('f2i', ('ftrunc', a)), ('f2i', a)),
(('f2u', ('ftrunc', a)), ('f2u', a)),
(('i2b', ('ineg', a)), ('i2b', a)),
(('i2b', ('iabs', a)), ('i2b', a)),
(('fabs', ('b2f', a)), ('b2f', a)),
(('iabs', ('b2i', a)), ('b2i', a)),
- (('inot', ('f2b', a)), ('feq', a, 0.0)),
+ (('inot', ('f2b32', a)), ('feq', a, 0.0)),
# Ironically, mark these as imprecise because removing the conversions may
# preserve more precision than doing the conversions (e.g.,
@@ -752,8 +752,8 @@ for left, right in itertools.combinations_with_replacement(invert.keys(), 2):
('ior', (invert[left], a, b), (invert[right], c, d))))
# Optimize x2yN(b2x(x)) -> b2y
-optimizations.append((('f2b', ('b2f', 'a at 32')), a))
-optimizations.append((('i2b', ('b2i', 'a at 32')), a))
+optimizations.append((('f2b32', ('b2f', 'a at 32')), a))
+optimizations.append((('i2b32', ('b2i', 'a at 32')), a))
for x, y in itertools.product(['f', 'u', 'i'], ['f', 'u', 'i']):
if x != 'f' and y != 'f' and x != y:
continue
@@ -914,7 +914,7 @@ late_optimizations = [
(('fmax', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmax', a, b))),
# Lowered for backends without a dedicated b2f instruction
- (('b2f at 32', 'a at 32'), ('iand', a, 1.0), 'options->lower_b2f'),
+ (('b2f32', 'a at 32'), ('iand', a, 1.0), 'options->lower_b2f'),
]
print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())
--
2.19.1
More information about the mesa-dev
mailing list