Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for isPowerOfTwo64 (0.37 sec)

  1. src/cmd/compile/internal/ssa/_gen/ARM64.rules

    (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.Type> x) x [log64(c+1)])
    (MUL x (MOVDconst [c])) && c%3 == 0 && isPowerOfTwo64(c/3) => (SLLconst [log64(c/3)] (ADDshiftLL <x.Type> x x [1]))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 15:49:20 UTC 2024
    - 113.1K bytes
    - Viewed (0)
  2. test/codegen/bmi.go

    	// amd64/v3:"BLSRL"
    	return x & (x - 1)
    }
    
    func isPowerOfTwo64(x int64) bool {
    	// amd64/v3:"BLSRQ",-"TESTQ",-"CALL"
    	return blsr64(x) == 0
    }
    
    func isPowerOfTwo32(x int32) bool {
    	// amd64/v3:"BLSRL",-"TESTL",-"CALL"
    	return blsr32(x) == 0
    }
    
    func isPowerOfTwoSelect64(x, a, b int64) int64 {
    	var r int64
    	// amd64/v3:"BLSRQ",-"TESTQ",-"CALL"
    	if isPowerOfTwo64(x) {
    		r = a
    	} else {
    		r = b
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 20 04:58:59 UTC 2023
    - 4.2K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/ssa/rewriteARM64.go

    		v.AddArg2(a, x)
    		return true
    	}
    	// match: (MADD a x (MOVDconst [c]))
    	// cond: isPowerOfTwo64(c)
    	// result: (ADDshiftLL a x [log64(c)])
    	for {
    		a := v_0
    		x := v_1
    		if v_2.Op != OpARM64MOVDconst {
    			break
    		}
    		c := auxIntToInt64(v_2.AuxInt)
    		if !(isPowerOfTwo64(c)) {
    			break
    		}
    		v.reset(OpARM64ADDshiftLL)
    		v.AuxInt = int64ToAuxInt(log64(c))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 15:49:20 UTC 2024
    - 608.6K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/ssa/_gen/LOONG64.rules

    (MULV x (MOVVconst [1])) => x
    (MULV x (MOVVconst [c])) && isPowerOfTwo64(c) => (SLLVconst [log64(c)] x)
    
    // div by constant
    (DIVVU x (MOVVconst [1])) => x
    (DIVVU x (MOVVconst [c])) && isPowerOfTwo64(c) => (SRLVconst [log64(c)] x)
    (REMVU _ (MOVVconst [1])) => (MOVVconst [0])                       // mod
    (REMVU x (MOVVconst [c])) && isPowerOfTwo64(c) => (ANDconst [c-1] x) // mod
    
    // generic simplifications
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 21 19:26:25 UTC 2023
    - 31.8K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/ssa/_gen/MIPS.rules

    (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)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 14:43:03 UTC 2023
    - 35.3K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/ssa/_gen/MIPS64.rules

    (Select1 (MULVU x (MOVVconst [c]))) && isPowerOfTwo64(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)
    (Select0 (DIVVU _ (MOVVconst [1]))) => (MOVVconst [0])                       // mod
    (Select0 (DIVVU x (MOVVconst [c]))) && isPowerOfTwo64(c) => (ANDconst [c-1] x) // mod
    
    // generic simplifications
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jul 31 03:59:48 UTC 2023
    - 41.9K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/ssa/_gen/generic.rules

    (Mul16 <t> n (Const16 [c])) && isPowerOfTwo16(c) => (Lsh16x64 <t> n (Const64 <typ.UInt64> [log16(c)]))
    (Mul32 <t> n (Const32 [c])) && isPowerOfTwo32(c) => (Lsh32x64 <t> n (Const64 <typ.UInt64> [log32(c)]))
    (Mul64 <t> n (Const64 [c])) && isPowerOfTwo64(c) => (Lsh64x64 <t> n (Const64 <typ.UInt64> [log64(c)]))
    (Mul8  <t> n (Const8  [c])) && t.IsSigned() && isPowerOfTwo8(-c)  => (Neg8  (Lsh8x64  <t> n (Const64 <typ.UInt64> [log8(-c)])))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 22:21:05 UTC 2024
    - 135.3K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/ssa/rewriteLOONG64.go

    			break
    		}
    		v.copyOf(x)
    		return true
    	}
    	// match: (DIVVU x (MOVVconst [c]))
    	// cond: isPowerOfTwo64(c)
    	// result: (SRLVconst [log64(c)] x)
    	for {
    		x := v_0
    		if v_1.Op != OpLOONG64MOVVconst {
    			break
    		}
    		c := auxIntToInt64(v_1.AuxInt)
    		if !(isPowerOfTwo64(c)) {
    			break
    		}
    		v.reset(OpLOONG64SRLVconst)
    		v.AuxInt = int64ToAuxInt(log64(c))
    		v.AddArg(x)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 21 19:26:25 UTC 2023
    - 195.8K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/ssa/rewriteMIPS.go

    		}
    		break
    	}
    	// match: (MUL (MOVWconst [c]) x )
    	// 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 {
    			if v_0.Op != OpMIPSMOVWconst {
    				continue
    			}
    			c := auxIntToInt32(v_0.AuxInt)
    			x := v_1
    			if !(isPowerOfTwo64(int64(uint32(c)))) {
    				continue
    			}
    			v.reset(OpMIPSSLLconst)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 14:43:03 UTC 2023
    - 176.6K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/ssa/rewrite.go

    	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 {
    	return n > 0 && n&(n-1) == 0
    }
    
    // isUint64PowerOfTwo reports whether uint64(n) is a power of 2.
    func isUint64PowerOfTwo(in int64) bool {
    	n := uint64(in)
    	return n > 0 && n&(n-1) == 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 19:02:52 UTC 2024
    - 64.2K bytes
    - Viewed (0)
Back to top