aarch64: Check predicate when using gen_vec_duplicate [PR98657]
authorAndre Vieira <andre.simoesdiasvieira@arm.com>
Fri, 19 Feb 2021 09:13:02 +0000 (09:13 +0000)
committerAndre Vieira <andre.simoesdiasvieira@arm.com>
Fri, 19 Feb 2021 09:13:02 +0000 (09:13 +0000)
Prevents generation of a vec_duplicate with illegal predicate in
<ASHIFT:optab><mode>3.

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

PR target/98657
* config/aarch64/aarch64-sve.md (<ASHIFT:optab><mode>3): Use
expand_vector_broadcast' to emit the vec_duplicate operand.

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

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

gcc/config/aarch64/aarch64-sve.md
gcc/testsuite/gcc.target/aarch64/sve/pr98657.c [new file with mode: 0644]

index 608319600318974b414e47285ee1474b041f0e05..7db2938bb84e04d066a7b07574e5cf344a3a8fb6 100644 (file)
       }
     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 (file)
index 0000000..592af25
--- /dev/null
@@ -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];
+}