llvm.org GIT mirror llvm / 148692b
Fix for PR18921 (LDRD/STRD part):: Removed "GNU Assembler extension (compatibility)" definitions from ARMInstrInfo.td Fixed ARMAsmParser::ParseInstruction GNU compatability branch, so it also works for thumb mode from now. Added new tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205622 91177308-0d34-0410-b5e6-96231b3b80d8 Stepan Dyatkovskiy 6 years ago
6 changed file(s) with 77 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
22812281 def LDRD : AI3ld<0b1101, 0, (outs GPR:$Rt, GPR:$Rt2), (ins addrmode3:$addr),
22822282 LdMiscFrm, IIC_iLoad_d_r, "ldrd", "\t$Rt, $Rt2, $addr", []>,
22832283 Requires<[IsARM, HasV5TE]>;
2284
2285 // GNU Assembler extension (compatibility)
2286 let isAsmParserOnly = 1 in
2287 def LDRD_PAIR : AI3ld<0b1101, 0, (outs GPRPairOp:$Rt), (ins addrmode3:$addr),
2288 LdMiscFrm, IIC_iLoad_d_r, "ldrd", "\t$Rt, $addr", []>,
2289 Requires<[IsARM, HasV5TE]>;
22902284 }
22912285
22922286 def LDA : AIldracq<0b00, (outs GPR:$Rt), (ins addr_offset_none:$addr),
25562550 Requires<[IsARM, HasV5TE]> {
25572551 let Inst{21} = 0;
25582552 }
2559
2560 // GNU Assembler extension (compatibility)
2561 let isAsmParserOnly = 1 in
2562 def STRD_PAIR : AI3str<0b1111, (outs), (ins GPRPairOp:$Rt, addrmode3:$addr),
2563 StMiscFrm, IIC_iStore_d_r, "strd", "\t$Rt, $addr", []>,
2564 Requires<[IsARM, HasV5TE]> {
2565 let Inst{21} = 0;
2566 }
25672553 }
25682554
25692555 // Indexed stores
54035403 }
54045404
54055405 // GNU Assembler extension (compatibility)
5406 if ((Mnemonic == "ldrd" || Mnemonic == "strd") && !isThumb() &&
5407 Operands.size() == 4) {
5408 ARMOperand *Op = static_cast(Operands[2]);
5409 assert(Op->isReg() && "expected register argument");
5410
5411 unsigned SuperReg = MRI->getMatchingSuperReg(
5412 Op->getReg(), ARM::gsub_0, &MRI->getRegClass(ARM::GPRPairRegClassID));
5413
5414 assert(SuperReg && "expected register pair");
5415
5416 unsigned PairedReg = MRI->getSubReg(SuperReg, ARM::gsub_1);
5417
5418 Operands.insert(Operands.begin() + 3,
5419 ARMOperand::CreateReg(PairedReg, Op->getStartLoc(),
5420 Op->getEndLoc()));
5406 if ((Mnemonic == "ldrd" || Mnemonic == "strd")) {
5407 ARMOperand *Op2 = static_cast(Operands[2]);
5408 ARMOperand *Op3 = static_cast(Operands[3]);
5409 if (Op3->isMem()) {
5410 assert(Op2->isReg() && "expected register argument");
5411
5412 unsigned SuperReg = MRI->getMatchingSuperReg(
5413 Op2->getReg(), ARM::gsub_0, &MRI->getRegClass(ARM::GPRPairRegClassID));
5414
5415 assert(SuperReg && "expected register pair");
5416
5417 unsigned PairedReg = MRI->getSubReg(SuperReg, ARM::gsub_1);
5418
5419 Operands.insert(Operands.begin() + 3,
5420 ARMOperand::CreateReg(PairedReg,
5421 Op2->getStartLoc(),
5422 Op2->getEndLoc()));
5423 }
54215424 }
54225425
54235426 // FIXME: As said above, this is all a pretty gross hack. This instruction
0 @ RUN: not llvm-mc -triple=armv7-linux-gnueabi %s 2>&1 | FileCheck %s
1 .text
2 @ CHECK: error: instruction requires: thumb2
3 @ CHECK: ldrd r0, [r0, #512]
4 ldrd r0, [r0, #512]
5
6 @ CHECK: error: instruction requires: thumb2
7 @ CHECK: strd r0, [r0, #512]
8 strd r0, [r0, #512]
0 @ PR18921
1 @ RUN: llvm-mc -triple=armv7-linux-gnueabi -show-encoding < %s | FileCheck %s
2 .text
3
4 @ CHECK-NOT: .code 16
5
6
7 @ CHECK: ldrd r0, r1, [r10, #32]! @ encoding: [0xd0,0x02,0xea,0xe1]
8 @ CHECK: ldrd r0, r1, [r10], #32 @ encoding: [0xd0,0x02,0xca,0xe0]
9 @ CHECK: ldrd r0, r1, [r10, #32] @ encoding: [0xd0,0x02,0xca,0xe1]
10 ldrd r0, [r10, #32]!
11 ldrd r0, [r10], #32
12 ldrd r0, [r10, #32]
13
14 @ CHECK: strd r0, r1, [r10, #32]! @ encoding: [0xf0,0x02,0xea,0xe1]
15 @ CHECK: strd r0, r1, [r10], #32 @ encoding: [0xf0,0x02,0xca,0xe0]
16 @ CHECK: strd r0, r1, [r10, #32] @ encoding: [0xf0,0x02,0xca,0xe1]
17 strd r0, [r10, #32]!
18 strd r0, [r10], #32
19 strd r0, [r10, #32]
0 @ RUN: not llvm-mc -triple=armv7-linux-gnueabi %s 2>&1 | FileCheck %s
1 .text
2 .thumb
3 @ CHECK: error: invalid operand for instruction
4 @ CHECK: ldrd r12, [r0, #512]
5 ldrd r12, [r0, #512]
6
7 @ CHECK: error: invalid operand for instruction
8 @ CHECK: strd r12, [r0, #512]
9 strd r12, [r0, #512]
0 @ PR18921
1 @ RUN: llvm-mc -triple=armv7-linux-gnueabi -show-encoding < %s | FileCheck %s
2 .text
3 .thumb
4
5 @ CHECK: .code 16
6
7 @ CHECK: ldrd r0, r1, [r10, #512]! @ encoding: [0xfa,0xe9,0x80,0x01]
8 @ CHECK: ldrd r0, r1, [r10], #512 @ encoding: [0xfa,0xe8,0x80,0x01]
9 @ CHECK: ldrd r0, r1, [r10, #512] @ encoding: [0xda,0xe9,0x80,0x01]
10 ldrd r0, [r10, #512]!
11 ldrd r0, [r10], #512
12 ldrd r0, [r10, #512]
13
14 @ CHECK: strd r0, r1, [r10, #512]! @ encoding: [0xea,0xe9,0x80,0x01]
15 @ CHECK: strd r0, r1, [r10], #512 @ encoding: [0xea,0xe8,0x80,0x01]
16 @ CHECK: strd r0, r1, [r10, #512] @ encoding: [0xca,0xe9,0x80,0x01]
17 strd r0, [r10, #512]!
18 strd r0, [r10], #512
19 strd r0, [r10, #512]