1 # Copyright (C) 2007-2016 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 # Exit immediately if this isn't a sh target.
20 if ![istarget sh*-*-*] then {
27 # Return 1 if target is SH2A
28 proc check_effective_target_sh2a { } {
29 return [check_no_compiler_messages sh2a object {
36 # Return 1 if target is SH1
37 proc check_effective_target_sh1 { } {
38 return [check_no_compiler_messages sh1 object {
45 # Return 1 if target is SH4A
46 proc check_effective_target_sh4a { } {
47 return [check_no_compiler_messages sh4a object {
54 # Return 1 if target is big endian
55 proc check_effective_target_big_endian { } {
56 return [check_no_compiler_messages big_endian object {
57 #if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
63 # Return 1 if target is little endian
64 proc check_effective_target_little_endian { } {
65 return [check_no_compiler_messages little_endian object {
66 #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
72 # Return 1 if the target has any FPU (single or double precision)
73 proc check_effective_target_any_fpu { } {
74 return [check_no_compiler_messages any_fpu object {
75 #ifndef __SH_FPU_ANY__
81 # Return 1 if the target has a double precision FPU which is allowed to be
82 # used by the compiler as such.
83 proc check_effective_target_double_fpu { } {
84 return [check_no_compiler_messages double_fpu object {
85 #ifndef __SH_FPU_DOUBLE__
91 # Return 1 if the target has a double precision FPU but it is only being used
92 # in single precision mode by the compiler
93 proc check_effective_target_use_single_only_fpu { } {
94 return [check_no_compiler_messages use_single_only_fpu object {
95 #if !(defined (__SH2A_SINGLE_ONLY__) \
96 || defined (__SH4_SINGLE_ONLY__))
102 # Return 1 if the target has an FPU and the default mode is single
103 proc check_effective_target_default_single_fpu { } {
104 return [check_no_compiler_messages default_single_fpu object {
105 #if !(defined (__SH2E__) || defined (__SH3E__) \
106 || defined (__SH2A_SINGLE__) \
107 || defined (__SH2A_SINGLE_ONLY__) \
108 || defined (__SH4_SINGLE__) \
109 || defined (__SH4_SINGLE_ONLY__))
115 # Return 1 if the target has no FPU
116 proc check_effective_target_no_fpu { } {
117 return [check_no_compiler_messages no_fpu object {
118 #ifdef __SH_FPU_ANY__
125 # Return 1 if the target has XF regs
126 proc check_effective_target_has_xf_regs { } {
127 return [check_no_compiler_messages has_xf_regs object {
128 #if !(defined (__SH_FPU_ANY__) \
129 && (defined (__SH4__) \
130 || defined (__SH4_SINGLE__) \
131 || defined (__SH4_SINGLE_ONLY__) \
132 || defined (__SH4A__)))
139 # Return 1 if the target can do the fsca insn
140 proc check_effective_target_has_fsca { } {
141 return [check_no_compiler_messages has_fsca object {
142 #if !(defined (__SH_FPU_ANY__) \
143 && (defined (__SH4__) \
144 || defined (__SH4_SINGLE__) \
145 || defined (__SH4_SINGLE_ONLY__) \
146 || defined (__SH4A__)))
152 # Return 1 if the target can do the fsrra insn
153 proc check_effective_target_has_fsrra { } {
154 return [check_no_compiler_messages has_fsrra object {
155 #if !(defined (__SH_FPU_ANY__) \
156 && (defined (__SH4__) \
157 || defined (__SH4_SINGLE__) \
158 || defined (__SH4_SINGLE_ONLY__) \
159 || defined (__SH4A__)))
165 # Return 1 if the target can do the fpchg insn
166 proc check_effective_target_has_fpchg { } {
167 return [check_no_compiler_messages has_fpchg object {
168 #if !(defined (__SH4A__) && defined (__SH_FPU_ANY__) \
169 && !defined (__SH4_SINGLE_ONLY__))
175 # Return 1 if the target can do dynamic shifts
176 proc check_effective_target_has_dyn_shift { } {
177 return [check_no_compiler_messages has_dyn_shift object {
178 #if !(defined (__SH3__) \
179 || defined (__SH3E__) \
180 || defined (__SH2A__) \
181 || defined (__SH4__) \
182 || defined (__SH4_NOFPU__) \
183 || defined (__SH4_SINGLE__) \
184 || defined (__SH4_SINGLE_ONLY__) \
185 || defined (__SH4A__))
191 # Return 1 if the mfmovd option is enabled
192 proc check_effective_target_fmovd_enabled { } {
193 return [check_no_compiler_messages fmovd_enabled object {
194 #ifndef __FMOVD_ENABLED__
200 # Return 1 if the target supports privileged mode
201 proc check_effective_target_has_privileged { } {
202 return [check_no_compiler_messages has_privileged object {
203 #if !(defined (__SH3__) \
204 || defined (__SH3E__) \
205 || defined (__SH4__) \
206 || defined (__SH4_NOFPU__) \
207 || defined (__SH4_SINGLE__) \
208 || defined (__SH4_SINGLE_ONLY__) \
209 || defined (__SH4A__))
215 # Return 1 if the target supports the prefetch insn
216 proc check_effective_target_has_pref { } {
217 return [check_no_compiler_messages has_pref object {
218 #if !(defined (__SH3__) \
219 || defined (__SH3E__) \
220 || defined (__SH4__) \
221 || defined (__SH4_NOFPU__) \
222 || defined (__SH4_SINGLE__) \
223 || defined (__SH4_SINGLE_ONLY__) \
224 || defined (__SH4A__))
230 # Return 1 if target does banked r0..r7 regs type of ISRs
231 proc check_effective_target_banked_r0r7_isr { } {
232 return [check_no_compiler_messages banked_r0r7_isr object {
233 #if !(defined (__SH3__) || defined (__SH3E__) \
234 || defined (__SH4__) \
235 || defined (__SH4_SINGLE__) \
236 || defined (__SH4_SINGLE_ONLY__) \
237 || defined (__SH4_NOFPU__) \
238 || defined (__SH4A__))
244 # Return 1 if target does stack only type of ISRs
245 proc check_effective_target_stack_save_isr { } {
246 return [check_no_compiler_messages stack_save_isr object {
247 #if !(defined (__SH1__) \
248 || defined (__SH2__) \
249 || defined (__SH2E__) \
250 || defined (__SH2A__))
256 # Return 1 if target supports atomic-model=soft-gusa
257 proc check_effective_target_atomic_model_soft_gusa_available { } {
258 return [check_no_compiler_messages atomic_model_soft_gusa_available object {
260 } "-matomic-model=soft-gusa"]
263 # Return 1 if target supports atomic-model=soft-tcb
264 proc check_effective_target_atomic_model_soft_tcb_available { } {
265 return [check_no_compiler_messages atomic_model_soft_tcb_available object {
267 } "-matomic-model=soft-tcb,gbr-offset=0"]
270 # Return 1 if target supports atomic-model=soft-imask
271 proc check_effective_target_atomic_model_soft_imask_available { } {
272 return [check_no_compiler_messages atomic_model_soft_imask_available object {
274 } "-matomic-model=soft-imask -mno-usermode"]
277 # Return 1 if target supports atomic-model=hard-llcs
278 proc check_effective_target_atomic_model_hard_llcs_available { } {
279 return [check_no_compiler_messages atomic_model_hard_llcs_available object {
281 } "-matomic-model=hard-llcs"]
284 # If a testcase doesn't have special options, use these.
285 global DEFAULT_CFLAGS
286 if ![info exists DEFAULT_CFLAGS] then {
287 set DEFAULT_CFLAGS " -ansi -pedantic-errors"
294 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \