aco: Fix swapping sources in SOPC -> SOPK optimization.

Fixes: 2d6b0a4177 ("aco/optimizer: Optimize SOPC with literal to SOPK.")

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17407>
This commit is contained in:
Georg Lehmann 2022-07-07 23:54:39 +02:00 committed by Marge Bot
parent 27526ffad1
commit 68db0a079b

View file

@ -4583,7 +4583,7 @@ sopc_is_signed(aco_opcode opcode)
}
static aco_opcode
sopc_32_inverse(aco_opcode opcode)
sopc_32_swapped(aco_opcode opcode)
{
#define SOPC(op1, op2) \
case aco_opcode::s_cmp_##op1##_i32: return aco_opcode::s_cmp_##op2##_i32; \
@ -4591,10 +4591,10 @@ sopc_32_inverse(aco_opcode opcode)
switch (opcode) {
SOPC(eq, eq)
SOPC(lg, lg)
SOPC(gt, le)
SOPC(ge, lt)
SOPC(lt, ge)
SOPC(le, gt)
SOPC(gt, lt)
SOPC(ge, le)
SOPC(lt, gt)
SOPC(le, ge)
default: return aco_opcode::num_opcodes;
}
#undef SOPC
@ -4608,7 +4608,7 @@ try_convert_sopc_to_sopk(aco_ptr<Instruction>& instr)
if (instr->operands[0].isLiteral()) {
std::swap(instr->operands[0], instr->operands[1]);
instr->opcode = sopc_32_inverse(instr->opcode);
instr->opcode = sopc_32_swapped(instr->opcode);
}
if (!instr->operands[1].isLiteral())