[Mesa-dev] [PATCH 13/15] i965/fs: Optimize OR with identical sources into a MOV.

Matt Turner mattst88 at gmail.com
Mon Oct 28 19:31:37 CET 2013


Helps a lot of Steam games.

total instructions in shared programs: 1287432 -> 1287130 (-0.02%)
instructions in affected programs:     21447 -> 21145 (-1.41%)
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 2821170..e709b3e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1897,6 +1897,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;
       }
-- 
1.8.3.2



More information about the mesa-dev mailing list