Skip to content

Commit f5e81ae

Browse files
author
Johnny Chen
committed
Added Thumb2 LDRD/STRD pre/post variants for disassembly only.
Plus fixed the encoding of t2LDRDpci such that P = 1 and W = 0 (offset mode). llvm-svn: 98217
1 parent 28492aa commit f5e81ae

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

llvm/lib/Target/ARM/ARMInstrThumb2.td

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ def t2addrmode_imm8s4 : Operand<i32>,
150150
let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm);
151151
}
152152

153+
def t2am_imm8s4_offset : Operand<i32> {
154+
let PrintMethod = "printT2AddrModeImm8s4OffsetOperand";
155+
}
156+
153157
// t2addrmode_so_reg := reg + (reg << imm2)
154158
def t2addrmode_so_reg : Operand<i32>,
155159
ComplexPattern<i32, 3, "SelectT2AddrModeSoReg", []> {
@@ -903,7 +907,7 @@ let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
903907
def t2LDRDi8 : T2Ii8s4<1, 0, 1, (outs GPR:$dst1, GPR:$dst2),
904908
(ins t2addrmode_imm8s4:$addr),
905909
IIC_iLoadi, "ldrd", "\t$dst1, $addr", []>;
906-
def t2LDRDpci : T2Ii8s4<?, ?, 1, (outs GPR:$dst1, GPR:$dst2),
910+
def t2LDRDpci : T2Ii8s4<1, 0, 1, (outs GPR:$dst1, GPR:$dst2),
907911
(ins i32imm:$addr), IIC_iLoadi,
908912
"ldrd", "\t$dst1, $addr", []> {
909913
let Inst{19-16} = 0b1111; // Rn
@@ -1105,7 +1109,24 @@ def t2STRT : T2IstT<0b10, "strt">;
11051109
def t2STRBT : T2IstT<0b00, "strbt">;
11061110
def t2STRHT : T2IstT<0b01, "strht">;
11071111

1108-
// FIXME: ldrd / strd pre / post variants
1112+
// ldrd / strd pre / post variants
1113+
// For disassembly only.
1114+
1115+
def t2LDRD_PRE : T2Ii8s4<1, 1, 1, (outs GPR:$dst1, GPR:$dst2),
1116+
(ins GPR:$base, t2am_imm8s4_offset:$imm), NoItinerary,
1117+
"ldrd", "\t$dst1, $dst2, [$base, $imm]!", []>;
1118+
1119+
def t2LDRD_POST : T2Ii8s4<0, 1, 1, (outs GPR:$dst1, GPR:$dst2),
1120+
(ins GPR:$base, t2am_imm8s4_offset:$imm), NoItinerary,
1121+
"ldrd", "\t$dst1, $dst2, [$base], $imm", []>;
1122+
1123+
def t2STRD_PRE : T2Ii8s4<1, 1, 0, (outs),
1124+
(ins GPR:$src1, GPR:$src2, GPR:$base, t2am_imm8s4_offset:$imm),
1125+
NoItinerary, "strd", "\t$src1, $src2, [$base, $imm]!", []>;
1126+
1127+
def t2STRD_POST : T2Ii8s4<0, 1, 0, (outs),
1128+
(ins GPR:$src1, GPR:$src2, GPR:$base, t2am_imm8s4_offset:$imm),
1129+
NoItinerary, "strd", "\t$src1, $src2, [$base], $imm", []>;
11091130

11101131
// T2Ipl (Preload Data/Instruction) signals the memory system of possible future
11111132
// data/instruction access. These are for disassembly only.

llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ namespace {
120120
void printT2AddrModeImm8Operand(const MachineInstr *MI, int OpNum);
121121
void printT2AddrModeImm8s4Operand(const MachineInstr *MI, int OpNum);
122122
void printT2AddrModeImm8OffsetOperand(const MachineInstr *MI, int OpNum);
123+
void printT2AddrModeImm8s4OffsetOperand(const MachineInstr *MI, int OpNum) {}
123124
void printT2AddrModeSoRegOperand(const MachineInstr *MI, int OpNum);
124125

125126
void printCPSOptionOperand(const MachineInstr *MI, int OpNum) {}

llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class ARMInstPrinter : public MCInstPrinter {
6868
void printT2AddrModeImm8Operand(const MCInst *MI, unsigned OpNum) {}
6969
void printT2AddrModeImm8s4Operand(const MCInst *MI, unsigned OpNum) {}
7070
void printT2AddrModeImm8OffsetOperand(const MCInst *MI, unsigned OpNum) {}
71+
void printT2AddrModeImm8s4OffsetOperand(const MCInst *MI, unsigned OpNum) {}
7172
void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum) {}
7273

7374
void printCPSOptionOperand(const MCInst *MI, unsigned OpNum) {}

0 commit comments

Comments
 (0)