Mesa (master): i965/vec4: Perform CSE on MOV ..., VF instructions.

Matt Turner mattst88 at kemper.freedesktop.org
Mon Dec 29 20:15:45 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Apr  3 14:29:30 2014 -0700

i965/vec4: Perform CSE on MOV ..., VF instructions.

Port of commit a28ad9d4 from the fs backend.

No shader-db changes since we don't emit MOV ..., VF instructions yet.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/i965/brw_vec4_cse.cpp |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 7071213..37c930c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
@@ -48,6 +48,7 @@ static bool
 is_expression(const vec4_instruction *const inst)
 {
    switch (inst->opcode) {
+   case BRW_OPCODE_MOV:
    case BRW_OPCODE_SEL:
    case BRW_OPCODE_NOT:
    case BRW_OPCODE_AND:
@@ -154,11 +155,16 @@ vec4_visitor::opt_cse_local(bblock_t *block)
          }
 
          if (!found) {
-            /* Our first sighting of this expression.  Create an entry. */
-            aeb_entry *entry = ralloc(cse_ctx, aeb_entry);
-            entry->tmp = src_reg(); /* file will be BAD_FILE */
-            entry->generator = inst;
-            aeb.push_tail(entry);
+            if (inst->opcode != BRW_OPCODE_MOV ||
+                (inst->opcode == BRW_OPCODE_MOV &&
+                 inst->src[0].file == IMM &&
+                 inst->src[0].type == BRW_REGISTER_TYPE_VF)) {
+               /* Our first sighting of this expression.  Create an entry. */
+               aeb_entry *entry = ralloc(cse_ctx, aeb_entry);
+               entry->tmp = src_reg(); /* file will be BAD_FILE */
+               entry->generator = inst;
+               aeb.push_tail(entry);
+            }
          } else {
             /* This is at least our second sighting of this expression.
              * If we don't have a temporary already, make one.




More information about the mesa-commit mailing list