[PATCH] D23795: [mips] Tighten FastISel restrictions

Simon Dardis via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 08:44:57 PDT 2016


sdardis removed rL LLVM as the repository for this revision.
sdardis updated this revision to Diff 69866.
sdardis added a comment.

Address review comments on test, fix a comment in test.


https://reviews.llvm.org/D23795

Files:
  lib/Target/Mips/MipsFastISel.cpp
  test/CodeGen/Mips/Fast-ISel/double-arg.ll

Index: test/CodeGen/Mips/Fast-ISel/double-arg.ll
===================================================================
--- /dev/null
+++ test/CodeGen/Mips/Fast-ISel/double-arg.ll
@@ -0,0 +1,14 @@
+; RUN: not llc -march=mipsel -mcpu=mips32r2 -fast-isel -mattr=+fp64 < %s \
+; RUN:     -fast-isel-abort=3 | FileCheck %s
+
+; Check that FastISel aborts when we have 64bit FPU registers. FastISel currently
+; supports AFGR64 only, which uses paired 32 bit registers.
+
+define zeroext i1 @f(double %value) {
+entry:
+; CHECK-LABEL: f:
+; CHECK: sdc1
+  %value.addr = alloca double, align 8
+  store double %value, double* %value.addr, align 8
+  ret i1 false
+}
Index: lib/Target/Mips/MipsFastISel.cpp
===================================================================
--- lib/Target/Mips/MipsFastISel.cpp
+++ lib/Target/Mips/MipsFastISel.cpp
@@ -976,9 +976,13 @@
 bool MipsFastISel::selectSelect(const Instruction *I) {
   assert(isa<SelectInst>(I) && "Expected a select instruction.");
 
+  DEBUG(dbgs() << "selectSelect\n");
+
   MVT VT;
-  if (!isTypeSupported(I->getType(), VT))
+  if (!isTypeSupported(I->getType(), VT) || UnsupportedFPMode) {
+    DEBUG(dbgs() << ".. .. gave up (!isTypeSupported || UnsupportedFPMode)\n");
     return false;
+  }
 
   unsigned CondMovOpc;
   const TargetRegisterClass *RC;
@@ -1376,6 +1380,10 @@
       break;
 
     case MVT::f64:
+      if (UnsupportedFPMode) {
+        DEBUG(dbgs() << ".. .. gave up (UnsupportedFPMode\n");
+        return false;
+      }
       if (NextAFGR64 == AFGR64ArgRegs.end()) {
         DEBUG(dbgs() << ".. .. gave up (ran out of AFGR64 arguments)\n");
         return false;
@@ -1617,6 +1625,8 @@
   const Function &F = *I->getParent()->getParent();
   const ReturnInst *Ret = cast<ReturnInst>(I);
 
+  DEBUG(dbgs() << "selectRet\n");
+
   if (!FuncInfo.CanLowerReturn)
     return false;
 
@@ -1677,6 +1687,12 @@
     if (RVVT == MVT::f128)
       return false;
 
+    // Do not handle FGR64 returns for now.
+    if (RVVT == MVT::f64 && UnsupportedFPMode) {
+      DEBUG(dbgs() << ".. .. gave up (UnsupportedFPMode\n");
+      return false;
+    }
+
     MVT DestVT = VA.getValVT();
     // Special handling for extended integers.
     if (RVVT != DestVT) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23795.69866.patch
Type: text/x-patch
Size: 2229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160831/1392fd8c/attachment.bin>


More information about the llvm-commits mailing list