diff mbox

[4b/4,ARM] PR63870 Remove error for invalid lane numbers

Message ID 1446942404-11561-6-git-send-email-charles.baylis@linaro.org
State New
Headers show

Commit Message

Charles Baylis Nov. 8, 2015, 12:26 a.m. UTC
From: Charles Baylis <charles.baylis@linaro.org>


<DATE>  Charles Baylis  <charles.baylis@linaro.org>

	* config/arm/neon.md (neon_vld1_lane<mode>): Remove error for invalid
	lane number.
	(neon_vst1_lane<mode>): Likewise.
	(neon_vld2_lane<mode>): Likewise.
	(neon_vst2_lane<mode>): Likewise.
	(neon_vld3_lane<mode>): Likewise.
	(neon_vst3_lane<mode>): Likewise.
	(neon_vld4_lane<mode>): Likewise.
	(neon_vst4_lane<mode>): Likewise.

Change-Id: Id7b4b6fa7320157e62e5bae574b4c4688d921774
---
 gcc/config/arm/neon.md | 48 ++++++++----------------------------------------
 1 file changed, 8 insertions(+), 40 deletions(-)

-- 
1.9.1

Comments

Kyrylo Tkachov Nov. 11, 2015, 11:22 a.m. UTC | #1
Hi Charles,

On 08/11/15 00:26, charles.baylis@linaro.org wrote:
> From: Charles Baylis <charles.baylis@linaro.org>

>

> <DATE>  Charles Baylis  <charles.baylis@linaro.org>

>

> 	* config/arm/neon.md (neon_vld1_lane<mode>): Remove error for invalid

> 	lane number.

> 	(neon_vst1_lane<mode>): Likewise.

> 	(neon_vld2_lane<mode>): Likewise.

> 	(neon_vst2_lane<mode>): Likewise.

> 	(neon_vld3_lane<mode>): Likewise.

> 	(neon_vst3_lane<mode>): Likewise.

> 	(neon_vld4_lane<mode>): Likewise.

> 	(neon_vst4_lane<mode>): Likewise.

>

> Change-Id: Id7b4b6fa7320157e62e5bae574b4c4688d921774

> ---

>   gcc/config/arm/neon.md | 48 ++++++++----------------------------------------

>   1 file changed, 8 insertions(+), 40 deletions(-)

>

> diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md

> index e8db020..6574e6e 100644

> --- a/gcc/config/arm/neon.md

> +++ b/gcc/config/arm/neon.md

> @@ -4264,8 +4264,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT lane = ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3]));

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     operands[3] = GEN_INT (lane);

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     if (max == 1)

>       return "vld1.<V_sz_elem>\t%P0, %A1";

>     else

> @@ -4286,9 +4284,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     operands[3] = GEN_INT (lane);

>     int regno = REGNO (operands[0]);

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -4372,8 +4368,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT lane = ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2]));

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     operands[2] = GEN_INT (lane);

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     if (max == 1)

>       return "vst1.<V_sz_elem>\t{%P1}, %A0";

>     else

> @@ -4393,9 +4387,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT lane = ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2]));

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -4464,8 +4456,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[0]);

>     rtx ops[4];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");


In this pattern the 'max' variable is now unused, causing a bootstrap -Werror failure on arm.
I'll test a patch to fix it unless you beat me to it...

Thanks,
Kyrill

>     ops[0] = gen_rtx_REG (DImode, regno);

>     ops[1] = gen_rtx_REG (DImode, regno + 2);

>     ops[2] = operands[1];

> @@ -4489,9 +4479,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[0]);

>     rtx ops[4];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -4579,8 +4567,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

>     rtx ops[4];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     ops[0] = operands[0];

>     ops[1] = gen_rtx_REG (DImode, regno);

>     ops[2] = gen_rtx_REG (DImode, regno + 2);

> @@ -4604,9 +4590,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

>     rtx ops[4];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -4723,8 +4707,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[0]);

>     rtx ops[5];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     ops[0] = gen_rtx_REG (DImode, regno);

>     ops[1] = gen_rtx_REG (DImode, regno + 2);

>     ops[2] = gen_rtx_REG (DImode, regno + 4);

> @@ -4750,9 +4732,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[0]);

>     rtx ops[5];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -4895,8 +4875,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

>     rtx ops[5];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     ops[0] = operands[0];

>     ops[1] = gen_rtx_REG (DImode, regno);

>     ops[2] = gen_rtx_REG (DImode, regno + 2);

> @@ -4922,9 +4900,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

>     rtx ops[5];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -5045,8 +5021,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[0]);

>     rtx ops[6];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     ops[0] = gen_rtx_REG (DImode, regno);

>     ops[1] = gen_rtx_REG (DImode, regno + 2);

>     ops[2] = gen_rtx_REG (DImode, regno + 4);

> @@ -5073,9 +5047,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[0]);

>     rtx ops[6];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;

> @@ -5225,8 +5197,6 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

>     rtx ops[6];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

>     ops[0] = operands[0];

>     ops[1] = gen_rtx_REG (DImode, regno);

>     ops[2] = gen_rtx_REG (DImode, regno + 2);

> @@ -5253,9 +5223,7 @@ if (BYTES_BIG_ENDIAN)

>     HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);

>     int regno = REGNO (operands[1]);

>     rtx ops[6];

> -  if (lane < 0 || lane >= max)

> -    error ("lane out of range");

> -  else if (lane >= max / 2)

> +  if (lane >= max / 2)

>       {

>         lane -= max / 2;

>         regno += 2;
Charles Baylis Nov. 12, 2015, 1:13 p.m. UTC | #2
On 9 November 2015 at 13:35, Ramana Radhakrishnan
<ramana.radhakrishnan@foss.arm.com> wrote:
>

>

> On 08/11/15 00:26, charles.baylis@linaro.org wrote:

>> From: Charles Baylis <charles.baylis@linaro.org>

>>

>> <DATE>  Charles Baylis  <charles.baylis@linaro.org>

>>

>>       * config/arm/neon.md (neon_vld1_lane<mode>): Remove error for invalid

>>       lane number.

>>       (neon_vst1_lane<mode>): Likewise.

>>       (neon_vld2_lane<mode>): Likewise.

>>       (neon_vst2_lane<mode>): Likewise.

>>       (neon_vld3_lane<mode>): Likewise.

>>       (neon_vst3_lane<mode>): Likewise.

>>       (neon_vld4_lane<mode>): Likewise.

>>       (neon_vst4_lane<mode>): Likewise.

>>

>

> The only way we can get here is through the intrinsics - we do a check for lane numbers earlier.

>

> If things go horribly wrong - the assembler will complain, so it's ok to elide this internal_error here, thus OK.


Applied as r230144
diff mbox

Patch

diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index e8db020..6574e6e 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -4264,8 +4264,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT lane = ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3]));
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   operands[3] = GEN_INT (lane);
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   if (max == 1)
     return "vld1.<V_sz_elem>\t%P0, %A1";
   else
@@ -4286,9 +4284,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   operands[3] = GEN_INT (lane);
   int regno = REGNO (operands[0]);
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -4372,8 +4368,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT lane = ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2]));
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   operands[2] = GEN_INT (lane);
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   if (max == 1)
     return "vst1.<V_sz_elem>\t{%P1}, %A0";
   else
@@ -4393,9 +4387,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT lane = ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2]));
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -4464,8 +4456,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[0]);
   rtx ops[4];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   ops[0] = gen_rtx_REG (DImode, regno);
   ops[1] = gen_rtx_REG (DImode, regno + 2);
   ops[2] = operands[1];
@@ -4489,9 +4479,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[0]);
   rtx ops[4];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -4579,8 +4567,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
   rtx ops[4];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   ops[0] = operands[0];
   ops[1] = gen_rtx_REG (DImode, regno);
   ops[2] = gen_rtx_REG (DImode, regno + 2);
@@ -4604,9 +4590,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
   rtx ops[4];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -4723,8 +4707,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[0]);
   rtx ops[5];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   ops[0] = gen_rtx_REG (DImode, regno);
   ops[1] = gen_rtx_REG (DImode, regno + 2);
   ops[2] = gen_rtx_REG (DImode, regno + 4);
@@ -4750,9 +4732,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[0]);
   rtx ops[5];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -4895,8 +4875,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
   rtx ops[5];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   ops[0] = operands[0];
   ops[1] = gen_rtx_REG (DImode, regno);
   ops[2] = gen_rtx_REG (DImode, regno + 2);
@@ -4922,9 +4900,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
   rtx ops[5];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -5045,8 +5021,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[0]);
   rtx ops[6];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   ops[0] = gen_rtx_REG (DImode, regno);
   ops[1] = gen_rtx_REG (DImode, regno + 2);
   ops[2] = gen_rtx_REG (DImode, regno + 4);
@@ -5073,9 +5047,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[0]);
   rtx ops[6];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;
@@ -5225,8 +5197,6 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
   rtx ops[6];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
   ops[0] = operands[0];
   ops[1] = gen_rtx_REG (DImode, regno);
   ops[2] = gen_rtx_REG (DImode, regno + 2);
@@ -5253,9 +5223,7 @@  if (BYTES_BIG_ENDIAN)
   HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode);
   int regno = REGNO (operands[1]);
   rtx ops[6];
-  if (lane < 0 || lane >= max)
-    error ("lane out of range");
-  else if (lane >= max / 2)
+  if (lane >= max / 2)
     {
       lane -= max / 2;
       regno += 2;