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

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


This starts coming up with the array indexing math I'm about to add.
---
 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 9851ad4..796a361 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1429,8 +1429,11 @@ fs_visitor::opt_algebraic()
             continue;
 
          /* a + 0.0 = a */
-         if (inst->src[1].type == BRW_REGISTER_TYPE_F &&
-             inst->src[1].imm.f == 0.0) {
+         if ((inst->src[1].type == BRW_REGISTER_TYPE_F &&
+              inst->src[1].imm.f == 0.0) ||
+             ((inst->src[1].type == BRW_REGISTER_TYPE_D ||
+               inst->src[1].type == BRW_REGISTER_TYPE_UD) &&
+              inst->src[1].imm.u == 0)) {
             inst->opcode = BRW_OPCODE_MOV;
             inst->src[1] = reg_undef;
             progress = true;
-- 
1.7.10.4



More information about the mesa-dev mailing list