Skip to content

Commit 19870ed

Browse files
authored
[X86] Emit Warnings for frontend options to enable knl/knm specific ISAs. (#75580)
Since Knight Landing and Knight Mill microarchitectures are EOL, we would like to remove intrinsic supports for its specific ISA in LLVM 19. In LLVM 18, we will first emit a warning for the usage.
1 parent c714846 commit 19870ed

File tree

7 files changed

+32
-6
lines changed

7 files changed

+32
-6
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,14 @@ X86 Support
936936
- Support ISA of ``AVX10.1``.
937937
- ``-march=pantherlake`` and ``-march=clearwaterforest`` are now supported.
938938
- Added ABI handling for ``__float128`` to match with GCC.
939+
- Emit warnings for options to enable knl/knm specific ISAs: AVX512PF, AVX512ER
940+
and PREFETCHWT1. From next version (LLVM 19), these ISAs' intrinsic supports
941+
will be deprecated:
942+
* intrinsic series of *_exp2a23_*
943+
* intrinsic series of *_rsqrt28_*
944+
* intrinsic series of *_rcp28_*
945+
* intrinsic series of *_prefetch_i[3|6][2|4]gather_*
946+
* intrinsic series of *_prefetch_i[3|6][2|4]scatter_*
939947

940948
Arm and AArch64 Support
941949
^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ def warn_invalid_feature_combination : Warning<
349349
def warn_target_unrecognized_env : Warning<
350350
"mismatch between architecture and environment in target triple '%0'; did you mean '%1'?">,
351351
InGroup<InvalidCommandLineArgument>;
352+
def warn_knl_knm_isa_support_removed : Warning<
353+
"KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.">,
354+
InGroup<DiagGroup<"knl-knm-isa-support-removed">>;
352355

353356
// Source manager
354357
def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;

clang/lib/Basic/Targets/X86.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,13 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
295295
HasAVX512BF16 = true;
296296
} else if (Feature == "+avx512er") {
297297
HasAVX512ER = true;
298+
Diags.Report(diag::warn_knl_knm_isa_support_removed);
298299
} else if (Feature == "+avx512fp16") {
299300
HasAVX512FP16 = true;
300301
HasLegalHalfType = true;
301302
} else if (Feature == "+avx512pf") {
302303
HasAVX512PF = true;
304+
Diags.Report(diag::warn_knl_knm_isa_support_removed);
303305
} else if (Feature == "+avx512dq") {
304306
HasAVX512DQ = true;
305307
} else if (Feature == "+avx512bitalg") {
@@ -358,6 +360,7 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
358360
HasPREFETCHI = true;
359361
} else if (Feature == "+prefetchwt1") {
360362
HasPREFETCHWT1 = true;
363+
Diags.Report(diag::warn_knl_knm_isa_support_removed);
361364
} else if (Feature == "+clzero") {
362365
HasCLZERO = true;
363366
} else if (Feature == "+cldemote") {

clang/test/CodeGen/X86/avx512er-builtins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -target-feature +avx512er -emit-llvm -o - -Wall -Werror | FileCheck %s
1+
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -target-feature +avx512er -emit-llvm -o - -Wall | FileCheck %s
22

33

44
#include <immintrin.h>

clang/test/CodeGen/X86/avx512pf-builtins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512pf -emit-llvm -o - -Wall -Werror | FileCheck %s
1+
// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512pf -emit-llvm -o - -Wall | FileCheck %s
22

33

44
#include <immintrin.h>

clang/test/Driver/cl-x86-flags.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@
6969
// RUN: %clang_cl -m32 -arch:avx2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx2 %s
7070
// avx2: invalid /arch: argument
7171

72-
// RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX512F -- %s
72+
// RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify=KNL1 -DTEST_32_ARCH_AVX512F -- %s
73+
// KNL1-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
74+
// KNL1-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
75+
// KNL1-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
7376
#if defined(TEST_32_ARCH_AVX512F)
7477
#if _M_IX86_FP != 2 || !__AVX__ || !__AVX2__ || !__AVX512F__ || __AVX512BW__
7578
#error fail
@@ -109,7 +112,10 @@
109112
// RUN: %clang_cl -m64 -arch:avx2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx264 %s
110113
// avx264: invalid /arch: argument
111114

112-
// RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX512F -- %s
115+
// RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify=KNL2 -DTEST_64_ARCH_AVX512F -- %s
116+
// KNL2-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
117+
// KNL2-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
118+
// KNL2-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
113119
#if defined(TEST_64_ARCH_AVX512F)
114120
#if _M_IX86_FP || !__AVX__ || !__AVX2__ || !__AVX512F__ || __AVX512BW__
115121
#error fail

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu cannonlake -verify %s
1616
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-client -verify %s
1717
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-server -verify %s
18-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify %s
19-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify %s
18+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify=knl %s
19+
// knl-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
20+
// knl-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
21+
// knl-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
22+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify=knm %s
23+
// knm-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
24+
// knm-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
25+
// knm-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}}
2026
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu bonnell -verify %s
2127
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu silvermont -verify %s
2228
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu k8 -verify %s

0 commit comments

Comments
 (0)