Index: lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp =================================================================== --- lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp +++ lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp @@ -1190,6 +1190,29 @@ } 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_PASTEo); + TmpInst.addOperand(Inst.getOperand(0)); + TmpInst.addOperand(Inst.getOperand(1)); + TmpInst.addOperand(MCOperand::createImm(Opcode == PPC::CP_PASTEx ? 0 : 1)); + + Inst = TmpInst; + break; + } } } Index: lib/Target/PowerPC/PPCInstr64Bit.td =================================================================== --- lib/Target/PowerPC/PPCInstr64Bit.td +++ lib/Target/PowerPC/PPCInstr64Bit.td @@ -1246,3 +1246,20 @@ def : Pat<(atomic_store_64 ixaddr:$ptr, i64:$val), (STD g8rc:$val, memrix:$ptr)>; def : Pat<(atomic_store_64 xaddr:$ptr, i64:$val), (STDX g8rc:$val, memrr:$ptr)>; + +class X_L1_RA5_RB5 opcode, bits<10> xo, string opc, RegisterOperand ty, + InstrItinClass itin, list pattern> + : X_L1_RS5_RS5; + +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_PASTE8o : X_L1_RA5_RB5<31, 902, "paste.", g8rc, IIC_LdStPASTE, []>,isDOT; +} + +// SLB Invalidate Entry Global +def SLBIEG : XForm_26<31, 466, (outs), (ins gprc:$RS, gprc:$RB), + "slbieg $RS, $RB", IIC_SprSLBIEG, []>; +// SLB Synchronize +def SLBSYNC : XForm_0<31, 338, (outs), (ins), "slbsync", IIC_SprSLBSYNC, []>; Index: lib/Target/PowerPC/PPCInstrFormats.td =================================================================== --- lib/Target/PowerPC/PPCInstrFormats.td +++ lib/Target/PowerPC/PPCInstrFormats.td @@ -754,6 +754,17 @@ let A = xo2; } +// [PO /// L RA RB XO /] +class X_L1_RS5_RS5 opcode, bits<10> xo, dag OOL, dag IOL, + string asmstr, InstrItinClass itin, list pattern> + : XForm_16 { + let BF = 0; + let Pattern = pattern; + + bit RC = 0; + let Inst{31} = RC; +} + // XX*-Form (VSX) class XX1Form opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list pattern> Index: lib/Target/PowerPC/PPCInstrInfo.td =================================================================== --- lib/Target/PowerPC/PPCInstrInfo.td +++ lib/Target/PowerPC/PPCInstrInfo.td @@ -4138,3 +4138,29 @@ def : Pat<(atomic_store_8 xaddr:$ptr, i32:$val), (STBX gprc:$val, memrr:$ptr)>; def : Pat<(atomic_store_16 xaddr:$ptr, i32:$val), (STHX gprc:$val, memrr:$ptr)>; def : Pat<(atomic_store_32 xaddr:$ptr, i32:$val), (STWX gprc:$val, memrr:$ptr)>; + +// Copy-Paste Facility +// 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, []>; + +let mayStore = 1, Defs = [CR0] in +def CP_PASTEo : X_L1_RA5_RB5<31, 902, "paste.", gprc, IIC_LdStPASTE, []>, isDOT; + +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, []>; + +// Message Synchronize +def MSGSYNC : XForm_0<31, 886, (outs), (ins), "msgsync", IIC_SprMSGSYNC, []>; + +// Power-Saving Mode Instruction: +def STOP : XForm_0<19, 370, (outs), (ins), "stop", IIC_SprSTOP, []>; Index: lib/Target/PowerPC/PPCSchedule.td =================================================================== --- lib/Target/PowerPC/PPCSchedule.td +++ lib/Target/PowerPC/PPCSchedule.td @@ -70,6 +70,8 @@ def IIC_LdStSTVEBX : InstrItinClass; def IIC_LdStSTWCX : InstrItinClass; def IIC_LdStSync : InstrItinClass; +def IIC_LdStCOPY : InstrItinClass; +def IIC_LdStPASTE : InstrItinClass; def IIC_SprISYNC : InstrItinClass; def IIC_SprMFSR : InstrItinClass; def IIC_SprMTMSR : InstrItinClass; @@ -104,12 +106,17 @@ def IIC_SprMTMSRD : InstrItinClass; def IIC_SprSLIE : InstrItinClass; def IIC_SprSLBIE : InstrItinClass; +def IIC_SprSLBIEG : InstrItinClass; def IIC_SprSLBMTE : InstrItinClass; def IIC_SprSLBMFEE : InstrItinClass; def IIC_SprSLBIA : InstrItinClass; +def IIC_SprSLBSYNC : InstrItinClass; def IIC_SprTLBIA : InstrItinClass; def IIC_SprTLBIEL : InstrItinClass; def IIC_SprTLBIE : InstrItinClass; +def IIC_SprABORT : InstrItinClass; +def IIC_SprMSGSYNC : InstrItinClass; +def IIC_SprSTOP : InstrItinClass; //===----------------------------------------------------------------------===// // Processor instruction itineraries. Index: lib/Target/PowerPC/README_P9.txt =================================================================== --- lib/Target/PowerPC/README_P9.txt +++ lib/Target/PowerPC/README_P9.txt @@ -116,3 +116,19 @@ . Provide builtin? (set f128:$vT, (int_ppc_vsx_xsrqpxp f128:$vB)) +Fixed Point Facility: + +- Copy-Paste Facility: copy copy_first cp_abort paste paste. paste_last + . Use instrinstics: + (int_ppc_copy_first i32:$rA, i32:$rB) + (int_ppc_copy i32:$rA, i32:$rB) + + (int_ppc_paste i32:$rA, i32:$rB) + (int_ppc_paste_last i32:$rA, i32:$rB) + + (int_cp_abort) + +- Message Synchronize: msgsync +- SLB*: slbieg slbsync +- stop + . No instrinstics Index: test/MC/Disassembler/PowerPC/ppc64-encoding.txt =================================================================== --- test/MC/Disassembler/PowerPC/ppc64-encoding.txt +++ test/MC/Disassembler/PowerPC/ppc64-encoding.txt @@ -662,3 +662,24 @@ 0x7d 0x40 0x61 0xe4 # CHECK: mfsrin 10, 12 0x7d 0x40 0x65 0x26 + +# CHECK: copy 2, 19, 1 +0x7c 0x22 0x9e 0x0c + +# CHECK: paste 17, 1, 1 +0x7c 0x31 0x0f 0x0c + +# CHECK: cp_abort +0x7c 0x00 0x06 0x8c + +# CHECK: msgsync +0x7c 0x00 0x06 0xec + +# CHECK: slbieg 6, 21 +0x7c 0xc0 0xab 0xa4 + +# CHECK: slbsync +0x7c 0x00 0x02 0xa4 + +# CHECK: stop +0x4c 0x00 0x02 0xe4 Index: test/MC/PowerPC/ppc64-encoding-ext.s =================================================================== --- test/MC/PowerPC/ppc64-encoding-ext.s +++ test/MC/PowerPC/ppc64-encoding-ext.s @@ -3666,3 +3666,16 @@ # CHECK-LE: attn # encoding: [0x00,0x02,0x00,0x00] 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] + 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 Index: test/MC/PowerPC/ppc64-encoding.s =================================================================== --- test/MC/PowerPC/ppc64-encoding.s +++ test/MC/PowerPC/ppc64-encoding.s @@ -848,3 +848,34 @@ # CHECK-BE: mfsrin 10, 12 # encoding: [0x7d,0x40,0x65,0x26] # CHECK-LE: mfsrin 10, 12 # encoding: [0x26,0x65,0x40,0x7d] 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 + +# Message Synchronize +# CHECK-BE: msgsync # encoding: [0x7c,0x00,0x06,0xec] +# CHECK-LE: msgsync # encoding: [0xec,0x06,0x00,0x7c] + msgsync + +# SLB Invalidate Entry Global +# CHECK-BE: slbieg 6, 21 # encoding: [0x7c,0xc0,0xab,0xa4] +# CHECK-LE: slbieg 6, 21 # encoding: [0xa4,0xab,0xc0,0x7c] + slbieg 6, 21 + +# SLB Synchronize +# CHECK-BE: slbsync # encoding: [0x7c,0x00,0x02,0xa4] +# CHECK-LE: slbsync # encoding: [0xa4,0x02,0x00,0x7c] + slbsync + +# Power-Saving Mode Instruction +# CHECK-BE: stop # encoding: [0x4c,0x00,0x02,0xe4] +# CHECK-LE: stop # encoding: [0xe4,0x02,0x00,0x4c] + stop