diff options
author | Chuang-Yu Cheng <cycheng@multicorewareinc.com> | 2016-04-06 01:46:45 +0000 |
---|---|---|
committer | Chuang-Yu Cheng <cycheng@multicorewareinc.com> | 2016-04-06 01:46:45 +0000 |
commit | eaf4b3d75ca523b19b4da1a329775ae988633c07 (patch) | |
tree | 9bdea760473e82efca557257789ae7d44f4c8a52 | |
parent | 99abb2728b1fed706c892d93327ebb3bcc0c939c (diff) | |
download | bcm5719-llvm-eaf4b3d75ca523b19b4da1a329775ae988633c07.tar.gz bcm5719-llvm-eaf4b3d75ca523b19b4da1a329775ae988633c07.zip |
[Power9] Implement copy-paste, msgsync, slb, and stop instructions
This patch implements the following BookII and Book III instructions:
- copy copy_first cp_abort paste paste. paste_last
- msgsync
- slbieg slbsync
- stop
Total 10 instructions
Reviewers: nemanjai hfinkel tjablin amehsan kbarton
llvm-svn: 265504
-rw-r--r-- | llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp | 23 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstr64Bit.td | 21 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrFormats.td | 11 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrInfo.td | 30 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCSchedule.td | 7 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/README_P9.txt | 17 | ||||
-rw-r--r-- | llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt | 21 | ||||
-rw-r--r-- | llvm/test/MC/PowerPC/ppc64-encoding-ext.s | 13 | ||||
-rw-r--r-- | llvm/test/MC/PowerPC/ppc64-encoding.s | 31 |
9 files changed, 174 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp index 13d002517de..c35c2b1cf2f 100644 --- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp +++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp @@ -1199,6 +1199,29 @@ 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_PASTEo); + TmpInst.addOperand(Inst.getOperand(0)); + TmpInst.addOperand(Inst.getOperand(1)); + TmpInst.addOperand(MCOperand::createImm(Opcode == PPC::CP_PASTEx ? 0 : 1)); + + Inst = TmpInst; + break; + } } } diff --git a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td index f7a1cc3b9a1..a5b9ba3aa14 100644 --- a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td @@ -1260,3 +1260,24 @@ def : Pat<(atomic_load_64 xaddr:$src), (LDX memrr:$src)>; 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)>; + +let Predicates = [IsISA3_0] in { + +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_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, []>; + +} // IsISA3_0 diff --git a/llvm/lib/Target/PowerPC/PPCInstrFormats.td b/llvm/lib/Target/PowerPC/PPCInstrFormats.td index d5b76aea40e..9ab88241e6a 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrFormats.td +++ b/llvm/lib/Target/PowerPC/PPCInstrFormats.td @@ -814,6 +814,17 @@ class X_BF3<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, let FRB = 0; } +// [PO /// L RA RB XO /] +class X_L1_RS5_RS5<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, + string asmstr, InstrItinClass itin, list<dag> pattern> + : XForm_16<opcode, xo, OOL, IOL, asmstr, itin> { + let BF = 0; + let Pattern = pattern; + + bit RC = 0; + let Inst{31} = RC; +} + // XX*-Form (VSX) class XX1Form<bits<6> opcode, bits<10> xo, dag OOL, dag IOL, string asmstr, InstrItinClass itin, list<dag> pattern> diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td index c241b257fbb..4970e908e4d 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -4185,3 +4185,33 @@ def : Pat<(atomic_store_32 iaddr:$ptr, i32:$val), (STW gprc:$val, memri:$ptr)>; 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)>; + +let Predicates = [IsISA3_0] in { + +// 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, []>; + +} // IsISA3_0 diff --git a/llvm/lib/Target/PowerPC/PPCSchedule.td b/llvm/lib/Target/PowerPC/PPCSchedule.td index d0954a11cd6..b4d72eff2b8 100644 --- a/llvm/lib/Target/PowerPC/PPCSchedule.td +++ b/llvm/lib/Target/PowerPC/PPCSchedule.td @@ -70,6 +70,8 @@ def IIC_LdStSTFDU : InstrItinClass; 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_VecVSR : InstrItinClass; 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. diff --git a/llvm/lib/Target/PowerPC/README_P9.txt b/llvm/lib/Target/PowerPC/README_P9.txt index 1bf3a93d245..3fd4ab9fca6 100644 --- a/llvm/lib/Target/PowerPC/README_P9.txt +++ b/llvm/lib/Target/PowerPC/README_P9.txt @@ -573,3 +573,20 @@ Load Doubleword Monitored (ldmx): Move to CR from XER Extended (mcrxrx): - Is there a use for this in LLVM? + +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 diff --git a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt index aa2552ddac1..b18d056046e 100644 --- a/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt +++ b/llvm/test/MC/Disassembler/PowerPC/ppc64-encoding.txt @@ -669,3 +669,24 @@ # 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 diff --git a/llvm/test/MC/PowerPC/ppc64-encoding-ext.s b/llvm/test/MC/PowerPC/ppc64-encoding-ext.s index 143a30606f0..682a737547d 100644 --- a/llvm/test/MC/PowerPC/ppc64-encoding-ext.s +++ b/llvm/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 diff --git a/llvm/test/MC/PowerPC/ppc64-encoding.s b/llvm/test/MC/PowerPC/ppc64-encoding.s index 84f1812b56a..f809aa412eb 100644 --- a/llvm/test/MC/PowerPC/ppc64-encoding.s +++ b/llvm/test/MC/PowerPC/ppc64-encoding.s @@ -854,3 +854,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 |