Skip to content

Commit 6ab0311

Browse files
SVE2 API for AbsoluteDifferenceAdd (#115513)
* SVE2 API for AbsoluteDifferenceAdd and widening variants * Removing the 'unsafe' keyword from the intrinsic definitions
1 parent b142ec3 commit 6ab0311

File tree

6 files changed

+338
-9
lines changed

6 files changed

+338
-9
lines changed

src/coreclr/jit/hwintrinsiclistarm64sve.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ HARDWARE_INTRINSIC(Sve, ZipLow,
308308
// {TYP_BYTE, TYP_UBYTE, TYP_SHORT, TYP_USHORT, TYP_INT, TYP_UINT, TYP_LONG, TYP_ULONG, TYP_FLOAT, TYP_DOUBLE}
309309
// ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
310310
// SVE2 Intrinsics
311-
#define FIRST_NI_Sve2 NI_Sve2_BitwiseClearXor
311+
#define FIRST_NI_Sve2 NI_Sve2_AbsoluteDifferenceAdd
312+
HARDWARE_INTRINSIC(Sve2, AbsoluteDifferenceAdd, -1, 3, {INS_sve_saba, INS_sve_uaba, INS_sve_saba, INS_sve_uaba, INS_sve_saba, INS_sve_uaba, INS_sve_saba, INS_sve_uaba, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_HasRMWSemantics)
313+
HARDWARE_INTRINSIC(Sve2, AbsoluteDifferenceAddWideningLower, -1, 3, {INS_invalid, INS_invalid, INS_sve_sabalb, INS_sve_uabalb, INS_sve_sabalb, INS_sve_uabalb, INS_sve_sabalb, INS_sve_uabalb, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_HasRMWSemantics)
314+
HARDWARE_INTRINSIC(Sve2, AbsoluteDifferenceAddWideningUpper, -1, 3, {INS_invalid, INS_invalid, INS_sve_sabalt, INS_sve_uabalt, INS_sve_sabalt, INS_sve_uabalt, INS_sve_sabalt, INS_sve_uabalt, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_BaseTypeFromFirstArg|HW_Flag_HasRMWSemantics)
312315
HARDWARE_INTRINSIC(Sve2, BitwiseClearXor, -1, 3, {INS_sve_bcax, INS_sve_bcax, INS_sve_bcax, INS_sve_bcax, INS_sve_bcax, INS_sve_bcax, INS_sve_bcax, INS_sve_bcax, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)
313316
HARDWARE_INTRINSIC(Sve2, BitwiseSelect, -1, 3, {INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_sve_bsl, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)
314317
HARDWARE_INTRINSIC(Sve2, BitwiseSelectLeftInverted, -1, 3, {INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_sve_bsl1n, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialCodeGen|HW_Flag_HasRMWSemantics)

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.PlatformNotSupported.cs

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,132 @@ internal Arm64() { }
2828
public static new bool IsSupported { get => IsSupported; }
2929
}
3030

31+
// Absolute difference and accumulate
32+
33+
/// <summary>
34+
/// svuint8_t svaba[_u8](svuint8_t op1, svuint8_t op2, svuint8_t op3)
35+
/// UABA Ztied1.B, Zop2.B, Zop3.B
36+
/// </summary>
37+
public static Vector<byte> AbsoluteDifferenceAdd(Vector<byte> addend, Vector<byte> left, Vector<byte> right) { throw new PlatformNotSupportedException(); }
38+
39+
/// <summary>
40+
/// svint16_t svaba[_s16](svint16_t op1, svint16_t op2, svint16_t op3)
41+
/// SABA Ztied1.H, Zop2.H, Zop3.H
42+
/// </summary>
43+
public static Vector<short> AbsoluteDifferenceAdd(Vector<short> addend, Vector<short> left, Vector<short> right) { throw new PlatformNotSupportedException(); }
44+
45+
/// <summary>
46+
/// svint32_t svaba[_s32](svint32_t op1, svint32_t op2, svint32_t op3)
47+
/// SABA Ztied1.S, Zop2.S, Zop3.S
48+
/// </summary>
49+
public static Vector<int> AbsoluteDifferenceAdd(Vector<int> addend, Vector<int> left, Vector<int> right) { throw new PlatformNotSupportedException(); }
50+
51+
/// <summary>
52+
/// svint64_t svaba[_s64](svint64_t op1, svint64_t op2, svint64_t op3)
53+
/// SABA Ztied1.D, Zop2.D, Zop3.D
54+
/// </summary>
55+
public static Vector<long> AbsoluteDifferenceAdd(Vector<long> addend, Vector<long> left, Vector<long> right) { throw new PlatformNotSupportedException(); }
56+
57+
/// <summary>
58+
/// svint8_t svaba[_s8](svint8_t op1, svint8_t op2, svint8_t op3)
59+
/// SABA Ztied1.B, Zop2.B, Zop3.B
60+
/// </summary>
61+
public static Vector<sbyte> AbsoluteDifferenceAdd(Vector<sbyte> addend, Vector<sbyte> left, Vector<sbyte> right) { throw new PlatformNotSupportedException(); }
62+
63+
/// <summary>
64+
/// svuint16_t svaba[_u16](svuint16_t op1, svuint16_t op2, svuint16_t op3)
65+
/// UABA Ztied1.H, Zop2.H, Zop3.H
66+
/// </summary>
67+
public static Vector<ushort> AbsoluteDifferenceAdd(Vector<ushort> addend, Vector<ushort> left, Vector<ushort> right) { throw new PlatformNotSupportedException(); }
68+
69+
/// <summary>
70+
/// svuint32_t svaba[_u32](svuint32_t op1, svuint32_t op2, svuint32_t op3)
71+
/// UABA Ztied1.S, Zop2.S, Zop3.S
72+
/// </summary>
73+
public static Vector<uint> AbsoluteDifferenceAdd(Vector<uint> addend, Vector<uint> left, Vector<uint> right) { throw new PlatformNotSupportedException(); }
74+
75+
/// <summary>
76+
/// svuint64_t svaba[_u64](svuint64_t op1, svuint64_t op2, svuint64_t op3)
77+
/// UABA Ztied1.D, Zop2.D, Zop3.D
78+
/// </summary>
79+
public static Vector<ulong> AbsoluteDifferenceAdd(Vector<ulong> addend, Vector<ulong> left, Vector<ulong> right) { throw new PlatformNotSupportedException(); }
80+
81+
// Absolute difference and accumulate long (bottom)
82+
83+
/// <summary>
84+
/// svint16_t svabalb[_s16](svint16_t op1, svint8_t op2, svint8_t op3)
85+
/// SABALB Ztied1.H, Zop2.B, Zop3.B
86+
/// </summary>
87+
public static Vector<short> AbsoluteDifferenceAddWideningLower(Vector<short> addend, Vector<sbyte> left, Vector<sbyte> right) { throw new PlatformNotSupportedException(); }
88+
89+
/// <summary>
90+
/// svint32_t svabalb[_s32](svint32_t op1, svint16_t op2, svint16_t op3)
91+
/// SABALB Ztied1.S, Zop2.H, Zop3.H
92+
/// </summary>
93+
public static Vector<int> AbsoluteDifferenceAddWideningLower(Vector<int> addend, Vector<short> left, Vector<short> right) { throw new PlatformNotSupportedException(); }
94+
95+
/// <summary>
96+
/// svint64_t svabalb[_s64](svint64_t op1, svint32_t op2, svint32_t op3)
97+
/// SABALB Ztied1.D, Zop2.S, Zop3.S
98+
/// </summary>
99+
public static Vector<long> AbsoluteDifferenceAddWideningLower(Vector<long> addend, Vector<int> left, Vector<int> right) { throw new PlatformNotSupportedException(); }
100+
101+
/// <summary>
102+
/// svuint16_t svabalb[_u16](svuint16_t op1, svuint8_t op2, svuint8_t op3)
103+
/// UABALB Ztied1.H, Zop2.B, Zop3.B
104+
/// </summary>
105+
public static Vector<ushort> AbsoluteDifferenceAddWideningLower(Vector<ushort> addend, Vector<byte> left, Vector<byte> right) { throw new PlatformNotSupportedException(); }
106+
107+
/// <summary>
108+
/// svuint32_t svabalb[_u32](svuint32_t op1, svuint16_t op2, svuint16_t op3)
109+
/// UABALB Ztied1.S, Zop2.H, Zop3.H
110+
/// </summary>
111+
public static Vector<uint> AbsoluteDifferenceAddWideningLower(Vector<uint> addend, Vector<ushort> left, Vector<ushort> right) { throw new PlatformNotSupportedException(); }
112+
113+
/// <summary>
114+
/// svuint64_t svabalb[_u64](svuint64_t op1, svuint32_t op2, svuint32_t op3)
115+
/// UABALB Ztied1.D, Zop2.S, Zop3.S
116+
/// </summary>
117+
public static Vector<ulong> AbsoluteDifferenceAddWideningLower(Vector<ulong> addend, Vector<uint> left, Vector<uint> right) { throw new PlatformNotSupportedException(); }
118+
119+
// Absolute difference and accumulate long (top)
120+
121+
/// <summary>
122+
/// svint16_t svabalt[_s16](svint16_t op1, svint8_t op2, svint8_t op3)
123+
/// SABALT Ztied1.H, Zop2.B, Zop3.B
124+
/// </summary>
125+
public static Vector<short> AbsoluteDifferenceAddWideningUpper(Vector<short> addend, Vector<sbyte> left, Vector<sbyte> right) { throw new PlatformNotSupportedException(); }
126+
127+
/// <summary>
128+
/// svint32_t svabalt[_s32](svint32_t op1, svint16_t op2, svint16_t op3)
129+
/// SABALT Ztied1.S, Zop2.H, Zop3.H
130+
/// </summary>
131+
public static Vector<int> AbsoluteDifferenceAddWideningUpper(Vector<int> addend, Vector<short> left, Vector<short> right) { throw new PlatformNotSupportedException(); }
132+
133+
/// <summary>
134+
/// svint64_t svabalt[_s64](svint64_t op1, svint32_t op2, svint32_t op3)
135+
/// SABALT Ztied1.D, Zop2.S, Zop3.S
136+
/// </summary>
137+
public static Vector<long> AbsoluteDifferenceAddWideningUpper(Vector<long> addend, Vector<int> left, Vector<int> right) { throw new PlatformNotSupportedException(); }
138+
139+
/// <summary>
140+
/// svuint16_t svabalt[_u16](svuint16_t op1, svuint8_t op2, svuint8_t op3)
141+
/// UABALT Ztied1.H, Zop2.B, Zop3.B
142+
/// </summary>
143+
public static Vector<ushort> AbsoluteDifferenceAddWideningUpper(Vector<ushort> addend, Vector<byte> left, Vector<byte> right) { throw new PlatformNotSupportedException(); }
144+
145+
/// <summary>
146+
/// svuint32_t svabalt[_u32](svuint32_t op1, svuint16_t op2, svuint16_t op3)
147+
/// UABALT Ztied1.S, Zop2.H, Zop3.H
148+
/// </summary>
149+
public static Vector<uint> AbsoluteDifferenceAddWideningUpper(Vector<uint> addend, Vector<ushort> left, Vector<ushort> right) { throw new PlatformNotSupportedException(); }
150+
151+
/// <summary>
152+
/// svuint64_t svabalt[_u64](svuint64_t op1, svuint32_t op2, svuint32_t op3)
153+
/// UABALT Ztied1.D, Zop2.S, Zop3.S
154+
/// </summary>
155+
public static Vector<ulong> AbsoluteDifferenceAddWideningUpper(Vector<ulong> addend, Vector<uint> left, Vector<uint> right) { throw new PlatformNotSupportedException(); }
156+
31157
// Bitwise clear and exclusive OR
32158

33159
/// <summary>

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Arm/Sve2.cs

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,132 @@ internal Arm64() { }
2828
public static new bool IsSupported { get => IsSupported; }
2929
}
3030

31+
// Absolute difference and accumulate
32+
33+
/// <summary>
34+
/// svuint8_t svaba[_u8](svuint8_t op1, svuint8_t op2, svuint8_t op3)
35+
/// UABA Ztied1.B, Zop2.B, Zop3.B
36+
/// </summary>
37+
public static Vector<byte> AbsoluteDifferenceAdd(Vector<byte> addend, Vector<byte> left, Vector<byte> right) => AbsoluteDifferenceAdd(addend, left, right);
38+
39+
/// <summary>
40+
/// svint16_t svaba[_s16](svint16_t op1, svint16_t op2, svint16_t op3)
41+
/// SABA Ztied1.H, Zop2.H, Zop3.H
42+
/// </summary>
43+
public static Vector<short> AbsoluteDifferenceAdd(Vector<short> addend, Vector<short> left, Vector<short> right) => AbsoluteDifferenceAdd(addend, left, right);
44+
45+
/// <summary>
46+
/// svint32_t svaba[_s32](svint32_t op1, svint32_t op2, svint32_t op3)
47+
/// SABA Ztied1.S, Zop2.S, Zop3.S
48+
/// </summary>
49+
public static Vector<int> AbsoluteDifferenceAdd(Vector<int> addend, Vector<int> left, Vector<int> right) => AbsoluteDifferenceAdd(addend, left, right);
50+
51+
/// <summary>
52+
/// svint64_t svaba[_s64](svint64_t op1, svint64_t op2, svint64_t op3)
53+
/// SABA Ztied1.D, Zop2.D, Zop3.D
54+
/// </summary>
55+
public static Vector<long> AbsoluteDifferenceAdd(Vector<long> addend, Vector<long> left, Vector<long> right) => AbsoluteDifferenceAdd(addend, left, right);
56+
57+
/// <summary>
58+
/// svint8_t svaba[_s8](svint8_t op1, svint8_t op2, svint8_t op3)
59+
/// SABA Ztied1.B, Zop2.B, Zop3.B
60+
/// </summary>
61+
public static Vector<sbyte> AbsoluteDifferenceAdd(Vector<sbyte> addend, Vector<sbyte> left, Vector<sbyte> right) => AbsoluteDifferenceAdd(addend, left, right);
62+
63+
/// <summary>
64+
/// svuint16_t svaba[_u16](svuint16_t op1, svuint16_t op2, svuint16_t op3)
65+
/// UABA Ztied1.H, Zop2.H, Zop3.H
66+
/// </summary>
67+
public static Vector<ushort> AbsoluteDifferenceAdd(Vector<ushort> addend, Vector<ushort> left, Vector<ushort> right) => AbsoluteDifferenceAdd(addend, left, right);
68+
69+
/// <summary>
70+
/// svuint32_t svaba[_u32](svuint32_t op1, svuint32_t op2, svuint32_t op3)
71+
/// UABA Ztied1.S, Zop2.S, Zop3.S
72+
/// </summary>
73+
public static Vector<uint> AbsoluteDifferenceAdd(Vector<uint> addend, Vector<uint> left, Vector<uint> right) => AbsoluteDifferenceAdd(addend, left, right);
74+
75+
/// <summary>
76+
/// svuint64_t svaba[_u64](svuint64_t op1, svuint64_t op2, svuint64_t op3)
77+
/// UABA Ztied1.D, Zop2.D, Zop3.D
78+
/// </summary>
79+
public static Vector<ulong> AbsoluteDifferenceAdd(Vector<ulong> addend, Vector<ulong> left, Vector<ulong> right) => AbsoluteDifferenceAdd(addend, left, right);
80+
81+
// Absolute difference and accumulate long (bottom)
82+
83+
/// <summary>
84+
/// svint16_t svabalb[_s16](svint16_t op1, svint8_t op2, svint8_t op3)
85+
/// SABALB Ztied1.H, Zop2.B, Zop3.B
86+
/// </summary>
87+
public static Vector<short> AbsoluteDifferenceAddWideningLower(Vector<short> addend, Vector<sbyte> left, Vector<sbyte> right) => AbsoluteDifferenceAddWideningLower(addend, left, right);
88+
89+
/// <summary>
90+
/// svint32_t svabalb[_s32](svint32_t op1, svint16_t op2, svint16_t op3)
91+
/// SABALB Ztied1.S, Zop2.H, Zop3.H
92+
/// </summary>
93+
public static Vector<int> AbsoluteDifferenceAddWideningLower(Vector<int> addend, Vector<short> left, Vector<short> right) => AbsoluteDifferenceAddWideningLower(addend, left, right);
94+
95+
/// <summary>
96+
/// svint64_t svabalb[_s64](svint64_t op1, svint32_t op2, svint32_t op3)
97+
/// SABALB Ztied1.D, Zop2.S, Zop3.S
98+
/// </summary>
99+
public static Vector<long> AbsoluteDifferenceAddWideningLower(Vector<long> addend, Vector<int> left, Vector<int> right) => AbsoluteDifferenceAddWideningLower(addend, left, right);
100+
101+
/// <summary>
102+
/// svuint16_t svabalb[_u16](svuint16_t op1, svuint8_t op2, svuint8_t op3)
103+
/// UABALB Ztied1.H, Zop2.B, Zop3.B
104+
/// </summary>
105+
public static Vector<ushort> AbsoluteDifferenceAddWideningLower(Vector<ushort> addend, Vector<byte> left, Vector<byte> right) => AbsoluteDifferenceAddWideningLower(addend, left, right);
106+
107+
/// <summary>
108+
/// svuint32_t svabalb[_u32](svuint32_t op1, svuint16_t op2, svuint16_t op3)
109+
/// UABALB Ztied1.S, Zop2.H, Zop3.H
110+
/// </summary>
111+
public static Vector<uint> AbsoluteDifferenceAddWideningLower(Vector<uint> addend, Vector<ushort> left, Vector<ushort> right) => AbsoluteDifferenceAddWideningLower(addend, left, right);
112+
113+
/// <summary>
114+
/// svuint64_t svabalb[_u64](svuint64_t op1, svuint32_t op2, svuint32_t op3)
115+
/// UABALB Ztied1.D, Zop2.S, Zop3.S
116+
/// </summary>
117+
public static Vector<ulong> AbsoluteDifferenceAddWideningLower(Vector<ulong> addend, Vector<uint> left, Vector<uint> right) => AbsoluteDifferenceAddWideningLower(addend, left, right);
118+
119+
// Absolute difference and accumulate long (top)
120+
121+
/// <summary>
122+
/// svint16_t svabalt[_s16](svint16_t op1, svint8_t op2, svint8_t op3)
123+
/// SABALT Ztied1.H, Zop2.B, Zop3.B
124+
/// </summary>
125+
public static Vector<short> AbsoluteDifferenceAddWideningUpper(Vector<short> addend, Vector<sbyte> left, Vector<sbyte> right) => AbsoluteDifferenceAddWideningUpper(addend, left, right);
126+
127+
/// <summary>
128+
/// svint32_t svabalt[_s32](svint32_t op1, svint16_t op2, svint16_t op3)
129+
/// SABALT Ztied1.S, Zop2.H, Zop3.H
130+
/// </summary>
131+
public static Vector<int> AbsoluteDifferenceAddWideningUpper(Vector<int> addend, Vector<short> left, Vector<short> right) => AbsoluteDifferenceAddWideningUpper(addend, left, right);
132+
133+
/// <summary>
134+
/// svint64_t svabalt[_s64](svint64_t op1, svint32_t op2, svint32_t op3)
135+
/// SABALT Ztied1.D, Zop2.S, Zop3.S
136+
/// </summary>
137+
public static Vector<long> AbsoluteDifferenceAddWideningUpper(Vector<long> addend, Vector<int> left, Vector<int> right) => AbsoluteDifferenceAddWideningUpper(addend, left, right);
138+
139+
/// <summary>
140+
/// svuint16_t svabalt[_u16](svuint16_t op1, svuint8_t op2, svuint8_t op3)
141+
/// UABALT Ztied1.H, Zop2.B, Zop3.B
142+
/// </summary>
143+
public static Vector<ushort> AbsoluteDifferenceAddWideningUpper(Vector<ushort> addend, Vector<byte> left, Vector<byte> right) => AbsoluteDifferenceAddWideningUpper(addend, left, right);
144+
145+
/// <summary>
146+
/// svuint32_t svabalt[_u32](svuint32_t op1, svuint16_t op2, svuint16_t op3)
147+
/// UABALT Ztied1.S, Zop2.H, Zop3.H
148+
/// </summary>
149+
public static Vector<uint> AbsoluteDifferenceAddWideningUpper(Vector<uint> addend, Vector<ushort> left, Vector<ushort> right) => AbsoluteDifferenceAddWideningUpper(addend, left, right);
150+
151+
/// <summary>
152+
/// svuint64_t svabalt[_u64](svuint64_t op1, svuint32_t op2, svuint32_t op3)
153+
/// UABALT Ztied1.D, Zop2.S, Zop3.S
154+
/// </summary>
155+
public static Vector<ulong> AbsoluteDifferenceAddWideningUpper(Vector<ulong> addend, Vector<uint> left, Vector<uint> right) => AbsoluteDifferenceAddWideningUpper(addend, left, right);
156+
31157
// Bitwise clear and exclusive OR
32158

33159
/// <summary>

0 commit comments

Comments
 (0)