Mesa (master): i965/fs: Allow constant propagation between different types

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue Jan 13 21:51:09 UTC 2015


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

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Oct 16 11:45:44 2014 -0700

i965/fs: Allow constant propagation between different types

This will be needed for NIR because it is typeless and treats all constants
as uint32 values and reinterprets them when they are used later.  This
commit allows those values to be properly propagated.

Also, this helps some synmark shaders because it allows us to copy
propagate a 0x00000000UD into a 0.0F in a load_payload, which then lets us
combine 4 load_payloads.

instructions in affected programs:     2288 -> 2144 (-6.29%)

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 611cff1..70f417f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -433,8 +433,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
          continue;
 
       assert(entry->dst.file == GRF);
-      if (inst->src[i].reg != entry->dst.reg ||
-          inst->src[i].type != entry->dst.type)
+      if (inst->src[i].reg != entry->dst.reg)
          continue;
 
       /* Bail if inst is reading a range that isn't contained in the range
@@ -454,6 +453,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
 
       fs_reg val = entry->src;
       val.effective_width = inst->src[i].effective_width;
+      val.type = inst->src[i].type;
 
       switch (inst->opcode) {
       case BRW_OPCODE_MOV:




More information about the mesa-commit mailing list