Skip to content

Commit 160398a

Browse files
lei137aokblast
authored andcommitted
[PowerPC] Implement Context Switch Instr mtlpl (llvm#160593)
Add new instruction `mtlpl`.
1 parent d21cc86 commit 160398a

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

llvm/lib/Target/PowerPC/PPCInstrFuture.td

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,22 @@ class XX3Form_XTAB6<bits<6> opcode, bits<8> xo, dag OOL, dag IOL, string asmstr,
194194
let Inst{31} = XT{5};
195195
}
196196

197+
class XForm_RBS5<bits<6> opCode, bits<10> xo, dag OOL, dag IOL, string asmstr,
198+
InstrItinClass itin, list<dag> pattern>
199+
: I<opCode, OOL, IOL, asmstr, itin> {
200+
201+
bits<5> RB;
202+
bits<5> RS;
203+
204+
let Pattern = pattern;
205+
206+
let Inst{6...10} = RS;
207+
let Inst{11...15} = 0;
208+
let Inst{16...20} = RB;
209+
let Inst{21...30} = xo;
210+
let Inst{31} = 0;
211+
}
212+
197213
class XX3Form_XTAB6_S<bits<5> xo, dag OOL, dag IOL, string asmstr,
198214
list<dag> pattern>
199215
: I<59, OOL, IOL, asmstr, NoItinerary> {
@@ -317,12 +333,16 @@ let Predicates = [IsISAFuture] in {
317333
def TLBIEIO
318334
: XForm_RSB5_UIMM2<31, 18, (outs), (ins g8rc:$RB, g8rc:$RS, u2imm:$RIC),
319335
"tlbieio $RB, $RS, $RIC", []>;
336+
def MTLPL : XForm_RBS5<31, 275, (outs), (ins gprc:$RB, gprc:$RS),
337+
"mtlpl $RB, $RS", IIC_SprMTSPR, []>;
320338
let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
321339
def TLBIEP8
322340
: XForm_RSB5_UIMM2_2UIMM1<31, 50, (outs),
323341
(ins g8rc:$RB, g8rc:$RS, u2imm:$RIC,
324342
u1imm:$PRS, u1imm:$R),
325343
"tlbiep $RB, $RS, $RIC, $PRS, $R", []>;
344+
def MTLPL8 : XForm_RBS5<31, 275, (outs), (ins g8rc:$RB, g8rc:$RS),
345+
"mtlpl $RB, $RS", IIC_SprMTSPR, []>, isPPC64;
326346
}
327347
}
328348

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@
286286
#CHECK: xvmulhuh 4, 5, 7
287287
0xf0,0x85,0x3b,0xd0
288288

289+
#CHECK: mtlpl 3, 4
290+
0x7c,0x80,0x1a,0x26
291+
289292
#CHECK: xxmulmul 8, 3, 4, 2
290293
0xed,0x03,0x22,0x08
291294

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@
280280
#CHECK: xvmulhuh 4, 5, 7
281281
0xd0,0x3b,0x85,0xf0
282282

283+
#CHECK: mtlpl 3, 4
284+
0x26,0x1a,0x80,0x7c
285+
283286
#CHECK: xxmulmul 8, 3, 4, 2
284287
0x08,0x22,0x03,0xed
285288

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@
403403
#CHECK-BE: xvmulhuh 4, 5, 7 # encoding: [0xf0,0x85,0x3b,0xd0]
404404
#CHECK-LE: xvmulhuh 4, 5, 7 # encoding: [0xd0,0x3b,0x85,0xf0]
405405

406+
mtlpl 3, 4
407+
#CHECK-BE: mtlpl 3, 4 # encoding: [0x7c,0x80,0x1a,0x26]
408+
#CHECK-LE: mtlpl 3, 4 # encoding: [0x26,0x1a,0x80,0x7c]
409+
406410
xxmulmul 8, 3, 4, 2
407411
#CHECK-BE: xxmulmul 8, 3, 4, 2 # encoding: [0xed,0x03,0x22,0x08]
408412
#CHECK-LE: xxmulmul 8, 3, 4, 2 # encoding: [0x08,0x22,0x03,0xed]

0 commit comments

Comments
 (0)