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 "-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
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] {
45 lappend DEFAULT_VECTCFLAGS "-maltivec"
46 if [check_vmx_hw_available] {
47 set dg-do-what-default run
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 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
63 set dg-do-what-default run
64 } elseif [istarget "sparc*-*-*"] {
65 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
66 if [check_effective_target_ultrasparc_hw] {
67 set dg-do-what-default run
69 set dg-do-what-default compile
71 } elseif [istarget "alpha*-*-*"] {
72 # Alpha's vectorization capabilities are extremely limited.
73 # It's more effort than its worth disabling all of the tests
74 # that it cannot pass. But if you actually want to see what
75 # does work, command out the return.
78 lappend DEFAULT_VECTCFLAGS "-mmax"
79 if [check_alpha_max_hw_available] {
80 set dg-do-what-default run
82 set dg-do-what-default compile
84 } elseif [istarget "ia64-*-*"] {
85 set dg-do-what-default run
86 } elseif [is-effective-target arm_neon_ok] {
87 lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
88 if [is-effective-target arm_neon_hw] {
89 set dg-do-what-default run
91 set dg-do-what-default compile
100 # Tests that should be run without generating dump info
101 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]] \
102 "" $DEFAULT_VECTCFLAGS
104 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
107 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
108 "" $DEFAULT_VECTCFLAGS
109 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]] \
110 "" $DEFAULT_VECTCFLAGS
112 #### Tests with special options
113 global SAVED_DEFAULT_VECTCFLAGS
114 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
117 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
118 lappend DEFAULT_VECTCFLAGS "-ffast-math"
119 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-vect*.\[cS\]]] \
120 "" $DEFAULT_VECTCFLAGS
122 # -fno-math-errno tests
123 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
124 lappend DEFAULT_VECTCFLAGS "-fno-math-errno"
125 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-math-errno-vect*.\[cS\]]] \
126 "" $DEFAULT_VECTCFLAGS
129 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
130 lappend DEFAULT_VECTCFLAGS "-fwrapv"
131 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-vect*.\[cS\]]] \
132 "" $DEFAULT_VECTCFLAGS
135 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
136 lappend DEFAULT_VECTCFLAGS "-ftrapv"
137 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-vect*.\[cS\]]] \
138 "" $DEFAULT_VECTCFLAGS
140 # -fdump-tree-dceloop-details tests
141 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
142 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
143 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]] \
144 "" $DEFAULT_VECTCFLAGS
146 # -fno-tree-dce tests
147 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
148 lappend DEFAULT_VECTCFLAGS "-fno-tree-dce"
149 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dce-*.\[cS\]]] \
150 "" $DEFAULT_VECTCFLAGS
152 # -fsection-anchors tests
153 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
154 lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
155 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
156 "" $DEFAULT_VECTCFLAGS
158 # -fno-section-anchors tests
159 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
160 lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
161 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-section-anchors-*.\[cS\]]] \
162 "" $DEFAULT_VECTCFLAGS
164 # -funswitch-loops tests
165 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
166 lappend DEFAULT_VECTCFLAGS "-funswitch-loops"
167 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \
168 "" $DEFAULT_VECTCFLAGS
170 # -fno-trapping-math tests
171 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
172 lappend DEFAULT_VECTCFLAGS "-fno-trapping-math"
173 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \
174 "" $DEFAULT_VECTCFLAGS
176 # -fno-tree-scev-cprop
177 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
178 lappend DEFAULT_VECTCFLAGS "-fno-tree-scev-cprop"
179 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-scev-cprop-*.\[cS\]]] \
180 "" $DEFAULT_VECTCFLAGS
182 # -fno-tree-dominator-opts
183 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
184 lappend DEFAULT_VECTCFLAGS "-fno-tree-dominator-opts"
185 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-dom-*.\[cS\]]] \
186 "" $DEFAULT_VECTCFLAGS
189 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
190 lappend DEFAULT_VECTCFLAGS "-Os"
191 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \
192 "" $DEFAULT_VECTCFLAGS
195 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
196 lappend DEFAULT_VECTCFLAGS "-O3"
197 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-vect-*.\[cS\]]] \
198 "" $DEFAULT_VECTCFLAGS
201 set dg-do-what-default ${save-dg-do-what-default}