Make SVE tests work with --with-cpu
A lot of the SVE assembly tests are for generic-tuned SVE codegen and so can fail when run on a toolchain configured with --with-cpu. This could easily be solved by forcing -mtune=generic, like we already do for -moverride=tune=none. However, the testsuite also has some useful execution tests that it would be better to run with as few flag changes as possible. Also, the flags in $sve_flags are printed as part of the test results, so each change to $sve_flags results in a change to the test summaries. This patch instead intercepts dg-options and tailors the list of additional options based on what the test is trying to do. It also gets rid of DEFAULT_CFLAGS, which are never useful for these tests. gcc/testsuite/ * lib/gcc-defs.exp (aarch64-arch-dg-options): New procedure. (aarch64-with-arch-dg-options): Likewise. * g++.target/aarch64/sve/aarch64-sve.exp: Run the tests inside aarch64-with-arch-dg-options. Move the default architecture flags to the final dg-runtest argument. * gcc.target/aarch64/sve/aarch64-sve.exp: Likewise. Dispense with DEFAULT_CFLAGS. * gcc.target/aarch64/sve2/aarch64-sve2.exp: Likewise.
This commit is contained in:
parent
ca7d451d98
commit
ff1912238e
|
@ -38,12 +38,10 @@ if { [check_effective_target_aarch64_sve] } {
|
|||
set sve_flags "-march=armv8.2-a+sve"
|
||||
}
|
||||
|
||||
# Turn off any codegen tweaks by default that may affect expected assembly.
|
||||
# Tests relying on those should turn them on explicitly.
|
||||
set sve_flags "$sve_flags -moverride=tune=none"
|
||||
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] $sve_flags ""
|
||||
aarch64-with-arch-dg-options $sve_flags {
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" $sve_flags
|
||||
}
|
||||
|
||||
# All done.
|
||||
dg-finish
|
||||
|
|
|
@ -28,26 +28,15 @@ if {![istarget aarch64*-*-*] } then {
|
|||
# Load support procs.
|
||||
load_lib gcc-dg.exp
|
||||
|
||||
# If a testcase doesn't have special options, use these.
|
||||
global DEFAULT_CFLAGS
|
||||
if ![info exists DEFAULT_CFLAGS] then {
|
||||
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
|
||||
}
|
||||
|
||||
# Initialize `dg'.
|
||||
dg-init
|
||||
|
||||
# Force SVE if we're not testing it already.
|
||||
if { [check_effective_target_aarch64_sve] } {
|
||||
set sve_flags ""
|
||||
} else {
|
||||
set sve_flags "-march=armv8.2-a+sve"
|
||||
}
|
||||
|
||||
# Turn off any codegen tweaks by default that may affect expected assembly.
|
||||
# Tests relying on those should turn them on explicitly.
|
||||
set sve_flags "$sve_flags -moverride=tune=none"
|
||||
|
||||
# Most of the code-quality tests are written for LP64. Just do the
|
||||
# correctness tests for ILP32.
|
||||
if { [check_effective_target_ilp32] } {
|
||||
|
@ -56,9 +45,11 @@ if { [check_effective_target_ilp32] } {
|
|||
set pattern "*"
|
||||
}
|
||||
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/$pattern.\[cCS\]]] \
|
||||
$sve_flags $DEFAULT_CFLAGS
|
||||
aarch64-with-arch-dg-options $sve_flags {
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/$pattern.\[cCS\]]] \
|
||||
"" $sve_flags
|
||||
}
|
||||
|
||||
# All done.
|
||||
dg-finish
|
||||
|
|
|
@ -28,12 +28,6 @@ if {![istarget aarch64*-*-*] } then {
|
|||
# Load support procs.
|
||||
load_lib gcc-dg.exp
|
||||
|
||||
# If a testcase doesn't have special options, use these.
|
||||
global DEFAULT_CFLAGS
|
||||
if ![info exists DEFAULT_CFLAGS] then {
|
||||
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
|
||||
}
|
||||
|
||||
# Initialize `dg'.
|
||||
dg-init
|
||||
|
||||
|
@ -44,9 +38,11 @@ if { [check_effective_target_aarch64_sve2] } {
|
|||
set sve2_flags "-march=armv8.5-a+sve2"
|
||||
}
|
||||
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
|
||||
$sve2_flags $DEFAULT_CFLAGS
|
||||
aarch64-with-arch-dg-options $sve2_flags {
|
||||
# Main loop.
|
||||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
|
||||
"" $sve2_flags
|
||||
}
|
||||
|
||||
# All done.
|
||||
dg-finish
|
||||
|
|
|
@ -506,3 +506,65 @@ proc dg-check-dot { args } {
|
|||
|
||||
pass "$testcase dg-check-dot $dotfile"
|
||||
}
|
||||
|
||||
# Used by aarch64-with-arch-dg-options to intercept dg-options and make
|
||||
# the changes required. See there for details.
|
||||
proc aarch64-arch-dg-options { args } {
|
||||
upvar dg-do-what do_what
|
||||
global aarch64_default_testing_arch
|
||||
|
||||
set add_arch 1
|
||||
set add_tune 1
|
||||
set checks_output [string equal [lindex $do_what 0] "compile"]
|
||||
set options [lindex $args 1]
|
||||
|
||||
foreach option [split $options] {
|
||||
switch -glob -- $option {
|
||||
-march=* { set add_arch 0 }
|
||||
-mcpu=* { set add_arch 0; set add_tune 0 }
|
||||
-mtune=* { set add_tune 0 }
|
||||
-moverride=* { set add_tune 0 }
|
||||
-save-temps { set checks_output 1 }
|
||||
--save-temps { set checks_output 1 }
|
||||
-fdump* { set checks_output 1 }
|
||||
}
|
||||
}
|
||||
|
||||
if { $add_arch && ![string equal $aarch64_default_testing_arch ""] } {
|
||||
# Force SVE if we're not testing it already.
|
||||
append options " $aarch64_default_testing_arch"
|
||||
}
|
||||
|
||||
if { $add_tune && $checks_output } {
|
||||
# Turn off any default tuning and codegen tweaks.
|
||||
append options " -mtune=generic -moverride=tune=none"
|
||||
}
|
||||
|
||||
uplevel 1 aarch64-old-dg-options [lreplace $args 1 1 $options]
|
||||
}
|
||||
|
||||
# Run Tcl code CODE with dg-options modified to work better for some
|
||||
# AArch64 tests. In particular:
|
||||
#
|
||||
# - If the dg-options do not specify an -march or -mcpu option,
|
||||
# use the architecture options in ARCH (which might be empty).
|
||||
#
|
||||
# - If the dg-options do not specify an -mcpu, -mtune or -moverride option,
|
||||
# and if the test appears to be checking assembly or dump output,
|
||||
# force the test to use generic tuning.
|
||||
#
|
||||
# The idea is to handle toolchains that are configured with a default
|
||||
# CPU or architecture that's different from the norm.
|
||||
proc aarch64-with-arch-dg-options { arch code } {
|
||||
global aarch64_default_testing_arch
|
||||
|
||||
set aarch64_default_testing_arch $arch
|
||||
|
||||
rename dg-options aarch64-old-dg-options
|
||||
rename aarch64-arch-dg-options dg-options
|
||||
|
||||
uplevel 1 $code
|
||||
|
||||
rename dg-options aarch64-arch-dg-options
|
||||
rename aarch64-old-dg-options dg-options
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue