}
}
-bool valu_can_accept_literal(opt_ctx& ctx, aco_ptr<Instruction>& instr)
-{
- // TODO: VOP3 can take a literal on GFX10
- return !instr->isSDWA() && !instr->isDPP() && !instr->isVOP3();
-}
-
/* only covers special cases */
bool can_accept_constant(aco_ptr<Instruction>& instr, unsigned operand)
{
}
}
+bool valu_can_accept_literal(opt_ctx& ctx, aco_ptr<Instruction>& instr, unsigned operand)
+{
+ // TODO: VOP3 can take a literal on GFX10
+ return !instr->isSDWA() && !instr->isDPP() && !instr->isVOP3() &&
+ operand == 0 && can_accept_constant(instr, operand);
+}
+
bool parse_base_offset(opt_ctx &ctx, Instruction* instr, unsigned op_index, Temp *base, uint32_t *offset)
{
Operand op = instr->operands[op_index];
if (ctx.uses[instr->operands[literal_idx].tempId()] == 0)
instr->operands[literal_idx] = Operand(ctx.info[instr->operands[literal_idx].tempId()].val);
}
- } else if (instr->isVALU() && valu_can_accept_literal(ctx, instr) &&
+ } else if (instr->isVALU() && valu_can_accept_literal(ctx, instr, 0) &&
instr->operands[0].isTemp() &&
ctx.info[instr->operands[0].tempId()].is_literal() &&
ctx.uses[instr->operands[0].tempId()] < threshold) {