[clang] cd5ab56 - Change the default target CPU for OpenBSD/i386 to i586

Brad Smith via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 8 10:50:39 PDT 2020


Author: Brad Smith
Date: 2020-08-08T13:49:45-04:00
New Revision: cd5ab56bc406c3f9a6f593f98c63dafb53547ab1

URL: https://github.com/llvm/llvm-project/commit/cd5ab56bc406c3f9a6f593f98c63dafb53547ab1
DIFF: https://github.com/llvm/llvm-project/commit/cd5ab56bc406c3f9a6f593f98c63dafb53547ab1.diff

LOG: Change the default target CPU for OpenBSD/i386 to i586

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Arch/X86.cpp
    clang/test/Driver/openbsd.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index c49aaadc42ae..94a53f9d9e46 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/X86.cpp
@@ -94,13 +94,13 @@ std::string x86::getX86TargetCPU(const ArgList &Args,
     return "x86-64";
 
   switch (Triple.getOS()) {
-  case llvm::Triple::FreeBSD:
-    return "i686";
   case llvm::Triple::NetBSD:
-  case llvm::Triple::OpenBSD:
     return "i486";
   case llvm::Triple::Haiku:
+  case llvm::Triple::OpenBSD:
     return "i586";
+  case llvm::Triple::FreeBSD:
+    return "i686";
   default:
     // Fallback to p4.
     return "pentium4";

diff  --git a/clang/test/Driver/openbsd.c b/clang/test/Driver/openbsd.c
index 51a5b4380f45..e17d05dc76da 100644
--- a/clang/test/Driver/openbsd.c
+++ b/clang/test/Driver/openbsd.c
@@ -14,6 +14,11 @@
 // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
 // CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o"
 
+// Check CPU type for i386
+// RUN: %clang -target i386-unknown-openbsd -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-i386-CPU %s
+// CHECK-i386-CPU: "-target-cpu" "i586"
+
 // Check CPU type for MIPS64
 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-MIPS64-CPU %s


        


More information about the cfe-commits mailing list