@@ -1920,11 +1920,15 @@ void Compiler::compSetProcessor()
1920
1920
opts.compSupportsISAReported .Reset ();
1921
1921
opts.compSupportsISAExactly .Reset ();
1922
1922
1923
- // The VM will set the ISA flags depending on actual hardware support
1924
- // and any specified config switches specified by the user. The exception
1925
- // here is for certain "artificial ISAs" such as Vector64/128/256 where they
1926
- // don't actually exist. The JIT is in charge of adding those and ensuring
1927
- // the total sum of flags is still valid.
1923
+ // The VM will set the ISA flags depending on actual hardware support and any
1924
+ // config values specified by the user. Config may cause the VM to omit baseline
1925
+ // ISAs from the supported set. We force their inclusion here so that JIT code
1926
+ // can use them unconditionally, but we will honor the config when resolving
1927
+ // managed HWIntrinsic methods.
1928
+ //
1929
+ // We also take care of adding the virtual vector ISAs (i.e. Vector64/128/256/512)
1930
+ // here, based on the combination of hardware ISA support and config values.
1931
+
1928
1932
#if defined(TARGET_XARCH)
1929
1933
// If the VM passed in a virtual vector ISA, it was done to communicate PreferredVectorBitWidth.
1930
1934
// No check is done for the validity of the value, since it will be clamped to max supported by
@@ -1955,10 +1959,14 @@ void Compiler::compSetProcessor()
1955
1959
!instructionSetFlags.HasInstructionSet (InstructionSet_Vector256) &&
1956
1960
!instructionSetFlags.HasInstructionSet (InstructionSet_Vector512));
1957
1961
1958
- if (instructionSetFlags.HasInstructionSet (InstructionSet_X86Base))
1959
- {
1960
- instructionSetFlags.AddInstructionSet (InstructionSet_Vector128);
1961
- }
1962
+ // Ensure required baseline ISAs are supported in JIT code, even if not passed in by the VM.
1963
+ instructionSetFlags.AddInstructionSet (InstructionSet_X86Base);
1964
+ #ifdef TARGET_AMD64
1965
+ instructionSetFlags.AddInstructionSet (InstructionSet_X86Base_X64);
1966
+ #endif // TARGET_AMD64
1967
+
1968
+ // We can now add the virtual vector ISAs as appropriate. Vector128 is part of the required baseline.
1969
+ instructionSetFlags.AddInstructionSet (InstructionSet_Vector128);
1962
1970
1963
1971
if (instructionSetFlags.HasInstructionSet (InstructionSet_AVX))
1964
1972
{
@@ -1970,11 +1978,15 @@ void Compiler::compSetProcessor()
1970
1978
instructionSetFlags.AddInstructionSet (InstructionSet_Vector512);
1971
1979
}
1972
1980
#elif defined(TARGET_ARM64)
1973
- if (instructionSetFlags.HasInstructionSet (InstructionSet_AdvSimd))
1974
- {
1975
- instructionSetFlags.AddInstructionSet (InstructionSet_Vector64);
1976
- instructionSetFlags.AddInstructionSet (InstructionSet_Vector128);
1977
- }
1981
+ // Ensure required baseline ISAs are supported in JIT code, even if not passed in by the VM.
1982
+ instructionSetFlags.AddInstructionSet (InstructionSet_ArmBase);
1983
+ instructionSetFlags.AddInstructionSet (InstructionSet_ArmBase_Arm64);
1984
+ instructionSetFlags.AddInstructionSet (InstructionSet_AdvSimd);
1985
+ instructionSetFlags.AddInstructionSet (InstructionSet_AdvSimd_Arm64);
1986
+
1987
+ // Add virtual vector ISAs. These are both supported as part of the required baseline.
1988
+ instructionSetFlags.AddInstructionSet (InstructionSet_Vector64);
1989
+ instructionSetFlags.AddInstructionSet (InstructionSet_Vector128);
1978
1990
#endif // TARGET_ARM64
1979
1991
1980
1992
assert (instructionSetFlags.Equals (EnsureInstructionSetFlagsAreValid (instructionSetFlags)));
@@ -5956,11 +5968,8 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr,
5956
5968
}
5957
5969
}
5958
5970
5959
- if (JitConfig.EnableHWIntrinsic () != 0 )
5960
- {
5961
- instructionSetFlags.AddInstructionSet (InstructionSet_ArmBase);
5962
- instructionSetFlags.AddInstructionSet (InstructionSet_AdvSimd);
5963
- }
5971
+ instructionSetFlags.AddInstructionSet (InstructionSet_ArmBase);
5972
+ instructionSetFlags.AddInstructionSet (InstructionSet_AdvSimd);
5964
5973
5965
5974
if (JitConfig.EnableArm64Aes () != 0 )
5966
5975
{
@@ -6029,10 +6038,7 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr,
6029
6038
}
6030
6039
}
6031
6040
6032
- if (JitConfig.EnableHWIntrinsic () != 0 )
6033
- {
6034
- instructionSetFlags.AddInstructionSet (InstructionSet_X86Base);
6035
- }
6041
+ instructionSetFlags.AddInstructionSet (InstructionSet_X86Base);
6036
6042
6037
6043
if (JitConfig.EnableSSE3 () != 0 )
6038
6044
{
@@ -6142,10 +6148,7 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr,
6142
6148
instructionSetFlags.AddInstructionSet (InstructionSet_APX);
6143
6149
}
6144
6150
#elif defined(TARGET_RISCV64)
6145
- if (JitConfig.EnableHWIntrinsic () != 0 )
6146
- {
6147
- instructionSetFlags.AddInstructionSet (InstructionSet_RiscV64Base);
6148
- }
6151
+ instructionSetFlags.AddInstructionSet (InstructionSet_RiscV64Base);
6149
6152
6150
6153
if (JitConfig.EnableRiscV64Zba () != 0 )
6151
6154
{
0 commit comments