aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-02-06 13:12:25 -0800
committerEric Anholt <[email protected]>2019-02-14 00:32:30 +0000
commit42d2cae90750360922ce1ca5af5609a1b661e669 (patch)
treeaca8adc6d7a54018811b1f1d1bf7c8986ad880e3
parent68baf96824a5a02f7ed82cd6b90eefc402ef83eb (diff)
nir: Move panfrost's isign lowering to nir_opt_algebraic.
I wanted to reuse this from v3d. Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/compiler/nir/nir.h3
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
-rw-r--r--src/gallium/drivers/panfrost/midgard/midgard_compile.h1
-rw-r--r--src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py1
4 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 353a1604785..94ca6c46468 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2156,6 +2156,9 @@ typedef struct nir_shader_compiler_options {
/** enables rules to lower idiv by power-of-two: */
bool lower_idiv;
+ /** enables rules to lower isign to imin+imax */
+ bool lower_isign;
+
/* Does the native fdot instruction replicate its result for four
* components? If so, then opt_algebraic_late will turn all fdotN
* instructions into fdot_replicatedN instructions.
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 75a3d2ad238..11d6aca1183 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -758,6 +758,8 @@ optimizations = [
('extract_i8', 'v', 3))),
127.0))),
'options->lower_unpack_snorm_4x8'),
+
+ (('isign', a), ('imin', ('imax', a, -1), 1), 'options->lower_isign'),
]
invert = OrderedDict([('feq', 'fne'), ('fne', 'feq'), ('fge', 'flt'), ('flt', 'fge')])
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.h b/src/gallium/drivers/panfrost/midgard/midgard_compile.h
index 887fd4e746f..2fcbc317164 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.h
@@ -71,6 +71,7 @@ static const nir_shader_compiler_options midgard_nir_options = {
.lower_fmod64 = true,
.lower_fdiv = true,
.lower_idiv = true,
+ .lower_isign = true,
.vertex_id_zero_based = true,
.lower_extract_byte = true,
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py b/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py
index 44441727b78..07ea427359b 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py
+++ b/src/gallium/drivers/panfrost/midgard/midgard_nir_algebraic.py
@@ -31,7 +31,6 @@ b = 'b'
algebraic = [
(('b2i32', a), ('iand@32', "a@32", 1)),
- (('isign', a), ('imin', ('imax', a, -1), 1)),
(('fge', a, b), ('flt', b, a)),
# XXX: We have hw ops for this, just unknown atm..