Skip to content

Commit

Permalink
[X86] Support -march=arrowlake,arrowlake-s,lunarlake
Browse files Browse the repository at this point in the history
Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D156239
  • Loading branch information
FreddyLeaf committed Jul 28, 2023
1 parent 3174766 commit c9d92e6
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 4 deletions.
6 changes: 6 additions & 0 deletions clang/lib/Basic/Targets/X86.cpp
Expand Up @@ -545,6 +545,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
case CK_Alderlake:
case CK_Raptorlake:
case CK_Meteorlake:
case CK_Arrowlake:
case CK_ArrowlakeS:
case CK_Lunarlake:
case CK_Sierraforest:
case CK_Grandridge:
case CK_Graniterapids:
Expand Down Expand Up @@ -1437,6 +1440,9 @@ std::optional<unsigned> X86TargetInfo::getCPUCacheLineSize() const {
case CK_Alderlake:
case CK_Raptorlake:
case CK_Meteorlake:
case CK_Arrowlake:
case CK_ArrowlakeS:
case CK_Lunarlake:
case CK_Sierraforest:
case CK_Grandridge:
case CK_Graniterapids:
Expand Down
3 changes: 3 additions & 0 deletions clang/test/CodeGen/attr-cpuspecific-cpus.c
Expand Up @@ -80,3 +80,6 @@ ATTR(cpu_specific(grandridge)) void CPU31(void){}
ATTR(cpu_specific(graniterapids)) void CPU32(void){}
ATTR(cpu_specific(emeraldrapids)) void CPU33(void){}
ATTR(cpu_specific(graniterapids_d)) void CPU34(void){}
ATTR(cpu_specific(arrowlake)) void CPU35(void){}
ATTR(cpu_specific(arrowlake_s)) void CPU36(void){}
ATTR(cpu_specific(lunarlake)) void CPU37(void){}
15 changes: 15 additions & 0 deletions clang/test/CodeGen/attr-target-mv.c
Expand Up @@ -22,6 +22,9 @@ int __attribute__((target("arch=grandridge"))) foo(void) {return 17;}
int __attribute__((target("arch=graniterapids"))) foo(void) {return 18;}
int __attribute__((target("arch=emeraldrapids"))) foo(void) {return 19;}
int __attribute__((target("arch=graniterapids-d"))) foo(void) {return 20;}
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("default"))) foo(void) { return 2; }

int bar(void) {
Expand Down Expand Up @@ -170,6 +173,12 @@ void calls_pr50025c(void) { pr50025c(); }
// LINUX: ret i32 19
// LINUX: define{{.*}} i32 @foo.arch_graniterapids-d()
// LINUX: ret i32 20
// LINUX: define{{.*}} i32 @foo.arch_arrowlake()
// LINUX: ret i32 21
// LINUX: define{{.*}} i32 @foo.arch_arrowlake-s()
// LINUX: ret i32 22
// LINUX: define{{.*}} i32 @foo.arch_lunarlake()
// LINUX: ret i32 23
// LINUX: define{{.*}} i32 @foo()
// LINUX: ret i32 2
// LINUX: define{{.*}} i32 @bar()
Expand Down Expand Up @@ -215,6 +224,12 @@ void calls_pr50025c(void) { pr50025c(); }
// WINDOWS: ret i32 19
// WINDOWS: define dso_local i32 @foo.arch_graniterapids-d()
// WINDOWS: ret i32 20
// WINDOWS: define dso_local i32 @foo.arch_arrowlake()
// WINDOWS: ret i32 21
// WINDOWS: define dso_local i32 @foo.arch_arrowlake-s()
// WINDOWS: ret i32 22
// WINDOWS: define dso_local i32 @foo.arch_lunarlake()
// WINDOWS: ret i32 23
// WINDOWS: define dso_local i32 @foo()
// WINDOWS: ret i32 2
// WINDOWS: define dso_local i32 @bar()
Expand Down
3 changes: 3 additions & 0 deletions clang/test/CodeGen/target-builtin-noerror.c
Expand Up @@ -111,6 +111,9 @@ void verifycpustrings(void) {
(void)__builtin_cpu_is("graniterapids");
(void)__builtin_cpu_is("emeraldrapids");
(void)__builtin_cpu_is("graniterapids-d");
(void)__builtin_cpu_is("arrowlake");
(void)__builtin_cpu_is("arrowlake-s");
(void)__builtin_cpu_is("lunarlake");
(void)__builtin_cpu_is("haswell");
(void)__builtin_cpu_is("icelake-client");
(void)__builtin_cpu_is("icelake-server");
Expand Down
12 changes: 12 additions & 0 deletions clang/test/Driver/x86-march.c
Expand Up @@ -96,6 +96,18 @@
// RUN: | FileCheck %s -check-prefix=meteorlake
// meteorlake: "-target-cpu" "meteorlake"
//
// RUN: %clang --target=x86_64 -c -### %s -march=arrowlake 2>&1 \
// RUN: | FileCheck %s -check-prefix=arrowlake
// arrowlake: "-target-cpu" "arrowlake"
//
// RUN: %clang --target=x86_64 -c -### %s -march=arrowlake-s 2>&1 \
// RUN: | FileCheck %s -check-prefix=arrowlake-s
// arrowlake-s: "-target-cpu" "arrowlake-s"
//
// RUN: %clang --target=x86_64 -c -### %s -march=lunarlake 2>&1 \
// RUN: | FileCheck %s -check-prefix=lunarlake
// lunarlake: "-target-cpu" "lunarlake"
//
// 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
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, 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, 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{{$}}

// 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, 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, 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{{$}}

// 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, 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, 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{{$}}

// 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, 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, 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{{$}}

// 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
34 changes: 34 additions & 0 deletions clang/test/Preprocessor/predefined-arch-macros.c
Expand Up @@ -2466,12 +2466,23 @@
// 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
// 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_SRF_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_SRF_M32,CHECK_ARLS_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_SRF_M32,CHECK_ARLS_M32
// CHECK_SRF_M32: #define __ADX__ 1
// CHECK_SRF_M32: #define __AES__ 1
// CHECK_SRF_M32: #define __AVX2__ 1
// CHECK_SRF_M32-NOT: AVX512
// CHECK_SRF_M32: #define __AVXIFMA__ 1
// CHECK_SRF_M32: #define __AVXNECONVERT__ 1
// CHECK_SRF_M32-NOT: #define __AVXVNNIINT16__ 1
// CHECK_ARLS_M32: #define __AVXVNNIINT16__ 1
// CHECK_SRF_M32: #define __AVXVNNIINT8__ 1
// CHECK_SRF_M32: #define __AVXVNNI__ 1
// CHECK_SRF_M32: #define __AVX__ 1
Expand Down Expand Up @@ -2508,8 +2519,14 @@
// CHECK_SRF_M32: #define __RDSEED__ 1
// CHECK_SRF_M32: #define __SERIALIZE__ 1
// CHECK_SRF_M32: #define __SGX__ 1
// CHECK_SRF_M32-NOT: #define __SHA512__ 1
// CHECK_ARLS_M32: #define __SHA512__ 1
// CHECK_SRF_M32: #define __SHA__ 1
// CHECK_SRF_M32: #define __SHSTK__ 1
// CHECK_SRF_M32-NOT: #define __SM3__ 1
// CHECK_ARLS_M32: #define __SM3__ 1
// CHECK_SRF_M32-NOT: #define __SM4__ 1
// CHECK_ARLS_M32: #define __SM4__ 1
// CHECK_SRF_M32: #define __SSE2__ 1
// CHECK_SRF_M32: #define __SSE3__ 1
// CHECK_SRF_M32: #define __SSE4_1__ 1
Expand Down Expand Up @@ -2539,12 +2556,23 @@
// 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
// 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_SRF_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_SRF_M64,CHECK_ARLS_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_SRF_M64,CHECK_ARLS_M64
// CHECK_SRF_M64: #define __ADX__ 1
// CHECK_SRF_M64: #define __AES__ 1
// CHECK_SRF_M64: #define __AVX2__ 1
// CHECK_SRF_M64-NOT: AVX512
// CHECK_SRF_M64: #define __AVXIFMA__ 1
// CHECK_SRF_M64: #define __AVXNECONVERT__ 1
// CHECK_SRF_M64-NOT: #define __AVXVNNIINT16__ 1
// CHECK_ARLS_M64: #define __AVXVNNIINT16__ 1
// CHECK_SRF_M64: #define __AVXVNNIINT8__ 1
// CHECK_SRF_M64: #define __AVXVNNI__ 1
// CHECK_SRF_M64: #define __AVX__ 1
Expand Down Expand Up @@ -2581,8 +2609,14 @@
// CHECK_SRF_M64: #define __RDSEED__ 1
// CHECK_SRF_M64: #define __SERIALIZE__ 1
// CHECK_SRF_M64: #define __SGX__ 1
// CHECK_SRF_M64-NOT: #define __SHA512__ 1
// CHECK_ARLS_M64: #define __SHA512__ 1
// CHECK_SRF_M64: #define __SHA__ 1
// CHECK_SRF_M64: #define __SHSTK__ 1
// CHECK_SRF_M64-NOT: #define __SM3__ 1
// CHECK_ARLS_M64: #define __SM3__ 1
// CHECK_SRF_M64-NOT: #define __SM4__ 1
// CHECK_ARLS_M64: #define __SM4__ 1
// CHECK_SRF_M64: #define __SSE2_MATH__ 1
// CHECK_SRF_M64: #define __SSE2__ 1
// CHECK_SRF_M64: #define __SSE3__ 1
Expand Down
18 changes: 18 additions & 0 deletions compiler-rt/lib/builtins/cpu_model.c
Expand Up @@ -114,6 +114,8 @@ enum ProcessorSubtypes {
AMDFAM19H_ZNVER4,
INTEL_COREI7_GRANITERAPIDS,
INTEL_COREI7_GRANITERAPIDS_D,
INTEL_COREI7_ARROWLAKE,
INTEL_COREI7_ARROWLAKE_S,
CPU_SUBTYPE_MAX
};

Expand Down Expand Up @@ -459,6 +461,22 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Subtype = INTEL_COREI7_ALDERLAKE;
break;

// Arrowlake:
case 0xc5:
CPU = "arrowlake";
*Type = INTEL_COREI7;
*Subtype = INTEL_COREI7_ARROWLAKE;
break;

// Arrowlake S:
case 0xc6:
// Lunarlake:
case 0xbd:
CPU = "arrowlake-s";
*Type = INTEL_COREI7;
*Subtype = INTEL_COREI7_ARROWLAKE_S;
break;

// Icelake Xeon:
case 0x6a:
case 0x6c:
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/TargetParser/X86TargetParser.def
Expand Up @@ -100,11 +100,14 @@ X86_CPU_SUBTYPE(ZHAOXIN_FAM7H_LUJIAZUI, "zhaoxin_fam7h_lujiazui")
X86_CPU_SUBTYPE(AMDFAM19H_ZNVER4, "znver4")
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")

// Alternate names supported by __builtin_cpu_is and target multiversioning.
X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_ALDERLAKE, "raptorlake")
X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_ALDERLAKE, "meteorlake")
X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_SAPPHIRERAPIDS, "emeraldrapids")
X86_CPU_SUBTYPE_ALIAS(INTEL_COREI7_ARROWLAKE_S,"lunarlake")

#undef X86_CPU_SUBTYPE_ALIAS
#undef X86_CPU_SUBTYPE
Expand Down
3 changes: 3 additions & 0 deletions llvm/include/llvm/TargetParser/X86TargetParser.h
Expand Up @@ -106,6 +106,9 @@ enum CPUKind {
CK_Alderlake,
CK_Raptorlake,
CK_Meteorlake,
CK_Arrowlake,
CK_ArrowlakeS,
CK_Lunarlake,
CK_Sierraforest,
CK_Grandridge,
CK_Graniterapids,
Expand Down
14 changes: 14 additions & 0 deletions llvm/lib/Target/X86/X86.td
Expand Up @@ -1215,6 +1215,14 @@ def ProcessorFeatures {
list<SubtargetFeature> GRRFeatures =
!listconcat(SRFFeatures, GRRAdditionalFeatures);

// Arrowlake S
list<SubtargetFeature> ARLSAdditionalFeatures = [FeatureAVXVNNIINT16,
FeatureSHA512,
FeatureSM3,
FeatureSM4];
list<SubtargetFeature> ARLSFeatures =
!listconcat(SRFFeatures, ARLSAdditionalFeatures);

// Knights Landing
list<SubtargetFeature> KNLFeatures = [FeatureX87,
FeatureCX8,
Expand Down Expand Up @@ -1717,6 +1725,12 @@ def : ProcModel<"raptorlake", AlderlakePModel,
ProcessorFeatures.ADLFeatures, ProcessorFeatures.ADLTuning>;
def : ProcModel<"meteorlake", AlderlakePModel,
ProcessorFeatures.ADLFeatures, ProcessorFeatures.ADLTuning>;
def : ProcModel<"arrowlake", AlderlakePModel,
ProcessorFeatures.SRFFeatures, ProcessorFeatures.ADLTuning>;
foreach P = ["arrowlake-s", "arrowlake_s", "lunarlake"] in {
def : ProcModel<P, AlderlakePModel,
ProcessorFeatures.ARLSFeatures, ProcessorFeatures.ADLTuning>;
}
def : ProcModel<"graniterapids", SapphireRapidsModel,
ProcessorFeatures.GNRFeatures, ProcessorFeatures.SPRTuning>;
def : ProcModel<"emeraldrapids", SapphireRapidsModel,
Expand Down
16 changes: 16 additions & 0 deletions llvm/lib/TargetParser/Host.cpp
Expand Up @@ -834,6 +834,22 @@ getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
*Subtype = X86::INTEL_COREI7_ALDERLAKE;
break;

// Arrowlake:
case 0xc5:
CPU = "arrowlake";
*Type = X86::INTEL_COREI7;
*Subtype = X86::INTEL_COREI7_ARROWLAKE;
break;

// Arrowlake S:
case 0xc6:
// Lunarlake:
case 0xbd:
CPU = "arrowlake-s";
*Type = X86::INTEL_COREI7;
*Subtype = X86::INTEL_COREI7_ARROWLAKE_S;
break;

// Graniterapids:
case 0xad:
CPU = "graniterapids";
Expand Down

0 comments on commit c9d92e6

Please sign in to comment.