forked from OSchip/llvm-project
Enable support for materializing i1, i8, and i16 integers via move immediate.
llvm-svn: 143739
This commit is contained in:
parent
c9473e9809
commit
67f96887aa
|
@ -545,22 +545,27 @@ unsigned ARMFastISel::ARMMaterializeFP(const ConstantFP *CFP, EVT VT) {
|
||||||
|
|
||||||
unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, EVT VT) {
|
unsigned ARMFastISel::ARMMaterializeInt(const Constant *C, EVT VT) {
|
||||||
|
|
||||||
// For now 32-bit only.
|
if (VT != MVT::i32 && VT != MVT::i16 && VT != MVT::i8 && VT != MVT::i1)
|
||||||
if (VT != MVT::i32) return false;
|
return false;
|
||||||
|
|
||||||
unsigned DestReg = createResultReg(TLI.getRegClassFor(VT));
|
|
||||||
|
|
||||||
// If we can do this in a single instruction without a constant pool entry
|
// If we can do this in a single instruction without a constant pool entry
|
||||||
// do so now.
|
// do so now.
|
||||||
const ConstantInt *CI = cast<ConstantInt>(C);
|
const ConstantInt *CI = cast<ConstantInt>(C);
|
||||||
if (Subtarget->hasV6T2Ops() && isUInt<16>(CI->getSExtValue())) {
|
if (Subtarget->hasV6T2Ops() && isUInt<16>(CI->getSExtValue())) {
|
||||||
unsigned Opc = isThumb ? ARM::t2MOVi16 : ARM::MOVi16;
|
unsigned Opc = isThumb ? ARM::t2MOVi16 : ARM::MOVi16;
|
||||||
|
unsigned ImmReg = createResultReg(TLI.getRegClassFor(VT));
|
||||||
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
|
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
|
||||||
TII.get(Opc), DestReg)
|
TII.get(Opc), ImmReg)
|
||||||
.addImm(CI->getSExtValue()));
|
.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.
|
// MachineConstantPool wants an explicit alignment.
|
||||||
unsigned Align = TD.getPrefTypeAlignment(C->getType());
|
unsigned Align = TD.getPrefTypeAlignment(C->getType());
|
||||||
if (Align == 0) {
|
if (Align == 0) {
|
||||||
|
|
Loading…
Reference in New Issue