Skip to content

Commit

Permalink
[Mono] Intrinsify Convert* for Vector{64, 128} on ARM64 (#65946)
Browse files Browse the repository at this point in the history
* Intrinsify Convert*

* Test - comment out my change

* Enable ConvertToDouble

* Enable ConvertToInt32 and ConvertToUInt32

* Enable ConvertToInt64 and ConvertToUInt64

* Disable ConvertToInt64 and ConvertToUInt64, but enable ConvertToSingle

* Remove the support for ConvertToInt64, ConvertToUInt64 and ConvertToSingle
  • Loading branch information
fanyang-mono authored Mar 7, 2022
1 parent 8b4eaf9 commit f5ebdf8
Showing 1 changed file with 30 additions and 0 deletions.
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

0 comments on commit f5ebdf8

Please sign in to comment.