]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/vect/vect.exp
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / vect / vect.exp
1 # Copyright (C) 1997-2019 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 gcc-dg.exp
21 load_lib clearcap.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 # If the target system supports vector instructions, the default action
33 # for a test is 'run', otherwise it's 'compile'. Save current default.
34 # Executing vector instructions on a system without hardware vector support
35 # is also disabled by a call to check_vect, but disabling execution here is
36 # more efficient.
37 global dg-do-what-default
38 set save-dg-do-what-default ${dg-do-what-default}
39
40 # Skip these tests for targets that do not support generating vector
41 # code. Set additional target-dependent vector flags, which can be
42 # overridden by using dg-options in individual tests.
43 if ![check_vect_support_and_set_flags] {
44 return
45 }
46
47 # These flags are used for all targets.
48 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model" "-fno-common"
49
50 # Initialize `dg'.
51 dg-init
52 clearcap-init
53
54 global VEC_FLAGS
55 set VEC_FLAGS $DEFAULT_VECTCFLAGS
56
57 global O1_VECTCFLAGS
58 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
59 lappend O1_VECTCFLAGS "-O1"
60 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
61
62 global O_VECTCFLAGS
63 set O_VECTCFLAGS $DEFAULT_VECTCFLAGS
64 lappend O_VECTCFLAGS "-O"
65 lappend O_VECTCFLAGS "-fdump-tree-vect-details"
66
67 lappend DEFAULT_VECTCFLAGS "-O2"
68
69 # Tests that should be run without generating dump info
70 et-dg-runtest dg-runtest [lsort \
71 [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
72 "" $DEFAULT_VECTCFLAGS
73
74 # "-O -fdump-tree-veclower2"
75 lappend VEC_FLAGS "-O" "-fdump-tree-veclower2"
76 et-dg-runtest dg-runtest [lsort [glob -nocomplain \
77 $srcdir/$subdir/vec-scal-*.\[cS\]]] \
78 "" $VEC_FLAGS
79
80 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
81
82 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
83 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
84
85 # Main loop.
86 set VECT_ADDITIONAL_FLAGS [list ""]
87 if { [check_effective_target_lto] } {
88 lappend VECT_ADDITIONAL_FLAGS "-flto -ffat-lto-objects"
89 }
90 foreach flags $VECT_ADDITIONAL_FLAGS {
91 et-dg-runtest dg-runtest [lsort \
92 [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
93 $flags $DEFAULT_VECTCFLAGS
94 et-dg-runtest dg-runtest [lsort \
95 [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
96 $flags $DEFAULT_VECTCFLAGS
97 et-dg-runtest dg-runtest [lsort \
98 [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
99 $flags $DEFAULT_VECTCFLAGS
100 et-dg-runtest dg-runtest [lsort \
101 [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
102 $flags $VECT_SLP_CFLAGS
103 }
104
105 #### Tests with special options
106 global SAVED_DEFAULT_VECTCFLAGS
107 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
108 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
109
110 # --param vect-max-version-for-alias-checks=0 tests
111 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
112 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
113 et-dg-runtest dg-runtest [lsort \
114 [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
115 "" $DEFAULT_VECTCFLAGS
116
117 # -ffast-math tests
118 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
119 lappend DEFAULT_VECTCFLAGS "-ffast-math"
120 et-dg-runtest dg-runtest [lsort \
121 [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]] \
122 "" $DEFAULT_VECTCFLAGS
123
124 # -ffast-math SLP tests
125 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
126 lappend VECT_SLP_CFLAGS "-ffast-math"
127 et-dg-runtest dg-runtest [lsort \
128 [glob -nocomplain $srcdir/$subdir/fast-math-bb-slp-*.\[cS\]]] \
129 "" $VECT_SLP_CFLAGS
130
131 # -fno-fast-math tests
132 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
133 lappend DEFAULT_VECTCFLAGS "-fno-fast-math"
134 et-dg-runtest dg-runtest [lsort \
135 [glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]] \
136 "" $DEFAULT_VECTCFLAGS
137
138 # -fno-math-errno tests
139 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
140 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
141 et-dg-runtest dg-runtest [lsort \
142 [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
143 "" $DEFAULT_VECTCFLAGS
144
145 # -fwrapv tests
146 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
147 lappend DEFAULT_VECTCFLAGS "-fwrapv"
148 et-dg-runtest dg-runtest [lsort \
149 [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
150 "" $DEFAULT_VECTCFLAGS
151
152 # -ftrapv tests
153 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
154 lappend DEFAULT_VECTCFLAGS "-ftrapv"
155 et-dg-runtest dg-runtest [lsort \
156 [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
157 "" $DEFAULT_VECTCFLAGS
158
159 # -fno-tree-dce tests
160 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
161 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
162 et-dg-runtest dg-runtest [lsort \
163 [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
164 "" $DEFAULT_VECTCFLAGS
165
166 # -fsection-anchors tests
167 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
168 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
169 et-dg-runtest dg-runtest [lsort \
170 [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
171 "" $DEFAULT_VECTCFLAGS
172
173 # alignment-sensitive -fsection-anchors tests
174 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
175 lappend DEFAULT_VECTCFLAGS "-fsection-anchors" \
176 "-fdump-ipa-increase_alignment-details"
177 et-dg-runtest dg-runtest [lsort \
178 [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
179 "" $DEFAULT_VECTCFLAGS
180
181 # -fno-section-anchors tests
182 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
183 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
184 et-dg-runtest dg-runtest [lsort \
185 [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
186 "" $DEFAULT_VECTCFLAGS
187
188 # -funswitch-loops tests
189 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
190 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
191 et-dg-runtest dg-runtest [lsort \
192 [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
193 "" $DEFAULT_VECTCFLAGS
194
195 # -fno-trapping-math tests
196 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
197 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
198 et-dg-runtest dg-runtest [lsort \
199 [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
200 "" $DEFAULT_VECTCFLAGS
201
202 # -fno-tree-scev-cprop
203 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
204 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
205 et-dg-runtest dg-runtest [lsort \
206 [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
207 "" $DEFAULT_VECTCFLAGS
208
209 # -fno-tree-scev-cprop
210 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
211 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
212 et-dg-runtest dg-runtest [lsort \
213 [glob -nocomplain $srcdir/$subdir/no-scevccp-pr*.\[cS\]]] \
214 "" $DEFAULT_VECTCFLAGS
215
216 # -fno-tree-scev-cprop
217 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
218 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
219 et-dg-runtest dg-runtest [lsort \
220 [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
221 "" $DEFAULT_VECTCFLAGS
222
223 # -fno-tree-scev-cprop -fno-tree-reassoc
224 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
225 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
226 et-dg-runtest dg-runtest [lsort \
227 [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
228 "" $DEFAULT_VECTCFLAGS
229
230 # -fno-tree-scev-cprop
231 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
232 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
233 et-dg-runtest dg-runtest [lsort \
234 [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
235 "" $DEFAULT_VECTCFLAGS
236
237 # -fno-tree-dominator-opts
238 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
239 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
240 et-dg-runtest dg-runtest [lsort \
241 [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
242 "" $DEFAULT_VECTCFLAGS
243
244 # -fno-tree-pre
245 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
246 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
247 et-dg-runtest dg-runtest [lsort \
248 [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
249 "" $DEFAULT_VECTCFLAGS
250
251 # With -Os
252 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
253 lappend DEFAULT_VECTCFLAGS "-Os"
254 et-dg-runtest dg-runtest [lsort \
255 [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
256 "" $DEFAULT_VECTCFLAGS
257
258 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
259 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
260 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
261 et-dg-runtest dg-runtest [lsort \
262 [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
263 "" $DEFAULT_VECTCFLAGS
264
265 # With -O3.
266 # Don't allow IPA cloning, because it throws our counts out of whack.
267 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
268 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
269 if [istarget "spu-*-*"] {
270 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
271 }
272
273 et-dg-runtest dg-runtest [lsort \
274 [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
275 "" $DEFAULT_VECTCFLAGS
276
277 # With -O1
278 et-dg-runtest dg-runtest [lsort \
279 [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
280 "" $O1_VECTCFLAGS
281
282 # With -O
283 et-dg-runtest dg-runtest [lsort \
284 [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] \
285 "" $O_VECTCFLAGS
286
287 # -fno-tree-reassoc
288 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
289 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
290 et-dg-runtest dg-runtest [lsort \
291 [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
292 "" $VECT_SLP_CFLAGS
293
294 # -fno-tree-fre
295 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
296 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
297 et-dg-runtest dg-runtest [lsort \
298 [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]] \
299 "" $DEFAULT_VECTCFLAGS
300
301 # -fno-tree-fre -fno-tree-pre
302 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
303 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" "-fno-tree-pre"
304 et-dg-runtest dg-runtest [lsort \
305 [glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]] \
306 "" $DEFAULT_VECTCFLAGS
307
308 # -fno-tree-sra
309 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
310 lappend VECT_SLP_CFLAGS "-fno-tree-sra"
311 et-dg-runtest dg-runtest [lsort \
312 [glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]]] \
313 "" $VECT_SLP_CFLAGS
314
315
316 # Clean up.
317 set dg-do-what-default ${save-dg-do-what-default}
318
319 # All done.
320 clearcap-finish
321 dg-finish