From: Jonathan Marek Date: Fri, 21 Jun 2019 01:56:29 +0000 (-0400) Subject: nir/algebraic: add fdot2 optimizations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=397375d3f353ec5027cb883faf9eb831b48f76f3;p=mesa.git 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 --- 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