[klibc] Re: long long on 32-bit machines

David S. Miller davem at redhat.com
Wed Jan 28 11:15:29 PST 2004


On Wed, 28 Jan 2004 14:12:50 -0500
Timothy Miller <miller at techsource.com> 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



More information about the klibc mailing list