1
0
mirror of https://github.com/golang/go synced 2024-09-30 01:14:29 -06:00

cmd/compile: merge more shifts into stores

Updates #36223

(Might fix #36223. I'm not sure whether there are more outstanding.)

This helps a bit, but not as much as I'd expected/hoped.

file                                      before  after   Δ       %       
runtime.s                                 477286  477256  -30     -0.006% 
bytes.s                                   31089   31085   -4      -0.013% 
time.s                                    83561   83547   -14     -0.017% 
strings.s                                 43284   43280   -4      -0.009% 
compress/flate.s                          51374   51295   -79     -0.154% 
math/big.s                                184283  184256  -27     -0.015% 
crypto/elliptic.s                         51649   51577   -72     -0.139% 
crypto/sha512.s                           8661    8644    -17     -0.196% 
crypto/sha1.s                             6975    6959    -16     -0.229% 
crypto/sha256.s                           6412    6393    -19     -0.296% 
vendor/golang.org/x/text/unicode/bidi.s   27158   27146   -12     -0.044% 
vendor/golang.org/x/text/unicode/norm.s   66802   66788   -14     -0.021% 
net/http.s                                560936  560929  -7      -0.001% 
text/template.s                           96475   96467   -8      -0.008% 
go/parser.s                               80284   80280   -4      -0.005% 
text/tabwriter.s                          9618    9611    -7      -0.073% 
go/printer.s                              78502   78499   -3      -0.004% 
go/types.s                                321815  321807  -8      -0.002% 
internal/xcoff.s                          23175   23171   -4      -0.017% 
image/jpeg.s                              36609   36587   -22     -0.060% 
cmd/vendor/golang.org/x/arch/x86/x86asm.s 81274   81001   -273    -0.336% 
cmd/internal/obj.s                        115184  115126  -58     -0.050% 
cmd/internal/obj/arm64.s                  151502  151487  -15     -0.010% 
cmd/internal/obj/s390x.s                  128054  128046  -8      -0.006% 
cmd/internal/obj/wasm.s                   44295   44291   -4      -0.009% 
cmd/compile/internal/ssa.s                4201992 4209504 +7512   +0.179% 
cmd/compile/internal/gc.s                 1555029 1555011 -18     -0.001% 
total                                     9792875 9799640 +6765   +0.069% 


Change-Id: If4a857c0953a766578e68aa299b112a20d9b2b86
Reviewed-on: https://go-review.googlesource.com/c/go/+/213704
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2020-01-07 13:41:02 -08:00
parent bd6d78ef37
commit f53f987ebf
3 changed files with 1180 additions and 991 deletions

View File

@ -597,15 +597,14 @@ func init() {
{name: "MOVQloadidx1", argLength: 3, reg: gploadidx, commutative: true, asm: "MOVQ", scale: 1, aux: "SymOff", typ: "UInt64", symEffect: "Read"}, // load 8 bytes from arg0+arg1+auxint+aux. arg2=mem
{name: "MOVQloadidx8", argLength: 3, reg: gploadidx, asm: "MOVQ", scale: 8, aux: "SymOff", typ: "UInt64", symEffect: "Read"}, // load 8 bytes from arg0+8*arg1+auxint+aux. arg2=mem
// TODO: sign-extending indexed loads
// TODO: mark the MOVXstoreidx1 ops as commutative. Generates too many rewrite rules at the moment.
{name: "MOVBstoreidx1", argLength: 4, reg: gpstoreidx, asm: "MOVB", scale: 1, aux: "SymOff", symEffect: "Write"}, // store byte in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVWstoreidx1", argLength: 4, reg: gpstoreidx, asm: "MOVW", scale: 1, aux: "SymOff", symEffect: "Write"}, // store 2 bytes in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVWstoreidx2", argLength: 4, reg: gpstoreidx, asm: "MOVW", scale: 2, aux: "SymOff", symEffect: "Write"}, // store 2 bytes in arg2 to arg0+2*arg1+auxint+aux. arg3=mem
{name: "MOVLstoreidx1", argLength: 4, reg: gpstoreidx, asm: "MOVL", scale: 1, aux: "SymOff", symEffect: "Write"}, // store 4 bytes in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVLstoreidx4", argLength: 4, reg: gpstoreidx, asm: "MOVL", scale: 4, aux: "SymOff", symEffect: "Write"}, // store 4 bytes in arg2 to arg0+4*arg1+auxint+aux. arg3=mem
{name: "MOVLstoreidx8", argLength: 4, reg: gpstoreidx, asm: "MOVL", scale: 8, aux: "SymOff", symEffect: "Write"}, // store 4 bytes in arg2 to arg0+8*arg1+auxint+aux. arg3=mem
{name: "MOVQstoreidx1", argLength: 4, reg: gpstoreidx, asm: "MOVQ", scale: 1, aux: "SymOff", symEffect: "Write"}, // store 8 bytes in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVQstoreidx8", argLength: 4, reg: gpstoreidx, asm: "MOVQ", scale: 8, aux: "SymOff", symEffect: "Write"}, // store 8 bytes in arg2 to arg0+8*arg1+auxint+aux. arg3=mem
{name: "MOVBstoreidx1", argLength: 4, reg: gpstoreidx, commutative: true, asm: "MOVB", scale: 1, aux: "SymOff", symEffect: "Write"}, // store byte in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVWstoreidx1", argLength: 4, reg: gpstoreidx, commutative: true, asm: "MOVW", scale: 1, aux: "SymOff", symEffect: "Write"}, // store 2 bytes in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVWstoreidx2", argLength: 4, reg: gpstoreidx, asm: "MOVW", scale: 2, aux: "SymOff", symEffect: "Write"}, // store 2 bytes in arg2 to arg0+2*arg1+auxint+aux. arg3=mem
{name: "MOVLstoreidx1", argLength: 4, reg: gpstoreidx, commutative: true, asm: "MOVL", scale: 1, aux: "SymOff", symEffect: "Write"}, // store 4 bytes in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVLstoreidx4", argLength: 4, reg: gpstoreidx, asm: "MOVL", scale: 4, aux: "SymOff", symEffect: "Write"}, // store 4 bytes in arg2 to arg0+4*arg1+auxint+aux. arg3=mem
{name: "MOVLstoreidx8", argLength: 4, reg: gpstoreidx, asm: "MOVL", scale: 8, aux: "SymOff", symEffect: "Write"}, // store 4 bytes in arg2 to arg0+8*arg1+auxint+aux. arg3=mem
{name: "MOVQstoreidx1", argLength: 4, reg: gpstoreidx, commutative: true, asm: "MOVQ", scale: 1, aux: "SymOff", symEffect: "Write"}, // store 8 bytes in arg2 to arg0+arg1+auxint+aux. arg3=mem
{name: "MOVQstoreidx8", argLength: 4, reg: gpstoreidx, asm: "MOVQ", scale: 8, aux: "SymOff", symEffect: "Write"}, // store 8 bytes in arg2 to arg0+8*arg1+auxint+aux. arg3=mem
// TODO: add size-mismatched indexed loads, like MOVBstoreidx4.
// For storeconst ops, the AuxInt field encodes both
@ -616,13 +615,13 @@ func init() {
{name: "MOVLstoreconst", argLength: 2, reg: gpstoreconst, asm: "MOVL", aux: "SymValAndOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store low 4 bytes of ...
{name: "MOVQstoreconst", argLength: 2, reg: gpstoreconst, asm: "MOVQ", aux: "SymValAndOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes of ...
{name: "MOVBstoreconstidx1", argLength: 3, reg: gpstoreconstidx, asm: "MOVB", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low byte of ValAndOff(AuxInt).Val() to arg0+1*arg1+ValAndOff(AuxInt).Off()+aux. arg2=mem
{name: "MOVWstoreconstidx1", argLength: 3, reg: gpstoreconstidx, asm: "MOVW", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 2 bytes of ... arg1 ...
{name: "MOVWstoreconstidx2", argLength: 3, reg: gpstoreconstidx, asm: "MOVW", scale: 2, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 2 bytes of ... 2*arg1 ...
{name: "MOVLstoreconstidx1", argLength: 3, reg: gpstoreconstidx, asm: "MOVL", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 4 bytes of ... arg1 ...
{name: "MOVLstoreconstidx4", argLength: 3, reg: gpstoreconstidx, asm: "MOVL", scale: 4, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 4 bytes of ... 4*arg1 ...
{name: "MOVQstoreconstidx1", argLength: 3, reg: gpstoreconstidx, asm: "MOVQ", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store 8 bytes of ... arg1 ...
{name: "MOVQstoreconstidx8", argLength: 3, reg: gpstoreconstidx, asm: "MOVQ", scale: 8, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store 8 bytes of ... 8*arg1 ...
{name: "MOVBstoreconstidx1", argLength: 3, reg: gpstoreconstidx, commutative: true, asm: "MOVB", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low byte of ValAndOff(AuxInt).Val() to arg0+1*arg1+ValAndOff(AuxInt).Off()+aux. arg2=mem
{name: "MOVWstoreconstidx1", argLength: 3, reg: gpstoreconstidx, commutative: true, asm: "MOVW", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 2 bytes of ... arg1 ...
{name: "MOVWstoreconstidx2", argLength: 3, reg: gpstoreconstidx, asm: "MOVW", scale: 2, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 2 bytes of ... 2*arg1 ...
{name: "MOVLstoreconstidx1", argLength: 3, reg: gpstoreconstidx, commutative: true, asm: "MOVL", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 4 bytes of ... arg1 ...
{name: "MOVLstoreconstidx4", argLength: 3, reg: gpstoreconstidx, asm: "MOVL", scale: 4, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store low 4 bytes of ... 4*arg1 ...
{name: "MOVQstoreconstidx1", argLength: 3, reg: gpstoreconstidx, commutative: true, asm: "MOVQ", scale: 1, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store 8 bytes of ... arg1 ...
{name: "MOVQstoreconstidx8", argLength: 3, reg: gpstoreconstidx, asm: "MOVQ", scale: 8, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store 8 bytes of ... 8*arg1 ...
// arg0 = pointer to start of memory to zero
// arg1 = value to store (will always be zero)

View File

@ -10969,12 +10969,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVBstoreidx1",
auxType: auxSymOff,
argLen: 4,
symEffect: SymWrite,
asm: x86.AMOVB,
scale: 1,
name: "MOVBstoreidx1",
auxType: auxSymOff,
argLen: 4,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVB,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -10984,12 +10985,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVWstoreidx1",
auxType: auxSymOff,
argLen: 4,
symEffect: SymWrite,
asm: x86.AMOVW,
scale: 1,
name: "MOVWstoreidx1",
auxType: auxSymOff,
argLen: 4,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVW,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -11014,12 +11016,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVLstoreidx1",
auxType: auxSymOff,
argLen: 4,
symEffect: SymWrite,
asm: x86.AMOVL,
scale: 1,
name: "MOVLstoreidx1",
auxType: auxSymOff,
argLen: 4,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVL,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -11059,12 +11062,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVQstoreidx1",
auxType: auxSymOff,
argLen: 4,
symEffect: SymWrite,
asm: x86.AMOVQ,
scale: 1,
name: "MOVQstoreidx1",
auxType: auxSymOff,
argLen: 4,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVQ,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -11141,12 +11145,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVBstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
symEffect: SymWrite,
asm: x86.AMOVB,
scale: 1,
name: "MOVBstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVB,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -11155,12 +11160,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVWstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
symEffect: SymWrite,
asm: x86.AMOVW,
scale: 1,
name: "MOVWstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVW,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -11183,12 +11189,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVLstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
symEffect: SymWrite,
asm: x86.AMOVL,
scale: 1,
name: "MOVLstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVL,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@ -11211,12 +11218,13 @@ var opcodeTable = [...]opInfo{
},
},
{
name: "MOVQstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
symEffect: SymWrite,
asm: x86.AMOVQ,
scale: 1,
name: "MOVQstoreconstidx1",
auxType: auxSymValAndOff,
argLen: 3,
commutative: true,
symEffect: SymWrite,
asm: x86.AMOVQ,
scale: 1,
reg: regInfo{
inputs: []inputInfo{
{1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15

File diff suppressed because it is too large Load Diff