[PATCH] D70018: [mips][test] Check if the subtarget can support the requested triple width

Miloš Stojanović via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 07:22:45 PST 2019


mstojanovic updated this revision to Diff 228891.
mstojanovic added a comment.

Shortened the tests.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70018/new/

https://reviews.llvm.org/D70018

Files:
  llvm/lib/Target/Mips/MipsSubtarget.cpp
  llvm/test/CodeGen/Mips/cpus-no-mips64.ll


Index: llvm/test/CodeGen/Mips/cpus-no-mips64.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/Mips/cpus-no-mips64.ll
@@ -0,0 +1,16 @@
+; Check that we reject 64-bit mode on 32-bit only CPUs.
+
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips1 2>&1 | FileCheck %s
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips2 2>&1 | FileCheck %s
+
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips32 2>&1 | FileCheck %s
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips32r2 2>&1 | FileCheck %s
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips32r3 2>&1 | FileCheck %s
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips32r5 2>&1 | FileCheck %s
+; RUN: not llc < %s -o /dev/null -mtriple=mips64 -mcpu=mips32r6 2>&1 | FileCheck %s
+
+; CHECK: LLVM ERROR: 64-bit code requested on a subtarget that doesn't support it!
+
+define void @foo() {
+  ret void
+}
Index: llvm/lib/Target/Mips/MipsSubtarget.cpp
===================================================================
--- llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -256,6 +256,10 @@
     stackAlignment = Align(8);
   }
 
+  if ((isABI_N32() || isABI_N64()) && !isGP64bit())
+    report_fatal_error("64-bit code requested on a subtarget that doesn't "
+                       "support it!");
+
   return *this;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70018.228891.patch
Type: text/x-patch
Size: 1419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191112/3e2aa940/attachment.bin>


More information about the llvm-commits mailing list