public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "simb611alt at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/101985] New: vec_cpsgn parameter order
Date: Thu, 19 Aug 2021 18:36:48 +0000	[thread overview]
Message-ID: <bug-101985-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 101985
           Summary: vec_cpsgn parameter order
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simb611alt at gmail dot com
  Target Milestone: ---

I have found an issue where the parameter order of the vec_cpsgn function on
POWER is reversed. Clang has recently fixed the same issue in their code which
leaves only GCC using the reversed order.
XLC always used the order clang currently uses.

Patch link for clang -
https://github.com/llvm/llvm-project/commit/1af037f643fc5499f83d92e5aec199950871d475

Link to POWER documentation -
http://cdn.openpowerfoundation.org/wp-content/uploads/resources/Intrinsics-Reference/content/VIPR.reference.vecfns.html

#include <stdio.h>
#include <altivec.h>

int main() {
    vector float a = {  1,  2, - 3, - 4};
    vector float b = {-10, 20, -30,  40};

    a = vec_cpsgn(a, b);
    printf("%f %f %f %f\n", a[0], a[1], a[2], a[3]);
    return 0;
}

Output for GCC 11.0.1:
-1.000000 2.000000 -3.000000 4.000000

Output for clang 12.0.1:
10.000000 20.000000 -30.000000 -40.000000

Output for xlc 16.1.1:
10.000000 20.000000 -30.000000 -40.000000

             reply	other threads:[~2021-08-19 18:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 18:36 simb611alt at gmail dot com [this message]
2021-09-23 16:40 ` [Bug target/101985] " wschmidt at gcc dot gnu.org
2021-09-24 15:33 ` wschmidt at gcc dot gnu.org
2021-09-28 15:28 ` wschmidt at gcc dot gnu.org
2021-09-29 19:33 ` simb611alt at gmail dot com
2021-10-12 22:39 ` cvs-commit at gcc dot gnu.org
2021-10-12 22:43 ` wschmidt at gcc dot gnu.org
2021-11-23 21:26 ` cvs-commit at gcc dot gnu.org
2021-11-23 22:40 ` cvs-commit at gcc dot gnu.org
2021-11-23 23:06 ` cvs-commit at gcc dot gnu.org
2021-11-23 23:07 ` wschmidt at gcc dot gnu.org
2022-11-17 21:02 ` mark.j.abraham 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-101985-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).