This enables publicationBarrier to be used as an intrinsic on mips64x.
Change-Id: I4030ea65086c37ee1dcc1675d0d5d40ef8683851
Reviewed-on: https://go-review.googlesource.com/c/go/+/674855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
p := s.Prog(obj.AGETCALLERPC)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
+ case ssa.OpMIPS64LoweredPubBarrier:
+ // SYNC
+ s.Prog(v.Op.Asm())
case ssa.OpClobber, ssa.OpClobberReg:
// TODO: implement for clobberdead experiment. Nop is ok for now.
default:
// 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)
// Returns a pointer to a write barrier buffer in R25.
{name: "LoweredWB", argLength: 1, reg: regInfo{clobbers: (callerSave &^ gpg) | buildReg("R31"), outputs: []regMask{buildReg("R25")}}, clobberFlags: true, aux: "Int64"},
+ // Do data barrier. arg0=memorys
+ {name: "LoweredPubBarrier", argLength: 1, asm: "SYNC", hasSideEffects: true},
+
// 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.
OpMIPS64LoweredGetCallerSP
OpMIPS64LoweredGetCallerPC
OpMIPS64LoweredWB
+ OpMIPS64LoweredPubBarrier
OpMIPS64LoweredPanicBoundsA
OpMIPS64LoweredPanicBoundsB
OpMIPS64LoweredPanicBoundsC
},
},
},
+ {
+ name: "LoweredPubBarrier",
+ argLen: 1,
+ hasSideEffects: true,
+ asm: mips.ASYNC,
+ reg: regInfo{},
+ },
{
name: "LoweredPanicBoundsA",
auxType: auxInt64,
return true
case OpPanicBounds:
return rewriteValueMIPS64_OpPanicBounds(v)
+ case OpPubBarrier:
+ v.Op = OpMIPS64LoweredPubBarrier
+ return true
case OpRotateLeft16:
return rewriteValueMIPS64_OpRotateLeft16(v)
case OpRotateLeft32:
s.vars[memVar] = s.newValue1(ssa.OpPubBarrier, types.TypeMem, s.mem())
return nil
},
- sys.ARM64, sys.Loong64, sys.PPC64, sys.RISCV64)
+ sys.ARM64, sys.Loong64, sys.MIPS64, sys.PPC64, sys.RISCV64)
/******** internal/runtime/sys ********/
add("internal/runtime/sys", "GetCallerPC",
{"mips64", "math/bits", "Sub"}: struct{}{},
{"mips64", "math/bits", "Sub64"}: struct{}{},
{"mips64", "runtime", "KeepAlive"}: struct{}{},
+ {"mips64", "runtime", "publicationBarrier"}: struct{}{},
{"mips64", "runtime", "slicebytetostringtmp"}: struct{}{},
{"mips64", "sync", "runtime_LoadAcquintptr"}: struct{}{},
{"mips64", "sync", "runtime_StoreReluintptr"}: struct{}{},
{"mips64le", "math/bits", "Sub"}: struct{}{},
{"mips64le", "math/bits", "Sub64"}: struct{}{},
{"mips64le", "runtime", "KeepAlive"}: struct{}{},
+ {"mips64le", "runtime", "publicationBarrier"}: struct{}{},
{"mips64le", "runtime", "slicebytetostringtmp"}: struct{}{},
{"mips64le", "sync", "runtime_LoadAcquintptr"}: struct{}{},
{"mips64le", "sync", "runtime_StoreReluintptr"}: struct{}{},