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 if { ![check_effective_target_sse2] } then {
73 lappend DEFAULT_VECTCFLAGS "-msse2"
74 if [check_sse2_hw_available] {
75 set dg-do-what-default run
77 set dg-do-what-default compile
79 } elseif { [istarget "mips*-*-*"]
80 && [check_effective_target_mpaired_single]
81 && [check_effective_target_nomips16] } {
82 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 if [is-effective-target arm_neon_hw] {
109 set dg-do-what-default run
111 set dg-do-what-default compile
121 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
122 lappend O1_VECTCFLAGS "-O1"
123 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
125 lappend DEFAULT_VECTCFLAGS "-O2"
127 # Tests that should be run without generating dump info
128 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
129 "" $DEFAULT_VECTCFLAGS
131 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
133 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
134 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
137 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
138 "" $DEFAULT_VECTCFLAGS
139 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
140 "" $DEFAULT_VECTCFLAGS
141 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
142 "" $DEFAULT_VECTCFLAGS
143 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
147 #### Tests with special options
148 global SAVED_DEFAULT_VECTCFLAGS
149 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
150 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
152 # --param vect-max-version-for-alias-checks=0 tests
153 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
154 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
155 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
156 "" $DEFAULT_VECTCFLAGS
159 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
160 lappend DEFAULT_VECTCFLAGS "-ffast-math"
161 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]] \
162 "" $DEFAULT_VECTCFLAGS
164 # -fno-math-errno tests
165 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
166 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
167 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
168 "" $DEFAULT_VECTCFLAGS
171 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
172 lappend DEFAULT_VECTCFLAGS "-fwrapv"
173 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
174 "" $DEFAULT_VECTCFLAGS
177 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
178 lappend DEFAULT_VECTCFLAGS "-ftrapv"
179 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
180 "" $DEFAULT_VECTCFLAGS
182 # -fdump-tree-dceloop-details tests
183 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
184 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
185 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
186 "" $DEFAULT_VECTCFLAGS
188 # -fno-tree-dce tests
189 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
190 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
191 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
192 "" $DEFAULT_VECTCFLAGS
194 # -fsection-anchors tests
195 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
196 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
197 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
198 "" $DEFAULT_VECTCFLAGS
200 # alignment-sensitive -fsection-anchors tests
201 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
202 lappend DEFAULT_VECTCFLAGS "-fsection-anchors" "-fdump-ipa-increase_alignment"
203 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
204 "" $DEFAULT_VECTCFLAGS
206 # -fno-section-anchors tests
207 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
208 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
209 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
210 "" $DEFAULT_VECTCFLAGS
212 # -funswitch-loops tests
213 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
214 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
215 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
216 "" $DEFAULT_VECTCFLAGS
218 # -fno-trapping-math tests
219 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
220 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
221 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
222 "" $DEFAULT_VECTCFLAGS
224 # -fno-tree-scev-cprop
225 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
226 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
227 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
228 "" $DEFAULT_VECTCFLAGS
230 # -fno-tree-scev-cprop
231 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
232 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
233 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
234 "" $DEFAULT_VECTCFLAGS
236 # -fno-tree-scev-cprop -fno-tree-reassoc
237 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
238 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
239 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
240 "" $DEFAULT_VECTCFLAGS
242 # -fno-tree-scev-cprop
243 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
244 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
245 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
246 "" $DEFAULT_VECTCFLAGS
248 # -fno-tree-dominator-opts
249 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
250 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
251 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
252 "" $DEFAULT_VECTCFLAGS
255 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
256 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
257 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
258 "" $DEFAULT_VECTCFLAGS
261 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
262 lappend DEFAULT_VECTCFLAGS "-Os"
263 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
264 "" $DEFAULT_VECTCFLAGS
266 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
267 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
268 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
269 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
270 "" $DEFAULT_VECTCFLAGS
273 # Don't allow IPA cloning, because it throws our counts out of whack.
274 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
275 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
276 if [istarget "spu-*-*"] {
277 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
279 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
280 "" $DEFAULT_VECTCFLAGS
283 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
287 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
288 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
289 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
293 set dg-do-what-default ${save-dg-do-what-default}