1 # Copyright (C) 1997, 2004, 2005, 2006, 2007, 2008
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_vmx_hw_available] {
55 set dg-do-what-default run
57 if [is-effective-target ilp32] {
58 # Specify a cpu that supports VMX for compile-only tests.
59 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
61 set dg-do-what-default compile
63 } elseif { [istarget "spu-*-*"] } {
64 set dg-do-what-default run
65 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
66 lappend DEFAULT_VECTCFLAGS "-msse2"
67 if [check_sse2_hw_available] {
68 set dg-do-what-default run
70 set dg-do-what-default compile
72 } elseif { [istarget "mips*-*-*"]
73 && [check_effective_target_mpaired_single]
74 && [check_effective_target_nomips16] } {
75 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
76 set dg-do-what-default run
77 } elseif [istarget "sparc*-*-*"] {
78 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
79 if [check_effective_target_ultrasparc_hw] {
80 set dg-do-what-default run
82 set dg-do-what-default compile
84 } elseif [istarget "alpha*-*-*"] {
85 # Alpha's vectorization capabilities are extremely limited.
86 # It's more effort than its worth disabling all of the tests
87 # that it cannot pass. But if you actually want to see what
88 # does work, command out the return.
91 lappend DEFAULT_VECTCFLAGS "-mmax"
92 if [check_alpha_max_hw_available] {
93 set dg-do-what-default run
95 set dg-do-what-default compile
97 } elseif [istarget "ia64-*-*"] {
98 set dg-do-what-default run
99 } elseif [is-effective-target arm_neon_ok] {
100 lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
101 if [is-effective-target arm_neon_hw] {
102 set dg-do-what-default run
104 set dg-do-what-default compile
114 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
115 lappend O1_VECTCFLAGS "-O1"
116 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
118 lappend DEFAULT_VECTCFLAGS "-O2"
120 # Tests that should be run without generating dump info
121 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
122 "" $DEFAULT_VECTCFLAGS
124 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
126 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
127 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
130 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
131 "" $DEFAULT_VECTCFLAGS
132 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
133 "" $DEFAULT_VECTCFLAGS
134 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
135 "" $DEFAULT_VECTCFLAGS
136 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
140 #### Tests with special options
141 global SAVED_DEFAULT_VECTCFLAGS
142 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
143 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
145 # --param vect-max-version-for-alias-checks=0 tests
146 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
147 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
148 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
149 "" $DEFAULT_VECTCFLAGS
152 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
153 lappend DEFAULT_VECTCFLAGS "-ffast-math"
154 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]] \
155 "" $DEFAULT_VECTCFLAGS
157 # -fno-math-errno tests
158 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
159 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
160 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
161 "" $DEFAULT_VECTCFLAGS
164 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
165 lappend DEFAULT_VECTCFLAGS "-fwrapv"
166 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
167 "" $DEFAULT_VECTCFLAGS
170 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
171 lappend DEFAULT_VECTCFLAGS "-ftrapv"
172 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
173 "" $DEFAULT_VECTCFLAGS
175 # -fdump-tree-dceloop-details tests
176 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
177 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
178 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
179 "" $DEFAULT_VECTCFLAGS
181 # -fno-tree-dce tests
182 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
183 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
184 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
185 "" $DEFAULT_VECTCFLAGS
187 # -fsection-anchors tests
188 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
189 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
190 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
191 "" $DEFAULT_VECTCFLAGS
193 # -fno-section-anchors tests
194 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
195 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
196 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
197 "" $DEFAULT_VECTCFLAGS
199 # -funswitch-loops tests
200 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
201 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
202 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
203 "" $DEFAULT_VECTCFLAGS
205 # -fno-trapping-math tests
206 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
207 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
208 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
209 "" $DEFAULT_VECTCFLAGS
211 # -fno-tree-scev-cprop
212 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
213 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
214 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
215 "" $DEFAULT_VECTCFLAGS
217 # -fno-tree-scev-cprop
218 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
219 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
220 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
221 "" $DEFAULT_VECTCFLAGS
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 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
227 "" $DEFAULT_VECTCFLAGS
229 # -fno-tree-scev-cprop
230 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
231 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
232 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
233 "" $DEFAULT_VECTCFLAGS
235 # -fno-tree-dominator-opts
236 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
237 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
238 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
239 "" $DEFAULT_VECTCFLAGS
242 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
243 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
244 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
245 "" $DEFAULT_VECTCFLAGS
248 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
249 lappend DEFAULT_VECTCFLAGS "-Os"
250 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
251 "" $DEFAULT_VECTCFLAGS
253 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
254 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
255 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
256 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
257 "" $DEFAULT_VECTCFLAGS
260 # Don't allow IPA cloning, because it throws our counts out of whack.
261 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
262 lappend DEFAULT_VECTCFLAGS "-O3 -fno-ipa-cp-clone"
263 if [istarget "spu-*-*"] {
264 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
266 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
267 "" $DEFAULT_VECTCFLAGS
270 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
274 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
275 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
276 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
280 set dg-do-what-default ${save-dg-do-what-default}