aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCISelPattern.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-04-01 01:08:07 +0000
committerNate Begeman <natebegeman@mac.com>2005-04-01 01:08:07 +0000
commit6d369ccae002bd0f1e506545b7f4590b081d778d (patch)
treebca834808e91eb4301e01d03a7259dbf4d890708 /lib/Target/PowerPC/PPCISelPattern.cpp
parentdffcfccc13f0cc39b774c47b93ac8a64e93f0d8d (diff)
Add support for adding 0.0 and -0.0 to the constant pool, since we lie and
say that we support them, for the purposes of generating fsel instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCISelPattern.cpp')
-rw-r--r--lib/Target/PowerPC/PPCISelPattern.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Target/PowerPC/PPCISelPattern.cpp b/lib/Target/PowerPC/PPCISelPattern.cpp
index fd4d89db2f..558232669e 100644
--- a/lib/Target/PowerPC/PPCISelPattern.cpp
+++ b/lib/Target/PowerPC/PPCISelPattern.cpp
@@ -760,9 +760,17 @@ unsigned ISel::SelectExprFP(SDOperand N, unsigned Result)
BuildMI(BB, PPC::FMR, 1, Result).addReg(Tmp1);
return Result;
- case ISD::ConstantFP:
- assert(0 && "ISD::ConstantFP Unimplemented");
- abort();
+ case ISD::ConstantFP: {
+ Tmp1 = MakeReg(MVT::i32);
+ ConstantFPSDNode *CN = cast<ConstantFPSDNode>(N);
+ MachineConstantPool *CP = BB->getParent()->getConstantPool();
+ ConstantFP *CFP = ConstantFP::get(Type::DoubleTy, CN->getValue());
+ unsigned CPI = CP->getConstantPoolIndex(CFP);
+ BuildMI(BB, PPC::LOADHiAddr, 2, Tmp1).addReg(getGlobalBaseReg())
+ .addConstantPoolIndex(CPI);
+ BuildMI(BB, PPC::LFD, 2, Result).addConstantPoolIndex(CPI).addReg(Tmp1);
+ return Result;
+ }
case ISD::MUL:
case ISD::ADD: