[PowerPC] Update Copy/Paste encodings according to ISA3.1

Copy-paste P9 insns were added back in 2016,
however, looks like the opcodes has changed in ISA3.1.

Reviewed By: #powerpc, nemanjai

Differential Revision: https://reviews.llvm.org/D97416
This commit is contained in:
Jinsong Ji 2021-03-05 14:25:35 +00:00
parent 65600cb2a7
commit cc21de6789
7 changed files with 39 additions and 61 deletions

View File

@ -1132,29 +1132,6 @@ void PPCAsmParser::ProcessInstruction(MCInst &Inst,
}
break;
}
case PPC::CP_COPYx:
case PPC::CP_COPY_FIRST: {
MCInst TmpInst;
TmpInst.setOpcode(PPC::CP_COPY);
TmpInst.addOperand(Inst.getOperand(0));
TmpInst.addOperand(Inst.getOperand(1));
TmpInst.addOperand(MCOperand::createImm(Opcode == PPC::CP_COPYx ? 0 : 1));
Inst = TmpInst;
break;
}
case PPC::CP_PASTEx :
case PPC::CP_PASTE_LAST: {
MCInst TmpInst;
TmpInst.setOpcode(Opcode == PPC::CP_PASTEx ? PPC::CP_PASTE
: PPC::CP_PASTE_rec);
TmpInst.addOperand(Inst.getOperand(0));
TmpInst.addOperand(Inst.getOperand(1));
TmpInst.addOperand(MCOperand::createImm(Opcode == PPC::CP_PASTEx ? 0 : 1));
Inst = TmpInst;
break;
}
}
}

View File

@ -733,7 +733,6 @@ def : InstRW<[P9_LS_4C, IP_AGEN_1C, DISP_1C],
(instregex "DCBZ(L)?(EP)?$"),
(instregex "DCBTST(EP)?$"),
(instregex "CP_COPY(8)?$"),
(instregex "CP_PASTE(8)?$"),
(instregex "ICBI(EP)?$"),
(instregex "ICBT(LS)?$"),
(instregex "LBARX(L)?$"),

View File

@ -1617,14 +1617,20 @@ def : Pat<(int_ppc_darn32), (EXTRACT_SUBREG (DARN 0), sub_32)>;
def : Pat<(int_ppc_darn), (DARN 1)>;
def : Pat<(int_ppc_darnraw), (DARN 2)>;
class X_RA5_RB5<bits<6> opcode, bits<10> xo, string opc, RegisterOperand ty,
InstrItinClass itin, list<dag> pattern>
: X_L1_RS5_RS5<opcode, xo, (outs), (ins ty:$rA, ty:$rB, u1imm:$L),
!strconcat(opc, " $rA, $rB"), itin, pattern>{
let L = 1;
}
class X_L1_RA5_RB5<bits<6> opcode, bits<10> xo, string opc, RegisterOperand ty,
InstrItinClass itin, list<dag> pattern>
: X_L1_RS5_RS5<opcode, xo, (outs), (ins ty:$rA, ty:$rB, u1imm:$L),
!strconcat(opc, " $rA, $rB, $L"), itin, pattern>;
let Interpretation64Bit = 1, isCodeGenOnly = 1 in {
def CP_COPY8 : X_L1_RA5_RB5<31, 774, "copy" , g8rc, IIC_LdStCOPY, []>;
def CP_PASTE8 : X_L1_RA5_RB5<31, 902, "paste" , g8rc, IIC_LdStPASTE, []>;
def CP_COPY8 : X_RA5_RB5<31, 774, "copy" , g8rc, IIC_LdStCOPY, []>;
def CP_PASTE8_rec : X_L1_RA5_RB5<31, 902, "paste.", g8rc, IIC_LdStPASTE, []>,isRecordForm;
}

View File

@ -5156,21 +5156,13 @@ let Predicates = [IsISA3_0] in {
// We prefix 'CP' to COPY due to name conflict in Target.td. We also prefix to
// PASTE for naming consistency.
let mayLoad = 1 in
def CP_COPY : X_L1_RA5_RB5<31, 774, "copy" , gprc, IIC_LdStCOPY, []>;
let mayStore = 1 in
def CP_PASTE : X_L1_RA5_RB5<31, 902, "paste" , gprc, IIC_LdStPASTE, []>;
def CP_COPY : X_RA5_RB5<31, 774, "copy" , gprc, IIC_LdStCOPY, []>;
let mayStore = 1, Defs = [CR0] in
def CP_PASTE_rec : X_L1_RA5_RB5<31, 902, "paste.", gprc, IIC_LdStPASTE, []>, isRecordForm;
def CP_COPYx : PPCAsmPseudo<"copy $rA, $rB" , (ins gprc:$rA, gprc:$rB)>;
def CP_PASTEx : PPCAsmPseudo<"paste $rA, $rB", (ins gprc:$rA, gprc:$rB)>;
def CP_COPY_FIRST : PPCAsmPseudo<"copy_first $rA, $rB",
(ins gprc:$rA, gprc:$rB)>;
def CP_PASTE_LAST : PPCAsmPseudo<"paste_last $rA, $rB",
(ins gprc:$rA, gprc:$rB)>;
def CP_ABORT : XForm_0<31, 838, (outs), (ins), "cp_abort", IIC_SprABORT, []>;
def : InstAlias<"paste. $RA, $RB", (CP_PASTE_rec gprc:$RA, gprc:$RB, 1)>;
def CP_ABORT : XForm_0<31, 838, (outs), (ins), "cpabort", IIC_SprABORT, []>;
// Message Synchronize
def MSGSYNC : XForm_0<31, 886, (outs), (ins), "msgsync", IIC_SprMSGSYNC, []>;

View File

@ -856,13 +856,16 @@
# CHECK: mfsrin 10, 12
0x7d 0x40 0x65 0x26
# CHECK: copy 2, 19, 1
# CHECK: copy 2, 19
0x7c 0x22 0x9e 0x0c
# CHECK: paste 17, 1, 1
0x7c 0x31 0x0f 0x0c
# CHECK: paste. 17, 1, 0
0x7c 0x11 0x0f 0x0d
# CHECK: cp_abort
# CHECK: paste. 17, 1
0x7c 0x31 0x0f 0x0d
# CHECK: cpabort
0x7c 0x00 0x06 0x8c
# CHECK: msgsync

View File

@ -3701,15 +3701,15 @@
attn
# Copy-Paste Facility (Extended Mnemonics):
# CHECK-BE: copy 2, 19, 0 # encoding: [0x7c,0x02,0x9e,0x0c]
# CHECK-LE: copy 2, 19, 0 # encoding: [0x0c,0x9e,0x02,0x7c]
# CHECK-BE: copy 2, 19 # encoding: [0x7c,0x22,0x9e,0x0c]
# CHECK-LE: copy 2, 19 # encoding: [0x0c,0x9e,0x22,0x7c]
copy 2, 19
# CHECK-BE: copy 2, 19, 1 # encoding: [0x7c,0x22,0x9e,0x0c]
# CHECK-LE: copy 2, 19, 1 # encoding: [0x0c,0x9e,0x22,0x7c]
copy_first 2, 19
# CHECK-BE: paste 17, 1, 0 # encoding: [0x7c,0x11,0x0f,0x0c]
# CHECK-LE: paste 17, 1, 0 # encoding: [0x0c,0x0f,0x11,0x7c]
paste 17, 1
# CHECK-BE: paste. 17, 1, 1 # encoding: [0x7c,0x31,0x0f,0x0d]
# CHECK-LE: paste. 17, 1, 1 # encoding: [0x0d,0x0f,0x31,0x7c]
paste_last 17, 1
# CHECK-BE: paste. 17, 1, 0 # encoding: [0x7c,0x11,0x0f,0x0d]
# CHECK-LE: paste. 17, 1, 0 # encoding: [0x0d,0x0f,0x11,0x7c]
paste. 17, 1, 0
# CHECK-BE: paste. 17, 1 # encoding: [0x7c,0x31,0x0f,0x0d]
# CHECK-LE: paste. 17, 1 # encoding: [0x0d,0x0f,0x31,0x7c]
paste. 17, 1, 1
# CHECK-BE: paste. 17, 1 # encoding: [0x7c,0x31,0x0f,0x0d]
# CHECK-LE: paste. 17, 1 # encoding: [0x0d,0x0f,0x31,0x7c]
paste. 17, 1

View File

@ -1053,15 +1053,16 @@
mfsrin %r10,%r12
# Copy-Paste Facility
# CHECK-BE: copy 2, 19, 1 # encoding: [0x7c,0x22,0x9e,0x0c]
# CHECK-LE: copy 2, 19, 1 # encoding: [0x0c,0x9e,0x22,0x7c]
copy 2, 19, 1
# CHECK-BE: paste 17, 1, 1 # encoding: [0x7c,0x31,0x0f,0x0c]
# CHECK-LE: paste 17, 1, 1 # encoding: [0x0c,0x0f,0x31,0x7c]
paste 17, 1, 1
# CHECK-BE: cp_abort # encoding: [0x7c,0x00,0x06,0x8c]
# CHECK-LE: cp_abort # encoding: [0x8c,0x06,0x00,0x7c]
cp_abort
# CHECK-BE: copy 2, 19 # encoding: [0x7c,0x22,0x9e,0x0c]
# CHECK-LE: copy 2, 19 # encoding: [0x0c,0x9e,0x22,0x7c]
copy 2, 19
# CHECK-BE: paste. 17, 1 # encoding: [0x7c,0x31,0x0f,0x0d]
# CHECK-LE: paste. 17, 1 # encoding: [0x0d,0x0f,0x31,0x7c]
paste. 17, 1, 1
# CHECK-BE: cpabort # encoding: [0x7c,0x00,0x06,0x8c]
# CHECK-LE: cpabort # encoding: [0x8c,0x06,0x00,0x7c]
cpabort
# Message Synchronize
# CHECK-BE: msgsync # encoding: [0x7c,0x00,0x06,0xec]