• Keith Randall's avatar
    cmd/compile: inline atomics from runtime/internal/atomic on amd64 · 320ddcf8
    Keith Randall authored
    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/27641Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
    320ddcf8
inl.go 25 KB