aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit203c5c75385c3d582ec4385e111f12a11189d1d6 (patch)
treeb9cc68acc10f91b460596585b577444bb24838a4 /lib
parenta86724559376732dd017290b21fbaa55f31ffa64 (diff)
downloadexternal_llvm-203c5c75385c3d582ec4385e111f12a11189d1d6.zip
external_llvm-203c5c75385c3d582ec4385e111f12a11189d1d6.tar.gz
external_llvm-203c5c75385c3d582ec4385e111f12a11189d1d6.tar.bz2
64-bit fp loads can come straight out of the constant pool, not as
bad as I'd thought. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMFastISel.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index cc5be6c..7ec62af 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/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) {