re PR tree-optimization/50414 (gfortran -Ofast SIGSEGV in store_constructor)
[gcc.git] / gcc / testsuite / gfortran.dg / vect / vect.exp
1 # Copyright (C) 1997, 2004, 2007, 2008, 2010 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 # These flags are used for all targets.
28 lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" \
29 "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
30
31 # If the target system supports vector instructions, the default action
32 # for a test is 'run', otherwise it's 'compile'. Save current default.
33 # Executing vector instructions on a system without hardware vector support
34 # is also disabled by a call to check_vect, but disabling execution here is
35 # more efficient.
36 global dg-do-what-default
37 set save-dg-do-what-default ${dg-do-what-default}
38
39 # Skip these tests for targets that do not support generating vector
40 # code. Set additional target-dependent vector flags, which can be
41 # overridden by using dg-options in individual tests.
42 if ![check_vect_support_and_set_flags] {
43 return
44 }
45
46 # Initialize `dg'.
47 dg-init
48
49 # Main loop.
50 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
51 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
52
53 #### Tests with special options
54 global SAVED_DEFAULT_VECTCFLAGS
55 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
56
57 # -ffast-math tests
58 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
59 lappend DEFAULT_VECTCFLAGS "-ffast-math"
60 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]] \
61 "" $DEFAULT_VECTCFLAGS
62
63 # -ffast-math tests
64 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
65 lappend DEFAULT_VECTCFLAGS "-ffast-math" "-fdefault-real-8"
66 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-real8*.\[fF\]{,90,95,03,08} ]] \
67 "" $DEFAULT_VECTCFLAGS
68
69 # -fvect-cost-model tests
70 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
71 lappend DEFAULT_VECTCFLAGS "-fvect-cost-model"
72 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]] \
73 "" $DEFAULT_VECTCFLAGS
74
75 # --param vect-max-version-for-alias-checks=0 tests
76 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
77 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
78 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]] \
79 "" $DEFAULT_VECTCFLAGS
80
81 # With -O3
82 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
83 lappend DEFAULT_VECTCFLAGS "-O3"
84 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]] \
85 "" $DEFAULT_VECTCFLAGS
86
87 # With -Ofast
88 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
89 lappend DEFAULT_VECTCFLAGS "-Ofast"
90 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]] \
91 "" $DEFAULT_VECTCFLAGS
92
93 # Clean up.
94 set dg-do-what-default ${save-dg-do-what-default}
95
96 # All done.
97 dg-finish