public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102143] New: ABI incompatibility with clang when passing 32bit vectors on 32bit i686
Date: Tue, 31 Aug 2021 08:45:36 +0000	[thread overview]
Message-ID: <bug-102143-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-08-31  8:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  8:45 ubizjak at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102143-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).