Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect.exp
blobe9103328a188ffe1b5099c8182189a0cd99955ae
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.
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.
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.
19 # Load support procs.
20 load_lib gcc-dg.exp
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 "-O2" "-ftree-vectorize"
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}
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*-*-*"] {
40 # Skip targets not supporting -maltivec.
41 if ![is-effective-target powerpc_altivec_ok] {
42 return
45 lappend DEFAULT_VECTCFLAGS "-maltivec"
46 if [check_vmx_hw_available] {
47 set dg-do-what-default run
48 } else {
49 if [is-effective-target ilp32] {
50 # Specify a cpu that supports VMX for compile-only tests.
51 lappend DEFAULT_VECTCFLAGS "-mcpu=7400"
53 set dg-do-what-default compile
55 } elseif { [istarget "spu-*-*"] } {
56 set dg-do-what-default run
57 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
58 lappend DEFAULT_VECTCFLAGS "-msse2"
59 set dg-do-what-default run
60 } elseif { [istarget "mipsisa64*-*-*"]
61 && [check_effective_target_mpaired_single]
62 && [check_effective_target_nomips16] } {
63 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
64 set dg-do-what-default run
65 } elseif [istarget "sparc*-*-*"] {
66 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
67 if [check_effective_target_ultrasparc_hw] {
68 set dg-do-what-default run
69 } else {
70 set dg-do-what-default compile
72 } elseif [istarget "alpha*-*-*"] {
73 # Alpha's vectorization capabilities are extremely limited.
74 # It's more effort than its worth disabling all of the tests
75 # that it cannot pass. But if you actually want to see what
76 # does work, command out the return.
77 return
79 lappend DEFAULT_VECTCFLAGS "-mmax"
80 if [check_alpha_max_hw_available] {
81 set dg-do-what-default run
82 } else {
83 set dg-do-what-default compile
85 } elseif [istarget "ia64-*-*"] {
86 set dg-do-what-default run
87 } elseif [is-effective-target arm_neon_ok] {
88 lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
89 if [is-effective-target arm_neon_hw] {
90 set dg-do-what-default run
91 } else {
92 set dg-do-what-default compile
94 } else {
95 return
98 # Initialize `dg'.
99 dg-init
101 # Tests that should be run without generating dump info
102 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
103 "" $DEFAULT_VECTCFLAGS
105 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
107 # Main loop.
108 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
109 "" $DEFAULT_VECTCFLAGS
110 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
111 "" $DEFAULT_VECTCFLAGS
112 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-*.\[cS\]]] \
113 "" $DEFAULT_VECTCFLAGS
115 #### Tests with special options
116 global SAVED_DEFAULT_VECTCFLAGS
117 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
119 # --param vect-max-version-for-alias-checks=0 tests
120 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
121 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
122 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[cS\]]] \
123 "" $DEFAULT_VECTCFLAGS
125 # -ffast-math tests
126 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
127 lappend DEFAULT_VECTCFLAGS "-ffast-math"
128 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[cS\]]] \
129 "" $DEFAULT_VECTCFLAGS
131 # -fno-math-errno tests
132 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
133 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
134 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-*.\[cS\]]] \
135 "" $DEFAULT_VECTCFLAGS
137 # -fwrapv tests
138 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
139 lappend DEFAULT_VECTCFLAGS "-fwrapv"
140 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-*.\[cS\]]] \
141 "" $DEFAULT_VECTCFLAGS
143 # -ftrapv tests
144 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
145 lappend DEFAULT_VECTCFLAGS "-ftrapv"
146 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-*.\[cS\]]] \
147 "" $DEFAULT_VECTCFLAGS
149 # -fdump-tree-dceloop-details tests
150 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
151 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
152 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
153 "" $DEFAULT_VECTCFLAGS
155 # -fno-tree-dce tests
156 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
157 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
158 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
159 "" $DEFAULT_VECTCFLAGS
161 # -fsection-anchors tests
162 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
163 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
164 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
165 "" $DEFAULT_VECTCFLAGS
167 # -fno-section-anchors tests
168 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
169 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
170 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
171 "" $DEFAULT_VECTCFLAGS
173 # -funswitch-loops tests
174 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
175 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
176 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
177 "" $DEFAULT_VECTCFLAGS
179 # -fno-trapping-math tests
180 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
181 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
182 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
183 "" $DEFAULT_VECTCFLAGS
185 # -fno-tree-scev-cprop
186 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
187 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
188 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-vect-*.\[cS\]]] \
189 "" $DEFAULT_VECTCFLAGS
191 # -fno-tree-scev-cprop
192 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
193 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
194 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-outer-*.\[cS\]]] \
195 "" $DEFAULT_VECTCFLAGS
197 # -fno-tree-scev-cprop -fno-tree-reassoc
198 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
199 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop" "-fno-tree-reassoc"
200 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-scevccp-noreassoc-*.\[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-slp-*.\[cS\]]] \
207 "" $DEFAULT_VECTCFLAGS
209 # -fno-tree-dominator-opts
210 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
211 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
212 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
213 "" $DEFAULT_VECTCFLAGS
215 # -fno-tree-pre
216 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
217 lappend DEFAULT_VECTCFLAGS "-fno-tree-pre"
218 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-pre-*.\[cS\]]] \
219 "" $DEFAULT_VECTCFLAGS
221 # With -Os
222 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
223 lappend DEFAULT_VECTCFLAGS "-Os"
224 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
225 "" $DEFAULT_VECTCFLAGS
227 # With -O3
228 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
229 lappend DEFAULT_VECTCFLAGS "-O3"
230 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-vect-*.\[cS\]]] \
231 "" $DEFAULT_VECTCFLAGS
233 # Clean up.
234 set dg-do-what-default ${save-dg-do-what-default}
236 # All done.
237 dg-finish