From 8701b18a2530c343ea5ef540113a1f93fc867c2a Mon Sep 17 00:00:00 2001 From: Gabor Buella Date: Tue, 10 Apr 2018 18:58:26 +0000 Subject: [PATCH] [X86] Split up -march=icelake to -client & -server Reviewers: craig.topper, zvi, echristo Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D45056 llvm-svn: 329741 --- clang/include/clang/Basic/X86Target.def | 6 +- clang/lib/Basic/Targets/X86.cpp | 6 +- clang/test/Driver/x86-march.c | 10 +- clang/test/Frontend/x86-target-cpu.c | 3 +- clang/test/Misc/target-invalid-cpu-note.c | 4 +- .../Preprocessor/predefined-arch-macros.c | 119 +++++++++++++++++- 6 files changed, 136 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Basic/X86Target.def b/clang/include/clang/Basic/X86Target.def index 0bb758978eb7..87646e0fdf30 100644 --- a/clang/include/clang/Basic/X86Target.def +++ b/clang/include/clang/Basic/X86Target.def @@ -149,7 +149,11 @@ PROC_WITH_FEAT(Cannonlake, "cannonlake", PROC_64_BIT, FEATURE_AVX512VBMI) /// \name Icelake Client /// Icelake client microarchitecture based processors. -PROC(Icelake, "icelake", PROC_64_BIT) +PROC(IcelakeClient, "icelake-client", PROC_64_BIT) + +/// \name Icelake Server +/// Icelake server microarchitecture based processors. +PROC(IcelakeServer, "icelake-server", PROC_64_BIT) /// \name Knights Landing /// Knights Landing processor. diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 4eb19b401fe2..34c406f3b084 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -153,7 +153,8 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "mmx", true); break; - case CK_Icelake: + case CK_IcelakeServer: + case CK_IcelakeClient: setFeatureEnabledImpl(Features, "vaes", true); setFeatureEnabledImpl(Features, "gfni", true); setFeatureEnabledImpl(Features, "vpclmulqdq", true); @@ -932,7 +933,8 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case CK_SkylakeClient: case CK_SkylakeServer: case CK_Cannonlake: - case CK_Icelake: + case CK_IcelakeClient: + case CK_IcelakeServer: // FIXME: Historically, we defined this legacy name, it would be nice to // remove it at some point. We've never exposed fine-grained names for // recent primary x86 CPUs, and we should keep it that way. diff --git a/clang/test/Driver/x86-march.c b/clang/test/Driver/x86-march.c index 9c9235dc0fdc..5e47ff354277 100644 --- a/clang/test/Driver/x86-march.c +++ b/clang/test/Driver/x86-march.c @@ -60,9 +60,13 @@ // RUN: | FileCheck %s -check-prefix=cannonlake // cannonlake: "-target-cpu" "cannonlake" // -// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=icelake 2>&1 \ -// RUN: | FileCheck %s -check-prefix=icelake -// icelake: "-target-cpu" "icelake" +// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=icelake-client 2>&1 \ +// RUN: | FileCheck %s -check-prefix=icelake-client +// icelake-client: "-target-cpu" "icelake-client" +// +// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=icelake-server 2>&1 \ +// RUN: | FileCheck %s -check-prefix=icelake-server +// icelake-server: "-target-cpu" "icelake-server" // // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=lakemont 2>&1 \ // RUN: | FileCheck %s -check-prefix=lakemont diff --git a/clang/test/Frontend/x86-target-cpu.c b/clang/test/Frontend/x86-target-cpu.c index b5103d238c9d..0ec301f4426e 100644 --- a/clang/test/Frontend/x86-target-cpu.c +++ b/clang/test/Frontend/x86-target-cpu.c @@ -13,7 +13,8 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu skylake-avx512 -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu skx -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu cannonlake -verify %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake -verify %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-client -verify %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-server -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu bonnell -verify %s diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c index 6b98ac97af30..2f71743dc442 100644 --- a/clang/test/Misc/target-invalid-cpu-note.c +++ b/clang/test/Misc/target-invalid-cpu-note.c @@ -16,7 +16,7 @@ // X86-SAME: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, // X86-SAME: nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, // X86-SAME: core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, -// X86-SAME: skx, cannonlake, icelake, knl, knm, lakemont, k6, k6-2, k6-3, +// X86-SAME: skx, cannonlake, icelake-client, icelake-server, knl, knm, lakemont, k6, k6-2, k6-3, // X86-SAME: athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, // X86-SAME: athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, // X86-SAME: barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, @@ -28,7 +28,7 @@ // X86_64-SAME: atom, silvermont, slm, goldmont, nehalem, corei7, westmere, // X86_64-SAME: sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, // X86_64-SAME: core-avx2, broadwell, skylake, skylake-avx512, skx, cannonlake, -// X86_64-SAME: icelake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, +// X86_64-SAME: icelake-client, icelake-server, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, // X86_64-SAME: athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, // X86_64-SAME: btver2, bdver1, bdver2, bdver3, bdver4, znver1, x86-64 diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index d36976ca2ffb..fe664ce3f60e 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -1055,7 +1055,7 @@ // CHECK_CNL_M64: #define __x86_64 1 // CHECK_CNL_M64: #define __x86_64__ 1 -// RUN: %clang -march=icelake -m32 -E -dM %s -o - 2>&1 \ +// RUN: %clang -march=icelake-client -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ICL_M32 // CHECK_ICL_M32: #define __AES__ 1 @@ -1110,8 +1110,8 @@ // CHECK_ICL_M32: #define __i386__ 1 // CHECK_ICL_M32: #define __tune_corei7__ 1 // CHECK_ICL_M32: #define i386 1 -// -// RUN: %clang -march=icelake -m64 -E -dM %s -o - 2>&1 \ + +// RUN: %clang -march=icelake-client -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ICL_M64 // CHECK_ICL_M64: #define __AES__ 1 @@ -1168,6 +1168,119 @@ // CHECK_ICL_M64: #define __x86_64 1 // CHECK_ICL_M64: #define __x86_64__ 1 +// RUN: %clang -march=icelake-server -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ICX_M32 +// CHECK_ICX_M32: #define __AES__ 1 +// CHECK_ICX_M32: #define __AVX2__ 1 +// CHECK_ICX_M32: #define __AVX512BITALG__ 1 +// CHECK_ICX_M32: #define __AVX512BW__ 1 +// CHECK_ICX_M32: #define __AVX512CD__ 1 +// CHECK_ICX_M32: #define __AVX512DQ__ 1 +// CHECK_ICX_M32: #define __AVX512F__ 1 +// CHECK_ICX_M32: #define __AVX512IFMA__ 1 +// CHECK_ICX_M32: #define __AVX512VBMI2__ 1 +// CHECK_ICX_M32: #define __AVX512VBMI__ 1 +// CHECK_ICX_M32: #define __AVX512VL__ 1 +// CHECK_ICX_M32: #define __AVX512VNNI__ 1 +// CHECK_ICX_M32: #define __AVX512VPOPCNTDQ__ 1 +// CHECK_ICX_M32: #define __AVX__ 1 +// CHECK_ICX_M32: #define __BMI2__ 1 +// CHECK_ICX_M32: #define __BMI__ 1 +// CHECK_ICX_M32: #define __CLFLUSHOPT__ 1 +// CHECK_ICX_M32: #define __CLWB__ 1 +// CHECK_ICX_M32: #define __F16C__ 1 +// CHECK_ICX_M32: #define __FMA__ 1 +// CHECK_ICX_M32: #define __GFNI__ 1 +// CHECK_ICX_M32: #define __LZCNT__ 1 +// CHECK_ICX_M32: #define __MMX__ 1 +// CHECK_ICX_M32: #define __MPX__ 1 +// CHECK_ICX_M32: #define __PCLMUL__ 1 +// CHECK_ICX_M32: #define __PKU__ 1 +// CHECK_ICX_M32: #define __POPCNT__ 1 +// CHECK_ICX_M32: #define __PRFCHW__ 1 +// CHECK_ICX_M32: #define __RDPID__ 1 +// CHECK_ICX_M32: #define __RDRND__ 1 +// CHECK_ICX_M32: #define __RDSEED__ 1 +// CHECK_ICX_M32: #define __RTM__ 1 +// CHECK_ICX_M32: #define __SGX__ 1 +// CHECK_ICX_M32: #define __SHA__ 1 +// CHECK_ICX_M32: #define __SSE2__ 1 +// CHECK_ICX_M32: #define __SSE3__ 1 +// CHECK_ICX_M32: #define __SSE4_1__ 1 +// CHECK_ICX_M32: #define __SSE4_2__ 1 +// CHECK_ICX_M32: #define __SSE__ 1 +// CHECK_ICX_M32: #define __SSSE3__ 1 +// CHECK_ICX_M32: #define __VAES__ 1 +// CHECK_ICX_M32: #define __VPCLMULQDQ__ 1 +// CHECK_ICX_M32: #define __XSAVEC__ 1 +// CHECK_ICX_M32: #define __XSAVEOPT__ 1 +// CHECK_ICX_M32: #define __XSAVES__ 1 +// CHECK_ICX_M32: #define __XSAVE__ 1 +// CHECK_ICX_M32: #define __corei7 1 +// CHECK_ICX_M32: #define __corei7__ 1 +// CHECK_ICX_M32: #define __i386 1 +// CHECK_ICX_M32: #define __i386__ 1 +// CHECK_ICX_M32: #define __tune_corei7__ 1 +// CHECK_ICX_M32: #define i386 1 + +// RUN: %clang -march=icelake-server -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ICX_M64 +// CHECK_ICX_M64: #define __AES__ 1 +// CHECK_ICX_M64: #define __AVX2__ 1 +// CHECK_ICX_M64: #define __AVX512BITALG__ 1 +// CHECK_ICX_M64: #define __AVX512BW__ 1 +// CHECK_ICX_M64: #define __AVX512CD__ 1 +// CHECK_ICX_M64: #define __AVX512DQ__ 1 +// CHECK_ICX_M64: #define __AVX512F__ 1 +// CHECK_ICX_M64: #define __AVX512IFMA__ 1 +// CHECK_ICX_M64: #define __AVX512VBMI2__ 1 +// CHECK_ICX_M64: #define __AVX512VBMI__ 1 +// CHECK_ICX_M64: #define __AVX512VL__ 1 +// CHECK_ICX_M64: #define __AVX512VNNI__ 1 +// CHECK_ICX_M64: #define __AVX512VPOPCNTDQ__ 1 +// CHECK_ICX_M64: #define __AVX__ 1 +// CHECK_ICX_M64: #define __BMI2__ 1 +// CHECK_ICX_M64: #define __BMI__ 1 +// CHECK_ICX_M64: #define __CLFLUSHOPT__ 1 +// CHECK_ICX_M64: #define __CLWB__ 1 +// CHECK_ICX_M64: #define __F16C__ 1 +// CHECK_ICX_M64: #define __FMA__ 1 +// CHECK_ICX_M64: #define __GFNI__ 1 +// CHECK_ICX_M64: #define __LZCNT__ 1 +// CHECK_ICX_M64: #define __MMX__ 1 +// CHECK_ICX_M64: #define __MPX__ 1 +// CHECK_ICX_M64: #define __PCLMUL__ 1 +// CHECK_ICX_M64: #define __PKU__ 1 +// CHECK_ICX_M64: #define __POPCNT__ 1 +// CHECK_ICX_M64: #define __PRFCHW__ 1 +// CHECK_ICX_M64: #define __RDPID__ 1 +// CHECK_ICX_M64: #define __RDRND__ 1 +// CHECK_ICX_M64: #define __RDSEED__ 1 +// CHECK_ICX_M64: #define __RTM__ 1 +// CHECK_ICX_M64: #define __SGX__ 1 +// CHECK_ICX_M64: #define __SHA__ 1 +// CHECK_ICX_M64: #define __SSE2__ 1 +// CHECK_ICX_M64: #define __SSE3__ 1 +// CHECK_ICX_M64: #define __SSE4_1__ 1 +// CHECK_ICX_M64: #define __SSE4_2__ 1 +// CHECK_ICX_M64: #define __SSE__ 1 +// CHECK_ICX_M64: #define __SSSE3__ 1 +// CHECK_ICX_M64: #define __VAES__ 1 +// CHECK_ICX_M64: #define __VPCLMULQDQ__ 1 +// CHECK_ICX_M64: #define __XSAVEC__ 1 +// CHECK_ICX_M64: #define __XSAVEOPT__ 1 +// CHECK_ICX_M64: #define __XSAVES__ 1 +// CHECK_ICX_M64: #define __XSAVE__ 1 +// CHECK_ICX_M64: #define __amd64 1 +// CHECK_ICX_M64: #define __amd64__ 1 +// CHECK_ICX_M64: #define __corei7 1 +// CHECK_ICX_M64: #define __corei7__ 1 +// CHECK_ICX_M64: #define __tune_corei7__ 1 +// CHECK_ICX_M64: #define __x86_64 1 +// CHECK_ICX_M64: #define __x86_64__ 1 + // RUN: %clang -march=atom -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ATOM_M32