[llvm-branch-commits] [llvm-branch] r118528 - /llvm/branches/Apple/whitney/lib/Target/ARM/ARMFastISel.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 9 09:28:18 PST 2010
Author: ddunbar
Date: Tue Nov 9 11:28:18 2010
New Revision: 118528
URL: http://llvm.org/viewvc/llvm-project?rev=118528&view=rev
Log:
Merge r118192:
--
Author: Eric Christopher <echristo at apple.com>
Date: Wed Nov 3 20:21:17 2010 +0000
Optimize generated code for integer materialization a bit.
Modified:
llvm/branches/Apple/whitney/lib/Target/ARM/ARMFastISel.cpp
Modified: llvm/branches/Apple/whitney/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Target/ARM/ARMFastISel.cpp?rev=118528&r1=118527&r2=118528&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/branches/Apple/whitney/lib/Target/ARM/ARMFastISel.cpp Tue Nov 9 11:28:18 2010
@@ -434,6 +434,19 @@
// For now 32-bit only.
if (VT.getSimpleVT().SimpleTy != MVT::i32) return false;
+ unsigned DestReg = createResultReg(TLI.getRegClassFor(VT));
+
+ // If we can do this in a single instruction without a constant pool entry
+ // do so now.
+ const ConstantInt *CI = cast<ConstantInt>(C);
+ if (isUInt<16>(CI->getSExtValue())) {
+ unsigned Opc = isThumb ? ARM::t2MOVi16 : ARM::MOVi16;
+ AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+ TII.get(Opc), DestReg)
+ .addImm(CI->getSExtValue()));
+ return DestReg;
+ }
+
// MachineConstantPool wants an explicit alignment.
unsigned Align = TD.getPrefTypeAlignment(C->getType());
if (Align == 0) {
@@ -441,7 +454,6 @@
Align = TD.getTypeAllocSize(C->getType());
}
unsigned Idx = MCP.getConstantPoolIndex(C, Align);
- unsigned DestReg = createResultReg(TLI.getRegClassFor(VT));
if (isThumb)
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
More information about the llvm-branch-commits
mailing list