From fdab5df303d9be013daa5c61c88f67e3ce153d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Tue, 3 Dec 2024 09:00:36 +0100 Subject: [PATCH] Fix `GetHardwareIntrinsicId` on 32bit platforms (#110238) AFAIK methods on the nested X64/Arm64 classes shouldn't be considered intrinsics on 32bit platforms since they are as relevant as e.g. WASM intrinsics. This should fix widespread runtime-nativeaot-outerloop failure on x86. I think this regressed in #109137. --- .../tools/Common/Compiler/InstructionSetSupport.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs b/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs index 1d2a4074a5458..480a604d6f7b8 100644 --- a/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs +++ b/src/coreclr/tools/Common/Compiler/InstructionSetSupport.cs @@ -71,8 +71,13 @@ public static string GetHardwareIntrinsicId(TargetArchitecture architecture, Typ return ""; // 64-bit ISA variants are not included in the mapping dictionary, so we use the containing type instead - if ((architecture, potentialType.Name) is (TargetArchitecture.X64, "X64") or (TargetArchitecture.ARM64, "Arm64")) - potentialType = (MetadataType)potentialType.ContainingType; + if (potentialType.Name is "X64" or "Arm64") + { + if (architecture is TargetArchitecture.X64 or TargetArchitecture.ARM64) + potentialType = (MetadataType)potentialType.ContainingType; + else + return ""; + } // We assume that managed names in InstructionSetDesc.txt use an underscore separator for nested classes string suffix = "";