[Mesa-dev] [RFC PATCH] i965/fs: Don't coalesce registers into smaller registers.

Kenneth Graunke kenneth at whitecape.org
Tue Aug 30 16:28:43 PDT 2011


If we detect MOV X Y, register coalescing tries to rewrite future
instructions that use X to use Y instead.  However, if Y is smaller
than X, coalescing could get us into trouble.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

This is probably...kinda bogus.  But it seems like we ought to have
something similar to this.

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 8b85f3b..b419538 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1288,7 +1288,8 @@ fs_visitor::register_coalesce()
 	  inst->saturate ||
 	  inst->dst.file != GRF || (inst->src[0].file != GRF &&
 				    inst->src[0].file != UNIFORM)||
-	  inst->dst.type != inst->src[0].type)
+	  inst->dst.type != inst->src[0].type ||
+	  virtual_grf_sizes[inst->src[0].reg] < virtual_grf_sizes[inst->dst.reg])
 	 continue;
 
       bool has_source_modifiers = inst->src[0].abs || inst->src[0].negate;
-- 
1.7.6.1



More information about the mesa-dev mailing list