diff mbox series

[AArch64] PR98657: Fix vec_duplicate creation in SVE's <ASHIFT:optab><mode>3

Message ID 4202239f-f0aa-98ea-4655-94a08ef3c978@arm.com
State New
Headers show
Series [AArch64] PR98657: Fix vec_duplicate creation in SVE's <ASHIFT:optab><mode>3 | expand

Commit Message

Andre Vieira (lists) Feb. 17, 2021, 2:17 p.m. UTC
Hi,

This patch prevents generating a vec_duplicate with illegal predicate.

Regression tested on aarch64-linux-gnu.

OK for trunk?

gcc/ChangeLog:
2021-02-17  Andre Vieira  <andre.simoesdiasvieira@arm.com>

         PR target/98657
         * config/aarch64/aarch64-sve.md: Use 'expand_vector_broadcast' 
to emit vec_duplicate's
         in '<ASHIFT:optab><mode>3' pattern.

gcc/testsuite/ChangeLog:
2021-02-17  Andre Vieira  <andre.simoesdiasvieira@arm.com>

         PR target/98657
         * gcc.target/aarch64/sve/pr98657.c: New test.

Comments

Kyrylo Tkachov Feb. 18, 2021, 4:30 p.m. UTC | #1
Hi Andre,

> -----Original Message-----
> From: Andre Vieira (lists) <andre.simoesdiasvieira@arm.com>
> Sent: 17 February 2021 14:17
> To: gcc-patches@gcc.gnu.org
> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Sandiford
> <Richard.Sandiford@arm.com>
> Subject: [AArch64] PR98657: Fix vec_duplicate creation in SVE's
> <ASHIFT:optab><mode>3
> 
> Hi,
> 
> This patch prevents generating a vec_duplicate with illegal predicate.
> 
> Regression tested on aarch64-linux-gnu.
> 
> OK for trunk?
> 
> gcc/ChangeLog:
> 2021-02-17  Andre Vieira  <andre.simoesdiasvieira@arm.com>
> 
>          PR target/98657
>          * config/aarch64/aarch64-sve.md: Use 'expand_vector_broadcast'
> to emit vec_duplicate's
>          in '<ASHIFT:optab><mode>3' pattern.

This entry should be
	* config/aarch64/aarch64-sve.md (<ASHIFT:optab><mode>3'): Use expand_vector_broadcast....

Ok with the ChangeLog fixed.
Thanks,
Kyrill

> 
> gcc/testsuite/ChangeLog:
> 2021-02-17  Andre Vieira  <andre.simoesdiasvieira@arm.com>
> 
>          PR target/98657
>          * gcc.target/aarch64/sve/pr98657.c: New test.
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md
index 608319600318974b414e47285ee1474b041f0e05..7db2938bb84e04d066a7b07574e5cf344a3a8fb6 100644
--- a/gcc/config/aarch64/aarch64-sve.md
+++ b/gcc/config/aarch64/aarch64-sve.md
@@ -4549,10 +4549,8 @@  (define_expand "<ASHIFT:optab><mode>3"
       }
     else
       {
-	amount = gen_reg_rtx (<MODE>mode);
-	emit_insn (gen_vec_duplicate<mode> (amount,
-					    convert_to_mode (<VEL>mode,
-							     operands[2], 0)));
+	amount = convert_to_mode (<VEL>mode, operands[2], 0);
+	amount = expand_vector_broadcast (<MODE>mode, amount);
       }
     emit_insn (gen_v<optab><mode>3 (operands[0], operands[1], amount));
     DONE;
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98657.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98657.c
new file mode 100644
index 0000000000000000000000000000000000000000..592af25d7bbc69bc05823d27358f07cd741dbe20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98657.c
@@ -0,0 +1,9 @@ 
+/* PR target/98657  */
+/* { dg-do compile } */
+/* { dg-options "-O3 -msve-vector-bits=256" } */
+extern char a[];
+void b(_Bool c[][18]) {
+  int d;
+  for (int e = 0; e < 23; e++)
+    a[e] = 6 >> c[1][d];
+}