Hi Jon,
I'd like to try to optimise double word left shifts of sign/zero
extended
operands if a widening multiply instruction is available. For the
following
code:
long long f(long a, long b)
{
return (long long)a << b;
}
I'd like to optimise this to something like:
(long long) a * (1 << b)
Which should just be 3 or so instructions.
Only if b < bits_per_long; it is quite a bit more otherwise
(you then need 1LL << b).
If your pattern actually works for b <= bits_per_long, you
can do b1 = b >> 1; b2 = b - b1; return (a << b1) << b2;
reasonably cheaply.
Segher