[Mesa-dev] [PATCH 2/9] i965/fs: Add support for integer a * 1 -> a in opt_algebraic().

Eric Anholt eric at anholt.net
Mon Nov 12 10:53:07 PST 2012


This also starts showing up with the variable array index support coming up.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 796a361..f5339b8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1405,8 +1405,11 @@ fs_visitor::opt_algebraic()
 	    continue;
 
 	 /* a * 1.0 = a */
-	 if (inst->src[1].type == BRW_REGISTER_TYPE_F &&
-	     inst->src[1].imm.f == 1.0) {
+	 if ((inst->src[1].type == BRW_REGISTER_TYPE_F &&
+              inst->src[1].imm.f == 1.0) ||
+             ((inst->src[1].type == BRW_REGISTER_TYPE_D ||
+               inst->src[1].type == BRW_REGISTER_TYPE_UD) &&
+              inst->src[1].imm.u == 1)) {
 	    inst->opcode = BRW_OPCODE_MOV;
 	    inst->src[1] = reg_undef;
 	    progress = true;
-- 
1.7.10.4



More information about the mesa-dev mailing list