public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1501] rs6000: Fix arguments for __builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrhx
@ 2023-06-02 15:11 Carl Love
0 siblings, 0 replies; only message in thread
From: Carl Love @ 2023-06-02 15:11 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:957798e44e7194f7b6a67b19f85ff72eab9a0d0e
commit r14-1501-g957798e44e7194f7b6a67b19f85ff72eab9a0d0e
Author: Carl Love <cel@us.ibm.com>
Date: Fri Jun 2 11:11:12 2023 -0400
rs6000: Fix arguments for __builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrhx
The third argument for __builtin_altivec_tr_stxvrhx should be short *
not int *. Similarly, the third argument for __builtin_altivec_tr_stxvrwx
should be int * not short *. This patch fixes the arguments in the two
builtins.
A runnable test case is added to test the __builtin_altivec_tr_stxvrbx,
__builtin_altivec_tr_stxvrhx, __builtin_altivec_tr_stxvrwx and
__builtin_altivec_tr_stxvrdx builtins.
gcc/
* config/rs6000/rs6000-builtins.def (__builtin_altivec_tr_stxvrhx,
__builtin_altivec_tr_stxvrwx): Fix type of third argument.
gcc/testsuite/
* gcc.target/powerpc/builtin_altivec_tr_stxvr_runnable.c: New test
for __builtin_altivec_tr_stxvrbx, __builtin_altivec_tr_stxvrhx,
__builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrdx.
Diff:
---
gcc/config/rs6000/rs6000-builtins.def | 4 +-
.../powerpc/builtin_altivec_tr_stxvr_runnable.c | 104 +++++++++++++++++++++
2 files changed, 106 insertions(+), 2 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def
index 92d9b46e1b9..289a37998b1 100644
--- a/gcc/config/rs6000/rs6000-builtins.def
+++ b/gcc/config/rs6000/rs6000-builtins.def
@@ -3160,10 +3160,10 @@
void __builtin_altivec_tr_stxvrbx (vsq, signed long, signed char *);
TR_STXVRBX vsx_stxvrbx {stvec}
- void __builtin_altivec_tr_stxvrhx (vsq, signed long, signed int *);
+ void __builtin_altivec_tr_stxvrhx (vsq, signed long, signed short *);
TR_STXVRHX vsx_stxvrhx {stvec}
- void __builtin_altivec_tr_stxvrwx (vsq, signed long, signed short *);
+ void __builtin_altivec_tr_stxvrwx (vsq, signed long, signed int *);
TR_STXVRWX vsx_stxvrwx {stvec}
void __builtin_altivec_tr_stxvrdx (vsq, signed long, signed long long *);
diff --git a/gcc/testsuite/gcc.target/powerpc/builtin_altivec_tr_stxvr_runnable.c b/gcc/testsuite/gcc.target/powerpc/builtin_altivec_tr_stxvr_runnable.c
new file mode 100644
index 00000000000..4b904379732
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtin_altivec_tr_stxvr_runnable.c
@@ -0,0 +1,104 @@
+/* Test of __builtin_vec_xst_trunc */
+
+/* { dg-do run { target power10_hw } } */
+/* { dg-require-effective-target int128 } */
+/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
+
+#include <altivec.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DEBUG 0
+
+vector signed __int128 store_data =
+ { (__int128) 0x8ACE000000000000 << 64 | (__int128) 0xfedcba9876543217ULL};
+
+union conv_t {
+ vector signed __int128 vsi128;
+ unsigned long long ull[2];
+} conv;
+
+void abort (void);
+
+
+int
+main () {
+ int i;
+ signed long sl;
+ signed char sc, expected_sc;
+ signed short ss, expected_ss;
+ signed int si, expected_si;
+ signed long long int sll, expected_sll;
+ signed char *psc;
+ signed short *pss;
+ signed int *psi;
+ signed long long int *psll;
+
+#if DEBUG
+ val.vsi128 = store_data;
+ printf("Data to store [%d] = 0x%llx %llx\n", i, val.ull[1], val.ull[0]);
+#endif
+
+ psc = ≻
+ pss = &ss;
+ psi = &si;
+ psll = &sll;
+
+ sl = 1;
+ sc = 0xA1;
+ expected_sc = 0xA1;
+ __builtin_altivec_tr_stxvrbx (store_data, sl, psc);
+
+ if (expected_sc != sc & 0xFF)
+#if DEBUG
+ printf(" ERROR: Signed char = 0x%x doesn't match expected value 0x%x\n",
+ sc & 0xFF, expected_sc);
+#else
+ abort();
+#endif
+
+ ss = 0x52;
+ expected_ss = 0x1752;
+ __builtin_altivec_tr_stxvrhx (store_data, sl, pss);
+
+ if (expected_ss != ss & 0xFFFF)
+#if DEBUG
+ printf(" ERROR: Signed short = 0x%x doesn't match expected value 0x%x\n",
+ ss, expected_ss) & 0xFFFF;
+#else
+ abort();
+#endif
+
+ si = 0x21;
+ expected_si = 0x54321721;
+ __builtin_altivec_tr_stxvrwx (store_data, sl, psi);
+
+ if (expected_si != si)
+#if DEBUG
+ printf(" ERROR: Signed int = 0x%x doesn't match expected value 0x%x\n",
+ si, expected_si);
+#else
+ abort();
+#endif
+
+ sll = 0x12FFULL;
+ expected_sll = 0xdcba9876543217FF;
+ __builtin_altivec_tr_stxvrdx (store_data, sl, psll);
+
+ if (expected_sll != sll)
+#if DEBUG
+ printf(" ERROR: Signed long long int = 0x%llx doesn't match expected value 0x%llx\n",
+ sll, expected_sll);
+#else
+ abort();
+#endif
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times {\mstxvrbx\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mstxvrhx\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mstxvrwx\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mstxvrdx\M} 1 } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-02 15:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02 15:11 [gcc r14-1501] rs6000: Fix arguments for __builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrhx Carl Love
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).