Mesa (master): i965: Also do constant propagation for the second operand of CMP.

Eric Anholt anholt at kemper.freedesktop.org
Wed Oct 6 16:35:32 UTC 2010


Module: Mesa
Branch: master
Commit: 634abbf7b2e6ea21db30aafc0de9472ee31d4173
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=634abbf7b2e6ea21db30aafc0de9472ee31d4173

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Oct  5 10:25:22 2010 -0700

i965: Also do constant propagation for the second operand of CMP.

We could do the first operand as well by flipping the comparison, but
this covered several CMPs in code I was looking at.

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0c9f17f..914141a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2607,6 +2607,11 @@ fs_visitor::propagate_constants()
 		  scan_inst->src[1] = inst->src[0];
 	       }
 	       break;
+	    case BRW_OPCODE_CMP:
+	       if (i == 1) {
+		  scan_inst->src[i] = inst->src[0];
+		  progress = true;
+	       }
 	    }
 	 }
 




More information about the mesa-commit mailing list