OSDN Git Service

* gcc.dg/vect/vect.exp: Add new stanza for aligned-section-anchors-*
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect.exp
1 # Copyright (C) 1997, 2004, 2005, 2006, 2007, 2008
2 # Free Software Foundation, Inc.
3
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.
8
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.
13
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/>.
17
18 # GCC testsuite that uses the `dg.exp' driver.
19
20 # Load support procs.
21 load_lib gcc-dg.exp
22
23 # Set up flags used for tests that don't specify options.
24 set DEFAULT_VECTCFLAGS ""
25
26 # These flags are used for all targets.
27 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
28
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
33 # more efficient.
34 global dg-do-what-default
35 set save-dg-do-what-default ${dg-do-what-default}
36
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 
44     } else {
45         set dg-do-what-default compile
46     }
47 } elseif [istarget "powerpc*-*-*"] {
48     # Skip targets not supporting -maltivec.
49     if ![is-effective-target powerpc_altivec_ok] {
50         return
51     }
52
53     lappend DEFAULT_VECTCFLAGS "-maltivec"
54     if [check_vmx_hw_available] {
55         set dg-do-what-default run
56     } else {
57         if [is-effective-target ilp32] {
58             # Specify a cpu that supports VMX for compile-only tests.
59             lappend DEFAULT_VECTCFLAGS "-mcpu=970"
60         }
61         set dg-do-what-default compile
62     }
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
69     } else {
70         set dg-do-what-default compile
71     }
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
81     } else {
82         set dg-do-what-default compile
83     }
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.
89     return
90
91     lappend DEFAULT_VECTCFLAGS "-mmax"
92     if [check_alpha_max_hw_available] {
93         set dg-do-what-default run
94     } else {
95         set dg-do-what-default compile
96     }
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
103     } else {
104       set dg-do-what-default compile
105     }
106 } else {
107     return
108 }
109
110 # Initialize `dg'.
111 dg-init
112
113 global O1_VECTCFLAGS
114 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
115 lappend O1_VECTCFLAGS "-O1"
116 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
117
118 lappend DEFAULT_VECTCFLAGS "-O2"
119
120 # Tests that should be run without generating dump info
121 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
122         "" $DEFAULT_VECTCFLAGS
123
124 set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
125
126 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" 
127 lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
128
129 # Main loop.
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\]]]  \
137         "" $VECT_SLP_CFLAGS
138
139
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
144
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
150
151 # -ffast-math tests
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
156
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
162
163 # -fwrapv tests
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
168
169 # -ftrapv tests
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
174
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
180
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
186
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
192
193 # alignment-sensitive -fsection-anchors tests
194 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
195 lappend DEFAULT_VECTCFLAGS "-fsection-anchors -fdump-ipa-increase_alignment"
196 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]]  \
197         "" $DEFAULT_VECTCFLAGS
198
199 # -fno-section-anchors tests
200 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
201 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
202 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]]  \
203         "" $DEFAULT_VECTCFLAGS
204
205 # -funswitch-loops tests
206 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
207 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
208 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]]  \
209         "" $DEFAULT_VECTCFLAGS
210
211 # -fno-trapping-math tests
212 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
213 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
214 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]]  \
215         "" $DEFAULT_VECTCFLAGS
216
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-vect-*.\[cS\]]]  \
221         "" $DEFAULT_VECTCFLAGS
222
223 # -fno-tree-scev-cprop
224 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
225 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
226 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]]  \
227         "" $DEFAULT_VECTCFLAGS
228
229 # -fno-tree-scev-cprop -fno-tree-reassoc
230 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
231 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
232 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[cS\]]]  \
233         "" $DEFAULT_VECTCFLAGS
234
235 # -fno-tree-scev-cprop
236 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
237 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
238 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-slp-*.\[cS\]]]  \
239         "" $DEFAULT_VECTCFLAGS
240
241 # -fno-tree-dominator-opts
242 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
243 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
244 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]]  \
245         "" $DEFAULT_VECTCFLAGS
246
247 # -fno-tree-pre
248 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
249 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
250 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]]  \
251         "" $DEFAULT_VECTCFLAGS
252
253 # With -Os
254 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
255 lappend DEFAULT_VECTCFLAGS "-Os"
256 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]]  \
257         "" $DEFAULT_VECTCFLAGS
258
259 # With --param ggc-min-expand=0 --param ggc-min-heapsize=0 
260 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
261 lappend DEFAULT_VECTCFLAGS "--param" "ggc-min-expand=0" "--param" "ggc-min-heapsize=0"
262 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/ggc-*.\[cS\]]]  \
263         "" $DEFAULT_VECTCFLAGS
264
265 # With -O3.
266 # Don't allow IPA cloning, because it throws our counts out of whack.
267 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
268 lappend DEFAULT_VECTCFLAGS "-O3" "-fno-ipa-cp-clone"
269 if  [istarget "spu-*-*"] {
270   lappend DEFAULT_VECTCFLAGS "-funroll-loops"
271 }
272 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]]  \
273         "" $DEFAULT_VECTCFLAGS
274
275 # With -O1
276 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]]  \
277         "" $O1_VECTCFLAGS
278
279 # -fno-tree-reassoc
280 set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
281 lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
282 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]]  \
283         "" $VECT_SLP_CFLAGS
284
285 # Clean up.
286 set dg-do-what-default ${save-dg-do-what-default}
287
288 # All done.
289 dg-finish