| 1 |
# Copyright (C) 2004-2025 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
# This program is free software; you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation; either version 3 of the License, or |
| 6 |
# (at your option) any later version. |
| 7 |
# |
| 8 |
# This program is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with GCC; see the file COPYING3. If not see |
| 15 |
# <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
# GCC testsuite that uses the 'dg.exp' driver. |
| 18 |
|
| 19 |
# There's a bunch of headers we need. |
| 20 |
if [is_remote host] { |
| 21 |
foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { |
| 22 |
remote_download host $header |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
# Load support procs. |
| 27 |
load_lib g++-dg.exp |
| 28 |
load_lib target-supports.exp |
| 29 |
|
| 30 |
# If the target system supports vector instructions, the default action |
| 31 |
# for a test is 'run', otherwise it's 'compile'. Save current default. |
| 32 |
# Executing vector instructions on a system without hardware vector support |
| 33 |
# is also disabled by a call to check_vect, but disabling execution here is |
| 34 |
# more efficient. |
| 35 |
global dg-do-what-default |
| 36 |
set save-dg-do-what-default ${dg-do-what-default} |
| 37 |
|
| 38 |
# Set up flags used for tests that don't specify options. |
| 39 |
global DEFAULT_VECTCFLAGS |
| 40 |
set DEFAULT_VECTCFLAGS "" |
| 41 |
|
| 42 |
# Set up a list of effective targets to run vector tests for all supported |
| 43 |
# targets. |
| 44 |
global EFFECTIVE_TARGETS |
| 45 |
set EFFECTIVE_TARGETS "" |
| 46 |
|
| 47 |
# These flags are used for all targets. |
| 48 |
lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" |
| 49 |
|
| 50 |
# Skip these tests for targets that do not support generating vector |
| 51 |
# code. Set additional target-dependent vector flags, which can be |
| 52 |
# overridden by using dg-options in individual tests. |
| 53 |
if ![check_vect_support_and_set_flags] { |
| 54 |
return |
| 55 |
} |
| 56 |
|
| 57 |
set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS |
| 58 |
|
| 59 |
lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" |
| 60 |
lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details" |
| 61 |
|
| 62 |
# Initialize `dg'. |
| 63 |
dg-init |
| 64 |
|
| 65 |
# Main loop. |
| 66 |
et-dg-runtest g++-dg-runtest [lsort [glob -nocomplain \ |
| 67 |
$srcdir/$subdir/{pr,simd,vect-}*.{c,cc,S} ]] "" $DEFAULT_VECTCFLAGS |
| 68 |
et-dg-runtest g++-dg-runtest [lsort [glob -nocomplain \ |
| 69 |
$srcdir/$subdir/slp-pr*.{c,cc,S} ]] "" $VECT_SLP_CFLAGS |
| 70 |
|
| 71 |
#### Tests with special options |
| 72 |
global SAVED_DEFAULT_VECTCFLAGS |
| 73 |
set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS |
| 74 |
|
| 75 |
# --param max-aliased-vops=0 |
| 76 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 77 |
lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0" |
| 78 |
et-dg-runtest g++-dg-runtest [lsort [glob -nocomplain \ |
| 79 |
$srcdir/$subdir/param-max-aliased*.\[cS\]]] "" $DEFAULT_VECTCFLAGS |
| 80 |
|
| 81 |
# Clean up. |
| 82 |
set dg-do-what-default ${save-dg-do-what-default} |
| 83 |
|
| 84 |
# All done. |
| 85 |
dg-finish |