x86-64 psABI says:
The 64-bit mantissa of arguments of type {long double
belongs to class X87, the 16-bit exponent plus 6 bytes of padding
belongs to class X87UP.
...
If one of the classes is X87, X87UP, COMPLEX\_X87 class,
MEMORY is used as class.
But I got
[...@gnu-6 avx-abi]$ cat u4.i
union sse2
{
int i;
long double x;
};
long double
bar2 (union sse2 x)
{
return x.x;
}
long double
foo2 (long double x)
{
union sse2 y;
y.x = x;
return bar2 (y);
}
[...@gnu-6 avx-abi]$ gcc -S u4.i -O -fno-asynchronous-unwind-tables
[...@gnu-6 avx-abi]$ cat u4.s
.file "u4.i"
.text
.globl bar2
.type bar2, @function
bar2:
movq %rdi, -24(%rsp)
movq %xmm0, -16(%rsp)
fldt -24(%rsp)
ret
.size bar2, .-bar2
.globl foo2
.type foo2, @function
foo2:
subq $24, %rsp
movq 32(%rsp), %rax
movl 40(%rsp), %edx
movq %rax, (%rsp)
movl %edx, 8(%rsp)
movq (%rsp), %rdi
movq 8(%rsp), %xmm0
call bar2
addq $24, %rsp
ret
.size foo2, .-foo2
Dave, does icc follow psABI?
--
Summary: union with long double doesn't follow x86-64 psABI
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
GCC target triplet: x86_64-*-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39082