TEXT ·tryAdd(SB), NOSPLIT, $0-24
MOVQ x+0(FP), BX
MOVQ y+8(FP), BP
ADDQ BP, BX
MOVQ BX, ret+16(FP)
RET
The pressure test results, tryAdd2 (go) is nearly 4 times faster than tryAdd (plan9)
BenchmarkTryAdd-4 2000000000 1.34 ns/op
BenchmarkTryAdd2-4 2000000000 0.24 ns/op
Maybe the addition is optimized away in the go version. I found this https://rakyll.org/go-tool-flags/ Try to run the code without optimisation?
$ go build -gcflags
Used to pass flags to the Go compiler. go tool compile -help lists all the flags that can be passed to the compiler.
For example, to disable compiler optimizations and inlining, you can use the following the gcflags.
$ go build -gcflags="-N -l"