public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101985] New: vec_cpsgn parameter order
@ 2021-08-19 18:36 simb611alt at gmail dot com
  2021-09-23 16:40 ` [Bug target/101985] " wschmidt at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: simb611alt at gmail dot com @ 2021-08-19 18:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

end of thread, other threads:[~2022-11-17 21:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
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

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).