Skip to content

Commit 944467a

Browse files
committed
JIT ARM64-SVE: Add CreateWhileLessThan*
1 parent d1747a7 commit 944467a

File tree

9 files changed

+819
-0
lines changed

9 files changed

+819
-0
lines changed

src/coreclr/jit/hwintrinsicarm64.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -2194,6 +2194,44 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic,
21942194
break;
21952195
}
21962196

2197+
case NI_Sve_CreateWhileLessThanMask8Bit:
2198+
case NI_Sve_CreateWhileLessThanMask16Bit:
2199+
case NI_Sve_CreateWhileLessThanMask32Bit:
2200+
case NI_Sve_CreateWhileLessThanMask64Bit:
2201+
case NI_Sve_CreateWhileLessThanOrEqualMask8Bit:
2202+
case NI_Sve_CreateWhileLessThanOrEqualMask16Bit:
2203+
case NI_Sve_CreateWhileLessThanOrEqualMask32Bit:
2204+
case NI_Sve_CreateWhileLessThanOrEqualMask64Bit:
2205+
{
2206+
// Target instruction is dependent on whether the inputs are signed or unsigned.
2207+
// This information is lost when the type is converted from CorInfoType to var_type.
2208+
// Ensure this is marked using GTF_UNSIGNED.
2209+
2210+
CORINFO_ARG_LIST_HANDLE arg1 = sig->args;
2211+
CORINFO_ARG_LIST_HANDLE arg2 = info.compCompHnd->getArgNext(arg1);
2212+
var_types argType = TYP_UNKNOWN;
2213+
CORINFO_CLASS_HANDLE argClass = NO_CLASS_HANDLE;
2214+
CorInfoType argCoreInfoType = strip(info.compCompHnd->getArgType(sig, arg2, &argClass));
2215+
2216+
assert(sig->numArgs == 2);
2217+
argType = JITtype2varType(argCoreInfoType);
2218+
op2 = getArgForHWIntrinsic(argType, argClass);
2219+
argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg1, &argClass)));
2220+
op1 = impPopStack().val;
2221+
2222+
retNode = gtNewSimdHWIntrinsicNode(retType, op1, op2, intrinsic, simdBaseJitType, simdSize);
2223+
2224+
if (argCoreInfoType == CORINFO_TYPE_ULONG || argCoreInfoType == CORINFO_TYPE_UINT)
2225+
{
2226+
retNode->gtFlags |= GTF_UNSIGNED;
2227+
}
2228+
else
2229+
{
2230+
assert(argCoreInfoType == CORINFO_TYPE_LONG || argCoreInfoType == CORINFO_TYPE_INT);
2231+
}
2232+
}
2233+
break;
2234+
21972235
default:
21982236
{
21992237
return nullptr;

src/coreclr/jit/hwintrinsiccodegenarm64.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,28 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
13001300
GetEmitter()->emitIns_R_PATTERN(ins, emitSize, targetReg, opt, SVE_PATTERN_ALL);
13011301
break;
13021302

1303+
case NI_Sve_CreateWhileLessThanMask8Bit:
1304+
case NI_Sve_CreateWhileLessThanMask16Bit:
1305+
case NI_Sve_CreateWhileLessThanMask32Bit:
1306+
case NI_Sve_CreateWhileLessThanMask64Bit:
1307+
// Emit size is the size of the scalar operands.
1308+
emitSize = emitActualTypeSize(intrin.op1->TypeGet());
1309+
// Instruction is dependent on whether the inputs are signed or unsigned.
1310+
ins = ((node->gtFlags & GTF_UNSIGNED) != 0) ? INS_sve_whilelo : INS_sve_whilelt;
1311+
GetEmitter()->emitIns_R_R_R(ins, emitSize, targetReg, op1Reg, op2Reg, opt);
1312+
break;
1313+
1314+
case NI_Sve_CreateWhileLessThanOrEqualMask8Bit:
1315+
case NI_Sve_CreateWhileLessThanOrEqualMask16Bit:
1316+
case NI_Sve_CreateWhileLessThanOrEqualMask32Bit:
1317+
case NI_Sve_CreateWhileLessThanOrEqualMask64Bit:
1318+
// Emit size is the size of the scalar operands.
1319+
emitSize = emitActualTypeSize(intrin.op1->TypeGet());
1320+
// Instruction is dependent on whether the inputs are signed or unsigned.
1321+
ins = ((node->gtFlags & GTF_UNSIGNED) != 0) ? INS_sve_whilels : INS_sve_whilele;
1322+
GetEmitter()->emitIns_R_R_R(ins, emitSize, targetReg, op1Reg, op2Reg, opt);
1323+
break;
1324+
13031325
default:
13041326
unreached();
13051327
}

src/coreclr/jit/hwintrinsiclistarm64sve.h

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ HARDWARE_INTRINSIC(Sve, CreateTrueMaskSingle,
2727
HARDWARE_INTRINSIC(Sve, CreateTrueMaskUInt16, -1, 1, false, {INS_invalid, INS_invalid, INS_invalid, INS_sve_ptrue, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_EnumPattern, HW_Flag_Scalable|HW_Flag_HasImmediateOperand|HW_Flag_ReturnsPerElementMask)
2828
HARDWARE_INTRINSIC(Sve, CreateTrueMaskUInt32, -1, 1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_ptrue, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_EnumPattern, HW_Flag_Scalable|HW_Flag_HasImmediateOperand|HW_Flag_ReturnsPerElementMask)
2929
HARDWARE_INTRINSIC(Sve, CreateTrueMaskUInt64, -1, 1, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_ptrue, INS_invalid, INS_invalid}, HW_Category_EnumPattern, HW_Flag_Scalable|HW_Flag_HasImmediateOperand|HW_Flag_ReturnsPerElementMask)
30+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanMask16Bit, -1, 2, false, {INS_invalid, INS_invalid, INS_invalid, INS_sve_whilelt, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
31+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanMask32Bit, -1, 2, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_whilelt, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
32+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanMask64Bit, -1, 2, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_whilelt, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
33+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanMask8Bit, -1, 2, false, {INS_invalid, INS_sve_whilelt, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
34+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanOrEqualMask16Bit, -1, 2, false, {INS_invalid, INS_invalid, INS_invalid, INS_sve_whilele, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
35+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanOrEqualMask32Bit, -1, 2, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_whilele, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
36+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanOrEqualMask64Bit, -1, 2, false, {INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_sve_whilele, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
37+
HARDWARE_INTRINSIC(Sve, CreateWhileLessThanOrEqualMask8Bit, -1, 2, false, {INS_invalid, INS_sve_whilele, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid, INS_invalid}, HW_Category_SIMD, HW_Flag_Scalable|HW_Flag_SpecialImport|HW_Flag_SpecialCodeGen|HW_Flag_ReturnsPerElementMask)
3038

3139
HARDWARE_INTRINSIC(Sve, LoadVector, -1, 2, true, {INS_sve_ld1b, INS_sve_ld1b, INS_sve_ld1h, INS_sve_ld1h, INS_sve_ld1w, INS_sve_ld1w, INS_sve_ld1d, INS_sve_ld1d, INS_sve_ld1w, INS_sve_ld1d}, HW_Category_MemoryLoad, HW_Flag_Scalable|HW_Flag_LowMaskedOperation)
3240

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

+215
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,221 @@ internal Arm64() { }
121121
public static unsafe Vector<ulong> CreateTrueMaskUInt64([ConstantExpected] SveMaskPattern pattern = SveMaskPattern.All) { throw new PlatformNotSupportedException(); }
122122

123123

124+
/// CreateWhileLessThanMask16Bit : While incrementing scalar is less than
125+
126+
/// <summary>
127+
/// svbool_t svwhilelt_b16[_s32](int32_t op1, int32_t op2)
128+
/// WHILELT Presult.H, Wop1, Wop2
129+
/// </summary>
130+
public static unsafe Vector<ushort> CreateWhileLessThanMask16Bit(int left, int right) { throw new PlatformNotSupportedException(); }
131+
132+
/// <summary>
133+
/// svbool_t svwhilelt_b16[_s64](int64_t op1, int64_t op2)
134+
/// WHILELT Presult.H, Xop1, Xop2
135+
/// </summary>
136+
public static unsafe Vector<ushort> CreateWhileLessThanMask16Bit(long left, long right) { throw new PlatformNotSupportedException(); }
137+
138+
/// <summary>
139+
/// svbool_t svwhilelt_b16[_u32](uint32_t op1, uint32_t op2)
140+
/// WHILELO Presult.H, Wop1, Wop2
141+
/// </summary>
142+
public static unsafe Vector<ushort> CreateWhileLessThanMask16Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
143+
144+
/// <summary>
145+
/// svbool_t svwhilelt_b16[_u64](uint64_t op1, uint64_t op2)
146+
/// WHILELO Presult.H, Xop1, Xop2
147+
/// </summary>
148+
public static unsafe Vector<ushort> CreateWhileLessThanMask16Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
149+
150+
151+
/// CreateWhileLessThanMask32Bit : While incrementing scalar is less than
152+
153+
/// <summary>
154+
/// svbool_t svwhilelt_b32[_s32](int32_t op1, int32_t op2)
155+
/// WHILELT Presult.S, Wop1, Wop2
156+
/// </summary>
157+
public static unsafe Vector<uint> CreateWhileLessThanMask32Bit(int left, int right) { throw new PlatformNotSupportedException(); }
158+
159+
/// <summary>
160+
/// svbool_t svwhilelt_b32[_s64](int64_t op1, int64_t op2)
161+
/// WHILELT Presult.S, Xop1, Xop2
162+
/// </summary>
163+
public static unsafe Vector<uint> CreateWhileLessThanMask32Bit(long left, long right) { throw new PlatformNotSupportedException(); }
164+
165+
/// <summary>
166+
/// svbool_t svwhilelt_b32[_u32](uint32_t op1, uint32_t op2)
167+
/// WHILELO Presult.S, Wop1, Wop2
168+
/// </summary>
169+
public static unsafe Vector<uint> CreateWhileLessThanMask32Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
170+
171+
/// <summary>
172+
/// svbool_t svwhilelt_b32[_u64](uint64_t op1, uint64_t op2)
173+
/// WHILELO Presult.S, Xop1, Xop2
174+
/// </summary>
175+
public static unsafe Vector<uint> CreateWhileLessThanMask32Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
176+
177+
178+
/// CreateWhileLessThanMask64Bit : While incrementing scalar is less than
179+
180+
/// <summary>
181+
/// svbool_t svwhilelt_b64[_s32](int32_t op1, int32_t op2)
182+
/// WHILELT Presult.D, Wop1, Wop2
183+
/// </summary>
184+
public static unsafe Vector<ulong> CreateWhileLessThanMask64Bit(int left, int right) { throw new PlatformNotSupportedException(); }
185+
186+
/// <summary>
187+
/// svbool_t svwhilelt_b64[_s64](int64_t op1, int64_t op2)
188+
/// WHILELT Presult.D, Xop1, Xop2
189+
/// </summary>
190+
public static unsafe Vector<ulong> CreateWhileLessThanMask64Bit(long left, long right) { throw new PlatformNotSupportedException(); }
191+
192+
/// <summary>
193+
/// svbool_t svwhilelt_b64[_u32](uint32_t op1, uint32_t op2)
194+
/// WHILELO Presult.D, Wop1, Wop2
195+
/// </summary>
196+
public static unsafe Vector<ulong> CreateWhileLessThanMask64Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
197+
198+
/// <summary>
199+
/// svbool_t svwhilelt_b64[_u64](uint64_t op1, uint64_t op2)
200+
/// WHILELO Presult.D, Xop1, Xop2
201+
/// </summary>
202+
public static unsafe Vector<ulong> CreateWhileLessThanMask64Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
203+
204+
205+
/// CreateWhileLessThanMask8Bit : While incrementing scalar is less than
206+
207+
/// <summary>
208+
/// svbool_t svwhilelt_b8[_s32](int32_t op1, int32_t op2)
209+
/// WHILELT Presult.B, Wop1, Wop2
210+
/// </summary>
211+
public static unsafe Vector<byte> CreateWhileLessThanMask8Bit(int left, int right) { throw new PlatformNotSupportedException(); }
212+
213+
/// <summary>
214+
/// svbool_t svwhilelt_b8[_s64](int64_t op1, int64_t op2)
215+
/// WHILELT Presult.B, Xop1, Xop2
216+
/// </summary>
217+
public static unsafe Vector<byte> CreateWhileLessThanMask8Bit(long left, long right) { throw new PlatformNotSupportedException(); }
218+
219+
/// <summary>
220+
/// svbool_t svwhilelt_b8[_u32](uint32_t op1, uint32_t op2)
221+
/// WHILELO Presult.B, Wop1, Wop2
222+
/// </summary>
223+
public static unsafe Vector<byte> CreateWhileLessThanMask8Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
224+
225+
/// <summary>
226+
/// svbool_t svwhilelt_b8[_u64](uint64_t op1, uint64_t op2)
227+
/// WHILELO Presult.B, Xop1, Xop2
228+
/// </summary>
229+
public static unsafe Vector<byte> CreateWhileLessThanMask8Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
230+
231+
232+
/// CreateWhileLessThanOrEqualMask16Bit : While incrementing scalar is less than or equal to
233+
234+
/// <summary>
235+
/// svbool_t svwhilele_b16[_s32](int32_t op1, int32_t op2)
236+
/// WHILELE Presult.H, Wop1, Wop2
237+
/// </summary>
238+
public static unsafe Vector<ushort> CreateWhileLessThanOrEqualMask16Bit(int left, int right) { throw new PlatformNotSupportedException(); }
239+
240+
/// <summary>
241+
/// svbool_t svwhilele_b16[_s64](int64_t op1, int64_t op2)
242+
/// WHILELE Presult.H, Xop1, Xop2
243+
/// </summary>
244+
public static unsafe Vector<ushort> CreateWhileLessThanOrEqualMask16Bit(long left, long right) { throw new PlatformNotSupportedException(); }
245+
246+
/// <summary>
247+
/// svbool_t svwhilele_b16[_u32](uint32_t op1, uint32_t op2)
248+
/// WHILELS Presult.H, Wop1, Wop2
249+
/// </summary>
250+
public static unsafe Vector<ushort> CreateWhileLessThanOrEqualMask16Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
251+
252+
/// <summary>
253+
/// svbool_t svwhilele_b16[_u64](uint64_t op1, uint64_t op2)
254+
/// WHILELS Presult.H, Xop1, Xop2
255+
/// </summary>
256+
public static unsafe Vector<ushort> CreateWhileLessThanOrEqualMask16Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
257+
258+
259+
/// CreateWhileLessThanOrEqualMask32Bit : While incrementing scalar is less than or equal to
260+
261+
/// <summary>
262+
/// svbool_t svwhilele_b32[_s32](int32_t op1, int32_t op2)
263+
/// WHILELE Presult.S, Wop1, Wop2
264+
/// </summary>
265+
public static unsafe Vector<uint> CreateWhileLessThanOrEqualMask32Bit(int left, int right) { throw new PlatformNotSupportedException(); }
266+
267+
/// <summary>
268+
/// svbool_t svwhilele_b32[_s64](int64_t op1, int64_t op2)
269+
/// WHILELE Presult.S, Xop1, Xop2
270+
/// </summary>
271+
public static unsafe Vector<uint> CreateWhileLessThanOrEqualMask32Bit(long left, long right) { throw new PlatformNotSupportedException(); }
272+
273+
/// <summary>
274+
/// svbool_t svwhilele_b32[_u32](uint32_t op1, uint32_t op2)
275+
/// WHILELS Presult.S, Wop1, Wop2
276+
/// </summary>
277+
public static unsafe Vector<uint> CreateWhileLessThanOrEqualMask32Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
278+
279+
/// <summary>
280+
/// svbool_t svwhilele_b32[_u64](uint64_t op1, uint64_t op2)
281+
/// WHILELS Presult.S, Xop1, Xop2
282+
/// </summary>
283+
public static unsafe Vector<uint> CreateWhileLessThanOrEqualMask32Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
284+
285+
286+
/// CreateWhileLessThanOrEqualMask64Bit : While incrementing scalar is less than or equal to
287+
288+
/// <summary>
289+
/// svbool_t svwhilele_b64[_s32](int32_t op1, int32_t op2)
290+
/// WHILELE Presult.D, Wop1, Wop2
291+
/// </summary>
292+
public static unsafe Vector<ulong> CreateWhileLessThanOrEqualMask64Bit(int left, int right) { throw new PlatformNotSupportedException(); }
293+
294+
/// <summary>
295+
/// svbool_t svwhilele_b64[_s64](int64_t op1, int64_t op2)
296+
/// WHILELE Presult.D, Xop1, Xop2
297+
/// </summary>
298+
public static unsafe Vector<ulong> CreateWhileLessThanOrEqualMask64Bit(long left, long right) { throw new PlatformNotSupportedException(); }
299+
300+
/// <summary>
301+
/// svbool_t svwhilele_b64[_u32](uint32_t op1, uint32_t op2)
302+
/// WHILELS Presult.D, Wop1, Wop2
303+
/// </summary>
304+
public static unsafe Vector<ulong> CreateWhileLessThanOrEqualMask64Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
305+
306+
/// <summary>
307+
/// svbool_t svwhilele_b64[_u64](uint64_t op1, uint64_t op2)
308+
/// WHILELS Presult.D, Xop1, Xop2
309+
/// </summary>
310+
public static unsafe Vector<ulong> CreateWhileLessThanOrEqualMask64Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
311+
312+
313+
/// CreateWhileLessThanOrEqualMask8Bit : While incrementing scalar is less than or equal to
314+
315+
/// <summary>
316+
/// svbool_t svwhilele_b8[_s32](int32_t op1, int32_t op2)
317+
/// WHILELE Presult.B, Wop1, Wop2
318+
/// </summary>
319+
public static unsafe Vector<byte> CreateWhileLessThanOrEqualMask8Bit(int left, int right) { throw new PlatformNotSupportedException(); }
320+
321+
/// <summary>
322+
/// svbool_t svwhilele_b8[_s64](int64_t op1, int64_t op2)
323+
/// WHILELE Presult.B, Xop1, Xop2
324+
/// </summary>
325+
public static unsafe Vector<byte> CreateWhileLessThanOrEqualMask8Bit(long left, long right) { throw new PlatformNotSupportedException(); }
326+
327+
/// <summary>
328+
/// svbool_t svwhilele_b8[_u32](uint32_t op1, uint32_t op2)
329+
/// WHILELS Presult.B, Wop1, Wop2
330+
/// </summary>
331+
public static unsafe Vector<byte> CreateWhileLessThanOrEqualMask8Bit(uint left, uint right) { throw new PlatformNotSupportedException(); }
332+
333+
/// <summary>
334+
/// svbool_t svwhilele_b8[_u64](uint64_t op1, uint64_t op2)
335+
/// WHILELS Presult.B, Xop1, Xop2
336+
/// </summary>
337+
public static unsafe Vector<byte> CreateWhileLessThanOrEqualMask8Bit(ulong left, ulong right) { throw new PlatformNotSupportedException(); }
338+
124339

125340
/// LoadVector : Unextended load
126341

0 commit comments

Comments
 (0)