From 397375d3f353ec5027cb883faf9eb831b48f76f3 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Thu, 20 Jun 2019 21:56:29 -0400 Subject: nir/algebraic: add fdot2 optimizations Add simple fdot2 optimizations that are missing. Signed-off-by: Jonathan Marek Reviewed-by: Thomas Helland Reviewed-by: Ian Romanick Reviewed-by: Matt Turner --- src/compiler/nir/nir_opt_algebraic.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/compiler') 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 -- cgit v1.2.3