public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Carl Love <carll@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1501] rs6000: Fix arguments for __builtin_altivec_tr_stxvrwx, __builtin_altivec_tr_stxvrhx Date: Fri, 2 Jun 2023 15:11:42 +0000 (GMT) [thread overview] Message-ID: <20230602151142.6DF30385772C@sourceware.org> (raw) 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 } } */
reply other threads:[~2023-06-02 15:11 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230602151142.6DF30385772C@sourceware.org \ --to=carll@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).