decay vect tests from run to link for pr95401

Message ID orfrvdn25t.fsf_-_@lxoliva.fsfla.org
State Committed
Commit 05d83334d5bbeae01d71080f1da524810d6740d9
Headers
Series decay vect tests from run to link for pr95401 |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed

Commit Message

Alexandre Oliva April 22, 2024, 10:05 a.m. UTC
  Ping?-ish for the full version of the RFC posted at
https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566588.html

On Mar 11, 2021, Richard Biener <richard.guenther@gmail.com> wrote:

> On Thu, Mar 11, 2021 at 9:03 AM Alexandre Oliva <oliva@adacore.com> wrote:

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

Thanks, here's a completed version.


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.

Regstrapped on x86_64-linux-gnu and ppc64el-linux-gnu.  Also tested with
gcc-13 on ppc64-vx7r2 and ppc-vx7r2.  Ok to install?


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 |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
  

Comments

Richard Biener April 22, 2024, 7:10 p.m. UTC | #1
On Mon, Apr 22, 2024 at 12:05 PM Alexandre Oliva <oliva@adacore.com> wrote:
>
> Ping?-ish for the full version of the RFC posted at
> https://gcc.gnu.org/pipermail/gcc-patches/2021-March/566588.html
>
> On Mar 11, 2021, Richard Biener <richard.guenther@gmail.com> wrote:
>
> > On Thu, Mar 11, 2021 at 9:03 AM Alexandre Oliva <oliva@adacore.com> wrote:
>
> >> 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?
>
> Thanks, here's a completed version.
>
>
> 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.
>
> Regstrapped on x86_64-linux-gnu and ppc64el-linux-gnu.  Also tested with
> gcc-13 on ppc64-vx7r2 and ppc-vx7r2.  Ok to install?

That makes sense.  OK

Thanks,
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 |   18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index 3a5713d98691f..54a55585371b0 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -11625,7 +11625,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.
> @@ -11655,14 +11655,14 @@ proc check_vect_support_and_set_flags { } {
>                  # some other cpu type specified above.
>                 set DEFAULT_VECTCFLAGS [linsert $DEFAULT_VECTCFLAGS 0 "-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] } {
> @@ -11681,7 +11681,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.
> @@ -11694,7 +11694,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
> @@ -11707,7 +11707,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
> @@ -11731,7 +11731,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
> @@ -11742,7 +11742,7 @@ proc check_vect_support_and_set_flags { } {
>             foreach item [add_options_for_riscv_v ""] {
>                 lappend DEFAULT_VECTCFLAGS $item
>             }
> -           set dg-do-what-default compile
> +           set dg-do-what-default link
>         }
>      } elseif [istarget loongarch*-*-*] {
>        # Set the default vectorization option to "-mlsx" due to the problem
> @@ -11751,7 +11751,7 @@ proc check_vect_support_and_set_flags { } {
>        if [check_effective_target_loongarch_sx_hw] {
>           set dg-do-what-default run
>        } else {
> -         set dg-do-what-default compile
> +         set dg-do-what-default link
>        }
>      } else {
>          return 0
>
>
> --
> Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
>    Free Software Activist                   GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive
  
Alexandre Oliva April 29, 2024, 11:30 p.m. UTC | #2
On Apr 22, 2024, Richard Biener <richard.guenther@gmail.com> wrote:

>> Regstrapped on x86_64-linux-gnu and ppc64el-linux-gnu.  Also tested with
>> gcc-13 on ppc64-vx7r2 and ppc-vx7r2.  Ok to install?

> That makes sense.  OK

>> for  gcc/testsuite/ChangeLog
>> 
>> * lib/target-supports.exp (check_vect_support_and_set_flags):
>> Decay to link rather than compile.

Alas, linking may fail because of an incompatible libc, as reported by
Linaro with a link to their issue GNU-1206 (I'm not posting the link to
the fully-Javascrippled Jira web page; it shows nothing useful, and I
can't post feedback there) and to
https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m7_hard_eabi-build/10/artifact/artifacts/00-sumfiles/
(where I could get useful information)

I'm reverting the patch, and I'll see about some alternate approach that
can accommodate this scenario after I return from LibrePlanet.
  
Christophe Lyon April 30, 2024, 12:39 p.m. UTC | #3
Hi Alexandre,

On Tue, 30 Apr 2024 at 01:31, Alexandre Oliva <oliva@adacore.com> wrote:
>
> On Apr 22, 2024, Richard Biener <richard.guenther@gmail.com> wrote:
>
> >> Regstrapped on x86_64-linux-gnu and ppc64el-linux-gnu.  Also tested with
> >> gcc-13 on ppc64-vx7r2 and ppc-vx7r2.  Ok to install?
>
> > That makes sense.  OK
>
> >> for  gcc/testsuite/ChangeLog
> >>
> >> * lib/target-supports.exp (check_vect_support_and_set_flags):
> >> Decay to link rather than compile.
>
> Alas, linking may fail because of an incompatible libc, as reported by
> Linaro with a link to their issue GNU-1206 (I'm not posting the link to
> the fully-Javascrippled Jira web page; it shows nothing useful, and I
> can't post feedback there) and to
> https://ci.linaro.org/job/tcwg_gnu_embed_check_gcc--master-thumb_m7_hard_eabi-build/10/artifact/artifacts/00-sumfiles/
> (where I could get useful information)
>
> I'm reverting the patch, and I'll see about some alternate approach that
> can accommodate this scenario after I return from LibrePlanet.
>

Indeed, that's another instance of the tricky multilibs configuration issues.
In this case:
- we configure GCC: --disable-multilib --with-mode=thumb
--with-cpu=cortex-m7 --with-float=hard --target=arm-eabi
(we disable multilibs to save build time)
- we run the tests with
qemu/-mthumb/-march=armv7e-m+fp.dp/-mtune=cortex-m7/-mfloat-abi=hard/-mfpu=auto
which matches the GCC configuration flags,
but the vect.exp tests add -mfpu=neon -mfloat-abi=softfp -march=armv7-a
and link fails because the toolchain does not support softfp libs

HTH

Thanks,

Christophe

> --
> Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
>    Free Software Activist                   GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive
  

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 3a5713d98691f..54a55585371b0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -11625,7 +11625,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.
@@ -11655,14 +11655,14 @@  proc check_vect_support_and_set_flags { } {
                 # some other cpu type specified above.
 		set DEFAULT_VECTCFLAGS [linsert $DEFAULT_VECTCFLAGS 0 "-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] } {
@@ -11681,7 +11681,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.
@@ -11694,7 +11694,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
@@ -11707,7 +11707,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
@@ -11731,7 +11731,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
@@ -11742,7 +11742,7 @@  proc check_vect_support_and_set_flags { } {
 	    foreach item [add_options_for_riscv_v ""] {
 		lappend DEFAULT_VECTCFLAGS $item
 	    }
-	    set dg-do-what-default compile
+	    set dg-do-what-default link
 	}
     } elseif [istarget loongarch*-*-*] {
       # Set the default vectorization option to "-mlsx" due to the problem
@@ -11751,7 +11751,7 @@  proc check_vect_support_and_set_flags { } {
       if [check_effective_target_loongarch_sx_hw] {
 	  set dg-do-what-default run
       } else {
-	  set dg-do-what-default compile
+	  set dg-do-what-default link
       }
     } else {
         return 0