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
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
@ 2021-09-23 16:40 ` wschmidt at gcc dot gnu.org
2021-09-24 15:33 ` wschmidt at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2021-09-23 16:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
Bill Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Assignee|unassigned at gcc dot gnu.org |wschmidt at gcc dot gnu.org
Last reconfirmed| |2021-09-23
--- Comment #1 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Confirmed. I'll take a look.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
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
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2021-09-24 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #2 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Patch posted at
https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580235.html.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2021-09-28 15:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #3 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Kunwar, can you please tell us (if you don't mind) where the problem was
detected? Since we're changing behavior of the intrinsic, we'll need to
document this, and knowing whether we have problematic code in the wild that
relies on present behavior would be helpful.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (2 preceding siblings ...)
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
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: simb611alt at gmail dot com @ 2021-09-29 19:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #4 from Kunwar Maheep Singh <simb611alt at gmail dot com> ---
(In reply to Bill Schmidt from comment #3)
> Kunwar, can you please tell us (if you don't mind) where the problem was
> detected? Since we're changing behavior of the intrinsic, we'll need to
> document this, and knowing whether we have problematic code in the wild that
> relies on present behavior would be helpful.
I detected it in SIMDe (https://github.com/simd-everywhere/simde).
Relevant commit -
https://github.com/simd-everywhere/simde/commit/1ba15969fdc1b302c0e50084420412368a14cd96
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-12 22:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by William Schmidt <wschmidt@gcc.gnu.org>:
https://gcc.gnu.org/g:76ba473b99c30ddec6171840a76292d6d4b67e7c
commit r12-4361-g76ba473b99c30ddec6171840a76292d6d4b67e7c
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Tue Oct 12 17:37:16 2021 -0500
rs6000: Fix vec_cpsgn parameter order (PR101985)
The vec_cpsgn built-in function API differs in argument order from the
copysign<mode>3 convention. Currently that pattern is incorrctly used to
implement vec_cpsgn. Fix that by reversing the operand order of the
builtin while leaving the existing pattern in place to implement copysignf
for vector modes.
Part of the fix when using the new built-in support requires an adjustment
to a pending patch that replaces much of altivec.h with an automatically
generated file.
Also fix a bug in the new built-in overload infrastructure where we were
using the VSX form of the VEC_COPYSIGN built-in when we should default to
the VMX form.
2021-10-12 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/101985
* config/rs6000/altivec.h (vec_cpsgn): Swap operand order.
* config/rs6000/rs6000-overload.def (VEC_COPYSIGN): Use SKIP to
avoid generating an automatic #define of vec_cpsgn. Use the
correct built-in for V4SFmode that doesn't depend on VSX.
gcc/testsuite/
PR target/101985
* gcc.target/powerpc/pr101985-1.c: New.
* gcc.target/powerpc/pr101985-2.c: New.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2021-10-12 22:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #6 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Currently fixed on trunk. The parts of the fix that don't involve the new
builtin infrastructure should be backported to all releases after some burn-in
time.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23 21:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by William Schmidt
<wschmidt@gcc.gnu.org>:
https://gcc.gnu.org/g:8fb9bf6667db0c9bac4145fcc02280b8d3133a27
commit r11-9272-g8fb9bf6667db0c9bac4145fcc02280b8d3133a27
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Tue Nov 23 14:33:18 2021 -0600
rs6000: Fix vec_cpsgn parameter order (PR101985)
Backport r12-4361 to releases/gcc-11.
2021-11-23 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/101985
* config/rs6000/altivec.h (vec_cpsgn): Swap operand order.
gcc/testsuite/
PR target/101985
* gcc.target/powerpc/pr101985-1.c: New.
* gcc.target/powerpc/pr101985-2.c: New.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (6 preceding siblings ...)
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
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23 22:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by William Schmidt
<wschmidt@gcc.gnu.org>:
https://gcc.gnu.org/g:049aa656393299d2ff23f0292c6f49e5057e2909
commit r10-10289-g049aa656393299d2ff23f0292c6f49e5057e2909
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Tue Nov 23 15:57:27 2021 -0600
rs6000: Fix vec_cpsgn parameter order (PR101985)
Backport r12-4361 to releases/gcc-10.
2021-11-23 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/101985
* config/rs6000/altivec.h (vec_cpsgn): Swap operand order.
gcc/testsuite/
PR target/101985
* gcc.target/powerpc/pr101985-1.c: New.
* gcc.target/powerpc/pr101985-2.c: New.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (7 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23 23:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by William Schmidt
<wschmidt@gcc.gnu.org>:
https://gcc.gnu.org/g:4326a1cd664e56167ed23de8beecfe250f466fcb
commit r9-9839-g4326a1cd664e56167ed23de8beecfe250f466fcb
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date: Tue Nov 23 16:14:01 2021 -0600
rs6000: Fix vec_cpsgn parameter order (PR101985)
Backport r12-4361 to releases/gcc-9.
2021-11-23 Bill Schmidt <wschmidt@linux.ibm.com>
gcc/
PR target/101985
* config/rs6000/altivec.h (vec_cpsgn): Swap operand order.
gcc/testsuite/
PR target/101985
* gcc.target/powerpc/pr101985-1.c: New.
* gcc.target/powerpc/pr101985-2.c: New.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2021-11-23 23:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
Bill Schmidt <wschmidt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Now fixed everywhere.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/101985] vec_cpsgn parameter order
2021-08-19 18:36 [Bug c/101985] New: vec_cpsgn parameter order simb611alt at gmail dot com
` (9 preceding siblings ...)
2021-11-23 23:07 ` wschmidt at gcc dot gnu.org
@ 2022-11-17 21:02 ` mark.j.abraham at gmail dot com
10 siblings, 0 replies; 12+ messages in thread
From: mark.j.abraham at gmail dot com @ 2022-11-17 21:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101985
Mark Abraham <mark.j.abraham at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark.j.abraham at gmail dot com
--- Comment #11 from Mark Abraham <mark.j.abraham at gmail dot com> ---
Also discovered in the SIMD compatibility layer for GROMACS
https://gitlab.com/gromacs/gromacs/-/issues/4661
^ 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).