public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102143] New: ABI incompatibility with clang when passing 32bit vectors on 32bit i686
@ 2021-08-31  8:45 ubizjak at gmail dot com
  2021-08-31 13:36 ` [Bug target/102143] " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2021-08-31  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102143
           Summary: ABI incompatibility with clang when passing 32bit
                    vectors on 32bit i686
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---

Following testcase:

--cut here--
typedef short __v2hi __attribute__((__vector_size__ (4)));

__v2hi
foo (__v2hi x, __v2hi y)
{
  return x + y;
}
--cut here--

exhibits ABI incompatibility with clang when passing 32bit vectors on 32bit
i686.

gcc-12 compiles with "-O2 -msse2" to:

foo:
        movd    4(%esp), %xmm0
        movd    8(%esp), %xmm1
        paddw   %xmm1, %xmm0
        movd    %xmm0, %eax
        ret

(gcc before version 12 uses the same ABI).

while clang-11 compiles the testacse to:

foo:
        paddw   %xmm1, %xmm0
        retl

So, clang is passing 32bit vectors via vector registers, while gcc is passing
them like integer values in memory and returns them in integer return register.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-02  2:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31  8:45 [Bug target/102143] New: ABI incompatibility with clang when passing 32bit vectors on 32bit i686 ubizjak at gmail dot com
2021-08-31 13:36 ` [Bug target/102143] " hjl.tools at gmail dot com
2021-09-01  7:24 ` ubizjak at gmail dot com
2021-09-01  7:28 ` ubizjak at gmail dot com
2021-09-01  7:32 ` jakub at gcc dot gnu.org
2021-09-01  7:33 ` ubizjak at gmail dot com
2021-09-02  2:02 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).