llvm.org GIT mirror llvm / f671391
ARM push of a single register encodes as pre-indexed STR. Per the ARM ARM, a 'push' of a single register encodes as an STR, not an STM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137318 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 8 years ago
4 changed file(s) with 25 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
28782878 Inst = TmpInst;
28792879 }
28802880 break;
2881 case ARM::STMDB_UPD:
2882 // If this is a store of a single register via a 'push', then we should use
2883 // a pre-indexed STR instruction instead, per the ARM ARM.
2884 if (static_cast(Operands[0])->getToken() == "push" &&
2885 Inst.getNumOperands() == 5) {
2886 MCInst TmpInst;
2887 TmpInst.setOpcode(ARM::STR_PRE_IMM);
2888 TmpInst.addOperand(Inst.getOperand(0)); // Rn_wb
2889 TmpInst.addOperand(Inst.getOperand(4)); // Rt
2890 TmpInst.addOperand(Inst.getOperand(1)); // addrmode_imm12
2891 TmpInst.addOperand(MCOperand::CreateImm(-4));
2892 TmpInst.addOperand(Inst.getOperand(2)); // CondCode
2893 TmpInst.addOperand(Inst.getOperand(3));
2894 Inst = TmpInst;
2895 }
2896 break;
28812897 }
28822898 }
28832899
8585 O << ".w";
8686 O << '\t';
8787 printRegisterList(MI, 4, O);
88 return;
89 }
90 if (Opcode == ARM::STR_PRE_IMM && MI->getOperand(2).getReg() == ARM::SP &&
91 MI->getOperand(3).getImm() == -4) {
92 O << '\t' << "push";
93 printPredicateOperand(MI, 4, O);
94 O << "\t{" << getRegisterName(MI->getOperand(1).getReg()) << "}";
8895 return;
8996 }
9097
66
77 define i64 @t(i64 %a) nounwind readonly {
88 entry:
9 ; CHECK: str lr, [sp, #-4]!
9 ; CHECK: push {lr}
1010 ; CHECK: pop {lr}
1111 %0 = load i64** @b, align 4
1212 %1 = load i64* %0, align 4
10701070 push {r7}
10711071 push {r7, r8, r9, r10}
10721072
1073 @ FIXME: push of a single register should encode as "str r7, [sp, #-4]!"
1074 @ CHECK-FIXME: push {r7} @ encoding: [0x04,0x70,0x2d,0xe5]
1073 @ CHECK: push {r7} @ encoding: [0x04,0x70,0x2d,0xe5]
10751074 @ CHECK: push {r7, r8, r9, r10} @ encoding: [0x80,0x07,0x2d,0xe9]
10761075
10771076