https://github.com/mikolaj-pirog updated https://github.com/llvm/llvm-project/pull/184078
From 36839a382fe5b5444ef85666d46ebb18ba7ac649 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Mon, 2 Mar 2026 08:15:36 +0100 Subject: [PATCH 1/8] Support apxf in function multiversioning, don't support indivudal features --- clang/lib/Basic/Targets/X86.cpp | 34 +++++++++++++++++++++------- clang/test/CodeGen/attr-target-x86.c | 10 ++++++++ clang/test/Sema/attr-target.c | 21 +++++++++++++++++ 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 6f88a428b1230..f0c31dddbc205 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -179,6 +179,31 @@ bool X86TargetInfo::initFeatureMap( continue; } + // Expand apxf to the individual APX features + if (Feature == "+apxf") { + UpdatedFeaturesVec.push_back("+egpr"); + UpdatedFeaturesVec.push_back("+ndd"); + UpdatedFeaturesVec.push_back("+ccmp"); + UpdatedFeaturesVec.push_back("+nf"); + UpdatedFeaturesVec.push_back("+zu"); + if (!getTriple().isOSWindows()) { + UpdatedFeaturesVec.push_back("+push2pop2"); + UpdatedFeaturesVec.push_back("+ppx"); + } + continue; + } + + if (Feature == "-apxf") { + UpdatedFeaturesVec.push_back("-egpr"); + UpdatedFeaturesVec.push_back("-ndd"); + UpdatedFeaturesVec.push_back("-ccmp"); + UpdatedFeaturesVec.push_back("-nf"); + UpdatedFeaturesVec.push_back("-zu"); + UpdatedFeaturesVec.push_back("-push2pop2"); + UpdatedFeaturesVec.push_back("-ppx"); + continue; + } + UpdatedFeaturesVec.push_back(Feature); } @@ -1169,14 +1194,7 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const { .Case("xsavec", true) .Case("xsaves", true) .Case("xsaveopt", true) - .Case("egpr", true) - .Case("push2pop2", true) - .Case("ppx", true) - .Case("ndd", true) - .Case("ccmp", true) - .Case("nf", true) - .Case("cf", true) - .Case("zu", true) + .Case("apxf", true) .Default(false); } diff --git a/clang/test/CodeGen/attr-target-x86.c b/clang/test/CodeGen/attr-target-x86.c index 474fa93629d89..35f07a2e0c2bb 100644 --- a/clang/test/CodeGen/attr-target-x86.c +++ b/clang/test/CodeGen/attr-target-x86.c @@ -19,6 +19,8 @@ // CHECK: define {{.*}}@f_avx10_1{{.*}} [[f_avx10_1:#[0-9]+]] // CHECK: define {{.*}}@f_prefer_256_bit({{.*}} [[f_prefer_256_bit:#[0-9]+]] // CHECK: define {{.*}}@f_no_prefer_256_bit({{.*}} [[f_no_prefer_256_bit:#[0-9]+]] +// CHECK: define {{.*}}@f_apxf({{.*}} [[f_apxf:#[0-9]+]] +// CHECK: define {{.*}}@f_no_apxf({{.*}} [[f_no_apxf:#[0-9]+]] // CHECK: [[f_default]] = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87" "tune-cpu"="i686" void f_default(void) {} @@ -108,3 +110,11 @@ void f_prefer_256_bit(void) {} // CHECK: [[f_no_prefer_256_bit]] = {{.*}}"target-features"="{{.*}}-prefer-256-bit __attribute__((target("no-prefer-256-bit"))) void f_no_prefer_256_bit(void) {} + +// CHECK: [[f_apxf]] = {{.*}}"target-features"="{{.*}}+ccmp{{.*}}+egpr{{.*}}+ndd{{.*}}+nf{{.*}}+ppx{{.*}}+push2pop2{{.*}}+zu +__attribute__((target("apxf"))) +void f_apxf(void) {} + +// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-egpr{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu +__attribute__((target("no-apxf"))) +void f_no_apxf(void) {} diff --git a/clang/test/Sema/attr-target.c b/clang/test/Sema/attr-target.c index 65ece3c27d299..a68fb06ec8684 100644 --- a/clang/test/Sema/attr-target.c +++ b/clang/test/Sema/attr-target.c @@ -35,6 +35,27 @@ void __attribute__((target("x86-64-v2"))) v2(void) {} int __attribute__((target("sha"))) good_target_but_not_for_fmv() { return 5; } +int __attribute__((target("apxf"))) apx_supported(void) { return 6; } +int __attribute__((target("no-apxf"))) no_apx_supported(void) { return 7; } + +// APXF sub-features should NOT be supported directly in target attribute +//expected-warning@+1 {{unsupported 'egpr' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("egpr"))) egpr_not_supported(void) { return 8; } +//expected-warning@+1 {{unsupported 'ndd' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("ndd"))) ndd_not_supported(void) { return 9; } +//expected-warning@+1 {{unsupported 'ccmp' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("ccmp"))) ccmp_not_supported(void) { return 10; } +//expected-warning@+1 {{unsupported 'nf' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("nf"))) nf_not_supported(void) { return 11; } +//expected-warning@+1 {{unsupported 'cf' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("cf"))) cf_not_supported(void) { return 12; } +//expected-warning@+1 {{unsupported 'zu' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("zu"))) zu_not_supported(void) { return 13; } +//expected-warning@+1 {{unsupported 'push2pop2' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("push2pop2"))) push2pop2_not_supported(void) { return 14; } +//expected-warning@+1 {{unsupported 'ppx' in the 'target' attribute string; 'target' attribute ignored}} +int __attribute__((target("ppx"))) ppx_not_supported(void) { return 15; } + #elifdef __aarch64__ int __attribute__((target("sve,arch=armv8-a"))) foo(void) { return 4; } From 74c3586f2c06e6c7c536b8df1c06f9c22ccff482 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Tue, 3 Mar 2026 13:09:22 +0100 Subject: [PATCH 2/8] Deduplicate --- clang/lib/Basic/Targets/X86.cpp | 30 ++++--------------- clang/lib/Driver/ToolChains/Arch/X86.cpp | 21 ++++--------- clang/test/Driver/cl-x86-flags.c | 2 +- .../llvm/TargetParser/X86TargetParser.h | 4 +++ llvm/lib/TargetParser/X86TargetParser.cpp | 16 ++++++++++ 5 files changed, 32 insertions(+), 41 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index f0c31dddbc205..8a910205eedba 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -169,7 +169,7 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabled(Features, "ppx", false); } - std::vector<std::string> UpdatedFeaturesVec; + std::vector<StringRef> UpdatedFeaturesVec; for (const auto &Feature : FeaturesVec) { // Expand general-regs-only to -x86, -mmx and -sse if (Feature == "+general-regs-only") { @@ -179,35 +179,15 @@ bool X86TargetInfo::initFeatureMap( continue; } - // Expand apxf to the individual APX features - if (Feature == "+apxf") { - UpdatedFeaturesVec.push_back("+egpr"); - UpdatedFeaturesVec.push_back("+ndd"); - UpdatedFeaturesVec.push_back("+ccmp"); - UpdatedFeaturesVec.push_back("+nf"); - UpdatedFeaturesVec.push_back("+zu"); - if (!getTriple().isOSWindows()) { - UpdatedFeaturesVec.push_back("+push2pop2"); - UpdatedFeaturesVec.push_back("+ppx"); - } + if (llvm::X86::expandAPXFeatures(Feature, getTriple(), UpdatedFeaturesVec)) continue; - } - - if (Feature == "-apxf") { - UpdatedFeaturesVec.push_back("-egpr"); - UpdatedFeaturesVec.push_back("-ndd"); - UpdatedFeaturesVec.push_back("-ccmp"); - UpdatedFeaturesVec.push_back("-nf"); - UpdatedFeaturesVec.push_back("-zu"); - UpdatedFeaturesVec.push_back("-push2pop2"); - UpdatedFeaturesVec.push_back("-ppx"); - continue; - } UpdatedFeaturesVec.push_back(Feature); } - if (!TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec)) + if (!TargetInfo::initFeatureMap( + Features, Diags, CPU, + {UpdatedFeaturesVec.begin(), UpdatedFeaturesVec.end()})) return false; // Can't do this earlier because we need to be able to explicitly enable diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index 61d512f9e093f..62b9c59d651d4 100644 --- a/clang/lib/Driver/ToolChains/Arch/X86.cpp +++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp @@ -13,6 +13,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/Option/ArgList.h" #include "llvm/TargetParser/Host.h" +#include "llvm/TargetParser/X86TargetParser.h" using namespace clang::driver; using namespace clang::driver::tools; @@ -257,21 +258,11 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple, if (A->getOption().matches(options::OPT_mapxf) || A->getOption().matches(options::OPT_mno_apxf)) { - if (IsNegative) { - Features.insert(Features.end(), - {"-egpr", "-ndd", "-ccmp", "-nf", "-zu"}); - if (!Triple.isOSWindows()) - Features.insert(Features.end(), {"-push2pop2", "-ppx"}); - } else { - Features.insert(Features.end(), - {"+egpr", "+ndd", "+ccmp", "+nf", "+zu"}); - if (!Triple.isOSWindows()) - Features.insert(Features.end(), {"+push2pop2", "+ppx"}); - - if (Not64Bit) - D.Diag(diag::err_drv_unsupported_opt_for_target) - << StringRef("-mapxf") << Triple.getTriple(); - } + llvm::X86::expandAPXFeatures(IsNegative ? "-apxf" : "+apxf", Triple, + Features); + if (!IsNegative && Not64Bit) + D.Diag(diag::err_drv_unsupported_opt_for_target) + << StringRef("-mapxf") << Triple.getTriple(); continue; } diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c index 5b32f17774e27..6bad93b633549 100644 --- a/clang/test/Driver/cl-x86-flags.c +++ b/clang/test/Driver/cl-x86-flags.c @@ -224,5 +224,5 @@ void f(void) { // RUN: %clang_cl --target=x86_64-pc-windows -mapxf -mno-apxf -### -- 2>&1 %s | FileCheck -check-prefix=NO-APXF %s // RUN: %clang_cl --target=x86_64-pc-windows -mapx-features=egpr,push2pop2,ppx,ndd,ccmp,nf,cf,zu -### -- 2>&1 %s | FileCheck -check-prefix=APXALL %s // APXF: "-target-feature" "+egpr" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+zu" -// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu" +// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu" "-target-feature" "-push2pop2" "-target-feature" "-ppx" // APXALL: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+cf" "-target-feature" "+zu" diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h index 31d13ce29f7fc..ead5791fc911f 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.h +++ b/llvm/include/llvm/TargetParser/X86TargetParser.h @@ -16,6 +16,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/Compiler.h" +#include "llvm/TargetParser/Triple.h" #include <array> namespace llvm { @@ -187,6 +188,9 @@ LLVM_ABI std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs); LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat); +LLVM_ABI bool expandAPXFeatures(StringRef Name, const llvm::Triple &Triple, + std::vector<StringRef> &Features); + } // namespace X86 } // namespace llvm diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp index f848b1ac08607..b2b561041399e 100644 --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -778,6 +778,22 @@ llvm::X86::getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs) { return FeatureMask; } +bool llvm::X86::expandAPXFeatures(StringRef Name, const llvm::Triple &Triple, + std::vector<StringRef> &Features) { + if (Name == "+apxf") { + Features.insert(Features.end(), {"+egpr", "+ndd", "+ccmp", "+nf", "+zu"}); + if (!Triple.isOSWindows()) { + Features.insert(Features.end(), {"+push2pop2", "+ppx"}); + } + } else if (Name == "-apxf") { + Features.insert(Features.end(), {"-egpr", "-ndd", "-ccmp", "-nf", "-zu", + "-push2pop2", "-ppx"}); + } else { + return false; + } + return true; +} + unsigned llvm::X86::getFeaturePriority(ProcessorFeatures Feat) { #ifndef NDEBUG // Check that priorities are set properly in the .def file. We expect that From 16d61db29cf5c3da51d88f42ec2b18e45404eea5 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Tue, 3 Mar 2026 18:54:37 +0100 Subject: [PATCH 3/8] Reviewer suggestions --- clang/lib/Basic/Targets/X86.cpp | 6 +++++- clang/lib/Driver/ToolChains/Arch/X86.cpp | 3 +-- clang/test/CodeGen/attr-target-x86.c | 2 +- clang/test/Driver/x86-target-features.c | 3 ++- llvm/include/llvm/TargetParser/X86TargetParser.h | 2 +- llvm/lib/TargetParser/X86TargetParser.cpp | 15 ++++++--------- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 8a910205eedba..088d9dfe67a31 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -179,8 +179,12 @@ bool X86TargetInfo::initFeatureMap( continue; } - if (llvm::X86::expandAPXFeatures(Feature, getTriple(), UpdatedFeaturesVec)) + if (Feature == "+apxf" || Feature == "-apxf") { + llvm::X86::expandAPXFeatures(Feature == "-apxf" ? true : false, + getTriple().isOSWindows(), + UpdatedFeaturesVec); continue; + } UpdatedFeaturesVec.push_back(Feature); } diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp index 62b9c59d651d4..205e6c13f8dee 100644 --- a/clang/lib/Driver/ToolChains/Arch/X86.cpp +++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp @@ -258,8 +258,7 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple, if (A->getOption().matches(options::OPT_mapxf) || A->getOption().matches(options::OPT_mno_apxf)) { - llvm::X86::expandAPXFeatures(IsNegative ? "-apxf" : "+apxf", Triple, - Features); + llvm::X86::expandAPXFeatures(IsNegative, Triple.isOSWindows(), Features); if (!IsNegative && Not64Bit) D.Diag(diag::err_drv_unsupported_opt_for_target) << StringRef("-mapxf") << Triple.getTriple(); diff --git a/clang/test/CodeGen/attr-target-x86.c b/clang/test/CodeGen/attr-target-x86.c index 35f07a2e0c2bb..0b93ea0357793 100644 --- a/clang/test/CodeGen/attr-target-x86.c +++ b/clang/test/CodeGen/attr-target-x86.c @@ -115,6 +115,6 @@ void f_no_prefer_256_bit(void) {} __attribute__((target("apxf"))) void f_apxf(void) {} -// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-egpr{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu +// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-cf{{.*}}-egpr{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu __attribute__((target("no-apxf"))) void f_no_apxf(void) {} diff --git a/clang/test/Driver/x86-target-features.c b/clang/test/Driver/x86-target-features.c index 99eef8e4da172..009ef4c89c73a 100644 --- a/clang/test/Driver/x86-target-features.c +++ b/clang/test/Driver/x86-target-features.c @@ -445,7 +445,8 @@ // RUN: %clang --target=x86_64-unknown-linux-gnu -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s // // APXF: "-target-feature" "+egpr" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+zu" "-target-feature" "+push2pop2" "-target-feature" "+ppx" -// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu" "-target-feature" "-push2pop2" "-target-feature" "-ppx" +// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-cf" + // RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s // RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h index ead5791fc911f..90b3fbf81c8ee 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.h +++ b/llvm/include/llvm/TargetParser/X86TargetParser.h @@ -188,7 +188,7 @@ LLVM_ABI std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs); LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat); -LLVM_ABI bool expandAPXFeatures(StringRef Name, const llvm::Triple &Triple, +LLVM_ABI void expandAPXFeatures(bool Negative, bool IsOSWindows, std::vector<StringRef> &Features); } // namespace X86 diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp index b2b561041399e..2a0beed328495 100644 --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -778,20 +778,17 @@ llvm::X86::getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs) { return FeatureMask; } -bool llvm::X86::expandAPXFeatures(StringRef Name, const llvm::Triple &Triple, +void llvm::X86::expandAPXFeatures(bool Negative, const bool IsOsWindows, std::vector<StringRef> &Features) { - if (Name == "+apxf") { + if (Negative) { + Features.insert(Features.end(), {"-egpr", "-ndd", "-ccmp", "-nf", "-zu", + "-push2pop2", "-ppx", "-cf"}); + } else { Features.insert(Features.end(), {"+egpr", "+ndd", "+ccmp", "+nf", "+zu"}); - if (!Triple.isOSWindows()) { + if (!IsOsWindows) { Features.insert(Features.end(), {"+push2pop2", "+ppx"}); } - } else if (Name == "-apxf") { - Features.insert(Features.end(), {"-egpr", "-ndd", "-ccmp", "-nf", "-zu", - "-push2pop2", "-ppx"}); - } else { - return false; } - return true; } unsigned llvm::X86::getFeaturePriority(ProcessorFeatures Feat) { From f13eb781e4f1fb30a9da18829138811abeff73a8 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Wed, 15 Jul 2026 14:48:45 +0200 Subject: [PATCH 4/8] ALlow apx subfeatures in attribute_target --- clang/lib/Basic/Targets/X86.cpp | 21 +++++++++---- clang/test/Driver/x86-target-features.c | 6 ---- clang/test/Sema/attr-target-mv.c | 14 +++++++++ clang/test/Sema/attr-target.c | 31 ++++++++----------- .../llvm/TargetParser/X86TargetParser.def | 4 +-- 5 files changed, 44 insertions(+), 32 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 9e7f506856dd9..6da3f383d8e23 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -175,18 +175,18 @@ bool X86TargetInfo::initFeatureMap( } if (Feature == "+apxf" || Feature == "-apxf") { - llvm::X86::expandAPXFeatures(Feature == "-apxf" ? true : false, - getTriple().isOSWindows(), - UpdatedFeaturesVec); + std::vector<StringRef> APXFeatures; + llvm::X86::expandAPXFeatures(Feature == "-apxf", getTriple().isOSWindows(), + APXFeatures); + UpdatedFeaturesVec.insert(UpdatedFeaturesVec.end(), APXFeatures.begin(), + APXFeatures.end()); continue; } UpdatedFeaturesVec.push_back(Feature); } - if (!TargetInfo::initFeatureMap( - Features, Diags, CPU, - {UpdatedFeaturesVec.begin(), UpdatedFeaturesVec.end()})) + if (!TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec)) return false; // Can't do this earlier because we need to be able to explicitly enable @@ -1194,6 +1194,15 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const { .Case("xsaves", true) .Case("xsaveopt", true) .Case("apxf", true) + .Case("egpr", true) + .Case("push2pop2", true) + .Case("ppx", true) + .Case("ndd", true) + .Case("ccmp", true) + .Case("nf", true) + .Case("cf", true) + .Case("zu", true) + .Case("jmpabs", true) .Default(false); } diff --git a/clang/test/Driver/x86-target-features.c b/clang/test/Driver/x86-target-features.c index 5546eda90266b..e11753b91de98 100644 --- a/clang/test/Driver/x86-target-features.c +++ b/clang/test/Driver/x86-target-features.c @@ -441,14 +441,8 @@ // RUN: %clang --target=x86_64-unknown-linux-gnu -mno-apxf -mapxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=APXF %s // RUN: %clang --target=x86_64-unknown-linux-gnu -mapxf -mno-apxf %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-APXF %s // -<<<<<<< HEAD -// APXF: "-target-feature" "+egpr" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+zu" "-target-feature" "+push2pop2" "-target-feature" "+ppx" -// NO-APXF: "-target-feature" "-egpr" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-cf" - -======= // APXF: "-target-feature" "+egpr" "-target-feature" "+push2pop2" "-target-feature" "+ppx" "-target-feature" "+ndd" "-target-feature" "+ccmp" "-target-feature" "+nf" "-target-feature" "+zu" "-target-feature" "+jmpabs" // NO-APXF: "-target-feature" "-egpr" "-target-feature" "-push2pop2" "-target-feature" "-ppx" "-target-feature" "-ndd" "-target-feature" "-ccmp" "-target-feature" "-nf" "-target-feature" "-zu" "-target-feature" "-jmpabs" ->>>>>>> other/main // RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=egpr %s -### -o %t.o 2>&1 | FileCheck -check-prefix=EGPR %s // RUN: %clang --target=x86_64-unknown-linux-gnu -mapx-features=push2pop2 %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PUSH2POP2 %s diff --git a/clang/test/Sema/attr-target-mv.c b/clang/test/Sema/attr-target-mv.c index dfc3d614dc1e0..825246f66d882 100644 --- a/clang/test/Sema/attr-target-mv.c +++ b/clang/test/Sema/attr-target-mv.c @@ -185,3 +185,17 @@ int __attribute__((target("default"))) no_priority3(void); int __attribute__((target("avx2"))) no_priority3(void); // expected-error@+1 {{function multiversioning doesn't support feature 'sha'}} int __attribute__((target("sha"))) no_priority3(void); + +int __attribute__((target("default"))) apxf_mv(void) { return 0; } +int __attribute__((target("apxf"))) apxf_mv(void) { return 1; } + +int __attribute__((target("default"))) apx_sub(void); +// expected-error@+1 {{function multiversioning doesn't support feature 'ndd'}} +int __attribute__((target("ndd"))) apx_sub(void); + +// expected-error@+1 {{function multiversioning doesn't support feature 'egpr'}} +int __attribute__((target("egpr"))) apx_two_subs(void) { return 0; } +// expected-error@+1 {{function multiversioning doesn't support feature 'ndd'}} +int __attribute__((target("ndd"))) apx_two_subs(void) { return 1; } +// expected-note@+1 {{function multiversioning caused by this declaration}} +int __attribute__((target("default"))) apx_two_subs(void) { return 2; } diff --git a/clang/test/Sema/attr-target.c b/clang/test/Sema/attr-target.c index a26376a522fcc..e6e8b66da48af 100644 --- a/clang/test/Sema/attr-target.c +++ b/clang/test/Sema/attr-target.c @@ -35,26 +35,21 @@ void __attribute__((target("x86-64-v2"))) v2(void) {} int __attribute__((target("sha"))) good_target_but_not_for_fmv() { return 5; } +// 'apxf' and the individual APX sub-features are all valid in a 'target' +// attribute when used to enable the feature on a single (non-multiversioned) +// function, so none of these produce a diagnostic. int __attribute__((target("apxf"))) apx_supported(void) { return 6; } int __attribute__((target("no-apxf"))) no_apx_supported(void) { return 7; } - -// APXF sub-features should NOT be supported directly in target attribute -//expected-warning@+1 {{unsupported 'egpr' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("egpr"))) egpr_not_supported(void) { return 8; } -//expected-warning@+1 {{unsupported 'ndd' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("ndd"))) ndd_not_supported(void) { return 9; } -//expected-warning@+1 {{unsupported 'ccmp' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("ccmp"))) ccmp_not_supported(void) { return 10; } -//expected-warning@+1 {{unsupported 'nf' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("nf"))) nf_not_supported(void) { return 11; } -//expected-warning@+1 {{unsupported 'cf' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("cf"))) cf_not_supported(void) { return 12; } -//expected-warning@+1 {{unsupported 'zu' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("zu"))) zu_not_supported(void) { return 13; } -//expected-warning@+1 {{unsupported 'push2pop2' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("push2pop2"))) push2pop2_not_supported(void) { return 14; } -//expected-warning@+1 {{unsupported 'ppx' in the 'target' attribute string; 'target' attribute ignored}} -int __attribute__((target("ppx"))) ppx_not_supported(void) { return 15; } +int __attribute__((target("egpr"))) egpr_enabled(void) { return 8; } +int __attribute__((target("ndd"))) ndd_enabled(void) { return 9; } +int __attribute__((target("ccmp"))) ccmp_enabled(void) { return 10; } +int __attribute__((target("nf"))) nf_enabled(void) { return 11; } +int __attribute__((target("cf"))) cf_enabled(void) { return 12; } +int __attribute__((target("zu"))) zu_enabled(void) { return 13; } +int __attribute__((target("push2pop2"))) push2pop2_enabled(void) { return 14; } +int __attribute__((target("ppx"))) ppx_enabled(void) { return 15; } +int __attribute__((target("jmpabs"))) jmpabs_enabled(void) { return 16; } +int __attribute__((target("egpr,ndd,ccmp"))) multiple_enabled(void) { return 17; } #elifdef __aarch64__ diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.def b/llvm/include/llvm/TargetParser/X86TargetParser.def index 0185bfa76db66..30d3bc563a2be 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.def +++ b/llvm/include/llvm/TargetParser/X86TargetParser.def @@ -235,7 +235,7 @@ X86_FEATURE_COMPAT(AVXVNNIINT16, "avxvnniint16", 0, 107) X86_FEATURE_COMPAT(SM3, "sm3", 0, 108) X86_FEATURE_COMPAT(SHA512, "sha512", 0, 109) X86_FEATURE_COMPAT(SM4, "sm4", 0, 110) -X86_FEATURE_COMPAT(APXF, "apxf", 0, 111) +X86_FEATURE_COMPAT(APXF, "apxf", 36, 111) X86_FEATURE_COMPAT(USERMSR, "usermsr", 0, 112) X86_FEATURE_COMPAT(AVX10_1, "avx10.1", 34, 114) X86_FEATURE_COMPAT(AVX10_2, "avx10.2", 35, 116) @@ -274,7 +274,7 @@ X86_FEATURE (LVI_CFI, "lvi-cfi") X86_FEATURE (LVI_LOAD_HARDENING, "lvi-load-hardening") // Max number of priorities. Priorities form a consecutive range. -#define MAX_PRIORITY 35 +#define MAX_PRIORITY 36 #undef X86_FEATURE_COMPAT #undef X86_FEATURE From 187f77915eab4c335436ac458222079bea10fe76 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Wed, 15 Jul 2026 16:25:32 +0200 Subject: [PATCH 5/8] Extend tests, drop custom feature function --- clang/lib/Basic/Targets/X86.cpp | 11 +++-- clang/test/CodeGen/attr-target-x86.c | 49 ++++++++++++++++++- clang/test/Sema/attr-target.c | 2 +- .../llvm/TargetParser/X86TargetParser.h | 4 -- llvm/lib/TargetParser/X86TargetParser.cpp | 13 ----- 5 files changed, 54 insertions(+), 25 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 6da3f383d8e23..904fda63bce92 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -175,11 +175,12 @@ bool X86TargetInfo::initFeatureMap( } if (Feature == "+apxf" || Feature == "-apxf") { - std::vector<StringRef> APXFeatures; - llvm::X86::expandAPXFeatures(Feature == "-apxf", getTriple().isOSWindows(), - APXFeatures); - UpdatedFeaturesVec.insert(UpdatedFeaturesVec.end(), APXFeatures.begin(), - APXFeatures.end()); + char Sign = Feature[0]; + for (const char *Sub : {"egpr", "push2pop2", "ppx", "ndd", "ccmp", "nf", + "zu", "jmpabs"}) + UpdatedFeaturesVec.push_back(Sign + std::string(Sub)); + if (Sign == '-') + UpdatedFeaturesVec.push_back("-cf"); continue; } diff --git a/clang/test/CodeGen/attr-target-x86.c b/clang/test/CodeGen/attr-target-x86.c index e959ac1b849be..85f2d769b3480 100644 --- a/clang/test/CodeGen/attr-target-x86.c +++ b/clang/test/CodeGen/attr-target-x86.c @@ -21,6 +21,15 @@ // CHECK: define {{.*}}@f_no_prefer_256_bit({{.*}} [[f_no_prefer_256_bit:#[0-9]+]] // CHECK: define {{.*}}@f_apxf({{.*}} [[f_apxf:#[0-9]+]] // CHECK: define {{.*}}@f_no_apxf({{.*}} [[f_no_apxf:#[0-9]+]] +// CHECK: define {{.*}}@f_egpr({{.*}} [[f_egpr:#[0-9]+]] +// CHECK: define {{.*}}@f_ndd({{.*}} [[f_ndd:#[0-9]+]] +// CHECK: define {{.*}}@f_ccmp({{.*}} [[f_ccmp:#[0-9]+]] +// CHECK: define {{.*}}@f_nf({{.*}} [[f_nf:#[0-9]+]] +// CHECK: define {{.*}}@f_cf({{.*}} [[f_cf:#[0-9]+]] +// CHECK: define {{.*}}@f_zu({{.*}} [[f_zu:#[0-9]+]] +// CHECK: define {{.*}}@f_push2pop2({{.*}} [[f_push2pop2:#[0-9]+]] +// CHECK: define {{.*}}@f_ppx({{.*}} [[f_ppx:#[0-9]+]] +// CHECK: define {{.*}}@f_jmpabs({{.*}} [[f_jmpabs:#[0-9]+]] // CHECK: [[f_default]] = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87" "tune-cpu"="i686" void f_default(void) {} @@ -111,10 +120,46 @@ void f_prefer_256_bit(void) {} __attribute__((target("no-prefer-256-bit"))) void f_no_prefer_256_bit(void) {} -// CHECK: [[f_apxf]] = {{.*}}"target-features"="{{.*}}+ccmp{{.*}}+egpr{{.*}}+ndd{{.*}}+nf{{.*}}+ppx{{.*}}+push2pop2{{.*}}+zu +// CHECK: [[f_apxf]] = {{.*}}"target-features"="{{.*}}+ccmp{{.*}}+egpr{{.*}}+jmpabs{{.*}}+ndd{{.*}}+nf{{.*}}+ppx{{.*}}+push2pop2{{.*}}+zu __attribute__((target("apxf"))) void f_apxf(void) {} -// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-cf{{.*}}-egpr{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu +// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-cf{{.*}}-egpr{{.*}}-jmpabs{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu __attribute__((target("no-apxf"))) void f_no_apxf(void) {} + +// CHECK: [[f_egpr]] = {{.*}}"target-features"="{{.*}}+egpr +__attribute__((target("egpr"))) +void f_egpr(void) {} + +// CHECK: [[f_ndd]] = {{.*}}"target-features"="{{.*}}+ndd +__attribute__((target("ndd"))) +void f_ndd(void) {} + +// CHECK: [[f_ccmp]] = {{.*}}"target-features"="{{.*}}+ccmp +__attribute__((target("ccmp"))) +void f_ccmp(void) {} + +// CHECK: [[f_nf]] = {{.*}}"target-features"="{{.*}}+nf +__attribute__((target("nf"))) +void f_nf(void) {} + +// CHECK: [[f_cf]] = {{.*}}"target-features"="{{.*}}+cf +__attribute__((target("cf"))) +void f_cf(void) {} + +// CHECK: [[f_zu]] = {{.*}}"target-features"="{{.*}}+zu +__attribute__((target("zu"))) +void f_zu(void) {} + +// CHECK: [[f_push2pop2]] = {{.*}}"target-features"="{{.*}}+push2pop2 +__attribute__((target("push2pop2"))) +void f_push2pop2(void) {} + +// CHECK: [[f_ppx]] = {{.*}}"target-features"="{{.*}}+ppx +__attribute__((target("ppx"))) +void f_ppx(void) {} + +// CHECK: [[f_jmpabs]] = {{.*}}"target-features"="{{.*}}+jmpabs +__attribute__((target("jmpabs"))) +void f_jmpabs(void) {} diff --git a/clang/test/Sema/attr-target.c b/clang/test/Sema/attr-target.c index e6e8b66da48af..b11147396aee4 100644 --- a/clang/test/Sema/attr-target.c +++ b/clang/test/Sema/attr-target.c @@ -37,7 +37,7 @@ int __attribute__((target("sha"))) good_target_but_not_for_fmv() { return 5; } // 'apxf' and the individual APX sub-features are all valid in a 'target' // attribute when used to enable the feature on a single (non-multiversioned) -// function, so none of these produce a diagnostic. +// function, so none of these produce a diagnostic. int __attribute__((target("apxf"))) apx_supported(void) { return 6; } int __attribute__((target("no-apxf"))) no_apx_supported(void) { return 7; } int __attribute__((target("egpr"))) egpr_enabled(void) { return 8; } diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h index bda53cb3ea46c..4552287507fd3 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.h +++ b/llvm/include/llvm/TargetParser/X86TargetParser.h @@ -16,7 +16,6 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/Compiler.h" -#include "llvm/TargetParser/Triple.h" #include <array> namespace llvm { @@ -178,9 +177,6 @@ LLVM_ABI std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs); LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat); -LLVM_ABI void expandAPXFeatures(bool Negative, bool IsOSWindows, - std::vector<StringRef> &Features); - } // namespace X86 } // namespace llvm diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp index ebb33baea234a..ad1c0011bc2b5 100644 --- a/llvm/lib/TargetParser/X86TargetParser.cpp +++ b/llvm/lib/TargetParser/X86TargetParser.cpp @@ -806,19 +806,6 @@ llvm::X86::getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs) { return FeatureMask; } -void llvm::X86::expandAPXFeatures(bool Negative, const bool IsOsWindows, - std::vector<StringRef> &Features) { - if (Negative) { - Features.insert(Features.end(), {"-egpr", "-ndd", "-ccmp", "-nf", "-zu", - "-push2pop2", "-ppx", "-cf"}); - } else { - Features.insert(Features.end(), {"+egpr", "+ndd", "+ccmp", "+nf", "+zu"}); - if (!IsOsWindows) { - Features.insert(Features.end(), {"+push2pop2", "+ppx"}); - } - } -} - unsigned llvm::X86::getFeaturePriority(ProcessorFeatures Feat) { #ifndef NDEBUG // Check that priorities are set properly in the .def file. We expect that From f09098aa06a89764ac5ad9fa6e427b97bfb25469 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Wed, 15 Jul 2026 19:00:35 +0200 Subject: [PATCH 6/8] Formatting --- clang/lib/Basic/Targets/X86.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index 904fda63bce92..c7dd9c8f00918 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -176,8 +176,8 @@ bool X86TargetInfo::initFeatureMap( if (Feature == "+apxf" || Feature == "-apxf") { char Sign = Feature[0]; - for (const char *Sub : {"egpr", "push2pop2", "ppx", "ndd", "ccmp", "nf", - "zu", "jmpabs"}) + for (const char *Sub : + {"egpr", "push2pop2", "ppx", "ndd", "ccmp", "nf", "zu", "jmpabs"}) UpdatedFeaturesVec.push_back(Sign + std::string(Sub)); if (Sign == '-') UpdatedFeaturesVec.push_back("-cf"); From 53808cbbf63c1a560cd8776cbeb8cc68826d339f Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Fri, 17 Jul 2026 15:23:41 +0200 Subject: [PATCH 7/8] Review suggestions, don't disable cf --- clang/lib/Basic/Targets/X86.cpp | 2 -- clang/test/CodeGen/attr-target-x86.c | 2 +- clang/test/Sema/attr-target-mv.c | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index c7dd9c8f00918..7d8a74d62be74 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -179,8 +179,6 @@ bool X86TargetInfo::initFeatureMap( for (const char *Sub : {"egpr", "push2pop2", "ppx", "ndd", "ccmp", "nf", "zu", "jmpabs"}) UpdatedFeaturesVec.push_back(Sign + std::string(Sub)); - if (Sign == '-') - UpdatedFeaturesVec.push_back("-cf"); continue; } diff --git a/clang/test/CodeGen/attr-target-x86.c b/clang/test/CodeGen/attr-target-x86.c index 85f2d769b3480..954a508fc6773 100644 --- a/clang/test/CodeGen/attr-target-x86.c +++ b/clang/test/CodeGen/attr-target-x86.c @@ -124,7 +124,7 @@ void f_no_prefer_256_bit(void) {} __attribute__((target("apxf"))) void f_apxf(void) {} -// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-cf{{.*}}-egpr{{.*}}-jmpabs{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu +// CHECK: [[f_no_apxf]] = {{.*}}"target-features"="{{.*}}-ccmp{{.*}}-egpr{{.*}}-jmpabs{{.*}}-ndd{{.*}}-nf{{.*}}-ppx{{.*}}-push2pop2{{.*}}-zu __attribute__((target("no-apxf"))) void f_no_apxf(void) {} diff --git a/clang/test/Sema/attr-target-mv.c b/clang/test/Sema/attr-target-mv.c index 825246f66d882..e77a1888595f2 100644 --- a/clang/test/Sema/attr-target-mv.c +++ b/clang/test/Sema/attr-target-mv.c @@ -189,9 +189,10 @@ int __attribute__((target("sha"))) no_priority3(void); int __attribute__((target("default"))) apxf_mv(void) { return 0; } int __attribute__((target("apxf"))) apxf_mv(void) { return 1; } -int __attribute__((target("default"))) apx_sub(void); -// expected-error@+1 {{function multiversioning doesn't support feature 'ndd'}} +// expected-error@+2 {{function multiversioning doesn't support feature 'ndd'}} +// expected-note@+2 {{function multiversioning caused by this declaration}} int __attribute__((target("ndd"))) apx_sub(void); +int __attribute__((target("default"))) apx_sub(void); // expected-error@+1 {{function multiversioning doesn't support feature 'egpr'}} int __attribute__((target("egpr"))) apx_two_subs(void) { return 0; } From 9804f807001b453175016ebbab52acd84c664d02 Mon Sep 17 00:00:00 2001 From: "Pirog, Mikolaj Maciej" <[email protected]> Date: Sat, 18 Jul 2026 17:48:43 +0200 Subject: [PATCH 8/8] Review suggestions --- clang/test/CodeGen/attr-target-mv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clang/test/CodeGen/attr-target-mv.c b/clang/test/CodeGen/attr-target-mv.c index 68af3c7476b32..f4a9667aa403e 100644 --- a/clang/test/CodeGen/attr-target-mv.c +++ b/clang/test/CodeGen/attr-target-mv.c @@ -32,6 +32,7 @@ int __attribute__((target("arch=clearwaterforest"))) foo(void) {return 26;} int __attribute__((target("arch=diamondrapids"))) foo(void) {return 27;} int __attribute__((target("arch=wildcatlake"))) foo(void) {return 28;} int __attribute__((target("arch=novalake"))) foo(void) {return 29;} +int __attribute__((target("apxf"))) foo(void) {return 30;} int __attribute__((target("default"))) foo(void) { return 2; } int bar(void) { @@ -209,6 +210,8 @@ void calls_pr50025c(void) { pr50025c(); } // ITANIUM: ret i32 28 // ITANIUM: define{{.*}} i32 @foo.arch_novalake() // ITANIUM: ret i32 29 +// ITANIUM: define{{.*}} i32 @foo.apxf() +// ITANIUM: ret i32 30 // ITANIUM: define{{.*}} i32 @foo() // ITANIUM: ret i32 2 // ITANIUM: define{{.*}} i32 @bar() @@ -272,6 +275,8 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: ret i32 28 // WINDOWS: define dso_local i32 @foo.arch_novalake() // WINDOWS: ret i32 29 +// WINDOWS: define dso_local i32 @foo.apxf() +// WINDOWS: ret i32 30 // WINDOWS: define dso_local i32 @foo() // WINDOWS: ret i32 2 // WINDOWS: define dso_local i32 @bar() @@ -280,6 +285,7 @@ void calls_pr50025c(void) { pr50025c(); } // ITANIUM: define weak_odr ptr @foo.resolver() #[[ATTR_RESOLVER:[0-9]+]] // LINUX-SAME: comdat // ITANIUM: call void @__cpu_indicator_init() +// ITANIUM: ret ptr @foo.apxf // ITANIUM: ret ptr @foo.arch_sandybridge // ITANIUM: ret ptr @foo.arch_ivybridge // ITANIUM: ret ptr @foo.sse4.2 @@ -287,6 +293,7 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: define weak_odr dso_local i32 @foo.resolver() #[[ATTR_RESOLVER:[0-9]+]] comdat // WINDOWS: call void @__cpu_indicator_init() +// WINDOWS: call i32 @foo.apxf // WINDOWS: call i32 @foo.arch_sandybridge // WINDOWS: call i32 @foo.arch_ivybridge // WINDOWS: call i32 @foo.sse4.2 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
