From: Segher Boessenkool <segher@kernel.crashing.org>
To: Carl Love <cel@us.ibm.com>
Cc: gcc-patches@gcc.gnu.org, David Edelsohn <dje.gcc@gmail.com>,
Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Subject: Re: [PATCH v2, rs6000] Add vec_reve support
Date: Thu, 22 Jun 2017 15:23:00 -0000 [thread overview]
Message-ID: <20170622152332.GD16550@gate.crashing.org> (raw)
In-Reply-To: <1498080186.20938.9.camel@us.ibm.com>
Hi Carl,
On Wed, Jun 21, 2017 at 02:23:06PM -0700, Carl Love wrote:
> +;; Vector reverse elements
> +(define_expand "altivec_vreve<mode>2"
> + [(set (match_operand:VEC_A 0 "register_operand" "=v")
> + (unspec:VEC_A [(match_operand:VEC_A 1 "register_operand" "v")]
> + UNSPEC_VREVEV))]
The constraints on an expand are never used; it's less confusing if you
remove them.
> + for (j = num_elements - 1; j >= 0; j--)
> + for (i = 0; i < size; i++)
> + RTVEC_ELT (v, i + j * size)
> + = gen_rtx_CONST_INT (QImode,
> + size * num_elements - j * size + i - size);
Maybe
+ RTVEC_ELT (v, i + j * size)
+ = gen_rtx_CONST_INT (QImode, i + (num_elements - j - 1) * size);
(so it is clearer this is reverting the elements)? Oh, and you can make
the "j" loop run forward now.
You can assume the compiler will strength-reduce the loop and everything;
write your code so it is easily readable, everything boring, everything
the same as always. This makes unusual things stand out more, too, which
is a very good thing :-)
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-vec_reve-runnable.c
> @@ -0,0 +1,394 @@
> +/* { dg-do run { target { powerpc*-*-linux* } } } */
> +/* { dg-require-effective-target vsx_hw } */
> +/* { dg-options "-O2 -mvsx -mcpu=power8" } */
> +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
This will make it run on power7 as well... That won't work. I think
you're previous patch had something similar (and that is in fact failing
on power7). Please investigate. (Maybe it wants p8vector_hw instead?)
Segher
next prev parent reply other threads:[~2017-06-22 15:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 21:23 Carl Love
2017-06-22 15:23 ` Segher Boessenkool [this message]
2017-06-23 21:59 ` [PATCH v3, " Carl Love
2017-06-23 22:19 ` Segher Boessenkool
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=20170622152332.GD16550@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=cel@us.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=wschmidt@linux.vnet.ibm.com \
/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: link
Be 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).