1 # Copyright (C) 1997, 2004, 2005, 2006, 2007, 2008, 2010
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC; see the file COPYING3. If not see
16 # <http://www.gnu.org/licenses/>.
18 # GCC testsuite that uses the `dg.exp' driver.
23 # Set up flags used for tests that don't specify options.
24 global DEFAULT_VECTCFLAGS
25 set DEFAULT_VECTCFLAGS ""
27 # If the target system supports vector instructions, the default action
28 # for a test is 'run', otherwise it's 'compile'. Save current default.
29 # Executing vector instructions on a system without hardware vector support
30 # is also disabled by a call to check_vect, but disabling execution here is
32 global dg-do-what-default
33 set save-dg-do-what-default ${dg-do-what-default}
35 # Skip these tests for targets that do not support generating vector
36 # code. Set additional target-dependent vector flags, which can be
37 # overridden by using dg-options in individual tests.
38 if ![check_vect_support_and_set_flags] {
43 set VEC_FLAGS $DEFAULT_VECTCFLAGS
45 # These flags are used for all targets.
46 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
52 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
53 lappend O1_VECTCFLAGS "-O1"
54 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
57 set O_VECTCFLAGS $DEFAULT_VECTCFLAGS
58 lappend O_VECTCFLAGS "-O"
59 lappend O_VECTCFLAGS "-fdump-tree-vect-details"
61 lappend DEFAULT_VECTCFLAGS "-O2"
63 # Tests that should be run without generating dump info
64 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
65 "" $DEFAULT_VECTCFLAGS
67 # "-O -fdump-tree-veclower"
68 lappend VEC_FLAGS "-O" "-fdump-tree-veclower"
69 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vec-scal-*.\[cS\]]] \
72 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
74 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
75 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
78 set VECT_ADDITIONAL_FLAGS [list ""]
79 if { [check_effective_target_lto] } {
80 lappend VECT_ADDITIONAL_FLAGS "-flto"
82 foreach flags $VECT_ADDITIONAL_FLAGS {
83 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
84 $flags $DEFAULT_VECTCFLAGS
85 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
86 $flags $DEFAULT_VECTCFLAGS
87 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
88 $flags $DEFAULT_VECTCFLAGS
89 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
90 $flags $VECT_SLP_CFLAGS
93 #### Tests with special options
94 global SAVED_DEFAULT_VECTCFLAGS
95 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
96 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
98 # --param vect-max-version-for-alias-checks=0 tests
99 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
100 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
101 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
102 "" $DEFAULT_VECTCFLAGS
105 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
106 lappend DEFAULT_VECTCFLAGS "-ffast-math"
107 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]] \
108 "" $DEFAULT_VECTCFLAGS
110 # -fno-math-errno tests
111 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
112 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
113 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
114 "" $DEFAULT_VECTCFLAGS
117 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
118 lappend DEFAULT_VECTCFLAGS "-fwrapv"
119 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
120 "" $DEFAULT_VECTCFLAGS
123 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
124 lappend DEFAULT_VECTCFLAGS "-ftrapv"
125 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
126 "" $DEFAULT_VECTCFLAGS
128 # -fdump-tree-dceloop-details tests
129 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
130 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
131 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
132 "" $DEFAULT_VECTCFLAGS
134 # -fno-tree-dce tests
135 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
136 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
137 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
138 "" $DEFAULT_VECTCFLAGS
140 # -fsection-anchors tests
141 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
142 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
143 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
144 "" $DEFAULT_VECTCFLAGS
146 # alignment-sensitive -fsection-anchors tests
147 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
148 lappend DEFAULT_VECTCFLAGS "-fsection-anchors" "-fdump-ipa-increase_alignment"
149 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
150 "" $DEFAULT_VECTCFLAGS
152 # -fno-section-anchors tests
153 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
154 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
155 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
156 "" $DEFAULT_VECTCFLAGS
158 # -funswitch-loops tests
159 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
160 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
161 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
162 "" $DEFAULT_VECTCFLAGS
164 # -fno-trapping-math tests
165 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
166 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
167 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
168 "" $DEFAULT_VECTCFLAGS
170 # -fno-tree-scev-cprop
171 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
172 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
173 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
174 "" $DEFAULT_VECTCFLAGS
176 # -fno-tree-scev-cprop
177 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
178 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
179 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
180 "" $DEFAULT_VECTCFLAGS
182 # -fno-tree-scev-cprop -fno-tree-reassoc
183 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
184 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
185 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
186 "" $DEFAULT_VECTCFLAGS
188 # -fno-tree-scev-cprop
189 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
190 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
191 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
192 "" $DEFAULT_VECTCFLAGS
194 # -fno-tree-dominator-opts
195 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
196 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
197 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
198 "" $DEFAULT_VECTCFLAGS
201 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
202 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
203 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
204 "" $DEFAULT_VECTCFLAGS
207 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
208 lappend DEFAULT_VECTCFLAGS "-Os"
209 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
210 "" $DEFAULT_VECTCFLAGS
212 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
213 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
214 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
215 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
216 "" $DEFAULT_VECTCFLAGS
218 # -ftree-loop-if-convert-stores
219 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
220 lappend DEFAULT_VECTCFLAGS "-ftree-loop-if-convert-stores"
221 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/if-cvt-stores-vect-*.\[cS\]]] \
222 "" $DEFAULT_VECTCFLAGS
225 # Don't allow IPA cloning, because it throws our counts out of whack.
226 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
227 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
228 if [istarget "spu-*-*"] {
229 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
231 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
232 "" $DEFAULT_VECTCFLAGS
235 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
239 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] \
243 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
244 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
245 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
249 set dg-do-what-default ${save-dg-do-what-default}