This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2, rs6000] Add vec_reve support
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Carl Love <cel at us dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Date: Thu, 22 Jun 2017 10:23:32 -0500
- Subject: Re: [PATCH v2, rs6000] Add vec_reve support
- Authentication-results: sourceware.org; auth=none
- References: <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