[llvm-commits] [llvm] r146999 - in /llvm/trunk: lib/Target/Mips/MipsISelDAGToDAG.cpp test/CodeGen/Mips/mips64fpimm0.ll

Akira Hatanaka ahatanaka at mips.com
Tue Dec 20 14:25:51 PST 2011


Author: ahatanak
Date: Tue Dec 20 16:25:50 2011
New Revision: 146999

URL: http://llvm.org/viewvc/llvm-project?rev=146999&view=rev
Log:
Add code in MipsDAGToDAGISel for selecting constant +0.0.
MIPS64 can generate constant +0.0 with a single DMTC1 instruction. 

Added:
    llvm/trunk/test/CodeGen/Mips/mips64fpimm0.ll
Modified:
    llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=146999&r1=146998&r2=146999&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Tue Dec 20 16:25:50 2011
@@ -293,6 +293,12 @@
     case ISD::ConstantFP: {
       ConstantFPSDNode *CN = dyn_cast<ConstantFPSDNode>(Node);
       if (Node->getValueType(0) == MVT::f64 && CN->isExactlyValue(+0.0)) {
+        if (Subtarget.hasMips64()) {
+          SDValue Zero = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl,
+                                                Mips::ZERO_64, MVT::i64);
+          return CurDAG->getMachineNode(Mips::DMTC1, dl, MVT::f64, Zero);
+        }
+
         SDValue Zero = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), dl,
                                               Mips::ZERO, MVT::i32);
         return CurDAG->getMachineNode(Mips::BuildPairF64, dl, MVT::f64, Zero,

Added: llvm/trunk/test/CodeGen/Mips/mips64fpimm0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/mips64fpimm0.ll?rev=146999&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/mips64fpimm0.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/mips64fpimm0.ll Tue Dec 20 16:25:50 2011
@@ -0,0 +1,7 @@
+; RUN: llc  < %s -march=mips64el -mcpu=mips64 -mattr=n64 | FileCheck %s
+
+define double @foo1() nounwind readnone {
+entry:
+; CHECK: dmtc1 $zero
+  ret double 0.000000e+00
+}





More information about the llvm-commits mailing list