From f7fbcc7003959a599686ede2df781bc7a21cac5c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 11:04:52 +0000 Subject: [PATCH 1/2] Initial plan From 21922bb2b4d4e0e6f55ab7a04fe755bc890a57fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Apr 2026 11:38:25 +0000 Subject: [PATCH 2/2] JIT: gate Vector512.ConvertToInt32(Native) on AVX-512 support Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/d3553c5c-02dd-45e0-8878-95eb48397075 Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com> --- src/coreclr/jit/gentree.cpp | 4 ++-- src/coreclr/jit/hwintrinsicxarch.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index a0a8e62c337a40..4741dce96ae8cd 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -23127,7 +23127,7 @@ GenTree* Compiler::gtNewSimdCvtNode( assert(varTypeIsIntegral(simdTargetBaseType)); #if defined(TARGET_XARCH) - assert(compIsaSupportedDebugOnly(InstructionSet_AVX512) || (simdTargetBaseType == TYP_INT)); + assert(compIsaSupportedDebugOnly(InstructionSet_AVX512) || ((simdTargetBaseType == TYP_INT) && (simdSize != 64))); GenTree* fixupVal; @@ -23258,7 +23258,7 @@ GenTree* Compiler::gtNewSimdCvtNativeNode( NamedIntrinsic hwIntrinsicID = NI_Illegal; #if defined(TARGET_XARCH) - assert(compIsaSupportedDebugOnly(InstructionSet_AVX512) || (simdTargetBaseType == TYP_INT)); + assert(compIsaSupportedDebugOnly(InstructionSet_AVX512) || ((simdTargetBaseType == TYP_INT) && (simdSize != 64))); switch (simdSourceBaseType) { diff --git a/src/coreclr/jit/hwintrinsicxarch.cpp b/src/coreclr/jit/hwintrinsicxarch.cpp index 9c57cded52e184..aa0c8f34526d91 100644 --- a/src/coreclr/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/jit/hwintrinsicxarch.cpp @@ -1853,6 +1853,13 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, assert(sig->numArgs == 1); assert(simdBaseType == TYP_FLOAT); + if ((simdSize == 64) && !compOpportunisticallyDependsOn(InstructionSet_AVX512)) + { + // Vector512 float->int conversion requires AVX-512 for the native + // truncation instruction. Fall back to the managed implementation. + break; + } + op1 = impSIMDPopStack(); retNode = gtNewSimdCvtNode(retType, op1, TYP_INT, simdBaseType, simdSize); break; @@ -1870,6 +1877,13 @@ GenTree* Compiler::impSpecialIntrinsic(NamedIntrinsic intrinsic, break; } + if ((simdSize == 64) && !compOpportunisticallyDependsOn(InstructionSet_AVX512)) + { + // Vector512 float->int conversion requires AVX-512 for the native + // truncation instruction. Fall back to the managed implementation. + break; + } + op1 = impSIMDPopStack(); retNode = gtNewSimdCvtNativeNode(retType, op1, TYP_INT, simdBaseType, simdSize); break;