Skip to content

Commit 95f00da

Browse files
committed
Handle more cases
1 parent e3e66d4 commit 95f00da

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

src/mono/mono/mini/intrinsics.c

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,17 @@ MONO_RESTORE_WARNING
710710
opcode = (tto_type == MONO_TYPE_I2) ? OP_ICONV_TO_I2 : OP_ICONV_TO_U2;
711711
tto_stack = STACK_I4;
712712
} else if (size == 4) {
713+
#if TARGET_SIZEOF_VOID_P == 4
714+
if (tto_type == MONO_TYPE_I)
715+
tto_type = MONO_TYPE_I4;
716+
else if (tto_type == MONO_TYPE_U)
717+
tto_type = MONO_TYPE_U4;
718+
719+
if (tfrom_type == MONO_TYPE_I)
720+
tfrom_type = MONO_TYPE_I4;
721+
else if (tfrom_type == MONO_TYPE_U)
722+
tfrom_type = MONO_TYPE_U4;
723+
#endif
713724
if ((tfrom_type == MONO_TYPE_R4) && ((tto_type == MONO_TYPE_I4) || (tto_type == MONO_TYPE_U4))) {
714725
opcode = OP_MOVE_F_TO_I4;
715726
tto_stack = STACK_I4;
@@ -722,23 +733,30 @@ MONO_RESTORE_WARNING
722733
}
723734
} else if (size == 8) {
724735
#if TARGET_SIZEOF_VOID_P == 8
725-
if ((tfrom_type == MONO_TYPE_R8) && ((tto_type == MONO_TYPE_I8) || (tto_type == MONO_TYPE_U8))) {
726-
opcode = OP_MOVE_F_TO_I8;
727-
tto_stack = STACK_I8;
728-
} else if ((tto_type == MONO_TYPE_R8) && ((tfrom_type == MONO_TYPE_I8) || (tfrom_type == MONO_TYPE_U8))) {
729-
opcode = OP_MOVE_I8_TO_F;
730-
tto_stack = STACK_R8;
731-
} else {
732-
opcode = OP_MOVE;
733-
tto_stack = STACK_I8;
734-
}
735-
#else
736-
return NULL;
736+
if (tto_type == MONO_TYPE_I)
737+
tto_type = MONO_TYPE_I8;
738+
else if (tto_type == MONO_TYPE_U)
739+
tto_type = MONO_TYPE_U8;
740+
741+
if (tfrom_type == MONO_TYPE_I)
742+
tfrom_type = MONO_TYPE_I8;
743+
else if (tfrom_type == MONO_TYPE_U)
744+
tfrom_type = MONO_TYPE_U8;
737745
#endif
746+
if ((tfrom_type == MONO_TYPE_R8) && ((tto_type == MONO_TYPE_I8) || (tto_type == MONO_TYPE_U8))) {
747+
opcode = OP_MOVE_F_TO_I8;
748+
tto_stack = STACK_I8;
749+
} else if ((tto_type == MONO_TYPE_R8) && ((tfrom_type == MONO_TYPE_I8) || (tfrom_type == MONO_TYPE_U8))) {
750+
opcode = OP_MOVE_I8_TO_F;
751+
tto_stack = STACK_R8;
752+
} else {
753+
opcode = OP_MOVE;
754+
tto_stack = STACK_I8;
755+
}
738756
}
739757
} else if (mini_class_is_simd (cfg, tfrom_klass) && mini_class_is_simd (cfg, tto_klass)) {
740-
opcode = OP_XCAST;
741-
tto_stack = STACK_VTYPE;
758+
opcode = OP_XCAST;
759+
tto_stack = STACK_VTYPE;
742760
}
743761

744762
if (opcode == OP_LDADDR) {

0 commit comments

Comments
 (0)