From 079e9b0bfab17b6a5b8f95fe2cf6138d489f7be7 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sun, 21 May 2023 07:10:07 -0700 Subject: [PATCH] Ensure we handle HWIntrinsics being disabled --- src/coreclr/jit/compiler.h | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/coreclr/jit/compiler.h b/src/coreclr/jit/compiler.h index 6b7d47e207241..a8e4f3191b68e 100644 --- a/src/coreclr/jit/compiler.h +++ b/src/coreclr/jit/compiler.h @@ -8696,25 +8696,33 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX uint32_t getMaxVectorByteLength() const { #if defined(FEATURE_HW_INTRINSICS) && defined(TARGET_XARCH) - if (compOpportunisticallyDependsOn(InstructionSet_AVX)) + if (compOpportunisticallyDependsOn(InstructionSet_AVX512F)) { - if (compOpportunisticallyDependsOn(InstructionSet_AVX512F)) - { - return ZMM_REGSIZE_BYTES; - } - else - { - return YMM_REGSIZE_BYTES; - } + return ZMM_REGSIZE_BYTES; } - else + else if (compOpportunisticallyDependsOn(InstructionSet_AVX)) + { + return YMM_REGSIZE_BYTES; + } + else if (compOpportunisticallyDependsOn(InstructionSet_SSE)) { - assert(compIsaSupportedDebugOnly(InstructionSet_SSE)); return XMM_REGSIZE_BYTES; } + else + { + assert((JitConfig.EnableHWIntrinsic() == 0) || (JitConfig.EnableSSE() == 0)); + return 0; + } #elif defined(TARGET_ARM64) - assert(compIsaSupportedDebugOnly(InstructionSet_AdvSimd)); - return FP_REGSIZE_BYTES; + if (compOpportunisticallyDependsOn(InstructionSet_AdvSimd)) + { + return FP_REGSIZE_BYTES; + } + else + { + assert((JitConfig.EnableHWIntrinsic() == 0) || (JitConfig.EnableArm64AdvSimd() == 0)); + return 0; + } #else assert(!"getMaxVectorByteLength() unimplemented on target arch"); unreached();