http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13355
--- Comment #9 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-08
22:41:41 UTC ---
(In reply to comment #6)
> A reduced testcase for the second case.
> On mainline, i686-pc-linux-gnu.
>
> /* -march=i686 -mtune=i686 -fomit-frame-pointer -O2 */
>
> register int ebx asm ("ebx");
> register int dummy1 asm ("esi");
> register int dummy2 asm ("ebp");
>
> int
> foo (int arg)
> {
> long long res = (long long) arg * (long long) ebx;
> return (int) res;
> }
>
> Global variables take up three registers from IA-32!
GCC 4.1, GCC 4.3, and GCC 4.7 compile this to:
foo:
subl $12, %esp
movl 16(%esp), %eax
imull %ebx
movl %eax, (%esp)
movl (%esp), %eax
movl %edx, 4(%esp)
addl $12, %esp
ret
Trunk r193340 compiles it to:
foo:
movl %ebx, %eax
imull 4(%esp)
ret