Reverting merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect.exp
blobbea7ee0064baeb99ea3ff131fd7d6dea3a275f2e
1 # Copyright (C) 1997-2013 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.
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.
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.
19 # Load support procs.
20 load_lib gcc-dg.exp
22 # Set up flags used for tests that don't specify options.
23 global DEFAULT_VECTCFLAGS
24 set DEFAULT_VECTCFLAGS ""
26 # If the target system supports vector instructions, the default action
27 # for a test is 'run', otherwise it's 'compile'. Save current default.
28 # Executing vector instructions on a system without hardware vector support
29 # is also disabled by a call to check_vect, but disabling execution here is
30 # more efficient.
31 global dg-do-what-default
32 set save-dg-do-what-default ${dg-do-what-default}
34 # Skip these tests for targets that do not support generating vector
35 # code. Set additional target-dependent vector flags, which can be
36 # overridden by using dg-options in individual tests.
37 if ![check_vect_support_and_set_flags] {
38 return
41 # These flags are used for all targets.
42 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model" "-fno-common"
44 # Initialize `dg'.
45 dg-init
47 global VEC_FLAGS
48 set VEC_FLAGS $DEFAULT_VECTCFLAGS
50 global O1_VECTCFLAGS
51 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
52 lappend O1_VECTCFLAGS "-O1"
53 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
55 global O_VECTCFLAGS
56 set O_VECTCFLAGS $DEFAULT_VECTCFLAGS
57 lappend O_VECTCFLAGS "-O"
58 lappend O_VECTCFLAGS "-fdump-tree-vect-details"
60 lappend DEFAULT_VECTCFLAGS "-O2"
62 # Tests that should be run without generating dump info
63 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
64 "" $DEFAULT_VECTCFLAGS
66 # "-O -fdump-tree-veclower2"
67 lappend VEC_FLAGS "-O" "-fdump-tree-veclower2"
68 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vec-scal-*.\[cS\]]] \
69 "" $VEC_FLAGS
71 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
73 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
74 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
76 # Main loop.
77 set VECT_ADDITIONAL_FLAGS [list ""]
78 if { [check_effective_target_lto] } {
79 lappend VECT_ADDITIONAL_FLAGS "-flto"
81 foreach flags $VECT_ADDITIONAL_FLAGS {
82 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
83 $flags $DEFAULT_VECTCFLAGS
84 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
85 $flags $DEFAULT_VECTCFLAGS
86 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
87 $flags $DEFAULT_VECTCFLAGS
88 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
89 $flags $VECT_SLP_CFLAGS
92 #### Tests with special options
93 global SAVED_DEFAULT_VECTCFLAGS
94 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
95 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
97 # --param vect-max-version-for-alias-checks=0 tests
98 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
99 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
100 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
101 "" $DEFAULT_VECTCFLAGS
103 # -ffast-math tests
104 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
105 lappend DEFAULT_VECTCFLAGS "-ffast-math"
106 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]] \
107 "" $DEFAULT_VECTCFLAGS
109 # -ffast-math SLP tests
110 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
111 lappend VECT_SLP_CFLAGS "-ffast-math"
112 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-bb-slp-*.\[cS\]]] \
113 "" $VECT_SLP_CFLAGS
115 # -fno-fast-math tests
116 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
117 lappend DEFAULT_VECTCFLAGS "-fno-fast-math"
118 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]] \
119 "" $DEFAULT_VECTCFLAGS
121 # -fno-math-errno tests
122 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
123 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
124 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
125 "" $DEFAULT_VECTCFLAGS
127 # -fwrapv tests
128 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
129 lappend DEFAULT_VECTCFLAGS "-fwrapv"
130 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
131 "" $DEFAULT_VECTCFLAGS
133 # -ftrapv tests
134 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
135 lappend DEFAULT_VECTCFLAGS "-ftrapv"
136 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
137 "" $DEFAULT_VECTCFLAGS
139 # -fdump-tree-dceloop-details tests
140 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
141 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
142 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
143 "" $DEFAULT_VECTCFLAGS
145 # -fno-tree-dce tests
146 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
147 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
148 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
149 "" $DEFAULT_VECTCFLAGS
151 # -fsection-anchors tests
152 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
153 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
154 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
155 "" $DEFAULT_VECTCFLAGS
157 # alignment-sensitive -fsection-anchors tests
158 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
159 lappend DEFAULT_VECTCFLAGS "-fsection-anchors" \
160 "-fdump-ipa-increase_alignment-details"
161 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
162 "" $DEFAULT_VECTCFLAGS
164 # -fno-section-anchors tests
165 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
166 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
167 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
168 "" $DEFAULT_VECTCFLAGS
170 # -funswitch-loops tests
171 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
172 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
173 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
174 "" $DEFAULT_VECTCFLAGS
176 # -fno-trapping-math tests
177 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
178 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
179 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
180 "" $DEFAULT_VECTCFLAGS
182 # -fno-tree-scev-cprop
183 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
184 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
185 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[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-pr*.\[cS\]]] \
192 "" $DEFAULT_VECTCFLAGS
194 # -fno-tree-scev-cprop
195 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
196 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
197 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
198 "" $DEFAULT_VECTCFLAGS
200 # -fno-tree-scev-cprop -fno-tree-reassoc
201 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
202 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
203 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
204 "" $DEFAULT_VECTCFLAGS
206 # -fno-tree-scev-cprop
207 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
208 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
209 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
210 "" $DEFAULT_VECTCFLAGS
212 # -fno-tree-dominator-opts
213 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
214 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
215 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
216 "" $DEFAULT_VECTCFLAGS
218 # -fno-tree-pre
219 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
220 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
221 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
222 "" $DEFAULT_VECTCFLAGS
224 # With -Os
225 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
226 lappend DEFAULT_VECTCFLAGS "-Os"
227 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
228 "" $DEFAULT_VECTCFLAGS
230 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
231 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
232 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
233 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
234 "" $DEFAULT_VECTCFLAGS
236 # -ftree-loop-if-convert-stores
237 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
238 lappend DEFAULT_VECTCFLAGS "-ftree-loop-if-convert-stores"
239 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/if-cvt-stores-vect-*.\[cS\]]] \
240 "" $DEFAULT_VECTCFLAGS
242 # With -O3.
243 # Don't allow IPA cloning, because it throws our counts out of whack.
244 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
245 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
246 if [istarget "spu-*-*"] {
247 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
249 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
250 "" $DEFAULT_VECTCFLAGS
252 # With -O1
253 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
254 "" $O1_VECTCFLAGS
256 # With -O
257 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] \
258 "" $O_VECTCFLAGS
260 # -fno-tree-reassoc
261 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
262 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
263 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
264 "" $VECT_SLP_CFLAGS
266 # -fno-tree-fre
267 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
268 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
269 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]] \
270 "" $DEFAULT_VECTCFLAGS
272 # -fno-tree-fre -fno-tree-pre
273 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
274 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" "-fno-tree-pre"
275 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]] \
276 "" $DEFAULT_VECTCFLAGS
278 # -fno-tree-sra
279 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
280 lappend VECT_SLP_CFLAGS "-fno-tree-sra"
281 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]]] \
282 "" $VECT_SLP_CFLAGS
285 # Clean up.
286 set dg-do-what-default ${save-dg-do-what-default}
288 # All done.
289 dg-finish