Commit c1593da8 authored by Keith Randall's avatar Keith Randall

[dev.ssa] cmd/compile/internal/ssa/gen: Fix *64 strength reduction

*64 is <<6, not <<5.

Change-Id: I2eb7e113d5003b2c77fbd3abc3defc4d98976a5e
Reviewed-on: https://go-review.googlesource.com/12323Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 3dcc424b
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
// strength reduction // strength reduction
// TODO: do this a lot more generically // TODO: do this a lot more generically
(MULQconst [8] x) -> (SHLQconst [3] x) (MULQconst [8] x) -> (SHLQconst [3] x)
(MULQconst [64] x) -> (SHLQconst [5] x) (MULQconst [64] x) -> (SHLQconst [6] x)
// fold add/shift into leaq // fold add/shift into leaq
(ADDQ x (SHLQconst [3] y)) -> (LEAQ8 x y) (ADDQ x (SHLQconst [3] y)) -> (LEAQ8 x y)
......
...@@ -1225,22 +1225,22 @@ func rewriteValueAMD64(v *Value, config *Config) bool { ...@@ -1225,22 +1225,22 @@ func rewriteValueAMD64(v *Value, config *Config) bool {
; ;
// match: (MULQconst [64] x) // match: (MULQconst [64] x)
// cond: // cond:
// result: (SHLQconst [5] x) // result: (SHLQconst [6] x)
{ {
if v.AuxInt != 64 { if v.AuxInt != 64 {
goto end75c0c250c703f89e6c43d718dd5ea3c0 goto end3e36a587d1e7c193048d489a0429692c
} }
x := v.Args[0] x := v.Args[0]
v.Op = OpAMD64SHLQconst v.Op = OpAMD64SHLQconst
v.AuxInt = 0 v.AuxInt = 0
v.Aux = nil v.Aux = nil
v.resetArgs() v.resetArgs()
v.AuxInt = 5 v.AuxInt = 6
v.AddArg(x) v.AddArg(x)
return true return true
} }
goto end75c0c250c703f89e6c43d718dd5ea3c0 goto end3e36a587d1e7c193048d489a0429692c
end75c0c250c703f89e6c43d718dd5ea3c0: end3e36a587d1e7c193048d489a0429692c:
; ;
case OpMove: case OpMove:
// match: (Move [size] dst src mem) // match: (Move [size] dst src mem)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment