1 # Copyright (C) 1997, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # GCC testsuite that uses the `dg.exp' driver.
22 # Set up flags used for tests that don't specify options.
23 set DEFAULT_VECTCFLAGS ""
25 # These flags are used for all targets.
26 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
28 # If the target system supports vector instructions, the default action
29 # for a test is 'run', otherwise it's 'compile'. Save current default.
30 # Executing vector instructions on a system without hardware vector support
31 # is also disabled by a call to check_vect, but disabling execution here is
33 global dg-do-what-default
34 set save-dg-do-what-default ${dg-do-what-default}
36 # Skip these tests for targets that do not support generating vector
37 # code. Set additional target-dependent vector flags, which can be
38 # overridden by using dg-options in individual tests.
39 if [istarget "powerpc-*paired*"] {
40 lappend DEFAULT_VECTCFLAGS "-mpaired"
41 if [check_750cl_hw_available] {
42 set dg-do-what-default run
44 set dg-do-what-default compile
46 } elseif [istarget "powerpc*-*-*"] {
47 # Skip targets not supporting -maltivec.
48 if ![is-effective-target powerpc_altivec_ok] {
52 lappend DEFAULT_VECTCFLAGS "-maltivec"
53 if [check_vmx_hw_available] {
54 set dg-do-what-default run
56 if [is-effective-target ilp32] {
57 # Specify a cpu that supports VMX for compile-only tests.
58 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
60 set dg-do-what-default compile
62 } elseif { [istarget "spu-*-*"] } {
63 set dg-do-what-default run
64 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
65 lappend DEFAULT_VECTCFLAGS "-msse2"
66 if [check_sse2_hw_available] {
67 set dg-do-what-default run
69 set dg-do-what-default compile
71 } elseif { [istarget "mips*-*-*"]
72 && [check_effective_target_mpaired_single]
73 && [check_effective_target_nomips16] } {
74 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
75 set dg-do-what-default run
76 } elseif [istarget "sparc*-*-*"] {
77 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
78 if [check_effective_target_ultrasparc_hw] {
79 set dg-do-what-default run
81 set dg-do-what-default compile
83 } elseif [istarget "alpha*-*-*"] {
84 # Alpha's vectorization capabilities are extremely limited.
85 # It's more effort than its worth disabling all of the tests
86 # that it cannot pass. But if you actually want to see what
87 # does work, command out the return.
90 lappend DEFAULT_VECTCFLAGS "-mmax"
91 if [check_alpha_max_hw_available] {
92 set dg-do-what-default run
94 set dg-do-what-default compile
96 } elseif [istarget "ia64-*-*"] {
97 set dg-do-what-default run
98 } elseif [is-effective-target arm_neon_ok] {
99 lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
100 if [is-effective-target arm_neon_hw] {
101 set dg-do-what-default run
103 set dg-do-what-default compile
113 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
114 lappend O1_VECTCFLAGS "-O1"
115 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
117 lappend DEFAULT_VECTCFLAGS "-O2"
119 # Tests that should be run without generating dump info
120 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
121 "" $DEFAULT_VECTCFLAGS
123 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
126 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
127 "" $DEFAULT_VECTCFLAGS
128 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
129 "" $DEFAULT_VECTCFLAGS
130 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
131 "" $DEFAULT_VECTCFLAGS
133 #### Tests with special options
134 global SAVED_DEFAULT_VECTCFLAGS
135 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
137 # --param vect-max-version-for-alias-checks=0 tests
138 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
139 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
140 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
141 "" $DEFAULT_VECTCFLAGS
144 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
145 lappend DEFAULT_VECTCFLAGS "-ffast-math"
146 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]] \
147 "" $DEFAULT_VECTCFLAGS
149 # -fno-math-errno tests
150 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
151 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
152 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
153 "" $DEFAULT_VECTCFLAGS
156 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
157 lappend DEFAULT_VECTCFLAGS "-fwrapv"
158 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
159 "" $DEFAULT_VECTCFLAGS
162 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
163 lappend DEFAULT_VECTCFLAGS "-ftrapv"
164 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
165 "" $DEFAULT_VECTCFLAGS
167 # -fdump-tree-dceloop-details tests
168 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
169 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
170 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
171 "" $DEFAULT_VECTCFLAGS
173 # -fno-tree-dce tests
174 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
175 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
176 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
177 "" $DEFAULT_VECTCFLAGS
179 # -fsection-anchors tests
180 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
181 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
182 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
183 "" $DEFAULT_VECTCFLAGS
185 # -fno-section-anchors tests
186 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
187 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
188 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
189 "" $DEFAULT_VECTCFLAGS
191 # -funswitch-loops tests
192 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
193 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
194 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
195 "" $DEFAULT_VECTCFLAGS
197 # -fno-trapping-math tests
198 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
199 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
200 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
201 "" $DEFAULT_VECTCFLAGS
203 # -fno-tree-scev-cprop
204 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
205 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
206 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
207 "" $DEFAULT_VECTCFLAGS
209 # -fno-tree-scev-cprop
210 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
211 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
212 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
213 "" $DEFAULT_VECTCFLAGS
215 # -fno-tree-scev-cprop -fno-tree-reassoc
216 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
217 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
218 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[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-slp-*.\[cS\]]] \
225 "" $DEFAULT_VECTCFLAGS
227 # -fno-tree-dominator-opts
228 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
229 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
230 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
231 "" $DEFAULT_VECTCFLAGS
234 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
235 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
236 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
237 "" $DEFAULT_VECTCFLAGS
240 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
241 lappend DEFAULT_VECTCFLAGS "-Os"
242 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
243 "" $DEFAULT_VECTCFLAGS
246 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
247 lappend DEFAULT_VECTCFLAGS "-O3"
248 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \
249 "" $DEFAULT_VECTCFLAGS
252 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \
257 set dg-do-what-default ${save-dg-do-what-default}