diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -545,6 +545,9 @@ 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: @@ -1437,6 +1440,9 @@ 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: diff --git a/clang/test/CodeGen/attr-cpuspecific-cpus.c b/clang/test/CodeGen/attr-cpuspecific-cpus.c --- a/clang/test/CodeGen/attr-cpuspecific-cpus.c +++ b/clang/test/CodeGen/attr-cpuspecific-cpus.c @@ -80,3 +80,6 @@ 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){} diff --git a/clang/test/CodeGen/attr-target-mv.c b/clang/test/CodeGen/attr-target-mv.c --- a/clang/test/CodeGen/attr-target-mv.c +++ b/clang/test/CodeGen/attr-target-mv.c @@ -22,6 +22,9 @@ 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) { @@ -170,6 +173,12 @@ // 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() @@ -215,6 +224,12 @@ // 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() diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -111,6 +111,9 @@ (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"); diff --git a/clang/test/Driver/x86-march.c b/clang/test/Driver/x86-march.c --- a/clang/test/Driver/x86-march.c +++ b/clang/test/Driver/x86-march.c @@ -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" diff --git a/clang/test/Misc/target-invalid-cpu-note.c b/clang/test/Misc/target-invalid-cpu-note.c --- a/clang/test/Misc/target-invalid-cpu-note.c +++ b/clang/test/Misc/target-invalid-cpu-note.c @@ -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' diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -2466,12 +2466,22 @@ // 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_ARLS_M32: #define __AVXVNNIINT16__ 1 // CHECK_SRF_M32: #define __AVXVNNIINT8__ 1 // CHECK_SRF_M32: #define __AVXVNNI__ 1 // CHECK_SRF_M32: #define __AVX__ 1 @@ -2508,8 +2518,11 @@ // CHECK_SRF_M32: #define __RDSEED__ 1 // CHECK_SRF_M32: #define __SERIALIZE__ 1 // CHECK_SRF_M32: #define __SGX__ 1 +// CHECK_ARLS_M32: #define __SHA512__ 1 // CHECK_SRF_M32: #define __SHA__ 1 // CHECK_SRF_M32: #define __SHSTK__ 1 +// CHECK_ARLS_M32: #define __SM3__ 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 @@ -2539,12 +2552,22 @@ // 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_ARLS_M64: #define __AVXVNNIINT16__ 1 // CHECK_SRF_M64: #define __AVXVNNIINT8__ 1 // CHECK_SRF_M64: #define __AVXVNNI__ 1 // CHECK_SRF_M64: #define __AVX__ 1 @@ -2581,8 +2604,11 @@ // CHECK_SRF_M64: #define __RDSEED__ 1 // CHECK_SRF_M64: #define __SERIALIZE__ 1 // CHECK_SRF_M64: #define __SGX__ 1 +// CHECK_ARLS_M64: #define __SHA512__ 1 // CHECK_SRF_M64: #define __SHA__ 1 // CHECK_SRF_M64: #define __SHSTK__ 1 +// CHECK_ARLS_M64: #define __SM3__ 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 diff --git a/compiler-rt/lib/builtins/cpu_model.c b/compiler-rt/lib/builtins/cpu_model.c --- a/compiler-rt/lib/builtins/cpu_model.c +++ b/compiler-rt/lib/builtins/cpu_model.c @@ -114,6 +114,8 @@ AMDFAM19H_ZNVER4, INTEL_COREI7_GRANITERAPIDS, INTEL_COREI7_GRANITERAPIDS_D, + INTEL_COREI7_ARROWLAKE, + INTEL_COREI7_ARROWLAKE_S, CPU_SUBTYPE_MAX }; @@ -457,6 +459,22 @@ *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: diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h --- a/llvm/include/llvm/TargetParser/X86TargetParser.h +++ b/llvm/include/llvm/TargetParser/X86TargetParser.h @@ -106,6 +106,9 @@ CK_Alderlake, CK_Raptorlake, CK_Meteorlake, + CK_Arrowlake, + CK_ArrowlakeS, + CK_Lunarlake, CK_Sierraforest, CK_Grandridge, CK_Graniterapids, diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.def b/llvm/include/llvm/TargetParser/X86TargetParser.def --- a/llvm/include/llvm/TargetParser/X86TargetParser.def +++ b/llvm/include/llvm/TargetParser/X86TargetParser.def @@ -100,11 +100,14 @@ 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 diff --git a/llvm/lib/Target/X86/X86.td b/llvm/lib/Target/X86/X86.td --- a/llvm/lib/Target/X86/X86.td +++ b/llvm/lib/Target/X86/X86.td @@ -1215,6 +1215,14 @@ list GRRFeatures = !listconcat(SRFFeatures, GRRAdditionalFeatures); + // Arrowlake S + list ARLSAdditionalFeatures = [FeatureAVXVNNIINT16, + FeatureSHA512, + FeatureSM3, + FeatureSM4]; + list ARLSFeatures = + !listconcat(SRFFeatures, ARLSAdditionalFeatures); + // Knights Landing list KNLFeatures = [FeatureX87, FeatureCX8, @@ -1717,6 +1725,14 @@ 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"] in { +def : ProcModel; +} +def : ProcModel<"lunarlake", AlderlakePModel, + ProcessorFeatures.ARLSFeatures, ProcessorFeatures.ADLTuning>; def : ProcModel<"graniterapids", SapphireRapidsModel, ProcessorFeatures.GNRFeatures, ProcessorFeatures.SPRTuning>; def : ProcModel<"emeraldrapids", SapphireRapidsModel, diff --git a/llvm/lib/TargetParser/Host.cpp b/llvm/lib/TargetParser/Host.cpp --- a/llvm/lib/TargetParser/Host.cpp +++ b/llvm/lib/TargetParser/Host.cpp @@ -832,6 +832,22 @@ *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"; diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -237,6 +237,8 @@ FeatureENQCMD | FeatureAVXNECONVERT | FeatureAVXVNNIINT8; constexpr FeatureBitset FeaturesGrandridge = FeaturesSierraforest | FeatureRAOINT; +constexpr FeatureBitset FeaturesArrowlakeS = FeaturesSierraforest | + FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 | FeatureSM4; // Geode Processor. constexpr FeatureBitset FeaturesGeode = @@ -422,6 +424,12 @@ { {"raptorlake"}, CK_Raptorlake, FEATURE_AVX2, FeaturesAlderlake, 'p', false }, // Meteorlake microarchitecture based processors. { {"meteorlake"}, CK_Meteorlake, FEATURE_AVX2, FeaturesAlderlake, 'p', false }, + // Arrowlake microarchitecture based processors. + { {"arrowlake"}, CK_Arrowlake, FEATURE_AVX2, FeaturesSierraforest, 'p', false }, + { {"arrowlake-s"}, CK_ArrowlakeS, FEATURE_AVX2, FeaturesArrowlakeS, '\0', false }, + { {"arrowlake_s"}, CK_Lunarlake, FEATURE_AVX2, FeaturesArrowlakeS, 'p', true }, + // Lunarlake microarchitecture based processors. + { {"lunarlake"}, CK_Lunarlake, FEATURE_AVX2, FeaturesArrowlakeS, 'p', false }, // Sierraforest microarchitecture based processors. { {"sierraforest"}, CK_Sierraforest, FEATURE_AVX2, FeaturesSierraforest, 'p', false }, // Grandridge microarchitecture based processors. diff --git a/llvm/test/CodeGen/X86/cpus-intel.ll b/llvm/test/CodeGen/X86/cpus-intel.ll --- a/llvm/test/CodeGen/X86/cpus-intel.ll +++ b/llvm/test/CodeGen/X86/cpus-intel.ll @@ -32,6 +32,10 @@ ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=graniterapids 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=graniterapids-d 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=emeraldrapids 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=arrowlake 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=arrowlake-s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=arrowlake_s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=lunarlake 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=nocona 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=core2 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty @@ -90,6 +94,10 @@ ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=grandridge 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=graniterapids 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=graniterapids-d 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=arrowlake 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=arrowlake-s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=arrowlake_s 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty +; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=lunarlake 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty define void @foo() { ret void