mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
aco: disable some instruction combining if it could change an exec operand
Found by observation. No pipeline-db changes. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3599>
This commit is contained in:
parent
e9f83185a2
commit
d45e9451cf
1 changed files with 13 additions and 2 deletions
|
|
@ -665,6 +665,11 @@ Operand get_constant_op(opt_ctx &ctx, uint32_t val, bool is64bit = false)
|
|||
return op;
|
||||
}
|
||||
|
||||
bool fixed_to_exec(Operand op)
|
||||
{
|
||||
return op.isFixed() && op.physReg() == exec;
|
||||
}
|
||||
|
||||
void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
|
||||
{
|
||||
if (instr->isSALU() || instr->isVALU() || instr->format == Format::PSEUDO) {
|
||||
|
|
@ -1155,7 +1160,7 @@ void label_instruction(opt_ctx &ctx, Block& block, aco_ptr<Instruction>& instr)
|
|||
break;
|
||||
case aco_opcode::s_and_b32:
|
||||
case aco_opcode::s_and_b64:
|
||||
if (instr->operands[1].isFixed() && instr->operands[1].physReg() == exec && instr->operands[0].isTemp()) {
|
||||
if (fixed_to_exec(instr->operands[1]) && instr->operands[0].isTemp()) {
|
||||
if (ctx.info[instr->operands[0].tempId()].is_uniform_bool()) {
|
||||
/* Try to get rid of the superfluous s_cselect + s_and_b64 that comes from turning a uniform bool into divergent */
|
||||
ctx.info[instr->definitions[1].tempId()].set_temp(ctx.info[instr->operands[0].tempId()].temp);
|
||||
|
|
@ -1640,6 +1645,8 @@ bool match_op3_for_vop3(opt_ctx &ctx, aco_opcode op1, aco_opcode op2,
|
|||
Instruction *op2_instr = follow_operand(ctx, op1_instr->operands[swap]);
|
||||
if (!op2_instr || op2_instr->opcode != op2)
|
||||
return false;
|
||||
if (fixed_to_exec(op2_instr->operands[0]) || fixed_to_exec(op2_instr->operands[1]))
|
||||
return false;
|
||||
|
||||
VOP3A_instruction *op1_vop3 = op1_instr->isVOP3() ? static_cast<VOP3A_instruction *>(op1_instr) : NULL;
|
||||
VOP3A_instruction *op2_vop3 = op2_instr->isVOP3() ? static_cast<VOP3A_instruction *>(op2_instr) : NULL;
|
||||
|
|
@ -1851,6 +1858,8 @@ bool combine_salu_n2(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
Instruction *op2_instr = follow_operand(ctx, instr->operands[i]);
|
||||
if (!op2_instr || (op2_instr->opcode != aco_opcode::s_not_b32 && op2_instr->opcode != aco_opcode::s_not_b64))
|
||||
continue;
|
||||
if (fixed_to_exec(op2_instr->operands[0]))
|
||||
continue;
|
||||
|
||||
if (instr->operands[!i].isLiteral() && op2_instr->operands[0].isLiteral() &&
|
||||
instr->operands[!i].constantValue() != op2_instr->operands[0].constantValue())
|
||||
|
|
@ -1891,7 +1900,9 @@ bool combine_salu_lshl_add(opt_ctx& ctx, aco_ptr<Instruction>& instr)
|
|||
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
Instruction *op2_instr = follow_operand(ctx, instr->operands[i]);
|
||||
if (!op2_instr || op2_instr->opcode != aco_opcode::s_lshl_b32 || !op2_instr->operands[1].isConstant())
|
||||
if (!op2_instr || op2_instr->opcode != aco_opcode::s_lshl_b32)
|
||||
continue;
|
||||
if (!op2_instr->operands[1].isConstant() || fixed_to_exec(op2_instr->operands[0]))
|
||||
continue;
|
||||
|
||||
uint32_t shift = op2_instr->operands[1].constantValue();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue