From 5f41d052bf53e32761fb528f4be99a1af3a33ebc Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 19 Sep 2014 20:36:52 -0700 Subject: i965/fs: Make fs_reg::effective_width take fs_inst* instead of fs_visitor* Now that we have execution sizes, we can use that instead of the dispatch width. This way it also works for 8-wide instructions in SIMD16. i965/fs: Make effective_width a variable instead of a function i965/fs: Preserve effective width in constant propagation Signed-off-by: Jason Ekstrand Reviewed-by: Matt Turner --- .../drivers/dri/i965/brw_fs_copy_propagation.cpp | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp') 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 b4f4431..322debf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -450,9 +450,12 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) if (inst->src[i].negate || inst->src[i].abs) continue; + fs_reg val = entry->src; + val.effective_width = inst->src[i].effective_width; + switch (inst->opcode) { case BRW_OPCODE_MOV: - inst->src[i] = entry->src; + inst->src[i] = val; progress = true; break; @@ -468,7 +471,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) case BRW_OPCODE_SHR: case BRW_OPCODE_SUBB: if (i == 1) { - inst->src[i] = entry->src; + inst->src[i] = val; progress = true; } break; @@ -481,7 +484,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) case BRW_OPCODE_XOR: case BRW_OPCODE_ADDC: if (i == 1) { - inst->src[i] = entry->src; + inst->src[i] = val; progress = true; } else if (i == 0 && inst->src[1].file != IMM) { /* Fit this constant in by commuting the operands. @@ -494,7 +497,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) inst->src[1].type == BRW_REGISTER_TYPE_UD)) break; inst->src[0] = inst->src[1]; - inst->src[1] = entry->src; + inst->src[1] = val; progress = true; } break; @@ -502,7 +505,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) case BRW_OPCODE_CMP: case BRW_OPCODE_IF: if (i == 1) { - inst->src[i] = entry->src; + inst->src[i] = val; progress = true; } else if (i == 0 && inst->src[1].file != IMM) { enum brw_conditional_mod new_cmod; @@ -513,7 +516,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) * flipping the test */ inst->src[0] = inst->src[1]; - inst->src[1] = entry->src; + inst->src[1] = val; inst->conditional_mod = new_cmod; progress = true; } @@ -522,11 +525,11 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) case BRW_OPCODE_SEL: if (i == 1) { - inst->src[i] = entry->src; + inst->src[i] = val; progress = true; } else if (i == 0 && inst->src[1].file != IMM) { inst->src[0] = inst->src[1]; - inst->src[1] = entry->src; + inst->src[1] = val; /* If this was predicated, flipping operands means * we also need to flip the predicate. @@ -548,14 +551,14 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) assert(i == 0); if (inst->src[0].fixed_hw_reg.dw1.f != 0.0f) { inst->opcode = BRW_OPCODE_MOV; - inst->src[0] = entry->src; + inst->src[0] = val; inst->src[0].fixed_hw_reg.dw1.f = 1.0f / inst->src[0].fixed_hw_reg.dw1.f; progress = true; } break; case FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD: - inst->src[i] = entry->src; + inst->src[i] = val; progress = true; break; @@ -639,13 +642,13 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block, inst->dst.file == GRF) { int offset = 0; for (int i = 0; i < inst->sources; i++) { - int regs_written = ((inst->src[i].effective_width(this) * + int regs_written = ((inst->src[i].effective_width * type_sz(inst->src[i].type)) + 31) / 32; if (inst->src[i].file == GRF) { acp_entry *entry = ralloc(copy_prop_ctx, acp_entry); entry->dst = inst->dst; entry->dst.reg_offset = offset; - entry->dst.width = inst->src[i].effective_width(this); + entry->dst.width = inst->src[i].effective_width; entry->src = inst->src[i]; entry->regs_written = regs_written; entry->opcode = inst->opcode; -- cgit v1.1