Skip to content

Commit 149a150

Browse files
ganeshgittru
authored andcommitted
[X86] AMD Zen 5 Initial enablement
1 parent 82e85b6 commit 149a150

30 files changed

+238
-4
lines changed

clang/lib/Basic/Targets/X86.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
723723
case CK_ZNVER4:
724724
defineCPUMacros(Builder, "znver4");
725725
break;
726+
case CK_ZNVER5:
727+
defineCPUMacros(Builder, "znver5");
728+
break;
726729
case CK_Geode:
727730
defineCPUMacros(Builder, "geode");
728731
break;
@@ -1613,6 +1616,7 @@ std::optional<unsigned> X86TargetInfo::getCPUCacheLineSize() const {
16131616
case CK_ZNVER2:
16141617
case CK_ZNVER3:
16151618
case CK_ZNVER4:
1619+
case CK_ZNVER5:
16161620
// Deprecated
16171621
case CK_x86_64:
16181622
case CK_x86_64_v2:

clang/test/CodeGen/target-builtin-noerror.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,5 @@ void verifycpustrings(void) {
205205
(void)__builtin_cpu_is("znver2");
206206
(void)__builtin_cpu_is("znver3");
207207
(void)__builtin_cpu_is("znver4");
208+
(void)__builtin_cpu_is("znver5");
208209
}

clang/test/Driver/x86-march.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@
242242
// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=znver4 2>&1 \
243243
// RUN: | FileCheck %s -check-prefix=znver4
244244
// znver4: "-target-cpu" "znver4"
245+
//
246+
// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=znver5 2>&1 \
247+
// RUN: | FileCheck %s -check-prefix=znver5
248+
// znver5: "-target-cpu" "znver5"
245249

246250
// RUN: %clang -target x86_64 -c -### %s -march=x86-64 2>&1 | FileCheck %s --check-prefix=x86-64
247251
// x86-64: "-target-cpu" "x86-64"

clang/test/Frontend/x86-target-cpu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver2 -verify %s
3939
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver3 -verify %s
4040
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver4 -verify %s
41+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu znver5 -verify %s
4142
//
4243
// expected-no-diagnostics

clang/test/Misc/target-invalid-cpu-note.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313

1414
// RUN: not %clang_cc1 -triple i386--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86
1515
// X86: error: unknown target CPU 'not-a-cpu'
16-
// 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{{$}}
16+
// 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, znver5, x86-64, x86-64-v2, x86-64-v3, x86-64-v4, geode{{$}}
1717

1818
// RUN: not %clang_cc1 -triple x86_64--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix X86_64
1919
// X86_64: error: unknown target CPU 'not-a-cpu'
20-
// 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{{$}}
20+
// 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, znver5, x86-64, x86-64-v2, x86-64-v3, x86-64-v4{{$}}
2121

2222
// RUN: not %clang_cc1 -triple i386--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86
2323
// TUNE_X86: error: unknown target CPU 'not-a-cpu'
24-
// 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{{$}}
24+
// 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, znver5, x86-64, geode{{$}}
2525

2626
// RUN: not %clang_cc1 -triple x86_64--- -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE_X86_64
2727
// TUNE_X86_64: error: unknown target CPU 'not-a-cpu'
28-
// 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{{$}}
28+
// 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, znver5, x86-64, geode{{$}}
2929

3030
// RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix NVPTX
3131
// NVPTX: error: unknown target CPU 'not-a-cpu'

clang/test/Preprocessor/predefined-arch-macros.c

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3923,6 +3923,148 @@
39233923
// CHECK_ZNVER4_M64: #define __znver4 1
39243924
// CHECK_ZNVER4_M64: #define __znver4__ 1
39253925

3926+
// RUN: %clang -march=znver5 -m32 -E -dM %s -o - 2>&1 \
3927+
// RUN: -target i386-unknown-linux \
3928+
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ZNVER5_M32
3929+
// CHECK_ZNVER5_M32-NOT: #define __3dNOW_A__ 1
3930+
// CHECK_ZNVER5_M32-NOT: #define __3dNOW__ 1
3931+
// CHECK_ZNVER5_M32: #define __ADX__ 1
3932+
// CHECK_ZNVER5_M32: #define __AES__ 1
3933+
// CHECK_ZNVER5_M32: #define __AVX2__ 1
3934+
// CHECK_ZNVER5_M32: #define __AVX512BF16__ 1
3935+
// CHECK_ZNVER5_M32: #define __AVX512BITALG__ 1
3936+
// CHECK_ZNVER5_M32: #define __AVX512BW__ 1
3937+
// CHECK_ZNVER5_M32: #define __AVX512CD__ 1
3938+
// CHECK_ZNVER5_M32: #define __AVX512DQ__ 1
3939+
// CHECK_ZNVER5_M32: #define __AVX512F__ 1
3940+
// CHECK_ZNVER5_M32: #define __AVX512IFMA__ 1
3941+
// CHECK_ZNVER5_M32: #define __AVX512VBMI2__ 1
3942+
// CHECK_ZNVER5_M32: #define __AVX512VBMI__ 1
3943+
// CHECK_ZNVER5_M32: #define __AVX512VL__ 1
3944+
// CHECK_ZNVER5_M32: #define __AVX512VNNI__ 1
3945+
// CHECK_ZNVER5_M32: #define __AVX512VP2INTERSECT__ 1
3946+
// CHECK_ZNVER5_M32: #define __AVX512VPOPCNTDQ__ 1
3947+
// CHECK_ZNVER5_M32: #define __AVXVNNI__ 1
3948+
// CHECK_ZNVER5_M32: #define __AVX__ 1
3949+
// CHECK_ZNVER5_M32: #define __BMI2__ 1
3950+
// CHECK_ZNVER5_M32: #define __BMI__ 1
3951+
// CHECK_ZNVER5_M32: #define __CLFLUSHOPT__ 1
3952+
// CHECK_ZNVER5_M32: #define __CLWB__ 1
3953+
// CHECK_ZNVER5_M32: #define __CLZERO__ 1
3954+
// CHECK_ZNVER5_M32: #define __F16C__ 1
3955+
// CHECK_ZNVER5_M32-NOT: #define __FMA4__ 1
3956+
// CHECK_ZNVER5_M32: #define __FMA__ 1
3957+
// CHECK_ZNVER5_M32: #define __FSGSBASE__ 1
3958+
// CHECK_ZNVER5_M32: #define __GFNI__ 1
3959+
// CHECK_ZNVER5_M32: #define __LZCNT__ 1
3960+
// CHECK_ZNVER5_M32: #define __MMX__ 1
3961+
// CHECK_ZNVER5_M32: #define __MOVDIR64B__ 1
3962+
// CHECK_ZNVER5_M32: #define __MOVDIRI__ 1
3963+
// CHECK_ZNVER5_M32: #define __PCLMUL__ 1
3964+
// CHECK_ZNVER5_M32: #define __PKU__ 1
3965+
// CHECK_ZNVER5_M32: #define __POPCNT__ 1
3966+
// CHECK_ZNVER5_M32: #define __PREFETCHI__ 1
3967+
// CHECK_ZNVER5_M32: #define __PRFCHW__ 1
3968+
// CHECK_ZNVER5_M32: #define __RDPID__ 1
3969+
// CHECK_ZNVER5_M32: #define __RDPRU__ 1
3970+
// CHECK_ZNVER5_M32: #define __RDRND__ 1
3971+
// CHECK_ZNVER5_M32: #define __RDSEED__ 1
3972+
// CHECK_ZNVER5_M32: #define __SHA__ 1
3973+
// CHECK_ZNVER5_M32: #define __SSE2_MATH__ 1
3974+
// CHECK_ZNVER5_M32: #define __SSE2__ 1
3975+
// CHECK_ZNVER5_M32: #define __SSE3__ 1
3976+
// CHECK_ZNVER5_M32: #define __SSE4A__ 1
3977+
// CHECK_ZNVER5_M32: #define __SSE4_1__ 1
3978+
// CHECK_ZNVER5_M32: #define __SSE4_2__ 1
3979+
// CHECK_ZNVER5_M32: #define __SSE_MATH__ 1
3980+
// CHECK_ZNVER5_M32: #define __SSE__ 1
3981+
// CHECK_ZNVER5_M32: #define __SSSE3__ 1
3982+
// CHECK_ZNVER5_M32-NOT: #define __TBM__ 1
3983+
// CHECK_ZNVER5_M32: #define __WBNOINVD__ 1
3984+
// CHECK_ZNVER5_M32-NOT: #define __XOP__ 1
3985+
// CHECK_ZNVER5_M32: #define __XSAVEC__ 1
3986+
// CHECK_ZNVER5_M32: #define __XSAVEOPT__ 1
3987+
// CHECK_ZNVER5_M32: #define __XSAVES__ 1
3988+
// CHECK_ZNVER5_M32: #define __XSAVE__ 1
3989+
// CHECK_ZNVER5_M32: #define __i386 1
3990+
// CHECK_ZNVER5_M32: #define __i386__ 1
3991+
// CHECK_ZNVER5_M32: #define __tune_znver5__ 1
3992+
// CHECK_ZNVER5_M32: #define __znver5 1
3993+
// CHECK_ZNVER5_M32: #define __znver5__ 1
3994+
3995+
// RUN: %clang -march=znver5 -m64 -E -dM %s -o - 2>&1 \
3996+
// RUN: -target i386-unknown-linux \
3997+
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_ZNVER5_M64
3998+
// CHECK_ZNVER5_M64-NOT: #define __3dNOW_A__ 1
3999+
// CHECK_ZNVER5_M64-NOT: #define __3dNOW__ 1
4000+
// CHECK_ZNVER5_M64: #define __ADX__ 1
4001+
// CHECK_ZNVER5_M64: #define __AES__ 1
4002+
// CHECK_ZNVER5_M64: #define __AVX2__ 1
4003+
// CHECK_ZNVER5_M64: #define __AVX512BF16__ 1
4004+
// CHECK_ZNVER5_M64: #define __AVX512BITALG__ 1
4005+
// CHECK_ZNVER5_M64: #define __AVX512BW__ 1
4006+
// CHECK_ZNVER5_M64: #define __AVX512CD__ 1
4007+
// CHECK_ZNVER5_M64: #define __AVX512DQ__ 1
4008+
// CHECK_ZNVER5_M64: #define __AVX512F__ 1
4009+
// CHECK_ZNVER5_M64: #define __AVX512IFMA__ 1
4010+
// CHECK_ZNVER5_M64: #define __AVX512VBMI2__ 1
4011+
// CHECK_ZNVER5_M64: #define __AVX512VBMI__ 1
4012+
// CHECK_ZNVER5_M64: #define __AVX512VL__ 1
4013+
// CHECK_ZNVER5_M64: #define __AVX512VNNI__ 1
4014+
// CHECK_ZNVER5_M64: #define __AVX512VP2INTERSECT__ 1
4015+
// CHECK_ZNVER5_M64: #define __AVX512VPOPCNTDQ__ 1
4016+
// CHECK_ZNVER5_M64: #define __AVXVNNI__ 1
4017+
// CHECK_ZNVER5_M64: #define __AVX__ 1
4018+
// CHECK_ZNVER5_M64: #define __BMI2__ 1
4019+
// CHECK_ZNVER5_M64: #define __BMI__ 1
4020+
// CHECK_ZNVER5_M64: #define __CLFLUSHOPT__ 1
4021+
// CHECK_ZNVER5_M64: #define __CLWB__ 1
4022+
// CHECK_ZNVER5_M64: #define __CLZERO__ 1
4023+
// CHECK_ZNVER5_M64: #define __F16C__ 1
4024+
// CHECK_ZNVER5_M64-NOT: #define __FMA4__ 1
4025+
// CHECK_ZNVER5_M64: #define __FMA__ 1
4026+
// CHECK_ZNVER5_M64: #define __FSGSBASE__ 1
4027+
// CHECK_ZNVER5_M64: #define __GFNI__ 1
4028+
// CHECK_ZNVER5_M64: #define __LZCNT__ 1
4029+
// CHECK_ZNVER5_M64: #define __MMX__ 1
4030+
// CHECK_ZNVER5_M64: #define __MOVDIR64B__ 1
4031+
// CHECK_ZNVER5_M64: #define __MOVDIRI__ 1
4032+
// CHECK_ZNVER5_M64: #define __PCLMUL__ 1
4033+
// CHECK_ZNVER5_M64: #define __PKU__ 1
4034+
// CHECK_ZNVER5_M64: #define __POPCNT__ 1
4035+
// CHECK_ZNVER5_M64: #define __PREFETCHI__ 1
4036+
// CHECK_ZNVER5_M64: #define __PRFCHW__ 1
4037+
// CHECK_ZNVER5_M64: #define __RDPID__ 1
4038+
// CHECK_ZNVER5_M64: #define __RDPRU__ 1
4039+
// CHECK_ZNVER5_M64: #define __RDRND__ 1
4040+
// CHECK_ZNVER5_M64: #define __RDSEED__ 1
4041+
// CHECK_ZNVER5_M64: #define __SHA__ 1
4042+
// CHECK_ZNVER5_M64: #define __SSE2_MATH__ 1
4043+
// CHECK_ZNVER5_M64: #define __SSE2__ 1
4044+
// CHECK_ZNVER5_M64: #define __SSE3__ 1
4045+
// CHECK_ZNVER5_M64: #define __SSE4A__ 1
4046+
// CHECK_ZNVER5_M64: #define __SSE4_1__ 1
4047+
// CHECK_ZNVER5_M64: #define __SSE4_2__ 1
4048+
// CHECK_ZNVER5_M64: #define __SSE_MATH__ 1
4049+
// CHECK_ZNVER5_M64: #define __SSE__ 1
4050+
// CHECK_ZNVER5_M64: #define __SSSE3__ 1
4051+
// CHECK_ZNVER5_M64-NOT: #define __TBM__ 1
4052+
// CHECK_ZNVER5_M64: #define __VAES__ 1
4053+
// CHECK_ZNVER5_M64: #define __VPCLMULQDQ__ 1
4054+
// CHECK_ZNVER5_M64: #define __WBNOINVD__ 1
4055+
// CHECK_ZNVER5_M64-NOT: #define __XOP__ 1
4056+
// CHECK_ZNVER5_M64: #define __XSAVEC__ 1
4057+
// CHECK_ZNVER5_M64: #define __XSAVEOPT__ 1
4058+
// CHECK_ZNVER5_M64: #define __XSAVES__ 1
4059+
// CHECK_ZNVER5_M64: #define __XSAVE__ 1
4060+
// CHECK_ZNVER5_M64: #define __amd64 1
4061+
// CHECK_ZNVER5_M64: #define __amd64__ 1
4062+
// CHECK_ZNVER5_M64: #define __tune_znver5__ 1
4063+
// CHECK_ZNVER5_M64: #define __x86_64 1
4064+
// CHECK_ZNVER5_M64: #define __x86_64__ 1
4065+
// CHECK_ZNVER5_M64: #define __znver5 1
4066+
// CHECK_ZNVER5_M64: #define __znver5__ 1
4067+
39264068
// End X86/GCC/Linux tests ------------------
39274069

39284070
// Begin PPC/GCC/Linux tests ----------------

compiler-rt/lib/builtins/cpu_model/x86.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ enum ProcessorTypes {
5959
INTEL_SIERRAFOREST,
6060
INTEL_GRANDRIDGE,
6161
INTEL_CLEARWATERFOREST,
62+
AMDFAM1AH,
6263
CPU_TYPE_MAX
6364
};
6465

@@ -97,6 +98,7 @@ enum ProcessorSubtypes {
9798
INTEL_COREI7_ARROWLAKE,
9899
INTEL_COREI7_ARROWLAKE_S,
99100
INTEL_COREI7_PANTHERLAKE,
101+
AMDFAM1AH_ZNVER5,
100102
CPU_SUBTYPE_MAX
101103
};
102104

@@ -803,6 +805,24 @@ static const char *getAMDProcessorTypeAndSubtype(unsigned Family,
803805
break; // "znver4"
804806
}
805807
break; // family 19h
808+
case 26:
809+
CPU = "znver5";
810+
*Type = AMDFAM1AH;
811+
if (Model <= 0x77) {
812+
// Models 00h-0Fh (Breithorn).
813+
// Models 10h-1Fh (Breithorn-Dense).
814+
// Models 20h-2Fh (Strix 1).
815+
// Models 30h-37h (Strix 2).
816+
// Models 38h-3Fh (Strix 3).
817+
// Models 40h-4Fh (Granite Ridge).
818+
// Models 50h-5Fh (Weisshorn).
819+
// Models 60h-6Fh (Krackan1).
820+
// Models 70h-77h (Sarlak).
821+
CPU = "znver5";
822+
*Subtype = AMDFAM1AH_ZNVER5;
823+
break; // "znver5"
824+
}
825+
break;
806826
default:
807827
break; // Unknown AMD CPU.
808828
}

llvm/include/llvm/TargetParser/X86TargetParser.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ X86_CPU_TYPE(ZHAOXIN_FAM7H, "zhaoxin_fam7h")
4949
X86_CPU_TYPE(INTEL_SIERRAFOREST, "sierraforest")
5050
X86_CPU_TYPE(INTEL_GRANDRIDGE, "grandridge")
5151
X86_CPU_TYPE(INTEL_CLEARWATERFOREST, "clearwaterforest")
52+
X86_CPU_TYPE(AMDFAM1AH, "amdfam1ah")
5253

5354
// Alternate names supported by __builtin_cpu_is and target multiversioning.
5455
X86_CPU_TYPE_ALIAS(INTEL_BONNELL, "atom")
5556
X86_CPU_TYPE_ALIAS(AMDFAM10H, "amdfam10")
5657
X86_CPU_TYPE_ALIAS(AMDFAM15H, "amdfam15")
58+
X86_CPU_TYPE_ALIAS(AMDFAM1AH, "amdfam1a")
5759
X86_CPU_TYPE_ALIAS(INTEL_SILVERMONT, "slm")
5860

5961
#undef X86_CPU_TYPE_ALIAS
@@ -104,6 +106,7 @@ X86_CPU_SUBTYPE(INTEL_COREI7_GRANITERAPIDS_D,"graniterapids-d")
104106
X86_CPU_SUBTYPE(INTEL_COREI7_ARROWLAKE, "arrowlake")
105107
X86_CPU_SUBTYPE(INTEL_COREI7_ARROWLAKE_S, "arrowlake-s")
106108
X86_CPU_SUBTYPE(INTEL_COREI7_PANTHERLAKE, "pantherlake")
109+
X86_CPU_SUBTYPE(AMDFAM1AH_ZNVER5, "znver5")
107110

108111
// Alternate names supported by __builtin_cpu_is and target multiversioning.
109112
X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_ALDERLAKE, "raptorlake")

llvm/include/llvm/TargetParser/X86TargetParser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ enum CPUKind {
147147
CK_x86_64_v3,
148148
CK_x86_64_v4,
149149
CK_Geode,
150+
CK_ZNVER5,
150151
};
151152

152153
/// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if

0 commit comments

Comments
 (0)