Skip to content

Commit

Permalink
cmd/asm, cmd/internal/obj/ppc64: add ISA 3.0 instructions
Browse files Browse the repository at this point in the history
This change adds new ppc64 instructions from the POWER9 ISA. This includes
compares, loads, maths, register moves and the new random number generator and
copy/paste facilities.

Change-Id: Ife3720b90f5af184ff115bbcdcbce5c1302d39b6
Reviewed-on: https://go-review.googlesource.com/53930
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
  • Loading branch information
ceseo authored and laboger committed Aug 29, 2017
1 parent 6959087 commit 526f342
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 32 deletions.
40 changes: 40 additions & 0 deletions src/cmd/asm/internal/asm/testdata/ppc64.s
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ label1:
// cmpb RA,RS,RB
CMPB R2,R2,R1

// CMPEQB RA,RB,BF produces
// cmpeqb BF,RA,RB
CMPEQB R1, R2, CR0

//
// rotate extended mnemonics map onto other shift instructions
//
Expand Down Expand Up @@ -707,13 +711,28 @@ label1:
DCBF (R1)
DCBF (R1+R2) // DCBF (R1)(R2*1)

// LDMX (RB)(RA*1),RT produces
// ldmx RT,RA,RB
LDMX (R2)(R1*1), R3

// Population count, X-form
// <MNEMONIC> RS,RA produces
// <mnemonic> RA,RS
POPCNTD R1,R2
POPCNTW R1,R2
POPCNTB R1,R2

// Random number generator, X-form
// DARN L,RT produces
// darn RT,L
DARN $1, R1

// Copy/Paste facility
// <MNEMONIC> RB,RA produces
// <mnemonic> RA,RB
COPY R2,R1
PASTECC R2,R1

// VMX instructions

// Described as:
Expand Down Expand Up @@ -788,6 +807,11 @@ label1:
VPMSUMW V2, V3, V1
VPMSUMD V2, V3, V1

// Vector multiply-sum, VA-form
// <MNEMONIC> VRA, VRB, VRC, VRT produces
// <mnemonic> VRT, VRA, VRB, VRC
VMSUMUDM V4, V3, V2, V1

// Vector SUB, VX-form
// <MNEMONIC> VRA,VRB,VRT produces
// <mnemonic> VRT,VRA,VRB
Expand Down Expand Up @@ -885,6 +909,8 @@ label1:
VCMPGTSWCC V3, V2, V1
VCMPGTSD V3, V2, V1
VCMPGTSDCC V3, V2, V1
VCMPNEZB V3, V2, V1
VCMPNEZBCC V3, V2, V1

// Vector permute, VA-form
// <MNEMONIC> VRA,VRB,VRC,VRT produces
Expand Down Expand Up @@ -958,13 +984,16 @@ label1:
// <mnemonic> RA,XS
MFVSRD VS0, R1
MFVSRWZ VS33, R1
MFVSRLD VS63, R1

// VSX move to VSR, XX1-form
// <MNEMONIC> RA,XT produces
// <mnemonic> XT,RA
MTVSRD R1, VS0
MTVSRWA R1, VS31
MTVSRWZ R1, VS63
MTVSRDD R1, R2, VS0
MTVSRWS R1, VS32

// VSX AND, XX3-form
// <MNEMONIC> XA,XB,XT produces
Expand Down Expand Up @@ -1062,6 +1091,17 @@ label1:
XVCVUXDSP VS0,VS32
XVCVUXWSP VS0,VS32

// Multiply-Add High Doubleword
// <MNEMONIC> RA,RB,RC,RT produces
// <mnemonic> RT,RA,RB,RC
MADDHD R1,R2,R3,R4
MADDHDU R1,R2,R3,R4

// Add Extended using alternate carry bit
// ADDEX RA,RB,CY,RT produces
// addex RT, RA, RB, CY
ADDEX R1, R2, $0, R3

//
// NOP
//
Expand Down
15 changes: 15 additions & 0 deletions src/cmd/internal/obj/ppc64/a.out.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ const (
AADDZECC
AADDZEVCC
AADDZEV
AADDEX
AAND
AANDCC
AANDN
Expand All @@ -412,6 +413,7 @@ const (
ABVS // Unordered-set
ACMP
ACMPU
ACMPEQB
ACNTLZW
ACNTLZWCC
ACRAND
Expand Down Expand Up @@ -712,6 +714,13 @@ const (
APOPCNTD
APOPCNTW
APOPCNTB
ACOPY
APASTECC
ADARN
ALDMX
AMADDHD
AMADDHDU
AMADDLD

/* Vector */
ALV
Expand Down Expand Up @@ -781,6 +790,7 @@ const (
AVPMSUMH
AVPMSUMW
AVPMSUMD
AVMSUMUDM
AVR
AVRLB
AVRLH
Expand Down Expand Up @@ -842,6 +852,8 @@ const (
AVCMPGTSWCC
AVCMPGTSD
AVCMPGTSDCC
AVCMPNEZB
AVCMPNEZBCC
AVPERM
AVSEL
AVSPLT
Expand Down Expand Up @@ -885,12 +897,15 @@ const (
AMFFPRD
AMFVRD
AMFVSRWZ
AMFVSRLD
AMTVSR
AMTVSRD
AMTFPRD
AMTVRD
AMTVSRWA
AMTVSRWZ
AMTVSRDD
AMTVSRWS
AXXLAND
AXXLANDQ
AXXLANDC
Expand Down
15 changes: 15 additions & 0 deletions src/cmd/internal/obj/ppc64/anames.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var Anames = []string{
"ADDZECC",
"ADDZEVCC",
"ADDZEV",
"ADDEX",
"AND",
"ANDCC",
"ANDN",
Expand All @@ -42,6 +43,7 @@ var Anames = []string{
"BVS",
"CMP",
"CMPU",
"CMPEQB",
"CNTLZW",
"CNTLZWCC",
"CRAND",
Expand Down Expand Up @@ -329,6 +331,13 @@ var Anames = []string{
"POPCNTD",
"POPCNTW",
"POPCNTB",
"COPY",
"PASTECC",
"DARN",
"LDMX",
"MADDHD",
"MADDHDU",
"MADDLD",
"LV",
"LVEBX",
"LVEHX",
Expand Down Expand Up @@ -396,6 +405,7 @@ var Anames = []string{
"VPMSUMH",
"VPMSUMW",
"VPMSUMD",
"VMSUMUDM",
"VR",
"VRLB",
"VRLH",
Expand Down Expand Up @@ -457,6 +467,8 @@ var Anames = []string{
"VCMPGTSWCC",
"VCMPGTSD",
"VCMPGTSDCC",
"VCMPNEZB",
"VCMPNEZBCC",
"VPERM",
"VSEL",
"VSPLT",
Expand Down Expand Up @@ -498,12 +510,15 @@ var Anames = []string{
"MFFPRD",
"MFVRD",
"MFVSRWZ",
"MFVSRLD",
"MTVSR",
"MTVSRD",
"MTFPRD",
"MTVRD",
"MTVSRWA",
"MTVSRWZ",
"MTVSRDD",
"MTVSRWS",
"XXLAND",
"XXLANDQ",
"XXLANDC",
Expand Down
Loading

0 comments on commit 526f342

Please sign in to comment.