PR81738: Split vect-alias-check-6.c

Message ID 87y3qrv8zw.fsf@linaro.org
State New
Headers show

Commit Message

Richard Sandiford Aug. 10, 2017, 1:37 p.m.
The second loop in the testcase only vectorises if we can reverse
a vector and if aligned loads aren't required.

Sanity-checked on aarch64-linux-gnu, x86_64-linux-gnu and
powerpc64le-linux-gnu (although all three were unaffected).
OK to install?

Thanks,
Richard


2017-08-10  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/testsuite/
	PR testsuite/81738
	* gcc.dg/vect/vect-alias-check-6.c: Move second function to...
	* gcc.dg/vect/vect-alias-check-7.c: ...this new file.  Require
	vect_perm and vect_element_align for vectorization.

Comments

Richard Biener Aug. 10, 2017, 5:54 p.m. | #1
On August 10, 2017 3:37:55 PM GMT+02:00, Richard Sandiford <richard.sandiford@linaro.org> wrote:
>The second loop in the testcase only vectorises if we can reverse

>a vector and if aligned loads aren't required.

>

>Sanity-checked on aarch64-linux-gnu, x86_64-linux-gnu and

>powerpc64le-linux-gnu (although all three were unaffected).

>OK to install?


OK.

Richard.

>Thanks,

>Richard

>

>

>2017-08-10  Richard Sandiford  <richard.sandiford@linaro.org>

>

>gcc/testsuite/

>	PR testsuite/81738

>	* gcc.dg/vect/vect-alias-check-6.c: Move second function to...

>	* gcc.dg/vect/vect-alias-check-7.c: ...this new file.  Require

>	vect_perm and vect_element_align for vectorization.

>

>Index: gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c

>===================================================================

>--- gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c	2017-08-04

>11:40:26.372205514 +0100

>+++ gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c	2017-08-10

>14:36:24.201888108 +0100

>@@ -12,12 +12,5 @@ f1 (struct s *a, struct s *b)

>     a->x[i + 1] += b->x[i];

> }

> 

>-void

>-f2 (struct s *a, struct s *b)

>-{

>-  for (int i = 0; i < N; ++i)

>-    a->x[i] += b->x[N - i - 1];

>-}

>-

>-/* { dg-final { scan-tree-dump-times {checking that [^\n]* and [^\n]*

>have different addresses} 2 "vect" } } */

>-/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */

>+/* { dg-final { scan-tree-dump {checking that [^\n]* and [^\n]* have

>different addresses} "vect" } } */

>+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */

>Index: gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c

>===================================================================

>--- /dev/null	2017-08-09 18:16:39.535015779 +0100

>+++ gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c	2017-08-10

>14:36:24.201888108 +0100

>@@ -0,0 +1,16 @@

>+/* { dg-do compile } */

>+/* { dg-require-effective-target vect_int } */

>+

>+#define N 16

>+

>+struct s { int x[N]; };

>+

>+void

>+f1 (struct s *a, struct s *b)

>+{

>+  for (int i = 0; i < N; ++i)

>+    a->x[i] += b->x[N - i - 1];

>+}

>+

>+/* { dg-final { scan-tree-dump {checking that [^\n]* and [^\n]* have

>different addresses} "vect" } } */

>+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target {

>vect_perm && vect_element_align } } } } */

Patch

Index: gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c	2017-08-04 11:40:26.372205514 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-alias-check-6.c	2017-08-10 14:36:24.201888108 +0100
@@ -12,12 +12,5 @@  f1 (struct s *a, struct s *b)
     a->x[i + 1] += b->x[i];
 }
 
-void
-f2 (struct s *a, struct s *b)
-{
-  for (int i = 0; i < N; ++i)
-    a->x[i] += b->x[N - i - 1];
-}
-
-/* { dg-final { scan-tree-dump-times {checking that [^\n]* and [^\n]* have different addresses} 2 "vect" } } */
-/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */
+/* { dg-final { scan-tree-dump {checking that [^\n]* and [^\n]* have different addresses} "vect" } } */
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } } */
Index: gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c
===================================================================
--- /dev/null	2017-08-09 18:16:39.535015779 +0100
+++ gcc/testsuite/gcc.dg/vect/vect-alias-check-7.c	2017-08-10 14:36:24.201888108 +0100
@@ -0,0 +1,16 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+#define N 16
+
+struct s { int x[N]; };
+
+void
+f1 (struct s *a, struct s *b)
+{
+  for (int i = 0; i < N; ++i)
+    a->x[i] += b->x[N - i - 1];
+}
+
+/* { dg-final { scan-tree-dump {checking that [^\n]* and [^\n]* have different addresses} "vect" } } */
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { vect_perm && vect_element_align } } } } */