1 # Copyright (C) 1997, 2004, 2007 Free Software Foundation, Inc.
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.
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.
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/>.
17 # GCC testsuite that uses the `dg.exp' driver.
20 load_lib gfortran-dg.exp
21 load_lib target-supports.exp
23 # Set up flags used for tests that don't specify options.
24 set DEFAULT_VECTCFLAGS ""
26 # These flags are used for all targets.
27 lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" \
28 "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
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
35 global dg-do-what-default
36 set save-dg-do-what-default ${dg-do-what-default}
38 # Skip these tests for targets that do not support generating vector
39 # code. Set additional target-dependent vector flags, which can be
40 # overridden by using dg-options in individual tests.
41 if [istarget "powerpc*-*-*"] {
42 # If there are powerpc targets to skip, do it here.
44 lappend DEFAULT_VECTCFLAGS "-maltivec"
45 if [check_vmx_hw_available] {
46 set dg-do-what-default run
48 if [is-effective-target ilp32] {
49 # Specify a cpu that supports VMX for compile-only tests.
50 lappend DEFAULT_VECTCFLAGS "-mcpu=7400"
52 set dg-do-what-default compile
54 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
55 lappend DEFAULT_VECTCFLAGS "-msse2"
56 set dg-do-what-default run
57 } elseif [istarget "mipsisa64*-*-*"] {
58 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
59 set dg-do-what-default run
60 } elseif [istarget "sparc*-*-*"] {
61 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
62 set dg-do-what-default run
63 } elseif [istarget "alpha*-*-*"] {
64 lappend DEFAULT_VECTCFLAGS "-mmax"
65 if [check_alpha_max_hw_available] {
66 set dg-do-what-default run
68 set dg-do-what-default compile
70 } elseif [istarget "ia64-*-*"] {
71 set dg-do-what-default run
76 # Return 1 if the effective target is LP64 or if the effective target
77 # does not support a vector alignment mechanism.
79 proc check_effective_target_lp64_or_vect_no_align { } {
80 if { [is-effective-target lp64]
81 || [is-effective-target vect_no_align] } {
93 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
94 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
96 #### Tests with special options
97 global SAVED_DEFAULT_VECTCFLAGS
98 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
101 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
102 lappend DEFAULT_VECTCFLAGS "-ffast-math"
103 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]] \
104 "" $DEFAULT_VECTCFLAGS
106 # -fvect-cost-model tests
107 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
108 lappend DEFAULT_VECTCFLAGS "-fvect-cost-model"
109 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]] \
110 "" $DEFAULT_VECTCFLAGS
112 # --param vect-max-version-for-alias-checks=0 tests
113 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
114 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
115 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]] \
116 "" $DEFAULT_VECTCFLAGS
119 set dg-do-what-default ${save-dg-do-what-default}