• Dave Cheney's avatar
    cmd/5g: avoid temporaries during gcmp(reg, constant) · 905e8dfa
    Dave Cheney authored
    Address several instances of unneeded temporaries when using gcmp.
    
    func M(m map[int]bool) int {
            return len(m)
    }
    
    --- prog list "M" ---
    0000 (/home/dfc/src/map.go:3) TEXT      M+0(SB),$0-8
    0001 (/home/dfc/src/map.go:4) MOVW      m+0(FP),R0
    0002 (/home/dfc/src/map.go:4) MOVW      $0,R1
    0003 (/home/dfc/src/map.go:4) CMP       R1,R0,
    0004 (/home/dfc/src/map.go:4) BEQ       ,6(APC)
    0005 (/home/dfc/src/map.go:4) MOVW      0(R0),R0
    0006 (/home/dfc/src/map.go:4) MOVW      R0,.noname+4(FP)
    0007 (/home/dfc/src/map.go:4) RET       ,
    
    after:
    
    --- prog list "M" ---
    0000 (/home/dfc/src/map.go:3) TEXT      M+0(SB),$0-8
    0001 (/home/dfc/src/map.go:4) MOVW      m+0(FP),R0
    0002 (/home/dfc/src/map.go:4) CMP       $0,R0,
    0003 (/home/dfc/src/map.go:4) BEQ       ,5(APC)
    0004 (/home/dfc/src/map.go:4) MOVW      0(R0),R0
    0005 (/home/dfc/src/map.go:4) MOVW      R0,.noname+4(FP)
    0006 (/home/dfc/src/map.go:4) RET       ,
    
    func C(c chan int) int {
            return cap(c)
    }
    
    --- prog list "C" ---
    0000 (/home/dfc/src/map.go:3) TEXT      C+0(SB),$0-8
    0001 (/home/dfc/src/map.go:4) MOVW      c+0(FP),R0
    0002 (/home/dfc/src/map.go:4) MOVW      $0,R1
    0003 (/home/dfc/src/map.go:4) CMP       R1,R0,
    0004 (/home/dfc/src/map.go:4) BEQ       ,6(APC)
    0005 (/home/dfc/src/map.go:4) MOVW      4(R0),R0
    0006 (/home/dfc/src/map.go:4) MOVW      R0,.noname+4(FP)
    0007 (/home/dfc/src/map.go:4) RET       ,
    
    after:
    
    --- prog list "C" ---
    0000 (/home/dfc/src/map.go:3) TEXT      C+0(SB),$0-8
    0001 (/home/dfc/src/map.go:4) MOVW      c+0(FP),R0
    0002 (/home/dfc/src/map.go:4) CMP       $0,R0,
    0003 (/home/dfc/src/map.go:4) BEQ       ,5(APC)
    0004 (/home/dfc/src/map.go:4) MOVW      4(R0),R0
    0005 (/home/dfc/src/map.go:4) MOVW      R0,.noname+4(FP)
    0006 (/home/dfc/src/map.go:4) RET       ,
    
    R=rsc, minux.ma, remyoudompheng
    CC=golang-dev
    https://golang.org/cl/6618054
    905e8dfa
Name
Last commit
Last update
..
5a Loading commit data...
5c Loading commit data...
5g Loading commit data...
5l Loading commit data...
6a Loading commit data...
6c Loading commit data...
6g Loading commit data...
6l Loading commit data...
8a Loading commit data...
8c Loading commit data...
8g Loading commit data...
8l Loading commit data...
addr2line Loading commit data...
api Loading commit data...
cc Loading commit data...
cgo Loading commit data...
cov Loading commit data...
dist Loading commit data...
fix Loading commit data...
gc Loading commit data...
go Loading commit data...
godoc Loading commit data...
gofmt Loading commit data...
ld Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
prof Loading commit data...
vet Loading commit data...
yacc Loading commit data...