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 set DEFAULT_VECTCFLAGS
""
26 # These flags are used
for all targets.
27 lappend DEFAULT_VECTCFLAGS
"-ftree-vectorize" "-fno-vect-cost-model"
29 #
If the target
system supports vector instructions
, the default action
30 #
for a test is
'run', otherwise it
's 'compile'. Save current default.
31 # Executing vector instructions on a system without hardware vector support
32 # is also disabled by a call to check_vect, but disabling execution here is
34 global dg-do-what-default
35 set save-dg-do-what-default ${dg-do-what-default}
37 # Skip these tests for targets that do not support generating vector
38 # code. Set additional target-dependent vector flags, which can be
39 # overridden by using dg-options in individual tests.
40 if [istarget "powerpc-*paired*"] {
41 lappend DEFAULT_VECTCFLAGS "-mpaired"
42 if [check_750cl_hw_available] {
43 set dg-do-what-default run
45 set dg-do-what-default compile
47 } elseif [istarget "powerpc*-*-*"] {
48 # Skip targets not supporting -maltivec.
49 if ![is-effective-target powerpc_altivec_ok] {
53 lappend DEFAULT_VECTCFLAGS "-maltivec"
54 if [check_vsx_hw_available] {
55 lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
58 if [check_vmx_hw_available] {
59 set dg-do-what-default run
61 if [is-effective-target ilp32] {
62 # Specify a cpu that supports VMX for compile-only tests.
63 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
65 set dg-do-what-default compile
67 } elseif { [istarget "spu-*-*"] } {
68 set dg-do-what-default run
69 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
70 lappend DEFAULT_VECTCFLAGS "-msse2"
71 if { [check_effective_target_sse2_runtime] } {
72 set dg-do-what-default run
74 set dg-do-what-default compile
76 } elseif { [istarget "mips*-*-*"]
77 && ([check_effective_target_mpaired_single]
78 || [check_effective_target_mips_loongson])
79 && [check_effective_target_nomips16] } {
80 if { [check_effective_target_mpaired_single] } {
81 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
83 set dg-do-what-default run
84 } elseif [istarget "sparc*-*-*"] {
85 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
86 if [check_effective_target_ultrasparc_hw] {
87 set dg-do-what-default run
89 set dg-do-what-default compile
91 } elseif [istarget "alpha*-*-*"] {
92 # Alpha's vectorization capabilities are extremely limited.
93 # It
's more effort than its worth disabling all of the tests
94 # that it cannot pass. But if you actually want to see what
95 # does work, command out the return.
98 lappend DEFAULT_VECTCFLAGS "-mmax"
99 if [check_alpha_max_hw_available] {
100 set dg-do-what-default run
102 set dg-do-what-default compile
104 } elseif [istarget "ia64-*-*"] {
105 set dg-do-what-default run
106 } elseif [is-effective-target arm_neon_ok] {
107 eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
108 # NEON does not support denormals, so is not used for vectorization by
109 # default to avoid loss of precision. We must pass -ffast-math to test
110 # vectorization of float operations.
111 lappend DEFAULT_VECTCFLAGS "-ffast-math"
112 if [is-effective-target arm_neon_hw] {
113 set dg-do-what-default run
115 set dg-do-what-default compile
125 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
126 lappend O1_VECTCFLAGS
"-O1"
127 lappend O1_VECTCFLAGS
"-fdump-tree-vect-details"
129 lappend DEFAULT_VECTCFLAGS
"-O2"
131 # Tests that should be run without generating dump
info
132 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/nodump
-*.\
[cS\
]]] \
133 "" $DEFAULT_VECTCFLAGS
135 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
137 lappend DEFAULT_VECTCFLAGS
"-fdump-tree-vect-details"
138 lappend VECT_SLP_CFLAGS
"-fdump-tree-slp-details"
141 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/pr
*.\
[cS\
]]] \
142 "" $DEFAULT_VECTCFLAGS
143 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/vect
-*.\
[cS\
]]] \
144 "" $DEFAULT_VECTCFLAGS
145 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/slp
-*.\
[cS\
]]] \
146 "" $DEFAULT_VECTCFLAGS
147 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/bb
-slp
*.\
[cS\
]]] \
151 #### Tests with special options
152 global SAVED_DEFAULT_VECTCFLAGS
153 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
154 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
156 #
--param vect
-max-version
-for-alias
-checks
=0 tests
157 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
158 lappend DEFAULT_VECTCFLAGS
"--param" "vect-max-version-for-alias-checks=0"
159 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-vfa
-*.\
[cS\
]]] \
160 "" $DEFAULT_VECTCFLAGS
163 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
164 lappend DEFAULT_VECTCFLAGS
"-ffast-math"
165 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/fast
-math
-*.\
[cS\
]]] \
166 "" $DEFAULT_VECTCFLAGS
168 #
-fno
-math
-errno tests
169 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
170 lappend DEFAULT_VECTCFLAGS
"-fno-math-errno"
171 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-math
-errno
-*.\
[cS\
]]] \
172 "" $DEFAULT_VECTCFLAGS
175 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
176 lappend DEFAULT_VECTCFLAGS
"-fwrapv"
177 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/wrapv
-*.\
[cS\
]]] \
178 "" $DEFAULT_VECTCFLAGS
181 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
182 lappend DEFAULT_VECTCFLAGS
"-ftrapv"
183 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/trapv
-*.\
[cS\
]]] \
184 "" $DEFAULT_VECTCFLAGS
186 #
-fdump
-tree
-dceloop
-details tests
187 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
188 lappend DEFAULT_VECTCFLAGS
"-fdump-tree-dceloop-details"
189 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/dump
-tree
-dceloop
-*.\
[cS\
]]] \
190 "" $DEFAULT_VECTCFLAGS
192 #
-fno
-tree
-dce tests
193 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
194 lappend DEFAULT_VECTCFLAGS
"-fno-tree-dce"
195 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-tree
-dce
-*.\
[cS\
]]] \
196 "" $DEFAULT_VECTCFLAGS
198 #
-fsection
-anchors tests
199 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
200 lappend DEFAULT_VECTCFLAGS
"-fsection-anchors"
201 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/section
-anchors
-*.\
[cS\
]]] \
202 "" $DEFAULT_VECTCFLAGS
204 # alignment
-sensitive
-fsection
-anchors tests
205 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
206 lappend DEFAULT_VECTCFLAGS
"-fsection-anchors" "-fdump-ipa-increase_alignment"
207 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/aligned
-section
-anchors
-*.\
[cS\
]]] \
208 "" $DEFAULT_VECTCFLAGS
210 #
-fno
-section
-anchors tests
211 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
212 lappend DEFAULT_VECTCFLAGS
"-fno-section-anchors"
213 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-section
-anchors
-*.\
[cS\
]]] \
214 "" $DEFAULT_VECTCFLAGS
216 #
-funswitch
-loops tests
217 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
218 lappend DEFAULT_VECTCFLAGS
"-funswitch-loops"
219 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/unswitch
-loops
-*.\
[cS\
]]] \
220 "" $DEFAULT_VECTCFLAGS
222 #
-fno
-trapping
-math tests
223 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
224 lappend DEFAULT_VECTCFLAGS
"-fno-trapping-math"
225 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-trapping
-math
-*.\
[cS\
]]] \
226 "" $DEFAULT_VECTCFLAGS
228 #
-fno
-tree
-scev
-cprop
229 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
230 lappend DEFAULT_VECTCFLAGS
"-fno-tree-scev-cprop"
231 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-scevccp
-vect
-*.\
[cS\
]]] \
232 "" $DEFAULT_VECTCFLAGS
234 #
-fno
-tree
-scev
-cprop
235 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
236 lappend DEFAULT_VECTCFLAGS
"-fno-tree-scev-cprop"
237 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-scevccp
-outer
-*.\
[cS\
]]] \
238 "" $DEFAULT_VECTCFLAGS
240 #
-fno
-tree
-scev
-cprop
-fno
-tree
-reassoc
241 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
242 lappend DEFAULT_VECTCFLAGS
"-fno-tree-scev-cprop" "-fno-tree-reassoc"
243 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-scevccp
-noreassoc
-*.\
[cS\
]]] \
244 "" $DEFAULT_VECTCFLAGS
246 #
-fno
-tree
-scev
-cprop
247 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
248 lappend DEFAULT_VECTCFLAGS
"-fno-tree-scev-cprop"
249 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-scevccp
-slp
-*.\
[cS\
]]] \
250 "" $DEFAULT_VECTCFLAGS
252 #
-fno
-tree
-dominator
-opts
253 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
254 lappend DEFAULT_VECTCFLAGS
"-fno-tree-dominator-opts"
255 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-tree
-dom
-*.\
[cS\
]]] \
256 "" $DEFAULT_VECTCFLAGS
259 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
260 lappend DEFAULT_VECTCFLAGS
"-fno-tree-pre"
261 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/no
-tree
-pre
-*.\
[cS\
]]] \
262 "" $DEFAULT_VECTCFLAGS
265 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
266 lappend DEFAULT_VECTCFLAGS
"-Os"
267 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/Os
-vect
-*.\
[cS\
]]] \
268 "" $DEFAULT_VECTCFLAGS
270 # With
--param ggc
-min-expand
=0 --param ggc
-min-heapsize
=0
271 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
272 lappend DEFAULT_VECTCFLAGS
"--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
273 dg
-runtest
[lsort
[glob
-nocomplain $srcdir
/$subdir
/ggc
-*.\
[cS\
]]] \
274 "" $DEFAULT_VECTCFLAGS
277 # Don
't allow IPA cloning, because it throws our counts out of whack.
278 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
279 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
280 if [istarget "spu-*-*"] {
281 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
283 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
284 "" $DEFAULT_VECTCFLAGS
287 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
291 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
292 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
293 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
297 set dg-do-what-default ${save-dg-do-what-default}