From d44bcf3c186ec025e3084af3fc2887b7181183d6 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Mon, 1 Jun 2020 14:02:47 -0700 Subject: [PATCH] Return nullptr from impSimdAsHWIntrinsic if the baseline ISA has been marked as disabled --- src/coreclr/src/jit/simdashwintrinsic.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/coreclr/src/jit/simdashwintrinsic.cpp b/src/coreclr/src/jit/simdashwintrinsic.cpp index a4f07b0c2dc816..facb9c2a4baf75 100644 --- a/src/coreclr/src/jit/simdashwintrinsic.cpp +++ b/src/coreclr/src/jit/simdashwintrinsic.cpp @@ -179,6 +179,22 @@ GenTree* Compiler::impSimdAsHWIntrinsic(NamedIntrinsic intrinsic, return nullptr; } +#if defined(TARGET_XARCH) + CORINFO_InstructionSet minimumIsa = InstructionSet_SSE2; +#elif defined(TARGET_ARM64) + CORINFO_InstructionSet minimumIsa = InstructionSet_AdvSimd; +#else +#error Unsupported platform +#endif // !TARGET_XARCH && !TARGET_ARM64 + + if (!compOpportunisticallyDependsOn(minimumIsa)) + { + // The user disabled support for the baseline ISA so + // don't emit any SIMD intrinsics as they all require + // this at a minimum + return nullptr; + } + CORINFO_CLASS_HANDLE argClass = NO_CLASS_HANDLE; var_types retType = JITtype2varType(sig->retType); var_types baseType = TYP_UNKNOWN;