| 1 |
# Copyright (C) 1997-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 |
# Load support procs. |
| 20 |
load_lib gfortran-dg.exp |
| 21 |
load_lib target-supports.exp |
| 22 |
|
| 23 |
# Set up flags used for tests that don't specify options. |
| 24 |
global DEFAULT_VECTCFLAGS |
| 25 |
set DEFAULT_VECTCFLAGS "" |
| 26 |
|
| 27 |
# Set up a list of effective targets to run vector tests for all supported |
| 28 |
# targets. |
| 29 |
global EFFECTIVE_TARGETS |
| 30 |
set EFFECTIVE_TARGETS "" |
| 31 |
|
| 32 |
# These flags are used for all targets. |
| 33 |
lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model=unlimited" \ |
| 34 |
"-fdump-tree-vect-details" |
| 35 |
|
| 36 |
# If the target system supports vector instructions, the default action |
| 37 |
# for a test is 'run', otherwise it's 'compile'. Save current default. |
| 38 |
# Executing vector instructions on a system without hardware vector support |
| 39 |
# is also disabled by a call to check_vect, but disabling execution here is |
| 40 |
# more efficient. |
| 41 |
global dg-do-what-default |
| 42 |
set save-dg-do-what-default ${dg-do-what-default} |
| 43 |
|
| 44 |
# Skip these tests for targets that do not support generating vector |
| 45 |
# code. Set additional target-dependent vector flags, which can be |
| 46 |
# overridden by using dg-options in individual tests. |
| 47 |
if ![check_vect_support_and_set_flags] { |
| 48 |
return |
| 49 |
} |
| 50 |
|
| 51 |
# Initialize `dg'. |
| 52 |
dg-init |
| 53 |
|
| 54 |
# Main loop. |
| 55 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 56 |
$srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] "" $DEFAULT_VECTCFLAGS |
| 57 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 58 |
$srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] "" $DEFAULT_VECTCFLAGS |
| 59 |
|
| 60 |
#### Tests with special options |
| 61 |
global SAVED_DEFAULT_VECTCFLAGS |
| 62 |
set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS |
| 63 |
|
| 64 |
# -ffast-math tests |
| 65 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 66 |
lappend DEFAULT_VECTCFLAGS "-ffast-math" |
| 67 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 68 |
$srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]] \ |
| 69 |
"" $DEFAULT_VECTCFLAGS |
| 70 |
|
| 71 |
# -ffast-math tests |
| 72 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 73 |
lappend DEFAULT_VECTCFLAGS "-ffast-math" "-fdefault-real-8" |
| 74 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 75 |
$srcdir/$subdir/fast-math-real8*.\[fF\]{,90,95,03,08} ]] \ |
| 76 |
"" $DEFAULT_VECTCFLAGS |
| 77 |
|
| 78 |
# -fvect-cost-model tests |
| 79 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 80 |
lappend DEFAULT_VECTCFLAGS "-fvect-cost-model=dynamic" |
| 81 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 82 |
$srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]] \ |
| 83 |
"" $DEFAULT_VECTCFLAGS |
| 84 |
|
| 85 |
# --param vect-max-version-for-alias-checks=0 tests |
| 86 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 87 |
lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0" |
| 88 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 89 |
$srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]] \ |
| 90 |
"" $DEFAULT_VECTCFLAGS |
| 91 |
|
| 92 |
# With -O3 |
| 93 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 94 |
lappend DEFAULT_VECTCFLAGS "-O3" |
| 95 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 96 |
$srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]] \ |
| 97 |
"" $DEFAULT_VECTCFLAGS |
| 98 |
|
| 99 |
# With -Ofast |
| 100 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 101 |
lappend DEFAULT_VECTCFLAGS "-Ofast" |
| 102 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 103 |
$srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]] \ |
| 104 |
"" $DEFAULT_VECTCFLAGS |
| 105 |
|
| 106 |
# With -fno-tree-copy-prop -fno-tree-fre -O3 |
| 107 |
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS |
| 108 |
lappend DEFAULT_VECTCFLAGS "-fno-tree-copy-prop" "-fno-tree-fre" "-O3" |
| 109 |
et-dg-runtest gfortran-dg-runtest [lsort [glob -nocomplain \ |
| 110 |
$srcdir/$subdir/no-fre-no-copy-prop-O3-*.\[fF\]{,90,95,03,08} ]] \ |
| 111 |
"" $DEFAULT_VECTCFLAGS |
| 112 |
|
| 113 |
# Clean up. |
| 114 |
set dg-do-what-default ${save-dg-do-what-default} |
| 115 |
|
| 116 |
# All done. |
| 117 |
dg-finish |