Skip to content

[Mono] Add arm64 SIMD intrinsic for Vector64/128 Ceiling and Floor #64994

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

Merged
merged 2 commits into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/mono/mono/mini/simd-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,11 @@ static guint16 sri_vector_methods [] = {
SN_AsVector256,
SN_AsVector3,
SN_AsVector4,
SN_Ceiling,
SN_Create,
SN_CreateScalar,
SN_CreateScalarUnsafe,
SN_Floor,
SN_GetElement,
SN_GetLower,
SN_GetUpper,
Expand Down Expand Up @@ -650,6 +652,17 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
return NULL;
return emit_simd_ins (cfg, klass, OP_XCAST, args [0]->dreg, -1);
}
case SN_Ceiling:
case SN_Floor: {
#ifdef TARGET_ARM64
if ((arg0_type != MONO_TYPE_R4) && (arg0_type != MONO_TYPE_R8))
return NULL;
int ceil_or_floor = id == SN_Ceiling ? INTRINS_AARCH64_ADV_SIMD_FRINTP : INTRINS_AARCH64_ADV_SIMD_FRINTM;
return emit_simd_ins_for_sig (cfg, klass, OP_XOP_OVR_X_X, ceil_or_floor, arg0_type, fsig, args);
#else
return NULL;
#endif
}
case SN_Create: {
MonoType *etype = get_vector_t_elem_type (fsig->ret);
if (fsig->param_count == 1 && mono_metadata_type_equal (fsig->params [0], etype))
Expand Down