diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index b9b29a489d7..8742c49ebd9 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -959,7 +959,7 @@ (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) && isPowerOfTwo(int64(c)+1) && c >= 15 => (SUB(Q|L) (SHL(Q|L)const [int8(log2(int64(c)+1))] x) x) +(MUL(Q|L)const [c] x) && isPowerOfTwo64(int64(c)+1) && c >= 15 => (SUB(Q|L) (SHL(Q|L)const [int8(log2(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) diff --git a/src/cmd/compile/internal/ssa/gen/ARM64.rules b/src/cmd/compile/internal/ssa/gen/ARM64.rules index f2d2fb6cf64..c50a8c7778f 100644 --- a/src/cmd/compile/internal/ssa/gen/ARM64.rules +++ b/src/cmd/compile/internal/ssa/gen/ARM64.rules @@ -1173,145 +1173,145 @@ (MUL x (MOVDconst [-1])) => (NEG x) (MUL _ (MOVDconst [0])) => (MOVDconst [0]) (MUL x (MOVDconst [1])) => x -(MUL x (MOVDconst [c])) && isPowerOfTwo(c) => (SLLconst [log2(c)] x) -(MUL x (MOVDconst [c])) && isPowerOfTwo(c-1) && c >= 3 => (ADDshiftLL x x [log2(c-1)]) -(MUL x (MOVDconst [c])) && isPowerOfTwo(c+1) && c >= 7 => (ADDshiftLL (NEG x) x [log2(c+1)]) -(MUL x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SLLconst [log2(c/3)] (ADDshiftLL x x [1])) -(MUL x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (SLLconst [log2(c/5)] (ADDshiftLL x x [2])) -(MUL x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SLLconst [log2(c/7)] (ADDshiftLL (NEG x) x [3])) -(MUL x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (SLLconst [log2(c/9)] (ADDshiftLL x x [3])) +(MUL x (MOVDconst [c])) && isPowerOfTwo64(c) => (SLLconst [log2(c)] x) +(MUL x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c >= 3 => (ADDshiftLL x x [log2(c-1)]) +(MUL x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c >= 7 => (ADDshiftLL (NEG x) x [log2(c+1)]) +(MUL x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SLLconst [log2(c/3)] (ADDshiftLL x x [1])) +(MUL x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (SLLconst [log2(c/5)] (ADDshiftLL x x [2])) +(MUL x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (SLLconst [log2(c/7)] (ADDshiftLL (NEG x) x [3])) +(MUL x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (SLLconst [log2(c/9)] (ADDshiftLL x x [3])) (MULW x (MOVDconst [c])) && int32(c)==-1 => (NEG x) (MULW _ (MOVDconst [c])) && int32(c)==0 => (MOVDconst [0]) (MULW x (MOVDconst [c])) && int32(c)==1 => x -(MULW x (MOVDconst [c])) && isPowerOfTwo(c) => (SLLconst [log2(c)] x) -(MULW x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c) >= 3 => (ADDshiftLL x x [log2(c-1)]) -(MULW x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c) >= 7 => (ADDshiftLL (NEG x) x [log2(c+1)]) -(MULW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (SLLconst [log2(c/3)] (ADDshiftLL x x [1])) -(MULW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (SLLconst [log2(c/5)] (ADDshiftLL x x [2])) -(MULW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (SLLconst [log2(c/7)] (ADDshiftLL (NEG x) x [3])) -(MULW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (SLLconst [log2(c/9)] (ADDshiftLL x x [3])) +(MULW x (MOVDconst [c])) && isPowerOfTwo64(c) => (SLLconst [log2(c)] x) +(MULW x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c) >= 3 => (ADDshiftLL x x [log2(c-1)]) +(MULW x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c) >= 7 => (ADDshiftLL (NEG x) x [log2(c+1)]) +(MULW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (SLLconst [log2(c/3)] (ADDshiftLL x x [1])) +(MULW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (SLLconst [log2(c/5)] (ADDshiftLL x x [2])) +(MULW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (SLLconst [log2(c/7)] (ADDshiftLL (NEG x) x [3])) +(MULW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (SLLconst [log2(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])) && isPowerOfTwo(c) => (NEG (SLLconst [log2(c)] x)) -(MNEG x (MOVDconst [c])) && isPowerOfTwo(c-1) && c >= 3 => (NEG (ADDshiftLL x x [log2(c-1)])) -(MNEG x (MOVDconst [c])) && isPowerOfTwo(c+1) && c >= 7 => (NEG (ADDshiftLL (NEG x) x [log2(c+1)])) -(MNEG x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SLLconst [log2(c/3)] (SUBshiftLL x x [2])) -(MNEG x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (NEG (SLLconst [log2(c/5)] (ADDshiftLL x x [2]))) -(MNEG x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SLLconst [log2(c/7)] (SUBshiftLL x x [3])) -(MNEG x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (NEG (SLLconst [log2(c/9)] (ADDshiftLL x x [3]))) +(MNEG x (MOVDconst [c])) && isPowerOfTwo64(c) => (NEG (SLLconst [log2(c)] x)) +(MNEG x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c >= 3 => (NEG (ADDshiftLL x x [log2(c-1)])) +(MNEG x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c >= 7 => (NEG (ADDshiftLL (NEG x) x [log2(c+1)])) +(MNEG x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SLLconst [log2(c/3)] (SUBshiftLL x x [2])) +(MNEG x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (NEG (SLLconst [log2(c/5)] (ADDshiftLL x x [2]))) +(MNEG x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (SLLconst [log2(c/7)] (SUBshiftLL x x [3])) +(MNEG x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (NEG (SLLconst [log2(c/9)] (ADDshiftLL x x [3]))) (MNEGW x (MOVDconst [c])) && int32(c)==-1 => x (MNEGW _ (MOVDconst [c])) && int32(c)==0 => (MOVDconst [0]) (MNEGW x (MOVDconst [c])) && int32(c)==1 => (NEG x) -(MNEGW x (MOVDconst [c])) && isPowerOfTwo(c) => (NEG (SLLconst [log2(c)] x)) -(MNEGW x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c) >= 3 => (NEG (ADDshiftLL x x [log2(c-1)])) -(MNEGW x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c) >= 7 => (NEG (ADDshiftLL (NEG x) x [log2(c+1)])) -(MNEGW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (SLLconst [log2(c/3)] (SUBshiftLL x x [2])) -(MNEGW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (NEG (SLLconst [log2(c/5)] (ADDshiftLL x x [2]))) -(MNEGW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (SLLconst [log2(c/7)] (SUBshiftLL x x [3])) -(MNEGW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (NEG (SLLconst [log2(c/9)] (ADDshiftLL x x [3]))) +(MNEGW x (MOVDconst [c])) && isPowerOfTwo64(c) => (NEG (SLLconst [log2(c)] x)) +(MNEGW x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c) >= 3 => (NEG (ADDshiftLL x x [log2(c-1)])) +(MNEGW x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c) >= 7 => (NEG (ADDshiftLL (NEG x) x [log2(c+1)])) +(MNEGW x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (SLLconst [log2(c/3)] (SUBshiftLL x x [2])) +(MNEGW x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (NEG (SLLconst [log2(c/5)] (ADDshiftLL x x [2]))) +(MNEGW x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (SLLconst [log2(c/7)] (SUBshiftLL x x [3])) +(MNEGW x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (NEG (SLLconst [log2(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])) && isPowerOfTwo(c) => (ADDshiftLL a x [log2(c)]) -(MADD a x (MOVDconst [c])) && isPowerOfTwo(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) -(MADD a x (MOVDconst [c])) && isPowerOfTwo(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) -(MADD a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MADD a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MADD a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MADD a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MADD a x (MOVDconst [c])) && isPowerOfTwo64(c) => (ADDshiftLL a x [log2(c)]) +(MADD a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) +(MADD a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) +(MADD a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MADD a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MADD a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MADD a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(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) && isPowerOfTwo(c) => (ADDshiftLL a x [log2(c)]) -(MADD a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) -(MADD a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) -(MADD a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MADD a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MADD a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MADD a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MADD a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (ADDshiftLL a x [log2(c)]) +(MADD a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && c>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) +(MADD a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && c>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) +(MADD a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MADD a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MADD a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MADD a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) (MADDW a x (MOVDconst [c])) && int32(c)==-1 => (SUB a x) (MADDW a _ (MOVDconst [c])) && int32(c)==0 => a (MADDW a x (MOVDconst [c])) && int32(c)==1 => (ADD a x) -(MADDW a x (MOVDconst [c])) && isPowerOfTwo(c) => (ADDshiftLL a x [log2(c)]) -(MADDW a x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c)>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) -(MADDW a x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c)>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) -(MADDW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MADDW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MADDW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MADDW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MADDW a x (MOVDconst [c])) && isPowerOfTwo64(c) => (ADDshiftLL a x [log2(c)]) +(MADDW a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c)>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) +(MADDW a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c)>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) +(MADDW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MADDW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MADDW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MADDW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) (MADDW a (MOVDconst [c]) x) && int32(c)==-1 => (SUB a x) (MADDW a (MOVDconst [c]) _) && int32(c)==0 => a (MADDW a (MOVDconst [c]) x) && int32(c)==1 => (ADD a x) -(MADDW a (MOVDconst [c]) x) && isPowerOfTwo(c) => (ADDshiftLL a x [log2(c)]) -(MADDW a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && int32(c)>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) -(MADDW a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && int32(c)>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) -(MADDW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MADDW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MADDW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MADDW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MADDW a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (ADDshiftLL a x [log2(c)]) +(MADDW a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && int32(c)>=3 => (ADD a (ADDshiftLL x x [log2(c-1)])) +(MADDW a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && int32(c)>=7 => (SUB a (SUBshiftLL x x [log2(c+1)])) +(MADDW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MADDW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MADDW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MADDW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (ADDshiftLL a (ADDshiftLL x x [3]) [log2(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])) && isPowerOfTwo(c) => (SUBshiftLL a x [log2(c)]) -(MSUB a x (MOVDconst [c])) && isPowerOfTwo(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) -(MSUB a x (MOVDconst [c])) && isPowerOfTwo(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) -(MSUB a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MSUB a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MSUB a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MSUB a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MSUB a x (MOVDconst [c])) && isPowerOfTwo64(c) => (SUBshiftLL a x [log2(c)]) +(MSUB a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) +(MSUB a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) +(MSUB a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MSUB a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MSUB a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MSUB a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(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) && isPowerOfTwo(c) => (SUBshiftLL a x [log2(c)]) -(MSUB a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) -(MSUB a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) -(MSUB a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MSUB a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MSUB a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MSUB a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MSUB a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (SUBshiftLL a x [log2(c)]) +(MSUB a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && c>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) +(MSUB a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && c>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) +(MSUB a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MSUB a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MSUB a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MSUB a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) (MSUBW a x (MOVDconst [c])) && int32(c)==-1 => (ADD a x) (MSUBW a _ (MOVDconst [c])) && int32(c)==0 => a (MSUBW a x (MOVDconst [c])) && int32(c)==1 => (SUB a x) -(MSUBW a x (MOVDconst [c])) && isPowerOfTwo(c) => (SUBshiftLL a x [log2(c)]) -(MSUBW a x (MOVDconst [c])) && isPowerOfTwo(c-1) && int32(c)>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) -(MSUBW a x (MOVDconst [c])) && isPowerOfTwo(c+1) && int32(c)>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) -(MSUBW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MSUBW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MSUBW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MSUBW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MSUBW a x (MOVDconst [c])) && isPowerOfTwo64(c) => (SUBshiftLL a x [log2(c)]) +(MSUBW a x (MOVDconst [c])) && isPowerOfTwo64(c-1) && int32(c)>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) +(MSUBW a x (MOVDconst [c])) && isPowerOfTwo64(c+1) && int32(c)>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) +(MSUBW a x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MSUBW a x (MOVDconst [c])) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MSUBW a x (MOVDconst [c])) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MSUBW a x (MOVDconst [c])) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) (MSUBW a (MOVDconst [c]) x) && int32(c)==-1 => (ADD a x) (MSUBW a (MOVDconst [c]) _) && int32(c)==0 => a (MSUBW a (MOVDconst [c]) x) && int32(c)==1 => (SUB a x) -(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo(c) => (SUBshiftLL a x [log2(c)]) -(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo(c-1) && int32(c)>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) -(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo(c+1) && int32(c)>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) -(MSUBW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) -(MSUBW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) -(MSUBW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) -(MSUBW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) +(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo64(c) => (SUBshiftLL a x [log2(c)]) +(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo64(c-1) && int32(c)>=3 => (SUB a (ADDshiftLL x x [log2(c-1)])) +(MSUBW a (MOVDconst [c]) x) && isPowerOfTwo64(c+1) && int32(c)>=7 => (ADD a (SUBshiftLL x x [log2(c+1)])) +(MSUBW a (MOVDconst [c]) x) && c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) +(MSUBW a (MOVDconst [c]) x) && c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) +(MSUBW a (MOVDconst [c]) x) && c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) => (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) +(MSUBW a (MOVDconst [c]) x) && c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) => (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) // div by constant (UDIV x (MOVDconst [1])) => x -(UDIV x (MOVDconst [c])) && isPowerOfTwo(c) => (SRLconst [log2(c)] x) +(UDIV x (MOVDconst [c])) && isPowerOfTwo64(c) => (SRLconst [log2(c)] x) (UDIVW x (MOVDconst [c])) && uint32(c)==1 => x -(UDIVW x (MOVDconst [c])) && isPowerOfTwo(c) && is32Bit(c) => (SRLconst [log2(c)] x) +(UDIVW x (MOVDconst [c])) && isPowerOfTwo64(c) && is32Bit(c) => (SRLconst [log2(c)] x) (UMOD _ (MOVDconst [1])) => (MOVDconst [0]) -(UMOD x (MOVDconst [c])) && isPowerOfTwo(c) => (ANDconst [c-1] x) +(UMOD x (MOVDconst [c])) && isPowerOfTwo64(c) => (ANDconst [c-1] x) (UMODW _ (MOVDconst [c])) && uint32(c)==1 => (MOVDconst [0]) -(UMODW x (MOVDconst [c])) && isPowerOfTwo(c) && is32Bit(c) => (ANDconst [c-1] x) +(UMODW x (MOVDconst [c])) && isPowerOfTwo64(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/MIPS.rules b/src/cmd/compile/internal/ssa/gen/MIPS.rules index 246b4ebdbc5..ba3e8cc000b 100644 --- a/src/cmd/compile/internal/ssa/gen/MIPS.rules +++ b/src/cmd/compile/internal/ssa/gen/MIPS.rules @@ -584,13 +584,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 )) && 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) +(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) (MUL (MOVWconst [0]) _ ) => (MOVWconst [0]) (MUL (MOVWconst [1]) x ) => x (MUL (MOVWconst [-1]) x ) => (NEG x) -(MUL (MOVWconst [c]) x ) && isPowerOfTwo(int64(uint32(c))) => (SLLconst [int32(log2uint32(int64(c)))] x) +(MUL (MOVWconst [c]) x ) && isPowerOfTwo64(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 e008ec87036..8e4c3a07c80 100644 --- a/src/cmd/compile/internal/ssa/gen/MIPS64.rules +++ b/src/cmd/compile/internal/ssa/gen/MIPS64.rules @@ -580,13 +580,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]))) && isPowerOfTwo(c) => (SLLVconst [log2(c)] x) +(Select1 (MULVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (SLLVconst [log2(c)] x) // div by constant (Select1 (DIVVU x (MOVVconst [1]))) => x -(Select1 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo(c) => (SRLVconst [log2(c)] x) +(Select1 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (SRLVconst [log2(c)] x) (Select0 (DIVVU _ (MOVVconst [1]))) => (MOVVconst [0]) // mod -(Select0 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo(c) => (ANDconst [c-1] x) // mod +(Select0 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (ANDconst [c-1] x) // mod // generic simplifications (ADDV x (NEGV y)) => (SUBV x y) diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index 9b3c83d1cfb..ab6d0209421 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -449,10 +449,7 @@ func log2uint32(n int64) int64 { return int64(bits.Len32(uint32(n))) - 1 } -// isPowerOfTwo reports whether n is a power of 2. -func isPowerOfTwo(n int64) bool { - return n > 0 && n&(n-1) == 0 -} +// isPowerOfTwo functions report whether n is a power of 2. func isPowerOfTwo8(n int8) bool { return n > 0 && n&(n-1) == 0 } @@ -1555,7 +1552,7 @@ func (bfc arm64BitField) getARM64BFwidth() 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 && isPowerOfTwo(shiftedMask+1) && nto(shiftedMask)+lsb < 64 + return shiftedMask != 0 && isPowerOfTwo64(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/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index 15bb6274503..833470ea663 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -15834,12 +15834,12 @@ func rewriteValueAMD64_OpAMD64MULLconst(v *Value) bool { return true } // match: (MULLconst [c] x) - // cond: isPowerOfTwo(int64(c)+1) && c >= 15 + // cond: isPowerOfTwo64(int64(c)+1) && c >= 15 // result: (SUBL (SHLLconst [int8(log2(int64(c)+1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo(int64(c)+1) && c >= 15) { + if !(isPowerOfTwo64(int64(c)+1) && c >= 15) { break } v.reset(OpAMD64SUBL) @@ -16281,12 +16281,12 @@ func rewriteValueAMD64_OpAMD64MULQconst(v *Value) bool { return true } // match: (MULQconst [c] x) - // cond: isPowerOfTwo(int64(c)+1) && c >= 15 + // cond: isPowerOfTwo64(int64(c)+1) && c >= 15 // result: (SUBQ (SHLQconst [int8(log2(int64(c)+1))] x) x) for { c := auxIntToInt32(v.AuxInt) x := v_0 - if !(isPowerOfTwo(int64(c)+1) && c >= 15) { + if !(isPowerOfTwo64(int64(c)+1) && c >= 15) { break } v.reset(OpAMD64SUBQ) diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go index 327f1674b56..774e2ead680 100644 --- a/src/cmd/compile/internal/ssa/rewriteARM64.go +++ b/src/cmd/compile/internal/ssa/rewriteARM64.go @@ -4892,7 +4892,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (ADDshiftLL a x [log2(c)]) for { a := v_0 @@ -4901,7 +4901,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -4910,7 +4910,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && c>=3 + // cond: isPowerOfTwo64(c-1) && c>=3 // result: (ADD a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -4919,7 +4919,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c-1) && c >= 3) { + if !(isPowerOfTwo64(c-1) && c >= 3) { break } v.reset(OpARM64ADD) @@ -4930,7 +4930,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && c>=7 + // cond: isPowerOfTwo64(c+1) && c>=7 // result: (SUB a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -4939,7 +4939,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c+1) && c >= 7) { + if !(isPowerOfTwo64(c+1) && c >= 7) { break } v.reset(OpARM64SUB) @@ -4950,7 +4950,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) // result: (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -4959,7 +4959,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3)) { break } v.reset(OpARM64SUBshiftLL) @@ -4971,7 +4971,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) // result: (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -4980,7 +4980,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5)) { break } v.reset(OpARM64ADDshiftLL) @@ -4992,7 +4992,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) // result: (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -5001,7 +5001,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7)) { break } v.reset(OpARM64SUBshiftLL) @@ -5013,7 +5013,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) // result: (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -5022,7 +5022,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9)) { break } v.reset(OpARM64ADDshiftLL) @@ -5068,7 +5068,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (ADDshiftLL a x [log2(c)]) for { a := v_0 @@ -5077,7 +5077,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5086,7 +5086,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c-1) && c>=3 + // cond: isPowerOfTwo64(c-1) && c>=3 // result: (ADD a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -5095,7 +5095,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c-1) && c >= 3) { + if !(isPowerOfTwo64(c-1) && c >= 3) { break } v.reset(OpARM64ADD) @@ -5106,7 +5106,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c+1) && c>=7 + // cond: isPowerOfTwo64(c+1) && c>=7 // result: (SUB a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -5115,7 +5115,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c+1) && c >= 7) { + if !(isPowerOfTwo64(c+1) && c >= 7) { break } v.reset(OpARM64SUB) @@ -5126,7 +5126,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo(c/3) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) // result: (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -5135,7 +5135,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo(c/3)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3)) { break } v.reset(OpARM64SUBshiftLL) @@ -5147,7 +5147,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo(c/5) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) // result: (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -5156,7 +5156,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo(c/5)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5)) { break } v.reset(OpARM64ADDshiftLL) @@ -5168,7 +5168,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo(c/7) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) // result: (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -5177,7 +5177,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo(c/7)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7)) { break } v.reset(OpARM64SUBshiftLL) @@ -5189,7 +5189,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { return true } // match: (MADD a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo(c/9) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) // result: (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -5198,7 +5198,7 @@ func rewriteValueARM64_OpARM64MADD(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo(c/9)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9)) { break } v.reset(OpARM64ADDshiftLL) @@ -5299,7 +5299,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (ADDshiftLL a x [log2(c)]) for { a := v_0 @@ -5308,7 +5308,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5317,7 +5317,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && int32(c)>=3 + // cond: isPowerOfTwo64(c-1) && int32(c)>=3 // result: (ADD a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -5326,7 +5326,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { break } v.reset(OpARM64ADD) @@ -5337,7 +5337,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && int32(c)>=7 + // cond: isPowerOfTwo64(c+1) && int32(c)>=7 // result: (SUB a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -5346,7 +5346,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { break } v.reset(OpARM64SUB) @@ -5357,7 +5357,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) // result: (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -5366,7 +5366,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -5378,7 +5378,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) // result: (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -5387,7 +5387,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5399,7 +5399,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) // result: (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -5408,7 +5408,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -5420,7 +5420,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) // result: (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -5429,7 +5429,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5490,7 +5490,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (ADDshiftLL a x [log2(c)]) for { a := v_0 @@ -5499,7 +5499,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5508,7 +5508,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c-1) && int32(c)>=3 + // cond: isPowerOfTwo64(c-1) && int32(c)>=3 // result: (ADD a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -5517,7 +5517,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { break } v.reset(OpARM64ADD) @@ -5528,7 +5528,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c+1) && int32(c)>=7 + // cond: isPowerOfTwo64(c+1) && int32(c)>=7 // result: (SUB a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -5537,7 +5537,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { break } v.reset(OpARM64SUB) @@ -5548,7 +5548,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) // result: (SUBshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -5557,7 +5557,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -5569,7 +5569,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) // result: (ADDshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -5578,7 +5578,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5590,7 +5590,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) // result: (SUBshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -5599,7 +5599,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -5611,7 +5611,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { return true } // match: (MADDW a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) // result: (ADDshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -5620,7 +5620,7 @@ func rewriteValueARM64_OpARM64MADDW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -5711,7 +5711,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (NEG (SLLconst [log2(c)] x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5720,7 +5720,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { continue } v.reset(OpARM64NEG) @@ -5733,7 +5733,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && c >= 3 + // cond: isPowerOfTwo64(c-1) && c >= 3 // result: (NEG (ADDshiftLL x x [log2(c-1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5742,7 +5742,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c-1) && c >= 3) { + if !(isPowerOfTwo64(c-1) && c >= 3) { continue } v.reset(OpARM64NEG) @@ -5755,7 +5755,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && c >= 7 + // cond: isPowerOfTwo64(c+1) && c >= 7 // result: (NEG (ADDshiftLL (NEG x) x [log2(c+1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5764,7 +5764,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c+1) && c >= 7) { + if !(isPowerOfTwo64(c+1) && c >= 7) { continue } v.reset(OpARM64NEG) @@ -5779,7 +5779,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) // result: (SLLconst [log2(c/3)] (SUBshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5788,7 +5788,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3)) { continue } v.reset(OpARM64SLLconst) @@ -5803,7 +5803,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) // result: (NEG (SLLconst [log2(c/5)] (ADDshiftLL x x [2]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5812,7 +5812,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5)) { continue } v.reset(OpARM64NEG) @@ -5828,7 +5828,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) // result: (SLLconst [log2(c/7)] (SUBshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5837,7 +5837,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7)) { continue } v.reset(OpARM64SLLconst) @@ -5852,7 +5852,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { break } // match: (MNEG x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) // result: (NEG (SLLconst [log2(c/9)] (ADDshiftLL x x [3]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5861,7 +5861,7 @@ func rewriteValueARM64_OpARM64MNEG(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9)) { continue } v.reset(OpARM64NEG) @@ -5956,7 +5956,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (NEG (SLLconst [log2(c)] x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5965,7 +5965,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { continue } v.reset(OpARM64NEG) @@ -5978,7 +5978,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && int32(c) >= 3 + // cond: isPowerOfTwo64(c-1) && int32(c) >= 3 // result: (NEG (ADDshiftLL x x [log2(c-1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5987,7 +5987,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { continue } v.reset(OpARM64NEG) @@ -6000,7 +6000,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && int32(c) >= 7 + // cond: isPowerOfTwo64(c+1) && int32(c) >= 7 // result: (NEG (ADDshiftLL (NEG x) x [log2(c+1)])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -6009,7 +6009,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { continue } v.reset(OpARM64NEG) @@ -6024,7 +6024,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) // result: (SLLconst [log2(c/3)] (SUBshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -6033,7 +6033,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { continue } v.reset(OpARM64SLLconst) @@ -6048,7 +6048,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) // result: (NEG (SLLconst [log2(c/5)] (ADDshiftLL x x [2]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -6057,7 +6057,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { continue } v.reset(OpARM64NEG) @@ -6073,7 +6073,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) // result: (SLLconst [log2(c/7)] (SUBshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -6082,7 +6082,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { continue } v.reset(OpARM64SLLconst) @@ -6097,7 +6097,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { break } // match: (MNEGW x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) // result: (NEG (SLLconst [log2(c/9)] (ADDshiftLL x x [3]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -6106,7 +6106,7 @@ func rewriteValueARM64_OpARM64MNEGW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { continue } v.reset(OpARM64NEG) @@ -13380,7 +13380,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SUBshiftLL a x [log2(c)]) for { a := v_0 @@ -13389,7 +13389,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -13398,7 +13398,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && c>=3 + // cond: isPowerOfTwo64(c-1) && c>=3 // result: (SUB a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -13407,7 +13407,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c-1) && c >= 3) { + if !(isPowerOfTwo64(c-1) && c >= 3) { break } v.reset(OpARM64SUB) @@ -13418,7 +13418,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && c>=7 + // cond: isPowerOfTwo64(c+1) && c>=7 // result: (ADD a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -13427,7 +13427,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c+1) && c >= 7) { + if !(isPowerOfTwo64(c+1) && c >= 7) { break } v.reset(OpARM64ADD) @@ -13438,7 +13438,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) // result: (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -13447,7 +13447,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3)) { break } v.reset(OpARM64ADDshiftLL) @@ -13459,7 +13459,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) // result: (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -13468,7 +13468,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5)) { break } v.reset(OpARM64SUBshiftLL) @@ -13480,7 +13480,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) // result: (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -13489,7 +13489,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7)) { break } v.reset(OpARM64ADDshiftLL) @@ -13501,7 +13501,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) // result: (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -13510,7 +13510,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9)) { break } v.reset(OpARM64SUBshiftLL) @@ -13556,7 +13556,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SUBshiftLL a x [log2(c)]) for { a := v_0 @@ -13565,7 +13565,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -13574,7 +13574,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c-1) && c>=3 + // cond: isPowerOfTwo64(c-1) && c>=3 // result: (SUB a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -13583,7 +13583,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c-1) && c >= 3) { + if !(isPowerOfTwo64(c-1) && c >= 3) { break } v.reset(OpARM64SUB) @@ -13594,7 +13594,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c+1) && c>=7 + // cond: isPowerOfTwo64(c+1) && c>=7 // result: (ADD a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -13603,7 +13603,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c+1) && c >= 7) { + if !(isPowerOfTwo64(c+1) && c >= 7) { break } v.reset(OpARM64ADD) @@ -13614,7 +13614,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo(c/3) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) // result: (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -13623,7 +13623,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo(c/3)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3)) { break } v.reset(OpARM64ADDshiftLL) @@ -13635,7 +13635,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo(c/5) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) // result: (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -13644,7 +13644,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo(c/5)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5)) { break } v.reset(OpARM64SUBshiftLL) @@ -13656,7 +13656,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo(c/7) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) // result: (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -13665,7 +13665,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo(c/7)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7)) { break } v.reset(OpARM64ADDshiftLL) @@ -13677,7 +13677,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { return true } // match: (MSUB a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo(c/9) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) // result: (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -13686,7 +13686,7 @@ func rewriteValueARM64_OpARM64MSUB(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo(c/9)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9)) { break } v.reset(OpARM64SUBshiftLL) @@ -13787,7 +13787,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SUBshiftLL a x [log2(c)]) for { a := v_0 @@ -13796,7 +13796,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -13805,7 +13805,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && int32(c)>=3 + // cond: isPowerOfTwo64(c-1) && int32(c)>=3 // result: (SUB a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -13814,7 +13814,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { break } v.reset(OpARM64SUB) @@ -13825,7 +13825,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && int32(c)>=7 + // cond: isPowerOfTwo64(c+1) && int32(c)>=7 // result: (ADD a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -13834,7 +13834,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(isPowerOfTwo(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { break } v.reset(OpARM64ADD) @@ -13845,7 +13845,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) // result: (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -13854,7 +13854,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -13866,7 +13866,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) // result: (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -13875,7 +13875,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -13887,7 +13887,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) // result: (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -13896,7 +13896,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -13908,7 +13908,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) // result: (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -13917,7 +13917,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { break } c := auxIntToInt64(v_2.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -13978,7 +13978,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SUBshiftLL a x [log2(c)]) for { a := v_0 @@ -13987,7 +13987,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -13996,7 +13996,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c-1) && int32(c)>=3 + // cond: isPowerOfTwo64(c-1) && int32(c)>=3 // result: (SUB a (ADDshiftLL x x [log2(c-1)])) for { a := v_0 @@ -14005,7 +14005,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { break } v.reset(OpARM64SUB) @@ -14016,7 +14016,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: isPowerOfTwo(c+1) && int32(c)>=7 + // cond: isPowerOfTwo64(c+1) && int32(c)>=7 // result: (ADD a (SUBshiftLL x x [log2(c+1)])) for { a := v_0 @@ -14025,7 +14025,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(isPowerOfTwo(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { break } v.reset(OpARM64ADD) @@ -14036,7 +14036,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) // result: (ADDshiftLL a (SUBshiftLL x x [2]) [log2(c/3)]) for { a := v_0 @@ -14045,7 +14045,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -14057,7 +14057,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) // result: (SUBshiftLL a (ADDshiftLL x x [2]) [log2(c/5)]) for { a := v_0 @@ -14066,7 +14066,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -14078,7 +14078,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) // result: (ADDshiftLL a (SUBshiftLL x x [3]) [log2(c/7)]) for { a := v_0 @@ -14087,7 +14087,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { break } v.reset(OpARM64ADDshiftLL) @@ -14099,7 +14099,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { return true } // match: (MSUBW a (MOVDconst [c]) x) - // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) // result: (SUBshiftLL a (ADDshiftLL x x [3]) [log2(c/9)]) for { a := v_0 @@ -14108,7 +14108,7 @@ func rewriteValueARM64_OpARM64MSUBW(v *Value) bool { } c := auxIntToInt64(v_1.AuxInt) x := v_2 - if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { break } v.reset(OpARM64SUBshiftLL) @@ -14214,7 +14214,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SLLconst [log2(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14223,7 +14223,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { continue } v.reset(OpARM64SLLconst) @@ -14234,7 +14234,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && c >= 3 + // cond: isPowerOfTwo64(c-1) && c >= 3 // result: (ADDshiftLL x x [log2(c-1)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14243,7 +14243,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c-1) && c >= 3) { + if !(isPowerOfTwo64(c-1) && c >= 3) { continue } v.reset(OpARM64ADDshiftLL) @@ -14254,7 +14254,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && c >= 7 + // cond: isPowerOfTwo64(c+1) && c >= 7 // result: (ADDshiftLL (NEG x) x [log2(c+1)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14263,7 +14263,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c+1) && c >= 7) { + if !(isPowerOfTwo64(c+1) && c >= 7) { continue } v.reset(OpARM64ADDshiftLL) @@ -14276,7 +14276,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) // result: (SLLconst [log2(c/3)] (ADDshiftLL x x [1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14285,7 +14285,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3)) { continue } v.reset(OpARM64SLLconst) @@ -14299,7 +14299,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) // result: (SLLconst [log2(c/5)] (ADDshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14308,7 +14308,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5)) { continue } v.reset(OpARM64SLLconst) @@ -14322,7 +14322,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) // result: (SLLconst [log2(c/7)] (ADDshiftLL (NEG x) x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14331,7 +14331,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7)) { continue } v.reset(OpARM64SLLconst) @@ -14347,7 +14347,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { break } // match: (MUL x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) // result: (SLLconst [log2(c/9)] (ADDshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14356,7 +14356,7 @@ func rewriteValueARM64_OpARM64MUL(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9)) { continue } v.reset(OpARM64SLLconst) @@ -14464,7 +14464,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SLLconst [log2(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14473,7 +14473,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { continue } v.reset(OpARM64SLLconst) @@ -14484,7 +14484,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: isPowerOfTwo(c-1) && int32(c) >= 3 + // cond: isPowerOfTwo64(c-1) && int32(c) >= 3 // result: (ADDshiftLL x x [log2(c-1)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14493,7 +14493,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c-1) && int32(c) >= 3) { + if !(isPowerOfTwo64(c-1) && int32(c) >= 3) { continue } v.reset(OpARM64ADDshiftLL) @@ -14504,7 +14504,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: isPowerOfTwo(c+1) && int32(c) >= 7 + // cond: isPowerOfTwo64(c+1) && int32(c) >= 7 // result: (ADDshiftLL (NEG x) x [log2(c+1)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14513,7 +14513,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c+1) && int32(c) >= 7) { + if !(isPowerOfTwo64(c+1) && int32(c) >= 7) { continue } v.reset(OpARM64ADDshiftLL) @@ -14526,7 +14526,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c) + // cond: c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c) // result: (SLLconst [log2(c/3)] (ADDshiftLL x x [1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14535,7 +14535,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%3 == 0 && isPowerOfTwo(c/3) && is32Bit(c)) { + if !(c%3 == 0 && isPowerOfTwo64(c/3) && is32Bit(c)) { continue } v.reset(OpARM64SLLconst) @@ -14549,7 +14549,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c) + // cond: c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c) // result: (SLLconst [log2(c/5)] (ADDshiftLL x x [2])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14558,7 +14558,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%5 == 0 && isPowerOfTwo(c/5) && is32Bit(c)) { + if !(c%5 == 0 && isPowerOfTwo64(c/5) && is32Bit(c)) { continue } v.reset(OpARM64SLLconst) @@ -14572,7 +14572,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c) + // cond: c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c) // result: (SLLconst [log2(c/7)] (ADDshiftLL (NEG x) x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14581,7 +14581,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%7 == 0 && isPowerOfTwo(c/7) && is32Bit(c)) { + if !(c%7 == 0 && isPowerOfTwo64(c/7) && is32Bit(c)) { continue } v.reset(OpARM64SLLconst) @@ -14597,7 +14597,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { break } // match: (MULW x (MOVDconst [c])) - // cond: c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c) + // cond: c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c) // result: (SLLconst [log2(c/9)] (ADDshiftLL x x [3])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -14606,7 +14606,7 @@ func rewriteValueARM64_OpARM64MULW(v *Value) bool { continue } c := auxIntToInt64(v_1.AuxInt) - if !(c%9 == 0 && isPowerOfTwo(c/9) && is32Bit(c)) { + if !(c%9 == 0 && isPowerOfTwo64(c/9) && is32Bit(c)) { continue } v.reset(OpARM64SLLconst) @@ -20386,7 +20386,7 @@ func rewriteValueARM64_OpARM64UDIV(v *Value) bool { return true } // match: (UDIV x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SRLconst [log2(c)] x) for { x := v_0 @@ -20394,7 +20394,7 @@ func rewriteValueARM64_OpARM64UDIV(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64SRLconst) @@ -20438,7 +20438,7 @@ func rewriteValueARM64_OpARM64UDIVW(v *Value) bool { return true } // match: (UDIVW x (MOVDconst [c])) - // cond: isPowerOfTwo(c) && is32Bit(c) + // cond: isPowerOfTwo64(c) && is32Bit(c) // result: (SRLconst [log2(c)] x) for { x := v_0 @@ -20446,7 +20446,7 @@ func rewriteValueARM64_OpARM64UDIVW(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c) && is32Bit(c)) { + if !(isPowerOfTwo64(c) && is32Bit(c)) { break } v.reset(OpARM64SRLconst) @@ -20502,7 +20502,7 @@ func rewriteValueARM64_OpARM64UMOD(v *Value) bool { return true } // match: (UMOD x (MOVDconst [c])) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (ANDconst [c-1] x) for { x := v_0 @@ -20510,7 +20510,7 @@ func rewriteValueARM64_OpARM64UMOD(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpARM64ANDconst) @@ -20571,7 +20571,7 @@ func rewriteValueARM64_OpARM64UMODW(v *Value) bool { return true } // match: (UMODW x (MOVDconst [c])) - // cond: isPowerOfTwo(c) && is32Bit(c) + // cond: isPowerOfTwo64(c) && is32Bit(c) // result: (ANDconst [c-1] x) for { x := v_0 @@ -20579,7 +20579,7 @@ func rewriteValueARM64_OpARM64UMODW(v *Value) bool { break } c := auxIntToInt64(v_1.AuxInt) - if !(isPowerOfTwo(c) && is32Bit(c)) { + if !(isPowerOfTwo64(c) && is32Bit(c)) { break } v.reset(OpARM64ANDconst) diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go index 87d1aa378f7..175ba770c28 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go @@ -3852,7 +3852,7 @@ func rewriteValueMIPS_OpMIPSMUL(v *Value) bool { break } // match: (MUL (MOVWconst [c]) x ) - // cond: isPowerOfTwo(int64(uint32(c))) + // cond: isPowerOfTwo64(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 { @@ -3861,7 +3861,7 @@ func rewriteValueMIPS_OpMIPSMUL(v *Value) bool { } c := auxIntToInt32(v_0.AuxInt) x := v_1 - if !(isPowerOfTwo(int64(uint32(c)))) { + if !(isPowerOfTwo64(int64(uint32(c)))) { continue } v.reset(OpMIPSSLLconst) @@ -6388,7 +6388,7 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool { break } // match: (Select0 (MULTU (MOVWconst [c]) x )) - // cond: isPowerOfTwo(int64(uint32(c))) + // cond: isPowerOfTwo64(int64(uint32(c))) // result: (SRLconst [int32(32-log2uint32(int64(c)))] x) for { if v_0.Op != OpMIPSMULTU { @@ -6403,7 +6403,7 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool { } c := auxIntToInt32(v_0_0.AuxInt) x := v_0_1 - if !(isPowerOfTwo(int64(uint32(c)))) { + if !(isPowerOfTwo64(int64(uint32(c)))) { continue } v.reset(OpMIPSSRLconst) @@ -6576,7 +6576,7 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool { break } // match: (Select1 (MULTU (MOVWconst [c]) x )) - // cond: isPowerOfTwo(int64(uint32(c))) + // cond: isPowerOfTwo64(int64(uint32(c))) // result: (SLLconst [int32(log2uint32(int64(c)))] x) for { if v_0.Op != OpMIPSMULTU { @@ -6591,7 +6591,7 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool { } c := auxIntToInt32(v_0_0.AuxInt) x := v_0_1 - if !(isPowerOfTwo(int64(uint32(c)))) { + if !(isPowerOfTwo64(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 dfff1c03b70..d0751ee5c39 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go @@ -6865,7 +6865,7 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool { return true } // match: (Select0 (DIVVU x (MOVVconst [c]))) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (ANDconst [c-1] x) for { if v_0.Op != OpMIPS64DIVVU { @@ -6878,7 +6878,7 @@ func rewriteValueMIPS64_OpSelect0(v *Value) bool { break } c := auxIntToInt64(v_0_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpMIPS64ANDconst) @@ -7012,7 +7012,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { break } // match: (Select1 (MULVU x (MOVVconst [c]))) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SLLVconst [log2(c)] x) for { if v_0.Op != OpMIPS64MULVU { @@ -7027,7 +7027,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { continue } c := auxIntToInt64(v_0_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { continue } v.reset(OpMIPS64SLLVconst) @@ -7053,7 +7053,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { return true } // match: (Select1 (DIVVU x (MOVVconst [c]))) - // cond: isPowerOfTwo(c) + // cond: isPowerOfTwo64(c) // result: (SRLVconst [log2(c)] x) for { if v_0.Op != OpMIPS64DIVVU { @@ -7066,7 +7066,7 @@ func rewriteValueMIPS64_OpSelect1(v *Value) bool { break } c := auxIntToInt64(v_0_1.AuxInt) - if !(isPowerOfTwo(c)) { + if !(isPowerOfTwo64(c)) { break } v.reset(OpMIPS64SRLVconst)