1 |
301 |
jeremybenn |
# Copyright (C) 2004, 2007, 2008, 2010 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 |
|
|
# .
|
16 |
|
|
|
17 |
|
|
# GCC testsuite that uses the 'dg.exp' driver.
|
18 |
|
|
|
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
|
23 |
|
|
}
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
# Load support procs.
|
27 |
|
|
load_lib g++-dg.exp
|
28 |
|
|
load_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.
|
35 |
|
|
global dg-do-what-default
|
36 |
|
|
set save-dg-do-what-default ${dg-do-what-default}
|
37 |
|
|
|
38 |
|
|
# Set up flags used for tests that don't specify options.
|
39 |
|
|
set DEFAULT_VECTCFLAGS ""
|
40 |
|
|
|
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"
|
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.
|
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
|
54 |
|
|
}
|
55 |
|
|
} elseif [istarget "powerpc*-*-*"] {
|
56 |
|
|
# Skip targets not supporting -maltivec.
|
57 |
|
|
if ![is-effective-target powerpc_altivec_ok] {
|
58 |
|
|
return
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
lappend DEFAULT_VECTCFLAGS "-maltivec"
|
62 |
|
|
if [check_vsx_hw_available] {
|
63 |
|
|
lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
if [check_vmx_hw_available] {
|
67 |
|
|
set dg-do-what-default run
|
68 |
|
|
} else {
|
69 |
|
|
if [is-effective-target ilp32] {
|
70 |
|
|
# Specify a cpu that supports VMX for compile-only tests.
|
71 |
|
|
lappend DEFAULT_VECTCFLAGS "-mcpu=970"
|
72 |
|
|
}
|
73 |
|
|
set dg-do-what-default compile
|
74 |
|
|
}
|
75 |
|
|
} elseif { [istarget "spu-*-*"] } {
|
76 |
|
|
set dg-do-what-default run
|
77 |
|
|
} elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
|
78 |
|
|
if { ![check_effective_target_sse2] } then {
|
79 |
|
|
return
|
80 |
|
|
}
|
81 |
|
|
lappend DEFAULT_VECTCFLAGS "-msse2"
|
82 |
|
|
if { [check_sse2_hw_available] && [check_sse_os_support_available] } {
|
83 |
|
|
set dg-do-what-default run
|
84 |
|
|
} else {
|
85 |
|
|
set dg-do-what-default compile
|
86 |
|
|
}
|
87 |
|
|
} elseif { [istarget "mips*-*-*"]
|
88 |
|
|
&& [check_effective_target_mpaired_single]
|
89 |
|
|
&& [check_effective_target_nomips16] } {
|
90 |
|
|
lappend DEFAULT_VECTCFLAGS "-mpaired-single"
|
91 |
|
|
set dg-do-what-default run
|
92 |
|
|
} elseif [istarget "sparc*-*-*"] {
|
93 |
|
|
lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
|
94 |
|
|
if [check_effective_target_ultrasparc_hw] {
|
95 |
|
|
set dg-do-what-default run
|
96 |
|
|
} else {
|
97 |
|
|
set dg-do-what-default compile
|
98 |
|
|
}
|
99 |
|
|
} elseif [istarget "alpha*-*-*"] {
|
100 |
|
|
# Alpha's vectorization capabilities are extremely limited.
|
101 |
|
|
# It's more effort than its worth disabling all of the tests
|
102 |
|
|
# that it cannot pass. But if you actually want to see what
|
103 |
|
|
# does work, command out the return.
|
104 |
|
|
return
|
105 |
|
|
|
106 |
|
|
lappend DEFAULT_VECTCFLAGS "-mmax"
|
107 |
|
|
if [check_alpha_max_hw_available] {
|
108 |
|
|
set dg-do-what-default run
|
109 |
|
|
} else {
|
110 |
|
|
set dg-do-what-default compile
|
111 |
|
|
}
|
112 |
|
|
} elseif [istarget "ia64-*-*"] {
|
113 |
|
|
set dg-do-what-default run
|
114 |
|
|
} elseif [is-effective-target arm_neon_ok] {
|
115 |
|
|
lappend DEFAULT_VECTCFLAGS "-mfpu=neon" "-mfloat-abi=softfp"
|
116 |
|
|
if [is-effective-target arm_neon_hw] {
|
117 |
|
|
set dg-do-what-default run
|
118 |
|
|
} else {
|
119 |
|
|
set dg-do-what-default compile
|
120 |
|
|
}
|
121 |
|
|
} else {
|
122 |
|
|
return
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
# Initialize `dg'.
|
126 |
|
|
dg-init
|
127 |
|
|
|
128 |
|
|
# Main loop.
|
129 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \
|
130 |
|
|
"" $DEFAULT_VECTCFLAGS
|
131 |
|
|
|
132 |
|
|
#### Tests with special options
|
133 |
|
|
global SAVED_DEFAULT_VECTCFLAGS
|
134 |
|
|
set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS
|
135 |
|
|
|
136 |
|
|
# --param max-aliased-vops=0
|
137 |
|
|
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
|
138 |
|
|
lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0"
|
139 |
|
|
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \
|
140 |
|
|
"" $DEFAULT_VECTCFLAGS
|
141 |
|
|
|
142 |
|
|
# Clean up.
|
143 |
|
|
set dg-do-what-default ${save-dg-do-what-default}
|
144 |
|
|
|
145 |
|
|
# All done.
|
146 |
|
|
dg-finish
|