public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10289] rs6000: Fix vec_cpsgn parameter order (PR101985)
@ 2021-11-23 22:40 William Schmidt
  0 siblings, 0 replies; only message in thread
From: William Schmidt @ 2021-11-23 22:40 UTC (permalink / raw)
  To: gcc-cvs

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.

Diff:
---
 gcc/config/rs6000/altivec.h                   |  2 +-
 gcc/testsuite/gcc.target/powerpc/pr101985-1.c | 18 ++++++++++++++++++
 gcc/testsuite/gcc.target/powerpc/pr101985-2.c | 18 ++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index b40e750dc13..c03d7c9b149 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -129,7 +129,7 @@
 #define vec_vcfux __builtin_vec_vcfux
 #define vec_cts __builtin_vec_cts
 #define vec_ctu __builtin_vec_ctu
-#define vec_cpsgn __builtin_vec_copysign
+#define vec_cpsgn(x,y) __builtin_vec_copysign(y,x)
 #define vec_double __builtin_vec_double
 #define vec_doublee __builtin_vec_doublee
 #define vec_doubleo __builtin_vec_doubleo
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101985-1.c b/gcc/testsuite/gcc.target/powerpc/pr101985-1.c
new file mode 100644
index 00000000000..b4753ab83d7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101985-1.c
@@ -0,0 +1,18 @@
+/* PR target/101985 */
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-O2 -mvsx" } */
+
+#include <altivec.h>
+
+int
+main (void)
+{
+  vector float a = {  1,  2, - 3, - 4};
+  vector float b = {-10, 20, -30,  40};
+  vector float c = { 10, 20, -30, -40};
+  a = vec_cpsgn (a, b);
+  if (! vec_all_eq (a, c))
+    __builtin_abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr101985-2.c b/gcc/testsuite/gcc.target/powerpc/pr101985-2.c
new file mode 100644
index 00000000000..148ad657366
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr101985-2.c
@@ -0,0 +1,18 @@
+/* PR target/101985 */
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-O2 -mvsx" } */
+
+#include <altivec.h>
+
+int
+main (void)
+{
+  vector double a = {   1,  -4};
+  vector double b = { -10,  40};
+  vector double c = {  10, -40};
+  a = vec_cpsgn (a, b);
+  if (! vec_all_eq (a, c))
+    __builtin_abort ();
+  return 0;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-23 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 22:40 [gcc r10-10289] rs6000: Fix vec_cpsgn parameter order (PR101985) William Schmidt

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