[llvm] r365508 - [mips] Show error in case of using FP64 mode on pre MIPS32R2 CPU

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 08:48:16 PDT 2019


Author: atanasyan
Date: Tue Jul  9 08:48:16 2019
New Revision: 365508

URL: http://llvm.org/viewvc/llvm-project?rev=365508&view=rev
Log:
[mips] Show error in case of using FP64 mode on pre MIPS32R2 CPU

Modified:
    llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
    llvm/trunk/test/CodeGen/Mips/fp64a.ll

Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=365508&r1=365507&r2=365508&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Tue Jul  9 08:48:16 2019
@@ -108,6 +108,11 @@ MipsSubtarget::MipsSubtarget(const Tripl
                        "See -mattr=+fp64.",
                        false);
 
+  if (isFP64bit() && !hasMips64() && hasMips32() && !hasMips32r2())
+    report_fatal_error(
+        "FPU with 64-bit registers is not available on MIPS32 pre revision 2. "
+        "Use -mcpu=mips32r2 or greater.");
+
   if (!isABI_O32() && !useOddSPReg())
     report_fatal_error("-mattr=+nooddspreg requires the O32 ABI.", false);
 

Modified: llvm/trunk/test/CodeGen/Mips/fp64a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/fp64a.ll?rev=365508&r1=365507&r2=365508&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/fp64a.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/fp64a.ll Tue Jul  9 08:48:16 2019
@@ -6,9 +6,8 @@
 
 ; We don't test MIPS32r1 since support for 64-bit coprocessors (such as a 64-bit
 ; FPU) on a 32-bit architecture was added in MIPS32r2.
-; FIXME: We currently don't test that attempting to use FP64 on MIPS32r1 is an
-;        error either.
 
+; RUN: not llc -march=mips -mcpu=mips32 -mattr=fp64 < %s 2>&1 | FileCheck %s -check-prefix=32R1-FP64
 ; RUN: llc -march=mips -mcpu=mips32r2 -mattr=fp64 < %s | FileCheck %s -check-prefixes=ALL,32R2-NO-FP64A-BE
 ; RUN: llc -march=mips -mcpu=mips32r2 -mattr=fp64,nooddspreg < %s | FileCheck %s -check-prefixes=ALL,32R2-FP64A
 ; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=fp64 < %s | FileCheck %s -check-prefixes=ALL,32R2-NO-FP64A-LE
@@ -19,6 +18,7 @@
 ; RUN: llc -march=mips64el -mcpu=mips64 -mattr=fp64 < %s | FileCheck %s -check-prefixes=ALL,64-NO-FP64A
 ; RUN: not llc -march=mips64el -mcpu=mips64 -mattr=fp64,nooddspreg < %s 2>&1 | FileCheck %s -check-prefix=64-FP64A
 
+; 32R1-FP64: LLVM ERROR: FPU with 64-bit registers is not available on MIPS32 pre revision 2. Use -mcpu=mips32r2 or greater.
 ; 64-FP64A: LLVM ERROR: -mattr=+nooddspreg requires the O32 ABI.
 
 declare double @dbl();




More information about the llvm-commits mailing list