mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
Add code in MipsDAGToDAGISel for selecting constant +0.0.
MIPS64 can generate constant +0.0 with a single DMTC1 instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52346e964f
commit
990d639f55
@ -293,6 +293,12 @@ SDNode* MipsDAGToDAGISel::Select(SDNode *Node) {
|
||||
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,
|
||||
|
7
test/CodeGen/Mips/mips64fpimm0.ll
Normal file
7
test/CodeGen/Mips/mips64fpimm0.ll
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user