This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix gcc.dg/vect-opt-info-1.c testcase
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Sandiford <richard dot sandiford at linaro dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 3 Jan 2018 22:23:26 +0100
- Subject: [PATCH] Fix gcc.dg/vect-opt-info-1.c testcase
- Authentication-results: sourceware.org; auth=none
- References: <871sltvm7r.fsf@linaro.org> <87bmkxkc7f.fsf@linaro.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Oct 23, 2017 at 06:26:12PM +0100, Richard Sandiford wrote:
> 2017-10-23 Richard Sandiford <richard.sandiford@linaro.org>
> Alan Hayward <alan.hayward@arm.com>
> David Sherwood <david.sherwood@arm.com>
...
> --- /dev/null 2017-10-21 08:51:42.385141415 +0100
> +++ gcc/testsuite/gcc.dg/vect-opt-info-1.c 2017-10-23 17:22:26.571498977 +0100
> @@ -0,0 +1,11 @@
> +/* { dg-options "-std=c99 -fopt-info -O3" } */
> +
> +void
> +vadd (int *dst, int *op1, int *op2, int count)
> +{
> + for (int i = 0; i < count; ++i)
> + dst[i] = op1[i] + op2[i];
> +}
> +
> +/* { dg-message "loop vectorized" "" { target *-*-* } 6 } */
> +/* { dg-message "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } 6 } */
This testcase fails e.g. on i686-linux. The problem is
1) it really should be at least guarded with
/* { dg-do compile { target vect_int } } */
because on targets that can't vectorize even simple int operations
this will obviously fail
2) that won't help for i686 though, because we need -msse2 added
to options for it to work; that is normally added by
check_vect_support_and_set_flags
only when in vect.exp. If it was just that target, we could add
dg-additional-options, but I'm afraid many other targets add some options.
The following works for me, calling it nodump-* ensures that
-fdump-tree-* isn't added, which I believe is essential for the testcase;
tested on x86_64-linux with
RUNTESTFLAGS='--target_board=unix\{-m32,-m32/-mno-sse,-m64\} vect.exp=nodump*'
ok for trunk?
Sadly I don't have your broken development version of the patch, so can't
verify it fails with the broken patch.
2018-01-03 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/vect-opt-info-1.c: Moved to ...
* gcc.dg/vect/nodump-vect-opt-info-1.c: ... here. Only run on
vect_int targets, use dg-additional-options instead of dg-options and
use relative line numbers instead of absolute.
--- gcc/testsuite/gcc.dg/vect-opt-info-1.c.jj 2018-01-03 10:04:47.568412808 +0100
+++ gcc/testsuite/gcc.dg/vect-opt-info-1.c 2018-01-03 22:14:44.082848915 +0100
@@ -1,11 +0,0 @@
-/* { dg-options "-std=c99 -fopt-info -O3" } */
-
-void
-vadd (int *dst, int *op1, int *op2, int count)
-{
- for (int i = 0; i < count; ++i)
- dst[i] = op1[i] + op2[i];
-}
-
-/* { dg-message "loop vectorized" "" { target *-*-* } 6 } */
-/* { dg-message "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } 6 } */
--- gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c.jj 2018-01-03 22:14:49.387852927 +0100
+++ gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-1.c 2018-01-03 22:17:30.437974412 +0100
@@ -0,0 +1,11 @@
+/* { dg-do compile { target vect_int } } */
+/* { dg-additional-options "-std=c99 -fopt-info -O3" } */
+
+void
+vadd (int *dst, int *op1, int *op2, int count)
+{
+/* { dg-message "loop vectorized" "" { target *-*-* } .+2 } */
+/* { dg-message "loop versioned for vectorization because of possible aliasing" "" { target *-*-* } .+1 } */
+ for (int i = 0; i < count; ++i)
+ dst[i] = op1[i] + op2[i];
+}
Jakub