Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / gcc / testsuite / g++.dg / vect / vect.exp
blob0688a70339c967e38c02715e771125ab5ffa06d8
1 # Copyright (C) 2004, 2007, 2008 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.
19 # There's a bunch of headers we need.
20 if [is_remote host] {
21 foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] {
22 remote_download host $header
26 # Load support procs.
27 load_lib g++-dg.exp
28 load_lib target-supports.exp
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}
38 # Set up flags used for tests that don't specify options.
39 set DEFAULT_VECTCFLAGS ""
41 # These flags are used for all targets.
42 lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" \
43 "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
45 # Skip these tests for targets that do not support generating vector
46 # code. Set additional target-dependent vector flags, which can be
47 # overridden by using dg-options in individual tests.
48 if [istarget "powerpc-*paired*"] {
49 lappend DEFAULT_VECTCFLAGS "-mpaired"
50 if [check_750cl_hw_available] {
51 set dg-do-what-default run
52 } else {
53 set dg-do-what-default compile
55 } elseif [istarget "powerpc*-*-*"] {
56 # Skip targets not supporting -maltivec.
57 if ![is-effective-target powerpc_altivec_ok] {
58 return
61 lappend DEFAULT_VECTCFLAGS "-maltivec"
62 if [check_vmx_hw_available] {
63 set dg-do-what-default run
64 } else {
65 if [is-effective-target ilp32] {
66 # Specify a cpu that supports VMX for compile-only tests.
67 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
69 set dg-do-what-default compile
71 } elseif { [istarget "spu-*-*"] } {
72 set dg-do-what-default run
73 } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
74 lappend DEFAULT_VECTCFLAGS "-msse2"
75 if [check_sse2_hw_available] {
76 set dg-do-what-default run
77 } else {
78 set dg-do-what-default compile
80 } elseif { [istarget "mips*-*-*"]
81 && [check_effective_target_mpaired_single]
82 && [check_effective_target_nomips16] } {
83 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
84 set dg-do-what-default run
85 } elseif [istarget "sparc*-*-*"] {
86 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
87 if [check_effective_target_ultrasparc_hw] {
88 set dg-do-what-default run
89 } else {
90 set dg-do-what-default compile
92 } elseif [istarget "alpha*-*-*"] {
93 # Alpha's vectorization capabilities are extremely limited.
94 # It's more effort than its worth disabling all of the tests
95 # that it cannot pass. But if you actually want to see what
96 # does work, command out the return.
97 return
99 lappend DEFAULT_VECTCFLAGS "-mmax"
100 if [check_alpha_max_hw_available] {
101 set dg-do-what-default run
102 } else {
103 set dg-do-what-default compile
105 } elseif [istarget "ia64-*-*"] {
106 set dg-do-what-default run
107 } elseif [is-effective-target arm_neon_ok] {
108 lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
109 if [is-effective-target arm_neon_hw] {
110 set dg-do-what-default run
111 } else {
112 set dg-do-what-default compile
114 } else {
115 return
118 # Initialize `dg'.
119 dg-init
121 # Main loop.
122 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \
123 "" $DEFAULT_VECTCFLAGS
125 #### Tests with special options
126 global SAVED_DEFAULT_VECTCFLAGS
127 set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
129 # --param max-aliased-vops=0
130 set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
131 lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0"
132 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \
133 "" $DEFAULT_VECTCFLAGS
135 # Clean up.
136 set dg-do-what-default ${save-dg-do-what-default}
138 # All done.
139 dg-finish