This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Integer constant multiplication on Alpha
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: gcc at gcc dot gnu dot org
- Date: 20 Dec 2001 16:44:38 +0100
- Subject: Integer constant multiplication on Alpha
Hi,
I noticed gcc optimizes multiplications with integers quite good,
which is nice, but I have a few questions :)
* Where in the code does this happen? I looked quite hard, but
couldn't find it.
* Why isn't this disabled on -Os?
* The code seems slightly subobtimal sometimes:
int foo(int x) {
return 6*x;
}
yields
s4subq $16,$16,$0
addq $0,$0,$0
addl $0,$31,$0
ret $31,($26),1
with gcc 2.95.4 (Debian prerelease). What does that addl $0,$31,$0 do?
It looks like a sign extension, but the same could be achieved by just
using addl...
Also gcc 3.0 introduces a redundant mov:
mov $16,$1
s4subq $1,$1,$2
addq $2,$2,$1
addl $1,$31,$0
ret $31,($26),1
where could I look to check where this comes from?
Falk