Just killing the SSA link isn't enough. It confuses RA, legalize,
and postsched to see a bogus unused reg.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3569>
instr_cat5_t *cat5 = ptr;
iassert((instr->regs_count == 2) ||
- (instr->regs_count == 3) || (instr->regs_count == 4));
+ (instr->regs_count == 3) ||
+ (instr->regs_count == 4));
- switch (instr->opc) {
- case OPC_DSX:
- case OPC_DSXPP_1:
- case OPC_DSY:
- case OPC_DSYPP_1:
- case OPC_RGETPOS:
- case OPC_RGETINFO:
- iassert((instr->flags & IR3_INSTR_S2EN) == 0);
- src1 = instr->regs[1];
- src2 = instr->regs_count > 2 ? instr->regs[2] : NULL;
- break;
- default:
+ if (instr->flags & IR3_INSTR_S2EN) {
src1 = instr->regs[2];
src2 = instr->regs_count > 3 ? instr->regs[3] : NULL;
- break;
+ } else {
+ src1 = instr->regs[1];
+ src2 = instr->regs_count > 2 ? instr->regs[2] : NULL;
}
assume(src1 || !src2);
instr->flags &= ~IR3_INSTR_S2EN;
instr->cat5.samp = samp->regs[1]->iim_val;
instr->cat5.tex = tex->regs[1]->iim_val;
- instr->regs[1]->instr = NULL;
+
+ /* shuffle around the regs to remove the first src: */
+ instr->regs_count--;
+ for (unsigned i = 1; i < instr->regs_count; i++) {
+ instr->regs[i] = instr->regs[i + 1];
+ }
}
}
}
for (i = 0; i < instr->regs_count; i++) {
struct ir3_register *reg = instr->regs[i];
- /* skip the samp/tex src if it has been lowered to immed: */
- if ((i == 1) && is_tex(instr) && !(instr->flags & IR3_INSTR_S2EN))
- continue;
-
printf(i ? ", " : "");
print_reg_name(reg);
}