]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use shorter versions of zero-extend ops
authorKeith Randall <khr@golang.org>
Thu, 2 Jun 2016 19:41:42 +0000 (12:41 -0700)
committerKeith Randall <khr@golang.org>
Tue, 16 Aug 2016 21:32:21 +0000 (21:32 +0000)
Only need to zero-extend to 32 bits and we get the top
32 bits zeroed for free.

Only the WQ change actually generates different code.
The assembler did this optimization for us in the other two cases.
But we might as well do it during SSA so -S output more closely
matches the actual generated instructions.

Change-Id: I3e4ac50dc4da124014d4e31c86e9fc539d94f7fd
Reviewed-on: https://go-review.googlesource.com/23711
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/cmd/compile/internal/ssa/gen/AMD64Ops.go
src/cmd/compile/internal/ssa/opGen.go

index 07301618f4ffe3b07b314105e48846c39bcc0e14..0265963252234fe6f79a7e1b733d3b0b9e6e3a9d 100644 (file)
@@ -332,11 +332,11 @@ func init() {
                {name: "SETGEF", argLength: 1, reg: flagsgp, asm: "SETCC"}, // extract floating >= condition from arg0
 
                {name: "MOVBQSX", argLength: 1, reg: gp11, asm: "MOVBQSX"}, // sign extend arg0 from int8 to int64
-               {name: "MOVBQZX", argLength: 1, reg: gp11, asm: "MOVBQZX"}, // zero extend arg0 from int8 to int64
+               {name: "MOVBQZX", argLength: 1, reg: gp11, asm: "MOVBLZX"}, // zero extend arg0 from int8 to int64
                {name: "MOVWQSX", argLength: 1, reg: gp11, asm: "MOVWQSX"}, // sign extend arg0 from int16 to int64
-               {name: "MOVWQZX", argLength: 1, reg: gp11, asm: "MOVWQZX"}, // zero extend arg0 from int16 to int64
+               {name: "MOVWQZX", argLength: 1, reg: gp11, asm: "MOVWLZX"}, // zero extend arg0 from int16 to int64
                {name: "MOVLQSX", argLength: 1, reg: gp11, asm: "MOVLQSX"}, // sign extend arg0 from int32 to int64
-               {name: "MOVLQZX", argLength: 1, reg: gp11, asm: "MOVLQZX"}, // zero extend arg0 from int32 to int64
+               {name: "MOVLQZX", argLength: 1, reg: gp11, asm: "MOVL"},    // zero extend arg0 from int32 to int64
 
                {name: "MOVLconst", reg: gp01, asm: "MOVL", typ: "UInt32", aux: "Int32", rematerializeable: true}, // 32 low bits of auxint
                {name: "MOVQconst", reg: gp01, asm: "MOVQ", typ: "UInt64", aux: "Int64", rematerializeable: true}, // auxint
index be8cdd60aca1392be731657c9eaf516e93acf6b1..cc6383da009048b801e44a88ef6438023257430f 100644 (file)
@@ -5794,7 +5794,7 @@ var opcodeTable = [...]opInfo{
        {
                name:   "MOVBQZX",
                argLen: 1,
-               asm:    x86.AMOVBQZX,
+               asm:    x86.AMOVBLZX,
                reg: regInfo{
                        inputs: []inputInfo{
                                {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@@ -5820,7 +5820,7 @@ var opcodeTable = [...]opInfo{
        {
                name:   "MOVWQZX",
                argLen: 1,
-               asm:    x86.AMOVWQZX,
+               asm:    x86.AMOVWLZX,
                reg: regInfo{
                        inputs: []inputInfo{
                                {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
@@ -5846,7 +5846,7 @@ var opcodeTable = [...]opInfo{
        {
                name:   "MOVLQZX",
                argLen: 1,
-               asm:    x86.AMOVLQZX,
+               asm:    x86.AMOVL,
                reg: regInfo{
                        inputs: []inputInfo{
                                {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15