diff options
author | Jonathan Marek <[email protected]> | 2019-06-20 21:56:29 -0400 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-07-24 17:36:21 -0400 |
commit | 397375d3f353ec5027cb883faf9eb831b48f76f3 (patch) | |
tree | d38b0759d865fcde2fcd4674541b2ce56a19e573 /src/compiler | |
parent | 1e089d05750cfc9555a421eaa0c44005361ebb4b (diff) |
nir/algebraic: add fdot2 optimizations
Add simple fdot2 optimizations that are missing.
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Thomas Helland <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler')
-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 d57eff2fdde..1ac1e6c64c0 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -191,6 +191,9 @@ optimizations = [ (('fdot3', ('vec3', a, 0.0, 0.0), b), ('fmul', a, b)), (('fdot3', ('vec3', a, b, 0.0), c), ('fdot2', ('vec2', a, b), c)), + (('fdot2', ('vec2', a, 0.0), b), ('fmul', a, b)), + (('fdot2', a, 1.0), ('fadd', 'a.x', 'a.y')), + # If x >= 0 and x <= 1: fsat(1 - x) == 1 - fsat(x) trivially # 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 |