diff options
author | Chad Rosier <mcrosier@apple.com> | 2011-11-04 22:29:00 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2011-11-04 22:29:00 +0000 |
commit | 44e895761f289029657a8d066f67f0c9d18693b3 (patch) | |
tree | 5b4310fea4477a223cad2b5561df2820cb24cd7d | |
parent | a0dd4cbc8739ab24535542b58c4c25e15146b44d (diff) | |
download | llvm-44e895761f289029657a8d066f67f0c9d18693b3.tar.gz llvm-44e895761f289029657a8d066f67f0c9d18693b3.tar.bz2 llvm-44e895761f289029657a8d066f67f0c9d18693b3.tar.xz |
Enable support for materializing i1, i8, and i16 integers via move immediate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143739 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMFastISel.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp index 0290c9d611..e8e8124b66 100644 --- a/lib/Target/ARM/ARMFastISel.cpp +++ b/lib/Target/ARM/ARMFastISel.cpp @@ -545,22 +545,27 @@ unsigned ARMFastISel::ARMMaterializeFP(const ConstantFP *CFP, EVT VT) { unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, EVT VT) { - // For now 32-bit only. - if (VT != MVT::i32) return false; - - unsigned DestReg = createResultReg(TLI.getRegClassFor(VT)); + if (VT != MVT::i32 && VT != MVT::i16 && VT != MVT::i8 && VT != MVT::i1) + return false; // If we can do this in a single instruction without a constant pool entry // do so now. const ConstantInt *CI = cast<ConstantInt>(C); if (Subtarget->hasV6T2Ops() && isUInt<16>(CI->getSExtValue())) { unsigned Opc = isThumb ? ARM::t2MOVi16 : ARM::MOVi16; + unsigned ImmReg = createResultReg(TLI.getRegClassFor(VT)); AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, - TII.get(Opc), DestReg) + TII.get(Opc), ImmReg) .addImm(CI->getSExtValue())); - return DestReg; + return ImmReg; } + // For now 32-bit only. + if (VT != MVT::i32) + return false; + + unsigned DestReg = createResultReg(TLI.getRegClassFor(VT)); + // MachineConstantPool wants an explicit alignment. unsigned Align = TD.getPrefTypeAlignment(C->getType()); if (Align == 0) { |