diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 11b0454802c..d4ee7c0c117 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -651,12 +651,12 @@ def t2STRB_POST : T2Iidxldst<(outs GPR:$base_wb), let mayLoad = 1 in def t2LDM : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops), - IIC_iLoad, "ldm${addr:submode}${p} $addr, $dst1", []>; + IIC_iLoad, "ldm${addr:submode}${p}${addr:wide} $addr, $dst1", []>; let mayStore = 1 in def t2STM : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$src1, variable_ops), - IIC_iStore, "stm${addr:submode}${p} $addr, $src1", []>; + IIC_iStore, "stm${addr:submode}${p}${addr:wide} $addr, $src1", []>; //===----------------------------------------------------------------------===// // Move Instructions. @@ -1072,7 +1072,7 @@ let isCall = 1, let isReturn = 1, isTerminator = 1, mayLoad = 1 in def t2LDM_RET : T2XI<(outs), (ins addrmode4:$addr, pred:$p, reglist:$dst1, variable_ops), - IIC_iLoad, "ldm${addr:submode}${p} $addr, $dst1", + IIC_iLoad, "ldm${addr:submode}${p}${addr:wide} $addr, $dst1", []>; let isBranch = 1, isTerminator = 1, isBarrier = 1 in { diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 7b19969cfb7..3bbb3b9d464 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -599,6 +599,10 @@ void ARMAsmPrinter::printAddrMode4Operand(const MachineInstr *MI, int Op, O << ARM_AM::getAMSubModeAltStr(Mode, isLDM); } else O << ARM_AM::getAMSubModeStr(Mode); + } else if (Modifier && strcmp(Modifier, "wide") == 0) { + ARM_AM::AMSubMode Mode = ARM_AM::getAM4SubMode(MO2.getImm()); + if (Mode == ARM_AM::ia) + O << ".w"; } else { printOperand(MI, Op); if (ARM_AM::getAM4WBFlag(MO2.getImm())) diff --git a/test/CodeGen/Thumb2/thumb2-ldm.ll b/test/CodeGen/Thumb2/thumb2-ldm.ll index c3e3bf6b3b5..932ec7527af 100644 --- a/test/CodeGen/Thumb2/thumb2-ldm.ll +++ b/test/CodeGen/Thumb2/thumb2-ldm.ll @@ -5,7 +5,7 @@ define i32 @t1() { ; CHECK: t1: ; CHECK: stmfd sp!, {r7, lr} -; CHECK: ldmfd sp!, {r7, pc} +; CHECK: ldmfd.w sp!, {r7, pc} %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 0) ; [#uses=1] %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 1) ; [#uses=1] %tmp4 = tail call i32 @f1( i32 %tmp, i32 %tmp3 ) ; [#uses=1] @@ -15,8 +15,8 @@ define i32 @t1() { define i32 @t2() { ; CHECK: t2: ; CHECK: stmfd sp!, {r7, lr} -; CHECK: ldmia -; CHECK: ldmfd sp!, {r7, pc} +; CHECK: ldmia.w +; CHECK: ldmfd.w sp!, {r7, pc} %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 2) ; [#uses=1] %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 3) ; [#uses=1] %tmp5 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 4) ; [#uses=1] @@ -27,7 +27,7 @@ define i32 @t2() { define i32 @t3() { ; CHECK: t3: ; CHECK: stmfd sp!, {r7, lr} -; CHECK: ldmfd sp!, {r7, pc} +; CHECK: ldmfd.w sp!, {r7, pc} %tmp = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 1) ; [#uses=1] %tmp3 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 2) ; [#uses=1] %tmp5 = load i32* getelementptr ([0 x i32]* @X, i32 0, i32 3) ; [#uses=1]