Skip to content

Commit db23478

Browse files
authored
Delete VectorT size constants from minipal/cpufeatures (#102946)
Vector<T> policy is JIT/EE interface level concern. It should not live in the PAL.
1 parent 94af06a commit db23478

File tree

4 files changed

+142
-169
lines changed

4 files changed

+142
-169
lines changed

src/coreclr/tools/Common/Compiler/HardwareIntrinsicHelpers.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,9 @@ private static class XArchIntrinsicConstants
8181
public const int Avx512Vbmi = 0x800000;
8282
public const int Avx512Vbmi_vl = 0x1000000;
8383
public const int Serialize = 0x2000000;
84-
public const int VectorT128 = 0x4000000;
85-
public const int VectorT256 = 0x8000000;
86-
public const int VectorT512 = 0x10000000;
87-
public const int Avx10v1 = 0x20000000;
88-
public const int Avx10v1_v256 = 0x40000000;
89-
public const int Avx10v1_v512 = unchecked((int)0x80000000);
84+
public const int Avx10v1 = 0x4000000;
85+
public const int Avx10v1_v256 = 0x8000000;
86+
public const int Avx10v1_v512 = 0x10000000;
9087

9188
public static void AddToBuilder(InstructionSetSupportBuilder builder, int flags)
9289
{
@@ -228,9 +225,9 @@ public static int FromInstructionSet(InstructionSet instructionSet)
228225
InstructionSet.X64_X86Base_X64 => 0,
229226

230227
// Vector<T> Sizes
231-
InstructionSet.X64_VectorT128 => VectorT128,
232-
InstructionSet.X64_VectorT256 => VectorT256,
233-
InstructionSet.X64_VectorT512 => VectorT512,
228+
InstructionSet.X64_VectorT128 => 0,
229+
InstructionSet.X64_VectorT256 => Avx2,
230+
InstructionSet.X64_VectorT512 => Avx512f,
234231

235232
_ => throw new NotSupportedException(((InstructionSet_X64)instructionSet).ToString())
236233
};
@@ -249,9 +246,8 @@ private static class Arm64IntrinsicConstants
249246
public const int Sha256 = 0x0040;
250247
public const int Atomics = 0x0080;
251248
public const int Rcpc = 0x0100;
252-
public const int VectorT128 = 0x0200;
253-
public const int Rcpc2 = 0x0400;
254-
public const int Sve = 0x0800;
249+
public const int Rcpc2 = 0x0200;
250+
public const int Sve = 0x0400;
255251

256252
public static void AddToBuilder(InstructionSetSupportBuilder builder, int flags)
257253
{
@@ -310,7 +306,7 @@ public static int FromInstructionSet(InstructionSet instructionSet)
310306
InstructionSet.ARM64_Sve_Arm64 => Sve,
311307

312308
// Vector<T> Sizes
313-
InstructionSet.ARM64_VectorT128 => VectorT128,
309+
InstructionSet.ARM64_VectorT128 => AdvSimd,
314310

315311
_ => throw new NotSupportedException(((InstructionSet_ARM64)instructionSet).ToString())
316312
};

src/coreclr/vm/codeman.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,29 +1258,18 @@ void EEJitManager::SetCpuInfo()
12581258
int cpuFeatures = minipal_getcpufeatures();
12591259

12601260
#if defined(TARGET_X86) || defined(TARGET_AMD64)
1261-
1262-
#if defined(TARGET_X86) && !defined(TARGET_WINDOWS)
1263-
// Linux may still support no SSE/SSE2 for 32-bit
1264-
if ((cpuFeatures & XArchIntrinsicConstants_VectorT128) == 0)
1265-
{
1266-
EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("SSE and SSE2 processor support required."));
1267-
}
1268-
#else
1269-
_ASSERTE((cpuFeatures & XArchIntrinsicConstants_VectorT128) != 0);
1270-
#endif
1271-
12721261
CPUCompileFlags.Set(InstructionSet_VectorT128);
12731262

12741263
// Get the maximum bitwidth of Vector<T>, rounding down to the nearest multiple of 128-bits
12751264
uint32_t maxVectorTBitWidth = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_MaxVectorTBitWidth) / 128) * 128;
12761265

1277-
if (((cpuFeatures & XArchIntrinsicConstants_VectorT256) != 0) && ((maxVectorTBitWidth == 0) || (maxVectorTBitWidth >= 256)))
1266+
if (((cpuFeatures & XArchIntrinsicConstants_Avx2) != 0) && ((maxVectorTBitWidth == 0) || (maxVectorTBitWidth >= 256)))
12781267
{
12791268
// We allow 256-bit Vector<T> by default
12801269
CPUCompileFlags.Set(InstructionSet_VectorT256);
12811270
}
12821271

1283-
if (((cpuFeatures & XArchIntrinsicConstants_VectorT512) != 0) && (maxVectorTBitWidth >= 512))
1272+
if (((cpuFeatures & XArchIntrinsicConstants_Avx512f) != 0) && (maxVectorTBitWidth >= 512))
12841273
{
12851274
// We require 512-bit Vector<T> to be opt-in
12861275
CPUCompileFlags.Set(InstructionSet_VectorT512);
@@ -1458,12 +1447,12 @@ void EEJitManager::SetCpuInfo()
14581447

14591448
#if !defined(TARGET_WINDOWS)
14601449
// Linux may still support no AdvSimd
1461-
if ((cpuFeatures & ARM64IntrinsicConstants_VectorT128) == 0)
1450+
if ((cpuFeatures & ARM64IntrinsicConstants_AdvSimd) == 0)
14621451
{
14631452
EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("AdvSimd processor support required."));
14641453
}
14651454
#else
1466-
_ASSERTE((cpuFeatures & ARM64IntrinsicConstants_VectorT128) != 0);
1455+
_ASSERTE((cpuFeatures & ARM64IntrinsicConstants_AdvSimd) != 0);
14671456
#endif
14681457

14691458
CPUCompileFlags.Set(InstructionSet_VectorT128);

0 commit comments

Comments
 (0)