cmd/5g: avoid temporary during constant OINDEX
func addr(s[]int) *int { return &s[2] } --- prog list "addr" --- 0000 (/home/dfc/src/addr.go:5) TEXT addr+0(SB),$0-16 0001 (/home/dfc/src/addr.go:6) MOVW $s+0(FP),R0 0002 (/home/dfc/src/addr.go:6) MOVW 4(R0),R1 0003 (/home/dfc/src/addr.go:6) MOVW $2,R2 0004 (/home/dfc/src/addr.go:6) CMP R2,R1, 0005 (/home/dfc/src/addr.go:6) BHI ,7(APC) 0006 (/home/dfc/src/addr.go:6) BL ,runtime.panicindex+0(SB) 0007 (/home/dfc/src/addr.go:6) MOVW 0(R0),R0 0008 (/home/dfc/src/addr.go:6) MOVW $8,R1 0009 (/home/dfc/src/addr.go:6) ADD R1,R0 0010 (/home/dfc/src/addr.go:6) MOVW R0,.noname+12(FP) 0011 (/home/dfc/src/addr.go:6) RET , becomes --- prog list "addr" --- 0000 (/home/dfc/src/addr.go:5) TEXT addr+0(SB),$0-16 0001 (/home/dfc/src/addr.go:6) MOVW $s+0(FP),R0 0002 (/home/dfc/src/addr.go:6) MOVW 4(R0),R1 0003 (/home/dfc/src/addr.go:6) MOVW $2,R2 0004 (/home/dfc/src/addr.go:6) CMP R2,R1, 0005 (/home/dfc/src/addr.go:6) BHI ,7(APC) 0006 (/home/dfc/src/addr.go:6) BL ,runtime.panicindex+0(SB) 0007 (/home/dfc/src/addr.go:6) MOVW 0(R0),R0 0008 (/home/dfc/src/addr.go:6) ADD $8,R0 0009 (/home/dfc/src/addr.go:6) MOVW R0,.noname+12(FP) 0010 (/home/dfc/src/addr.go:6) RET , R=rsc, remyoudompheng, minux.ma CC=golang-dev https://golang.org/cl/6590056
Showing
Please register or sign in to comment