Skip to content

[X86] Support -march=pantherlake,clearwaterforest #69277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ X86 Support
* Support intrinsic of ``_urdmsr``.
* Support intrinsic of ``_uwrmsr``.
- Support ISA of ``AVX10.1``.
- ``-march=pantherlake`` and ``-march=clearwaterforest`` are now supported.

Arm and AArch64 Support
^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions clang/lib/Basic/Targets/X86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,13 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
case CK_Arrowlake:
case CK_ArrowlakeS:
case CK_Lunarlake:
case CK_Pantherlake:
case CK_Sierraforest:
case CK_Grandridge:
case CK_Graniterapids:
case CK_GraniterapidsD:
case CK_Emeraldrapids:
case CK_Clearwaterforest:
// 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.
Expand Down Expand Up @@ -1501,11 +1503,13 @@ std::optional<unsigned> X86TargetInfo::getCPUCacheLineSize() const {
case CK_Arrowlake:
case CK_ArrowlakeS:
case CK_Lunarlake:
case CK_Pantherlake:
case CK_Sierraforest:
case CK_Grandridge:
case CK_Graniterapids:
case CK_GraniterapidsD:
case CK_Emeraldrapids:
case CK_Clearwaterforest:
case CK_KNL:
case CK_KNM:
// K7
Expand Down
2 changes: 2 additions & 0 deletions clang/test/CodeGen/attr-cpuspecific-cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ ATTR(cpu_specific(arrowlake)) void CPU35(void){}
ATTR(cpu_specific(arrowlake_s)) void CPU36(void){}
ATTR(cpu_specific(lunarlake)) void CPU37(void){}
ATTR(cpu_specific(gracemont)) void CPU38(void){}
ATTR(cpu_specific(pantherlake)) void CPU39(void){}
ATTR(cpu_specific(clearwaterforest)) void CPU40(void){}
10 changes: 10 additions & 0 deletions clang/test/CodeGen/attr-target-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ int __attribute__((target("arch=arrowlake"))) foo(void) {return 21;}
int __attribute__((target("arch=arrowlake-s"))) foo(void) {return 22;}
int __attribute__((target("arch=lunarlake"))) foo(void) {return 23;}
int __attribute__((target("arch=gracemont"))) foo(void) {return 24;}
int __attribute__((target("arch=pantherlake"))) foo(void) {return 25;}
int __attribute__((target("arch=clearwaterforest"))) foo(void) {return 26;}
int __attribute__((target("default"))) foo(void) { return 2; }

int bar(void) {
Expand Down Expand Up @@ -190,6 +192,10 @@ void calls_pr50025c(void) { pr50025c(); }
// LINUX: ret i32 23
// LINUX: define{{.*}} i32 @foo.arch_gracemont()
// LINUX: ret i32 24
// LINUX: define{{.*}} i32 @foo.arch_pantherlake()
// LINUX: ret i32 25
// LINUX: define{{.*}} i32 @foo.arch_clearwaterforest()
// LINUX: ret i32 26
// LINUX: define{{.*}} i32 @foo()
// LINUX: ret i32 2
// LINUX: define{{.*}} i32 @bar()
Expand Down Expand Up @@ -243,6 +249,10 @@ void calls_pr50025c(void) { pr50025c(); }
// WINDOWS: ret i32 23
// WINDOWS: define dso_local i32 @foo.arch_gracemont()
// WINDOWS: ret i32 24
// WINDOWS: define dso_local i32 @foo.arch_pantherlake()
// WINDOWS: ret i32 25
// WINDOWS: define dso_local i32 @foo.arch_clearwaterforest()
// WINDOWS: ret i32 26
// WINDOWS: define dso_local i32 @foo()
// WINDOWS: ret i32 2
// WINDOWS: define dso_local i32 @bar()
Expand Down
2 changes: 2 additions & 0 deletions clang/test/CodeGen/target-builtin-noerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ void verifycpustrings(void) {
(void)__builtin_cpu_is("arrowlake");
(void)__builtin_cpu_is("arrowlake-s");
(void)__builtin_cpu_is("lunarlake");
(void)__builtin_cpu_is("clearwaterforest");
(void)__builtin_cpu_is("pantherlake");
(void)__builtin_cpu_is("haswell");
(void)__builtin_cpu_is("icelake-client");
(void)__builtin_cpu_is("icelake-server");
Expand Down
8 changes: 8 additions & 0 deletions clang/test/Driver/x86-march.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@
// RUN: | FileCheck %s -check-prefix=gracemont
// gracemont: "-target-cpu" "gracemont"
//
// RUN: %clang --target=x86_64 -c -### %s -march=pantherlake 2>&1 \
// RUN: | FileCheck %s -check-prefix=pantherlake
// pantherlake: "-target-cpu" "pantherlake"
//
// RUN: %clang --target=x86_64 -c -### %s -march=clearwaterforest 2>&1 \
// RUN: | FileCheck %s -check-prefix=clearwaterforest
// clearwaterforest: "-target-cpu" "clearwaterforest"
//
// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=lakemont 2>&1 \
// RUN: | FileCheck %s -check-prefix=lakemont
// lakemont: "-target-cpu" "lakemont"
Expand Down
8 changes: 4 additions & 4 deletions clang/test/Misc/target-invalid-cpu-note.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@

// RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86
// X86: error: unknown target CPU 'not-a-cpu'
// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}}
// X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}}

// RUN: not %clang_cc1 -triple x86_64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86_64
// X86_64: error: unknown target CPU 'not-a-cpu'
// X86_64-NEXT: note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}}
// X86_64-NEXT: note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}}

// RUN: not %clang_cc1 -triple i386--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86
// TUNE_X86: error: unknown target CPU 'not-a-cpu'
// TUNE_X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}}
// TUNE_X86-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}}

// RUN: not %clang_cc1 -triple x86_64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86_64
// TUNE_X86_64: error: unknown target CPU 'not-a-cpu'
// TUNE_X86_64-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}}
// TUNE_X86_64-NEXT: note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, x86-64, geode{{$}}

// RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix NVPTX
// NVPTX: error: unknown target CPU 'not-a-cpu'
Expand Down
26 changes: 26 additions & 0 deletions clang/test/Preprocessor/predefined-arch-macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,6 +2503,12 @@
// 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_SRF_M32,CHECK_ARLS_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_SRF_M32,CHECK_ARLS_M32,CHECK_PTL_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
// CHECK_SRF_M32: #define __ADX__ 1
// CHECK_SRF_M32: #define __AES__ 1
// CHECK_SRF_M32: #define __AVX2__ 1
Expand Down Expand Up @@ -2538,6 +2544,9 @@
// CHECK_SRF_M32: #define __PCONFIG__ 1
// CHECK_SRF_M32: #define __PKU__ 1
// CHECK_SRF_M32: #define __POPCNT__ 1
// CHECK_SRF_M32-NOT: #define __PREFETCHI__ 1
// CHECK_ARLS_M32-NOT: #define __PREFETCHI__ 1
// CHECK_PTL_M32: #define __PREFETCHI__ 1
// CHECK_SRF_M32: #define __PRFCHW__ 1
// CHECK_SRF_M32: #define __PTWRITE__ 1
// CHECK_SRF_M32-NOT: #define __RAOINT__ 1
Expand All @@ -2563,6 +2572,10 @@
// CHECK_SRF_M32: #define __SSE__ 1
// CHECK_SRF_M32: #define __SSSE3__ 1
// CHECK_SRF_M32: #define __UINTR__ 1
// CHECK_SRF_M32-NOT: #define __USERMSR__ 1
// CHECK_ARLS_M32-NOT: #define __USERMSR__ 1
// CHECK_PTL_M32-NOT: #define __USERMSR__ 1
// CHECK_CWF_M32: #define __USERMSR__ 1
// CHECK_SRF_M32: #define __VAES__ 1
// CHECK_SRF_M32: #define __VPCLMULQDQ__ 1
// CHECK_SRF_M32: #define __WAITPKG__ 1
Expand Down Expand Up @@ -2593,6 +2606,12 @@
// 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_SRF_M64,CHECK_ARLS_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_SRF_M64,CHECK_ARLS_M64,CHECK_PTL_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_SRF_M64,CHECK_ARLS_M64,CHECK_PTL_M64,CHECK_CWF_M64
// CHECK_SRF_M64: #define __ADX__ 1
// CHECK_SRF_M64: #define __AES__ 1
// CHECK_SRF_M64: #define __AVX2__ 1
Expand Down Expand Up @@ -2628,6 +2647,9 @@
// CHECK_SRF_M64: #define __PCONFIG__ 1
// CHECK_SRF_M64: #define __PKU__ 1
// CHECK_SRF_M64: #define __POPCNT__ 1
// CHECK_SRF_M64-NOT: #define __PREFETCHI__ 1
// CHECK_ARLS_M64-NOT: #define __PREFETCHI__ 1
// CHECK_PTL_M64: #define __PREFETCHI__ 1
// CHECK_SRF_M64: #define __PRFCHW__ 1
// CHECK_SRF_M64: #define __PTWRITE__ 1
// CHECK_SRF_M64-NOT: #define __RAOINT__ 1
Expand All @@ -2654,6 +2676,10 @@
// CHECK_SRF_M64: #define __SSE__ 1
// CHECK_SRF_M64: #define __SSSE3__ 1
// CHECK_SRF_M64: #define __UINTR__ 1
// CHECK_SRF_M64-NOT: #define __USERMSR__ 1
// CHECK_ARLS_M64-NOT: #define __USERMSR__ 1
// CHECK_PTL_M64-NOT: #define __USERMSR__ 1
// CHECK_CWF_M64: #define __USERMSR__ 1
// CHECK_SRF_M64: #define __VAES__ 1
// CHECK_SRF_M64: #define __VPCLMULQDQ__ 1
// CHECK_SRF_M64: #define __WAITPKG__ 1
Expand Down
15 changes: 15 additions & 0 deletions compiler-rt/lib/builtins/cpu_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ enum ProcessorTypes {
ZHAOXIN_FAM7H,
INTEL_SIERRAFOREST,
INTEL_GRANDRIDGE,
INTEL_CLEARWATERFOREST,
CPU_TYPE_MAX
};

Expand Down Expand Up @@ -116,6 +117,7 @@ enum ProcessorSubtypes {
INTEL_COREI7_GRANITERAPIDS_D,
INTEL_COREI7_ARROWLAKE,
INTEL_COREI7_ARROWLAKE_S,
INTEL_COREI7_PANTHERLAKE,
CPU_SUBTYPE_MAX
};

Expand Down Expand Up @@ -492,6 +494,13 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Subtype = INTEL_COREI7_ARROWLAKE_S;
break;

// Pantherlake:
case 0xcc:
CPU = "pantherlake";
*Type = INTEL_COREI7;
*Subtype = INTEL_COREI7_PANTHERLAKE;
break;

// Icelake Xeon:
case 0x6a:
case 0x6c:
Expand Down Expand Up @@ -572,6 +581,12 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Type = INTEL_GRANDRIDGE;
break;

// Clearwaterforest:
case 0xdd:
CPU = "clearwaterforest";
*Type = INTEL_COREI7;
*Subtype = INTEL_CLEARWATERFOREST;

case 0x57:
CPU = "knl";
*Type = INTEL_KNL;
Expand Down
1 change: 1 addition & 0 deletions llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Changes to the X86 Backend
type matched and called into libgcc helper functions.
* Support ISA of ``USER_MSR``.
* Support ISA of ``AVX10.1-256`` and ``AVX10.1-512``.
* ``-mcpu=pantherlake`` and ``-mcpu=clearwaterforest`` are now supported.

Changes to the OCaml bindings
-----------------------------
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/TargetParser/X86TargetParser.def
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ X86_CPU_TYPE(AMDFAM19H, "amdfam19h")
X86_CPU_TYPE(ZHAOXIN_FAM7H, "zhaoxin_fam7h")
X86_CPU_TYPE(INTEL_SIERRAFOREST, "sierraforest")
X86_CPU_TYPE(INTEL_GRANDRIDGE, "grandridge")
X86_CPU_TYPE(INTEL_CLEARWATERFOREST, "clearwaterforest")

// Alternate names supported by __builtin_cpu_is and target multiversioning.
X86_CPU_TYPE_ALIAS(INTEL_BONNELL, "atom")
Expand Down Expand Up @@ -102,6 +103,7 @@ X86_CPU_SUBTYPE(INTEL_COREI7_GRANITERAPIDS, "graniterapids")
X86_CPU_SUBTYPE(INTEL_COREI7_GRANITERAPIDS_D,"graniterapids-d")
X86_CPU_SUBTYPE(INTEL_COREI7_ARROWLAKE, "arrowlake")
X86_CPU_SUBTYPE(INTEL_COREI7_ARROWLAKE_S, "arrowlake-s")
X86_CPU_SUBTYPE(INTEL_COREI7_PANTHERLAKE, "pantherlake")

// Alternate names supported by __builtin_cpu_is and target multiversioning.
X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_ALDERLAKE, "raptorlake")
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/TargetParser/X86TargetParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ enum CPUKind {
CK_Arrowlake,
CK_ArrowlakeS,
CK_Lunarlake,
CK_Pantherlake,
CK_Sierraforest,
CK_Grandridge,
CK_Graniterapids,
CK_GraniterapidsD,
CK_Emeraldrapids,
CK_Clearwaterforest,
CK_KNL,
CK_KNM,
CK_Lakemont,
Expand Down
16 changes: 16 additions & 0 deletions llvm/lib/Target/X86/X86.td
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,18 @@ def ProcessorFeatures {
list<SubtargetFeature> ARLSFeatures =
!listconcat(SRFFeatures, ARLSAdditionalFeatures);

// Pantherlake
list<SubtargetFeature> PTLAdditionalFeatures = [FeaturePREFETCHI];
list<SubtargetFeature> PTLFeatures =
!listconcat(ARLSFeatures, PTLAdditionalFeatures);


// Clearwaterforest
list<SubtargetFeature> CWFAdditionalFeatures = [FeaturePREFETCHI,
FeatureUSERMSR];
list<SubtargetFeature> CWFFeatures =
!listconcat(ARLSFeatures, CWFAdditionalFeatures);

// Knights Landing
list<SubtargetFeature> KNLFeatures = [FeatureX87,
FeatureCX8,
Expand Down Expand Up @@ -1770,6 +1782,10 @@ foreach P = ["arrowlake-s", "arrowlake_s", "lunarlake"] in {
def : ProcModel<P, AlderlakePModel,
ProcessorFeatures.ARLSFeatures, ProcessorFeatures.ADLTuning>;
}
def : ProcModel<"pantherlake", AlderlakePModel,
ProcessorFeatures.PTLFeatures, ProcessorFeatures.ADLTuning>;
def : ProcModel<"clearwaterforest", AlderlakePModel,
ProcessorFeatures.CWFFeatures, ProcessorFeatures.ADLTuning>;
def : ProcModel<"graniterapids", SapphireRapidsModel,
ProcessorFeatures.GNRFeatures, ProcessorFeatures.SPRTuning>;
def : ProcModel<"emeraldrapids", SapphireRapidsModel,
Expand Down
13 changes: 13 additions & 0 deletions llvm/lib/TargetParser/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,13 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Subtype = X86::INTEL_COREI7_ARROWLAKE_S;
break;

// Pantherlake:
case 0xcc:
CPU = "pantherlake";
*Type = X86::INTEL_COREI7;
*Subtype = X86::INTEL_COREI7_PANTHERLAKE;
break;

// Graniterapids:
case 0xad:
CPU = "graniterapids";
Expand Down Expand Up @@ -932,6 +939,12 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Type = X86::INTEL_GRANDRIDGE;
break;

// Clearwaterforest:
case 0xdd:
CPU = "clearwaterforest";
*Type = X86::INTEL_CLEARWATERFOREST;
break;

// Xeon Phi (Knights Landing + Knights Mill):
case 0x57:
CPU = "knl";
Expand Down
Loading