Skip to content

Commit

Permalink
Fix dessa swap of register with different types
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed May 7, 2024
1 parent b0a34ae commit 3553ef1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ir_emit.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,9 @@ IR_ALWAYS_INLINE void ir_dessa_resolve_cycle(ir_ctx *ctx, int32_t *pred, int32_t
#ifdef IR_HAVE_SWAP_INT
if (pred[from] == to && to < IR_REG_NUM && from < IR_REG_NUM) {
/* a simple cycle from 2 elements */
if (ir_type_size[types[to]] > ir_type_size[type]) {
type = types[to];
}
ir_emit_swap(ctx, type, to, from);
ir_bitset_excl(todo, from);
ir_bitset_excl(todo, to);
Expand All @@ -713,7 +716,7 @@ IR_ALWAYS_INLINE void ir_dessa_resolve_cycle(ir_ctx *ctx, int32_t *pred, int32_t
}
} else {
#ifdef IR_HAVE_SWAP_FP
if (pred[from] == to && to < IR_REG_NUM && from < IR_REG_NUM) {
if (pred[from] == to && to < IR_REG_NUM && from < IR_REG_NUM && types[to] == type) {
/* a simple cycle from 2 elements */
ir_emit_swap_fp(ctx, type, to, from);
IR_REGSET_EXCL(todo, from);
Expand Down

0 comments on commit 3553ef1

Please sign in to comment.