OSDN Git Service

00f5b00bb872cb7306fee45f1d74a1ae4148e303
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / vect / vect.exp
1 # Copyright (C) 1997, 2004, 2007, 2008 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-*paired*"]  {
42    lappend DEFAULT_VECTCFLAGS "-mpaired"
43     if [check_750cl_hw_available] {
44         set dg-do-what-default run 
45     } else {
46         set dg-do-what-default compile
47     }
48 } elseif [istarget "powerpc*-*-*"] {
49     # Skip targets not supporting -maltivec.
50     if ![is-effective-target powerpc_altivec_ok] {
51         return
52     }
53
54     lappend DEFAULT_VECTCFLAGS "-maltivec"
55     if [check_vmx_hw_available] {
56         set dg-do-what-default run
57     } else {
58         if [is-effective-target ilp32] {
59             # Specify a cpu that supports VMX for compile-only tests.
60             lappend DEFAULT_VECTCFLAGS "-mcpu=970"
61         }
62         set dg-do-what-default compile
63     }
64 } elseif { [istarget  "spu-*-*"] } {
65    set dg-do-what-default run
66 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
67     lappend DEFAULT_VECTCFLAGS "-msse2"
68     if [check_sse2_hw_available] {
69         set dg-do-what-default run
70     } else {
71         set dg-do-what-default compile
72     }
73 } elseif { [istarget "mips*-*-*"]
74            && [check_effective_target_mpaired_single]
75            && [check_effective_target_nomips16] } {
76     lappend DEFAULT_VECTCFLAGS "-mpaired-single"
77     set dg-do-what-default run
78 } elseif [istarget "sparc*-*-*"] {
79     lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
80     if [check_effective_target_ultrasparc_hw] {
81         set dg-do-what-default run
82     } else {
83         set dg-do-what-default compile
84     }
85 } elseif [istarget "alpha*-*-*"] {
86     # Alpha's vectorization capabilities are extremely limited.
87     # It's more effort than its worth disabling all of the tests
88     # that it cannot pass.  But if you actually want to see what
89     # does work, command out the return.
90     return
91
92     lappend DEFAULT_VECTCFLAGS "-mmax"
93     if [check_alpha_max_hw_available] {
94         set dg-do-what-default run
95     } else {
96         set dg-do-what-default compile
97     }
98 } elseif [istarget "ia64-*-*"] {
99     set dg-do-what-default run
100 } elseif [is-effective-target arm_neon_ok] {
101     lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
102     if [is-effective-target arm_neon_hw] {
103       set dg-do-what-default run
104     } else {
105       set dg-do-what-default compile
106     }
107 } else {
108     return
109 }
110
111 # Initialize `dg'.
112 dg-init
113
114 # Main loop.
115 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/vect-*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
116 gfortran-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[fF\]{,90,95,03,08} ]] $DEFAULT_VECTCFLAGS
117
118 #### Tests with special options
119 global SAVED_DEFAULT_VECTCFLAGS
120 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
121
122 # -ffast-math tests
123 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
124 lappend DEFAULT_VECTCFLAGS "-ffast-math"
125 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/fast-math-*.\[fF\]{,90,95,03,08} ]]  \
126         "" $DEFAULT_VECTCFLAGS
127
128 # -fvect-cost-model tests
129 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
130 lappend DEFAULT_VECTCFLAGS "-fvect-cost-model"
131 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/cost-model-*.\[fF\]{,90,95,03,08} ]]  \
132         "" $DEFAULT_VECTCFLAGS
133
134 # --param vect-max-version-for-alias-checks=0 tests
135 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
136 lappend DEFAULT_VECTCFLAGS "--param" "vect-max-version-for-alias-checks=0"
137 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-vfa-*.\[fF\]{,90,95,03,08} ]]  \
138         "" $DEFAULT_VECTCFLAGS
139
140 # With -O3
141 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
142 lappend DEFAULT_VECTCFLAGS "-O3"
143 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]]  \
144         "" $DEFAULT_VECTCFLAGS
145
146 # Clean up.
147 set dg-do-what-default ${save-dg-do-what-default}
148
149 # All done.
150 dg-finish