OSDN Git Service

18877095fa9dfe8436382658810d1188ec786b61
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect.exp
1 # Copyright (C) 1997, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2
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.
7
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.
12
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/>.
16
17 # GCC testsuite that uses the `dg.exp' driver.
18
19 # Load support procs.
20 load_lib gcc-dg.exp
21
22 # Set up flags used for tests that don't specify options.
23 set DEFAULT_VECTCFLAGS ""
24
25 # These flags are used for all targets.
26 lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model"
27
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
32 # more efficient.
33 global dg-do-what-default
34 set save-dg-do-what-default ${dg-do-what-default}
35
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 
43     } else {
44         set dg-do-what-default compile
45     }
46 } elseif [istarget "powerpc*-*-*"] {
47     # Skip targets not supporting -maltivec.
48     if ![is-effective-target powerpc_altivec_ok] {
49         return
50     }
51
52     lappend DEFAULT_VECTCFLAGS "-maltivec"
53     if [check_vmx_hw_available] {
54         set dg-do-what-default run
55     } else {
56         if [is-effective-target ilp32] {
57             # Specify a cpu that supports VMX for compile-only tests.
58             lappend DEFAULT_VECTCFLAGS "-mcpu=970"
59         }
60         set dg-do-what-default compile
61     }
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
68     } else {
69         set dg-do-what-default compile
70     }
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
80     } else {
81         set dg-do-what-default compile
82     }
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.
88     return
89
90     lappend DEFAULT_VECTCFLAGS "-mmax"
91     if [check_alpha_max_hw_available] {
92         set dg-do-what-default run
93     } else {
94         set dg-do-what-default compile
95     }
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
102     } else {
103       set dg-do-what-default compile
104     }
105 } else {
106     return
107 }
108
109 # Initialize `dg'.
110 dg-init
111
112 global O1_VECTCFLAGS
113 set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
114 lappend O1_VECTCFLAGS "-O1"
115 lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
116
117 lappend DEFAULT_VECTCFLAGS "-O2"
118
119 # Tests that should be run without generating dump info
120 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
121         "" $DEFAULT_VECTCFLAGS
122
123 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" 
124
125 # Main loop.
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
132
133 #### Tests with special options
134 global SAVED_DEFAULT_VECTCFLAGS
135 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
136
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
142
143 # -ffast-math tests
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
148
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
154
155 # -fwrapv tests
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
160
161 # -ftrapv tests
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
166
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
172
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
178
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
184
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
190
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
196
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
202
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
208
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
214
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
220
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
226
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
232
233 # -fno-tree-pre
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
238
239 # With -Os
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
244
245 # With -O3
246 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
247 lappend DEFAULT_VECTCFLAGS "-O3"
248 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-vect-*.\[cS\]]]  \
249         "" $DEFAULT_VECTCFLAGS
250
251 # With -O1
252 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]]  \
253         "" $O1_VECTCFLAGS
254
255
256 # Clean up.
257 set dg-do-what-default ${save-dg-do-what-default}
258
259 # All done.
260 dg-finish