From c072c50d24235f40c9d2f0b63caf1db580d36a20 Mon Sep 17 00:00:00 2001 From: Simon Dardis Date: Tue, 4 Oct 2016 10:35:07 +0000 Subject: [PATCH] [mips][fastisel] Consider soft-float an unsupported floating point mode Treat soft-float as unsupported for fast-isel. Additionally, ensure we check that lowering f32 arguments also considers the case of soft-float mode. Reviewers: ehostunreach, vkalintiris, zoran.jovanovic Differential Review: https://reviews.llvm.org/D24505 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283209 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/MipsFastISel.cpp | 8 ++++++-- .../Mips/Fast-ISel/fast-isel-softfloat-lower-args.ll | 11 +++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/Mips/Fast-ISel/fast-isel-softfloat-lower-args.ll diff --git a/lib/Target/Mips/MipsFastISel.cpp b/lib/Target/Mips/MipsFastISel.cpp index 94531642492..1581bc9c58a 100644 --- a/lib/Target/Mips/MipsFastISel.cpp +++ b/lib/Target/Mips/MipsFastISel.cpp @@ -216,7 +216,7 @@ public: !Subtarget->inMicroMipsMode() && Subtarget->hasMips32(); TargetSupported = ISASupported && TM.isPositionIndependent() && getABI().IsO32(); - UnsupportedFPMode = Subtarget->isFP64bit(); + UnsupportedFPMode = Subtarget->isFP64bit() || Subtarget->useSoftFloat(); } unsigned fastMaterializeAlloca(const AllocaInst *AI) override; @@ -1365,6 +1365,10 @@ bool MipsFastISel::fastLowerArguments() { break; case MVT::f32: + if (UnsupportedFPMode) { + DEBUG(dbgs() << ".. .. gave up (UnsupportedFPMode)\n"); + return false; + } if (NextFGR32 == FGR32ArgRegs.end()) { DEBUG(dbgs() << ".. .. gave up (ran out of FGR32 arguments)\n"); return false; @@ -1381,7 +1385,7 @@ bool MipsFastISel::fastLowerArguments() { case MVT::f64: if (UnsupportedFPMode) { - DEBUG(dbgs() << ".. .. gave up (UnsupportedFPMode\n"); + DEBUG(dbgs() << ".. .. gave up (UnsupportedFPMode)\n"); return false; } if (NextAFGR64 == AFGR64ArgRegs.end()) { diff --git a/test/CodeGen/Mips/Fast-ISel/fast-isel-softfloat-lower-args.ll b/test/CodeGen/Mips/Fast-ISel/fast-isel-softfloat-lower-args.ll new file mode 100644 index 00000000000..24161ca8238 --- /dev/null +++ b/test/CodeGen/Mips/Fast-ISel/fast-isel-softfloat-lower-args.ll @@ -0,0 +1,11 @@ +; RUN: not llc -march=mipsel -mcpu=mips32r2 -mattr=+soft-float \ +; RUN: -O0 -fast-isel-abort=3 -relocation-model=pic < %s + +; Test that FastISel aborts instead of trying to lower arguments for soft-float. + +define void @__signbit(double %__x) { +entry: + %__x.addr = alloca double, align 8 + store double %__x, double* %__x.addr, align 8 + ret void +}