public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]middle-end: ensure that VEC_PERM operands get lowered to the same SSA_NAME. [PR107717]
@ 2022-11-17  4:09 Tamar Christina
  2022-11-17  6:33 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2022-11-17  4:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: nd, rguenther, jlaw

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

Hi All,

At the moment when the VEC_PERMs generated by this match.pd rule is generated
it creates two different SSA_NAMEs for the folded operand.  Because of this it
the permute switches from a single operand permute to a two operand permute and
the target may no longer support a permute for this.

This fixes it by ensuring we generate the same SSA_NAME for both operands.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	PR tree-optimization/107717
	* match.pd: Ensure same SSA_NAME.

gcc/testsuite/ChangeLog:

	PR tree-optimization/107717
	* gcc.target/aarch64/sve2/pr107717.c: New test.

--- inline copy of patch -- 
diff --git a/gcc/match.pd b/gcc/match.pd
index 82f05bbc912e4f80f3984d930c4a8dcb010136e1..cd510d80d409a7c52ba2a78e2fd7df0fc85cab2b 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -8317,7 +8317,7 @@ and,
  (simplify
   (op (vec_perm @0 @0 @2) (vec_perm @1 @1 @2))
    (if (VECTOR_INTEGER_TYPE_P (type))
-    (vec_perm (op @0 @1) (op @0 @1) @2))))
+    (vec_perm (op@3 @0 @1) @3 @2))))
 
 /* Similar for float arithmetic when permutation constant covers
    all vector elements.  */
@@ -8356,4 +8356,4 @@ and,
 	 }
       }
       (if (full_perm_p)
-	(vec_perm (op @0 @1) (op @0 @1) @2))))))
+	(vec_perm (op@3 @0 @1) @3 @2))))))




-- 

[-- Attachment #2: rb16601.patch --]
[-- Type: text/plain, Size: 629 bytes --]

diff --git a/gcc/match.pd b/gcc/match.pd
index 82f05bbc912e4f80f3984d930c4a8dcb010136e1..cd510d80d409a7c52ba2a78e2fd7df0fc85cab2b 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -8317,7 +8317,7 @@ and,
  (simplify
   (op (vec_perm @0 @0 @2) (vec_perm @1 @1 @2))
    (if (VECTOR_INTEGER_TYPE_P (type))
-    (vec_perm (op @0 @1) (op @0 @1) @2))))
+    (vec_perm (op@3 @0 @1) @3 @2))))
 
 /* Similar for float arithmetic when permutation constant covers
    all vector elements.  */
@@ -8356,4 +8356,4 @@ and,
 	 }
       }
       (if (full_perm_p)
-	(vec_perm (op @0 @1) (op @0 @1) @2))))))
+	(vec_perm (op@3 @0 @1) @3 @2))))))




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH]middle-end: ensure that VEC_PERM operands get lowered to the same SSA_NAME. [PR107717]
  2022-11-17  4:09 [PATCH]middle-end: ensure that VEC_PERM operands get lowered to the same SSA_NAME. [PR107717] Tamar Christina
@ 2022-11-17  6:33 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-11-17  6:33 UTC (permalink / raw)
  To: Tamar Christina; +Cc: gcc-patches, nd, jlaw



> Am 17.11.2022 um 05:10 schrieb Tamar Christina via Gcc-patches <gcc-patches@gcc.gnu.org>:
> 
> Hi All,
> 
> At the moment when the VEC_PERMs generated by this match.pd rule is generated
> it creates two different SSA_NAMEs for the folded operand.  Because of this it
> the permute switches from a single operand permute to a two operand permute and
> the target may no longer support a permute for this.
> 
> This fixes it by ensuring we generate the same SSA_NAME for both operands.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?
> 

Ok.

Richard 

> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
>    PR tree-optimization/107717
>    * match.pd: Ensure same SSA_NAME.
> 
> gcc/testsuite/ChangeLog:
> 
>    PR tree-optimization/107717
>    * gcc.target/aarch64/sve2/pr107717.c: New test.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 82f05bbc912e4f80f3984d930c4a8dcb010136e1..cd510d80d409a7c52ba2a78e2fd7df0fc85cab2b 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -8317,7 +8317,7 @@ and,
>  (simplify
>   (op (vec_perm @0 @0 @2) (vec_perm @1 @1 @2))
>    (if (VECTOR_INTEGER_TYPE_P (type))
> -    (vec_perm (op @0 @1) (op @0 @1) @2))))
> +    (vec_perm (op@3 @0 @1) @3 @2))))
> 
> /* Similar for float arithmetic when permutation constant covers
>    all vector elements.  */
> @@ -8356,4 +8356,4 @@ and,
>     }
>       }
>       (if (full_perm_p)
> -    (vec_perm (op @0 @1) (op @0 @1) @2))))))
> +    (vec_perm (op@3 @0 @1) @3 @2))))))
> 
> 
> 
> 
> -- 
> <rb16601.patch>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-17  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17  4:09 [PATCH]middle-end: ensure that VEC_PERM operands get lowered to the same SSA_NAME. [PR107717] Tamar Christina
2022-11-17  6:33 ` Richard Biener

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).