will multi-register returns get fixed?
David Mosberger
davidm@napali.hpl.hp.com
Fri Jun 6 20:25:00 GMT 2003
>>>>> On Fri, 6 Jun 2003 22:16:50 +0200 (CEST), Michael Matz <matz@suse.de> said:
Michael> Hi,
Michael> On Fri, 6 Jun 2003, David Mosberger wrote:
>> platform
>> compiler: x86 ia64
>> gcc atrocious code atrocious code
Michael> What exactly is atrocious with that code:
Michael> foo:
Michael> movl 4(%esp), %ecx
Michael> xorl %edx, %edx
Michael> testl %ecx, %ecx
Michael> movl $-13, %eax
Michael> jle .L1
Michael> movl %ecx, %eax
Michael> xorl %edx, %edx
Michael> .L1:
Michael> ret
Michael> ???
Nothing! ;-)
I found an x86 box now with gcc3.x installed and it looks like
gcc3/x86 handles "long long" returns much better than gcc 2.9x.
That's nice.
However, I don't think the problem is fixed in general. If I try to
return a pair of 32-bit "long" values, I get:
foo:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl 12(%ebp), %eax
testl %eax, %eax
movl 8(%ebp), %ecx
jle .L2
movl %eax, -8(%ebp)
movl $0, -4(%ebp)
.L3:
movl -8(%ebp), %eax
movl -4(%ebp), %edx
movl %edx, 4(%ecx)
movl %eax, (%ecx)
movl %ecx, %eax
leave
ret $4
Or am I missing something?
--david
More information about the Gcc
mailing list