diff options
author | Rob Clark <[email protected]> | 2017-10-31 12:21:51 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-11-12 12:28:59 -0500 |
commit | 4c711f4d1898b147b66e1e69b7899d08ec925d0d (patch) | |
tree | 1122de760df7148511b13ced2a1df6538acf2af8 | |
parent | 6da513007474ddee48edf256e435a0fa7a65335d (diff) |
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 <[email protected]>
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3.h | 26 |
1 files 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) |