[Mesa-dev] [PATCH 4/4] nir: Allow abs/neg in select peephole pass.

Jason Ekstrand jason at jlekstrand.net
Thu Apr 2 21:05:25 PDT 2015


From: Matt Turner <mattst88 at gmail.com>

total instructions in shared programs: 4314633 -> 4309085 (-0.13%)
instructions in affected programs:     429085 -> 423537 (-1.29%)
helped:                                1680
HURT:                                  0
GAINED:                                0
LOST:                                  111

---
I did some looking and it seems like all the programs we lost are in talos
principle and serious sam and seem to pretty much all be programs that we
didn't have in GLSL IR anyway.  Unfortunately, I haven't had a chance to
figure out exactly why we lost them.

 src/glsl/nir/nir_opt_peephole_select.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir_opt_peephole_select.c b/src/glsl/nir/nir_opt_peephole_select.c
index b89451b..f400cfd 100644
--- a/src/glsl/nir/nir_opt_peephole_select.c
+++ b/src/glsl/nir/nir_opt_peephole_select.c
@@ -84,7 +84,9 @@ block_check_for_allowed_instrs(nir_block *block)
       case nir_instr_type_alu: {
          /* It must be a move operation */
          nir_alu_instr *mov = nir_instr_as_alu(instr);
-         if (mov->op != nir_op_fmov && mov->op != nir_op_imov)
+         if (mov->op != nir_op_fmov && mov->op != nir_op_imov &&
+             mov->op != nir_op_fneg && mov->op != nir_op_ineg &&
+             mov->op != nir_op_fabs && mov->op != nir_op_iabs)
             return false;
 
          /* Can't handle saturate */
-- 
2.3.4



More information about the mesa-dev mailing list