nir: Move panfrost's isign lowering to nir_opt_algebraic.

I wanted to reuse this from v3d.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Eric Anholt
2019-02-06 13:12:25 -08:00
parent 68baf96824
commit 42d2cae907
4 changed files with 6 additions and 1 deletions

View File

@@ -2156,6 +2156,9 @@ typedef struct nir_shader_compiler_options {
/** enables rules to lower idiv by power-of-two: */ /** enables rules to lower idiv by power-of-two: */
bool lower_idiv; bool lower_idiv;
/** enables rules to lower isign to imin+imax */
bool lower_isign;
/* Does the native fdot instruction replicate its result for four /* Does the native fdot instruction replicate its result for four
* components? If so, then opt_algebraic_late will turn all fdotN * components? If so, then opt_algebraic_late will turn all fdotN
* instructions into fdot_replicatedN instructions. * instructions into fdot_replicatedN instructions.

View File

@@ -758,6 +758,8 @@ optimizations = [
('extract_i8', 'v', 3))), ('extract_i8', 'v', 3))),
127.0))), 127.0))),
'options->lower_unpack_snorm_4x8'), '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')]) invert = OrderedDict([('feq', 'fne'), ('fne', 'feq'), ('fge', 'flt'), ('flt', 'fge')])

View File

@@ -71,6 +71,7 @@ static const nir_shader_compiler_options midgard_nir_options = {
.lower_fmod64 = true, .lower_fmod64 = true,
.lower_fdiv = true, .lower_fdiv = true,
.lower_idiv = true, .lower_idiv = true,
.lower_isign = true,
.vertex_id_zero_based = true, .vertex_id_zero_based = true,
.lower_extract_byte = true, .lower_extract_byte = true,

View File

@@ -31,7 +31,6 @@ b = 'b'
algebraic = [ algebraic = [
(('b2i32', a), ('iand@32', "a@32", 1)), (('b2i32', a), ('iand@32', "a@32", 1)),
(('isign', a), ('imin', ('imax', a, -1), 1)),
(('fge', a, b), ('flt', b, a)), (('fge', a, b), ('flt', b, a)),
# XXX: We have hw ops for this, just unknown atm.. # XXX: We have hw ops for this, just unknown atm..