1#   Copyright (C) 2004 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# There's a bunch of headers we need.
20if [is_remote host] {
21    foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] {
22        remote_download host $header
23    }
24}
25
26# Load support procs.
27load_lib g++-dg.exp
28load_lib target-supports.exp
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.
35global dg-do-what-default
36set save-dg-do-what-default ${dg-do-what-default}
37
38# Set up flags used for tests that don't specify options.
39set DEFAULT_VECTCFLAGS ""
40
41# These flags are used for all targets.
42lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" \
43  "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
44
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.
48if [istarget "powerpc*-*-*"] {
49    # If there are powerpc targets to skip, do it here.
50
51    lappend DEFAULT_VECTCFLAGS "-maltivec"
52    if [check_vmx_hw_available] {
53        set dg-do-what-default run
54    } else {
55        if [is-effective-target ilp32] {
56            # Specify a cpu that supports VMX for compile-only tests.
57            lappend DEFAULT_VECTCFLAGS "-mcpu=7400"
58        }
59        set dg-do-what-default compile
60    }
61} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
62    lappend DEFAULT_VECTCFLAGS "-msse2"
63    set dg-do-what-default run
64} elseif [istarget "mipsisa64*-*-*"] {
65    lappend DEFAULT_VECTCFLAGS "-mpaired-single"
66    set dg-do-what-default run
67} elseif [istarget "sparc*-*-*"] {
68    lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
69    set dg-do-what-default run
70} elseif [istarget "alpha*-*-*"] {
71    lappend DEFAULT_VECTCFLAGS "-mmax"
72    if [check_alpha_max_hw_available] {
73        set dg-do-what-default run
74    } else {
75        set dg-do-what-default compile
76    }
77} elseif [istarget "ia64-*-*"] {
78    set dg-do-what-default run
79} else {
80    return
81}
82
83
84# Initialize `dg'.
85dg-init
86
87# Main loop.
88dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \
89        "" $DEFAULT_VECTCFLAGS
90
91# Clean up.
92set dg-do-what-default ${save-dg-do-what-default}
93
94# All done.
95dg-finish
96