1
0
mirror of https://github.com/golang/go synced 2024-11-20 10:04:45 -07:00
go/src/liblink
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
..
asm5.c build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00
asm6.c liblink: fix encoding of SETcc for amd64 2015-01-04 20:38:12 +00:00
asm8.c runtime: faster aeshash implementation 2014-12-11 05:23:00 +00:00
asm9.c liblink: fail for too-large register offset constants 2014-12-18 22:32:18 +00:00
data.c liblink: require DATA lines to be ordered by offset, with no overlap 2014-10-14 23:25:12 -04:00
go.c
ld.c liblink: support big-endian properly 2014-08-06 00:25:41 -04:00
list5.c liblink, cmd/dist, cmd/5l: introduce %^ and move C_* constants. 2014-08-06 00:31:22 -04:00
list6.c liblink: remove class from %#D formatter on 6l 2014-12-22 19:25:52 +00:00
list8.c liblink: remove some gotos + other fixes 2014-07-21 17:38:48 -04:00
list9.c [dev.cc] liblink: fix warnings on Plan 9 2014-11-21 20:56:33 +01:00
Makefile
obj5.c Revert "liblink, cmd/ld, runtime: remove stackguard1" 2015-01-05 16:29:56 +00:00
obj6.c cmd/6g, cmd/8g, liblink: improve handling of float constants 2015-01-07 22:26:55 +00:00
obj8.c cmd/6g, cmd/8g, liblink: improve handling of float constants 2015-01-07 22:26:55 +00:00
obj9.c Revert "liblink, cmd/ld, runtime: remove stackguard1" 2015-01-05 16:29:56 +00:00
obj.c cmd/gc: record line number for auto-generated wrappers as <autogenerated>:1 2014-05-12 11:59:55 -04:00
objfile.c Revert "liblink, cmd/ld, runtime: remove stackguard1" 2015-01-05 16:29:56 +00:00
pass.c [dev.cc] liblink: don't patch jumps to jumps to symbols 2014-12-05 09:24:01 -05:00
pcln.c liblink: fix precedence bug in pcdata comparison 2014-07-16 19:26:36 -04:00
sched9.c [dev.power64] cmd/9a, cmd/9c, cmd/9l, liblink: import code from Vita Nuova. 2014-08-06 23:41:29 -04:00
sym.c build: adjustments for move from src/pkg to src 2014-09-08 00:06:45 -04:00