ir3: Actually allow shared reg moves to be folded

I realized that shared registers were never actually getting folded,
even after adding them to valid_flags, because the move wasn't even
being considered.

I looked at the other uses of is_same_type_mov(), and they should be ok
with this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
This commit is contained in:
Connor Abbott 2021-06-25 16:51:22 +02:00 committed by Marge Bot
parent b32188cdba
commit b1b4ce7be2

View file

@ -715,13 +715,17 @@ static inline bool is_nop(struct ir3_instruction *instr)
return instr->opc == OPC_NOP;
}
static inline bool is_same_type_reg(struct ir3_register *reg1,
struct ir3_register *reg2)
static inline bool is_same_type_reg(struct ir3_register *dst,
struct ir3_register *src)
{
unsigned type_reg1 = (reg1->flags & (IR3_REG_SHARED | IR3_REG_HALF));
unsigned type_reg2 = (reg2->flags & (IR3_REG_SHARED | IR3_REG_HALF));
unsigned dst_type = (dst->flags & IR3_REG_HALF);
unsigned src_type = (src->flags & IR3_REG_HALF);
if (type_reg1 ^ type_reg2)
/* Treat shared->normal copies as same-type, because they can generally be
* folded, but not normal->shared copies.
*/
if (dst_type != src_type ||
((dst->flags & IR3_REG_SHARED) && !(src->flags & IR3_REG_SHARED)))
return false;
else
return true;