From 4c711f4d1898b147b66e1e69b7899d08ec925d0d Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 31 Oct 2017 12:21:51 -0400 Subject: freedreno/ir3: invert is_same_type_mov() logic Some instructions (like barriers) have no dst, which causes problems with dereferencing a NULL dst. Flip the logic around to reject opc's that can't be a type of move first, to filter out those instructions. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/ir3/ir3.h | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h index 25fddbf00f4..0ff8aba63bd 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3.h +++ b/src/gallium/drivers/freedreno/ir3/ir3.h @@ -569,7 +569,21 @@ static inline bool is_nop(struct ir3_instruction *instr) */ static inline bool is_same_type_mov(struct ir3_instruction *instr) { - struct ir3_register *dst = instr->regs[0]; + struct ir3_register *dst; + + switch (instr->opc) { + case OPC_MOV: + if (instr->cat1.src_type != instr->cat1.dst_type) + return false; + break; + case OPC_ABSNEG_F: + case OPC_ABSNEG_S: + break; + default: + return false; + } + + dst = instr->regs[0]; /* mov's that write to a0.x or p0.x are special: */ if (dst->num == regid(REG_P0, 0)) @@ -580,15 +594,7 @@ static inline bool is_same_type_mov(struct ir3_instruction *instr) if (dst->flags & (IR3_REG_RELATIV | IR3_REG_ARRAY)) return false; - switch (instr->opc) { - case OPC_MOV: - return instr->cat1.src_type == instr->cat1.dst_type; - case OPC_ABSNEG_F: - case OPC_ABSNEG_S: - return true; - default: - return false; - } + return true; } static inline bool is_alu(struct ir3_instruction *instr) -- cgit v1.2.3