From afa9fc15613c3ebdc59245c9d4d8c1280b2a2a37 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Feb 2015 12:24:38 -0800 Subject: [PATCH] nir: Add optional lowering of flrp. Reviewed-by: Matt Turner Reviewed-by: Connor Abbott --- src/glsl/nir/nir.h | 1 + src/glsl/nir/nir_opt_algebraic.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 29fe942431c..7b886e3d36f 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1365,6 +1365,7 @@ typedef struct nir_function { typedef struct nir_shader_compiler_options { bool lower_ffma; + bool lower_flrp; bool lower_fpow; bool lower_fsat; bool lower_fsqrt; diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 1ee51a05f80..20ec4d3a39a 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -75,6 +75,7 @@ optimizations = [ (('flrp', a, b, 1.0), b), (('flrp', a, a, b), a), (('flrp', 0.0, a, b), ('fmul', a, b)), + (('flrp', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp'), (('ffma', a, b, c), ('fadd', ('fmul', a, b), c), 'options->lower_ffma'), (('fadd', ('fmul', a, b), c), ('ffma', a, b, c), '!options->lower_ffma'), # Comparison simplifications -- 2.30.2