Skip to content

Commit 13d88c6

Browse files
Bring back unused implementation of type conversions (#66597)
1 parent ba5a582 commit 13d88c6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/mono/mono/mini/simd-intrinsics.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,10 @@ static guint16 sri_vector_methods [] = {
859859
SN_ConditionalSelect,
860860
SN_ConvertToDouble,
861861
SN_ConvertToInt32,
862+
SN_ConvertToInt64,
863+
SN_ConvertToSingle,
862864
SN_ConvertToUInt32,
865+
SN_ConvertToUInt64,
863866
SN_Create,
864867
SN_CreateScalar,
865868
SN_CreateScalarUnsafe,
@@ -1049,6 +1052,33 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
10491052
return emit_simd_ins_for_sig (cfg, klass, op, -1, arg0_type, fsig, args);
10501053
#else
10511054
return NULL;
1055+
#endif
1056+
}
1057+
case SN_ConvertToInt64:
1058+
case SN_ConvertToUInt64: {
1059+
#ifdef TARGET_ARM64
1060+
if (arg0_type != MONO_TYPE_R8)
1061+
return NULL;
1062+
MonoClass *arg_class = mono_class_from_mono_type_internal (fsig->params [0]);
1063+
int size = mono_class_value_size (arg_class, NULL);
1064+
int op = -1;
1065+
if (id == SN_ConvertToInt64)
1066+
op = size == 8 ? OP_ARM64_FCVTZS_SCALAR : OP_ARM64_FCVTZS;
1067+
else
1068+
op = size == 8 ? OP_ARM64_FCVTZU_SCALAR : OP_ARM64_FCVTZU;
1069+
return emit_simd_ins_for_sig (cfg, klass, op, -1, arg0_type, fsig, args);
1070+
#else
1071+
return NULL;
1072+
#endif
1073+
}
1074+
case SN_ConvertToSingle: {
1075+
#ifdef TARGET_ARM64
1076+
if ((arg0_type != MONO_TYPE_I4) && (arg0_type != MONO_TYPE_U4))
1077+
return NULL;
1078+
int op = arg0_type == MONO_TYPE_I4 ? OP_ARM64_SCVTF : OP_ARM64_UCVTF;
1079+
return emit_simd_ins_for_sig (cfg, klass, op, -1, arg0_type, fsig, args);
1080+
#else
1081+
return NULL;
10521082
#endif
10531083
}
10541084
case SN_Create: {

0 commit comments

Comments
 (0)