From 5cc4b1059b2842418514a54599a37900b8c608a0 Mon Sep 17 00:00:00 2001 From: Freddy Ye Date: Tue, 25 Jul 2023 11:00:04 +0800 Subject: [PATCH] [X86] Update features for sierraforest, grandridge Reviewed By: pengfei Differential Revision: https://reviews.llvm.org/D155784 --- clang/test/Preprocessor/predefined-arch-macros.c | 150 +++-------------------- llvm/lib/Target/X86/X86.td | 2 + llvm/lib/TargetParser/X86TargetParser.cpp | 4 +- 3 files changed, 18 insertions(+), 138 deletions(-) diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 03d60c5..17ea99f 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -2455,6 +2455,9 @@ // RUN: %clang -march=sierraforest -m32 -E -dM %s -o - 2>&1 \ // RUN: --target=i386 \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SRF_M32 +// RUN: %clang -march=grandridge -m32 -E -dM %s -o - 2>&1 \ +// RUN: --target=i386 \ +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_SRF_M32,CHECK_GRR_M32 // CHECK_SRF_M32: #define __ADX__ 1 // CHECK_SRF_M32: #define __AES__ 1 // CHECK_SRF_M32: #define __AVX2__ 1 @@ -2470,6 +2473,7 @@ // CHECK_SRF_M32: #define __CLFLUSHOPT__ 1 // CHECK_SRF_M32: #define __CLWB__ 1 // CHECK_SRF_M32: #define __CMPCCXADD__ 1 +// CHECK_SRF_M32: #define __ENQCMD__ 1 // CHECK_SRF_M32: #define __F16C__ 1 // CHECK_SRF_M32: #define __FMA__ 1 // CHECK_SRF_M32: #define __FSGSBASE__ 1 @@ -2489,6 +2493,8 @@ // CHECK_SRF_M32: #define __POPCNT__ 1 // CHECK_SRF_M32: #define __PRFCHW__ 1 // CHECK_SRF_M32: #define __PTWRITE__ 1 +// CHECK_SRF_M32-NOT: #define __RAOINT__ 1 +// CHECK_GRR_M32: #define __RAOINT__ 1 // CHECK_SRF_M32: #define __RDPID__ 1 // CHECK_SRF_M32: #define __RDRND__ 1 // CHECK_SRF_M32: #define __RDSEED__ 1 @@ -2503,6 +2509,7 @@ // CHECK_SRF_M32: #define __SSE_MATH__ 1 // CHECK_SRF_M32: #define __SSE__ 1 // CHECK_SRF_M32: #define __SSSE3__ 1 +// CHECK_SRF_M32: #define __UINTR__ 1 // CHECK_SRF_M32: #define __VAES__ 1 // CHECK_SRF_M32: #define __VPCLMULQDQ__ 1 // CHECK_SRF_M32: #define __WAITPKG__ 1 @@ -2521,6 +2528,9 @@ // RUN: %clang -march=sierraforest -m64 -E -dM %s -o - 2>&1 \ // RUN: --target=i386 \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SRF_M64 +// RUN: %clang -march=grandridge -m64 -E -dM %s -o - 2>&1 \ +// RUN: --target=i386 \ +// RUN: | FileCheck -match-full-lines %s -check-prefixes=CHECK_SRF_M64,CHECK_GRR_M64 // CHECK_SRF_M64: #define __ADX__ 1 // CHECK_SRF_M64: #define __AES__ 1 // CHECK_SRF_M64: #define __AVX2__ 1 @@ -2536,6 +2546,7 @@ // CHECK_SRF_M64: #define __CLFLUSHOPT__ 1 // CHECK_SRF_M64: #define __CLWB__ 1 // CHECK_SRF_M64: #define __CMPCCXADD__ 1 +// CHECK_SRF_M64: #define __ENQCMD__ 1 // CHECK_SRF_M64: #define __F16C__ 1 // CHECK_SRF_M64: #define __FMA__ 1 // CHECK_SRF_M64: #define __FSGSBASE__ 1 @@ -2555,6 +2566,8 @@ // CHECK_SRF_M64: #define __POPCNT__ 1 // CHECK_SRF_M64: #define __PRFCHW__ 1 // CHECK_SRF_M64: #define __PTWRITE__ 1 +// CHECK_SRF_M64-NOT: #define __RAOINT__ 1 +// CHECK_GRR_M64: #define __RAOINT__ 1 // CHECK_SRF_M64: #define __RDPID__ 1 // CHECK_SRF_M64: #define __RDRND__ 1 // CHECK_SRF_M64: #define __RDSEED__ 1 @@ -2570,6 +2583,7 @@ // CHECK_SRF_M64: #define __SSE_MATH__ 1 // CHECK_SRF_M64: #define __SSE__ 1 // CHECK_SRF_M64: #define __SSSE3__ 1 +// CHECK_SRF_M64: #define __UINTR__ 1 // CHECK_SRF_M64: #define __VAES__ 1 // CHECK_SRF_M64: #define __VPCLMULQDQ__ 1 // CHECK_SRF_M64: #define __WAITPKG__ 1 @@ -2586,142 +2600,6 @@ // CHECK_SRF_M64: #define __x86_64 1 // CHECK_SRF_M64: #define __x86_64__ 1 -// RUN: %clang -march=grandridge -m32 -E -dM %s -o - 2>&1 \ -// RUN: --target=i386 \ -// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_GRR_M32 -// CHECK_GRR_M32: #define __ADX__ 1 -// CHECK_GRR_M32: #define __AES__ 1 -// CHECK_GRR_M32: #define __AVX2__ 1 -// CHECK_GRR_M32-NOT: AVX512 -// CHECK_GRR_M32: #define __AVXIFMA__ 1 -// CHECK_GRR_M32: #define __AVXNECONVERT__ 1 -// CHECK_GRR_M32: #define __AVXVNNIINT8__ 1 -// CHECK_GRR_M32: #define __AVXVNNI__ 1 -// CHECK_GRR_M32: #define __AVX__ 1 -// CHECK_GRR_M32: #define __BMI2__ 1 -// CHECK_GRR_M32: #define __BMI__ 1 -// CHECK_GRR_M32: #define __CLDEMOTE__ 1 -// CHECK_GRR_M32: #define __CLFLUSHOPT__ 1 -// CHECK_GRR_M32: #define __CLWB__ 1 -// CHECK_GRR_M32: #define __CMPCCXADD__ 1 -// CHECK_GRR_M32: #define __F16C__ 1 -// CHECK_GRR_M32: #define __FMA__ 1 -// CHECK_GRR_M32: #define __FSGSBASE__ 1 -// CHECK_GRR_M32: #define __FXSR__ 1 -// CHECK_GRR_M32: #define __GFNI__ 1 -// CHECK_GRR_M32: #define __HRESET__ 1 -// CHECK_GRR_M32: #define __INVPCID__ 1 -// CHECK_GRR_M32: #define __KL__ 1 -// CHECK_GRR_M32: #define __LZCNT__ 1 -// CHECK_GRR_M32: #define __MMX__ 1 -// CHECK_GRR_M32: #define __MOVBE__ 1 -// CHECK_GRR_M32: #define __MOVDIR64B__ 1 -// CHECK_GRR_M32: #define __MOVDIRI__ 1 -// CHECK_GRR_M32: #define __PCLMUL__ 1 -// CHECK_GRR_M32: #define __PCONFIG__ 1 -// CHECK_GRR_M32: #define __PKU__ 1 -// CHECK_GRR_M32: #define __POPCNT__ 1 -// CHECK_GRR_M32: #define __PRFCHW__ 1 -// CHECK_GRR_M32: #define __PTWRITE__ 1 -// CHECK_GRR_M32: #define __RAOINT__ 1 -// CHECK_GRR_M32: #define __RDPID__ 1 -// CHECK_GRR_M32: #define __RDRND__ 1 -// CHECK_GRR_M32: #define __RDSEED__ 1 -// CHECK_GRR_M32: #define __SERIALIZE__ 1 -// CHECK_GRR_M32: #define __SGX__ 1 -// CHECK_GRR_M32: #define __SHA__ 1 -// CHECK_GRR_M32: #define __SHSTK__ 1 -// CHECK_GRR_M32: #define __SSE2__ 1 -// CHECK_GRR_M32: #define __SSE3__ 1 -// CHECK_GRR_M32: #define __SSE4_1__ 1 -// CHECK_GRR_M32: #define __SSE4_2__ 1 -// CHECK_GRR_M32: #define __SSE_MATH__ 1 -// CHECK_GRR_M32: #define __SSE__ 1 -// CHECK_GRR_M32: #define __SSSE3__ 1 -// CHECK_GRR_M32: #define __VAES__ 1 -// CHECK_GRR_M32: #define __VPCLMULQDQ__ 1 -// CHECK_GRR_M32: #define __WAITPKG__ 1 -// CHECK_GRR_M32: #define __WIDEKL__ 1 -// CHECK_GRR_M32: #define __XSAVEC__ 1 -// CHECK_GRR_M32: #define __XSAVEOPT__ 1 -// CHECK_GRR_M32: #define __XSAVES__ 1 -// CHECK_GRR_M32: #define __XSAVE__ 1 -// CHECK_GRR_M32: #define __corei7 1 -// CHECK_GRR_M32: #define __corei7__ 1 -// CHECK_GRR_M32: #define __i386 1 -// CHECK_GRR_M32: #define __i386__ 1 -// CHECK_GRR_M32: #define __tune_corei7__ 1 -// CHECK_GRR_M32: #define i386 1 - -// RUN: %clang -march=grandridge -m64 -E -dM %s -o - 2>&1 \ -// RUN: --target=x86_64 \ -// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_GRR_M64 -// CHECK_GRR_M64: #define __ADX__ 1 -// CHECK_GRR_M64: #define __AES__ 1 -// CHECK_GRR_M64: #define __AVX2__ 1 -// CHECK_GRR_M64-NOT: AVX512 -// CHECK_GRR_M64: #define __AVXIFMA__ 1 -// CHECK_GRR_M64: #define __AVXNECONVERT__ 1 -// CHECK_GRR_M64: #define __AVXVNNIINT8__ 1 -// CHECK_GRR_M64: #define __AVXVNNI__ 1 -// CHECK_GRR_M64: #define __AVX__ 1 -// CHECK_GRR_M64: #define __BMI2__ 1 -// CHECK_GRR_M64: #define __BMI__ 1 -// CHECK_GRR_M64: #define __CLDEMOTE__ 1 -// CHECK_GRR_M64: #define __CLFLUSHOPT__ 1 -// CHECK_GRR_M64: #define __CLWB__ 1 -// CHECK_GRR_M64: #define __CMPCCXADD__ 1 -// CHECK_GRR_M64: #define __F16C__ 1 -// CHECK_GRR_M64: #define __FMA__ 1 -// CHECK_GRR_M64: #define __FSGSBASE__ 1 -// CHECK_GRR_M64: #define __FXSR__ 1 -// CHECK_GRR_M64: #define __GFNI__ 1 -// CHECK_GRR_M64: #define __HRESET__ 1 -// CHECK_GRR_M64: #define __INVPCID__ 1 -// CHECK_GRR_M64: #define __KL__ 1 -// CHECK_GRR_M64: #define __LZCNT__ 1 -// CHECK_GRR_M64: #define __MMX__ 1 -// CHECK_GRR_M64: #define __MOVBE__ 1 -// CHECK_GRR_M64: #define __MOVDIR64B__ 1 -// CHECK_GRR_M64: #define __MOVDIRI__ 1 -// CHECK_GRR_M64: #define __PCLMUL__ 1 -// CHECK_GRR_M64: #define __PCONFIG__ 1 -// CHECK_GRR_M64: #define __PKU__ 1 -// CHECK_GRR_M64: #define __POPCNT__ 1 -// CHECK_GRR_M64: #define __PRFCHW__ 1 -// CHECK_GRR_M64: #define __PTWRITE__ 1 -// CHECK_GRR_M64: #define __RAOINT__ 1 -// CHECK_GRR_M64: #define __RDPID__ 1 -// CHECK_GRR_M64: #define __RDRND__ 1 -// CHECK_GRR_M64: #define __RDSEED__ 1 -// CHECK_GRR_M64: #define __SERIALIZE__ 1 -// CHECK_GRR_M64: #define __SGX__ 1 -// CHECK_GRR_M64: #define __SHA__ 1 -// CHECK_GRR_M64: #define __SHSTK__ 1 -// CHECK_GRR_M64: #define __SSE2_MATH__ 1 -// CHECK_GRR_M64: #define __SSE2__ 1 -// CHECK_GRR_M64: #define __SSE3__ 1 -// CHECK_GRR_M64: #define __SSE4_1__ 1 -// CHECK_GRR_M64: #define __SSE4_2__ 1 -// CHECK_GRR_M64: #define __SSE_MATH__ 1 -// CHECK_GRR_M64: #define __SSE__ 1 -// CHECK_GRR_M64: #define __SSSE3__ 1 -// CHECK_GRR_M64: #define __VAES__ 1 -// CHECK_GRR_M64: #define __VPCLMULQDQ__ 1 -// CHECK_GRR_M64: #define __WAITPKG__ 1 -// CHECK_GRR_M64: #define __WIDEKL__ 1 -// CHECK_GRR_M64: #define __XSAVEC__ 1 -// CHECK_GRR_M64: #define __XSAVEOPT__ 1 -// CHECK_GRR_M64: #define __XSAVES__ 1 -// CHECK_GRR_M64: #define __XSAVE__ 1 -// CHECK_GRR_M64: #define __amd64 1 -// CHECK_GRR_M64: #define __amd64__ 1 -// CHECK_GRR_M64: #define __corei7 1 -// CHECK_GRR_M64: #define __corei7__ 1 -// CHECK_GRR_M64: #define __tune_corei7__ 1 -// CHECK_GRR_M64: #define __x86_64 1 -// CHECK_GRR_M64: #define __x86_64__ 1 - // RUN: %clang -march=geode -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_GEODE_M32 diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td index 6f67561..cc88af1 100644 --- a/llvm/lib/Target/X86/X86.td +++ b/llvm/lib/Target/X86/X86.td @@ -1200,6 +1200,8 @@ def ProcessorFeatures { list SRFAdditionalFeatures = [FeatureCMPCCXADD, FeatureAVXIFMA, FeatureAVXNECONVERT, + FeatureENQCMD, + FeatureUINTR, FeatureAVXVNNIINT8]; list SRFFeatures = !listconcat(ADLFeatures, SRFAdditionalFeatures); diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp index 606370b..6d2c903 100644 --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -234,8 +234,8 @@ constexpr FeatureBitset FeaturesAlderlake = FeatureCLDEMOTE | FeatureMOVDIR64B | FeatureMOVDIRI | FeatureWAITPKG | FeatureAVXVNNI | FeatureHRESET | FeatureWIDEKL; constexpr FeatureBitset FeaturesSierraforest = - FeaturesAlderlake | FeatureCMPCCXADD | FeatureAVXIFMA | - FeatureAVXNECONVERT | FeatureAVXVNNIINT8; + FeaturesAlderlake | FeatureCMPCCXADD | FeatureAVXIFMA | FeatureUINTR | + FeatureENQCMD | FeatureAVXNECONVERT | FeatureAVXVNNIINT8; constexpr FeatureBitset FeaturesGrandridge = FeaturesSierraforest | FeatureRAOINT; -- 2.7.4