Mesa (master): i965/vec4: Constant propagate into 2-src math instructions on Gen8.

Matt Turner mattst88 at kemper.freedesktop.org
Wed Jun 25 20:02:05 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Jun 23 22:07:38 2014 -0700

i965/vec4: Constant propagate into 2-src math instructions on Gen8.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 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 11571ad..278ec7b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -73,7 +73,8 @@ is_channel_updated(vec4_instruction *inst, src_reg *values[4], int ch)
 }
 
 static bool
-try_constant_propagation(vec4_instruction *inst, int arg, src_reg *values[4])
+try_constant_propagation(struct brw_context *brw, vec4_instruction *inst,
+                         int arg, src_reg *values[4])
 {
    /* For constant propagation, we only handle the same constant
     * across all 4 channels.  Some day, we should handle the 8-bit
@@ -110,6 +111,12 @@ try_constant_propagation(vec4_instruction *inst, int arg, src_reg *values[4])
       inst->src[arg] = value;
       return true;
 
+   case SHADER_OPCODE_POW:
+   case SHADER_OPCODE_INT_QUOTIENT:
+   case SHADER_OPCODE_INT_REMAINDER:
+      if (brw->gen < 8)
+         break;
+      /* fallthrough */
    case BRW_OPCODE_DP2:
    case BRW_OPCODE_DP3:
    case BRW_OPCODE_DP4:
@@ -360,7 +367,7 @@ vec4_visitor::opt_copy_propagation()
 	 if (c != 4)
 	    continue;
 
-	 if (try_constant_propagation(inst, i, values) ||
+	 if (try_constant_propagation(brw, inst, i, values) ||
 	     try_copy_propagation(inst, i, values))
 	    progress = true;
       }




More information about the mesa-commit mailing list