public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: HaoChen Gui <guihaoc@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4423] rs6000: Generates permute index directly for little endian targets (PR100866) Date: Thu, 1 Dec 2022 02:07:28 +0000 (GMT) [thread overview] Message-ID: <20221201020728.9E9553858C54@sourceware.org> (raw) https://gcc.gnu.org/g:9d68cba5eb20442f8075b8f92d1b20a00022852f commit r13-4423-g9d68cba5eb20442f8075b8f92d1b20a00022852f Author: Haochen Gui <guihaoc@gcc.gnu.org> Date: Wed Nov 30 15:05:59 2022 +0800 rs6000: Generates permute index directly for little endian targets (PR100866) 2022-10-11 Haochen Gui <guihaoc@linux.ibm.com> gcc/ PR target/100866 * config/rs6000/rs6000-call.cc (swap_endian_selector_for_mode): Generate permute index directly for little endian targets. * config/rs6000/vsx.md (revb_<mode>): Call vprem directly with corresponding permute indexes. gcc/testsuite/ PR target/100866 * gcc.target/powerpc/pr100866-1.c: New. Diff: --- gcc/config/rs6000/rs6000-call.cc | 8 +++++++- gcc/config/rs6000/vsx.md | 4 ++-- gcc/testsuite/gcc.target/powerpc/pr100866-1.c | 11 +++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc index 6da4de67137..c2a4e4f4e27 100644 --- a/gcc/config/rs6000/rs6000-call.cc +++ b/gcc/config/rs6000/rs6000-call.cc @@ -2802,6 +2802,8 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, return build_va_arg_indirect_ref (addr); } +/* The selector (perm) is expected to be used with vperm direct as the + function generates reversed perm for little endian with this patch. */ rtx swap_endian_selector_for_mode (machine_mode mode) { @@ -2834,7 +2836,11 @@ swap_endian_selector_for_mode (machine_mode mode) } for (i = 0; i < 16; ++i) - perm[i] = GEN_INT (swaparray[i]); + if (BYTES_BIG_ENDIAN) + perm[i] = GEN_INT (swaparray[i]); + else + /* Generates the reversed perm for little endian. */ + perm[i] = GEN_INT (~swaparray[i] & 0x0000001f); return force_reg (V16QImode, gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm))); diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index fb5cf04147e..992fbc983be 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -6099,8 +6099,8 @@ to the endian mode in use, i.e. in LE mode, put elements in BE order. */ rtx sel = swap_endian_selector_for_mode (<MODE>mode); - emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], - operands[1], sel)); + emit_insn (gen_altivec_vperm_<mode>_direct (operands[0], operands[1], + operands[1], sel)); } } diff --git a/gcc/testsuite/gcc.target/powerpc/pr100866-1.c b/gcc/testsuite/gcc.target/powerpc/pr100866-1.c new file mode 100644 index 00000000000..63872f21bf8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr100866-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power8" } */ +/* { dg-final { scan-assembler-not {\mxxlnor\M} } } */ + +#include <altivec.h> + +vector unsigned int revb (vector unsigned int a) +{ + return vec_revb(a); +}
reply other threads:[~2022-12-01 2:07 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=20221201020728.9E9553858C54@sourceware.org \ --to=guihaoc@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).