Re: long long on 32-bit machines

From: David S. Miller
Date: Wed Jan 28 2004 - 14:18:32 EST


On Wed, 28 Jan 2004 14:12:50 -0500
Timothy Miller <miller@xxxxxxxxxxxxxx> wrote:

> I don't know how it is for GCC, but when using the Sun compiler, "long
> long" for 32-bit is low-high, while "long long" (or just long) for
> 64-bit is high-low. This has been an annoyance to me. :)

For 64-bit it goes into a single 64-bit register.
And for 32-bit the sequence is high 32-bits low 32-bits.
At least on Sparc.

extern void foo(long long a);
void bar(void)
{
foo(1);
}
/* gcc -m32 -S -o bar.s bar.c */
bar:
!#PROLOGUE# 0
save %sp, -104, %sp
!#PROLOGUE# 1
mov 0, %o0
mov 1, %o1
call foo, 0
nop
nop
ret
restore
/* gcc -m64 -S -o bar.s bar.c */
bar:
!#PROLOGUE# 0
save %sp, -192, %sp
!#PROLOGUE# 1
mov 1, %o0
call foo, 0
nop
nop
return %i7+8
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/