Skip to content

Commit 53648ac

Browse files
committed
[PowerPC][MC] Recognize tlbilx and its mnemonics
This fixes issue 64080. tlbilx exists in ISA 2.07 Book III-E. Since contents of Book III-E were eliminated after ISA 3.0, tlbilx does not exist in ISA 3.0 and ISA 3.1. Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D156204
1 parent 1c10667 commit 53648ac

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

llvm/lib/Target/PowerPC/PPCInstrFormats.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ class XForm_tlb<bits<10> xo, dag OOL, dag IOL, string asmstr,
461461
let RST = 0;
462462
}
463463

464+
class XForm_tlbilx<bits<10> xo, dag OOL, dag IOL, string asmstr,
465+
InstrItinClass itin> : XForm_base_r3xo<31, xo, OOL, IOL, asmstr, itin, []> {
466+
bits<5> T;
467+
let RST = T;
468+
}
469+
464470
class XForm_attn<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr,
465471
InstrItinClass itin>
466472
: I<opcode, OOL, IOL, asmstr, itin> {

llvm/lib/Target/PowerPC/PPCInstrInfo.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4317,6 +4317,9 @@ def TLBSX : XForm_tlb<914, (outs), (ins gprc:$RA, gprc:$RB), "tlbsx $RA, $RB",
43174317
def TLBIVAX : XForm_tlb<786, (outs), (ins gprc:$RA, gprc:$RB), "tlbivax $RA, $RB",
43184318
IIC_LdStLoad>, Requires<[IsBookE]>;
43194319

4320+
def TLBILX : XForm_tlbilx<18, (outs), (ins u2imm:$T, gprc:$RA, gprc:$RB),
4321+
"tlbilx $T, $RA, $RB", IIC_LdStLoad>, Requires<[IsBookE]>;
4322+
43204323
def TLBRE : XForm_24_eieio<31, 946, (outs), (ins),
43214324
"tlbre", IIC_LdStLoad, []>, Requires<[IsBookE]>;
43224325

@@ -4680,6 +4683,12 @@ def : InstAlias<"tlbwehi $RS, $A", (TLBWE2 gprc:$RS, gprc:$A, 0)>,
46804683
def : InstAlias<"tlbwelo $RS, $A", (TLBWE2 gprc:$RS, gprc:$A, 1)>,
46814684
Requires<[IsPPC4xx]>;
46824685

4686+
def : InstAlias<"tlbilxlpid", (TLBILX 0, R0, R0)>, Requires<[IsBookE]>;
4687+
def : InstAlias<"tlbilxpid", (TLBILX 1, R0, R0)>, Requires<[IsBookE]>;
4688+
def : InstAlias<"tlbilxva $RA, $RB", (TLBILX 3, gprc:$RA, gprc:$RB)>,
4689+
Requires<[IsBookE]>;
4690+
def : InstAlias<"tlbilxva $RB", (TLBILX 3, R0, gprc:$RB)>, Requires<[IsBookE]>;
4691+
46834692
def LAx : PPCAsmPseudo<"la $rA, $addr", (ins gprc:$rA, memri:$addr)>;
46844693

46854694
def SUBI : PPCAsmPseudo<"subi $rA, $rB, $imm",

llvm/lib/Target/PowerPC/PPCScheduleP9.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def P9Model : SchedMachineModel {
4242
// Power 9, or MMA, or paired vector mem ops, or PC relative mem ops, or
4343
// instructions introduced after ISA 3.0.
4444
let UnsupportedFeatures = [HasSPE, PrefixInstrs, MMA,
45-
PairedVectorMemops,
45+
PairedVectorMemops, IsBookE,
4646
PCRelativeMemops, IsISA3_1, IsISAFuture];
4747
}
4848

llvm/test/MC/PowerPC/ppc64-encoding-bookIII.s

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,26 @@
170170
# CHECK-LE: tlbie 4 # encoding: [0x64,0x22,0x00,0x7c]
171171
tlbie %r4
172172

173+
# CHECK-BE: tlbilx 1, 4, 5 # encoding: [0x7c,0x24,0x28,0x24]
174+
# CHECK-LE: tlbilx 1, 4, 5 # encoding: [0x24,0x28,0x24,0x7c]
175+
tlbilx 1, %r4, %r5
176+
177+
# CHECK-BE: tlbilxlpid # encoding: [0x7c,0x00,0x00,0x24]
178+
# CHECK-LE: tlbilxlpid # encoding: [0x24,0x00,0x00,0x7c]
179+
tlbilxlpid
180+
181+
# CHECK-BE: tlbilxpid # encoding: [0x7c,0x20,0x00,0x24]
182+
# CHECK-LE: tlbilxpid # encoding: [0x24,0x00,0x20,0x7c]
183+
tlbilxpid
184+
185+
# CHECK-BE: tlbilxva 4, 5 # encoding: [0x7c,0x64,0x28,0x24]
186+
# CHECK-LE: tlbilxva 4, 5 # encoding: [0x24,0x28,0x64,0x7c]
187+
tlbilxva %r4, %r5
188+
189+
# CHECK-BE: tlbilxva 0, 5 # encoding: [0x7c,0x60,0x28,0x24]
190+
# CHECK-LE: tlbilxva 0, 5 # encoding: [0x24,0x28,0x60,0x7c]
191+
tlbilxva %r5
192+
173193
# CHECK-BE: rfi # encoding: [0x4c,0x00,0x00,0x64]
174194
# CHECK-LE: rfi # encoding: [0x64,0x00,0x00,0x4c]
175195
rfi

0 commit comments

Comments
 (0)