From be86f09e01891390d4842ff760a1272e745c6409 Mon Sep 17 00:00:00 2001 From: "khr@golang.org" Date: Thu, 19 Sep 2024 10:06:55 -0700 Subject: [PATCH] cmd/compile: use generics for isPowerOfTwo predicates Change-Id: I097b53e9f13de6ff6eb18ae2261842b097f26390 Reviewed-on: https://go-review.googlesource.com/c/go/+/615197 Auto-Submit: Keith Randall Reviewed-by: Keith Randall Reviewed-by: Cuong Manh Le LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase --- src/cmd/compile/internal/ssa/_gen/386.rules | 16 +- src/cmd/compile/internal/ssa/_gen/AMD64.rules | 16 +- src/cmd/compile/internal/ssa/_gen/ARM.rules | 74 ++-- src/cmd/compile/internal/ssa/_gen/ARM64.rules | 176 ++++----- .../compile/internal/ssa/_gen/LOONG64.rules | 6 +- src/cmd/compile/internal/ssa/_gen/MIPS.rules | 6 +- .../compile/internal/ssa/_gen/MIPS64.rules | 6 +- src/cmd/compile/internal/ssa/_gen/S390X.rules | 8 +- .../compile/internal/ssa/_gen/generic.rules | 56 +-- src/cmd/compile/internal/ssa/rewrite.go | 13 +- src/cmd/compile/internal/ssa/rewrite386.go | 32 +- src/cmd/compile/internal/ssa/rewriteAMD64.go | 64 ++-- src/cmd/compile/internal/ssa/rewriteARM.go | 148 ++++---- src/cmd/compile/internal/ssa/rewriteARM64.go | 352 +++++++++--------- .../compile/internal/ssa/rewriteLOONG64.go | 12 +- src/cmd/compile/internal/ssa/rewriteMIPS.go | 12 +- src/cmd/compile/internal/ssa/rewriteMIPS64.go | 12 +- src/cmd/compile/internal/ssa/rewriteS390X.go | 24 +- .../compile/internal/ssa/rewritegeneric.go | 112 +++--- 19 files changed, 568 insertions(+), 577 deletions(-) diff --git a/src/cmd/compile/internal/ssa/_gen/386.rules b/src/cmd/compile/internal/ssa/_gen/386.rules index d92dddd377..4339812224 100644 --- a/src/cmd/compile/internal/ssa/_gen/386.rules +++ b/src/cmd/compile/internal/ssa/_gen/386.rules @@ -493,14 +493,14 @@ (MULLconst [73] x) => (LEAL8 x (LEAL8 x x)) (MULLconst [81] x) => (LEAL8 (LEAL8 x x) (LEAL8 x x)) -(MULLconst [c] x) && isPowerOfTwo32(c+1) && c >= 15 => (SUBL (SHLLconst [int32(log32(c+1))] x) x) -(MULLconst [c] x) && isPowerOfTwo32(c-1) && c >= 17 => (LEAL1 (SHLLconst [int32(log32(c-1))] x) x) -(MULLconst [c] x) && isPowerOfTwo32(c-2) && c >= 34 => (LEAL2 (SHLLconst [int32(log32(c-2))] x) x) -(MULLconst [c] x) && isPowerOfTwo32(c-4) && c >= 68 => (LEAL4 (SHLLconst [int32(log32(c-4))] x) x) -(MULLconst [c] x) && isPowerOfTwo32(c-8) && c >= 136 => (LEAL8 (SHLLconst [int32(log32(c-8))] x) x) -(MULLconst [c] x) && c%3 == 0 && isPowerOfTwo32(c/3) => (SHLLconst [int32(log32(c/3))] (LEAL2 x x)) -(MULLconst [c] x) && c%5 == 0 && isPowerOfTwo32(c/5) => (SHLLconst [int32(log32(c/5))] (LEAL4 x x)) -(MULLconst [c] x) && c%9 == 0 && isPowerOfTwo32(c/9) => (SHLLconst [int32(log32(c/9))] (LEAL8 x x)) +(MULLconst [c] x) && isPowerOfTwo(c+1) && c >= 15 => (SUBL (SHLLconst [int32(log32(c+1))] x) x) +(MULLconst [c] x) && isPowerOfTwo(c-1) && c >= 17 => (LEAL1 (SHLLconst [int32(log32(c-1))] x) x) +(MULLconst [c] x) && isPowerOfTwo(c-2) && c >= 34 => (LEAL2 (SHLLconst [int32(log32(c-2))] x) x) +(MULLconst [c] x) && isPowerOfTwo(c-4) && c >= 68 => (LEAL4 (SHLLconst [int32(log32(c-4))] x) x) +(MULLconst [c] x) && isPowerOfTwo(c-8) && c >= 136 => (LEAL8 (SHLLconst [int32(log32(c-8))] x) x) +(MULLconst [c] x) && c%3 == 0 && isPowerOfTwo(c/3) => (SHLLconst [int32(log32(c/3))] (LEAL2 x x)) +(MULLconst [c] x) && c%5 == 0 && isPowerOfTwo(c/5) => (SHLLconst [int32(log32(c/5))] (LEAL4 x x)) +(MULLconst [c] x) && c%9 == 0 && isPowerOfTwo(c/9) => (SHLLconst [int32(log32(c/9))] (LEAL8 x x)) // combine add/shift into LEAL (ADDL x (SHLLconst [3] y)) => (LEAL8 x y) diff --git a/src/cmd/compile/internal/ssa/_gen/AMD64.rules b/src/cmd/compile/internal/ssa/_gen/AMD64.rules index d8bdf6b17e..7ac9d5ca16 100644 --- a/src/cmd/compile/internal/ssa/_gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/_gen/AMD64.rules @@ -925,14 +925,14 @@ (MUL(Q|L)const [73] x) => (LEA(Q|L)8 x (LEA(Q|L)8 x x)) (MUL(Q|L)const [81] x) => (LEA(Q|L)8 (LEA(Q|L)8 x x) (LEA(Q|L)8 x x)) -(MUL(Q|L)const [c] x) && isPowerOfTwo64(int64(c)+1) && c >= 15 => (SUB(Q|L) (SHL(Q|L)const [int8(log64(int64(c)+1))] x) x) -(MUL(Q|L)const [c] x) && isPowerOfTwo32(c-1) && c >= 17 => (LEA(Q|L)1 (SHL(Q|L)const [int8(log32(c-1))] x) x) -(MUL(Q|L)const [c] x) && isPowerOfTwo32(c-2) && c >= 34 => (LEA(Q|L)2 (SHL(Q|L)const [int8(log32(c-2))] x) x) -(MUL(Q|L)const [c] x) && isPowerOfTwo32(c-4) && c >= 68 => (LEA(Q|L)4 (SHL(Q|L)const [int8(log32(c-4))] x) x) -(MUL(Q|L)const [c] x) && isPowerOfTwo32(c-8) && c >= 136 => (LEA(Q|L)8 (SHL(Q|L)const [int8(log32(c-8))] x) x) -(MUL(Q|L)const [c] x) && c%3 == 0 && isPowerOfTwo32(c/3) => (SHL(Q|L)const [int8(log32(c/3))] (LEA(Q|L)2 x x)) -(MUL(Q|L)const [c] x) && c%5 == 0 && isPowerOfTwo32(c/5) => (SHL(Q|L)const [int8(log32(c/5))] (LEA(Q|L)4 x x)) -(MUL(Q|L)const [c] x) && c%9 == 0 && isPowerOfTwo32(c/9) => (SHL(Q|L)const [int8(log32(c/9))] (LEA(Q|L)8 x x)) +(MUL(Q|L)const [c] x) && isPowerOfTwo(int64(c)+1) && c >= 15 => (SUB(Q|L) (SHL(Q|L)const [int8(log64(int64(c)+1))] x) x) +(MUL(Q|L)const [c] x) && isPowerOfTwo(c-1) && c >= 17 => (LEA(Q|L)1 (SHL(Q|L)const [int8(log32(c-1))] x) x) +(MUL(Q|L)const [c] x) && isPowerOfTwo(c-2) && c >= 34 => (LEA(Q|L)2 (SHL(Q|L)const [int8(log32(c-2))] x) x) +(MUL(Q|L)const [c] x) && isPowerOfTwo(c-4) && c >= 68 => (LEA(Q|L)4 (SHL(Q|L)const [int8(log32(c-4))] x) x) +(MUL(Q|L)const [c] x) && isPowerOfTwo(c-8) && c >= 136 => (LEA(Q|L)8 (SHL(Q|L)const [int8(log32(c-8))] x) x) +(MUL(Q|L)const [c] x) && c%3 == 0 && isPowerOfTwo(c/3) => (SHL(Q|L)const [int8(log32(c/3))] (LEA(Q|L)2 x x)) +(MUL(Q|L)const [c] x) && c%5 == 0 && isPowerOfTwo(c/5) => (SHL(Q|L)const [int8(log32(c/5))] (LEA(Q|L)4 x x)) +(MUL(Q|L)const [c] x) && c%9 == 0 && isPowerOfTwo(c/9) => (SHL(Q|L)const [int8(log32(c/9))] (LEA(Q|L)8 x x)) // combine add/shift into LEAQ/LEAL (ADD(L|Q) x (SHL(L|Q)const [3] y)) => (LEA(L|Q)8 x y) diff --git a/src/cmd/compile/internal/ssa/_gen/ARM.rules b/src/cmd/compile/internal/ssa/_gen/ARM.rules index ed0ed80afa..9cdb5d8ad5 100644 --- a/src/cmd/compile/internal/ssa/_gen/ARM.rules +++ b/src/cmd/compile/internal/ssa/_gen/ARM.rules @@ -559,63 +559,63 @@ (MUL x (MOVWconst [c])) && int32(c) == -1 => (RSBconst [0] x) (MUL _ (MOVWconst [0])) => (MOVWconst [0]) (MUL x (MOVWconst [1])) => x -(MUL x (MOVWconst [c])) && isPowerOfTwo32(c) => (SLLconst [int32(log32(c))] x) -(MUL x (MOVWconst [c])) && isPowerOfTwo32(c-1) && c >= 3 => (ADDshiftLL x x [int32(log32(c-1))]) -(MUL x (MOVWconst [c])) && isPowerOfTwo32(c+1) && c >= 7 => (RSBshiftLL x x [int32(log32(c+1))]) -(MUL x (MOVWconst [c])) && c%3 == 0 && isPowerOfTwo32(c/3) => (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) -(MUL x (MOVWconst [c])) && c%5 == 0 && isPowerOfTwo32(c/5) => (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) -(MUL x (MOVWconst [c])) && c%7 == 0 && isPowerOfTwo32(c/7) => (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) -(MUL x (MOVWconst [c])) && c%9 == 0 && isPowerOfTwo32(c/9) => (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) +(MUL x (MOVWconst [c])) && isPowerOfTwo(c) => (SLLconst [int32(log32(c))] x) +(MUL x (MOVWconst [c])) && isPowerOfTwo(c-1) && c >= 3 => (ADDshiftLL x x [int32(log32(c-1))]) +(MUL x (MOVWconst [c])) && isPowerOfTwo(c+1) && c >= 7 => (RSBshiftLL x x [int32(log32(c+1))]) +(MUL x (MOVWconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) +(MUL x (MOVWconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) +(MUL x (MOVWconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) +(MUL x (MOVWconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) (MULA x (MOVWconst [c]) a) && c == -1 => (SUB a x) (MULA _ (MOVWconst [0]) a) => a (MULA x (MOVWconst [1]) a) => (ADD x a) -(MULA x (MOVWconst [c]) a) && isPowerOfTwo32(c) => (ADD (SLLconst [int32(log32(c))] x) a) -(MULA x (MOVWconst [c]) a) && isPowerOfTwo32(c-1) && c >= 3 => (ADD (ADDshiftLL x x [int32(log32(c-1))]) a) -(MULA x (MOVWconst [c]) a) && isPowerOfTwo32(c+1) && c >= 7 => (ADD (RSBshiftLL x x [int32(log32(c+1))]) a) -(MULA x (MOVWconst [c]) a) && c%3 == 0 && isPowerOfTwo32(c/3) => (ADD (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) -(MULA x (MOVWconst [c]) a) && c%5 == 0 && isPowerOfTwo32(c/5) => (ADD (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) -(MULA x (MOVWconst [c]) a) && c%7 == 0 && isPowerOfTwo32(c/7) => (ADD (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) -(MULA x (MOVWconst [c]) a) && c%9 == 0 && isPowerOfTwo32(c/9) => (ADD (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) +(MULA x (MOVWconst [c]) a) && isPowerOfTwo(c) => (ADD (SLLconst [int32(log32(c))] x) a) +(MULA x (MOVWconst [c]) a) && isPowerOfTwo(c-1) && c >= 3 => (ADD (ADDshiftLL x x [int32(log32(c-1))]) a) +(MULA x (MOVWconst [c]) a) && isPowerOfTwo(c+1) && c >= 7 => (ADD (RSBshiftLL x x [int32(log32(c+1))]) a) +(MULA x (MOVWconst [c]) a) && c%3 == 0 && isPowerOfTwo(c/3) => (ADD (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) +(MULA x (MOVWconst [c]) a) && c%5 == 0 && isPowerOfTwo(c/5) => (ADD (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) +(MULA x (MOVWconst [c]) a) && c%7 == 0 && isPowerOfTwo(c/7) => (ADD (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) +(MULA x (MOVWconst [c]) a) && c%9 == 0 && isPowerOfTwo(c/9) => (ADD (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) (MULA (MOVWconst [c]) x a) && c == -1 => (SUB a x) (MULA (MOVWconst [0]) _ a) => a (MULA (MOVWconst [1]) x a) => (ADD x a) -(MULA (MOVWconst [c]) x a) && isPowerOfTwo32(c) => (ADD (SLLconst [int32(log32(c))] x) a) -(MULA (MOVWconst [c]) x a) && isPowerOfTwo32(c-1) && c >= 3 => (ADD (ADDshiftLL x x [int32(log32(c-1))]) a) -(MULA (MOVWconst [c]) x a) && isPowerOfTwo32(c+1) && c >= 7 => (ADD (RSBshiftLL x x [int32(log32(c+1))]) a) -(MULA (MOVWconst [c]) x a) && c%3 == 0 && isPowerOfTwo32(c/3) => (ADD (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) -(MULA (MOVWconst [c]) x a) && c%5 == 0 && isPowerOfTwo32(c/5) => (ADD (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) -(MULA (MOVWconst [c]) x a) && c%7 == 0 && isPowerOfTwo32(c/7) => (ADD (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) -(MULA (MOVWconst [c]) x a) && c%9 == 0 && isPowerOfTwo32(c/9) => (ADD (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) +(MULA (MOVWconst [c]) x a) && isPowerOfTwo(c) => (ADD (SLLconst [int32(log32(c))] x) a) +(MULA (MOVWconst [c]) x a) && isPowerOfTwo(c-1) && c >= 3 => (ADD (ADDshiftLL x x [int32(log32(c-1))]) a) +(MULA (MOVWconst [c]) x a) && isPowerOfTwo(c+1) && c >= 7 => (ADD (RSBshiftLL x x [int32(log32(c+1))]) a) +(MULA (MOVWconst [c]) x a) && c%3 == 0 && isPowerOfTwo(c/3) => (ADD (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) +(MULA (MOVWconst [c]) x a) && c%5 == 0 && isPowerOfTwo(c/5) => (ADD (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) +(MULA (MOVWconst [c]) x a) && c%7 == 0 && isPowerOfTwo(c/7) => (ADD (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) +(MULA (MOVWconst [c]) x a) && c%9 == 0 && isPowerOfTwo(c/9) => (ADD (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) (MULS x (MOVWconst [c]) a) && c == -1 => (ADD a x) (MULS _ (MOVWconst [0]) a) => a (MULS x (MOVWconst [1]) a) => (RSB x a) -(MULS x (MOVWconst [c]) a) && isPowerOfTwo32(c) => (RSB (SLLconst [int32(log32(c))] x) a) -(MULS x (MOVWconst [c]) a) && isPowerOfTwo32(c-1) && c >= 3 => (RSB (ADDshiftLL x x [int32(log32(c-1))]) a) -(MULS x (MOVWconst [c]) a) && isPowerOfTwo32(c+1) && c >= 7 => (RSB (RSBshiftLL x x [int32(log32(c+1))]) a) -(MULS x (MOVWconst [c]) a) && c%3 == 0 && isPowerOfTwo32(c/3) => (RSB (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) -(MULS x (MOVWconst [c]) a) && c%5 == 0 && isPowerOfTwo32(c/5) => (RSB (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) -(MULS x (MOVWconst [c]) a) && c%7 == 0 && isPowerOfTwo32(c/7) => (RSB (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) -(MULS x (MOVWconst [c]) a) && c%9 == 0 && isPowerOfTwo32(c/9) => (RSB (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) +(MULS x (MOVWconst [c]) a) && isPowerOfTwo(c) => (RSB (SLLconst [int32(log32(c))] x) a) +(MULS x (MOVWconst [c]) a) && isPowerOfTwo(c-1) && c >= 3 => (RSB (ADDshiftLL x x [int32(log32(c-1))]) a) +(MULS x (MOVWconst [c]) a) && isPowerOfTwo(c+1) && c >= 7 => (RSB (RSBshiftLL x x [int32(log32(c+1))]) a) +(MULS x (MOVWconst [c]) a) && c%3 == 0 && isPowerOfTwo(c/3) => (RSB (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) +(MULS x (MOVWconst [c]) a) && c%5 == 0 && isPowerOfTwo(c/5) => (RSB (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) +(MULS x (MOVWconst [c]) a) && c%7 == 0 && isPowerOfTwo(c/7) => (RSB (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) +(MULS x (MOVWconst [c]) a) && c%9 == 0 && isPowerOfTwo(c/9) => (RSB (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) (MULS (MOVWconst [c]) x a) && c == -1 => (ADD a x) (MULS (MOVWconst [0]) _ a) => a (MULS (MOVWconst [1]) x a) => (RSB x a) -(MULS (MOVWconst [c]) x a) && isPowerOfTwo32(c) => (RSB (SLLconst [int32(log32(c))] x) a) -(MULS (MOVWconst [c]) x a) && isPowerOfTwo32(c-1) && c >= 3 => (RSB (ADDshiftLL x x [int32(log32(c-1))]) a) -(MULS (MOVWconst [c]) x a) && isPowerOfTwo32(c+1) && c >= 7 => (RSB (RSBshiftLL x x [int32(log32(c+1))]) a) -(MULS (MOVWconst [c]) x a) && c%3 == 0 && isPowerOfTwo32(c/3) => (RSB (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) -(MULS (MOVWconst [c]) x a) && c%5 == 0 && isPowerOfTwo32(c/5) => (RSB (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) -(MULS (MOVWconst [c]) x a) && c%7 == 0 && isPowerOfTwo32(c/7) => (RSB (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) -(MULS (MOVWconst [c]) x a) && c%9 == 0 && isPowerOfTwo32(c/9) => (RSB (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) +(MULS (MOVWconst [c]) x a) && isPowerOfTwo(c) => (RSB (SLLconst [int32(log32(c))] x) a) +(MULS (MOVWconst [c]) x a) && isPowerOfTwo(c-1) && c >= 3 => (RSB (ADDshiftLL x x [int32(log32(c-1))]) a) +(MULS (MOVWconst [c]) x a) && isPowerOfTwo(c+1) && c >= 7 => (RSB (RSBshiftLL x x [int32(log32(c+1))]) a) +(MULS (MOVWconst [c]) x a) && c%3 == 0 && isPowerOfTwo(c/3) => (RSB (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) +(MULS (MOVWconst [c]) x a) && c%5 == 0 && isPowerOfTwo(c/5) => (RSB (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) +(MULS (MOVWconst [c]) x a) && c%7 == 0 && isPowerOfTwo(c/7) => (RSB (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) +(MULS (MOVWconst [c]) x a) && c%9 == 0 && isPowerOfTwo(c/9) => (RSB (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) // div by constant (Select0 (CALLudiv x (MOVWconst [1]))) => x (Select1 (CALLudiv _ (MOVWconst [1]))) => (MOVWconst [0]) -(Select0 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo32(c) => (SRLconst [int32(log32(c))] x) -(Select1 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo32(c) => (ANDconst [c-1] x) +(Select0 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo(c) => (SRLconst [int32(log32(c))] x) +(Select1 (CALLudiv x (MOVWconst [c]))) && isPowerOfTwo(c) => (ANDconst [c-1] x) // constant comparisons (CMPconst (MOVWconst [x]) [y]) => (FlagConstant [subFlags32(x,y)]) diff --git a/src/cmd/compile/internal/ssa/_gen/ARM64.rules b/src/cmd/compile/internal/ssa/_gen/ARM64.rules index 21780d5a62..9064b515f7 100644 --- a/src/cmd/compile/internal/ssa/_gen/ARM64.rules +++ b/src/cmd/compile/internal/ssa/_gen/ARM64.rules @@ -1157,147 +1157,147 @@ (MUL x (MOVDconst [-1])) => (NEG x) (MUL _ (MOVDconst [0])) => (MOVDconst [0]) (MUL x (MOVDconst [1])) => x -(MUL x (MOVDconst [c])) && isPowerOfTwo64(c) => (SLLconst [log64(c)] x) -(MUL x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c >= 3 => (ADDshiftLL x x [log64(c-1)]) -(MUL x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c >= 7 => (ADDshiftLL (NEG x) x [log64(c+1)]) -(MUL x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SLLconst [log64(c/3)] (ADDshiftLL x x [1])) -(MUL x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (SLLconst [log64(c/5)] (ADDshiftLL x x [2])) -(MUL x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (SLLconst [log64(c/7)] (ADDshiftLL (NEG x) x [3])) -(MUL x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (SLLconst [log64(c/9)] (ADDshiftLL x x [3])) +(MUL x (MOVDconst [c])) && isPowerOfTwo(c) => (SLLconst [log64(c)] x) +(MUL x (MOVDconst [c])) && isPowerOfTwo(c-1) && c >= 3 => (ADDshiftLL x x [log64(c-1)]) +(MUL x (MOVDconst [c])) && isPowerOfTwo(c+1) && c >= 7 => (ADDshiftLL (NEG x) x [log64(c+1)]) +(MUL x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SLLconst [log64(c/3)] (ADDshiftLL x x [1])) +(MUL x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (SLLconst [log64(c/5)] (ADDshiftLL x x [2])) +(MUL x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SLLconst [log64(c/7)] (ADDshiftLL (NEG x) x [3])) +(MUL x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (SLLconst [log64(c/9)] (ADDshiftLL x x [3])) (MULW x (MOVDconst [c])) && int32(c)==-1 => (MOVWUreg (NEG x)) (MULW _ (MOVDconst [c])) && int32(c)==0 => (MOVDconst [0]) (MULW x (MOVDconst [c])) && int32(c)==1 => (MOVWUreg x) -(MULW x (MOVDconst [c])) && isPowerOfTwo64(c) => (MOVWUreg (SLLconst [log64(c)] x)) -(MULW x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c) >= 3 => (MOVWUreg (ADDshiftLL x x [log64(c-1)])) -(MULW x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c) >= 7 => (MOVWUreg (ADDshiftLL (NEG x) x [log64(c+1)])) -(MULW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/3)] (ADDshiftLL x x [1]))) -(MULW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/5)] (ADDshiftLL x x [2]))) -(MULW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/7)] (ADDshiftLL (NEG x) x [3]))) -(MULW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/9)] (ADDshiftLL x x [3]))) +(MULW x (MOVDconst [c])) && isPowerOfTwo(c) => (MOVWUreg (SLLconst [log64(c)] x)) +(MULW x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c) >= 3 => (MOVWUreg (ADDshiftLL x x [log64(c-1)])) +(MULW x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c) >= 7 => (MOVWUreg (ADDshiftLL (NEG x) x [log64(c+1)])) +(MULW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/3)] (ADDshiftLL x x [1]))) +(MULW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/5)] (ADDshiftLL x x [2]))) +(MULW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/7)] (ADDshiftLL (NEG x) x [3]))) +(MULW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/9)] (ADDshiftLL x x [3]))) // mneg by constant (MNEG x (MOVDconst [-1])) => x (MNEG _ (MOVDconst [0])) => (MOVDconst [0]) (MNEG x (MOVDconst [1])) => (NEG x) -(MNEG x (MOVDconst [c])) && isPowerOfTwo64(c) => (NEG (SLLconst [log64(c)] x)) -(MNEG x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c >= 3 => (NEG (ADDshiftLL x x [log64(c-1)])) -(MNEG x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c >= 7 => (NEG (ADDshiftLL (NEG x) x [log64(c+1)])) -(MNEG x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SLLconst [log64(c/3)] (SUBshiftLL x x [2])) -(MNEG x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (NEG (SLLconst [log64(c/5)] (ADDshiftLL x x [2]))) -(MNEG x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (SLLconst [log64(c/7)] (SUBshiftLL x x [3])) -(MNEG x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (NEG (SLLconst [log64(c/9)] (ADDshiftLL x x [3]))) +(MNEG x (MOVDconst [c])) && isPowerOfTwo(c) => (NEG (SLLconst [log64(c)] x)) +(MNEG x (MOVDconst [c])) && isPowerOfTwo(c-1) && c >= 3 => (NEG (ADDshiftLL x x [log64(c-1)])) +(MNEG x (MOVDconst [c])) && isPowerOfTwo(c+1) && c >= 7 => (NEG (ADDshiftLL (NEG x) x [log64(c+1)])) +(MNEG x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SLLconst [log64(c/3)] (SUBshiftLL x x [2])) +(MNEG x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (NEG (SLLconst [log64(c/5)] (ADDshiftLL x x [2]))) +(MNEG x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SLLconst [log64(c/7)] (SUBshiftLL x x [3])) +(MNEG x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (NEG (SLLconst [log64(c/9)] (ADDshiftLL x x [3]))) (MNEGW x (MOVDconst [c])) && int32(c)==-1 => (MOVWUreg x) (MNEGW _ (MOVDconst [c])) && int32(c)==0 => (MOVDconst [0]) (MNEGW x (MOVDconst [c])) && int32(c)==1 => (MOVWUreg (NEG x)) -(MNEGW x (MOVDconst [c])) && isPowerOfTwo64(c) => (NEG (SLLconst [log64(c)] x)) -(MNEGW x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c) >= 3 => (MOVWUreg (NEG (ADDshiftLL x x [log64(c-1)]))) -(MNEGW x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c) >= 7 => (MOVWUreg (NEG (ADDshiftLL (NEG x) x [log64(c+1)]))) -(MNEGW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/3)] (SUBshiftLL x x [2]))) -(MNEGW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (MOVWUreg (NEG (SLLconst [log64(c/5)] (ADDshiftLL x x [2])))) -(MNEGW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/7)] (SUBshiftLL x x [3]))) -(MNEGW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (MOVWUreg (NEG (SLLconst [log64(c/9)] (ADDshiftLL x x [3])))) +(MNEGW x (MOVDconst [c])) && isPowerOfTwo(c) => (NEG (SLLconst [log64(c)] x)) +(MNEGW x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c) >= 3 => (MOVWUreg (NEG (ADDshiftLL x x [log64(c-1)]))) +(MNEGW x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c) >= 7 => (MOVWUreg (NEG (ADDshiftLL (NEG x) x [log64(c+1)]))) +(MNEGW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/3)] (SUBshiftLL x x [2]))) +(MNEGW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (MOVWUreg (NEG (SLLconst [log64(c/5)] (ADDshiftLL x x [2])))) +(MNEGW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (MOVWUreg (SLLconst [log64(c/7)] (SUBshiftLL x x [3]))) +(MNEGW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (MOVWUreg (NEG (SLLconst [log64(c/9)] (ADDshiftLL x x [3])))) (MADD a x (MOVDconst [-1])) => (SUB a x) (MADD a _ (MOVDconst [0])) => a (MADD a x (MOVDconst [1])) => (ADD a x) -(MADD a x (MOVDconst [c])) && isPowerOfTwo64(c) => (ADDshiftLL a x [log64(c)]) -(MADD a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log64(c-1)])) -(MADD a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log64(c+1)])) -(MADD a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) -(MADD a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) -(MADD a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) -(MADD a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) +(MADD a x (MOVDconst [c])) && isPowerOfTwo(c) => (ADDshiftLL a x [log64(c)]) +(MADD a x (MOVDconst [c])) && isPowerOfTwo(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log64(c-1)])) +(MADD a x (MOVDconst [c])) && isPowerOfTwo(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log64(c+1)])) +(MADD a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) +(MADD a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) +(MADD a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) +(MADD a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) (MADD a (MOVDconst [-1]) x) => (SUB a x) (MADD a (MOVDconst [0]) _) => a (MADD a (MOVDconst [1]) x) => (ADD a x) -(MADD a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (ADDshiftLL a x [log64(c)]) -(MADD a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log64(c-1)])) -(MADD a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log64(c+1)])) -(MADD a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) -(MADD a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) -(MADD a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) -(MADD a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) +(MADD a (MOVDconst [c]) x) && isPowerOfTwo(c) => (ADDshiftLL a x [log64(c)]) +(MADD a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log64(c-1)])) +(MADD a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log64(c+1)])) +(MADD a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) +(MADD a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) +(MADD a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) +(MADD a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) (MADDW a x (MOVDconst [c])) && int32(c)==-1 => (MOVWUreg (SUB a x)) (MADDW a _ (MOVDconst [c])) && int32(c)==0 => (MOVWUreg a) (MADDW a x (MOVDconst [c])) && int32(c)==1 => (MOVWUreg (ADD a x)) -(MADDW a x (MOVDconst [c])) && isPowerOfTwo64(c) => (MOVWUreg (ADDshiftLL a x [log64(c)])) -(MADDW a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c)>=3 => (MOVWUreg (ADD a (ADDshiftLL x x [log64(c-1)]))) -(MADDW a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c)>=7 => (MOVWUreg (SUB a (SUBshiftLL x x [log64(c+1)]))) -(MADDW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) -(MADDW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) -(MADDW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) -(MADDW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) +(MADDW a x (MOVDconst [c])) && isPowerOfTwo(c) => (MOVWUreg (ADDshiftLL a x [log64(c)])) +(MADDW a x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c)>=3 => (MOVWUreg (ADD a (ADDshiftLL x x [log64(c-1)]))) +(MADDW a x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c)>=7 => (MOVWUreg (SUB a (SUBshiftLL x x [log64(c+1)]))) +(MADDW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) +(MADDW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) +(MADDW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) +(MADDW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) (MADDW a (MOVDconst [c]) x) && int32(c)==-1 => (MOVWUreg (SUB a x)) (MADDW a (MOVDconst [c]) _) && int32(c)==0 => (MOVWUreg a) (MADDW a (MOVDconst [c]) x) && int32(c)==1 => (MOVWUreg (ADD a x)) -(MADDW a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (MOVWUreg (ADDshiftLL a x [log64(c)])) -(MADDW a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && int32(c)>=3 => (MOVWUreg (ADD a (ADDshiftLL x x [log64(c-1)]))) -(MADDW a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && int32(c)>=7 => (MOVWUreg (SUB a (SUBshiftLL x x [log64(c+1)]))) -(MADDW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) -(MADDW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) -(MADDW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) -(MADDW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) +(MADDW a (MOVDconst [c]) x) && isPowerOfTwo(c) => (MOVWUreg (ADDshiftLL a x [log64(c)])) +(MADDW a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && int32(c)>=3 => (MOVWUreg (ADD a (ADDshiftLL x x [log64(c-1)]))) +(MADDW a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && int32(c)>=7 => (MOVWUreg (SUB a (SUBshiftLL x x [log64(c+1)]))) +(MADDW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) +(MADDW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) +(MADDW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) +(MADDW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) (MSUB a x (MOVDconst [-1])) => (ADD a x) (MSUB a _ (MOVDconst [0])) => a (MSUB a x (MOVDconst [1])) => (SUB a x) -(MSUB a x (MOVDconst [c])) && isPowerOfTwo64(c) => (SUBshiftLL a x [log64(c)]) -(MSUB a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log64(c-1)])) -(MSUB a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log64(c+1)])) -(MSUB a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) -(MSUB a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) -(MSUB a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) -(MSUB a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) +(MSUB a x (MOVDconst [c])) && isPowerOfTwo(c) => (SUBshiftLL a x [log64(c)]) +(MSUB a x (MOVDconst [c])) && isPowerOfTwo(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log64(c-1)])) +(MSUB a x (MOVDconst [c])) && isPowerOfTwo(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log64(c+1)])) +(MSUB a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) +(MSUB a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) +(MSUB a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) +(MSUB a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) (MSUB a (MOVDconst [-1]) x) => (ADD a x) (MSUB a (MOVDconst [0]) _) => a (MSUB a (MOVDconst [1]) x) => (SUB a x) -(MSUB a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (SUBshiftLL a x [log64(c)]) -(MSUB a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log64(c-1)])) -(MSUB a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log64(c+1)])) -(MSUB a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) -(MSUB a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) -(MSUB a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) -(MSUB a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) +(MSUB a (MOVDconst [c]) x) && isPowerOfTwo(c) => (SUBshiftLL a x [log64(c)]) +(MSUB a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log64(c-1)])) +(MSUB a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log64(c+1)])) +(MSUB a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) +(MSUB a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) +(MSUB a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) +(MSUB a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) (MSUBW a x (MOVDconst [c])) && int32(c)==-1 => (MOVWUreg (ADD a x)) (MSUBW a _ (MOVDconst [c])) && int32(c)==0 => (MOVWUreg a) (MSUBW a x (MOVDconst [c])) && int32(c)==1 => (MOVWUreg (SUB a x)) -(MSUBW a x (MOVDconst [c])) && isPowerOfTwo64(c) => (MOVWUreg (SUBshiftLL a x [log64(c)])) -(MSUBW a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c)>=3 => (MOVWUreg (SUB a (ADDshiftLL x x [log64(c-1)]))) -(MSUBW a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c)>=7 => (MOVWUreg (ADD a (SUBshiftLL x x [log64(c+1)]))) -(MSUBW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) -(MSUBW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) -(MSUBW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) -(MSUBW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) +(MSUBW a x (MOVDconst [c])) && isPowerOfTwo(c) => (MOVWUreg (SUBshiftLL a x [log64(c)])) +(MSUBW a x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c)>=3 => (MOVWUreg (SUB a (ADDshiftLL x x [log64(c-1)]))) +(MSUBW a x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c)>=7 => (MOVWUreg (ADD a (SUBshiftLL x x [log64(c+1)]))) +(MSUBW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) +(MSUBW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) +(MSUBW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) +(MSUBW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) (MSUBW a (MOVDconst [c]) x) && int32(c)==-1 => (MOVWUreg (ADD a x)) (MSUBW a (MOVDconst [c]) _) && int32(c)==0 => (MOVWUreg a) (MSUBW a (MOVDconst [c]) x) && int32(c)==1 => (MOVWUreg (SUB a x)) -(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (MOVWUreg (SUBshiftLL a x [log64(c)])) -(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && int32(c)>=3 => (MOVWUreg (SUB a (ADDshiftLL x x [log64(c-1)]))) -(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && int32(c)>=7 => (MOVWUreg (ADD a (SUBshiftLL x x [log64(c+1)]))) -(MSUBW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) -(MSUBW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) -(MSUBW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) -(MSUBW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) +(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo(c) => (MOVWUreg (SUBshiftLL a x [log64(c)])) +(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && int32(c)>=3 => (MOVWUreg (SUB a (ADDshiftLL x x [log64(c-1)]))) +(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && int32(c)>=7 => (MOVWUreg (ADD a (SUBshiftLL x x [log64(c+1)]))) +(MSUBW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) +(MSUBW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) +(MSUBW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) +(MSUBW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) // div by constant (UDIV x (MOVDconst [1])) => x -(UDIV x (MOVDconst [c])) && isPowerOfTwo64(c) => (SRLconst [log64(c)] x) +(UDIV x (MOVDconst [c])) && isPowerOfTwo(c) => (SRLconst [log64(c)] x) (UDIVW x (MOVDconst [c])) && uint32(c)==1 => (MOVWUreg x) -(UDIVW x (MOVDconst [c])) && isPowerOfTwo64(c) && is32Bit(c) => (SRLconst [log64(c)] (MOVWUreg x)) +(UDIVW x (MOVDconst [c])) && isPowerOfTwo(c) && is32Bit(c) => (SRLconst [log64(c)] (MOVWUreg x)) (UMOD _ (MOVDconst [1])) => (MOVDconst [0]) -(UMOD x (MOVDconst [c])) && isPowerOfTwo64(c) => (ANDconst [c-1] x) +(UMOD x (MOVDconst [c])) && isPowerOfTwo(c) => (ANDconst [c-1] x) (UMODW _ (MOVDconst [c])) && uint32(c)==1 => (MOVDconst [0]) -(UMODW x (MOVDconst [c])) && isPowerOfTwo64(c) && is32Bit(c) => (ANDconst [c-1] x) +(UMODW x (MOVDconst [c])) && isPowerOfTwo(c) && is32Bit(c) => (ANDconst [c-1] x) // generic simplifications (ADD x (NEG y)) => (SUB x y) diff --git a/src/cmd/compile/internal/ssa/_gen/LOONG64.rules b/src/cmd/compile/internal/ssa/_gen/LOONG64.rules index ae01b5eb24..74ec2f2b94 100644 --- a/src/cmd/compile/internal/ssa/_gen/LOONG64.rules +++ b/src/cmd/compile/internal/ssa/_gen/LOONG64.rules @@ -583,13 +583,13 @@ (MULV x (MOVVconst [-1])) => (NEGV x) (MULV _ (MOVVconst [0])) => (MOVVconst [0]) (MULV x (MOVVconst [1])) => x -(MULV x (MOVVconst [c])) && isPowerOfTwo64(c) => (SLLVconst [log64(c)] x) +(MULV x (MOVVconst [c])) && isPowerOfTwo(c) => (SLLVconst [log64(c)] x) // div by constant (DIVVU x (MOVVconst [1])) => x -(DIVVU x (MOVVconst [c])) && isPowerOfTwo64(c) => (SRLVconst [log64(c)] x) +(DIVVU x (MOVVconst [c])) && isPowerOfTwo(c) => (SRLVconst [log64(c)] x) (REMVU _ (MOVVconst [1])) => (MOVVconst [0]) // mod -(REMVU x (MOVVconst [c])) && isPowerOfTwo64(c) => (ANDconst [c-1] x) // mod +(REMVU x (MOVVconst [c])) && isPowerOfTwo(c) => (ANDconst [c-1] x) // mod // generic simplifications (ADDV x (NEGV y)) => (SUBV x y) diff --git a/src/cmd/compile/internal/ssa/_gen/MIPS.rules b/src/cmd/compile/internal/ssa/_gen/MIPS.rules index d6ae0101cb..f4e0467ea0 100644 --- a/src/cmd/compile/internal/ssa/_gen/MIPS.rules +++ b/src/cmd/compile/internal/ssa/_gen/MIPS.rules @@ -602,13 +602,13 @@ (Select0 (MULTU (MOVWconst [1]) _ )) => (MOVWconst [0]) (Select1 (MULTU (MOVWconst [-1]) x )) => (NEG x) (Select0 (MULTU (MOVWconst [-1]) x )) => (CMOVZ (ADDconst [-1] x) (MOVWconst [0]) x) -(Select1 (MULTU (MOVWconst [c]) x )) && isPowerOfTwo64(int64(uint32(c))) => (SLLconst [int32(log2uint32(int64(c)))] x) -(Select0 (MULTU (MOVWconst [c]) x )) && isPowerOfTwo64(int64(uint32(c))) => (SRLconst [int32(32-log2uint32(int64(c)))] x) +(Select1 (MULTU (MOVWconst [c]) x )) && isPowerOfTwo(int64(uint32(c))) => (SLLconst [int32(log2uint32(int64(c)))] x) +(Select0 (MULTU (MOVWconst [c]) x )) && isPowerOfTwo(int64(uint32(c))) => (SRLconst [int32(32-log2uint32(int64(c)))] x) (MUL (MOVWconst [0]) _ ) => (MOVWconst [0]) (MUL (MOVWconst [1]) x ) => x (MUL (MOVWconst [-1]) x ) => (NEG x) -(MUL (MOVWconst [c]) x ) && isPowerOfTwo64(int64(uint32(c))) => (SLLconst [int32(log2uint32(int64(c)))] x) +(MUL (MOVWconst [c]) x ) && isPowerOfTwo(int64(uint32(c))) => (SLLconst [int32(log2uint32(int64(c)))] x) // generic simplifications (ADD x (NEG y)) => (SUB x y) diff --git a/src/cmd/compile/internal/ssa/_gen/MIPS64.rules b/src/cmd/compile/internal/ssa/_gen/MIPS64.rules index cabc7c652d..8aed350039 100644 --- a/src/cmd/compile/internal/ssa/_gen/MIPS64.rules +++ b/src/cmd/compile/internal/ssa/_gen/MIPS64.rules @@ -709,13 +709,13 @@ (Select1 (MULVU x (MOVVconst [-1]))) => (NEGV x) (Select1 (MULVU _ (MOVVconst [0]))) => (MOVVconst [0]) (Select1 (MULVU x (MOVVconst [1]))) => x -(Select1 (MULVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (SLLVconst [log64(c)] x) +(Select1 (MULVU x (MOVVconst [c]))) && isPowerOfTwo(c) => (SLLVconst [log64(c)] x) // div by constant (Select1 (DIVVU x (MOVVconst [1]))) => x -(Select1 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (SRLVconst [log64(c)] x) +(Select1 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo(c) => (SRLVconst [log64(c)] x) (Select0 (DIVVU _ (MOVVconst [1]))) => (MOVVconst [0]) // mod -(Select0 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (ANDconst [c-1] x) // mod +(Select0 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo(c) => (ANDconst [c-1] x) // mod // generic simplifications (ADDV x (NEGV y)) => (SUBV x y) diff --git a/src/cmd/compile/internal/ssa/_gen/S390X.rules b/src/cmd/compile/internal/ssa/_gen/S390X.rules index bda94004a4..462cf8f701 100644 --- a/src/cmd/compile/internal/ssa/_gen/S390X.rules +++ b/src/cmd/compile/internal/ssa/_gen/S390X.rules @@ -810,22 +810,22 @@ // // Notes: // - the generic rules have already matched single powers of two so we ignore them here -// - isPowerOfTwo32 asserts that its argument is greater than 0 +// - isPowerOfTwo asserts that its argument is greater than 0 // - c&(c-1) = clear rightmost bit // - c&^(c-1) = isolate rightmost bit // c = 2ˣ + 2ʸ => c - 2ˣ = 2ʸ -(MULL(D|W)const x [c]) && isPowerOfTwo32(c&(c-1)) +(MULL(D|W)const x [c]) && isPowerOfTwo(c&(c-1)) => ((ADD|ADDW) (SL(D|W)const x [uint8(log32(c&(c-1)))]) (SL(D|W)const x [uint8(log32(c&^(c-1)))])) // c = 2ʸ - 2ˣ => c + 2ˣ = 2ʸ -(MULL(D|W)const x [c]) && isPowerOfTwo32(c+(c&^(c-1))) +(MULL(D|W)const x [c]) && isPowerOfTwo(c+(c&^(c-1))) => ((SUB|SUBW) (SL(D|W)const x [uint8(log32(c+(c&^(c-1))))]) (SL(D|W)const x [uint8(log32(c&^(c-1)))])) // c = 2ˣ - 2ʸ => -c + 2ˣ = 2ʸ -(MULL(D|W)const x [c]) && isPowerOfTwo32(-c+(-c&^(-c-1))) +(MULL(D|W)const x [c]) && isPowerOfTwo(-c+(-c&^(-c-1))) => ((SUB|SUBW) (SL(D|W)const x [uint8(log32(-c&^(-c-1)))]) (SL(D|W)const x [uint8(log32(-c+(-c&^(-c-1))))])) diff --git a/src/cmd/compile/internal/ssa/_gen/generic.rules b/src/cmd/compile/internal/ssa/_gen/generic.rules index 65cd985484..3f4e41e68c 100644 --- a/src/cmd/compile/internal/ssa/_gen/generic.rules +++ b/src/cmd/compile/internal/ssa/_gen/generic.rules @@ -189,14 +189,14 @@ (Or(8|16|32|64) (Com(8|16|32|64) x) (Com(8|16|32|64) y)) => (Com(8|16|32|64) (And(8|16|32|64) x y)) // Convert multiplication by a power of two to a shift. -(Mul8 n (Const8 [c])) && isPowerOfTwo8(c) => (Lsh8x64 n (Const64 [log8(c)])) -(Mul16 n (Const16 [c])) && isPowerOfTwo16(c) => (Lsh16x64 n (Const64 [log16(c)])) -(Mul32 n (Const32 [c])) && isPowerOfTwo32(c) => (Lsh32x64 n (Const64 [log32(c)])) -(Mul64 n (Const64 [c])) && isPowerOfTwo64(c) => (Lsh64x64 n (Const64 [log64(c)])) -(Mul8 n (Const8 [c])) && t.IsSigned() && isPowerOfTwo8(-c) => (Neg8 (Lsh8x64 n (Const64 [log8(-c)]))) -(Mul16 n (Const16 [c])) && t.IsSigned() && isPowerOfTwo16(-c) => (Neg16 (Lsh16x64 n (Const64 [log16(-c)]))) -(Mul32 n (Const32 [c])) && t.IsSigned() && isPowerOfTwo32(-c) => (Neg32 (Lsh32x64 n (Const64 [log32(-c)]))) -(Mul64 n (Const64 [c])) && t.IsSigned() && isPowerOfTwo64(-c) => (Neg64 (Lsh64x64 n (Const64 [log64(-c)]))) +(Mul8 n (Const8 [c])) && isPowerOfTwo(c) => (Lsh8x64 n (Const64 [log8(c)])) +(Mul16 n (Const16 [c])) && isPowerOfTwo(c) => (Lsh16x64 n (Const64 [log16(c)])) +(Mul32 n (Const32 [c])) && isPowerOfTwo(c) => (Lsh32x64 n (Const64 [log32(c)])) +(Mul64 n (Const64 [c])) && isPowerOfTwo(c) => (Lsh64x64 n (Const64 [log64(c)])) +(Mul8 n (Const8 [c])) && t.IsSigned() && isPowerOfTwo(-c) => (Neg8 (Lsh8x64 n (Const64 [log8(-c)]))) +(Mul16 n (Const16 [c])) && t.IsSigned() && isPowerOfTwo(-c) => (Neg16 (Lsh16x64 n (Const64 [log16(-c)]))) +(Mul32 n (Const32 [c])) && t.IsSigned() && isPowerOfTwo(-c) => (Neg32 (Lsh32x64 n (Const64 [log32(-c)]))) +(Mul64 n (Const64 [c])) && t.IsSigned() && isPowerOfTwo(-c) => (Neg64 (Lsh64x64 n (Const64 [log64(-c)]))) (Mod8 (Const8 [c]) (Const8 [d])) && d != 0 => (Const8 [c % d]) (Mod16 (Const16 [c]) (Const16 [d])) && d != 0 => (Const16 [c % d]) @@ -1045,17 +1045,17 @@ // See ../magic.go for a detailed description of these algorithms. // Unsigned divide by power of 2. Strength reduce to a shift. -(Div8u n (Const8 [c])) && isPowerOfTwo8(c) => (Rsh8Ux64 n (Const64 [log8(c)])) -(Div16u n (Const16 [c])) && isPowerOfTwo16(c) => (Rsh16Ux64 n (Const64 [log16(c)])) -(Div32u n (Const32 [c])) && isPowerOfTwo32(c) => (Rsh32Ux64 n (Const64 [log32(c)])) -(Div64u n (Const64 [c])) && isPowerOfTwo64(c) => (Rsh64Ux64 n (Const64 [log64(c)])) +(Div8u n (Const8 [c])) && isPowerOfTwo(c) => (Rsh8Ux64 n (Const64 [log8(c)])) +(Div16u n (Const16 [c])) && isPowerOfTwo(c) => (Rsh16Ux64 n (Const64 [log16(c)])) +(Div32u n (Const32 [c])) && isPowerOfTwo(c) => (Rsh32Ux64 n (Const64 [log32(c)])) +(Div64u n (Const64 [c])) && isPowerOfTwo(c) => (Rsh64Ux64 n (Const64 [log64(c)])) (Div64u n (Const64 [-1<<63])) => (Rsh64Ux64 n (Const64 [63])) // Signed non-negative divide by power of 2. -(Div8 n (Const8 [c])) && isNonNegative(n) && isPowerOfTwo8(c) => (Rsh8Ux64 n (Const64 [log8(c)])) -(Div16 n (Const16 [c])) && isNonNegative(n) && isPowerOfTwo16(c) => (Rsh16Ux64 n (Const64 [log16(c)])) -(Div32 n (Const32 [c])) && isNonNegative(n) && isPowerOfTwo32(c) => (Rsh32Ux64 n (Const64 [log32(c)])) -(Div64 n (Const64 [c])) && isNonNegative(n) && isPowerOfTwo64(c) => (Rsh64Ux64 n (Const64 [log64(c)])) +(Div8 n (Const8 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (Rsh8Ux64 n (Const64 [log8(c)])) +(Div16 n (Const16 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (Rsh16Ux64 n (Const64 [log16(c)])) +(Div32 n (Const32 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (Rsh32Ux64 n (Const64 [log32(c)])) +(Div64 n (Const64 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (Rsh64Ux64 n (Const64 [log64(c)])) (Div64 n (Const64 [-1<<63])) && isNonNegative(n) => (Const64 [0]) // Unsigned divide, not a power of 2. Strength reduce to a multiply. @@ -1231,19 +1231,19 @@ // n / c = n >> log(c) if n >= 0 // = (n+c-1) >> log(c) if n < 0 // We conditionally add c-1 by adding n>>63>>(64-log(c)) (first shift signed, second shift unsigned). -(Div8 n (Const8 [c])) && isPowerOfTwo8(c) => +(Div8 n (Const8 [c])) && isPowerOfTwo(c) => (Rsh8x64 (Add8 n (Rsh8Ux64 (Rsh8x64 n (Const64 [ 7])) (Const64 [int64( 8-log8(c))]))) (Const64 [int64(log8(c))])) -(Div16 n (Const16 [c])) && isPowerOfTwo16(c) => +(Div16 n (Const16 [c])) && isPowerOfTwo(c) => (Rsh16x64 (Add16 n (Rsh16Ux64 (Rsh16x64 n (Const64 [15])) (Const64 [int64(16-log16(c))]))) (Const64 [int64(log16(c))])) -(Div32 n (Const32 [c])) && isPowerOfTwo32(c) => +(Div32 n (Const32 [c])) && isPowerOfTwo(c) => (Rsh32x64 (Add32 n (Rsh32Ux64 (Rsh32x64 n (Const64 [31])) (Const64 [int64(32-log32(c))]))) (Const64 [int64(log32(c))])) -(Div64 n (Const64 [c])) && isPowerOfTwo64(c) => +(Div64 n (Const64 [c])) && isPowerOfTwo(c) => (Rsh64x64 (Add64 n (Rsh64Ux64 (Rsh64x64 n (Const64 [63])) (Const64 [int64(64-log64(c))]))) (Const64 [int64(log64(c))])) @@ -1325,17 +1325,17 @@ (Const64 [63]))) // Unsigned mod by power of 2 constant. -(Mod8u n (Const8 [c])) && isPowerOfTwo8(c) => (And8 n (Const8 [c-1])) -(Mod16u n (Const16 [c])) && isPowerOfTwo16(c) => (And16 n (Const16 [c-1])) -(Mod32u n (Const32 [c])) && isPowerOfTwo32(c) => (And32 n (Const32 [c-1])) -(Mod64u n (Const64 [c])) && isPowerOfTwo64(c) => (And64 n (Const64 [c-1])) +(Mod8u n (Const8 [c])) && isPowerOfTwo(c) => (And8 n (Const8 [c-1])) +(Mod16u n (Const16 [c])) && isPowerOfTwo(c) => (And16 n (Const16 [c-1])) +(Mod32u n (Const32 [c])) && isPowerOfTwo(c) => (And32 n (Const32 [c-1])) +(Mod64u n (Const64 [c])) && isPowerOfTwo(c) => (And64 n (Const64 [c-1])) (Mod64u n (Const64 [-1<<63])) => (And64 n (Const64 [1<<63-1])) // Signed non-negative mod by power of 2 constant. -(Mod8 n (Const8 [c])) && isNonNegative(n) && isPowerOfTwo8(c) => (And8 n (Const8 [c-1])) -(Mod16 n (Const16 [c])) && isNonNegative(n) && isPowerOfTwo16(c) => (And16 n (Const16 [c-1])) -(Mod32 n (Const32 [c])) && isNonNegative(n) && isPowerOfTwo32(c) => (And32 n (Const32 [c-1])) -(Mod64 n (Const64 [c])) && isNonNegative(n) && isPowerOfTwo64(c) => (And64 n (Const64 [c-1])) +(Mod8 n (Const8 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (And8 n (Const8 [c-1])) +(Mod16 n (Const16 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (And16 n (Const16 [c-1])) +(Mod32 n (Const32 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (And32 n (Const32 [c-1])) +(Mod64 n (Const64 [c])) && isNonNegative(n) && isPowerOfTwo(c) => (And64 n (Const64 [c-1])) (Mod64 n (Const64 [-1<<63])) && isNonNegative(n) => n // Signed mod by negative constant. diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index 55417db8a6..687f6a8537 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -475,16 +475,7 @@ func log2uint32(n int64) int64 { } // isPowerOfTwoX functions report whether n is a power of 2. -func isPowerOfTwo8(n int8) bool { - return n > 0 && n&(n-1) == 0 -} -func isPowerOfTwo16(n int16) bool { - return n > 0 && n&(n-1) == 0 -} -func isPowerOfTwo32(n int32) bool { - return n > 0 && n&(n-1) == 0 -} -func isPowerOfTwo64(n int64) bool { +func isPowerOfTwo[T int8 | int16 | int32 | int64](n T) bool { return n > 0 && n&(n-1) == 0 } @@ -1820,7 +1811,7 @@ func (bfc arm64BitField) width() int64 { // checks if mask >> rshift applied at lsb is a valid arm64 bitfield op mask. func isARM64BFMask(lsb, mask, rshift int64) bool { shiftedMask := int64(uint64(mask) >> uint64(rshift)) - return shiftedMask != 0 && isPowerOfTwo64(shiftedMask+1) && nto(shiftedMask)+lsb < 64 + return shiftedMask != 0 && isPowerOfTwo(shiftedMask+1) && nto(shiftedMask)+lsb < 64 } // returns the bitfield width of mask >> rshift for arm64 bitfield ops. diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go index b0512676c9..ce74d75158 100644 --- a/src/cmd/compile/internal/ssa/rewrite386.go +++ b/src/cmd/compile/internal/ssa/rewrite386.go @@ -5273,12 +5273,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c+1) && c >= 15 + // cond: isPowerOfTwo(c+1) && c >= 15 // result: (SUBL (SHLLconst [int32(log32(c+1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c+1) && c >= 15) { + if !(isPowerOfTwo(c+1) && c >= 15) { break } v.reset(Op386SUBL) @@ -5289,12 +5289,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-1) && c >= 17 + // cond: isPowerOfTwo(c-1) && c >= 17 // result: (LEAL1 (SHLLconst [int32(log32(c-1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-1) && c >= 17) { + if !(isPowerOfTwo(c-1) && c >= 17) { break } v.reset(Op386LEAL1) @@ -5305,12 +5305,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-2) && c >= 34 + // cond: isPowerOfTwo(c-2) && c >= 34 // result: (LEAL2 (SHLLconst [int32(log32(c-2))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-2) && c >= 34) { + if !(isPowerOfTwo(c-2) && c >= 34) { break } v.reset(Op386LEAL2) @@ -5321,12 +5321,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-4) && c >= 68 + // cond: isPowerOfTwo(c-4) && c >= 68 // result: (LEAL4 (SHLLconst [int32(log32(c-4))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-4) && c >= 68) { + if !(isPowerOfTwo(c-4) && c >= 68) { break } v.reset(Op386LEAL4) @@ -5337,12 +5337,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-8) && c >= 136 + // cond: isPowerOfTwo(c-8) && c >= 136 // result: (LEAL8 (SHLLconst [int32(log32(c-8))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-8) && c >= 136) { + if !(isPowerOfTwo(c-8) && c >= 136) { break } v.reset(Op386LEAL8) @@ -5353,12 +5353,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SHLLconst [int32(log32(c/3))] (LEAL2 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(Op386SHLLconst) @@ -5369,12 +5369,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SHLLconst [int32(log32(c/5))] (LEAL4 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(Op386SHLLconst) @@ -5385,12 +5385,12 @@ func rewriteValue386_Op386MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SHLLconst [int32(log32(c/9))] (LEAL8 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(Op386SHLLconst) diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index b3a644cbed..77d53997f6 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -13400,12 +13400,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo64(int64(c)+1) && c >= 15 + // cond: isPowerOfTwo(int64(c)+1) && c >= 15 // result: (SUBL (SHLLconst [int8(log64(int64(c)+1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo64(int64(c)+1) && c >= 15) { + if !(isPowerOfTwo(int64(c)+1) && c >= 15) { break } v.reset(OpAMD64SUBL) @@ -13416,12 +13416,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-1) && c >= 17 + // cond: isPowerOfTwo(c-1) && c >= 17 // result: (LEAL1 (SHLLconst [int8(log32(c-1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-1) && c >= 17) { + if !(isPowerOfTwo(c-1) && c >= 17) { break } v.reset(OpAMD64LEAL1) @@ -13432,12 +13432,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-2) && c >= 34 + // cond: isPowerOfTwo(c-2) && c >= 34 // result: (LEAL2 (SHLLconst [int8(log32(c-2))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-2) && c >= 34) { + if !(isPowerOfTwo(c-2) && c >= 34) { break } v.reset(OpAMD64LEAL2) @@ -13448,12 +13448,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-4) && c >= 68 + // cond: isPowerOfTwo(c-4) && c >= 68 // result: (LEAL4 (SHLLconst [int8(log32(c-4))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-4) && c >= 68) { + if !(isPowerOfTwo(c-4) && c >= 68) { break } v.reset(OpAMD64LEAL4) @@ -13464,12 +13464,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo32(c-8) && c >= 136 + // cond: isPowerOfTwo(c-8) && c >= 136 // result: (LEAL8 (SHLLconst [int8(log32(c-8))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-8) && c >= 136) { + if !(isPowerOfTwo(c-8) && c >= 136) { break } v.reset(OpAMD64LEAL8) @@ -13480,12 +13480,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SHLLconst [int8(log32(c/3))] (LEAL2 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpAMD64SHLLconst) @@ -13496,12 +13496,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SHLLconst [int8(log32(c/5))] (LEAL4 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpAMD64SHLLconst) @@ -13512,12 +13512,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SHLLconst [int8(log32(c/9))] (LEAL8 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpAMD64SHLLconst) @@ -13847,12 +13847,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: isPowerOfTwo64(int64(c)+1) && c >= 15 + // cond: isPowerOfTwo(int64(c)+1) && c >= 15 // result: (SUBQ (SHLQconst [int8(log64(int64(c)+1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo64(int64(c)+1) && c >= 15) { + if !(isPowerOfTwo(int64(c)+1) && c >= 15) { break } v.reset(OpAMD64SUBQ) @@ -13863,12 +13863,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: isPowerOfTwo32(c-1) && c >= 17 + // cond: isPowerOfTwo(c-1) && c >= 17 // result: (LEAQ1 (SHLQconst [int8(log32(c-1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-1) && c >= 17) { + if !(isPowerOfTwo(c-1) && c >= 17) { break } v.reset(OpAMD64LEAQ1) @@ -13879,12 +13879,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: isPowerOfTwo32(c-2) && c >= 34 + // cond: isPowerOfTwo(c-2) && c >= 34 // result: (LEAQ2 (SHLQconst [int8(log32(c-2))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-2) && c >= 34) { + if !(isPowerOfTwo(c-2) && c >= 34) { break } v.reset(OpAMD64LEAQ2) @@ -13895,12 +13895,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: isPowerOfTwo32(c-4) && c >= 68 + // cond: isPowerOfTwo(c-4) && c >= 68 // result: (LEAQ4 (SHLQconst [int8(log32(c-4))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-4) && c >= 68) { + if !(isPowerOfTwo(c-4) && c >= 68) { break } v.reset(OpAMD64LEAQ4) @@ -13911,12 +13911,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: isPowerOfTwo32(c-8) && c >= 136 + // cond: isPowerOfTwo(c-8) && c >= 136 // result: (LEAQ8 (SHLQconst [int8(log32(c-8))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c-8) && c >= 136) { + if !(isPowerOfTwo(c-8) && c >= 136) { break } v.reset(OpAMD64LEAQ8) @@ -13927,12 +13927,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SHLQconst [int8(log32(c/3))] (LEAQ2 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpAMD64SHLQconst) @@ -13943,12 +13943,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SHLQconst [int8(log32(c/5))] (LEAQ4 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpAMD64SHLQconst) @@ -13959,12 +13959,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SHLQconst [int8(log32(c/9))] (LEAQ8 x x)) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpAMD64SHLQconst) diff --git a/src/cmd/compile/internal/ssa/rewriteARM.go b/src/cmd/compile/internal/ssa/rewriteARM.go index 971c9a5d55..09be5ccf68 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM.go +++ b/src/cmd/compile/internal/ssa/rewriteARM.go @@ -7009,7 +7009,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (SLLconst [int32(log32(c))] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7018,7 +7018,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpARMSLLconst) @@ -7029,7 +7029,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: isPowerOfTwo32(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (ADDshiftLL x x [int32(log32(c-1))]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7038,7 +7038,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { continue } v.reset(OpARMADDshiftLL) @@ -7049,7 +7049,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: isPowerOfTwo32(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (RSBshiftLL x x [int32(log32(c+1))]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7058,7 +7058,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { continue } v.reset(OpARMRSBshiftLL) @@ -7069,7 +7069,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7078,7 +7078,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { continue } v.reset(OpARMSLLconst) @@ -7092,7 +7092,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7101,7 +7101,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { continue } v.reset(OpARMSLLconst) @@ -7115,7 +7115,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: c%7 == 0 && isPowerOfTwo32(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7124,7 +7124,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo32(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { continue } v.reset(OpARMSLLconst) @@ -7138,7 +7138,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { break } // match: (MUL x (MOVWconst [c])) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7147,7 +7147,7 @@ func rewriteValueARM_OpARMMUL(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { continue } v.reset(OpARMSLLconst) @@ -7225,7 +7225,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (ADD (SLLconst [int32(log32(c))] x) a) for { x := v_0 @@ -7234,7 +7234,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARMADD) @@ -7245,7 +7245,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: isPowerOfTwo32(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (ADD (ADDshiftLL x x [int32(log32(c-1))]) a) for { x := v_0 @@ -7254,7 +7254,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(isPowerOfTwo32(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARMADD) @@ -7265,7 +7265,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: isPowerOfTwo32(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (ADD (RSBshiftLL x x [int32(log32(c+1))]) a) for { x := v_0 @@ -7274,7 +7274,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(isPowerOfTwo32(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARMADD) @@ -7285,7 +7285,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (ADD (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) for { x := v_0 @@ -7294,7 +7294,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARMADD) @@ -7308,7 +7308,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (ADD (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) for { x := v_0 @@ -7317,7 +7317,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARMADD) @@ -7331,7 +7331,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: c%7 == 0 && isPowerOfTwo32(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (ADD (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) for { x := v_0 @@ -7340,7 +7340,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%7 == 0 && isPowerOfTwo32(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARMADD) @@ -7354,7 +7354,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA x (MOVWconst [c]) a) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (ADD (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) for { x := v_0 @@ -7363,7 +7363,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARMADD) @@ -7416,7 +7416,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (ADD (SLLconst [int32(log32(c))] x) a) for { if v_0.Op != OpARMMOVWconst { @@ -7425,7 +7425,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARMADD) @@ -7436,7 +7436,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: isPowerOfTwo32(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (ADD (ADDshiftLL x x [int32(log32(c-1))]) a) for { if v_0.Op != OpARMMOVWconst { @@ -7445,7 +7445,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(isPowerOfTwo32(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARMADD) @@ -7456,7 +7456,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: isPowerOfTwo32(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (ADD (RSBshiftLL x x [int32(log32(c+1))]) a) for { if v_0.Op != OpARMMOVWconst { @@ -7465,7 +7465,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(isPowerOfTwo32(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARMADD) @@ -7476,7 +7476,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (ADD (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7485,7 +7485,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARMADD) @@ -7499,7 +7499,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (ADD (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7508,7 +7508,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARMADD) @@ -7522,7 +7522,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: c%7 == 0 && isPowerOfTwo32(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (ADD (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7531,7 +7531,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%7 == 0 && isPowerOfTwo32(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARMADD) @@ -7545,7 +7545,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { return true } // match: (MULA (MOVWconst [c]) x a) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (ADD (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7554,7 +7554,7 @@ func rewriteValueARM_OpARMMULA(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARMADD) @@ -7679,7 +7679,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (RSB (SLLconst [int32(log32(c))] x) a) for { x := v_0 @@ -7688,7 +7688,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARMRSB) @@ -7699,7 +7699,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: isPowerOfTwo32(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (RSB (ADDshiftLL x x [int32(log32(c-1))]) a) for { x := v_0 @@ -7708,7 +7708,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(isPowerOfTwo32(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARMRSB) @@ -7719,7 +7719,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: isPowerOfTwo32(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (RSB (RSBshiftLL x x [int32(log32(c+1))]) a) for { x := v_0 @@ -7728,7 +7728,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(isPowerOfTwo32(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARMRSB) @@ -7739,7 +7739,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (RSB (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) for { x := v_0 @@ -7748,7 +7748,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARMRSB) @@ -7762,7 +7762,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (RSB (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) for { x := v_0 @@ -7771,7 +7771,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARMRSB) @@ -7785,7 +7785,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: c%7 == 0 && isPowerOfTwo32(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (RSB (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) for { x := v_0 @@ -7794,7 +7794,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%7 == 0 && isPowerOfTwo32(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARMRSB) @@ -7808,7 +7808,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS x (MOVWconst [c]) a) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (RSB (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) for { x := v_0 @@ -7817,7 +7817,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { } c := auxIntToInt32(v_1.AuxInt) a := v_2 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARMRSB) @@ -7870,7 +7870,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (RSB (SLLconst [int32(log32(c))] x) a) for { if v_0.Op != OpARMMOVWconst { @@ -7879,7 +7879,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARMRSB) @@ -7890,7 +7890,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: isPowerOfTwo32(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (RSB (ADDshiftLL x x [int32(log32(c-1))]) a) for { if v_0.Op != OpARMMOVWconst { @@ -7899,7 +7899,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(isPowerOfTwo32(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARMRSB) @@ -7910,7 +7910,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: isPowerOfTwo32(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (RSB (RSBshiftLL x x [int32(log32(c+1))]) a) for { if v_0.Op != OpARMMOVWconst { @@ -7919,7 +7919,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(isPowerOfTwo32(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARMRSB) @@ -7930,7 +7930,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: c%3 == 0 && isPowerOfTwo32(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (RSB (SLLconst [int32(log32(c/3))] (ADDshiftLL x x [1])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7939,7 +7939,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%3 == 0 && isPowerOfTwo32(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARMRSB) @@ -7953,7 +7953,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: c%5 == 0 && isPowerOfTwo32(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (RSB (SLLconst [int32(log32(c/5))] (ADDshiftLL x x [2])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7962,7 +7962,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%5 == 0 && isPowerOfTwo32(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARMRSB) @@ -7976,7 +7976,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: c%7 == 0 && isPowerOfTwo32(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (RSB (SLLconst [int32(log32(c/7))] (RSBshiftLL x x [3])) a) for { if v_0.Op != OpARMMOVWconst { @@ -7985,7 +7985,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%7 == 0 && isPowerOfTwo32(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARMRSB) @@ -7999,7 +7999,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { return true } // match: (MULS (MOVWconst [c]) x a) - // cond: c%9 == 0 && isPowerOfTwo32(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (RSB (SLLconst [int32(log32(c/9))] (ADDshiftLL x x [3])) a) for { if v_0.Op != OpARMMOVWconst { @@ -8008,7 +8008,7 @@ func rewriteValueARM_OpARMMULS(v *Value) bool { c := auxIntToInt32(v_0.AuxInt) x := v_1 a := v_2 - if !(c%9 == 0 && isPowerOfTwo32(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARMRSB) @@ -15734,7 +15734,7 @@ func rewriteValueARM_OpSelect0(v *Value) bool { return true } // match: (Select0 (CALLudiv x (MOVWconst [c]))) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (SRLconst [int32(log32(c))] x) for { if v_0.Op != OpARMCALLudiv { @@ -15747,7 +15747,7 @@ func rewriteValueARM_OpSelect0(v *Value) bool { break } c := auxIntToInt32(v_0_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARMSRLconst) @@ -15800,7 +15800,7 @@ func rewriteValueARM_OpSelect1(v *Value) bool { return true } // match: (Select1 (CALLudiv x (MOVWconst [c]))) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (ANDconst [c-1] x) for { if v_0.Op != OpARMCALLudiv { @@ -15813,7 +15813,7 @@ func rewriteValueARM_OpSelect1(v *Value) bool { break } c := auxIntToInt32(v_0_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARMANDconst) diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go index e3e469349f..571046b5b8 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM64.go +++ b/src/cmd/compile/internal/ssa/rewriteARM64.go @@ -6813,7 +6813,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (ADDshiftLL a x [log64(c)]) for { a := v_0 @@ -6822,7 +6822,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -6831,7 +6831,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && c>=3 + // cond: isPowerOfTwo(c-1) && c>=3 // result: (ADD a (ADDshiftLL x x [log64(c-1)])) for { a := v_0 @@ -6840,7 +6840,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARM64ADD) @@ -6851,7 +6851,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && c>=7 + // cond: isPowerOfTwo(c+1) && c>=7 // result: (SUB a (SUBshiftLL x x [log64(c+1)])) for { a := v_0 @@ -6860,7 +6860,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARM64SUB) @@ -6871,7 +6871,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) for { a := v_0 @@ -6880,7 +6880,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARM64SUBshiftLL) @@ -6892,7 +6892,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) for { a := v_0 @@ -6901,7 +6901,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARM64ADDshiftLL) @@ -6913,7 +6913,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) for { a := v_0 @@ -6922,7 +6922,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARM64SUBshiftLL) @@ -6934,7 +6934,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) for { a := v_0 @@ -6943,7 +6943,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARM64ADDshiftLL) @@ -6989,7 +6989,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (ADDshiftLL a x [log64(c)]) for { a := v_0 @@ -6998,7 +6998,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -7007,7 +7007,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c-1) && c>=3 + // cond: isPowerOfTwo(c-1) && c>=3 // result: (ADD a (ADDshiftLL x x [log64(c-1)])) for { a := v_0 @@ -7016,7 +7016,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARM64ADD) @@ -7027,7 +7027,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c+1) && c>=7 + // cond: isPowerOfTwo(c+1) && c>=7 // result: (SUB a (SUBshiftLL x x [log64(c+1)])) for { a := v_0 @@ -7036,7 +7036,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARM64SUB) @@ -7047,7 +7047,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) for { a := v_0 @@ -7056,7 +7056,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo64(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARM64SUBshiftLL) @@ -7068,7 +7068,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) for { a := v_0 @@ -7077,7 +7077,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo64(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARM64ADDshiftLL) @@ -7089,7 +7089,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) for { a := v_0 @@ -7098,7 +7098,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo64(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARM64SUBshiftLL) @@ -7110,7 +7110,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) for { a := v_0 @@ -7119,7 +7119,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo64(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARM64ADDshiftLL) @@ -7225,7 +7225,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (MOVWUreg (ADDshiftLL a x [log64(c)])) for { a := v_0 @@ -7234,7 +7234,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7245,7 +7245,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && int32(c)>=3 + // cond: isPowerOfTwo(c-1) && int32(c)>=3 // result: (MOVWUreg (ADD a (ADDshiftLL x x [log64(c-1)]))) for { a := v_0 @@ -7254,7 +7254,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo(c-1) && int32(c) >= 3) { break } v.reset(OpARM64MOVWUreg) @@ -7267,7 +7267,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && int32(c)>=7 + // cond: isPowerOfTwo(c+1) && int32(c)>=7 // result: (MOVWUreg (SUB a (SUBshiftLL x x [log64(c+1)]))) for { a := v_0 @@ -7276,7 +7276,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo(c+1) && int32(c) >= 7) { break } v.reset(OpARM64MOVWUreg) @@ -7289,7 +7289,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) for { a := v_0 @@ -7298,7 +7298,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7312,7 +7312,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) for { a := v_0 @@ -7321,7 +7321,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7335,7 +7335,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) for { a := v_0 @@ -7344,7 +7344,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7358,7 +7358,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) for { a := v_0 @@ -7367,7 +7367,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7435,7 +7435,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (MOVWUreg (ADDshiftLL a x [log64(c)])) for { a := v_0 @@ -7444,7 +7444,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7455,7 +7455,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c-1) && int32(c)>=3 + // cond: isPowerOfTwo(c-1) && int32(c)>=3 // result: (MOVWUreg (ADD a (ADDshiftLL x x [log64(c-1)]))) for { a := v_0 @@ -7464,7 +7464,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo(c-1) && int32(c) >= 3) { break } v.reset(OpARM64MOVWUreg) @@ -7477,7 +7477,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c+1) && int32(c)>=7 + // cond: isPowerOfTwo(c+1) && int32(c)>=7 // result: (MOVWUreg (SUB a (SUBshiftLL x x [log64(c+1)]))) for { a := v_0 @@ -7486,7 +7486,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo(c+1) && int32(c) >= 7) { break } v.reset(OpARM64MOVWUreg) @@ -7499,7 +7499,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) for { a := v_0 @@ -7508,7 +7508,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7522,7 +7522,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) for { a := v_0 @@ -7531,7 +7531,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7545,7 +7545,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) for { a := v_0 @@ -7554,7 +7554,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7568,7 +7568,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) for { a := v_0 @@ -7577,7 +7577,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -7674,7 +7674,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (NEG (SLLconst [log64(c)] x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7683,7 +7683,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpARM64NEG) @@ -7696,7 +7696,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (NEG (ADDshiftLL x x [log64(c-1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7705,7 +7705,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { continue } v.reset(OpARM64NEG) @@ -7718,7 +7718,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (NEG (ADDshiftLL (NEG x) x [log64(c+1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7727,7 +7727,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { continue } v.reset(OpARM64NEG) @@ -7742,7 +7742,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SLLconst [log64(c/3)] (SUBshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7751,7 +7751,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { continue } v.reset(OpARM64SLLconst) @@ -7766,7 +7766,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (NEG (SLLconst [log64(c/5)] (ADDshiftLL x x [2]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7775,7 +7775,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { continue } v.reset(OpARM64NEG) @@ -7791,7 +7791,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (SLLconst [log64(c/7)] (SUBshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7800,7 +7800,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { continue } v.reset(OpARM64SLLconst) @@ -7815,7 +7815,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (NEG (SLLconst [log64(c/9)] (ADDshiftLL x x [3]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7824,7 +7824,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { continue } v.reset(OpARM64NEG) @@ -7922,7 +7922,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (NEG (SLLconst [log64(c)] x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7931,7 +7931,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpARM64NEG) @@ -7944,7 +7944,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && int32(c) >= 3 + // cond: isPowerOfTwo(c-1) && int32(c) >= 3 // result: (MOVWUreg (NEG (ADDshiftLL x x [log64(c-1)]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7953,7 +7953,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo(c-1) && int32(c) >= 3) { continue } v.reset(OpARM64MOVWUreg) @@ -7968,7 +7968,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && int32(c) >= 7 + // cond: isPowerOfTwo(c+1) && int32(c) >= 7 // result: (MOVWUreg (NEG (ADDshiftLL (NEG x) x [log64(c+1)]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -7977,7 +7977,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo(c+1) && int32(c) >= 7) { continue } v.reset(OpARM64MOVWUreg) @@ -7994,7 +7994,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) // result: (MOVWUreg (SLLconst [log64(c/3)] (SUBshiftLL x x [2]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -8003,7 +8003,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -8019,7 +8019,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) // result: (MOVWUreg (NEG (SLLconst [log64(c/5)] (ADDshiftLL x x [2])))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -8028,7 +8028,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -8046,7 +8046,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) // result: (MOVWUreg (SLLconst [log64(c/7)] (SUBshiftLL x x [3]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -8055,7 +8055,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -8071,7 +8071,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) // result: (MOVWUreg (NEG (SLLconst [log64(c/9)] (ADDshiftLL x x [3])))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -8080,7 +8080,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -12549,7 +12549,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SUBshiftLL a x [log64(c)]) for { a := v_0 @@ -12558,7 +12558,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -12567,7 +12567,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && c>=3 + // cond: isPowerOfTwo(c-1) && c>=3 // result: (SUB a (ADDshiftLL x x [log64(c-1)])) for { a := v_0 @@ -12576,7 +12576,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARM64SUB) @@ -12587,7 +12587,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && c>=7 + // cond: isPowerOfTwo(c+1) && c>=7 // result: (ADD a (SUBshiftLL x x [log64(c+1)])) for { a := v_0 @@ -12596,7 +12596,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARM64ADD) @@ -12607,7 +12607,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) for { a := v_0 @@ -12616,7 +12616,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARM64ADDshiftLL) @@ -12628,7 +12628,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) for { a := v_0 @@ -12637,7 +12637,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARM64SUBshiftLL) @@ -12649,7 +12649,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) for { a := v_0 @@ -12658,7 +12658,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARM64ADDshiftLL) @@ -12670,7 +12670,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) for { a := v_0 @@ -12679,7 +12679,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARM64SUBshiftLL) @@ -12725,7 +12725,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SUBshiftLL a x [log64(c)]) for { a := v_0 @@ -12734,7 +12734,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -12743,7 +12743,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c-1) && c>=3 + // cond: isPowerOfTwo(c-1) && c>=3 // result: (SUB a (ADDshiftLL x x [log64(c-1)])) for { a := v_0 @@ -12752,7 +12752,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { break } v.reset(OpARM64SUB) @@ -12763,7 +12763,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c+1) && c>=7 + // cond: isPowerOfTwo(c+1) && c>=7 // result: (ADD a (SUBshiftLL x x [log64(c+1)])) for { a := v_0 @@ -12772,7 +12772,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { break } v.reset(OpARM64ADD) @@ -12783,7 +12783,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)]) for { a := v_0 @@ -12792,7 +12792,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo64(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { break } v.reset(OpARM64ADDshiftLL) @@ -12804,7 +12804,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)]) for { a := v_0 @@ -12813,7 +12813,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo64(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { break } v.reset(OpARM64SUBshiftLL) @@ -12825,7 +12825,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)]) for { a := v_0 @@ -12834,7 +12834,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo64(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { break } v.reset(OpARM64ADDshiftLL) @@ -12846,7 +12846,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)]) for { a := v_0 @@ -12855,7 +12855,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo64(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { break } v.reset(OpARM64SUBshiftLL) @@ -12961,7 +12961,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (MOVWUreg (SUBshiftLL a x [log64(c)])) for { a := v_0 @@ -12970,7 +12970,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64MOVWUreg) @@ -12981,7 +12981,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && int32(c)>=3 + // cond: isPowerOfTwo(c-1) && int32(c)>=3 // result: (MOVWUreg (SUB a (ADDshiftLL x x [log64(c-1)]))) for { a := v_0 @@ -12990,7 +12990,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo(c-1) && int32(c) >= 3) { break } v.reset(OpARM64MOVWUreg) @@ -13003,7 +13003,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && int32(c)>=7 + // cond: isPowerOfTwo(c+1) && int32(c)>=7 // result: (MOVWUreg (ADD a (SUBshiftLL x x [log64(c+1)]))) for { a := v_0 @@ -13012,7 +13012,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo(c+1) && int32(c) >= 7) { break } v.reset(OpARM64MOVWUreg) @@ -13025,7 +13025,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) for { a := v_0 @@ -13034,7 +13034,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13048,7 +13048,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) for { a := v_0 @@ -13057,7 +13057,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13071,7 +13071,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) for { a := v_0 @@ -13080,7 +13080,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13094,7 +13094,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) for { a := v_0 @@ -13103,7 +13103,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13171,7 +13171,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (MOVWUreg (SUBshiftLL a x [log64(c)])) for { a := v_0 @@ -13180,7 +13180,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13191,7 +13191,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c-1) && int32(c)>=3 + // cond: isPowerOfTwo(c-1) && int32(c)>=3 // result: (MOVWUreg (SUB a (ADDshiftLL x x [log64(c-1)]))) for { a := v_0 @@ -13200,7 +13200,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo(c-1) && int32(c) >= 3) { break } v.reset(OpARM64MOVWUreg) @@ -13213,7 +13213,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: isPowerOfTwo64(c+1) && int32(c)>=7 + // cond: isPowerOfTwo(c+1) && int32(c)>=7 // result: (MOVWUreg (ADD a (SUBshiftLL x x [log64(c+1)]))) for { a := v_0 @@ -13222,7 +13222,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo(c+1) && int32(c) >= 7) { break } v.reset(OpARM64MOVWUreg) @@ -13235,7 +13235,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [2]) [log64(c/3)])) for { a := v_0 @@ -13244,7 +13244,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13258,7 +13258,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [2]) [log64(c/5)])) for { a := v_0 @@ -13267,7 +13267,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13281,7 +13281,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) // result: (MOVWUreg (ADDshiftLL a (SUBshiftLL x x [3]) [log64(c/7)])) for { a := v_0 @@ -13290,7 +13290,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13304,7 +13304,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) // result: (MOVWUreg (SUBshiftLL a (ADDshiftLL x x [3]) [log64(c/9)])) for { a := v_0 @@ -13313,7 +13313,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { break } v.reset(OpARM64MOVWUreg) @@ -13425,7 +13425,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SLLconst [log64(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13434,7 +13434,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpARM64SLLconst) @@ -13445,7 +13445,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && c >= 3 + // cond: isPowerOfTwo(c-1) && c >= 3 // result: (ADDshiftLL x x [log64(c-1)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13454,7 +13454,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c-1) && c >= 3) { + if !(isPowerOfTwo(c-1) && c >= 3) { continue } v.reset(OpARM64ADDshiftLL) @@ -13465,7 +13465,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && c >= 7 + // cond: isPowerOfTwo(c+1) && c >= 7 // result: (ADDshiftLL (NEG x) x [log64(c+1)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13474,7 +13474,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c+1) && c >= 7) { + if !(isPowerOfTwo(c+1) && c >= 7) { continue } v.reset(OpARM64ADDshiftLL) @@ -13487,7 +13487,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) + // cond: c%3 == 0 && isPowerOfTwo(c/3) // result: (SLLconst [log64(c/3)] (ADDshiftLL x x [1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13496,7 +13496,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3)) { + if !(c%3 == 0 && isPowerOfTwo(c/3)) { continue } v.reset(OpARM64SLLconst) @@ -13510,7 +13510,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) + // cond: c%5 == 0 && isPowerOfTwo(c/5) // result: (SLLconst [log64(c/5)] (ADDshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13519,7 +13519,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5)) { + if !(c%5 == 0 && isPowerOfTwo(c/5)) { continue } v.reset(OpARM64SLLconst) @@ -13533,7 +13533,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) + // cond: c%7 == 0 && isPowerOfTwo(c/7) // result: (SLLconst [log64(c/7)] (ADDshiftLL (NEG x) x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13542,7 +13542,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7)) { + if !(c%7 == 0 && isPowerOfTwo(c/7)) { continue } v.reset(OpARM64SLLconst) @@ -13558,7 +13558,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) + // cond: c%9 == 0 && isPowerOfTwo(c/9) // result: (SLLconst [log64(c/9)] (ADDshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13567,7 +13567,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9)) { + if !(c%9 == 0 && isPowerOfTwo(c/9)) { continue } v.reset(OpARM64SLLconst) @@ -13678,7 +13678,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (MOVWUreg (SLLconst [log64(c)] x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13687,7 +13687,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -13700,7 +13700,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c-1) && int32(c) >= 3 + // cond: isPowerOfTwo(c-1) && int32(c) >= 3 // result: (MOVWUreg (ADDshiftLL x x [log64(c-1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13709,7 +13709,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo(c-1) && int32(c) >= 3) { continue } v.reset(OpARM64MOVWUreg) @@ -13722,7 +13722,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c+1) && int32(c) >= 7 + // cond: isPowerOfTwo(c+1) && int32(c) >= 7 // result: (MOVWUreg (ADDshiftLL (NEG x) x [log64(c+1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13731,7 +13731,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo(c+1) && int32(c) >= 7) { continue } v.reset(OpARM64MOVWUreg) @@ -13746,7 +13746,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) // result: (MOVWUreg (SLLconst [log64(c/3)] (ADDshiftLL x x [1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13755,7 +13755,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -13771,7 +13771,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) // result: (MOVWUreg (SLLconst [log64(c/5)] (ADDshiftLL x x [2]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13780,7 +13780,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -13796,7 +13796,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) // result: (MOVWUreg (SLLconst [log64(c/7)] (ADDshiftLL (NEG x) x [3]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13805,7 +13805,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -13823,7 +13823,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) // result: (MOVWUreg (SLLconst [log64(c/9)] (ADDshiftLL x x [3]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -13832,7 +13832,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { continue } v.reset(OpARM64MOVWUreg) @@ -17155,7 +17155,7 @@ func rewriteValueARM64_OpARM64UDIV(v *Value) bool { return true } // match: (UDIV x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SRLconst [log64(c)] x) for { x := v_0 @@ -17163,7 +17163,7 @@ func rewriteValueARM64_OpARM64UDIV(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64SRLconst) @@ -17213,7 +17213,7 @@ func rewriteValueARM64_OpARM64UDIVW(v *Value) bool { return true } // match: (UDIVW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) && is32Bit(c) + // cond: isPowerOfTwo(c) && is32Bit(c) // result: (SRLconst [log64(c)] (MOVWUreg x)) for { x := v_0 @@ -17221,7 +17221,7 @@ func rewriteValueARM64_OpARM64UDIVW(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c) && is32Bit(c)) { + if !(isPowerOfTwo(c) && is32Bit(c)) { break } v.reset(OpARM64SRLconst) @@ -17283,7 +17283,7 @@ func rewriteValueARM64_OpARM64UMOD(v *Value) bool { return true } // match: (UMOD x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (ANDconst [c-1] x) for { x := v_0 @@ -17291,7 +17291,7 @@ func rewriteValueARM64_OpARM64UMOD(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpARM64ANDconst) @@ -17356,7 +17356,7 @@ func rewriteValueARM64_OpARM64UMODW(v *Value) bool { return true } // match: (UMODW x (MOVDconst [c])) - // cond: isPowerOfTwo64(c) && is32Bit(c) + // cond: isPowerOfTwo(c) && is32Bit(c) // result: (ANDconst [c-1] x) for { x := v_0 @@ -17364,7 +17364,7 @@ func rewriteValueARM64_OpARM64UMODW(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c) && is32Bit(c)) { + if !(isPowerOfTwo(c) && is32Bit(c)) { break } v.reset(OpARM64ANDconst) diff --git a/src/cmd/compile/internal/ssa/rewriteLOONG64.go b/src/cmd/compile/internal/ssa/rewriteLOONG64.go index 99690d324c..f4080d1ac7 100644 --- a/src/cmd/compile/internal/ssa/rewriteLOONG64.go +++ b/src/cmd/compile/internal/ssa/rewriteLOONG64.go @@ -1559,7 +1559,7 @@ func rewriteValueLOONG64_OpLOONG64DIVVU(v *Value) bool { return true } // match: (DIVVU x (MOVVconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SRLVconst [log64(c)] x) for { x := v_0 @@ -1567,7 +1567,7 @@ func rewriteValueLOONG64_OpLOONG64DIVVU(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpLOONG64SRLVconst) @@ -3550,7 +3550,7 @@ func rewriteValueLOONG64_OpLOONG64MULV(v *Value) bool { break } // match: (MULV x (MOVVconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SLLVconst [log64(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -3559,7 +3559,7 @@ func rewriteValueLOONG64_OpLOONG64MULV(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpLOONG64SLLVconst) @@ -3772,7 +3772,7 @@ func rewriteValueLOONG64_OpLOONG64REMVU(v *Value) bool { return true } // match: (REMVU x (MOVVconst [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (ANDconst [c-1] x) for { x := v_0 @@ -3780,7 +3780,7 @@ func rewriteValueLOONG64_OpLOONG64REMVU(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpLOONG64ANDconst) diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go index 6a259f5a47..045ebb955a 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go @@ -3977,7 +3977,7 @@ func rewriteValueMIPS_OpMIPSMUL(v *Value) bool { break } // match: (MUL (MOVWconst [c]) x ) - // cond: isPowerOfTwo64(int64(uint32(c))) + // cond: isPowerOfTwo(int64(uint32(c))) // result: (SLLconst [int32(log2uint32(int64(c)))] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -3986,7 +3986,7 @@ func rewriteValueMIPS_OpMIPSMUL(v *Value) bool { } c := auxIntToInt32(v_0.AuxInt) x := v_1 - if !(isPowerOfTwo64(int64(uint32(c)))) { + if !(isPowerOfTwo(int64(uint32(c)))) { continue } v.reset(OpMIPSSLLconst) @@ -6496,7 +6496,7 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool { break } // match: (Select0 (MULTU (MOVWconst [c]) x )) - // cond: isPowerOfTwo64(int64(uint32(c))) + // cond: isPowerOfTwo(int64(uint32(c))) // result: (SRLconst [int32(32-log2uint32(int64(c)))] x) for { if v_0.Op != OpMIPSMULTU { @@ -6511,7 +6511,7 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool { } c := auxIntToInt32(v_0_0.AuxInt) x := v_0_1 - if !(isPowerOfTwo64(int64(uint32(c)))) { + if !(isPowerOfTwo(int64(uint32(c)))) { continue } v.reset(OpMIPSSRLconst) @@ -6692,7 +6692,7 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool { break } // match: (Select1 (MULTU (MOVWconst [c]) x )) - // cond: isPowerOfTwo64(int64(uint32(c))) + // cond: isPowerOfTwo(int64(uint32(c))) // result: (SLLconst [int32(log2uint32(int64(c)))] x) for { if v_0.Op != OpMIPSMULTU { @@ -6707,7 +6707,7 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool { } c := auxIntToInt32(v_0_0.AuxInt) x := v_0_1 - if !(isPowerOfTwo64(int64(uint32(c)))) { + if !(isPowerOfTwo(int64(uint32(c)))) { continue } v.reset(OpMIPSSLLconst) diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS64.go b/src/cmd/compile/internal/ssa/rewriteMIPS64.go index 764465d0b7..bad8016cb4 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go @@ -7385,7 +7385,7 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool { return true } // match: (Select0 (DIVVU x (MOVVconst [c]))) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (ANDconst [c-1] x) for { if v_0.Op != OpMIPS64DIVVU { @@ -7398,7 +7398,7 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool { break } c := auxIntToInt64(v_0_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpMIPS64ANDconst) @@ -7584,7 +7584,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { break } // match: (Select1 (MULVU x (MOVVconst [c]))) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SLLVconst [log64(c)] x) for { if v_0.Op != OpMIPS64MULVU { @@ -7599,7 +7599,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { continue } c := auxIntToInt64(v_0_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpMIPS64SLLVconst) @@ -7625,7 +7625,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { return true } // match: (Select1 (DIVVU x (MOVVconst [c]))) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (SRLVconst [log64(c)] x) for { if v_0.Op != OpMIPS64DIVVU { @@ -7638,7 +7638,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { break } c := auxIntToInt64(v_0_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpMIPS64SRLVconst) diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go index 2f38289ab9..1816d2e27e 100644 --- a/src/cmd/compile/internal/ssa/rewriteS390X.go +++ b/src/cmd/compile/internal/ssa/rewriteS390X.go @@ -10833,13 +10833,13 @@ func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool { v_0 := v.Args[0] b := v.Block // match: (MULLDconst x [c]) - // cond: isPowerOfTwo32(c&(c-1)) + // cond: isPowerOfTwo(c&(c-1)) // result: (ADD (SLDconst x [uint8(log32(c&(c-1)))]) (SLDconst x [uint8(log32(c&^(c-1)))])) for { t := v.Type c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c & (c - 1))) { + if !(isPowerOfTwo(c & (c - 1))) { break } v.reset(OpS390XADD) @@ -10853,13 +10853,13 @@ func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool { return true } // match: (MULLDconst x [c]) - // cond: isPowerOfTwo32(c+(c&^(c-1))) + // cond: isPowerOfTwo(c+(c&^(c-1))) // result: (SUB (SLDconst x [uint8(log32(c+(c&^(c-1))))]) (SLDconst x [uint8(log32(c&^(c-1)))])) for { t := v.Type c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c + (c &^ (c - 1)))) { + if !(isPowerOfTwo(c + (c &^ (c - 1)))) { break } v.reset(OpS390XSUB) @@ -10873,13 +10873,13 @@ func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool { return true } // match: (MULLDconst x [c]) - // cond: isPowerOfTwo32(-c+(-c&^(-c-1))) + // cond: isPowerOfTwo(-c+(-c&^(-c-1))) // result: (SUB (SLDconst x [uint8(log32(-c&^(-c-1)))]) (SLDconst x [uint8(log32(-c+(-c&^(-c-1))))])) for { t := v.Type c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(-c + (-c &^ (-c - 1)))) { + if !(isPowerOfTwo(-c + (-c &^ (-c - 1)))) { break } v.reset(OpS390XSUB) @@ -11060,13 +11060,13 @@ func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool { v_0 := v.Args[0] b := v.Block // match: (MULLWconst x [c]) - // cond: isPowerOfTwo32(c&(c-1)) + // cond: isPowerOfTwo(c&(c-1)) // result: (ADDW (SLWconst x [uint8(log32(c&(c-1)))]) (SLWconst x [uint8(log32(c&^(c-1)))])) for { t := v.Type c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c & (c - 1))) { + if !(isPowerOfTwo(c & (c - 1))) { break } v.reset(OpS390XADDW) @@ -11080,13 +11080,13 @@ func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool { return true } // match: (MULLWconst x [c]) - // cond: isPowerOfTwo32(c+(c&^(c-1))) + // cond: isPowerOfTwo(c+(c&^(c-1))) // result: (SUBW (SLWconst x [uint8(log32(c+(c&^(c-1))))]) (SLWconst x [uint8(log32(c&^(c-1)))])) for { t := v.Type c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(c + (c &^ (c - 1)))) { + if !(isPowerOfTwo(c + (c &^ (c - 1)))) { break } v.reset(OpS390XSUBW) @@ -11100,13 +11100,13 @@ func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool { return true } // match: (MULLWconst x [c]) - // cond: isPowerOfTwo32(-c+(-c&^(-c-1))) + // cond: isPowerOfTwo(-c+(-c&^(-c-1))) // result: (SUBW (SLWconst x [uint8(log32(-c&^(-c-1)))]) (SLWconst x [uint8(log32(-c+(-c&^(-c-1))))])) for { t := v.Type c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo32(-c + (-c &^ (-c - 1)))) { + if !(isPowerOfTwo(-c + (-c &^ (-c - 1)))) { break } v.reset(OpS390XSUBW) diff --git a/src/cmd/compile/internal/ssa/rewritegeneric.go b/src/cmd/compile/internal/ssa/rewritegeneric.go index beeb548ad7..dee39eb261 100644 --- a/src/cmd/compile/internal/ssa/rewritegeneric.go +++ b/src/cmd/compile/internal/ssa/rewritegeneric.go @@ -6188,7 +6188,7 @@ func rewriteValuegeneric_OpDiv16(v *Value) bool { return true } // match: (Div16 n (Const16 [c])) - // cond: isNonNegative(n) && isPowerOfTwo16(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (Rsh16Ux64 n (Const64 [log16(c)])) for { n := v_0 @@ -6196,7 +6196,7 @@ func rewriteValuegeneric_OpDiv16(v *Value) bool { break } c := auxIntToInt16(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo16(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpRsh16Ux64) @@ -6245,7 +6245,7 @@ func rewriteValuegeneric_OpDiv16(v *Value) bool { return true } // match: (Div16 n (Const16 [c])) - // cond: isPowerOfTwo16(c) + // cond: isPowerOfTwo(c) // result: (Rsh16x64 (Add16 n (Rsh16Ux64 (Rsh16x64 n (Const64 [15])) (Const64 [int64(16-log16(c))]))) (Const64 [int64(log16(c))])) for { t := v.Type @@ -6254,7 +6254,7 @@ func rewriteValuegeneric_OpDiv16(v *Value) bool { break } c := auxIntToInt16(v_1.AuxInt) - if !(isPowerOfTwo16(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh16x64) @@ -6333,7 +6333,7 @@ func rewriteValuegeneric_OpDiv16u(v *Value) bool { return true } // match: (Div16u n (Const16 [c])) - // cond: isPowerOfTwo16(c) + // cond: isPowerOfTwo(c) // result: (Rsh16Ux64 n (Const64 [log16(c)])) for { n := v_0 @@ -6341,7 +6341,7 @@ func rewriteValuegeneric_OpDiv16u(v *Value) bool { break } c := auxIntToInt16(v_1.AuxInt) - if !(isPowerOfTwo16(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh16Ux64) @@ -6492,7 +6492,7 @@ func rewriteValuegeneric_OpDiv32(v *Value) bool { return true } // match: (Div32 n (Const32 [c])) - // cond: isNonNegative(n) && isPowerOfTwo32(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (Rsh32Ux64 n (Const64 [log32(c)])) for { n := v_0 @@ -6500,7 +6500,7 @@ func rewriteValuegeneric_OpDiv32(v *Value) bool { break } c := auxIntToInt32(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo32(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpRsh32Ux64) @@ -6549,7 +6549,7 @@ func rewriteValuegeneric_OpDiv32(v *Value) bool { return true } // match: (Div32 n (Const32 [c])) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (Rsh32x64 (Add32 n (Rsh32Ux64 (Rsh32x64 n (Const64 [31])) (Const64 [int64(32-log32(c))]))) (Const64 [int64(log32(c))])) for { t := v.Type @@ -6558,7 +6558,7 @@ func rewriteValuegeneric_OpDiv32(v *Value) bool { break } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh32x64) @@ -6743,7 +6743,7 @@ func rewriteValuegeneric_OpDiv32u(v *Value) bool { return true } // match: (Div32u n (Const32 [c])) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (Rsh32Ux64 n (Const64 [log32(c)])) for { n := v_0 @@ -6751,7 +6751,7 @@ func rewriteValuegeneric_OpDiv32u(v *Value) bool { break } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh32Ux64) @@ -6951,7 +6951,7 @@ func rewriteValuegeneric_OpDiv64(v *Value) bool { return true } // match: (Div64 n (Const64 [c])) - // cond: isNonNegative(n) && isPowerOfTwo64(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (Rsh64Ux64 n (Const64 [log64(c)])) for { n := v_0 @@ -6959,7 +6959,7 @@ func rewriteValuegeneric_OpDiv64(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo64(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpRsh64Ux64) @@ -7020,7 +7020,7 @@ func rewriteValuegeneric_OpDiv64(v *Value) bool { return true } // match: (Div64 n (Const64 [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (Rsh64x64 (Add64 n (Rsh64Ux64 (Rsh64x64 n (Const64 [63])) (Const64 [int64(64-log64(c))]))) (Const64 [int64(log64(c))])) for { t := v.Type @@ -7029,7 +7029,7 @@ func rewriteValuegeneric_OpDiv64(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh64x64) @@ -7182,7 +7182,7 @@ func rewriteValuegeneric_OpDiv64u(v *Value) bool { return true } // match: (Div64u n (Const64 [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (Rsh64Ux64 n (Const64 [log64(c)])) for { n := v_0 @@ -7190,7 +7190,7 @@ func rewriteValuegeneric_OpDiv64u(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh64Ux64) @@ -7374,7 +7374,7 @@ func rewriteValuegeneric_OpDiv8(v *Value) bool { return true } // match: (Div8 n (Const8 [c])) - // cond: isNonNegative(n) && isPowerOfTwo8(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (Rsh8Ux64 n (Const64 [log8(c)])) for { n := v_0 @@ -7382,7 +7382,7 @@ func rewriteValuegeneric_OpDiv8(v *Value) bool { break } c := auxIntToInt8(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo8(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpRsh8Ux64) @@ -7431,7 +7431,7 @@ func rewriteValuegeneric_OpDiv8(v *Value) bool { return true } // match: (Div8 n (Const8 [c])) - // cond: isPowerOfTwo8(c) + // cond: isPowerOfTwo(c) // result: (Rsh8x64 (Add8 n (Rsh8Ux64 (Rsh8x64 n (Const64 [ 7])) (Const64 [int64( 8-log8(c))]))) (Const64 [int64(log8(c))])) for { t := v.Type @@ -7440,7 +7440,7 @@ func rewriteValuegeneric_OpDiv8(v *Value) bool { break } c := auxIntToInt8(v_1.AuxInt) - if !(isPowerOfTwo8(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh8x64) @@ -7518,7 +7518,7 @@ func rewriteValuegeneric_OpDiv8u(v *Value) bool { return true } // match: (Div8u n (Const8 [c])) - // cond: isPowerOfTwo8(c) + // cond: isPowerOfTwo(c) // result: (Rsh8Ux64 n (Const64 [log8(c)])) for { n := v_0 @@ -7526,7 +7526,7 @@ func rewriteValuegeneric_OpDiv8u(v *Value) bool { break } c := auxIntToInt8(v_1.AuxInt) - if !(isPowerOfTwo8(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpRsh8Ux64) @@ -15436,7 +15436,7 @@ func rewriteValuegeneric_OpMod16(v *Value) bool { return true } // match: (Mod16 n (Const16 [c])) - // cond: isNonNegative(n) && isPowerOfTwo16(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (And16 n (Const16 [c-1])) for { t := v.Type @@ -15445,7 +15445,7 @@ func rewriteValuegeneric_OpMod16(v *Value) bool { break } c := auxIntToInt16(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo16(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpAnd16) @@ -15523,7 +15523,7 @@ func rewriteValuegeneric_OpMod16u(v *Value) bool { return true } // match: (Mod16u n (Const16 [c])) - // cond: isPowerOfTwo16(c) + // cond: isPowerOfTwo(c) // result: (And16 n (Const16 [c-1])) for { t := v.Type @@ -15532,7 +15532,7 @@ func rewriteValuegeneric_OpMod16u(v *Value) bool { break } c := auxIntToInt16(v_1.AuxInt) - if !(isPowerOfTwo16(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpAnd16) @@ -15590,7 +15590,7 @@ func rewriteValuegeneric_OpMod32(v *Value) bool { return true } // match: (Mod32 n (Const32 [c])) - // cond: isNonNegative(n) && isPowerOfTwo32(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (And32 n (Const32 [c-1])) for { t := v.Type @@ -15599,7 +15599,7 @@ func rewriteValuegeneric_OpMod32(v *Value) bool { break } c := auxIntToInt32(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo32(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpAnd32) @@ -15677,7 +15677,7 @@ func rewriteValuegeneric_OpMod32u(v *Value) bool { return true } // match: (Mod32u n (Const32 [c])) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (And32 n (Const32 [c-1])) for { t := v.Type @@ -15686,7 +15686,7 @@ func rewriteValuegeneric_OpMod32u(v *Value) bool { break } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpAnd32) @@ -15744,7 +15744,7 @@ func rewriteValuegeneric_OpMod64(v *Value) bool { return true } // match: (Mod64 n (Const64 [c])) - // cond: isNonNegative(n) && isPowerOfTwo64(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (And64 n (Const64 [c-1])) for { t := v.Type @@ -15753,7 +15753,7 @@ func rewriteValuegeneric_OpMod64(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo64(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpAnd64) @@ -15842,7 +15842,7 @@ func rewriteValuegeneric_OpMod64u(v *Value) bool { return true } // match: (Mod64u n (Const64 [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (And64 n (Const64 [c-1])) for { t := v.Type @@ -15851,7 +15851,7 @@ func rewriteValuegeneric_OpMod64u(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpAnd64) @@ -15923,7 +15923,7 @@ func rewriteValuegeneric_OpMod8(v *Value) bool { return true } // match: (Mod8 n (Const8 [c])) - // cond: isNonNegative(n) && isPowerOfTwo8(c) + // cond: isNonNegative(n) && isPowerOfTwo(c) // result: (And8 n (Const8 [c-1])) for { t := v.Type @@ -15932,7 +15932,7 @@ func rewriteValuegeneric_OpMod8(v *Value) bool { break } c := auxIntToInt8(v_1.AuxInt) - if !(isNonNegative(n) && isPowerOfTwo8(c)) { + if !(isNonNegative(n) && isPowerOfTwo(c)) { break } v.reset(OpAnd8) @@ -16010,7 +16010,7 @@ func rewriteValuegeneric_OpMod8u(v *Value) bool { return true } // match: (Mod8u n (Const8 [c])) - // cond: isPowerOfTwo8(c) + // cond: isPowerOfTwo(c) // result: (And8 n (Const8 [c-1])) for { t := v.Type @@ -16019,7 +16019,7 @@ func rewriteValuegeneric_OpMod8u(v *Value) bool { break } c := auxIntToInt8(v_1.AuxInt) - if !(isPowerOfTwo8(c)) { + if !(isPowerOfTwo(c)) { break } v.reset(OpAnd8) @@ -17443,7 +17443,7 @@ func rewriteValuegeneric_OpMul16(v *Value) bool { break } // match: (Mul16 n (Const16 [c])) - // cond: isPowerOfTwo16(c) + // cond: isPowerOfTwo(c) // result: (Lsh16x64 n (Const64 [log16(c)])) for { t := v.Type @@ -17453,7 +17453,7 @@ func rewriteValuegeneric_OpMul16(v *Value) bool { continue } c := auxIntToInt16(v_1.AuxInt) - if !(isPowerOfTwo16(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpLsh16x64) @@ -17466,7 +17466,7 @@ func rewriteValuegeneric_OpMul16(v *Value) bool { break } // match: (Mul16 n (Const16 [c])) - // cond: t.IsSigned() && isPowerOfTwo16(-c) + // cond: t.IsSigned() && isPowerOfTwo(-c) // result: (Neg16 (Lsh16x64 n (Const64 [log16(-c)]))) for { t := v.Type @@ -17476,7 +17476,7 @@ func rewriteValuegeneric_OpMul16(v *Value) bool { continue } c := auxIntToInt16(v_1.AuxInt) - if !(t.IsSigned() && isPowerOfTwo16(-c)) { + if !(t.IsSigned() && isPowerOfTwo(-c)) { continue } v.reset(OpNeg16) @@ -17616,7 +17616,7 @@ func rewriteValuegeneric_OpMul32(v *Value) bool { break } // match: (Mul32 n (Const32 [c])) - // cond: isPowerOfTwo32(c) + // cond: isPowerOfTwo(c) // result: (Lsh32x64 n (Const64 [log32(c)])) for { t := v.Type @@ -17626,7 +17626,7 @@ func rewriteValuegeneric_OpMul32(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(isPowerOfTwo32(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpLsh32x64) @@ -17639,7 +17639,7 @@ func rewriteValuegeneric_OpMul32(v *Value) bool { break } // match: (Mul32 n (Const32 [c])) - // cond: t.IsSigned() && isPowerOfTwo32(-c) + // cond: t.IsSigned() && isPowerOfTwo(-c) // result: (Neg32 (Lsh32x64 n (Const64 [log32(-c)]))) for { t := v.Type @@ -17649,7 +17649,7 @@ func rewriteValuegeneric_OpMul32(v *Value) bool { continue } c := auxIntToInt32(v_1.AuxInt) - if !(t.IsSigned() && isPowerOfTwo32(-c)) { + if !(t.IsSigned() && isPowerOfTwo(-c)) { continue } v.reset(OpNeg32) @@ -17891,7 +17891,7 @@ func rewriteValuegeneric_OpMul64(v *Value) bool { break } // match: (Mul64 n (Const64 [c])) - // cond: isPowerOfTwo64(c) + // cond: isPowerOfTwo(c) // result: (Lsh64x64 n (Const64 [log64(c)])) for { t := v.Type @@ -17901,7 +17901,7 @@ func rewriteValuegeneric_OpMul64(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo64(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpLsh64x64) @@ -17914,7 +17914,7 @@ func rewriteValuegeneric_OpMul64(v *Value) bool { break } // match: (Mul64 n (Const64 [c])) - // cond: t.IsSigned() && isPowerOfTwo64(-c) + // cond: t.IsSigned() && isPowerOfTwo(-c) // result: (Neg64 (Lsh64x64 n (Const64 [log64(-c)]))) for { t := v.Type @@ -17924,7 +17924,7 @@ func rewriteValuegeneric_OpMul64(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(t.IsSigned() && isPowerOfTwo64(-c)) { + if !(t.IsSigned() && isPowerOfTwo(-c)) { continue } v.reset(OpNeg64) @@ -18166,7 +18166,7 @@ func rewriteValuegeneric_OpMul8(v *Value) bool { break } // match: (Mul8 n (Const8 [c])) - // cond: isPowerOfTwo8(c) + // cond: isPowerOfTwo(c) // result: (Lsh8x64 n (Const64 [log8(c)])) for { t := v.Type @@ -18176,7 +18176,7 @@ func rewriteValuegeneric_OpMul8(v *Value) bool { continue } c := auxIntToInt8(v_1.AuxInt) - if !(isPowerOfTwo8(c)) { + if !(isPowerOfTwo(c)) { continue } v.reset(OpLsh8x64) @@ -18189,7 +18189,7 @@ func rewriteValuegeneric_OpMul8(v *Value) bool { break } // match: (Mul8 n (Const8 [c])) - // cond: t.IsSigned() && isPowerOfTwo8(-c) + // cond: t.IsSigned() && isPowerOfTwo(-c) // result: (Neg8 (Lsh8x64 n (Const64 [log8(-c)]))) for { t := v.Type @@ -18199,7 +18199,7 @@ func rewriteValuegeneric_OpMul8(v *Value) bool { continue } c := auxIntToInt8(v_1.AuxInt) - if !(t.IsSigned() && isPowerOfTwo8(-c)) { + if !(t.IsSigned() && isPowerOfTwo(-c)) { continue } v.reset(OpNeg8) -- 2.48.1