Mesa (master): i965/vs: Allow copy propagation on GRFs.

Eric Anholt anholt at kemper.freedesktop.org
Fri Sep 9 05:34:03 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Sep  1 16:43:38 2011 -0700

i965/vs: Allow copy propagation on GRFs.

Further reduces instruction count by 4.0% in 40.7% of the vertex
shaders.

---

 .../drivers/dri/i965/brw_vec4_copy_propagation.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 7862d78..c46735a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -187,6 +187,7 @@ try_copy_propagation(struct intel_context *intel,
    value.swizzle = BRW_SWIZZLE4(s[0], s[1], s[2], s[3]);
 
    if (value.file != UNIFORM &&
+       value.file != GRF &&
        value.file != ATTR)
       return false;
 
@@ -204,6 +205,10 @@ try_copy_propagation(struct intel_context *intel,
    if (intel->gen >= 6 && inst->is_math())
       return false;
 
+   /* Don't report progress if this is a noop. */
+   if (value.equals(&inst->src[arg]))
+      return false;
+
    inst->src[arg] = value;
    return true;
 }
@@ -307,7 +312,7 @@ vec4_visitor::opt_copy_propagation()
 		      cur_value[i][j] &&
 		      cur_value[i][j]->file == GRF &&
 		      cur_value[i][j]->reg == inst->dst.reg &&
-		      cur_value[i][j]->reg == inst->dst.reg) {
+		      cur_value[i][j]->reg_offset == inst->dst.reg_offset) {
 		     cur_value[i][j] = NULL;
 		  }
 	       }




More information about the mesa-commit mailing list