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_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_sse2_hw_available] {
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_nomips16] } {
79 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
80 set dg-do-what-default run
81 } elseif [istarget "sparc*-*-*"] {
82 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
83 if [check_effective_target_ultrasparc_hw] {
84 set dg-do-what-default run
86 set dg-do-what-default compile
88 } elseif [istarget "alpha*-*-*"] {
89 # Alpha's vectorization capabilities are extremely limited.
90 # It's more effort than its worth disabling all of the tests
91 # that it cannot pass. But if you actually want to see what
92 # does work, command out the return.
95 lappend DEFAULT_VECTCFLAGS "-mmax"
96 if [check_alpha_max_hw_available] {
97 set dg-do-what-default run
99 set dg-do-what-default compile
101 } elseif [istarget "ia64-*-*"] {
102 set dg-do-what-default run
103 } elseif [is-effective-target arm_neon_ok] {
104 lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
105 if [is-effective-target arm_neon_hw] {
106 set dg-do-what-default run
108 set dg-do-what-default compile
118 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
119 lappend O1_VECTCFLAGS "-O1"
120 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
122 lappend DEFAULT_VECTCFLAGS "-O2"
124 # Tests that should be run without generating dump info
125 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
126 "" $DEFAULT_VECTCFLAGS
128 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
130 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
131 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
134 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
135 "" $DEFAULT_VECTCFLAGS
136 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
137 "" $DEFAULT_VECTCFLAGS
138 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
139 "" $DEFAULT_VECTCFLAGS
140 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/bb-slp*.\[cS\]]] \
144 #### Tests with special options
145 global SAVED_DEFAULT_VECTCFLAGS
146 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
147 set SAVED_VECT_SLP_CFLAGS $VECT_SLP_CFLAGS
149 # --param vect-max-version-for-alias-checks=0 tests
150 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
151 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
152 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
153 "" $DEFAULT_VECTCFLAGS
156 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
157 lappend DEFAULT_VECTCFLAGS "-ffast-math"
158 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]] \
159 "" $DEFAULT_VECTCFLAGS
161 # -fno-math-errno tests
162 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
163 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
164 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
165 "" $DEFAULT_VECTCFLAGS
168 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
169 lappend DEFAULT_VECTCFLAGS "-fwrapv"
170 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
171 "" $DEFAULT_VECTCFLAGS
174 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
175 lappend DEFAULT_VECTCFLAGS "-ftrapv"
176 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
177 "" $DEFAULT_VECTCFLAGS
179 # -fdump-tree-dceloop-details tests
180 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
181 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
182 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
183 "" $DEFAULT_VECTCFLAGS
185 # -fno-tree-dce tests
186 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
187 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
188 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
189 "" $DEFAULT_VECTCFLAGS
191 # -fsection-anchors tests
192 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
193 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
194 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
195 "" $DEFAULT_VECTCFLAGS
197 # alignment-sensitive -fsection-anchors tests
198 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
199 lappend DEFAULT_VECTCFLAGS "-fsection-anchors -fdump-ipa-increase_alignment"
200 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
201 "" $DEFAULT_VECTCFLAGS
203 # -fno-section-anchors tests
204 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
205 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
206 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
207 "" $DEFAULT_VECTCFLAGS
209 # -funswitch-loops tests
210 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
211 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
212 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
213 "" $DEFAULT_VECTCFLAGS
215 # -fno-trapping-math tests
216 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
217 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
218 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
219 "" $DEFAULT_VECTCFLAGS
221 # -fno-tree-scev-cprop
222 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
223 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
224 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
225 "" $DEFAULT_VECTCFLAGS
227 # -fno-tree-scev-cprop
228 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
229 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
230 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
231 "" $DEFAULT_VECTCFLAGS
233 # -fno-tree-scev-cprop -fno-tree-reassoc
234 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
235 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
236 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]] \
237 "" $DEFAULT_VECTCFLAGS
239 # -fno-tree-scev-cprop
240 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
241 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
242 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]] \
243 "" $DEFAULT_VECTCFLAGS
245 # -fno-tree-dominator-opts
246 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
247 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
248 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
249 "" $DEFAULT_VECTCFLAGS
252 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
253 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
254 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
255 "" $DEFAULT_VECTCFLAGS
258 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
259 lappend DEFAULT_VECTCFLAGS "-Os"
260 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
261 "" $DEFAULT_VECTCFLAGS
263 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0
264 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
265 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
266 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]] \
267 "" $DEFAULT_VECTCFLAGS
270 # Don't allow IPA cloning, because it throws our counts out of whack.
271 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
272 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
273 if [istarget "spu-*-*"] {
274 lappend DEFAULT_VECTCFLAGS "-funroll-loops"
276 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
277 "" $DEFAULT_VECTCFLAGS
280 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
284 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
285 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
286 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]] \
290 set dg-do-what-default ${save-dg-do-what-default}