diff mbox series

Change permute index type to unsigned short

Message ID 874lrur8q8.fsf@linaro.org
State New
Headers show
Series Change permute index type to unsigned short | expand

Commit Message

Richard Sandiford Sept. 22, 2017, 4:36 p.m. UTC
This patch changes the element type of (auto_)vec_perm_indices from
unsigned char to unsigned short.  This is needed for fixed-length
2048-bit SVE.  (SVE is variable-length by default, but it's possible
to ask for specific vector lengths if you want to.)

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
Also tested by comparing the testsuite assembly output on at least one
target per CPU directory.  OK to install?

Richard


2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* target.h (vec_perm_indices): Use unsigned short rather than
	unsigned char.
	(auto_vec_perm_indices): Likewise.
	* config/aarch64/aarch64.c (aarch64_vectorize_vec_perm_const_ok):
	Use unsigned int rather than unsigned char.
	* config/arm/arm.c (arm_vectorize_vec_perm_const_ok): Likewise.

Comments

Richard Biener Sept. 25, 2017, 11:41 a.m. UTC | #1
On Fri, Sep 22, 2017 at 6:36 PM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> This patch changes the element type of (auto_)vec_perm_indices from
> unsigned char to unsigned short.  This is needed for fixed-length
> 2048-bit SVE.  (SVE is variable-length by default, but it's possible
> to ask for specific vector lengths if you want to.)
>
> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
> Also tested by comparing the testsuite assembly output on at least one
> target per CPU directory.  OK to install?

Ok.

Richard.

> Richard
>
>
> 2017-09-22  Richard Sandiford  <richard.sandiford@linaro.org>
>
> gcc/
>         * target.h (vec_perm_indices): Use unsigned short rather than
>         unsigned char.
>         (auto_vec_perm_indices): Likewise.
>         * config/aarch64/aarch64.c (aarch64_vectorize_vec_perm_const_ok):
>         Use unsigned int rather than unsigned char.
>         * config/arm/arm.c (arm_vectorize_vec_perm_const_ok): Likewise.
>
> Index: gcc/target.h
> ===================================================================
> --- gcc/target.h        2017-09-14 17:04:19.080694343 +0100
> +++ gcc/target.h        2017-09-22 17:35:22.486794044 +0100
> @@ -193,11 +193,11 @@ enum vect_cost_model_location {
>
>  /* The type to use for vector permutes with a constant permute vector.
>     Each entry is an index into the concatenated input vectors.  */
> -typedef vec<unsigned char> vec_perm_indices;
> +typedef vec<unsigned short> vec_perm_indices;
>
>  /* Same, but can be used to construct local permute vectors that are
>     automatically freed.  */
> -typedef auto_vec<unsigned char, 32> auto_vec_perm_indices;
> +typedef auto_vec<unsigned short, 32> auto_vec_perm_indices;
>
>  /* The target structure.  This holds all the backend hooks.  */
>  #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
> Index: gcc/config/aarch64/aarch64.c
> ===================================================================
> --- gcc/config/aarch64/aarch64.c        2017-09-22 17:31:56.412840135 +0100
> +++ gcc/config/aarch64/aarch64.c        2017-09-22 17:35:22.483794044 +0100
> @@ -13820,7 +13820,7 @@ aarch64_vectorize_vec_perm_const_ok (mac
>    nelt = sel.length ();
>    for (i = which = 0; i < nelt; ++i)
>      {
> -      unsigned char e = d.perm[i];
> +      unsigned int e = d.perm[i];
>        gcc_assert (e < 2 * nelt);
>        which |= (e < nelt ? 1 : 2);
>      }
> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c        2017-09-22 17:31:56.414735941 +0100
> +++ gcc/config/arm/arm.c        2017-09-22 17:35:22.486794044 +0100
> @@ -29261,7 +29261,7 @@ arm_vectorize_vec_perm_const_ok (machine
>    nelt = GET_MODE_NUNITS (d.vmode);
>    for (i = which = 0; i < nelt; ++i)
>      {
> -      unsigned char e = d.perm[i];
> +      unsigned int e = d.perm[i];
>        gcc_assert (e < 2 * nelt);
>        which |= (e < nelt ? 1 : 2);
>      }
diff mbox series

Patch

Index: gcc/target.h
===================================================================
--- gcc/target.h	2017-09-14 17:04:19.080694343 +0100
+++ gcc/target.h	2017-09-22 17:35:22.486794044 +0100
@@ -193,11 +193,11 @@  enum vect_cost_model_location {
 
 /* The type to use for vector permutes with a constant permute vector.
    Each entry is an index into the concatenated input vectors.  */
-typedef vec<unsigned char> vec_perm_indices;
+typedef vec<unsigned short> vec_perm_indices;
 
 /* Same, but can be used to construct local permute vectors that are
    automatically freed.  */
-typedef auto_vec<unsigned char, 32> auto_vec_perm_indices;
+typedef auto_vec<unsigned short, 32> auto_vec_perm_indices;
 
 /* The target structure.  This holds all the backend hooks.  */
 #define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
Index: gcc/config/aarch64/aarch64.c
===================================================================
--- gcc/config/aarch64/aarch64.c	2017-09-22 17:31:56.412840135 +0100
+++ gcc/config/aarch64/aarch64.c	2017-09-22 17:35:22.483794044 +0100
@@ -13820,7 +13820,7 @@  aarch64_vectorize_vec_perm_const_ok (mac
   nelt = sel.length ();
   for (i = which = 0; i < nelt; ++i)
     {
-      unsigned char e = d.perm[i];
+      unsigned int e = d.perm[i];
       gcc_assert (e < 2 * nelt);
       which |= (e < nelt ? 1 : 2);
     }
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	2017-09-22 17:31:56.414735941 +0100
+++ gcc/config/arm/arm.c	2017-09-22 17:35:22.486794044 +0100
@@ -29261,7 +29261,7 @@  arm_vectorize_vec_perm_const_ok (machine
   nelt = GET_MODE_NUNITS (d.vmode);
   for (i = which = 0; i < nelt; ++i)
     {
-      unsigned char e = d.perm[i];
+      unsigned int e = d.perm[i];
       gcc_assert (e < 2 * nelt);
       which |= (e < nelt ? 1 : 2);
     }