diff options
-rw-r--r-- | src/glsl/nir/nir.h | 2 | ||||
-rw-r--r-- | src/glsl/nir/nir_opt_algebraic.py | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index e844e4daef8..653123780ff 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1382,6 +1382,8 @@ typedef struct nir_shader_compiler_options { bool lower_fsqrt; /** lowers fneg and ineg to fsub and isub. */ bool lower_negate; + /** lowers fsub and isub to fadd+fneg and iadd+ineg. */ + bool lower_sub; /* lower {slt,sge,seq,sne} to {flt,fge,feq,fne} + b2f: */ bool lower_scmp; diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index a8c1745d09b..319732dfca7 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -192,8 +192,8 @@ optimizations = [ # Subtracts (('fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)), (('isub', a, ('isub', 0, b)), ('iadd', a, b)), - (('fsub', a, b), ('fadd', a, ('fneg', b)), '!options->lower_negate'), - (('isub', a, b), ('iadd', a, ('ineg', b)), '!options->lower_negate'), + (('fsub', a, b), ('fadd', a, ('fneg', b)), 'options->lower_sub'), + (('isub', a, b), ('iadd', a, ('ineg', b)), 'options->lower_sub'), (('fneg', a), ('fsub', 0.0, a), 'options->lower_negate'), (('ineg', a), ('isub', 0, a), 'options->lower_negate'), (('fadd', a, ('fsub', 0.0, b)), ('fsub', a, b)), diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index e52c44e3f6d..d4a7d3de7a7 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -558,6 +558,7 @@ brw_initialize_context_constants(struct brw_context *brw) * re-combine them as a later step. */ .lower_ffma = true, + .lower_sub = true, }; /* We want the GLSL compiler to emit code that uses condition codes */ |