This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/71486] Transparent union doesn't work with long double for x86_64


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71486

--- Comment #2 from UroÅ Bizjak <ubizjak at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> I thought the ABI for transparent unions was that of passing its members.
> 
> But int128 and long double are passed differently.

Similar case compiles OK (value in int reg vs. value in XMM reg):

--cut here--
union U { long x; double y; } __attribute__ ((transparent_union));

void foo (union U);

void test (void)
{
  union U t;

  foo (1.0);
  foo (1L);
}
--cut here--

-O2:

        movabsq $4607182418800017408, %rdi
        call    foo
        movl    $1, %edi
        call    foo

and even following for 32bit target, value in int reg vs. memory:

--cut here--
union U { int x; float y; } __attribute__ ((transparent_union));

void foo (union U);

void test (void)
{
  union U t;

  foo (1.0f);
  foo (1);
}
--cut here--

-O2 -m32 -mregparm=1:

        movl    $1065353216, %eax
        call    foo
        movl    $1, %eax
        call    foo

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]