aco: swap the correct v_mov_b32 if there are two of them

Previously, this function tried to swap the instruction which is not
v_mov_b32, so that it doesn't introduce any new OPY-only instructions. If
both were v_mov_b32, it swapped Y. Since this makes Y opy-only, this can't
be done if X is also opy-only.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 408fa33c09 ("aco/gfx12: don't use second VALU for VOPD's OPX if there is a WaR")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13101
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34841>
This commit is contained in:
Rhys Perry 2025-05-06 16:47:44 +01:00 committed by Marge Bot
parent 2f4f9f0b98
commit 9ca71b52aa

View file

@ -808,13 +808,17 @@ create_vopd_instruction(const SchedILPContext& ctx, unsigned idx, unsigned compa
if (compat & vopd_need_swap) {
assert(x_info.is_commutative || y_info.is_commutative);
/* Avoid swapping v_mov_b32 because it will become an OPY-only opcode. */
if (x_info.op == aco_opcode::v_dual_mov_b32 && !y_info.is_commutative) {
if (x_info.op == aco_opcode::v_dual_mov_b32 && y_info.op == aco_opcode::v_dual_mov_b32) {
swap_x = !x_info.can_be_opx;
swap_y = !swap_x;
} else if (x_info.op == aco_opcode::v_dual_mov_b32 && !y_info.is_commutative) {
swap_x = true;
x_info.can_be_opx = false;
} else {
swap_x = x_info.is_commutative && x_info.op != aco_opcode::v_dual_mov_b32;
swap_y = y_info.is_commutative && !swap_x;
}
y_info.can_be_opx &= !swap_y || y_info.op != aco_opcode::v_dual_mov_b32;
}
if (!x_info.can_be_opx) {