[llvm-commits] [llvm] r113561 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
Eric Christopher
echristo at apple.com
Thu Sep 9 16:50:01 PDT 2010
Author: echristo
Date: Thu Sep 9 18:50:00 2010
New Revision: 113561
URL: http://llvm.org/viewvc/llvm-project?rev=113561&view=rev
Log:
64-bit fp loads can come straight out of the constant pool, not as
bad as I'd thought.
Modified:
llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=113561&r1=113560&r2=113561&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Thu Sep 9 18:50:00 2010
@@ -373,16 +373,24 @@
.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) {
More information about the llvm-commits
mailing list