1
0
mirror of https://github.com/golang/go synced 2024-11-20 08:44:39 -07:00
go/src
Josh Bleecher Snyder 43c87aa481 cmd/6g, cmd/8g, liblink: improve handling of float constants
* Enable basic constant propagation for floats.
  The constant propagation is still not as aggressive as it could be.
* Implement MOVSS $(0), Xx and MOVSD $(0), Xx as XORPS Xx, Xx.

Sample code:

func f32() float32 {
	var f float32
	return f
}

func f64() float64 {
	var f float64
	return f
}

Before:

"".f32 t=1 size=32 value=0 args=0x8 locals=0x0
	0x0000 00000 (demo.go:3)	TEXT	"".f32+0(SB),4,$0-8
	0x0000 00000 (demo.go:3)	FUNCDATA	$0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB)
	0x0000 00000 (demo.go:3)	FUNCDATA	$1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB)
	0x0000 00000 (demo.go:3)	MOVSS	$f32.00000000+0(SB),X0
	0x0008 00008 (demo.go:4)	MOVSS	$f32.00000000+0(SB),X0
	0x0010 00016 (demo.go:5)	MOVSS	X0,"".~r0+8(FP)
	0x0016 00022 (demo.go:5)	RET	,
"".f64 t=1 size=32 value=0 args=0x8 locals=0x0
	0x0000 00000 (demo.go:8)	TEXT	"".f64+0(SB),4,$0-8
	0x0000 00000 (demo.go:8)	FUNCDATA	$0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB)
	0x0000 00000 (demo.go:8)	FUNCDATA	$1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB)
	0x0000 00000 (demo.go:8)	MOVSD	$f64.0000000000000000+0(SB),X0
	0x0008 00008 (demo.go:9)	MOVSD	$f64.0000000000000000+0(SB),X0
	0x0010 00016 (demo.go:10)	MOVSD	X0,"".~r0+8(FP)
	0x0016 00022 (demo.go:10)	RET	,

After:

"".f32 t=1 size=16 value=0 args=0x8 locals=0x0
	0x0000 00000 (demo.go:3)	TEXT	"".f32+0(SB),4,$0-8
	0x0000 00000 (demo.go:3)	FUNCDATA	$0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB)
	0x0000 00000 (demo.go:3)	FUNCDATA	$1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB)
	0x0000 00000 (demo.go:3)	XORPS	X0,X0
	0x0003 00003 (demo.go:5)	MOVSS	X0,"".~r0+8(FP)
	0x0009 00009 (demo.go:5)	RET	,
"".f64 t=1 size=16 value=0 args=0x8 locals=0x0
	0x0000 00000 (demo.go:8)	TEXT	"".f64+0(SB),4,$0-8
	0x0000 00000 (demo.go:8)	FUNCDATA	$0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB)
	0x0000 00000 (demo.go:8)	FUNCDATA	$1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB)
	0x0000 00000 (demo.go:8)	XORPS	X0,X0
	0x0003 00003 (demo.go:10)	MOVSD	X0,"".~r0+8(FP)
	0x0009 00009 (demo.go:10)	RET	,

Change-Id: Ie9eb65e324af4f664153d0a7cd22bb16b0fba16d
Reviewed-on: https://go-review.googlesource.com/2053
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-07 22:26:55 +00:00
..
archive archive/tar: document Reader.Next's behavior at the end 2014-12-30 21:38:37 +00:00
bufio bufio: add Reader.Discard 2015-01-07 06:37:57 +00:00
builtin
bytes
cmd cmd/6g, cmd/8g, liblink: improve handling of float constants 2015-01-07 22:26:55 +00:00
compress compress/bzip2: s/repeat_power/repeatPower/ 2014-12-19 01:29:00 +00:00
container
crypto crypto/tls: fix renegotiation extension. 2015-01-06 19:50:07 +00:00
database/sql database/sql: Remove unnecessary call to maybeOpenNewConnections 2014-12-24 02:39:12 +00:00
debug all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
encoding encoding/gob: address go vet report 2014-12-28 19:30:31 +00:00
errors
expvar
flag flag: Check for Set error 2014-12-22 00:17:07 +00:00
fmt fmt: fix two typos 2015-01-04 23:07:43 +00:00
go cmd/cgo, runtime/cgo: support ppc64 2015-01-07 20:36:27 +00:00
hash all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
html html/template: fix build after encoding/js escaping change 2014-10-28 10:18:44 +11:00
image image: use three-index slice for NewYCbCr. 2015-01-05 03:32:15 +00:00
index/suffixarray
internal/syscall
io
lib9
libbio
liblink cmd/6g, cmd/8g, liblink: improve handling of float constants 2015-01-07 22:26:55 +00:00
log log: update doc comment 2015-01-05 01:21:52 +00:00
math math/big: panic if n <= 0 for ProbablyPrime 2015-01-05 23:11:35 +00:00
mime mime/multipart: moved some code to mime/internal/quotedprintable 2014-12-23 19:30:02 +00:00
net bufio: add Reader.Discard 2015-01-07 06:37:57 +00:00
os os: replace itod on posix with general itoa and fix possible infinite recursion 2015-01-02 16:21:18 +00:00
path path/filepath: remove named result parameter for VolumeName 2014-12-18 16:05:07 +00:00
reflect reflect: add write barriers 2015-01-06 00:28:31 +00:00
regexp regexp: fix typo in comment: s/onpass/onepass/ 2014-12-24 07:30:28 +00:00
runtime runtime: remove size argument from hash and equal algorithms 2015-01-07 21:57:01 +00:00
sort sort: optimize symMerge performance for blocks with one element 2015-01-06 23:30:46 +00:00
strconv strconv: optimize decimal to string conversion 2014-12-30 23:28:02 +00:00
strings strings: use fast path for IndexRune 2014-10-06 15:10:51 -07:00
sync sync/atomic: remove atomic pointer hammer tests 2015-01-06 00:28:22 +00:00
syscall syscall: fix the deprecated way of parsing routing message on openbsd 2014-12-22 23:42:33 +00:00
testing testing/iotest: fix copy/paste error in comment 2014-12-29 19:05:37 +00:00
text text/template: fix bug in pipelined variadics 2014-10-18 11:22:05 -07:00
time time: panic with a more helpful error on use of invalid Timer 2014-10-21 13:26:40 +02:00
unicode unicode/utf8: fix docs for DecodeRune(empty) and friends. 2014-10-16 09:13:50 +11:00
unsafe unsafe: document that unsafe programs are not protected 2014-10-24 09:37:25 -07:00
all.bash
all.bat
all.rc
androidtest.bash
clean.bash
clean.bat
clean.rc
make.bash build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
make.bat build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
Make.dist
make.rc
nacltest.bash
race.bash
race.bat
run.bash cmd/cgo, runtime/cgo: support ppc64 2015-01-07 20:36:27 +00:00
run.bat build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
run.rc
sudo.bash