diff options
author | Erico Nunes <[email protected]> | 2019-04-16 22:49:41 +0200 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-04-19 15:42:23 +0000 |
commit | 4577eb7b7cddb0a5dd2ee77682eab01a4d55676b (patch) | |
tree | e78a233f7f588e52eb8f59dc766e1c8990151693 /src/compiler/nir/nir_opt_algebraic.py | |
parent | f9c594cdf5a69aabe2dfb8e6f61224cc2ff7b149 (diff) |
nir/algebraic: add lowering for fsign
The mali utgard pp doesn't support a sign instruction.
In the ARM offline shader compiler, the sign function is implemented
using sub(gt(0.0, a), lt(0.0, a)).
This is a generic optimization, so implement it in the nir level when
lower_fsign is set, alongside the lowering for isign.
Signed-off-by: Erico Nunes <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index b0914aca395..dad0545594f 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -840,6 +840,7 @@ optimizations.extend([ 'options->lower_unpack_snorm_4x8'), (('isign', a), ('imin', ('imax', a, -1), 1), 'options->lower_isign'), + (('fsign', a), ('fsub', ('b2f', ('flt', 0.0, a)), ('b2f', ('flt', a, 0.0))), 'options->lower_fsign'), ]) # bit_size dependent lowerings |