i965/fs: Optimize LRP with x == y into a MOV.
authorMatt Turner <mattst88@gmail.com>
Fri, 10 Jan 2014 04:57:36 +0000 (20:57 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 21 Jan 2014 22:20:44 +0000 (14:20 -0800)
total instructions in shared programs: 1487331 -> 1485988 (-0.09%)
instructions in affected programs:     45638 -> 44295 (-2.94%)
GAINED:                                7
LOST:                                  0

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/drivers/dri/i965/brw_fs.cpp

index 4a96126bac566d0eda0e3217454981472dd720d9..78ddf0d99cf9588d9b572110a5af1bfa22248230 100644 (file)
@@ -2000,6 +2000,16 @@ fs_visitor::opt_algebraic()
             break;
          }
          break;
+      case BRW_OPCODE_LRP:
+         if (inst->src[1].equals(inst->src[2])) {
+            inst->opcode = BRW_OPCODE_MOV;
+            inst->src[0] = inst->src[1];
+            inst->src[1] = reg_undef;
+            inst->src[2] = reg_undef;
+            progress = true;
+            break;
+         }
+         break;
       case BRW_OPCODE_SEL:
          if (inst->saturate && inst->src[1].file == IMM) {
             switch (inst->conditional_mod) {