OSDN Git Service

* gcc.dg/vect/vect-116.c: Add vect_int target requirement.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect.exp
1 # Copyright (C) 1997, 2004, 2005, 2006 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 2 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 this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  
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 "-O2" "-ftree-vectorize"
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*-*-*"] {
40     # Skip targets not supporting -maltivec.
41     if ![is-effective-target powerpc_altivec_ok] {
42         return
43     }
44
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"
52         }
53         set dg-do-what-default compile
54     }
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     lappend DEFAULT_VECTCFLAGS "-mpaired-single"
63     set dg-do-what-default run
64 } elseif [istarget "sparc*-*-*"] {
65     lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
66     set dg-do-what-default run
67 } elseif [istarget "alpha*-*-*"] {
68     # Alpha's vectorization capabilities are extremely limited.
69     # It's more effort than its worth disabling all of the tests
70     # that it cannot pass.  But if you actually want to see what
71     # does work, command out the return.
72     return
73
74     lappend DEFAULT_VECTCFLAGS "-mmax"
75     if [check_alpha_max_hw_available] {
76         set dg-do-what-default run
77     } else {
78         set dg-do-what-default compile
79     }
80 } elseif [istarget "ia64-*-*"] {
81     set dg-do-what-default run
82 } else {
83     return
84 }
85
86 # Initialize `dg'.
87 dg-init
88
89 # Tests that should be run without generating dump info
90 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
91         "" $DEFAULT_VECTCFLAGS
92
93 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
94
95 # Main loop.
96 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]]  \
97         "" $DEFAULT_VECTCFLAGS
98 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]]  \
99         "" $DEFAULT_VECTCFLAGS
100
101 #### Tests with special options
102 global SAVED_DEFAULT_VECTCFLAGS
103 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
104
105 # -ffast-math tests
106 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
107 lappend DEFAULT_VECTCFLAGS "-ffast-math"
108 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-vect*.\[cS\]]]  \
109         "" $DEFAULT_VECTCFLAGS
110
111 # -fno-math-errno tests
112 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
113 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
114 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-vect*.\[cS\]]]  \
115         "" $DEFAULT_VECTCFLAGS
116
117 # -fwrapv tests
118 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
119 lappend DEFAULT_VECTCFLAGS "-fwrapv"
120 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-vect*.\[cS\]]]  \
121         "" $DEFAULT_VECTCFLAGS
122
123 # -ftrapv tests
124 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
125 lappend DEFAULT_VECTCFLAGS "-ftrapv"
126 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-vect*.\[cS\]]]  \
127         "" $DEFAULT_VECTCFLAGS
128
129 # -fdump-tree-dceloop-details tests
130 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
131 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
132 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]]  \
133         "" $DEFAULT_VECTCFLAGS
134
135 # -fno-tree-dce tests
136 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
137 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
138 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]]  \
139         "" $DEFAULT_VECTCFLAGS
140
141 # -fsection-anchors tests
142 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
143 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
144 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]]  \
145         "" $DEFAULT_VECTCFLAGS
146
147 # -fno-section-anchors tests
148 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
149 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
150 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]]  \
151         "" $DEFAULT_VECTCFLAGS
152
153 # -funswitch-loops tests
154 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
155 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
156 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]]  \
157         "" $DEFAULT_VECTCFLAGS
158
159 # -fno-trapping-math tests
160 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
161 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
162 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]]  \
163         "" $DEFAULT_VECTCFLAGS
164
165 # -fno-tree-scev-cprop
166 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
167 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
168 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-scev-cprop-*.\[cS\]]]  \
169         "" $DEFAULT_VECTCFLAGS
170
171 # -fno-tree-dominator-opts
172 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
173 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
174 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]]  \
175         "" $DEFAULT_VECTCFLAGS
176
177 # With -Os
178 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
179 lappend DEFAULT_VECTCFLAGS "-Os"
180 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]]  \
181         "" $DEFAULT_VECTCFLAGS
182
183 # With -O3
184 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
185 lappend DEFAULT_VECTCFLAGS "-O3"
186 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-vect-*.\[cS\]]]  \
187         "" $DEFAULT_VECTCFLAGS
188
189 # Clean up.
190 set dg-do-what-default ${save-dg-do-what-default}
191
192 # All done.
193 dg-finish