Skip to content

Commit 3933fc6

Browse files
authored
[Mono] Add arm64 SIMD intrinsic for Vector64/128 Abs (#65086)
* [Mono] Add arm64 SIMD intrinsic for Vector64/128 Abs
1 parent b536fef commit 3933fc6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ type_to_extract_op (MonoTypeEnum type)
560560
}
561561

562562
static guint16 sri_vector_methods [] = {
563+
SN_Abs,
563564
SN_As,
564565
SN_AsByte,
565566
SN_AsDouble,
@@ -636,6 +637,23 @@ emit_sri_vector (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsi
636637
MonoTypeEnum arg0_type = fsig->param_count > 0 ? get_underlying_type (fsig->params [0]) : MONO_TYPE_VOID;
637638

638639
switch (id) {
640+
case SN_Abs: {
641+
#ifdef TARGET_ARM64
642+
switch (arg0_type) {
643+
case MONO_TYPE_U1:
644+
case MONO_TYPE_U2:
645+
case MONO_TYPE_U4:
646+
case MONO_TYPE_U8:
647+
case MONO_TYPE_U:
648+
return NULL;
649+
}
650+
gboolean is_float = arg0_type == MONO_TYPE_R4 || arg0_type == MONO_TYPE_R8;
651+
int iid = is_float ? INTRINS_AARCH64_ADV_SIMD_FABS : INTRINS_AARCH64_ADV_SIMD_ABS;
652+
return emit_simd_ins_for_sig (cfg, klass, OP_XOP_OVR_X_X, iid, arg0_type, fsig, args);
653+
#else
654+
return NULL;
655+
#endif
656+
}
639657
case SN_As:
640658
case SN_AsByte:
641659
case SN_AsDouble:

0 commit comments

Comments
 (0)