1# Copyright (C) 2007-2016 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# Exit immediately if this isn't a sh target. 20if ![istarget sh*-*-*] then { 21 return 22} 23 24# Load support procs. 25load_lib gcc-dg.exp 26 27# Return 1 if target is SH2A 28proc check_effective_target_sh2a { } { 29 return [check_no_compiler_messages sh2a object { 30 #ifndef __SH2A__ 31 #error "" 32 #endif 33 } ""] 34} 35 36# Return 1 if target is SH1 37proc check_effective_target_sh1 { } { 38 return [check_no_compiler_messages sh1 object { 39 #ifndef __SH1__ 40 #error "" 41 #endif 42 } ""] 43} 44 45# Return 1 if target is SH4A 46proc check_effective_target_sh4a { } { 47 return [check_no_compiler_messages sh4a object { 48 #ifndef __SH4A__ 49 #error "" 50 #endif 51 } ""] 52} 53 54# Return 1 if target is big endian 55proc check_effective_target_big_endian { } { 56 return [check_no_compiler_messages big_endian object { 57 #if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__ 58 #error "" 59 #endif 60 } ""] 61} 62 63# Return 1 if target is little endian 64proc check_effective_target_little_endian { } { 65 return [check_no_compiler_messages little_endian object { 66 #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ 67 #error "" 68 #endif 69 } ""] 70} 71 72# Return 1 if the target has any FPU (single or double precision) 73proc check_effective_target_any_fpu { } { 74 return [check_no_compiler_messages any_fpu object { 75 #ifndef __SH_FPU_ANY__ 76 #error "" 77 #endif 78 } ""] 79} 80 81# Return 1 if the target has a double precision FPU which is allowed to be 82# used by the compiler as such. 83proc check_effective_target_double_fpu { } { 84 return [check_no_compiler_messages double_fpu object { 85 #ifndef __SH_FPU_DOUBLE__ 86 #error "" 87 #endif 88 } ""] 89} 90 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 93proc 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__)) 97 #error "" 98 #endif 99 } ""] 100} 101 102# Return 1 if the target has an FPU and the default mode is single 103proc 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__)) 110 #error "" 111 #endif 112 } ""] 113} 114 115# Return 1 if the target has no FPU 116proc check_effective_target_no_fpu { } { 117 return [check_no_compiler_messages no_fpu object { 118 #ifdef __SH_FPU_ANY__ 119 #error "" 120 #endif 121 } ""] 122} 123 124 125# Return 1 if the target has XF regs 126proc 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__))) 133 #error "" 134 #endif 135 } ""] 136} 137 138 139# Return 1 if the target can do the fsca insn 140proc 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__))) 147 #error "" 148 #endif 149 } ""] 150} 151 152# Return 1 if the target can do the fsrra insn 153proc 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__))) 160 #error "" 161 #endif 162 } ""] 163} 164 165# Return 1 if the target can do the fpchg insn 166proc 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__)) 170 #error "" 171 #endif 172 } ""] 173} 174 175# Return 1 if the target can do dynamic shifts 176proc 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__)) 186 #error "" 187 #endif 188 } ""] 189} 190 191# Return 1 if the mfmovd option is enabled 192proc check_effective_target_fmovd_enabled { } { 193 return [check_no_compiler_messages fmovd_enabled object { 194 #ifndef __FMOVD_ENABLED__ 195 #error "" 196 #endif 197 } ""] 198} 199 200# Return 1 if the target supports privileged mode 201proc 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__)) 210 #error "" 211 #endif 212 } ""] 213} 214 215# Return 1 if the target supports the prefetch insn 216proc 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__)) 225 #error "" 226 #endif 227 } ""] 228} 229 230# Return 1 if target does banked r0..r7 regs type of ISRs 231proc 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__)) 239 #error "" 240 #endif 241 } ""] 242} 243 244# Return 1 if target does stack only type of ISRs 245proc 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__)) 251 #error "" 252 #endif 253 } ""] 254} 255 256# Return 1 if target supports atomic-model=soft-gusa 257proc check_effective_target_atomic_model_soft_gusa_available { } { 258 return [check_no_compiler_messages atomic_model_soft_gusa_available object { 259 int x = 0; 260 } "-matomic-model=soft-gusa"] 261} 262 263# Return 1 if target supports atomic-model=soft-tcb 264proc check_effective_target_atomic_model_soft_tcb_available { } { 265 return [check_no_compiler_messages atomic_model_soft_tcb_available object { 266 int x = 0; 267 } "-matomic-model=soft-tcb,gbr-offset=0"] 268} 269 270# Return 1 if target supports atomic-model=soft-imask 271proc check_effective_target_atomic_model_soft_imask_available { } { 272 return [check_no_compiler_messages atomic_model_soft_imask_available object { 273 int x = 0; 274 } "-matomic-model=soft-imask -mno-usermode"] 275} 276 277# Return 1 if target supports atomic-model=hard-llcs 278proc check_effective_target_atomic_model_hard_llcs_available { } { 279 return [check_no_compiler_messages atomic_model_hard_llcs_available object { 280 int x = 0; 281 } "-matomic-model=hard-llcs"] 282} 283 284# If a testcase doesn't have special options, use these. 285global DEFAULT_CFLAGS 286if ![info exists DEFAULT_CFLAGS] then { 287 set DEFAULT_CFLAGS " -ansi -pedantic-errors" 288} 289 290# Initialize `dg'. 291dg-init 292 293# Main loop. 294dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ 295 "" $DEFAULT_CFLAGS 296 297# All done. 298dg-finish 299