Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect.exp

raw
1 # Copyright (C) 1997-2025 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-tree-loop-distribute-patterns" "-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/tsvc/*.\[cS\]]] \
99 $flags $DEFAULT_VECTCFLAGS
100 et-dg-runtest dg-runtest [lsort \
101 [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
102 $flags $DEFAULT_VECTCFLAGS
103 et-dg-runtest dg-runtest [lsort \
104 [glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]] \
105 $flags $DEFAULT_VECTCFLAGS
106 et-dg-runtest dg-runtest [lsort \
107 [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
108 $flags $DEFAULT_VECTCFLAGS
109 et-dg-runtest dg-runtest [lsort \
110 [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
111 $flags $DEFAULT_VECTCFLAGS
112 et-dg-runtest dg-runtest [lsort \
113 [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsvc\]*.\[cS\]]] \
114 $flags $DEFAULT_VECTCFLAGS
115 et-dg-runtest dg-runtest [lsort \
116 [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
117 $flags $DEFAULT_VECTCFLAGS
118 et-dg-runtest dg-runtest [lsort \
119 [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
120 $flags $DEFAULT_VECTCFLAGS
121
122 et-dg-runtest dg-runtest [lsort \
123 [glob -nocomplain $srcdir/$subdir/fast-math-bb-slp-*.\[cS\]]] \
124 $flags $VECT_SLP_CFLAGS
125 et-dg-runtest dg-runtest [lsort \
126 [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
127 $flags $VECT_SLP_CFLAGS
128 }
129
130 #### Tests with special options
131 global SAVED_DEFAULT_VECTCFLAGS
132 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
133 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
134
135 # -fno-tree-dce tests
136 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
137 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
138 et-dg-runtest dg-runtest [lsort \
139 [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
140 "" $DEFAULT_VECTCFLAGS
141
142 # -fsection-anchors tests
143 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
144 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
145 et-dg-runtest dg-runtest [lsort \
146 [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
147 "" $DEFAULT_VECTCFLAGS
148
149 # alignment-sensitive -fsection-anchors tests
150 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
151 lappend DEFAULT_VECTCFLAGS "-fsection-anchors" \
152 "-fdump-ipa-increase_alignment-details"
153 et-dg-runtest dg-runtest [lsort \
154 [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
155 "" $DEFAULT_VECTCFLAGS
156
157 # -fno-section-anchors tests
158 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
159 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
160 et-dg-runtest dg-runtest [lsort \
161 [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
162 "" $DEFAULT_VECTCFLAGS
163
164 # -funswitch-loops tests
165 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
166 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
167 et-dg-runtest dg-runtest [lsort \
168 [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
169 "" $DEFAULT_VECTCFLAGS
170
171 # -fno-trapping-math tests
172 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
173 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
174 et-dg-runtest dg-runtest [lsort \
175 [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
176 "" $DEFAULT_VECTCFLAGS
177
178 # -fno-tree-scev-cprop
179 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
180 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
181 et-dg-runtest dg-runtest [lsort \
182 [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
183 "" $DEFAULT_VECTCFLAGS
184
185 # -fno-tree-scev-cprop
186 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
187 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
188 et-dg-runtest dg-runtest [lsort \
189 [glob -nocomplain $srcdir/$subdir/no-scevccp-pr*.\[cS\]]] \
190 "" $DEFAULT_VECTCFLAGS
191
192 # -fno-tree-scev-cprop
193 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
194 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
195 et-dg-runtest dg-runtest [lsort \
196 [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
197 "" $DEFAULT_VECTCFLAGS
198
199 # -fno-tree-scev-cprop -fno-tree-reassoc
200 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
201 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
202 et-dg-runtest dg-runtest [lsort \
203 [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
204 "" $DEFAULT_VECTCFLAGS
205
206 # -fno-tree-scev-cprop
207 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
208 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
209 et-dg-runtest dg-runtest [lsort \
210 [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
211 "" $DEFAULT_VECTCFLAGS
212
213 # -fno-tree-dominator-opts
214 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
215 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
216 et-dg-runtest dg-runtest [lsort \
217 [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
218 "" $DEFAULT_VECTCFLAGS
219
220 # -fno-tree-pre
221 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
222 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
223 et-dg-runtest dg-runtest [lsort \
224 [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
225 "" $DEFAULT_VECTCFLAGS
226
227 # With -Os
228 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
229 lappend DEFAULT_VECTCFLAGS "-Os"
230 et-dg-runtest dg-runtest [lsort \
231 [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
232 "" $DEFAULT_VECTCFLAGS
233
234 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
235 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
236 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
237 et-dg-runtest dg-runtest [lsort \
238 [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
239 "" $DEFAULT_VECTCFLAGS
240
241 # With -O3.
242 # Don't allow IPA cloning, because it throws our counts out of whack.
243 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
244 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
245
246 et-dg-runtest dg-runtest [lsort \
247 [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
248 "" $DEFAULT_VECTCFLAGS
249
250 # With -O1
251 et-dg-runtest dg-runtest [lsort \
252 [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
253 "" $O1_VECTCFLAGS
254
255 # With -O
256 et-dg-runtest dg-runtest [lsort \
257 [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] \
258 "" $O_VECTCFLAGS
259
260 # -fno-tree-reassoc
261 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
262 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
263 et-dg-runtest dg-runtest [lsort \
264 [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
265 "" $VECT_SLP_CFLAGS
266
267 # -fno-tree-fre
268 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
269 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
270 et-dg-runtest dg-runtest [lsort \
271 [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]] \
272 "" $DEFAULT_VECTCFLAGS
273
274 # -fno-tree-fre -fno-tree-pre
275 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
276 lappend DEFAULT_VECTCFLAGS "-fno-tree-fre" "-fno-tree-pre"
277 et-dg-runtest dg-runtest [lsort \
278 [glob -nocomplain $srcdir/$subdir/no-fre-pre*.\[cS\]]] \
279 "" $DEFAULT_VECTCFLAGS
280
281 # -fno-tree-sra
282 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
283 lappend VECT_SLP_CFLAGS "-fno-tree-sra"
284 et-dg-runtest dg-runtest [lsort \
285 [glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]]] \
286 "" $VECT_SLP_CFLAGS
287
288
289 # Clean up.
290 set dg-do-what-default ${save-dg-do-what-default}
291
292 # All done.
293 clearcap-finish
294 dg-finish