diff mbox series

[RFC] decay vect tests from run to link for pr95401

Message ID or7dmeb0o1.fsf@lxoliva.fsfla.org
State New
Headers show
Series [RFC] decay vect tests from run to link for pr95401 | expand

Commit Message

Alexandre Oliva March 11, 2021, 7:38 a.m. UTC
When vect.exp finds our configuration disables altivec by default, it
disables the execution of vectorization tests, assuming the test
hardware doesn't support it.

Tests become just compile tests, but compile tests won't work
correctly when additional sources are named, e.g. pr95401.cc, because
GCC refuses to compile multiple files into the same asm output.

With this patch, the default for when execution is not possible
becomes link.


This was regstrapped on x86_64-linux-gnu and ppc64-linux-gnu, and tested
with a cross to a ppc64-vxworks7r2 with altivec disabled by default.  I
found fixing the handling of additional sources to e.g. compile each one
separately, or perhaps just discard or reject additional sources for
compile tests, to be a little too involved.

So I'm leaning towards this proposed change, just extended to other
platforms that also decay from run to compile rather than link, and thus
run into this problem in g++.dg/vect/pr95401.cc.  Would this be
acceptable?


for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp (check_vect_support_and_set_flags):
	Decay to link rather than compile.
---
 gcc/testsuite/lib/target-supports.exp |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Biener March 11, 2021, 9:48 a.m. UTC | #1
On Thu, Mar 11, 2021 at 9:03 AM Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> When vect.exp finds our configuration disables altivec by default, it
> disables the execution of vectorization tests, assuming the test
> hardware doesn't support it.
>
> Tests become just compile tests, but compile tests won't work
> correctly when additional sources are named, e.g. pr95401.cc, because
> GCC refuses to compile multiple files into the same asm output.
>
> With this patch, the default for when execution is not possible
> becomes link.
>
>
> This was regstrapped on x86_64-linux-gnu and ppc64-linux-gnu, and tested
> with a cross to a ppc64-vxworks7r2 with altivec disabled by default.  I
> found fixing the handling of additional sources to e.g. compile each one
> separately, or perhaps just discard or reject additional sources for
> compile tests, to be a little too involved.
>
> So I'm leaning towards this proposed change, just extended to other
> platforms that also decay from run to compile rather than link, and thus
> run into this problem in g++.dg/vect/pr95401.cc.  Would this be
> acceptable?

I think that's OK.  It's probably difficult to make the test UNSUPPORTED
when dg-additional-sources is discovered with a dg-do compile test?

Richard.

>
> for  gcc/testsuite/ChangeLog
>
>         * lib/target-supports.exp (check_vect_support_and_set_flags):
>         Decay to link rather than compile.
> ---
>  gcc/testsuite/lib/target-supports.exp |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 52d3d036d3c5c..23d532fb2b963 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -9656,7 +9656,7 @@ proc check_vect_support_and_set_flags { } {
>                  # Specify a cpu that supports VMX for compile-only tests.
>                  lappend DEFAULT_VECTCFLAGS "-mcpu=970"
>              }
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
>          lappend DEFAULT_VECTCFLAGS "-msse2"
>
> --
> Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
>    Free Software Activist         GNU Toolchain Engineer
>         Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
Richard Sandiford March 11, 2021, 12:17 p.m. UTC | #2
Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> On Thu, Mar 11, 2021 at 9:03 AM Alexandre Oliva <oliva@adacore.com> wrote:
>>
>>
>> When vect.exp finds our configuration disables altivec by default, it
>> disables the execution of vectorization tests, assuming the test
>> hardware doesn't support it.
>>
>> Tests become just compile tests, but compile tests won't work
>> correctly when additional sources are named, e.g. pr95401.cc, because
>> GCC refuses to compile multiple files into the same asm output.
>>
>> With this patch, the default for when execution is not possible
>> becomes link.
>>
>>
>> This was regstrapped on x86_64-linux-gnu and ppc64-linux-gnu, and tested
>> with a cross to a ppc64-vxworks7r2 with altivec disabled by default.  I
>> found fixing the handling of additional sources to e.g. compile each one
>> separately, or perhaps just discard or reject additional sources for
>> compile tests, to be a little too involved.
>>
>> So I'm leaning towards this proposed change, just extended to other
>> platforms that also decay from run to compile rather than link, and thus
>> run into this problem in g++.dg/vect/pr95401.cc.  Would this be
>> acceptable?
>
> I think that's OK.

+1 FWIW.  It seems like an improvement anyway, since it makes it
harder to forget an explicit dg-do compile in cases where it's needed.

Richard
Alexandre Oliva March 11, 2021, 2:47 p.m. UTC | #3
On Mar 11, 2021, Richard Biener <richard.guenther@gmail.com> wrote:

> I think that's OK.

Cool, here's the patch I'm nearly done regstrapping on x86_64-linux-gnu
and x-ppc64-vx7r2.  Ok to install?

> It's probably difficult to make the test UNSUPPORTED
> when dg-additional-sources is discovered with a dg-do compile test?

Well, first of all, I really don't like the idea of skipping a test if
we can still get some useful information out of it.

That said, I suppose we could test for additional_sources_used in
${langdriver}_target_compile proces in gcc.exp, g++.exp et al, between
their calling dg-additional-files-options and target_compile, to
conditionally skip the latter, or pass $type to the former in all
$langdriver.exp, so that the extra files can be flagged and/or discarded
in unsupported modes.  I believe such changes would also require
adjustments to library test infrastructures.


decay vect tests from run to link for pr95401

When vect.exp finds our configuration disables altivec by default, it
disables the execution of vectorization tests, assuming the test
hardware doesn't support it.

Tests become just compile tests, but compile tests won't work
correctly when additional sources are named, e.g. pr95401.cc, because
GCC refuses to compile multiple files into the same asm output.

With this patch, the default for when execution is not possible
becomes link.


for  gcc/testsuite/ChangeLog

	* lib/target-supports.exp (check_vect_support_and_set_flags):
	Decay to link rather than compile.
---
 gcc/testsuite/lib/target-supports.exp |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 52d3d036d3c5c..f5b9b0578de37 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9632,7 +9632,7 @@ proc check_vect_support_and_set_flags { } {
         if [check_750cl_hw_available] {
             set dg-do-what-default run
         } else {
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif [istarget powerpc*-*-*] {
         # Skip targets not supporting -maltivec.
@@ -9656,14 +9656,14 @@ proc check_vect_support_and_set_flags { } {
                 # Specify a cpu that supports VMX for compile-only tests.
                 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
             }
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
         lappend DEFAULT_VECTCFLAGS "-msse2"
         if { [check_effective_target_sse2_runtime] } {
             set dg-do-what-default run
         } else {
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif { [istarget mips*-*-*]
 	       && [check_effective_target_nomips16] } {
@@ -9682,7 +9682,7 @@ proc check_vect_support_and_set_flags { } {
         if [check_effective_target_ultrasparc_hw] {
             set dg-do-what-default run
         } else {
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif [istarget alpha*-*-*] {
         # Alpha's vectorization capabilities are extremely limited.
@@ -9695,7 +9695,7 @@ proc check_vect_support_and_set_flags { } {
         if [check_alpha_max_hw_available] {
             set dg-do-what-default run
         } else {
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif [istarget ia64-*-*] {
         set dg-do-what-default run
@@ -9708,7 +9708,7 @@ proc check_vect_support_and_set_flags { } {
         if [is-effective-target arm_neon_hw] {
             set dg-do-what-default run
         } else {
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif [istarget "aarch64*-*-*"] {
         set dg-do-what-default run
@@ -9729,7 +9729,7 @@ proc check_vect_support_and_set_flags { } {
             set dg-do-what-default run
         } else {
 	    lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch"
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif [istarget amdgcn-*-*] {
         set dg-do-what-default run
Richard Biener March 12, 2021, 7:42 a.m. UTC | #4
On Thu, Mar 11, 2021 at 3:47 PM Alexandre Oliva <oliva@adacore.com> wrote:
>
> On Mar 11, 2021, Richard Biener <richard.guenther@gmail.com> wrote:
>
> > I think that's OK.
>
> Cool, here's the patch I'm nearly done regstrapping on x86_64-linux-gnu
> and x-ppc64-vx7r2.  Ok to install?

OK.

Richard.

> > It's probably difficult to make the test UNSUPPORTED
> > when dg-additional-sources is discovered with a dg-do compile test?
>
> Well, first of all, I really don't like the idea of skipping a test if
> we can still get some useful information out of it.
>
> That said, I suppose we could test for additional_sources_used in
> ${langdriver}_target_compile proces in gcc.exp, g++.exp et al, between
> their calling dg-additional-files-options and target_compile, to
> conditionally skip the latter, or pass $type to the former in all
> $langdriver.exp, so that the extra files can be flagged and/or discarded
> in unsupported modes.  I believe such changes would also require
> adjustments to library test infrastructures.
>
>
> decay vect tests from run to link for pr95401
>
> When vect.exp finds our configuration disables altivec by default, it
> disables the execution of vectorization tests, assuming the test
> hardware doesn't support it.
>
> Tests become just compile tests, but compile tests won't work
> correctly when additional sources are named, e.g. pr95401.cc, because
> GCC refuses to compile multiple files into the same asm output.
>
> With this patch, the default for when execution is not possible
> becomes link.
>
>
> for  gcc/testsuite/ChangeLog
>
>         * lib/target-supports.exp (check_vect_support_and_set_flags):
>         Decay to link rather than compile.
> ---
>  gcc/testsuite/lib/target-supports.exp |   14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 52d3d036d3c5c..f5b9b0578de37 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -9632,7 +9632,7 @@ proc check_vect_support_and_set_flags { } {
>          if [check_750cl_hw_available] {
>              set dg-do-what-default run
>          } else {
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif [istarget powerpc*-*-*] {
>          # Skip targets not supporting -maltivec.
> @@ -9656,14 +9656,14 @@ proc check_vect_support_and_set_flags { } {
>                  # Specify a cpu that supports VMX for compile-only tests.
>                  lappend DEFAULT_VECTCFLAGS "-mcpu=970"
>              }
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
>          lappend DEFAULT_VECTCFLAGS "-msse2"
>          if { [check_effective_target_sse2_runtime] } {
>              set dg-do-what-default run
>          } else {
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif { [istarget mips*-*-*]
>                && [check_effective_target_nomips16] } {
> @@ -9682,7 +9682,7 @@ proc check_vect_support_and_set_flags { } {
>          if [check_effective_target_ultrasparc_hw] {
>              set dg-do-what-default run
>          } else {
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif [istarget alpha*-*-*] {
>          # Alpha's vectorization capabilities are extremely limited.
> @@ -9695,7 +9695,7 @@ proc check_vect_support_and_set_flags { } {
>          if [check_alpha_max_hw_available] {
>              set dg-do-what-default run
>          } else {
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif [istarget ia64-*-*] {
>          set dg-do-what-default run
> @@ -9708,7 +9708,7 @@ proc check_vect_support_and_set_flags { } {
>          if [is-effective-target arm_neon_hw] {
>              set dg-do-what-default run
>          } else {
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif [istarget "aarch64*-*-*"] {
>          set dg-do-what-default run
> @@ -9729,7 +9729,7 @@ proc check_vect_support_and_set_flags { } {
>              set dg-do-what-default run
>          } else {
>             lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch"
> -            set dg-do-what-default compile
> +            set dg-do-what-default link
>          }
>      } elseif [istarget amdgcn-*-*] {
>          set dg-do-what-default run
>
>
> --
> Alexandre Oliva, happy hacker  https://FSFLA.org/blogs/lxo/
>    Free Software Activist         GNU Toolchain Engineer
>         Vim, Vi, Voltei pro Emacs -- GNUlius Caesar
diff mbox series

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 52d3d036d3c5c..23d532fb2b963 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9656,7 +9656,7 @@  proc check_vect_support_and_set_flags { } {
                 # Specify a cpu that supports VMX for compile-only tests.
                 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
             }
-            set dg-do-what-default compile
+            set dg-do-what-default link
         }
     } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
         lappend DEFAULT_VECTCFLAGS "-msse2"