i965/fs: Optimize OR with identical sources into a MOV.
authorMatt Turner <mattst88@gmail.com>
Mon, 28 Oct 2013 02:34:48 +0000 (19:34 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 1 Nov 2013 22:21:07 +0000 (15:21 -0700)
Helps a lot of Steam games.

total instructions in shared programs: 1409360 -> 1409124 (-0.02%)
instructions in affected programs:     20842 -> 20606 (-1.13%)

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.cpp

index 236e86c7cc21e37d9eb39a292939066bcf7d60eb..2350cd097c5c4f19b58a767b1ebce5aed152e792 100644 (file)
@@ -1872,6 +1872,14 @@ fs_visitor::opt_algebraic()
             break;
          }
          break;
+      case BRW_OPCODE_OR:
+         if (inst->src[0].equals(inst->src[1])) {
+            inst->opcode = BRW_OPCODE_MOV;
+            inst->src[1] = reg_undef;
+            progress = true;
+            break;
+         }
+         break;
       default:
         break;
       }