From b1b4ce7be2c5025a6b4d1169a1b12e99fcfd4390 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 25 Jun 2021 16:51:22 +0200 Subject: [PATCH] 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: --- src/freedreno/ir3/ir3.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index e181439..23762bd 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -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; -- 2.7.4