Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono] Intrinsify Convert* for Vector{64, 128} on ARM64 #65946

Merged
merged 8 commits into from
Mar 7, 2022
30 changes: 30 additions & 0 deletions src/mono/mono/mini/simd-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ static guint16 sri_vector_methods [] = {
SN_AsVector4,
SN_Ceiling,
SN_ConditionalSelect,
SN_ConvertToDouble,
SN_ConvertToInt32,
SN_ConvertToUInt32,
SN_Create,
SN_CreateScalar,
SN_CreateScalarUnsafe,
Expand Down Expand Up @@ -802,6 +805,33 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
return emit_simd_ins_for_sig (cfg, klass, OP_ARM64_BSL, -1, arg0_type, fsig, args);
#else
return NULL;
#endif
}
case SN_ConvertToDouble: {
#ifdef TARGET_ARM64
if ((arg0_type != MONO_TYPE_I8) && (arg0_type != MONO_TYPE_U8))
return NULL;
MonoClass *arg_class = mono_class_from_mono_type_internal (fsig->params [0]);
int size = mono_class_value_size (arg_class, NULL);
int op = -1;
if (size == 8)
op = arg0_type == MONO_TYPE_I8 ? OP_ARM64_SCVTF_SCALAR : OP_ARM64_UCVTF_SCALAR;
else
op = arg0_type == MONO_TYPE_I8 ? OP_ARM64_SCVTF : OP_ARM64_UCVTF;
return emit_simd_ins_for_sig (cfg, klass, op, -1, arg0_type, fsig, args);
#else
return NULL;
#endif
}
case SN_ConvertToInt32:
case SN_ConvertToUInt32: {
#ifdef TARGET_ARM64
if (arg0_type != MONO_TYPE_R4)
return NULL;
int op = id == SN_ConvertToInt32 ? OP_ARM64_FCVTZS : OP_ARM64_FCVTZU;
return emit_simd_ins_for_sig (cfg, klass, op, -1, arg0_type, fsig, args);
#else
return NULL;
#endif
}
case SN_Create: {
Expand Down