diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs index 6ec6baeded8a95..2e090550840e64 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -520,10 +520,17 @@ public static bool ShouldSkipCompilation(InstructionSetSupport instructionSetSup { return true; } - if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(methodNeedingCode)) + + // On platforms where we can JIT, we will rarely need the hardware intrinsic fallback implementations. + // On platforms where we cannot JIT, we need to ensure that we have a fallback implementation pre-compiled + // so any code that uses hardware intrinsics and is interpreted has an implementation to use. + // This allows us to avoid the high cost of manually implementing intrinsics in the interpreter. + if (HardwareIntrinsicHelpers.IsHardwareIntrinsic(methodNeedingCode) + && ((ReadyToRunCompilerContext)methodNeedingCode.Context).TargetAllowsRuntimeCodeGeneration) { return true; } + if (methodNeedingCode.IsAbstract) { return true;