Skip to content

Commit

Permalink
cmd/compile/internal: intrinsify publicationBarrier on ppc64x
Browse files Browse the repository at this point in the history
This enables publicationBarrier to be used as an intrinsic
on ppc64le/ppc64.

A call to this appears in test/bench/go1 BinaryTree17

Change-Id: If53528a82de99688270473cbe23472f37046ad65
Reviewed-on: https://go-review.googlesource.com/c/go/+/404056
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Lynn Boger <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: David Chase <[email protected]>
  • Loading branch information
laboger committed May 5, 2022
1 parent 6269dc2 commit c9f67c2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cmd/compile/internal/ppc64/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,10 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p8 := s.Prog(obj.ANOP)
p6.To.SetTarget(p8)

case ssa.OpPPC64LoweredPubBarrier:
// LWSYNC
s.Prog(v.Op.Asm())

case ssa.OpPPC64LoweredGetClosurePtr:
// Closure pointer is R11 (already)
ssagen.CheckLoweredGetClosurePtr(v)
Expand Down
3 changes: 3 additions & 0 deletions src/cmd/compile/internal/ssa/gen/PPC64.rules
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@
// Write barrier.
(WB ...) => (LoweredWB ...)

// Publication barrier as intrinsic
(PubBarrier ...) => (LoweredPubBarrier ...)

(PanicBounds [kind] x y mem) && boundsABI(kind) == 0 => (LoweredPanicBoundsA [kind] x y mem)
(PanicBounds [kind] x y mem) && boundsABI(kind) == 1 => (LoweredPanicBoundsB [kind] x y mem)
(PanicBounds [kind] x y mem) && boundsABI(kind) == 2 => (LoweredPanicBoundsC [kind] x y mem)
Expand Down
1 change: 1 addition & 0 deletions src/cmd/compile/internal/ssa/gen/PPC64Ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ func init() {
// but may clobber anything else, including R31 (REGTMP).
{name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("R20"), buildReg("R21")}, clobbers: (callerSave &^ buildReg("R0 R3 R4 R5 R6 R7 R8 R9 R10 R14 R15 R16 R17 R20 R21 g")) | buildReg("R31")}, clobberFlags: true, aux: "Sym", symEffect: "None"},

{name: "LoweredPubBarrier", argLength: 1, asm: "LWSYNC", hasSideEffects: true}, // Do data barrier. arg0=memory
// There are three of these functions so that they can have three different register inputs.
// When we check 0 <= c <= cap (A), then 0 <= b <= c (B), then 0 <= a <= b (C), we want the
// default registers to match so we don't need to copy registers around unnecessarily.
Expand Down
8 changes: 8 additions & 0 deletions src/cmd/compile/internal/ssa/opGen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/cmd/compile/internal/ssa/rewritePPC64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssagen/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -3951,7 +3951,7 @@ func InitTables() {
s.vars[memVar] = s.newValue1(ssa.OpPubBarrier, types.TypeMem, s.mem())
return nil
},
sys.ARM64)
sys.ARM64, sys.PPC64)

/******** runtime/internal/sys ********/
addF("runtime/internal/sys", "Ctz32",
Expand Down

0 comments on commit c9f67c2

Please sign in to comment.