https://github.com/phoebewang created https://github.com/llvm/llvm-project/pull/148184
According to Intel [SDM088](https://cdrdv2.intel.com/v1/dl/getContent/671200) Volume 1, Chapter 2.4, Key Locker will be removed from 2025 onwards products. >From 9a8224c22535912a1fa95caa41f8fc2c3f7a76d0 Mon Sep 17 00:00:00 2001 From: "Wang, Phoebe" <phoebe.w...@intel.com> Date: Fri, 11 Jul 2025 17:54:32 +0800 Subject: [PATCH] [X86] Remove WIDEKL feature from Pantherlake and Clearwaterforest According to Intel [SDM088](https://cdrdv2.intel.com/v1/dl/getContent/671200) Volume 1, Chapter 2.4, Key Locker will be removed from 2025 onwards products. --- .../Preprocessor/predefined-arch-macros.c | 40 ++++++++++--------- llvm/lib/Target/X86/X86.td | 4 +- llvm/lib/TargetParser/X86TargetParser.cpp | 6 +-- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 86d51820ae5b5..e82d825704439 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -2556,25 +2556,25 @@ // RUN: %clang -march=sierraforest -m32 -E -dM %s -o - 2>&1 \ // RUN: --target=i386 \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_SRF_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_SRF_M32,CHECK_KL_M32 // RUN: %clang -march=grandridge -m32 -E -dM %s -o - 2>&1 \ // RUN: --target=i386 \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_SRF_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_SRF_M32,CHECK_KL_M32 // RUN: %clang -march=arrowlake -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ARL_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_KL_M32 // RUN: %clang -march=arrowlake-s -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_ARLS_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_ARLS_M32,CHECK_KL_M32 // RUN: %clang -march=lunarlake -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_ARLS_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_ARLS_M32,CHECK_KL_M32 // RUN: %clang -march=pantherlake -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_ARLS_M32,CHECK_PTL_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M32,CHECK_ARLS_M32,CHECK_PTL_M32,CHECK_NKL_M32 // RUN: %clang -march=clearwaterforest -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_SRF_M32,CHECK_ARLS_M32,CHECK_PTL_M32,CHECK_CWF_M32 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_SRF_M32,CHECK_ARLS_M32,CHECK_PTL_M32,CHECK_CWF_M32,CHECK_NKL_M32 // CHECK_ARL_M32: #define __ADX__ 1 // CHECK_ARL_M32: #define __AES__ 1 // CHECK_ARL_M32: #define __AVX2__ 1 @@ -2601,7 +2601,8 @@ // CHECK_ARL_M32: #define __GFNI__ 1 // CHECK_ARL_M32: #define __HRESET__ 1 // CHECK_ARL_M32: #define __INVPCID__ 1 -// CHECK_ARL_M32: #define __KL__ 1 +// CHECK_KL_M32: #define __KL__ 1 +// CHECK_NKL_M32-NOT: __KL__ // CHECK_ARL_M32: #define __LZCNT__ 1 // CHECK_ARL_M32: #define __MMX__ 1 // CHECK_ARL_M32: #define __MOVBE__ 1 @@ -2645,7 +2646,8 @@ // CHECK_ARL_M32: #define __VAES__ 1 // CHECK_ARL_M32: #define __VPCLMULQDQ__ 1 // CHECK_ARL_M32: #define __WAITPKG__ 1 -// CHECK_ARL_M32: #define __WIDEKL__ 1 +// CHECK_KL_M32: #define __WIDEKL__ 1 +// CHECK_NKL_M32-NOT: __WIDEKL__ // CHECK_ARL_M32: #define __XSAVEC__ 1 // CHECK_ARL_M32: #define __XSAVEOPT__ 1 // CHECK_ARL_M32: #define __XSAVES__ 1 @@ -2659,25 +2661,25 @@ // RUN: %clang -march=sierraforest -m64 -E -dM %s -o - 2>&1 \ // RUN: --target=i386 \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_SRF_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_SRF_M64,CHECK_KL_M64 // RUN: %clang -march=grandridge -m64 -E -dM %s -o - 2>&1 \ // RUN: --target=i386 \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_SRF_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_SRF_M64,CHECK_KL_M64 // RUN: %clang -march=arrowlake -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ARL_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_KL_M64 // RUN: %clang -march=arrowlake-s -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_ARLS_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_ARLS_M64,CHECK_KL_M64 // RUN: %clang -march=lunarlake -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_ARLS_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_ARLS_M64,CHECK_KL_M64 // RUN: %clang -march=pantherlake -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_ARLS_M64,CHECK_PTL_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_ARLS_M64,CHECK_PTL_M64,CHECK_NKL_M64 // RUN: %clang -march=clearwaterforest -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ -// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_SRF_M64,CHECK_ARLS_M64,CHECK_PTL_M64,CHECK_CWF_M64 +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_ARL_M64,CHECK_SRF_M64,CHECK_ARLS_M64,CHECK_PTL_M64,CHECK_CWF_M64,CHECK_NKL_M64 // CHECK_ARL_M64: #define __ADX__ 1 // CHECK_ARL_M64: #define __AES__ 1 // CHECK_ARL_M64: #define __AVX2__ 1 @@ -2704,7 +2706,8 @@ // CHECK_ARL_M64: #define __GFNI__ 1 // CHECK_ARL_M64: #define __HRESET__ 1 // CHECK_ARL_M64: #define __INVPCID__ 1 -// CHECK_ARL_M64: #define __KL__ 1 +// CHECK_KL_M64: #define __KL__ 1 +// CHECK_NKL_M64-NOT: __KL__ // CHECK_ARL_M64: #define __LZCNT__ 1 // CHECK_ARL_M64: #define __MMX__ 1 // CHECK_ARL_M64: #define __MOVBE__ 1 @@ -2749,7 +2752,8 @@ // CHECK_ARL_M64: #define __VAES__ 1 // CHECK_ARL_M64: #define __VPCLMULQDQ__ 1 // CHECK_ARL_M64: #define __WAITPKG__ 1 -// CHECK_ARL_M64: #define __WIDEKL__ 1 +// CHECK_KL_M64: #define __WIDEKL__ 1 +// CHECK_NKL_M64-NOT: __WIDEKL__ // CHECK_ARL_M64: #define __XSAVEC__ 1 // CHECK_ARL_M64: #define __XSAVEOPT__ 1 // CHECK_ARL_M64: #define __XSAVES__ 1 diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td index 772e48efb8607..990b381341f07 100644 --- a/llvm/lib/Target/X86/X86.td +++ b/llvm/lib/Target/X86/X86.td @@ -1331,7 +1331,7 @@ def ProcessorFeatures { // Pantherlake list<SubtargetFeature> PTLAdditionalFeatures = [FeaturePREFETCHI]; list<SubtargetFeature> PTLFeatures = - !listconcat(ARLSFeatures, PTLAdditionalFeatures); + !listremove(!listconcat(ARLSFeatures, PTLAdditionalFeatures), [FeatureWIDEKL]); // Clearwaterforest @@ -1342,7 +1342,7 @@ def ProcessorFeatures { FeatureSM4, FeatureUSERMSR]; list<SubtargetFeature> CWFFeatures = - !listconcat(SRFFeatures, CWFAdditionalFeatures); + !listremove(!listconcat(SRFFeatures, CWFAdditionalFeatures), [FeatureWIDEKL]); // Knights Landing list<SubtargetFeature> KNLFeatures = [FeatureX87, diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp index 94812e4e60c3d..57fbc71fa22ee 100644 --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -176,10 +176,10 @@ constexpr FeatureBitset FeaturesArrowlakeS = FeaturesArrowlake | FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 | FeatureSM4; constexpr FeatureBitset FeaturesPantherlake = - FeaturesArrowlakeS | FeaturePREFETCHI; + FeaturesArrowlakeS ^ FeatureWIDEKL | FeaturePREFETCHI; constexpr FeatureBitset FeaturesClearwaterforest = - FeaturesSierraforest | FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 | - FeatureSM4 | FeaturePREFETCHI | FeatureUSERMSR; + FeaturesSierraforest ^ FeatureWIDEKL | FeatureAVXVNNIINT16 | FeatureSHA512 | + FeatureSM3 | FeatureSM4 | FeaturePREFETCHI | FeatureUSERMSR; // Geode Processor. constexpr FeatureBitset FeaturesGeode = _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits