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 <robdclark@gmail.com>
*/
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))
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)