1 |
689 |
jeremybenn |
# Copyright (C) 1997, 2004, 2005, 2006, 2007, 2008, 2010
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
|
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.
|
8 |
|
|
#
|
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.
|
13 |
|
|
#
|
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 |
|
|
# .
|
17 |
|
|
|
18 |
|
|
# GCC testsuite that uses the `dg.exp' driver.
|
19 |
|
|
|
20 |
|
|
# Load support procs.
|
21 |
|
|
load_lib gcc-dg.exp
|
22 |
|
|
|
23 |
|
|
# Set up flags used for tests that don't specify options.
|
24 |
|
|
global DEFAULT_VECTCFLAGS
|
25 |
|
|
set DEFAULT_VECTCFLAGS ""
|
26 |
|
|
|
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
|
31 |
|
|
# more efficient.
|
32 |
|
|
global dg-do-what-default
|
33 |
|
|
set save-dg-do-what-default ${dg-do-what-default}
|
34 |
|
|
|
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] {
|
39 |
|
|
return
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
# These flags are used for all targets.
|
43 |
|
|
lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
|
44 |
|
|
|
45 |
|
|
# Initialize `dg'.
|
46 |
|
|
dg-init
|
47 |
|
|
|
48 |
|
|
global VEC_FLAGS
|
49 |
|
|
set VEC_FLAGS $DEFAULT_VECTCFLAGS
|
50 |
|
|
|
51 |
|
|
global O1_VECTCFLAGS
|
52 |
|
|
set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
|
53 |
|
|
lappend O1_VECTCFLAGS "-O1"
|
54 |
|
|
lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
|
55 |
|
|
|
56 |
|
|
global O_VECTCFLAGS
|
57 |
|
|
set O_VECTCFLAGS $DEFAULT_VECTCFLAGS
|
58 |
|
|
lappend O_VECTCFLAGS "-O"
|
59 |
|
|
lappend O_VECTCFLAGS "-fdump-tree-vect-details"
|
60 |
|
|
|
61 |
|
|
lappend DEFAULT_VECTCFLAGS "-O2"
|
62 |
|
|
|
63 |
|
|
# Tests that should be run without generating dump info
|
64 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
|
65 |
|
|
"" $DEFAULT_VECTCFLAGS
|
66 |
|
|
|
67 |
|
|
# "-O -fdump-tree-veclower2"
|
68 |
|
|
lappend VEC_FLAGS "-O" "-fdump-tree-veclower2"
|
69 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vec-scal-*.\[cS\]]] \
|
70 |
|
|
"" $VEC_FLAGS
|
71 |
|
|
|
72 |
|
|
set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
|
73 |
|
|
|
74 |
|
|
lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
|
75 |
|
|
lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
|
76 |
|
|
|
77 |
|
|
# Main loop.
|
78 |
|
|
set VECT_ADDITIONAL_FLAGS [list ""]
|
79 |
|
|
if { [check_effective_target_lto] } {
|
80 |
|
|
lappend VECT_ADDITIONAL_FLAGS "-flto"
|
81 |
|
|
}
|
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
|
91 |
|
|
}
|
92 |
|
|
|
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
|
97 |
|
|
|
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
|
103 |
|
|
|
104 |
|
|
# -ffast-math tests
|
105 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
106 |
|
|
lappend DEFAULT_VECTCFLAGS "-ffast-math"
|
107 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-\[ipsv\]*.\[cS\]]] \
|
108 |
|
|
"" $DEFAULT_VECTCFLAGS
|
109 |
|
|
|
110 |
|
|
# -ffast-math SLP tests
|
111 |
|
|
set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
|
112 |
|
|
lappend VECT_SLP_CFLAGS "-ffast-math"
|
113 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-bb-slp-*.\[cS\]]] \
|
114 |
|
|
"" $VECT_SLP_CFLAGS
|
115 |
|
|
|
116 |
|
|
# -fno-fast-math tests
|
117 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
118 |
|
|
lappend DEFAULT_VECTCFLAGS "-fno-fast-math"
|
119 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fast-math-*.\[cS\]]] \
|
120 |
|
|
"" $DEFAULT_VECTCFLAGS
|
121 |
|
|
|
122 |
|
|
# -fno-math-errno tests
|
123 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
124 |
|
|
lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
|
125 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
|
126 |
|
|
"" $DEFAULT_VECTCFLAGS
|
127 |
|
|
|
128 |
|
|
# -fwrapv tests
|
129 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
130 |
|
|
lappend DEFAULT_VECTCFLAGS "-fwrapv"
|
131 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
|
132 |
|
|
"" $DEFAULT_VECTCFLAGS
|
133 |
|
|
|
134 |
|
|
# -ftrapv tests
|
135 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
136 |
|
|
lappend DEFAULT_VECTCFLAGS "-ftrapv"
|
137 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
|
138 |
|
|
"" $DEFAULT_VECTCFLAGS
|
139 |
|
|
|
140 |
|
|
# -fdump-tree-dceloop-details tests
|
141 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
142 |
|
|
lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
|
143 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
|
144 |
|
|
"" $DEFAULT_VECTCFLAGS
|
145 |
|
|
|
146 |
|
|
# -fno-tree-dce tests
|
147 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
148 |
|
|
lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
|
149 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
|
150 |
|
|
"" $DEFAULT_VECTCFLAGS
|
151 |
|
|
|
152 |
|
|
# -fsection-anchors tests
|
153 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
154 |
|
|
lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
|
155 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
|
156 |
|
|
"" $DEFAULT_VECTCFLAGS
|
157 |
|
|
|
158 |
|
|
# alignment-sensitive -fsection-anchors tests
|
159 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
160 |
|
|
lappend DEFAULT_VECTCFLAGS "-fsection-anchors" "-fdump-ipa-increase_alignment"
|
161 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
|
162 |
|
|
"" $DEFAULT_VECTCFLAGS
|
163 |
|
|
|
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
|
169 |
|
|
|
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
|
175 |
|
|
|
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
|
181 |
|
|
|
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
|
187 |
|
|
|
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
|
193 |
|
|
|
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
|
199 |
|
|
|
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
|
205 |
|
|
|
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
|
211 |
|
|
|
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
|
217 |
|
|
|
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
|
223 |
|
|
|
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
|
229 |
|
|
|
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
|
235 |
|
|
|
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
|
241 |
|
|
|
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"
|
248 |
|
|
}
|
249 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
|
250 |
|
|
"" $DEFAULT_VECTCFLAGS
|
251 |
|
|
|
252 |
|
|
# With -O1
|
253 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
|
254 |
|
|
"" $O1_VECTCFLAGS
|
255 |
|
|
|
256 |
|
|
# With -O
|
257 |
|
|
dg-runtest [lsort [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 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
|
264 |
|
|
"" $VECT_SLP_CFLAGS
|
265 |
|
|
|
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
|
271 |
|
|
|
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
|
277 |
|
|
|
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
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
# Clean up.
|
286 |
|
|
set dg-do-what-default ${save-dg-do-what-default}
|
287 |
|
|
|
288 |
|
|
# All done.
|
289 |
|
|
dg-finish
|