mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/ssa: generate bswap on AMD64
Generate bswap+load/store for reading/writing big endian data. Helps encoding/binary. name old time/op new time/op delta ReadSlice1000Int32s-8 5.06µs ± 8% 4.58µs ± 8% -9.50% (p=0.000 n=10+10) ReadStruct-8 1.07µs ± 0% 1.05µs ± 0% -1.51% (p=0.000 n=9+10) ReadInts-8 367ns ± 0% 363ns ± 0% -1.15% (p=0.000 n=8+9) WriteInts-8 475ns ± 1% 469ns ± 0% -1.45% (p=0.000 n=10+10) WriteSlice1000Int32s-8 5.03µs ± 3% 4.50µs ± 3% -10.45% (p=0.000 n=9+9) PutUvarint32-8 17.2ns ± 0% 17.2ns ± 0% ~ (all samples are equal) PutUvarint64-8 46.7ns ± 0% 46.7ns ± 0% ~ (p=0.509 n=10+10) name old speed new speed delta ReadSlice1000Int32s-8 791MB/s ± 8% 875MB/s ± 8% +10.53% (p=0.000 n=10+10) ReadStruct-8 70.0MB/s ± 0% 71.1MB/s ± 0% +1.54% (p=0.000 n=9+10) ReadInts-8 81.6MB/s ± 0% 82.6MB/s ± 0% +1.21% (p=0.000 n=9+9) WriteInts-8 63.0MB/s ± 1% 63.9MB/s ± 0% +1.45% (p=0.000 n=10+10) WriteSlice1000Int32s-8 796MB/s ± 4% 888MB/s ± 3% +11.65% (p=0.000 n=9+9) PutUvarint32-8 233MB/s ± 0% 233MB/s ± 0% ~ (p=0.089 n=10+10) PutUvarint64-8 171MB/s ± 0% 171MB/s ± 0% ~ (p=0.137 n=10+9) Change-Id: Ia2dbdef92198eaa7e2af5443a8ed586d4b401ffb Reviewed-on: https://go-review.googlesource.com/32222 Run-TryBot: Ilya Tocar <ilya.tocar@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
ca5cea9dca
commit
10f757486e
3 changed files with 1170 additions and 0 deletions
|
|
@ -157,6 +157,38 @@ func f(b []byte, i int) uint32 {
|
|||
`,
|
||||
[]string{"\tMOVL\t\\(.*\\)\\(.*\\*1\\),"},
|
||||
},
|
||||
{"amd64", "linux", `
|
||||
import "encoding/binary"
|
||||
func f(b []byte) uint64 {
|
||||
return binary.BigEndian.Uint64(b)
|
||||
}
|
||||
`,
|
||||
[]string{"\tBSWAPQ\t"},
|
||||
},
|
||||
{"amd64", "linux", `
|
||||
import "encoding/binary"
|
||||
func f(b []byte, i int) uint64 {
|
||||
return binary.BigEndian.Uint64(b[i:])
|
||||
}
|
||||
`,
|
||||
[]string{"\tBSWAPQ\t"},
|
||||
},
|
||||
{"amd64", "linux", `
|
||||
import "encoding/binary"
|
||||
func f(b []byte) uint32 {
|
||||
return binary.BigEndian.Uint32(b)
|
||||
}
|
||||
`,
|
||||
[]string{"\tBSWAPL\t"},
|
||||
},
|
||||
{"amd64", "linux", `
|
||||
import "encoding/binary"
|
||||
func f(b []byte, i int) uint32 {
|
||||
return binary.BigEndian.Uint32(b[i:])
|
||||
}
|
||||
`,
|
||||
[]string{"\tBSWAPL\t"},
|
||||
},
|
||||
{"386", "linux", `
|
||||
import "encoding/binary"
|
||||
func f(b []byte) uint32 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue