[PATCH] D145857: [X86] Make triple ArchName override OS for i686 and i786
Phoebe Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 12 19:19:51 PDT 2023
pengfei updated this revision to Diff 504498.
pengfei added a comment.
Support i886 and i986.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145857/new/
https://reviews.llvm.org/D145857
Files:
clang/lib/Driver/ToolChains/Arch/X86.cpp
clang/test/Driver/cl-x86-flags.c
clang/test/Driver/nacl-direct.c
Index: clang/test/Driver/nacl-direct.c
===================================================================
--- clang/test/Driver/nacl-direct.c
+++ clang/test/Driver/nacl-direct.c
@@ -6,7 +6,7 @@
// RUN: | FileCheck --check-prefix=CHECK-I686 %s
// CHECK-I686: "-cc1"
// CHECK-I686-NOT: "-fno-use-init-array"
-// CHECK-I686: "-target-cpu" "pentium4"
+// CHECK-I686: "-target-cpu" "i686"
// CHECK-I686: "-resource-dir" "foo"
// CHECK-I686: "-internal-isystem" "foo{{/|\\\\}}include"
// CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}i686-nacl{{/|\\\\}}usr{{/|\\\\}}include"
Index: clang/test/Driver/cl-x86-flags.c
===================================================================
--- clang/test/Driver/cl-x86-flags.c
+++ clang/test/Driver/cl-x86-flags.c
@@ -133,5 +133,11 @@
// tune: "-target-cpu" "sandybridge"
// tune-SAME: "-tune-cpu" "haswell"
+// RUN: %clang_cl --target=i686-unknown-unknown -### -- 2>&1 %s | FileCheck -check-prefix=i686 %s
+// i686: "-target-cpu" "i686"
+
+// RUN: %clang_cl --target=i786-unknown-unknown -### -- 2>&1 %s | FileCheck -check-prefix=i786 %s
+// i786: "-target-cpu" "pentium4"
+
void f(void) {
}
Index: clang/lib/Driver/ToolChains/Arch/X86.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -102,18 +102,27 @@
if (Is64Bit)
return "x86-64";
- switch (Triple.getOS()) {
- case llvm::Triple::NetBSD:
- return "i486";
- case llvm::Triple::Haiku:
- case llvm::Triple::OpenBSD:
- return "i586";
- case llvm::Triple::FreeBSD:
- return "i686";
- default:
- // Fallback to p4.
- return "pentium4";
+ StringRef ArchName = Triple.getArchName();
+
+ if (ArchName == "i386") {
+ switch (Triple.getOS()) {
+ case llvm::Triple::NetBSD:
+ return "i486";
+ case llvm::Triple::Haiku:
+ case llvm::Triple::OpenBSD:
+ return "i586";
+ case llvm::Triple::FreeBSD:
+ return "i686";
+ default:
+ // Fallback to p4.
+ return "pentium4";
+ }
}
+
+ if (ArchName == "i786" || ArchName == "i886" || ArchName == "i986")
+ return "pentium4";
+
+ return std::string(ArchName);
}
void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145857.504498.patch
Type: text/x-patch
Size: 2293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230313/e3eb3632/attachment-0001.bin>
More information about the cfe-commits
mailing list