OSDN Git Service

2008-03-20 Johannes Singler <singler@ira.uka.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / vect / vect.exp
1 # Copyright (C) 1997, 2004, 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 gfortran-dg.exp
21 load_lib target-supports.exp
22
23 # Set up flags used for tests that don't specify options.
24 set DEFAULT_VECTCFLAGS ""
25
26 # These flags are used for all targets.
27 lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" \
28   "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
29
30 # If the target system supports vector instructions, the default action
31 # for a test is 'run', otherwise it's 'compile'.  Save current default.
32 # Executing vector instructions on a system without hardware vector support
33 # is also disabled by a call to check_vect, but disabling execution here is
34 # more efficient.
35 global dg-do-what-default
36 set save-dg-do-what-default ${dg-do-what-default}
37
38 # Skip these tests for targets that do not support generating vector
39 # code.  Set additional target-dependent vector flags, which can be
40 # overridden by using dg-options in individual tests.
41 if [istarget "powerpc*-*-*"] {
42     # If there are powerpc targets to skip, do it here.
43
44     lappend DEFAULT_VECTCFLAGS "-maltivec"
45     if [check_vmx_hw_available] {
46         set dg-do-what-default run
47     } else {
48         if [is-effective-target ilp32] {
49             # Specify a cpu that supports VMX for compile-only tests.
50             lappend DEFAULT_VECTCFLAGS "-mcpu=7400"
51         }
52         set dg-do-what-default compile
53     }
54 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
55     lappend DEFAULT_VECTCFLAGS "-msse2"
56     set dg-do-what-default run
57 } elseif [istarget "mipsisa64*-*-*"] {
58     lappend DEFAULT_VECTCFLAGS "-mpaired-single"
59     set dg-do-what-default run
60 } elseif [istarget "sparc*-*-*"] {
61     lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
62     set dg-do-what-default run
63 } elseif [istarget "alpha*-*-*"] {
64     lappend DEFAULT_VECTCFLAGS "-mmax"
65     if [check_alpha_max_hw_available] {
66         set dg-do-what-default run
67     } else {
68         set dg-do-what-default compile
69     }
70 } elseif [istarget "ia64-*-*"] {
71     set dg-do-what-default run
72 } else {
73     return
74 }
75
76 # Return 1 if the effective target is LP64 or if the effective target
77 # does not support a vector alignment mechanism.
78
79 proc check_effective_target_lp64_or_vect_no_align { } {
80     if { [is-effective-target lp64]
81           || [is-effective-target vect_no_align] } {
82         set answer 1
83     } else {
84         set answer 0
85     }
86     return $answer
87 }
88
89 # Initialize `dg'.
90 dg-init
91
92 # Main loop.
93 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
94 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
95
96 #### Tests with special options
97 global SAVED_DEFAULT_VECTCFLAGS
98 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
99
100 # -ffast-math tests
101 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
102 lappend DEFAULT_VECTCFLAGS "-ffast-math"
103 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]]  \
104         "" $DEFAULT_VECTCFLAGS
105
106 # -fvect-cost-model tests
107 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
108 lappend DEFAULT_VECTCFLAGS "-fvect-cost-model"
109 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]]  \
110         "" $DEFAULT_VECTCFLAGS
111
112 # --param vect-max-version-for-alias-checks=0 tests
113 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
114 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
115 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]]  \
116         "" $DEFAULT_VECTCFLAGS
117
118 # Clean up.
119 set dg-do-what-default ${save-dg-do-what-default}
120
121 # All done.
122 dg-finish