]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: inline atomics from runtime/internal/atomic on amd64
authorKeith Randall <khr@golang.org>
Tue, 23 Aug 2016 23:49:28 +0000 (16:49 -0700)
committerKeith Randall <khr@golang.org>
Thu, 25 Aug 2016 20:09:04 +0000 (20:09 +0000)
commit320ddcf8344beb1c322f3a7f0a251eea5e442a10
tree6401b5a28fd5beecec4d2d9518528bc3eb7fcd2c
parent71ab9fa312f8266379dbb358b9ee9303cde7bd6b
cmd/compile: inline atomics from runtime/internal/atomic on amd64

Inline atomic reads and writes on amd64.  There's no reason
to pay the overhead of a call for these.

To keep atomic loads from being reordered, we make them
return a <value,memory> tuple.

Change the meaning of resultInArg0 for tuple-generating ops
to mean the first part of the result tuple, not the second.
This means we can always put the store part of the tuple last,
matching how arguments are laid out.  This requires reordering
the outputs of add32carry and sub32carry and their descendents
in various architectures.

benchmark                    old ns/op     new ns/op     delta
BenchmarkAtomicLoad64-8      2.09          0.26          -87.56%
BenchmarkAtomicStore64-8     7.54          5.72          -24.14%

TBD (in a different CL): Cas, Or8, ...

Change-Id: I713ea88e7da3026c44ea5bdb56ed094b20bc5207
Reviewed-on: https://go-review.googlesource.com/27641
Reviewed-by: Cherry Zhang <cherryyz@google.com>
20 files changed:
src/cmd/compile/internal/amd64/ssa.go
src/cmd/compile/internal/arm/ssa.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/ssa/deadstore.go
src/cmd/compile/internal/ssa/gen/386Ops.go
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/gen/AMD64Ops.go
src/cmd/compile/internal/ssa/gen/ARMOps.go
src/cmd/compile/internal/ssa/gen/dec64.rules
src/cmd/compile/internal/ssa/gen/genericOps.go
src/cmd/compile/internal/ssa/gen/main.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/regalloc.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewritedec64.go
src/cmd/compile/internal/ssa/type.go
src/cmd/compile/internal/x86/ssa.go
src/runtime/internal/atomic/asm_amd64.s
src/runtime/internal/atomic/bench_test.go [new file with mode: 0644]