ir3/cp: Support swapping mad srcs for shared regs

This was missed when adding shared reg constraints, and helps with
eliminating extra moves caused by uniform (but not const) mad sources.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22075>
This commit is contained in:
Connor Abbott 2023-03-15 17:25:36 +01:00 committed by Marge Bot
parent ef75ea18cd
commit 0f62203edf
1 changed files with 3 additions and 1 deletions

View File

@ -280,7 +280,7 @@ try_swap_mad_two_srcs(struct ir3_instruction *instr, unsigned new_flags)
/* If the reason we couldn't fold without swapping is something
* other than const source, then swapping won't help:
*/
if (!(new_flags & IR3_REG_CONST))
if (!(new_flags & (IR3_REG_CONST | IR3_REG_SHARED)))
return false;
instr->cat3.swapped = true;
@ -338,6 +338,8 @@ reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr,
unuse(src);
reg->def->instr->use_count++;
return true;
} else if (n == 1 && try_swap_mad_two_srcs(instr, new_flags)) {
return true;
}
} else if ((is_same_type_mov(src) || is_const_mov(src)) &&