summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-09-09 23:50:00 +0000
committerEric Christopher <echristo@apple.com>2010-09-09 23:50:00 +0000
commit22fd29a94a418b1f62805d7bf2dee3131df3e452 (patch)
tree2fdd7a46145d59b65da28f011d41060c48f8693b /llvm/lib
parentd198047ef3016488faa52e9ac603defdef4c4208 (diff)
downloadbcm5719-llvm-22fd29a94a418b1f62805d7bf2dee3131df3e452.tar.gz
bcm5719-llvm-22fd29a94a418b1f62805d7bf2dee3131df3e452.zip
64-bit fp loads can come straight out of the constant pool, not as
bad as I'd thought. llvm-svn: 113561
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMFastISel.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index cc5be6cace2..7ec62afc70c 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -373,16 +373,24 @@ unsigned ARMFastISel::ARMMaterializeFP(const ConstantFP *CFP, EVT VT) {
.addFPImm(CFP));
return DestReg;
}
-
- // No 64-bit at the moment.
- if (is64bit) return 0;
-
- // Load this from the constant pool.
- unsigned DestReg = ARMMaterializeInt(cast<Constant>(CFP));
-
- // If we have a floating point constant we expect it in a floating point
- // register.
- return ARMMoveToFPReg(VT, DestReg);
+
+ // Require VFP2 for this.
+ if (!Subtarget->hasVFP2()) return false;
+
+ // MachineConstantPool wants an explicit alignment.
+ unsigned Align = TD.getPrefTypeAlignment(CFP->getType());
+ if (Align == 0) {
+ // TODO: Figure out if this is correct.
+ Align = TD.getTypeAllocSize(CFP->getType());
+ }
+ unsigned Idx = MCP.getConstantPoolIndex(cast<Constant>(CFP), Align);
+ unsigned DestReg = createResultReg(TLI.getRegClassFor(VT));
+ unsigned Opc = is64bit ? ARM::VLDRD : ARM::VLDRS;
+
+ AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(Opc))
+ .addReg(DestReg).addConstantPoolIndex(Idx)
+ .addReg(0));
+ return DestReg;
}
unsigned ARMFastISel::ARMMaterializeInt(const Constant *C) {
OpenPOWER on IntegriCloud