[PATCH] Set the default ISA for OpenBSD/mips64 to MIPS III

Brad Smith brad at comstyle.com
Mon Jan 5 18:21:45 PST 2015


On Mon, Jan 05, 2015 at 04:52:09PM -0500, Rafael Esp??ndola wrote:
> On 5 January 2015 at 16:48, Brad Smith <brad at comstyle.com> wrote:
> > On 01/05/15 10:56, Rafael Esp??ndola wrote:
> >>
> >> testcase?
> >
> >
> > I wasn't sure what to use for a test. Checking -target-cpu would be
> > good enough?
> 
> Yes.

With some tests..

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp	(revision 225233)
+++ lib/Driver/Tools.cpp	(working copy)
@@ -977,6 +977,10 @@
     DefMips64CPU = "mips64r6";
   }
 
+  // MIPS3 is the default for mips64*-unknown-openbsd.
+  if (Triple.getOS() == llvm::Triple::OpenBSD)
+    DefMips64CPU = "mips3";
+
   if (Arg *A = Args.getLastArg(options::OPT_march_EQ,
                                options::OPT_mcpu_EQ))
     CPUName = A->getValue();
Index: test/Driver/openbsd.c
===================================================================
--- test/Driver/openbsd.c	(revision 225233)
+++ test/Driver/openbsd.c	(working copy)
@@ -8,6 +8,14 @@
 // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
 // CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o"
 
+// Check CPU type for MIPS64
+// RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-MIPS64-CPU %s
+// RUN: %clang -target mips64el-unknown-openbsd -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-MIPS64EL-CPU %s
+// CHECK-MIPS64-CPU: "-target-cpu" "mips3"
+// CHECK-MIPS64EL-CPU: "-target-cpu" "mips3"
+
 // Check that the new linker flags are passed to OpenBSD
 // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -r %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-R %s


More information about the cfe-commits mailing list