]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile/internal/ssa/gen: Fix *64 strength reduction
authorKeith Randall <khr@golang.org>
Thu, 16 Jul 2015 21:20:40 +0000 (14:20 -0700)
committerKeith Randall <khr@golang.org>
Fri, 17 Jul 2015 15:59:10 +0000 (15:59 +0000)
*64 is <<6, not <<5.

Change-Id: I2eb7e113d5003b2c77fbd3abc3defc4d98976a5e
Reviewed-on: https://go-review.googlesource.com/12323
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go

index 47e1fb9c6a0219c202288e68b4fe5eb2390ffc7c..3e25929af537dbff996cb2feb857cc2a534acf02 100644 (file)
 // strength reduction
 // TODO: do this a lot more generically
 (MULQconst [8] x) -> (SHLQconst [3] x)
-(MULQconst [64] x) -> (SHLQconst [5] x)
+(MULQconst [64] x) -> (SHLQconst [6] x)
 
 // fold add/shift into leaq
 (ADDQ x (SHLQconst [3] y)) -> (LEAQ8 x y)
index 7e892c384475f5a5e76647419be3b503da7baddc..3e24f9f618fcfae33d8f6babe5b6ccf72e9f34bc 100644 (file)
@@ -1225,22 +1225,22 @@ func rewriteValueAMD64(v *Value, config *Config) bool {
                ;
                // match: (MULQconst [64] x)
                // cond:
-               // result: (SHLQconst [5] x)
+               // result: (SHLQconst [6] x)
                {
                        if v.AuxInt != 64 {
-                               goto end75c0c250c703f89e6c43d718dd5ea3c0
+                               goto end3e36a587d1e7c193048d489a0429692c
                        }
                        x := v.Args[0]
                        v.Op = OpAMD64SHLQconst
                        v.AuxInt = 0
                        v.Aux = nil
                        v.resetArgs()
-                       v.AuxInt = 5
+                       v.AuxInt = 6
                        v.AddArg(x)
                        return true
                }
-               goto end75c0c250c703f89e6c43d718dd5ea3c0
-       end75c0c250c703f89e6c43d718dd5ea3c0:
+               goto end3e36a587d1e7c193048d489a0429692c
+       end3e36a587d1e7c193048d489a0429692c:
                ;
        case OpMove:
                // match: (Move [size] dst src mem)