diff options
author | Daniel Schürmann <[email protected]> | 2019-08-14 16:25:26 +0200 |
---|---|---|
committer | Connor Abbott <[email protected]> | 2019-08-21 08:51:49 +0000 |
commit | 7fa17400350b324840de3c742f336aefcd493c47 (patch) | |
tree | 8ea198122bef083e77951945f89545a545bbf14d /src/compiler/nir/nir_opt_algebraic.py | |
parent | 8a2465e3f3fed685611bd5824e955c83c0197a0a (diff) |
nir/algebraic: some subtraction optimizations
Changes with RADV/ACO:
Totals from affected shaders:
SGPRS: 444087 -> 455543 (2.58 %)
VGPRS: 436468 -> 436768 (0.07 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 13448928 -> 13353520 (-0.71 %) bytes
LDS: 0 -> 0 (0.00 %) blocks
Max Waves: 68060 -> 67979 (-0.12 %)
Wait states: 0 -> 0 (0.00 %)
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 26e2fc346ed..beb7f7978f9 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -204,6 +204,7 @@ optimizations = [ # If x < 0: 1 - fsat(x) => 1 - 0 => 1 and fsat(1 - x) => fsat(> 1) => 1 # If x > 1: 1 - fsat(x) => 1 - 1 => 0 and fsat(1 - x) => fsat(< 0) => 0 (('~fadd', ('fneg(is_used_once)', ('fsat(is_used_once)', 'a(is_not_fmul)')), 1.0), ('fsat', ('fadd', 1.0, ('fneg', a)))), + (('~fsub', 1.0, ('fsat', a)), ('fsat', ('fsub', 1.0, a))), # 1 - ((1 - a) * (1 - b)) # 1 - (1 - a - b + a*b) @@ -920,6 +921,8 @@ optimizations.extend([ # Subtracts (('~fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)), (('isub', a, ('isub', 0, b)), ('iadd', a, b)), + (('isub', ('iadd', a, b), b), a), + (('~fsub', ('fadd', a, b), b), a), (('ussub_4x8', a, 0), a), (('ussub_4x8', a, ~0), 0), (('fsub', a, b), ('fadd', a, ('fneg', b)), 'options->lower_sub'), |