insert_mov(struct ir3_instruction *collect, int idx)
{
struct ir3_instruction *src = ssa(collect->regs[idx+1]);
- struct ir3_instruction *mov = ir3_MOV(src->block, src, TYPE_F32);
+ struct ir3_instruction *mov = ir3_MOV(src->block, src,
+ (collect->regs[idx+1]->flags & IR3_REG_HALF) ? TYPE_U16 : TYPE_U32);
+
collect->regs[idx+1]->instr = mov;
/* if collect and src are in the same block, move the inserted mov
* it should be safe to leave at the end of the block it is in:
*/
if (src->block == collect->block) {
- list_delinit(&mov->node);
- list_addtail(&mov->node, &collect->node);
+ ir3_instr_move_before(mov, collect);
}
}
bool progress = false;
unsigned i;
- struct ir3_instruction *out;
foreach_output (out, ir)
progress |= instr_find_neighbors(out);