diff mbox series

Fix gcc.dg/vect-opt-info-1.c testcase

Message ID 20180103212326.GO1833@tucnak
State New
Headers show
Series Fix gcc.dg/vect-opt-info-1.c testcase | expand

Commit Message

Jakub Jelinek Jan. 3, 2018, 9:23 p.m. UTC
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.


	Jakub

Comments

Richard Sandiford Jan. 3, 2018, 9:30 p.m. UTC | #1
Jakub Jelinek <jakub@redhat.com> writes:
> 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

Hmm, yeah.

> 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;

Yeah, that's right, the bug was using dump_file when dump_enabled_p (),
which would segfault when -fopt-info was passed and -fdump-tree-vect*
wasn't.

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

Me neither any more, but it looks good to me FWIW.

Thanks,
Richard
Jeff Law Jan. 4, 2018, 5:32 p.m. UTC | #2
On 01/03/2018 02:23 PM, Jakub Jelinek wrote:
> 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.
OK.
jeff
diff mbox series

Patch

--- 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];
+}