Skip to content

Commit

Permalink
Don't invoke EnsureInstructionSetFlagsAreValid all the time in JIT (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Oct 20, 2022
1 parent be7d6f5 commit ddebaf5
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2252,33 +2252,39 @@ void Compiler::compSetProcessor()
opts.compUseCMOV = jitFlags.IsSet(JitFlags::JIT_FLAG_USE_CMOV);
#ifdef DEBUG
if (opts.compUseCMOV)
opts.compUseCMOV = !compStressCompile(STRESS_USE_CMOV, 50);
opts.compUseCMOV = !compStressCompile(STRESS_USE_CMOV, 50);
#endif // DEBUG

#endif // TARGET_X86

// The VM will set the ISA flags depending on actual hardware support
// and any specified config switches specified by the user. The exception
// here is for certain "artificial ISAs" such as Vector64/128/256 where they
// don't actually exist. The JIT is in charge of adding those and ensuring
// the total sum of flags is still valid.

CORINFO_InstructionSetFlags instructionSetFlags = jitFlags.GetInstructionSetFlags();
opts.compSupportsISA.Reset();
opts.compSupportsISAReported.Reset();
opts.compSupportsISAExactly.Reset();

// The VM will set the ISA flags depending on actual hardware support
// and any specified config switches specified by the user. The exception
// here is for certain "artificial ISAs" such as Vector64/128/256 where they
// don't actually exist. The JIT is in charge of adding those and ensuring
// the total sum of flags is still valid.
#if defined(TARGET_XARCH)
instructionSetFlags.AddInstructionSet(InstructionSet_Vector128);
instructionSetFlags.AddInstructionSet(InstructionSet_Vector256);
#endif // TARGET_XARCH

#if defined(TARGET_ARM64)
instructionSetFlags.AddInstructionSet(InstructionSet_Vector64);
instructionSetFlags.AddInstructionSet(InstructionSet_Vector128);
if (instructionSetFlags.HasInstructionSet(InstructionSet_SSE))
{
instructionSetFlags.AddInstructionSet(InstructionSet_Vector128);
}
if (instructionSetFlags.HasInstructionSet(InstructionSet_AVX))
{
instructionSetFlags.AddInstructionSet(InstructionSet_Vector256);
}
#elif defined(TARGET_ARM64)
if (instructionSetFlags.HasInstructionSet(InstructionSet_AdvSimd))
{
instructionSetFlags.AddInstructionSet(InstructionSet_Vector64);
instructionSetFlags.AddInstructionSet(InstructionSet_Vector128);
}
#endif // TARGET_ARM64

instructionSetFlags = EnsureInstructionSetFlagsAreValid(instructionSetFlags);
assert(instructionSetFlags.Equals(EnsureInstructionSetFlagsAreValid(instructionSetFlags)));
opts.setSupportedISAs(instructionSetFlags);

#ifdef TARGET_XARCH
Expand Down

0 comments on commit ddebaf5

Please sign in to comment.