1
0
mirror of https://github.com/golang/go synced 2024-11-19 13:14:42 -07:00
go/src
Keith Randall fb05948d9e cmd/compile,math: improve code generation for math.Abs
Implement int reg <-> fp reg moves on amd64.
If we see a load to int reg followed by an int->fp move, then we can just
load to the fp reg instead.  Same for stores.

math.Abs is now:

MOVQ	"".x+8(SP), AX
SHLQ	$1, AX
SHRQ	$1, AX
MOVQ	AX, "".~r1+16(SP)

math.Copysign is now:

MOVQ	"".x+8(SP), AX
SHLQ	$1, AX
SHRQ	$1, AX
MOVQ	"".y+16(SP), CX
SHRQ	$63, CX
SHLQ	$63, CX
ORQ	CX, AX
MOVQ	AX, "".~r2+24(SP)

math.Float64bits is now:

MOVSD	"".x+8(SP), X0
MOVSD	X0, "".~r1+16(SP)
(it would be nicer to use a non-SSE reg for this, nothing is perfect)

And due to the fix for #21440, the inlined version of these improve as well.

name      old time/op  new time/op  delta
Abs       1.38ns ± 5%  0.89ns ±10%  -35.54%  (p=0.000 n=10+10)
Copysign  1.56ns ± 7%  1.35ns ± 6%  -13.77%  (p=0.000 n=9+10)

Fixes #13095

Change-Id: Ibd7f2792412a6668608780b0688a77062e1f1499
Reviewed-on: https://go-review.googlesource.com/58732
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-08-25 19:15:01 +00:00
..
archive archive/tar: return better WriteHeader errors 2017-08-25 05:21:00 +00:00
bufio
builtin
bytes bytes: add examples for TrimLeft and TrimRight 2017-08-22 21:31:54 +00:00
cmd cmd/compile,math: improve code generation for math.Abs 2017-08-25 19:15:01 +00:00
compress
container
context
crypto crypto/x509: skip TestSystemRoots 2017-08-22 19:54:08 +00:00
database/sql all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
debug all: unindent some big chunks of code 2017-08-18 06:59:48 +00:00
encoding encoding/gob: fix Debug to properly print uint 2017-08-25 10:22:07 +00:00
errors
expvar
flag
fmt fmt: add Stringer example 2017-08-16 18:02:42 +00:00
go go/doc: classify function returning slice of T as constructor 2017-08-22 08:09:42 +00:00
hash
html
image
index/suffixarray
internal all: fix easy-to-miss typos 2017-08-23 03:07:12 +00:00
io io: add example for Pipe 2017-08-22 19:42:20 +00:00
log
math cmd/compile,math: improve code generation for math.Abs 2017-08-25 19:15:01 +00:00
mime
net {net,os/user,plugin}: eliminate unnecessary C round-trips 2017-08-17 18:14:16 +00:00
os {net,os/user,plugin}: eliminate unnecessary C round-trips 2017-08-17 18:14:16 +00:00
path path/filepath: add example for Ext 2017-08-25 16:24:37 +00:00
plugin {net,os/user,plugin}: eliminate unnecessary C round-trips 2017-08-17 18:14:16 +00:00
reflect reflect: handle types with unexported methods before exported ones 2017-08-23 23:48:49 +00:00
regexp
runtime runtime: capture runtimeInitTime after nanotime is initialized 2017-08-25 16:02:17 +00:00
sort sort: fix TestAdversary 2017-08-25 05:58:57 +00:00
strconv strconv: optimize Atoi for common case 2017-08-25 10:17:39 +00:00
strings
sync sync/atomic: remove references to old atomic pointer hammer tests 2017-08-25 05:58:33 +00:00
syscall syscall: skip some exec tests in container 2017-08-23 21:46:55 +00:00
testing testing: parallelize tests over count 2017-08-24 05:45:17 +00:00
text all: unindent some big chunks of code 2017-08-18 06:59:48 +00:00
time time: fix grammar/spelling errors in test comment 2017-08-21 17:52:45 +00:00
unicode
unsafe
vendor/golang_org/x
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash build: add go env GOROOT as default GOROOT_BOOTSTRAP value 2017-08-25 05:36:27 +00:00
make.bat
Make.dist
make.rc build: add go env GOROOT as default GOROOT_BOOTSTRAP value 2017-08-25 05:36:27 +00:00
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc