Skip to content

Commit f4fa437

Browse files
lei137dvbuka
authored andcommitted
[PowerPC] Add Implementation and test for new eTCE instructions (llvm#164002)
Add implementation and encoding tests for: - tlbiep - tlbieio - tlbsyncio - ptesyncio
1 parent 2d23c19 commit f4fa437

File tree

5 files changed

+85
-5
lines changed

5 files changed

+85
-5
lines changed

llvm/lib/Target/PowerPC/PPCInstrFormats.td

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -850,24 +850,34 @@ class XForm_45<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
850850
let Inst{31} = 0;
851851
}
852852

853-
class XForm_RSB5_UIMM2_2UIMM1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
853+
class XForm_RSB5_UIMM2<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
854854
string asmstr, list<dag> pattern>
855855
: I<opcode, OOL, IOL, asmstr, NoItinerary> {
856856

857857
bits<5> RS;
858858
bits<5> RB;
859859
bits<2> RIC;
860-
bits<1> PRS;
861-
bits<1> R;
862860

863861
let Pattern = pattern;
864862

865863
let Inst{6...10} = RS;
864+
let Inst{11} = 0;
866865
let Inst{12...13} = RIC;
867-
let Inst{14} = PRS;
868-
let Inst{15} = R;
866+
let Inst{14...15} = 0;
869867
let Inst{16...20} = RB;
870868
let Inst{21...30} = xo;
869+
let Inst{31} = 0;
870+
}
871+
872+
class XForm_RSB5_UIMM2_2UIMM1<bits<6> opcode, bits<10> xo, dag OOL, dag IOL,
873+
string asmstr, list<dag> pattern>
874+
: XForm_RSB5_UIMM2<opcode, xo, OOL, IOL, asmstr, pattern> {
875+
876+
bits<1> PRS;
877+
bits<1> R;
878+
879+
let Inst{14} = PRS;
880+
let Inst{15} = R;
871881
}
872882

873883
class X_FRT5_XO2_XO3_XO10<bits<6> opcode, bits<2> xo1, bits<3> xo2, bits<10> xo,

llvm/lib/Target/PowerPC/PPCInstrFuture.td

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14+
class XForm_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
15+
list<dag> pattern> : I<opcode, OOL, IOL, asmstr, NoItinerary> {
16+
bits<5> RS;
17+
18+
let Pattern = pattern;
19+
20+
let Inst{6...10} = RS;
21+
let Inst{11...20} = 0;
22+
let Inst{21...30} = xo;
23+
let Inst{31} = 0;
24+
}
25+
1426
class XOForm_RTAB5_L1<bits<6> opcode, bits<9> xo, dag OOL, dag IOL,
1527
string asmstr, list<dag> pattern>
1628
: I<opcode, OOL, IOL, asmstr, NoItinerary> {
@@ -294,6 +306,24 @@ let Predicates = [IsISAFuture] in {
294306
defm SUBFUS : XOForm_RTAB5_L1r<31, 72, (outs g8rc:$RT),
295307
(ins g8rc:$RA, g8rc:$RB, u1imm:$L), "subfus",
296308
"$RT, $L, $RA, $RB", []>;
309+
def TLBSYNCIO
310+
: XForm_RS5<31, 564, (outs), (ins g8rc:$RS), "tlbsyncio $RS", []>;
311+
def PTESYNCIO
312+
: XForm_RS5<31, 596, (outs), (ins g8rc:$RS), "ptesyncio $RS", []>;
313+
def TLBIEP : XForm_RSB5_UIMM2_2UIMM1<31, 50, (outs),
314+
(ins gprc:$RB, gprc:$RS, u2imm:$RIC,
315+
u1imm:$PRS, u1imm:$R),
316+
"tlbiep $RB, $RS, $RIC, $PRS, $R", []>;
317+
def TLBIEIO
318+
: XForm_RSB5_UIMM2<31, 18, (outs), (ins g8rc:$RB, g8rc:$RS, u2imm:$RIC),
319+
"tlbieio $RB, $RS, $RIC", []>;
320+
let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
321+
def TLBIEP8
322+
: XForm_RSB5_UIMM2_2UIMM1<31, 50, (outs),
323+
(ins g8rc:$RB, g8rc:$RS, u2imm:$RIC,
324+
u1imm:$PRS, u1imm:$R),
325+
"tlbiep $RB, $RS, $RIC, $PRS, $R", []>;
326+
}
297327
}
298328

299329
let Predicates = [HasVSX, IsISAFuture] in {

llvm/test/MC/Disassembler/PowerPC/ppc-encoding-ISAFuture.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
# RUN: llvm-mc --disassemble %s -triple powerpc-unknown-aix-gnu \
88
# RUN: -mcpu=future | FileCheck %s
99

10+
#CHECK: tlbiep 8, 10, 2, 1, 0
11+
0x7d 0x4a 0x40 0x64
12+
13+
#CHECK: tlbieio 8, 10, 2
14+
0x7d 0x48 0x40 0x24
15+
16+
#CHECK: tlbsyncio 15
17+
0x7d 0xe0 0x04 0x68
18+
19+
#CHECK: ptesyncio 15
20+
0x7d 0xe0 0x04 0xa8
21+
1022
#CHECK: dmxxextfdmr512 2, 34, 1, 0
1123
0xf0 0x82 0x17 0x12
1224

llvm/test/MC/Disassembler/PowerPC/ppc64le-encoding-ISAFuture.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# RUN: llvm-mc --disassemble %s -triple powerpc64le-unknown-unknown \
22
# RUN: -mcpu=future | FileCheck %s
33

4+
#CHECK: tlbiep 8, 10, 2, 1, 0
5+
0x64 0x40 0x4a 0x7d
6+
7+
#CHECK: tlbieio 8, 10, 2
8+
0x24 0x40 0x48 0x7d
9+
10+
#CHECK: tlbsyncio 15
11+
0x68 0x04 0xe0 0x7d
12+
13+
#CHECK: ptesyncio 15
14+
0xa8 0x04 0xe0 0x7d
15+
416
#CHECK: dmxxextfdmr512 2, 34, 1, 0
517
0x12 0x17 0x82 0xf0
618

llvm/test/MC/PowerPC/ppc-encoding-ISAFuture.s

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
# RUN: llvm-mc -triple powerpc-unknown-aix-gnu --show-encoding %s | \
66
# RUN: FileCheck -check-prefix=CHECK-BE %s
77

8+
#CHECK-BE: tlbiep 8, 10, 2, 1, 0 # encoding: [0x7d,0x4a,0x40,0x64]
9+
#CHECK-LE: tlbiep 8, 10, 2, 1, 0 # encoding: [0x64,0x40,0x4a,0x7d]
10+
tlbiep 8, 10, 2, 1, 0
11+
12+
# CHECK-BE: tlbieio 8, 10, 2 # encoding: [0x7d,0x48,0x40,0x24]
13+
# CHECK-LE: tlbieio 8, 10, 2 # encoding: [0x24,0x40,0x48,0x7d]
14+
tlbieio 8, 10, 2
15+
16+
# CHECK-BE: tlbsyncio 15 # encoding: [0x7d,0xe0,0x04,0x68]
17+
# CHECK-LE: tlbsyncio 15 # encoding: [0x68,0x04,0xe0,0x7d]
18+
tlbsyncio 15
19+
20+
# CHECK-BE: ptesyncio 15 # encoding: [0x7d,0xe0,0x04,0xa8]
21+
# CHECK-LE: ptesyncio 15 # encoding: [0xa8,0x04,0xe0,0x7d]
22+
ptesyncio 15
23+
824
# CHECK-BE: dmxxextfdmr512 2, 34, 1, 0 # encoding: [0xf0,0x82,0x17,0x12]
925
# CHECK-LE: dmxxextfdmr512 2, 34, 1, 0 # encoding: [0x12,0x17,0x82,0xf0]
1026
dmxxextfdmr512 2, 34, 1, 0

0 commit comments

Comments
 (0)