summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2019-11-13 12:08:38 +0300
committerSimon Atanasyan <simon@atanasyan.com>2019-11-13 13:32:39 +0300
commit068db2ed4d1879e100fb12f2a3d75e38b8867b46 (patch)
tree4eb7a0caba5fe7a57010141f0a4c2e5e83b44585
parentb3853d852629d1a2713cf47a2422c46c0c630f87 (diff)
downloadbcm5719-llvm-068db2ed4d1879e100fb12f2a3d75e38b8867b46.tar.gz
bcm5719-llvm-068db2ed4d1879e100fb12f2a3d75e38b8867b46.zip
[mips] Show an error if 64-bit target triple provided with 32-bit CPU
When a 64-bit triple is used emit an error if the CPU only supports 32-bit code. Patch by Miloš Stojanović. Differential Revision: https://reviews.llvm.org/D70018
-rw-r--r--llvm/lib/Target/Mips/MipsSubtarget.cpp4
-rw-r--r--llvm/test/CodeGen/Mips/cpus-no-mips64.ll16
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsSubtarget.cpp b/llvm/lib/Target/Mips/MipsSubtarget.cpp
index 29e557c6052..133b818114c 100644
--- a/llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ b/llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -256,6 +256,10 @@ MipsSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS,
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;
}
diff --git a/llvm/test/CodeGen/Mips/cpus-no-mips64.ll b/llvm/test/CodeGen/Mips/cpus-no-mips64.ll
new file mode 100644
index 00000000000..301f6c2152e
--- /dev/null
+++ b/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
+}
OpenPOWER on IntegriCloud