[Mesa-dev] [PATCH 10/15] i965: Allow immediates to be folded into logical and shift instructions.

Matt Turner mattst88 at gmail.com
Fri Aug 23 18:01:59 PDT 2013


On Fri, Aug 23, 2013 at 9:02 AM, Paul Berry <stereotype441 at gmail.com> wrote:
> Shouldn't we make a similar change to brw_vec4_copy_propagation.cpp?

Yes, thanks.

I've folded this change into the patch:

--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -95,9 +95,20 @@ try_constant_propagation(vec4_instruction *inst,
int arg, src_reg *values[4])
       inst->src[arg] = value;
       return true;

+   case BRW_OPCODE_SHL:
+   case BRW_OPCODE_SHR:
+      if (arg == 1) {
+         inst->src[arg] = value;
+         return true;
+      }
+      break;
+
    case BRW_OPCODE_MACH:
    case BRW_OPCODE_MUL:
    case BRW_OPCODE_ADD:
+   case BRW_OPCODE_OR:
+   case BRW_OPCODE_AND:
+   case BRW_OPCODE_XOR:
       if (arg == 1) {
         inst->src[arg] = value;
         return true;

(Don't you love the subtle differences between the vec4 and fs? like
progress = true; ... return progress; vs return true or that it's
try_constant_propagate in the fs backend and try_constant_propagation
in the vec4 backend.)


More information about the mesa-dev mailing list