https://github.com/FreddyLeaf created https://github.com/llvm/llvm-project/pull/75580
Since Knight Landing and Knight Mill microarchitectures are EOL, we would like to remove its support in LLVM 19. In LLVM 18, we will first emit a warning for the usage. >From e16afbdc9f0c04bad0e8f80f90c0eb26c13d3326 Mon Sep 17 00:00:00 2001 From: Freddy Ye <freddy...@intel.com> Date: Fri, 15 Dec 2023 16:50:23 +0800 Subject: [PATCH] [X86] Emit Warnings for frontend options to enable knl/knm. Since Knight Landing and Knight Mill microarchitectures are EOL, we would like to remove its support in LLVM 19. In LLVM 18, we will first emit a warning for the usage. --- clang/include/clang/Basic/DiagnosticCommonKinds.td | 2 ++ clang/lib/Basic/Targets/X86.cpp | 3 +++ clang/test/CodeGen/X86/avx512er-builtins.c | 2 +- clang/test/CodeGen/X86/avx512pf-builtins.c | 2 +- clang/test/Driver/cl-x86-flags.c | 10 ++++++++-- clang/test/Frontend/x86-target-cpu.c | 10 ++++++++-- clang/test/Misc/warning-flags.c | 3 ++- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index 65a33f61a6948a..40841e9df547bc 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -349,6 +349,8 @@ def warn_invalid_feature_combination : Warning< def warn_target_unrecognized_env : Warning< "mismatch between architecture and environment in target triple '%0'; did you mean '%1'?">, InGroup<InvalidCommandLineArgument>; +def warn_knl_knm_target_supports_remove : Warning< + "KNL/KNM's feature support will be removed in LLVM 19.">; // Source manager def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal; diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index b97f88647fa49f..dc56524d378104 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -295,11 +295,13 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features, HasAVX512BF16 = true; } else if (Feature == "+avx512er") { HasAVX512ER = true; + Diags.Report(diag::warn_knl_knm_target_supports_remove); } else if (Feature == "+avx512fp16") { HasAVX512FP16 = true; HasLegalHalfType = true; } else if (Feature == "+avx512pf") { HasAVX512PF = true; + Diags.Report(diag::warn_knl_knm_target_supports_remove); } else if (Feature == "+avx512dq") { HasAVX512DQ = true; } else if (Feature == "+avx512bitalg") { @@ -358,6 +360,7 @@ bool X86TargetInfo::handleTargetFeatures(std::vector<std::string> &Features, HasPREFETCHI = true; } else if (Feature == "+prefetchwt1") { HasPREFETCHWT1 = true; + Diags.Report(diag::warn_knl_knm_target_supports_remove); } else if (Feature == "+clzero") { HasCLZERO = true; } else if (Feature == "+cldemote") { diff --git a/clang/test/CodeGen/X86/avx512er-builtins.c b/clang/test/CodeGen/X86/avx512er-builtins.c index ee31236a3c01aa..11ec6aabec1e3f 100644 --- a/clang/test/CodeGen/X86/avx512er-builtins.c +++ b/clang/test/CodeGen/X86/avx512er-builtins.c @@ -1,4 +1,4 @@ -// 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 +// 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 #include <immintrin.h> diff --git a/clang/test/CodeGen/X86/avx512pf-builtins.c b/clang/test/CodeGen/X86/avx512pf-builtins.c index 4ca70f5787968b..3a117ed6a9460e 100644 --- a/clang/test/CodeGen/X86/avx512pf-builtins.c +++ b/clang/test/CodeGen/X86/avx512pf-builtins.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512pf -emit-llvm -o - -Wall -Werror | FileCheck %s +// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512pf -emit-llvm -o - -Wall | FileCheck %s #include <immintrin.h> diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c index 51b16f0ce35463..ae35a312fe8a4b 100644 --- a/clang/test/Driver/cl-x86-flags.c +++ b/clang/test/Driver/cl-x86-flags.c @@ -69,7 +69,10 @@ // RUN: %clang_cl -m32 -arch:avx2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx2 %s // avx2: invalid /arch: argument -// RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX512F -- %s +// RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify=KNL1 -DTEST_32_ARCH_AVX512F -- %s +// KNL1-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// KNL1-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// KNL1-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} #if defined(TEST_32_ARCH_AVX512F) #if _M_IX86_FP != 2 || !__AVX__ || !__AVX2__ || !__AVX512F__ || __AVX512BW__ #error fail @@ -109,7 +112,10 @@ // RUN: %clang_cl -m64 -arch:avx2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx264 %s // avx264: invalid /arch: argument -// RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX512F -- %s +// RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify=KNL2 -DTEST_64_ARCH_AVX512F -- %s +// KNL2-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// KNL2-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// KNL2-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} #if defined(TEST_64_ARCH_AVX512F) #if _M_IX86_FP || !__AVX__ || !__AVX2__ || !__AVX512F__ || __AVX512BW__ #error fail diff --git a/clang/test/Frontend/x86-target-cpu.c b/clang/test/Frontend/x86-target-cpu.c index 6c8502ac2c21ee..be57b3c0ec583b 100644 --- a/clang/test/Frontend/x86-target-cpu.c +++ b/clang/test/Frontend/x86-target-cpu.c @@ -15,8 +15,14 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu cannonlake -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-client -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-server -verify %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify=knl %s +// knl-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// knl-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// knl-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify=knm %s +// knm-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// knm-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} +// knm-warning@*:* {{KNL/KNM's feature support will be removed in LLVM 19.}} // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu bonnell -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu silvermont -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu k8 -verify %s diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index c587337da5933a..f580445b1f10b9 100644 --- a/clang/test/Misc/warning-flags.c +++ b/clang/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (65): +CHECK: Warnings without flags (66): CHECK-NEXT: ext_expected_semi_decl_list CHECK-NEXT: ext_explicit_specialization_storage_class @@ -56,6 +56,7 @@ CHECK-NEXT: warn_ignoring_ftabstop_value CHECK-NEXT: warn_implements_nscopying CHECK-NEXT: warn_incompatible_qualified_id CHECK-NEXT: warn_invalid_asm_cast_lvalue +CHECK-NEXT: warn_knl_knm_target_supports_remove CHECK-NEXT: warn_maynot_respond CHECK-NEXT: warn_method_param_redefinition CHECK-NEXT: warn_missing_case_for_condition _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits