OSDN Git Service

499ef00da58992b1c0b0c05273d72bd256a35d2f
[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     # If there are powerpc targets to skip, do it here.
41
42     lappend DEFAULT_VECTCFLAGS "-maltivec"
43     if [check_vmx_hw_available] {
44         set dg-do-what-default run
45     } else {
46         if [is-effective-target ilp32] {
47             # Specify a cpu that supports VMX for compile-only tests.
48             lappend DEFAULT_VECTCFLAGS "-mcpu=7400"
49         }
50         set dg-do-what-default compile
51     }
52 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
53     lappend DEFAULT_VECTCFLAGS "-msse2"
54     set dg-do-what-default run
55 } elseif { [istarget "mipsisa64*-*-*"]
56            && [check_effective_target_mpaired_single] } {
57     lappend DEFAULT_VECTCFLAGS "-mpaired-single"
58     set dg-do-what-default run
59 } elseif [istarget "sparc*-*-*"] {
60     lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
61     set dg-do-what-default run
62 } elseif [istarget "alpha*-*-*"] {
63     lappend DEFAULT_VECTCFLAGS "-mmax"
64     if [check_alpha_max_hw_available] {
65         set dg-do-what-default run
66     } else {
67         set dg-do-what-default compile
68     }
69 } elseif [istarget "ia64-*-*"] {
70     set dg-do-what-default run
71 } else {
72     return
73 }
74
75 # Initialize `dg'.
76 dg-init
77
78 # Tests that should be run without generating dump info
79 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/nodump-*.\[cS\]]]  \
80         "" $DEFAULT_VECTCFLAGS
81
82 lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
83
84 # Main loop.
85 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]]  \
86         "" $DEFAULT_VECTCFLAGS
87 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[cS\]]]  \
88         "" $DEFAULT_VECTCFLAGS
89
90 #### Tests with special options
91 global SAVED_DEFAULT_VECTCFLAGS
92 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
93
94 # -ffast-math tests
95 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
96 lappend DEFAULT_VECTCFLAGS "-ffast-math"
97 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-vect*.\[cS\]]]  \
98         "" $DEFAULT_VECTCFLAGS
99
100 # -fwrapv tests
101 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
102 lappend DEFAULT_VECTCFLAGS "-fwrapv"
103 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/wrapv-vect*.\[cS\]]]  \
104         "" $DEFAULT_VECTCFLAGS
105
106 # -ftrapv tests
107 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
108 lappend DEFAULT_VECTCFLAGS "-ftrapv"
109 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/trapv-vect*.\[cS\]]]  \
110         "" $DEFAULT_VECTCFLAGS
111
112 # -fdump-tree-dceloop-details tests
113 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
114 lappend DEFAULT_VECTCFLAGS "-fdump-tree-dceloop-details"
115 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/dump-tree-dceloop-*.\[cS\]]]  \
116         "" $DEFAULT_VECTCFLAGS
117
118 # With -Os
119 lappend DEFAULT_VECTCFLAGS "-Os"
120 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]]  \
121         "" $DEFAULT_VECTCFLAGS
122
123 # Clean up.
124 set dg-do-what-default ${save-dg-do-what-default}
125
126 # All done.
127 dg-finish