cmd/compile/internal/obj/x86: eliminate some function prologues
cmd/compile/internal/obj/x86: eliminate some function prologues

The standard sort swap method

func (t T) Swap(i, j int) {
  t[i], t[j] = t[j], t[i]
}

uses no stack space on architectures for which
FixedFrameSize == 0, currently 386 and amd64.

Nevertheless, we insert a stack check prologue.
This is because it contains a call to
runtime.panicindex.

However, for a few common runtime functions,
we know at compile time that they require
no arguments. Allow them to pass unnoticed.

Triggers for 380 functions during make.bash.
Cuts 4k off cmd/go.

encoding/binary benchmarks:

ReadSlice1000Int32s-8     9.49µs ± 3%    9.41µs ± 5%    ~     (p=0.075 n=29+27)
ReadStruct-8              1.50µs ± 3%    1.48µs ± 2%  -1.49%  (p=0.000 n=30+28)
ReadInts-8                 599ns ± 3%     600ns ± 3%    ~     (p=0.471 n=30+29)
WriteInts-8                836ns ± 4%     841ns ± 3%    ~     (p=0.371 n=30+29)
WriteSlice1000Int32s-8    8.84µs ± 3%    8.69µs ± 5%  -1.71%  (p=0.001 n=30+30)
PutUvarint32-8            29.6ns ± 1%    28.1ns ± 3%  -5.21%  (p=0.000 n=28+28)
PutUvarint64-8            82.6ns ± 5%    82.3ns ±10%  -0.43%  (p=0.014 n=27+30)

Swap assembly before:

"".T.Swap t=1 size=74 args=0x28 locals=0x0
	0x0000 00000 (swap.go:5)	TEXT	"".T.Swap(SB), $0-40
	0x0000 00000 (swap.go:5)	MOVQ	(TLS), CX
	0x0009 00009 (swap.go:5)	CMPQ	SP, 16(CX)
	0x000d 00013 (swap.go:5)	JLS	67
	0x000f 00015 (swap.go:5)	FUNCDATA	$0, gclocals·3cadd97b66f25a3a642be35e9362338f(SB)
	0x000f 00015 (swap.go:5)	FUNCDATA	$1, gclocals·69c1753bd5f81501d95132d08af04464(SB)
	0x000f 00015 (swap.go:5)	MOVQ	"".i+32(FP), AX
	0x0014 00020 (swap.go:5)	MOVQ	"".t+16(FP), CX
	0x0019 00025 (swap.go:5)	CMPQ	AX, CX
	0x001c 00028 (swap.go:5)	JCC	$0, 60
	0x001e 00030 (swap.go:5)	MOVQ	"".t+8(FP), DX
	0x0023 00035 (swap.go:5)	MOVBLZX	(DX)(AX*1), BX
	0x0027 00039 (swap.go:5)	MOVQ	"".j+40(FP), SI
	0x002c 00044 (swap.go:5)	CMPQ	SI, CX
	0x002f 00047 (swap.go:5)	JCC	$0, 60
	0x0031 00049 (swap.go:5)	MOVBLZX	(DX)(SI*1), CX
	0x0035 00053 (swap.go:5)	MOVB	CL, (DX)(AX*1)
	0x0038 00056 (swap.go:5)	MOVB	BL, (DX)(SI*1)
	0x003b 00059 (swap.go:5)	RET
	0x003c 00060 (swap.go:5)	PCDATA	$0, $1
	0x003c 00060 (swap.go:5)	CALL	runtime.panicindex(SB)
	0x0041 00065 (swap.go:5)	UNDEF
	0x0043 00067 (swap.go:5)	NOP
	0x0043 00067 (swap.go:5)	CALL	runtime.morestack_noctxt(SB)
	0x0048 00072 (swap.go:5)	JMP	0

Swap assembly after:

"".T.Swap t=1 size=52 args=0x28 locals=0x0
	0x0000 00000 (swap.go:5)	TEXT	"".T.Swap(SB), $0-40
	0x0000 00000 (swap.go:5)	FUNCDATA	$0, gclocals·3cadd97b66f25a3a642be35e9362338f(SB)
	0x0000 00000 (swap.go:5)	FUNCDATA	$1, gclocals·69c1753bd5f81501d95132d08af04464(SB)
	0x0000 00000 (swap.go:5)	MOVQ	"".i+32(FP), AX
	0x0005 00005 (swap.go:5)	MOVQ	"".t+16(FP), CX
	0x000a 00010 (swap.go:5)	CMPQ	AX, CX
	0x000d 00013 (swap.go:5)	JCC	$0, 45
	0x000f 00015 (swap.go:5)	MOVQ	"".t+8(FP), DX
	0x0014 00020 (swap.go:5)	MOVBLZX	(DX)(AX*1), BX
	0x0018 00024 (swap.go:5)	MOVQ	"".j+40(FP), SI
	0x001d 00029 (swap.go:5)	CMPQ	SI, CX
	0x0020 00032 (swap.go:5)	JCC	$0, 45
	0x0022 00034 (swap.go:5)	MOVBLZX	(DX)(SI*1), CX
	0x0026 00038 (swap.go:5)	MOVB	CL, (DX)(AX*1)
	0x0029 00041 (swap.go:5)	MOVB	BL, (DX)(SI*1)
	0x002c 00044 (swap.go:5)	RET
	0x002d 00045 (swap.go:5)	PCDATA	$0, $1
	0x002d 00045 (swap.go:5)	CALL	runtime.panicindex(SB)
	0x0032 00050 (swap.go:5)	UNDEF

Change-Id: I57dad14af8aaa5e6112deac407cfadc2bfaf1f54
Reviewed-on: https://go-review.googlesource.com/24814
Run-TryBot: Josh Bleecher Snyder <cdc248cc4d32e4fbfe04e45228163bcecd48a0b9@gmail.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Keith Randall <8c99c3a9284e493be632950b84cd789d08ed3e9d@golang.org>

Cofyc/go,golang/go,akutz/go,CAFxX/go,nawawi/go,momchil-velikov/go,vsekhar/elastic-go,derekmarcotte/go,suncycheng/go,golang/go,momchil-velikov/go,linux-on-ibm-z/go,goodlang/good,polyverse-security/go,Cofyc/go,vsekhar/elastic-go,ImJasonH/go,ImJasonH/go,momchil-velikov/go,momchil-velikov/go,cloudflare/go,momchil-velikov/go,Cofyc/go,josharian/go,codestation/go,CAFxX/go,codestation/go,cloudflare/go,linux-on-ibm-z/go,goodlang/good,vsekhar/elastic-go,derekmarcotte/go,goodlang/good,CAFxX/go,CAFxX/go,suncycheng/go,polyverse-security/go,CAFxX/go,nawawi/go,cloudflare/go,ImJasonH/go,codestation/go,akutz/go,vsekhar/elastic-go,Cofyc/go,polyverse-security/go,goodlang/good,derekmarcotte/go,golang/go,codestation/go,Cofyc/go,ImJasonH/go,polyverse-security/go,suncycheng/go,codestation/go,momchil-velikov/go,cloudflare/go,akutz/go,suncycheng/go,suncycheng/go,linux-on-ibm-z/go,nawawi/go,CAFxX/go,golang/go,codestation/go,josharian/go,codestation/go,Cofyc/go,josharian/go,akutz/go,ImJasonH/go,goodlang/good,cloudflare/go,ImJasonH/go,akutz/go,josharian/go,suncycheng/go,cloudflare/go,linux-on-ibm-z/go,golang/go,akutz/go,Cofyc/go,derekmarcotte/go,CAFxX/go,goodlang/good,suncycheng/go,golang/go,derekmarcotte/go,nawawi/go,polyverse-security/go,nawawi/go,polyverse-security/go,christopher-henderson/Go,josharian/go,vsekhar/elastic-go,nawawi/go,cloudflare/go,goodlang/good,suncycheng/go,codestation/go,linux-on-ibm-z/go,ImJasonH/go,akutz/go,vsekhar/elastic-go,vsekhar/elastic-go,derekmarcotte/go,josharian/go,linux-on-ibm-z/go,linux-on-ibm-z/go,nawawi/go,akutz/go,polyverse-security/go,josharian/go,golang/go,goodlang/good,derekmarcotte/go,linux-on-ibm-z/go,polyverse-security/go,nawawi/go,momchil-velikov/go,CAFxX/go,cloudflare/go,golang/go,josharian/go,Cofyc/go,momchil-velikov/go,vsekhar/elastic-go,ImJasonH/go,derekmarcotte/go