Lines Matching +full:a +full:- +full:c
1 /* SPDX-License-Identifier: GPL-2.0 */
8 * a supported configuration.
10 * With just a barrel shifter, we can implement an efficient constant
11 * multiply using shifts and adds. GCC can find a 9-step solution, but
12 * this 6-step solution was found by Yevgen Voronenko's implementation
15 * That software is really not designed for a single multiplier this large,
17 * 6-shift, 6-add sequences for computing x * 0x61C88647. They are all
18 * c = (x << 19) + x;
19 * a = (x << 9) + c;
20 * b = (x << 23) + a;
21 * return (a<<11) + (b<<6) + (c<<3) - b;
24 * Without even a shifter, it's hopless; any hash function will suck.
32 static inline u32 __attribute_const__ __hash_32(u32 a) in __hash_32() argument
35 unsigned int b, c; in __hash_32() local
38 b = a << 23; in __hash_32()
39 c = (a << 19) + a; in __hash_32()
40 a = (a << 9) + c; in __hash_32()
41 b += a; in __hash_32()
43 /* Phase 2: Compute (a << 11) + (b << 6) + (c << 3) - b */ in __hash_32()
44 a <<= 5; in __hash_32()
45 a += b; /* (a << 5) + b */ in __hash_32()
46 a <<= 3; in __hash_32()
47 a += c; /* (a << 8) + (b << 3) + c */ in __hash_32()
48 a <<= 3; in __hash_32()
49 return a - b; /* (a << 11) + (b << 6) + (c << 3) - b */ in __hash_32()
54 * Without a barrel shifter, left shifts are implemented as in __hash_32()
56 * addition-subtraction chain. This one is not known to be in __hash_32()
57 * optimal, but at 37 steps, it's decent for a 31-bit multiplier. in __hash_32()
62 unsigned int b, c, d; in __hash_32()
64 b = a << 4; /* 4 */ in __hash_32()
65 c = b << 1; /* 1 5 */ in __hash_32()
66 b += a; /* 1 6 */ in __hash_32()
67 c += b; /* 1 7 */ in __hash_32()
68 c <<= 3; /* 3 10 */ in __hash_32()
69 c -= a; /* 1 11 */ in __hash_32()
70 d = c << 7; /* 7 18 */ in __hash_32()
73 d += a; /* 1 28 */ in __hash_32()
77 return d + c; /* 1 37 total instructions*/ in __hash_32()