1 |
306 |
jeremybenn |
# Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
# This program is free software; you can redistribute it and/or modify
|
5 |
|
|
# it under the terms of the GNU General Public License as published by
|
6 |
|
|
# the Free Software Foundation; either version 3 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
# GNU General Public License for more details.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with GCC; see the file COPYING3. If not see
|
16 |
|
|
# .
|
17 |
|
|
|
18 |
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
19 |
|
|
# gcc-patches@gcc.gnu.org
|
20 |
|
|
|
21 |
|
|
# This file defines procs for determining features supported by the target.
|
22 |
|
|
|
23 |
|
|
# Try to compile the code given by CONTENTS into an output file of
|
24 |
|
|
# type TYPE, where TYPE is as for target_compile. Return a list
|
25 |
|
|
# whose first element contains the compiler messages and whose
|
26 |
|
|
# second element is the name of the output file.
|
27 |
|
|
#
|
28 |
|
|
# BASENAME is a prefix to use for source and output files.
|
29 |
|
|
# If ARGS is not empty, its first element is a string that
|
30 |
|
|
# should be added to the command line.
|
31 |
|
|
#
|
32 |
|
|
# Assume by default that CONTENTS is C code.
|
33 |
|
|
# Otherwise, code should contain:
|
34 |
|
|
# "// C++" for c++,
|
35 |
|
|
# "! Fortran" for Fortran code,
|
36 |
|
|
# "/* ObjC", for ObjC
|
37 |
|
|
# and "// ObjC++" for ObjC++
|
38 |
|
|
# If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
|
39 |
|
|
# allow for ObjC/ObjC++ specific flags.
|
40 |
|
|
proc check_compile {basename type contents args} {
|
41 |
|
|
global tool
|
42 |
|
|
verbose "check_compile tool: $tool for $basename"
|
43 |
|
|
|
44 |
|
|
if { [llength $args] > 0 } {
|
45 |
|
|
set options [list "additional_flags=[lindex $args 0]"]
|
46 |
|
|
} else {
|
47 |
|
|
set options ""
|
48 |
|
|
}
|
49 |
|
|
switch -glob -- $contents {
|
50 |
|
|
"*! Fortran*" { set src ${basename}[pid].f90 }
|
51 |
|
|
"*// C++*" { set src ${basename}[pid].cc }
|
52 |
|
|
"*// ObjC++*" { set src ${basename}[pid].mm }
|
53 |
|
|
"*/* ObjC*" { set src ${basename}[pid].m }
|
54 |
|
|
default {
|
55 |
|
|
switch -- $tool {
|
56 |
|
|
"objc" { set src ${basename}[pid].m }
|
57 |
|
|
"obj-c++" { set src ${basename}[pid].mm }
|
58 |
|
|
default { set src ${basename}[pid].c }
|
59 |
|
|
}
|
60 |
|
|
}
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
set compile_type $type
|
64 |
|
|
switch -glob $type {
|
65 |
|
|
assembly { set output ${basename}[pid].s }
|
66 |
|
|
object { set output ${basename}[pid].o }
|
67 |
|
|
executable { set output ${basename}[pid].exe }
|
68 |
|
|
"rtl-*" {
|
69 |
|
|
set output ${basename}[pid].s
|
70 |
|
|
lappend options "additional_flags=-fdump-$type"
|
71 |
|
|
set compile_type assembly
|
72 |
|
|
}
|
73 |
|
|
}
|
74 |
|
|
set f [open $src "w"]
|
75 |
|
|
puts $f $contents
|
76 |
|
|
close $f
|
77 |
|
|
set lines [${tool}_target_compile $src $output $compile_type "$options"]
|
78 |
|
|
file delete $src
|
79 |
|
|
|
80 |
|
|
set scan_output $output
|
81 |
|
|
# Don't try folding this into the switch above; calling "glob" before the
|
82 |
|
|
# file is created won't work.
|
83 |
|
|
if [regexp "rtl-(.*)" $type dummy rtl_type] {
|
84 |
|
|
set scan_output "[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
|
85 |
|
|
file delete $output
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
return [list $lines $scan_output]
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
proc current_target_name { } {
|
92 |
|
|
global target_info
|
93 |
|
|
if [info exists target_info(target,name)] {
|
94 |
|
|
set answer $target_info(target,name)
|
95 |
|
|
} else {
|
96 |
|
|
set answer ""
|
97 |
|
|
}
|
98 |
|
|
return $answer
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
# Implement an effective-target check for property PROP by invoking
|
102 |
|
|
# the Tcl command ARGS and seeing if it returns true.
|
103 |
|
|
|
104 |
|
|
proc check_cached_effective_target { prop args } {
|
105 |
|
|
global et_cache
|
106 |
|
|
|
107 |
|
|
set target [current_target_name]
|
108 |
|
|
if {![info exists et_cache($prop,target)]
|
109 |
|
|
|| $et_cache($prop,target) != $target} {
|
110 |
|
|
verbose "check_cached_effective_target $prop: checking $target" 2
|
111 |
|
|
set et_cache($prop,target) $target
|
112 |
|
|
set et_cache($prop,value) [uplevel eval $args]
|
113 |
|
|
}
|
114 |
|
|
set value $et_cache($prop,value)
|
115 |
|
|
verbose "check_cached_effective_target $prop: returning $value for $target" 2
|
116 |
|
|
return $value
|
117 |
|
|
}
|
118 |
|
|
|
119 |
|
|
# Like check_compile, but delete the output file and return true if the
|
120 |
|
|
# compiler printed no messages.
|
121 |
|
|
proc check_no_compiler_messages_nocache {args} {
|
122 |
|
|
set result [eval check_compile $args]
|
123 |
|
|
set lines [lindex $result 0]
|
124 |
|
|
set output [lindex $result 1]
|
125 |
|
|
remote_file build delete $output
|
126 |
|
|
return [string match "" $lines]
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
# Like check_no_compiler_messages_nocache, but cache the result.
|
130 |
|
|
# PROP is the property we're checking, and doubles as a prefix for
|
131 |
|
|
# temporary filenames.
|
132 |
|
|
proc check_no_compiler_messages {prop args} {
|
133 |
|
|
return [check_cached_effective_target $prop {
|
134 |
|
|
eval [list check_no_compiler_messages_nocache $prop] $args
|
135 |
|
|
}]
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
# Like check_compile, but return true if the compiler printed no
|
139 |
|
|
# messages and if the contents of the output file satisfy PATTERN.
|
140 |
|
|
# If PATTERN has the form "!REGEXP", the contents satisfy it if they
|
141 |
|
|
# don't match regular expression REGEXP, otherwise they satisfy it
|
142 |
|
|
# if they do match regular expression PATTERN. (PATTERN can start
|
143 |
|
|
# with something like "[!]" if the regular expression needs to match
|
144 |
|
|
# "!" as the first character.)
|
145 |
|
|
#
|
146 |
|
|
# Delete the output file before returning. The other arguments are
|
147 |
|
|
# as for check_compile.
|
148 |
|
|
proc check_no_messages_and_pattern_nocache {basename pattern args} {
|
149 |
|
|
global tool
|
150 |
|
|
|
151 |
|
|
set result [eval [list check_compile $basename] $args]
|
152 |
|
|
set lines [lindex $result 0]
|
153 |
|
|
set output [lindex $result 1]
|
154 |
|
|
|
155 |
|
|
set ok 0
|
156 |
|
|
if { [string match "" $lines] } {
|
157 |
|
|
set chan [open "$output"]
|
158 |
|
|
set invert [regexp {^!(.*)} $pattern dummy pattern]
|
159 |
|
|
set ok [expr { [regexp $pattern [read $chan]] != $invert }]
|
160 |
|
|
close $chan
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
remote_file build delete $output
|
164 |
|
|
return $ok
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
# Like check_no_messages_and_pattern_nocache, but cache the result.
|
168 |
|
|
# PROP is the property we're checking, and doubles as a prefix for
|
169 |
|
|
# temporary filenames.
|
170 |
|
|
proc check_no_messages_and_pattern {prop pattern args} {
|
171 |
|
|
return [check_cached_effective_target $prop {
|
172 |
|
|
eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
|
173 |
|
|
}]
|
174 |
|
|
}
|
175 |
|
|
|
176 |
|
|
# Try to compile and run an executable from code CONTENTS. Return true
|
177 |
|
|
# if the compiler reports no messages and if execution "passes" in the
|
178 |
|
|
# usual DejaGNU sense. The arguments are as for check_compile, with
|
179 |
|
|
# TYPE implicitly being "executable".
|
180 |
|
|
proc check_runtime_nocache {basename contents args} {
|
181 |
|
|
global tool
|
182 |
|
|
|
183 |
|
|
set result [eval [list check_compile $basename executable $contents] $args]
|
184 |
|
|
set lines [lindex $result 0]
|
185 |
|
|
set output [lindex $result 1]
|
186 |
|
|
|
187 |
|
|
set ok 0
|
188 |
|
|
if { [string match "" $lines] } {
|
189 |
|
|
# No error messages, everything is OK.
|
190 |
|
|
set result [remote_load target "./$output" "" ""]
|
191 |
|
|
set status [lindex $result 0]
|
192 |
|
|
verbose "check_runtime_nocache $basename: status is <$status>" 2
|
193 |
|
|
if { $status == "pass" } {
|
194 |
|
|
set ok 1
|
195 |
|
|
}
|
196 |
|
|
}
|
197 |
|
|
remote_file build delete $output
|
198 |
|
|
return $ok
|
199 |
|
|
}
|
200 |
|
|
|
201 |
|
|
# Like check_runtime_nocache, but cache the result. PROP is the
|
202 |
|
|
# property we're checking, and doubles as a prefix for temporary
|
203 |
|
|
# filenames.
|
204 |
|
|
proc check_runtime {prop args} {
|
205 |
|
|
global tool
|
206 |
|
|
|
207 |
|
|
return [check_cached_effective_target $prop {
|
208 |
|
|
eval [list check_runtime_nocache $prop] $args
|
209 |
|
|
}]
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
###############################
|
213 |
|
|
# proc check_weak_available { }
|
214 |
|
|
###############################
|
215 |
|
|
|
216 |
|
|
# weak symbols are only supported in some configs/object formats
|
217 |
|
|
# this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
|
218 |
|
|
|
219 |
|
|
proc check_weak_available { } {
|
220 |
|
|
global target_triplet
|
221 |
|
|
global target_cpu
|
222 |
|
|
|
223 |
|
|
# All mips targets should support it
|
224 |
|
|
|
225 |
|
|
if { [ string first "mips" $target_cpu ] >= 0 } {
|
226 |
|
|
return 1
|
227 |
|
|
}
|
228 |
|
|
|
229 |
|
|
# All solaris2 targets should support it
|
230 |
|
|
|
231 |
|
|
if { [regexp ".*-solaris2.*" $target_triplet] } {
|
232 |
|
|
return 1
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
# DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
|
236 |
|
|
|
237 |
|
|
if { [regexp "alpha.*osf.*" $target_triplet] } {
|
238 |
|
|
return 1
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
# Windows targets Cygwin and MingW32 support it
|
242 |
|
|
|
243 |
|
|
if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
|
244 |
|
|
return 1
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
# HP-UX 10.X doesn't support it
|
248 |
|
|
|
249 |
|
|
if { [istarget "hppa*-*-hpux10*"] } {
|
250 |
|
|
return 0
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
# ELF and ECOFF support it. a.out does with gas/gld but may also with
|
254 |
|
|
# other linkers, so we should try it
|
255 |
|
|
|
256 |
|
|
set objformat [gcc_target_object_format]
|
257 |
|
|
|
258 |
|
|
switch $objformat {
|
259 |
|
|
elf { return 1 }
|
260 |
|
|
ecoff { return 1 }
|
261 |
|
|
a.out { return 1 }
|
262 |
|
|
mach-o { return 1 }
|
263 |
|
|
som { return 1 }
|
264 |
|
|
unknown { return -1 }
|
265 |
|
|
default { return 0 }
|
266 |
|
|
}
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
###############################
|
270 |
|
|
# proc check_weak_override_available { }
|
271 |
|
|
###############################
|
272 |
|
|
|
273 |
|
|
# Like check_weak_available, but return 0 if weak symbol definitions
|
274 |
|
|
# cannot be overridden.
|
275 |
|
|
|
276 |
|
|
proc check_weak_override_available { } {
|
277 |
|
|
if { [istarget "*-*-mingw*"] } {
|
278 |
|
|
return 0
|
279 |
|
|
}
|
280 |
|
|
return [check_weak_available]
|
281 |
|
|
}
|
282 |
|
|
|
283 |
|
|
###############################
|
284 |
|
|
# proc check_visibility_available { what_kind }
|
285 |
|
|
###############################
|
286 |
|
|
|
287 |
|
|
# The visibility attribute is only support in some object formats
|
288 |
|
|
# This proc returns 1 if it is supported, 0 if not.
|
289 |
|
|
# The argument is the kind of visibility, default/protected/hidden/internal.
|
290 |
|
|
|
291 |
|
|
proc check_visibility_available { what_kind } {
|
292 |
|
|
global tool
|
293 |
|
|
global target_triplet
|
294 |
|
|
|
295 |
|
|
# On NetWare, support makes no sense.
|
296 |
|
|
if { [istarget *-*-netware*] } {
|
297 |
|
|
return 0
|
298 |
|
|
}
|
299 |
|
|
|
300 |
|
|
if [string match "" $what_kind] { set what_kind "hidden" }
|
301 |
|
|
|
302 |
|
|
return [check_no_compiler_messages visibility_available_$what_kind object "
|
303 |
|
|
void f() __attribute__((visibility(\"$what_kind\")));
|
304 |
|
|
void f() {}
|
305 |
|
|
"]
|
306 |
|
|
}
|
307 |
|
|
|
308 |
|
|
###############################
|
309 |
|
|
# proc check_alias_available { }
|
310 |
|
|
###############################
|
311 |
|
|
|
312 |
|
|
# Determine if the target toolchain supports the alias attribute.
|
313 |
|
|
|
314 |
|
|
# Returns 2 if the target supports aliases. Returns 1 if the target
|
315 |
|
|
# only supports weak aliased. Returns 0 if the target does not
|
316 |
|
|
# support aliases at all. Returns -1 if support for aliases could not
|
317 |
|
|
# be determined.
|
318 |
|
|
|
319 |
|
|
proc check_alias_available { } {
|
320 |
|
|
global alias_available_saved
|
321 |
|
|
global tool
|
322 |
|
|
|
323 |
|
|
if [info exists alias_available_saved] {
|
324 |
|
|
verbose "check_alias_available returning saved $alias_available_saved" 2
|
325 |
|
|
} else {
|
326 |
|
|
set src alias[pid].c
|
327 |
|
|
set obj alias[pid].o
|
328 |
|
|
verbose "check_alias_available compiling testfile $src" 2
|
329 |
|
|
set f [open $src "w"]
|
330 |
|
|
# Compile a small test program. The definition of "g" is
|
331 |
|
|
# necessary to keep the Solaris assembler from complaining
|
332 |
|
|
# about the program.
|
333 |
|
|
puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
|
334 |
|
|
puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
|
335 |
|
|
close $f
|
336 |
|
|
set lines [${tool}_target_compile $src $obj object ""]
|
337 |
|
|
file delete $src
|
338 |
|
|
remote_file build delete $obj
|
339 |
|
|
|
340 |
|
|
if [string match "" $lines] then {
|
341 |
|
|
# No error messages, everything is OK.
|
342 |
|
|
set alias_available_saved 2
|
343 |
|
|
} else {
|
344 |
|
|
if [regexp "alias definitions not supported" $lines] {
|
345 |
|
|
verbose "check_alias_available target does not support aliases" 2
|
346 |
|
|
|
347 |
|
|
set objformat [gcc_target_object_format]
|
348 |
|
|
|
349 |
|
|
if { $objformat == "elf" } {
|
350 |
|
|
verbose "check_alias_available but target uses ELF format, so it ought to" 2
|
351 |
|
|
set alias_available_saved -1
|
352 |
|
|
} else {
|
353 |
|
|
set alias_available_saved 0
|
354 |
|
|
}
|
355 |
|
|
} else {
|
356 |
|
|
if [regexp "only weak aliases are supported" $lines] {
|
357 |
|
|
verbose "check_alias_available target supports only weak aliases" 2
|
358 |
|
|
set alias_available_saved 1
|
359 |
|
|
} else {
|
360 |
|
|
set alias_available_saved -1
|
361 |
|
|
}
|
362 |
|
|
}
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
verbose "check_alias_available returning $alias_available_saved" 2
|
366 |
|
|
}
|
367 |
|
|
|
368 |
|
|
return $alias_available_saved
|
369 |
|
|
}
|
370 |
|
|
|
371 |
|
|
# Returns true if --gc-sections is supported on the target.
|
372 |
|
|
|
373 |
|
|
proc check_gc_sections_available { } {
|
374 |
|
|
global gc_sections_available_saved
|
375 |
|
|
global tool
|
376 |
|
|
|
377 |
|
|
if {![info exists gc_sections_available_saved]} {
|
378 |
|
|
# Some targets don't support gc-sections despite whatever's
|
379 |
|
|
# advertised by ld's options.
|
380 |
|
|
if { [istarget alpha*-*-*]
|
381 |
514 |
jeremybenn |
|| [istarget ia64-*-*]
|
382 |
|
|
|| [istarget or32-*-*] } {
|
383 |
306 |
jeremybenn |
set gc_sections_available_saved 0
|
384 |
|
|
return 0
|
385 |
|
|
}
|
386 |
|
|
|
387 |
|
|
# elf2flt uses -q (--emit-relocs), which is incompatible with
|
388 |
|
|
# --gc-sections.
|
389 |
|
|
if { [board_info target exists ldflags]
|
390 |
|
|
&& [regexp " -elf2flt\[ =\]" " [board_info target ldflags] "] } {
|
391 |
|
|
set gc_sections_available_saved 0
|
392 |
|
|
return 0
|
393 |
|
|
}
|
394 |
|
|
|
395 |
|
|
# VxWorks kernel modules are relocatable objects linked with -r,
|
396 |
|
|
# while RTP executables are linked with -q (--emit-relocs).
|
397 |
|
|
# Both of these options are incompatible with --gc-sections.
|
398 |
|
|
if { [istarget *-*-vxworks*] } {
|
399 |
|
|
set gc_sections_available_saved 0
|
400 |
|
|
return 0
|
401 |
|
|
}
|
402 |
|
|
|
403 |
|
|
# Check if the ld used by gcc supports --gc-sections.
|
404 |
|
|
set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
|
405 |
|
|
regsub ".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
|
406 |
|
|
set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
|
407 |
|
|
set ld_output [remote_exec host "$gcc_ld" "--help"]
|
408 |
|
|
if { [ string first "--gc-sections" $ld_output ] >= 0 } {
|
409 |
|
|
set gc_sections_available_saved 1
|
410 |
|
|
} else {
|
411 |
|
|
set gc_sections_available_saved 0
|
412 |
|
|
}
|
413 |
|
|
}
|
414 |
|
|
return $gc_sections_available_saved
|
415 |
|
|
}
|
416 |
|
|
|
417 |
|
|
# Return 1 if according to target_info struct and explicit target list
|
418 |
|
|
# target is supposed to support trampolines.
|
419 |
|
|
|
420 |
|
|
proc check_effective_target_trampolines { } {
|
421 |
|
|
if [target_info exists no_trampolines] {
|
422 |
|
|
return 0
|
423 |
|
|
}
|
424 |
|
|
if { [istarget avr-*-*]
|
425 |
|
|
|| [istarget hppa2.0w-hp-hpux11.23]
|
426 |
|
|
|| [istarget hppa64-hp-hpux11.23] } {
|
427 |
|
|
return 0;
|
428 |
|
|
}
|
429 |
|
|
return 1
|
430 |
|
|
}
|
431 |
|
|
|
432 |
|
|
# Return 1 if according to target_info struct and explicit target list
|
433 |
|
|
# target is supposed to keep null pointer checks. This could be due to
|
434 |
|
|
# use of option fno-delete-null-pointer-checks or hardwired in target.
|
435 |
|
|
|
436 |
|
|
proc check_effective_target_keeps_null_pointer_checks { } {
|
437 |
|
|
if [target_info exists keeps_null_pointer_checks] {
|
438 |
|
|
return 1
|
439 |
|
|
}
|
440 |
|
|
if { [istarget avr-*-*] } {
|
441 |
|
|
return 1;
|
442 |
|
|
}
|
443 |
|
|
return 0
|
444 |
|
|
}
|
445 |
|
|
|
446 |
|
|
# Return true if profiling is supported on the target.
|
447 |
|
|
|
448 |
|
|
proc check_profiling_available { test_what } {
|
449 |
|
|
global profiling_available_saved
|
450 |
|
|
|
451 |
|
|
verbose "Profiling argument is <$test_what>" 1
|
452 |
|
|
|
453 |
|
|
# These conditions depend on the argument so examine them before
|
454 |
|
|
# looking at the cache variable.
|
455 |
|
|
|
456 |
|
|
# Support for -p on solaris2 relies on mcrt1.o which comes with the
|
457 |
|
|
# vendor compiler. We cannot reliably predict the directory where the
|
458 |
|
|
# vendor compiler (and thus mcrt1.o) is installed so we can't
|
459 |
|
|
# necessarily find mcrt1.o even if we have it.
|
460 |
|
|
if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
|
461 |
|
|
return 0
|
462 |
|
|
}
|
463 |
|
|
|
464 |
|
|
# Support for -p on irix relies on libprof1.a which doesn't appear to
|
465 |
|
|
# exist on any irix6 system currently posting testsuite results.
|
466 |
|
|
# Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
|
467 |
|
|
# See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
|
468 |
|
|
if { [istarget mips*-*-irix*]
|
469 |
|
|
&& ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
|
470 |
|
|
return 0
|
471 |
|
|
}
|
472 |
|
|
|
473 |
|
|
# We don't yet support profiling for MIPS16.
|
474 |
|
|
if { [istarget mips*-*-*]
|
475 |
|
|
&& ![check_effective_target_nomips16]
|
476 |
|
|
&& ([lindex $test_what 1] == "-p"
|
477 |
|
|
|| [lindex $test_what 1] == "-pg") } {
|
478 |
|
|
return 0
|
479 |
|
|
}
|
480 |
|
|
|
481 |
|
|
# MinGW does not support -p.
|
482 |
|
|
if { [istarget *-*-mingw*] && [lindex $test_what 1] == "-p" } {
|
483 |
|
|
return 0
|
484 |
|
|
}
|
485 |
|
|
|
486 |
|
|
# cygwin does not support -p.
|
487 |
|
|
if { [istarget *-*-cygwin*] && [lindex $test_what 1] == "-p" } {
|
488 |
|
|
return 0
|
489 |
|
|
}
|
490 |
|
|
|
491 |
|
|
# uClibc does not have gcrt1.o.
|
492 |
|
|
if { [check_effective_target_uclibc]
|
493 |
|
|
&& ([lindex $test_what 1] == "-p"
|
494 |
|
|
|| [lindex $test_what 1] == "-pg") } {
|
495 |
|
|
return 0
|
496 |
|
|
}
|
497 |
|
|
|
498 |
|
|
# Now examine the cache variable.
|
499 |
|
|
if {![info exists profiling_available_saved]} {
|
500 |
|
|
# Some targets don't have any implementation of __bb_init_func or are
|
501 |
|
|
# missing other needed machinery.
|
502 |
|
|
if { [istarget mmix-*-*]
|
503 |
|
|
|| [istarget arm*-*-eabi*]
|
504 |
|
|
|| [istarget picochip-*-*]
|
505 |
|
|
|| [istarget *-*-netware*]
|
506 |
|
|
|| [istarget arm*-*-elf]
|
507 |
|
|
|| [istarget arm*-*-symbianelf*]
|
508 |
|
|
|| [istarget avr-*-*]
|
509 |
|
|
|| [istarget bfin-*-*]
|
510 |
|
|
|| [istarget powerpc-*-eabi*]
|
511 |
|
|
|| [istarget powerpc-*-elf]
|
512 |
|
|
|| [istarget cris-*-*]
|
513 |
|
|
|| [istarget crisv32-*-*]
|
514 |
|
|
|| [istarget fido-*-elf]
|
515 |
|
|
|| [istarget h8300-*-*]
|
516 |
|
|
|| [istarget lm32-*-*]
|
517 |
|
|
|| [istarget m32c-*-elf]
|
518 |
|
|
|| [istarget m68k-*-elf]
|
519 |
|
|
|| [istarget m68k-*-uclinux*]
|
520 |
|
|
|| [istarget mep-*-elf]
|
521 |
|
|
|| [istarget mips*-*-elf*]
|
522 |
|
|
|| [istarget moxie-*-elf*]
|
523 |
399 |
jeremybenn |
|| [istarget or32-*-elf*]
|
524 |
306 |
jeremybenn |
|| [istarget rx-*-*]
|
525 |
|
|
|| [istarget xstormy16-*]
|
526 |
|
|
|| [istarget xtensa*-*-elf]
|
527 |
|
|
|| [istarget *-*-rtems*]
|
528 |
|
|
|| [istarget *-*-vxworks*] } {
|
529 |
|
|
set profiling_available_saved 0
|
530 |
|
|
} else {
|
531 |
|
|
set profiling_available_saved 1
|
532 |
|
|
}
|
533 |
|
|
}
|
534 |
|
|
|
535 |
|
|
return $profiling_available_saved
|
536 |
|
|
}
|
537 |
|
|
|
538 |
|
|
# Check to see if a target is "freestanding". This is as per the definition
|
539 |
|
|
# in Section 4 of C99 standard. Effectively, it is a target which supports no
|
540 |
|
|
# extra headers or libraries other than what is considered essential.
|
541 |
|
|
proc check_effective_target_freestanding { } {
|
542 |
|
|
if { [istarget picochip-*-*] } then {
|
543 |
|
|
return 1
|
544 |
|
|
} else {
|
545 |
|
|
return 0
|
546 |
|
|
}
|
547 |
|
|
}
|
548 |
|
|
|
549 |
|
|
# Return 1 if target has packed layout of structure members by
|
550 |
|
|
# default, 0 otherwise. Note that this is slightly different than
|
551 |
|
|
# whether the target has "natural alignment": both attributes may be
|
552 |
|
|
# false.
|
553 |
|
|
|
554 |
|
|
proc check_effective_target_default_packed { } {
|
555 |
|
|
return [check_no_compiler_messages default_packed assembly {
|
556 |
|
|
struct x { char a; long b; } c;
|
557 |
|
|
int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
|
558 |
|
|
}]
|
559 |
|
|
}
|
560 |
|
|
|
561 |
|
|
# Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
|
562 |
|
|
# documentation, where the test also comes from.
|
563 |
|
|
|
564 |
|
|
proc check_effective_target_pcc_bitfield_type_matters { } {
|
565 |
|
|
# PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
|
566 |
|
|
# bitfields, but let's stick to the example code from the docs.
|
567 |
|
|
return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
|
568 |
|
|
struct foo1 { char x; char :0; char y; };
|
569 |
|
|
struct foo2 { char x; int :0; char y; };
|
570 |
|
|
int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
|
571 |
|
|
}]
|
572 |
|
|
}
|
573 |
|
|
|
574 |
|
|
# Return 1 if thread local storage (TLS) is supported, 0 otherwise.
|
575 |
|
|
|
576 |
|
|
proc check_effective_target_tls {} {
|
577 |
|
|
return [check_no_compiler_messages tls assembly {
|
578 |
|
|
__thread int i;
|
579 |
|
|
int f (void) { return i; }
|
580 |
|
|
void g (int j) { i = j; }
|
581 |
|
|
}]
|
582 |
|
|
}
|
583 |
|
|
|
584 |
|
|
# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
|
585 |
|
|
|
586 |
|
|
proc check_effective_target_tls_native {} {
|
587 |
|
|
# VxWorks uses emulated TLS machinery, but with non-standard helper
|
588 |
|
|
# functions, so we fail to automatically detect it.
|
589 |
|
|
global target_triplet
|
590 |
|
|
if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
|
591 |
|
|
return 0
|
592 |
|
|
}
|
593 |
|
|
|
594 |
|
|
return [check_no_messages_and_pattern tls_native "!emutls" assembly {
|
595 |
|
|
__thread int i;
|
596 |
|
|
int f (void) { return i; }
|
597 |
|
|
void g (int j) { i = j; }
|
598 |
|
|
}]
|
599 |
|
|
}
|
600 |
|
|
|
601 |
|
|
# Return 1 if TLS executables can run correctly, 0 otherwise.
|
602 |
|
|
|
603 |
|
|
proc check_effective_target_tls_runtime {} {
|
604 |
|
|
return [check_runtime tls_runtime {
|
605 |
|
|
__thread int thr = 0;
|
606 |
|
|
int main (void) { return thr; }
|
607 |
|
|
}]
|
608 |
|
|
}
|
609 |
|
|
|
610 |
|
|
# Return 1 if compilation with -fgraphite is error-free for trivial
|
611 |
|
|
# code, 0 otherwise.
|
612 |
|
|
|
613 |
|
|
proc check_effective_target_fgraphite {} {
|
614 |
|
|
return [check_no_compiler_messages fgraphite object {
|
615 |
|
|
void foo (void) { }
|
616 |
|
|
} "-O1 -fgraphite"]
|
617 |
|
|
}
|
618 |
|
|
|
619 |
|
|
# Return 1 if compilation with -fopenmp is error-free for trivial
|
620 |
|
|
# code, 0 otherwise.
|
621 |
|
|
|
622 |
|
|
proc check_effective_target_fopenmp {} {
|
623 |
|
|
return [check_no_compiler_messages fopenmp object {
|
624 |
|
|
void foo (void) { }
|
625 |
|
|
} "-fopenmp"]
|
626 |
|
|
}
|
627 |
|
|
|
628 |
|
|
# Return 1 if compilation with -pthread is error-free for trivial
|
629 |
|
|
# code, 0 otherwise.
|
630 |
|
|
|
631 |
|
|
proc check_effective_target_pthread {} {
|
632 |
|
|
return [check_no_compiler_messages pthread object {
|
633 |
|
|
void foo (void) { }
|
634 |
|
|
} "-pthread"]
|
635 |
|
|
}
|
636 |
|
|
|
637 |
|
|
# Return 1 if compilation with -mpe-aligned-commons is error-free
|
638 |
|
|
# for trivial code, 0 otherwise.
|
639 |
|
|
|
640 |
|
|
proc check_effective_target_pe_aligned_commons {} {
|
641 |
|
|
if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
|
642 |
|
|
return [check_no_compiler_messages pe_aligned_commons object {
|
643 |
|
|
int foo;
|
644 |
|
|
} "-mpe-aligned-commons"]
|
645 |
|
|
}
|
646 |
|
|
return 0
|
647 |
|
|
}
|
648 |
|
|
|
649 |
|
|
# Return 1 if the target supports -static
|
650 |
|
|
proc check_effective_target_static {} {
|
651 |
|
|
return [check_no_compiler_messages static executable {
|
652 |
|
|
int main (void) { return 0; }
|
653 |
|
|
} "-static"]
|
654 |
|
|
}
|
655 |
|
|
|
656 |
|
|
# Return 1 if the target supports -fstack-protector
|
657 |
|
|
proc check_effective_target_fstack_protector {} {
|
658 |
|
|
return [check_runtime fstack_protector {
|
659 |
|
|
int main (void) { return 0; }
|
660 |
|
|
} "-fstack-protector"]
|
661 |
|
|
}
|
662 |
|
|
|
663 |
|
|
# Return 1 if compilation with -freorder-blocks-and-partition is error-free
|
664 |
|
|
# for trivial code, 0 otherwise.
|
665 |
|
|
|
666 |
|
|
proc check_effective_target_freorder {} {
|
667 |
|
|
return [check_no_compiler_messages freorder object {
|
668 |
|
|
void foo (void) { }
|
669 |
|
|
} "-freorder-blocks-and-partition"]
|
670 |
|
|
}
|
671 |
|
|
|
672 |
|
|
# Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
|
673 |
|
|
# emitted, 0 otherwise. Whether a shared library can actually be built is
|
674 |
|
|
# out of scope for this test.
|
675 |
|
|
|
676 |
|
|
proc check_effective_target_fpic { } {
|
677 |
|
|
# Note that M68K has a multilib that supports -fpic but not
|
678 |
|
|
# -fPIC, so we need to check both. We test with a program that
|
679 |
|
|
# requires GOT references.
|
680 |
|
|
foreach arg {fpic fPIC} {
|
681 |
|
|
if [check_no_compiler_messages $arg object {
|
682 |
|
|
extern int foo (void); extern int bar;
|
683 |
|
|
int baz (void) { return foo () + bar; }
|
684 |
|
|
} "-$arg"] {
|
685 |
|
|
return 1
|
686 |
|
|
}
|
687 |
|
|
}
|
688 |
|
|
return 0
|
689 |
|
|
}
|
690 |
|
|
|
691 |
|
|
# Return true if the target supports -mpaired-single (as used on MIPS).
|
692 |
|
|
|
693 |
|
|
proc check_effective_target_mpaired_single { } {
|
694 |
|
|
return [check_no_compiler_messages mpaired_single object {
|
695 |
|
|
void foo (void) { }
|
696 |
|
|
} "-mpaired-single"]
|
697 |
|
|
}
|
698 |
|
|
|
699 |
|
|
# Return true if the target has access to FPU instructions.
|
700 |
|
|
|
701 |
|
|
proc check_effective_target_hard_float { } {
|
702 |
|
|
if { [istarget mips*-*-*] } {
|
703 |
|
|
return [check_no_compiler_messages hard_float assembly {
|
704 |
|
|
#if (defined __mips_soft_float || defined __mips16)
|
705 |
|
|
#error FOO
|
706 |
|
|
#endif
|
707 |
|
|
}]
|
708 |
|
|
}
|
709 |
|
|
|
710 |
|
|
# This proc is actually checking the availabilty of FPU
|
711 |
|
|
# support for doubles, so on the RX we must fail if the
|
712 |
|
|
# 64-bit double multilib has been selected.
|
713 |
|
|
if { [istarget rx-*-*] } {
|
714 |
|
|
return 0
|
715 |
|
|
# return [check_no_compiler_messages hard_float assembly {
|
716 |
|
|
#if defined __RX_64_BIT_DOUBLES__
|
717 |
|
|
#error FOO
|
718 |
|
|
#endif
|
719 |
|
|
# }]
|
720 |
|
|
}
|
721 |
|
|
|
722 |
|
|
# The generic test equates hard_float with "no call for adding doubles".
|
723 |
|
|
return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
|
724 |
|
|
double a (double b, double c) { return b + c; }
|
725 |
|
|
}]
|
726 |
|
|
}
|
727 |
|
|
|
728 |
|
|
# Return true if the target is a 64-bit MIPS target.
|
729 |
|
|
|
730 |
|
|
proc check_effective_target_mips64 { } {
|
731 |
|
|
return [check_no_compiler_messages mips64 assembly {
|
732 |
|
|
#ifndef __mips64
|
733 |
|
|
#error FOO
|
734 |
|
|
#endif
|
735 |
|
|
}]
|
736 |
|
|
}
|
737 |
|
|
|
738 |
|
|
# Return true if the target is a MIPS target that does not produce
|
739 |
|
|
# MIPS16 code.
|
740 |
|
|
|
741 |
|
|
proc check_effective_target_nomips16 { } {
|
742 |
|
|
return [check_no_compiler_messages nomips16 object {
|
743 |
|
|
#ifndef __mips
|
744 |
|
|
#error FOO
|
745 |
|
|
#else
|
746 |
|
|
/* A cheap way of testing for -mflip-mips16. */
|
747 |
|
|
void foo (void) { asm ("addiu $20,$20,1"); }
|
748 |
|
|
void bar (void) { asm ("addiu $20,$20,1"); }
|
749 |
|
|
#endif
|
750 |
|
|
}]
|
751 |
|
|
}
|
752 |
|
|
|
753 |
|
|
# Add the options needed for MIPS16 function attributes. At the moment,
|
754 |
|
|
# we don't support MIPS16 PIC.
|
755 |
|
|
|
756 |
|
|
proc add_options_for_mips16_attribute { flags } {
|
757 |
|
|
return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
|
758 |
|
|
}
|
759 |
|
|
|
760 |
|
|
# Return true if we can force a mode that allows MIPS16 code generation.
|
761 |
|
|
# We don't support MIPS16 PIC, and only support MIPS16 -mhard-float
|
762 |
|
|
# for o32 and o64.
|
763 |
|
|
|
764 |
|
|
proc check_effective_target_mips16_attribute { } {
|
765 |
|
|
return [check_no_compiler_messages mips16_attribute assembly {
|
766 |
|
|
#ifdef PIC
|
767 |
|
|
#error FOO
|
768 |
|
|
#endif
|
769 |
|
|
#if defined __mips_hard_float \
|
770 |
|
|
&& (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
|
771 |
|
|
&& (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
|
772 |
|
|
#error FOO
|
773 |
|
|
#endif
|
774 |
|
|
} [add_options_for_mips16_attribute ""]]
|
775 |
|
|
}
|
776 |
|
|
|
777 |
|
|
# Return 1 if the target supports long double larger than double when
|
778 |
|
|
# using the new ABI, 0 otherwise.
|
779 |
|
|
|
780 |
|
|
proc check_effective_target_mips_newabi_large_long_double { } {
|
781 |
|
|
return [check_no_compiler_messages mips_newabi_large_long_double object {
|
782 |
|
|
int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
|
783 |
|
|
} "-mabi=64"]
|
784 |
|
|
}
|
785 |
|
|
|
786 |
|
|
# Return 1 if the current multilib does not generate PIC by default.
|
787 |
|
|
|
788 |
|
|
proc check_effective_target_nonpic { } {
|
789 |
|
|
return [check_no_compiler_messages nonpic assembly {
|
790 |
|
|
#if __PIC__
|
791 |
|
|
#error FOO
|
792 |
|
|
#endif
|
793 |
|
|
}]
|
794 |
|
|
}
|
795 |
|
|
|
796 |
|
|
# Return 1 if the target does not use a status wrapper.
|
797 |
|
|
|
798 |
|
|
proc check_effective_target_unwrapped { } {
|
799 |
|
|
if { [target_info needs_status_wrapper] != "" \
|
800 |
|
|
&& [target_info needs_status_wrapper] != "0" } {
|
801 |
|
|
return 0
|
802 |
|
|
}
|
803 |
|
|
return 1
|
804 |
|
|
}
|
805 |
|
|
|
806 |
|
|
# Return true if iconv is supported on the target. In particular IBM1047.
|
807 |
|
|
|
808 |
|
|
proc check_iconv_available { test_what } {
|
809 |
|
|
global libiconv
|
810 |
|
|
|
811 |
|
|
# If the tool configuration file has not set libiconv, try "-liconv"
|
812 |
|
|
if { ![info exists libiconv] } {
|
813 |
|
|
set libiconv "-liconv"
|
814 |
|
|
}
|
815 |
|
|
set test_what [lindex $test_what 1]
|
816 |
|
|
return [check_runtime_nocache $test_what [subst {
|
817 |
|
|
#include
|
818 |
|
|
int main (void)
|
819 |
|
|
{
|
820 |
|
|
iconv_t cd;
|
821 |
|
|
|
822 |
|
|
cd = iconv_open ("$test_what", "UTF-8");
|
823 |
|
|
if (cd == (iconv_t) -1)
|
824 |
|
|
return 1;
|
825 |
|
|
return 0;
|
826 |
|
|
}
|
827 |
|
|
}] $libiconv]
|
828 |
|
|
}
|
829 |
|
|
|
830 |
|
|
# Return true if named sections are supported on this target.
|
831 |
|
|
|
832 |
|
|
proc check_named_sections_available { } {
|
833 |
|
|
return [check_no_compiler_messages named_sections assembly {
|
834 |
|
|
int __attribute__ ((section("whatever"))) foo;
|
835 |
|
|
}]
|
836 |
|
|
}
|
837 |
|
|
|
838 |
|
|
# Return 1 if the target supports Fortran real kinds larger than real(8),
|
839 |
|
|
# 0 otherwise.
|
840 |
|
|
#
|
841 |
|
|
# When the target name changes, replace the cached result.
|
842 |
|
|
|
843 |
|
|
proc check_effective_target_fortran_large_real { } {
|
844 |
|
|
return [check_no_compiler_messages fortran_large_real executable {
|
845 |
|
|
! Fortran
|
846 |
|
|
integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
|
847 |
|
|
real(kind=k) :: x
|
848 |
|
|
x = cos (x)
|
849 |
|
|
end
|
850 |
|
|
}]
|
851 |
|
|
}
|
852 |
|
|
|
853 |
|
|
# Return 1 if the target supports Fortran integer kinds larger than
|
854 |
|
|
# integer(8), 0 otherwise.
|
855 |
|
|
#
|
856 |
|
|
# When the target name changes, replace the cached result.
|
857 |
|
|
|
858 |
|
|
proc check_effective_target_fortran_large_int { } {
|
859 |
|
|
return [check_no_compiler_messages fortran_large_int executable {
|
860 |
|
|
! Fortran
|
861 |
|
|
integer,parameter :: k = selected_int_kind (range (0_8) + 1)
|
862 |
|
|
integer(kind=k) :: i
|
863 |
|
|
end
|
864 |
|
|
}]
|
865 |
|
|
}
|
866 |
|
|
|
867 |
|
|
# Return 1 if the target supports Fortran integer(16), 0 otherwise.
|
868 |
|
|
#
|
869 |
|
|
# When the target name changes, replace the cached result.
|
870 |
|
|
|
871 |
|
|
proc check_effective_target_fortran_integer_16 { } {
|
872 |
|
|
return [check_no_compiler_messages fortran_integer_16 executable {
|
873 |
|
|
! Fortran
|
874 |
|
|
integer(16) :: i
|
875 |
|
|
end
|
876 |
|
|
}]
|
877 |
|
|
}
|
878 |
|
|
|
879 |
|
|
# Return 1 if we can statically link libgfortran, 0 otherwise.
|
880 |
|
|
#
|
881 |
|
|
# When the target name changes, replace the cached result.
|
882 |
|
|
|
883 |
|
|
proc check_effective_target_static_libgfortran { } {
|
884 |
|
|
return [check_no_compiler_messages static_libgfortran executable {
|
885 |
|
|
! Fortran
|
886 |
|
|
print *, 'test'
|
887 |
|
|
end
|
888 |
|
|
} "-static"]
|
889 |
|
|
}
|
890 |
|
|
|
891 |
|
|
# Return 1 if the target supports executing 750CL paired-single instructions, 0
|
892 |
|
|
# otherwise. Cache the result.
|
893 |
|
|
|
894 |
|
|
proc check_750cl_hw_available { } {
|
895 |
|
|
return [check_cached_effective_target 750cl_hw_available {
|
896 |
|
|
# If this is not the right target then we can skip the test.
|
897 |
|
|
if { ![istarget powerpc-*paired*] } {
|
898 |
|
|
expr 0
|
899 |
|
|
} else {
|
900 |
|
|
check_runtime_nocache 750cl_hw_available {
|
901 |
|
|
int main()
|
902 |
|
|
{
|
903 |
|
|
#ifdef __MACH__
|
904 |
|
|
asm volatile ("ps_mul v0,v0,v0");
|
905 |
|
|
#else
|
906 |
|
|
asm volatile ("ps_mul 0,0,0");
|
907 |
|
|
#endif
|
908 |
|
|
return 0;
|
909 |
|
|
}
|
910 |
|
|
} "-mpaired"
|
911 |
|
|
}
|
912 |
|
|
}]
|
913 |
|
|
}
|
914 |
|
|
|
915 |
|
|
# Return 1 if the target OS supports running SSE executables, 0
|
916 |
|
|
# otherwise. Cache the result.
|
917 |
|
|
|
918 |
|
|
proc check_sse_os_support_available { } {
|
919 |
|
|
return [check_cached_effective_target sse_os_support_available {
|
920 |
|
|
# If this is not the right target then we can skip the test.
|
921 |
|
|
if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
|
922 |
|
|
expr 0
|
923 |
|
|
} elseif { [istarget i?86-*-solaris2*] } {
|
924 |
|
|
# The Solaris 2 kernel doesn't save and restore SSE registers
|
925 |
|
|
# before Solaris 9 4/04. Before that, executables die with SIGILL.
|
926 |
|
|
check_runtime_nocache sse_os_support_available {
|
927 |
|
|
int main ()
|
928 |
|
|
{
|
929 |
|
|
__asm__ volatile ("movss %xmm2,%xmm1");
|
930 |
|
|
return 0;
|
931 |
|
|
}
|
932 |
|
|
} "-msse"
|
933 |
|
|
} else {
|
934 |
|
|
expr 1
|
935 |
|
|
}
|
936 |
|
|
}]
|
937 |
|
|
}
|
938 |
|
|
|
939 |
|
|
# Return 1 if the target supports executing SSE instructions, 0
|
940 |
|
|
# otherwise. Cache the result.
|
941 |
|
|
|
942 |
|
|
proc check_sse_hw_available { } {
|
943 |
|
|
return [check_cached_effective_target sse_hw_available {
|
944 |
|
|
# If this is not the right target then we can skip the test.
|
945 |
|
|
if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
|
946 |
|
|
expr 0
|
947 |
|
|
} else {
|
948 |
|
|
check_runtime_nocache sse_hw_available {
|
949 |
|
|
#include "cpuid.h"
|
950 |
|
|
int main ()
|
951 |
|
|
{
|
952 |
|
|
unsigned int eax, ebx, ecx, edx = 0;
|
953 |
|
|
if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
|
954 |
|
|
return !(edx & bit_SSE);
|
955 |
|
|
return 1;
|
956 |
|
|
}
|
957 |
|
|
} ""
|
958 |
|
|
}
|
959 |
|
|
}]
|
960 |
|
|
}
|
961 |
|
|
|
962 |
|
|
# Return 1 if the target supports executing SSE2 instructions, 0
|
963 |
|
|
# otherwise. Cache the result.
|
964 |
|
|
|
965 |
|
|
proc check_sse2_hw_available { } {
|
966 |
|
|
return [check_cached_effective_target sse2_hw_available {
|
967 |
|
|
# If this is not the right target then we can skip the test.
|
968 |
|
|
if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
|
969 |
|
|
expr 0
|
970 |
|
|
} else {
|
971 |
|
|
check_runtime_nocache sse2_hw_available {
|
972 |
|
|
#include "cpuid.h"
|
973 |
|
|
int main ()
|
974 |
|
|
{
|
975 |
|
|
unsigned int eax, ebx, ecx, edx = 0;
|
976 |
|
|
if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
|
977 |
|
|
return !(edx & bit_SSE2);
|
978 |
|
|
return 1;
|
979 |
|
|
}
|
980 |
|
|
} ""
|
981 |
|
|
}
|
982 |
|
|
}]
|
983 |
|
|
}
|
984 |
|
|
|
985 |
|
|
# Return 1 if the target supports running SSE executables, 0 otherwise.
|
986 |
|
|
|
987 |
|
|
proc check_effective_target_sse_runtime { } {
|
988 |
|
|
if { [check_sse_hw_available] && [check_sse_os_support_available] } {
|
989 |
|
|
return 1
|
990 |
|
|
} else {
|
991 |
|
|
return 0
|
992 |
|
|
}
|
993 |
|
|
}
|
994 |
|
|
|
995 |
|
|
# Return 1 if the target supports running SSE2 executables, 0 otherwise.
|
996 |
|
|
|
997 |
|
|
proc check_effective_target_sse2_runtime { } {
|
998 |
|
|
if { [check_sse2_hw_available] && [check_sse_os_support_available] } {
|
999 |
|
|
return 1
|
1000 |
|
|
} else {
|
1001 |
|
|
return 0
|
1002 |
|
|
}
|
1003 |
|
|
}
|
1004 |
|
|
|
1005 |
|
|
# Return 1 if the target supports executing VSX instructions, 0
|
1006 |
|
|
# otherwise. Cache the result.
|
1007 |
|
|
|
1008 |
|
|
proc check_vsx_hw_available { } {
|
1009 |
|
|
return [check_cached_effective_target vsx_hw_available {
|
1010 |
|
|
# Some simulators are known to not support VSX instructions.
|
1011 |
|
|
# For now, disable on Darwin
|
1012 |
|
|
if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
|
1013 |
|
|
expr 0
|
1014 |
|
|
} else {
|
1015 |
|
|
set options "-mvsx"
|
1016 |
|
|
check_runtime_nocache vsx_hw_available {
|
1017 |
|
|
int main()
|
1018 |
|
|
{
|
1019 |
|
|
#ifdef __MACH__
|
1020 |
|
|
asm volatile ("xxlor vs0,vs0,vs0");
|
1021 |
|
|
#else
|
1022 |
|
|
asm volatile ("xxlor 0,0,0");
|
1023 |
|
|
#endif
|
1024 |
|
|
return 0;
|
1025 |
|
|
}
|
1026 |
|
|
} $options
|
1027 |
|
|
}
|
1028 |
|
|
}]
|
1029 |
|
|
}
|
1030 |
|
|
|
1031 |
|
|
# Return 1 if the target supports executing AltiVec instructions, 0
|
1032 |
|
|
# otherwise. Cache the result.
|
1033 |
|
|
|
1034 |
|
|
proc check_vmx_hw_available { } {
|
1035 |
|
|
return [check_cached_effective_target vmx_hw_available {
|
1036 |
|
|
# Some simulators are known to not support VMX instructions.
|
1037 |
|
|
if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
|
1038 |
|
|
expr 0
|
1039 |
|
|
} else {
|
1040 |
|
|
# Most targets don't require special flags for this test case, but
|
1041 |
|
|
# Darwin does. Just to be sure, make sure VSX is not enabled for
|
1042 |
|
|
# the altivec tests.
|
1043 |
|
|
if { [istarget *-*-darwin*]
|
1044 |
|
|
|| [istarget *-*-aix*] } {
|
1045 |
|
|
set options "-maltivec -mno-vsx"
|
1046 |
|
|
} else {
|
1047 |
|
|
set options "-mno-vsx"
|
1048 |
|
|
}
|
1049 |
|
|
check_runtime_nocache vmx_hw_available {
|
1050 |
|
|
int main()
|
1051 |
|
|
{
|
1052 |
|
|
#ifdef __MACH__
|
1053 |
|
|
asm volatile ("vor v0,v0,v0");
|
1054 |
|
|
#else
|
1055 |
|
|
asm volatile ("vor 0,0,0");
|
1056 |
|
|
#endif
|
1057 |
|
|
return 0;
|
1058 |
|
|
}
|
1059 |
|
|
} $options
|
1060 |
|
|
}
|
1061 |
|
|
}]
|
1062 |
|
|
}
|
1063 |
|
|
|
1064 |
|
|
# Return 1 if the target supports executing AltiVec and Cell PPU
|
1065 |
|
|
# instructions, 0 otherwise. Cache the result.
|
1066 |
|
|
|
1067 |
|
|
proc check_effective_target_cell_hw { } {
|
1068 |
|
|
return [check_cached_effective_target cell_hw_available {
|
1069 |
|
|
# Some simulators are known to not support VMX and PPU instructions.
|
1070 |
|
|
if { [istarget powerpc-*-eabi*] } {
|
1071 |
|
|
expr 0
|
1072 |
|
|
} else {
|
1073 |
|
|
# Most targets don't require special flags for this test
|
1074 |
|
|
# case, but Darwin and AIX do.
|
1075 |
|
|
if { [istarget *-*-darwin*]
|
1076 |
|
|
|| [istarget *-*-aix*] } {
|
1077 |
|
|
set options "-maltivec -mcpu=cell"
|
1078 |
|
|
} else {
|
1079 |
|
|
set options "-mcpu=cell"
|
1080 |
|
|
}
|
1081 |
|
|
check_runtime_nocache cell_hw_available {
|
1082 |
|
|
int main()
|
1083 |
|
|
{
|
1084 |
|
|
#ifdef __MACH__
|
1085 |
|
|
asm volatile ("vor v0,v0,v0");
|
1086 |
|
|
asm volatile ("lvlx v0,r0,r0");
|
1087 |
|
|
#else
|
1088 |
|
|
asm volatile ("vor 0,0,0");
|
1089 |
|
|
asm volatile ("lvlx 0,0,0");
|
1090 |
|
|
#endif
|
1091 |
|
|
return 0;
|
1092 |
|
|
}
|
1093 |
|
|
} $options
|
1094 |
|
|
}
|
1095 |
|
|
}]
|
1096 |
|
|
}
|
1097 |
|
|
|
1098 |
|
|
# Return 1 if the target supports executing 64-bit instructions, 0
|
1099 |
|
|
# otherwise. Cache the result.
|
1100 |
|
|
|
1101 |
|
|
proc check_effective_target_powerpc64 { } {
|
1102 |
|
|
global powerpc64_available_saved
|
1103 |
|
|
global tool
|
1104 |
|
|
|
1105 |
|
|
if [info exists powerpc64_available_saved] {
|
1106 |
|
|
verbose "check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
|
1107 |
|
|
} else {
|
1108 |
|
|
set powerpc64_available_saved 0
|
1109 |
|
|
|
1110 |
|
|
# Some simulators are known to not support powerpc64 instructions.
|
1111 |
|
|
if { [istarget powerpc-*-eabi*] || [istarget powerpc-ibm-aix*] } {
|
1112 |
|
|
verbose "check_effective_target_powerpc64 returning 0" 2
|
1113 |
|
|
return $powerpc64_available_saved
|
1114 |
|
|
}
|
1115 |
|
|
|
1116 |
|
|
# Set up, compile, and execute a test program containing a 64-bit
|
1117 |
|
|
# instruction. Include the current process ID in the file
|
1118 |
|
|
# names to prevent conflicts with invocations for multiple
|
1119 |
|
|
# testsuites.
|
1120 |
|
|
set src ppc[pid].c
|
1121 |
|
|
set exe ppc[pid].x
|
1122 |
|
|
|
1123 |
|
|
set f [open $src "w"]
|
1124 |
|
|
puts $f "int main() {"
|
1125 |
|
|
puts $f "#ifdef __MACH__"
|
1126 |
|
|
puts $f " asm volatile (\"extsw r0,r0\");"
|
1127 |
|
|
puts $f "#else"
|
1128 |
|
|
puts $f " asm volatile (\"extsw 0,0\");"
|
1129 |
|
|
puts $f "#endif"
|
1130 |
|
|
puts $f " return 0; }"
|
1131 |
|
|
close $f
|
1132 |
|
|
|
1133 |
|
|
set opts "additional_flags=-mcpu=G5"
|
1134 |
|
|
|
1135 |
|
|
verbose "check_effective_target_powerpc64 compiling testfile $src" 2
|
1136 |
|
|
set lines [${tool}_target_compile $src $exe executable "$opts"]
|
1137 |
|
|
file delete $src
|
1138 |
|
|
|
1139 |
|
|
if [string match "" $lines] then {
|
1140 |
|
|
# No error message, compilation succeeded.
|
1141 |
|
|
set result [${tool}_load "./$exe" "" ""]
|
1142 |
|
|
set status [lindex $result 0]
|
1143 |
|
|
remote_file build delete $exe
|
1144 |
|
|
verbose "check_effective_target_powerpc64 testfile status is <$status>" 2
|
1145 |
|
|
|
1146 |
|
|
if { $status == "pass" } then {
|
1147 |
|
|
set powerpc64_available_saved 1
|
1148 |
|
|
}
|
1149 |
|
|
} else {
|
1150 |
|
|
verbose "check_effective_target_powerpc64 testfile compilation failed" 2
|
1151 |
|
|
}
|
1152 |
|
|
}
|
1153 |
|
|
|
1154 |
|
|
return $powerpc64_available_saved
|
1155 |
|
|
}
|
1156 |
|
|
|
1157 |
|
|
# GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
|
1158 |
|
|
# complex float arguments. This affects gfortran tests that call cabsf
|
1159 |
|
|
# in libm built by an earlier compiler. Return 1 if libm uses the same
|
1160 |
|
|
# argument passing as the compiler under test, 0 otherwise.
|
1161 |
|
|
#
|
1162 |
|
|
# When the target name changes, replace the cached result.
|
1163 |
|
|
|
1164 |
|
|
proc check_effective_target_broken_cplxf_arg { } {
|
1165 |
|
|
return [check_cached_effective_target broken_cplxf_arg {
|
1166 |
|
|
# Skip the work for targets known not to be affected.
|
1167 |
|
|
if { ![istarget powerpc64-*-linux*] } {
|
1168 |
|
|
expr 0
|
1169 |
|
|
} elseif { ![is-effective-target lp64] } {
|
1170 |
|
|
expr 0
|
1171 |
|
|
} else {
|
1172 |
|
|
check_runtime_nocache broken_cplxf_arg {
|
1173 |
|
|
#include
|
1174 |
|
|
extern void abort (void);
|
1175 |
|
|
float fabsf (float);
|
1176 |
|
|
float cabsf (_Complex float);
|
1177 |
|
|
int main ()
|
1178 |
|
|
{
|
1179 |
|
|
_Complex float cf;
|
1180 |
|
|
float f;
|
1181 |
|
|
cf = 3 + 4.0fi;
|
1182 |
|
|
f = cabsf (cf);
|
1183 |
|
|
if (fabsf (f - 5.0) > 0.0001)
|
1184 |
|
|
abort ();
|
1185 |
|
|
return 0;
|
1186 |
|
|
}
|
1187 |
|
|
} "-lm"
|
1188 |
|
|
}
|
1189 |
|
|
}]
|
1190 |
|
|
}
|
1191 |
|
|
|
1192 |
|
|
proc check_alpha_max_hw_available { } {
|
1193 |
|
|
return [check_runtime alpha_max_hw_available {
|
1194 |
|
|
int main() { return __builtin_alpha_amask(1<<8) != 0; }
|
1195 |
|
|
}]
|
1196 |
|
|
}
|
1197 |
|
|
|
1198 |
|
|
# Returns true iff the FUNCTION is available on the target system.
|
1199 |
|
|
# (This is essentially a Tcl implementation of Autoconf's
|
1200 |
|
|
# AC_CHECK_FUNC.)
|
1201 |
|
|
|
1202 |
|
|
proc check_function_available { function } {
|
1203 |
|
|
return [check_no_compiler_messages ${function}_available \
|
1204 |
|
|
executable [subst {
|
1205 |
|
|
#ifdef __cplusplus
|
1206 |
|
|
extern "C"
|
1207 |
|
|
#endif
|
1208 |
|
|
char $function ();
|
1209 |
|
|
int main () { $function (); }
|
1210 |
|
|
}]]
|
1211 |
|
|
}
|
1212 |
|
|
|
1213 |
|
|
# Returns true iff "fork" is available on the target system.
|
1214 |
|
|
|
1215 |
|
|
proc check_fork_available {} {
|
1216 |
|
|
return [check_function_available "fork"]
|
1217 |
|
|
}
|
1218 |
|
|
|
1219 |
|
|
# Returns true iff "mkfifo" is available on the target system.
|
1220 |
|
|
|
1221 |
|
|
proc check_mkfifo_available {} {
|
1222 |
|
|
if {[istarget *-*-cygwin*]} {
|
1223 |
|
|
# Cygwin has mkfifo, but support is incomplete.
|
1224 |
|
|
return 0
|
1225 |
|
|
}
|
1226 |
|
|
|
1227 |
|
|
return [check_function_available "mkfifo"]
|
1228 |
|
|
}
|
1229 |
|
|
|
1230 |
|
|
# Returns true iff "__cxa_atexit" is used on the target system.
|
1231 |
|
|
|
1232 |
|
|
proc check_cxa_atexit_available { } {
|
1233 |
|
|
return [check_cached_effective_target cxa_atexit_available {
|
1234 |
|
|
if { [istarget "hppa*-*-hpux10*"] } {
|
1235 |
|
|
# HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
|
1236 |
|
|
expr 0
|
1237 |
|
|
} elseif { [istarget "*-*-vxworks"] } {
|
1238 |
|
|
# vxworks doesn't have __cxa_atexit but subsequent test passes.
|
1239 |
|
|
expr 0
|
1240 |
|
|
} else {
|
1241 |
|
|
check_runtime_nocache cxa_atexit_available {
|
1242 |
|
|
// C++
|
1243 |
|
|
#include
|
1244 |
|
|
static unsigned int count;
|
1245 |
|
|
struct X
|
1246 |
|
|
{
|
1247 |
|
|
X() { count = 1; }
|
1248 |
|
|
~X()
|
1249 |
|
|
{
|
1250 |
|
|
if (count != 3)
|
1251 |
|
|
exit(1);
|
1252 |
|
|
count = 4;
|
1253 |
|
|
}
|
1254 |
|
|
};
|
1255 |
|
|
void f()
|
1256 |
|
|
{
|
1257 |
|
|
static X x;
|
1258 |
|
|
}
|
1259 |
|
|
struct Y
|
1260 |
|
|
{
|
1261 |
|
|
Y() { f(); count = 2; }
|
1262 |
|
|
~Y()
|
1263 |
|
|
{
|
1264 |
|
|
if (count != 2)
|
1265 |
|
|
exit(1);
|
1266 |
|
|
count = 3;
|
1267 |
|
|
}
|
1268 |
|
|
};
|
1269 |
|
|
Y y;
|
1270 |
|
|
int main() { return 0; }
|
1271 |
|
|
}
|
1272 |
|
|
}
|
1273 |
|
|
}]
|
1274 |
|
|
}
|
1275 |
|
|
|
1276 |
|
|
proc check_effective_target_objc2 { } {
|
1277 |
|
|
return [check_no_compiler_messages objc2 object {
|
1278 |
|
|
#ifdef __OBJC2__
|
1279 |
|
|
int dummy[1];
|
1280 |
|
|
#else
|
1281 |
|
|
#error
|
1282 |
|
|
#endif
|
1283 |
|
|
}]
|
1284 |
|
|
}
|
1285 |
|
|
|
1286 |
|
|
proc check_effective_target_next_runtime { } {
|
1287 |
|
|
return [check_no_compiler_messages objc2 object {
|
1288 |
|
|
#ifdef __NEXT_RUNTIME__
|
1289 |
|
|
int dummy[1];
|
1290 |
|
|
#else
|
1291 |
|
|
#error
|
1292 |
|
|
#endif
|
1293 |
|
|
}]
|
1294 |
|
|
}
|
1295 |
|
|
|
1296 |
|
|
# Return 1 if we're generating 32-bit code using default options, 0
|
1297 |
|
|
# otherwise.
|
1298 |
|
|
|
1299 |
|
|
proc check_effective_target_ilp32 { } {
|
1300 |
|
|
return [check_no_compiler_messages ilp32 object {
|
1301 |
|
|
int dummy[sizeof (int) == 4
|
1302 |
|
|
&& sizeof (void *) == 4
|
1303 |
|
|
&& sizeof (long) == 4 ? 1 : -1];
|
1304 |
|
|
}]
|
1305 |
|
|
}
|
1306 |
|
|
|
1307 |
|
|
# Return 1 if we're generating 32-bit or larger integers using default
|
1308 |
|
|
# options, 0 otherwise.
|
1309 |
|
|
|
1310 |
|
|
proc check_effective_target_int32plus { } {
|
1311 |
|
|
return [check_no_compiler_messages int32plus object {
|
1312 |
|
|
int dummy[sizeof (int) >= 4 ? 1 : -1];
|
1313 |
|
|
}]
|
1314 |
|
|
}
|
1315 |
|
|
|
1316 |
|
|
# Return 1 if we're generating 32-bit or larger pointers using default
|
1317 |
|
|
# options, 0 otherwise.
|
1318 |
|
|
|
1319 |
|
|
proc check_effective_target_ptr32plus { } {
|
1320 |
|
|
return [check_no_compiler_messages ptr32plus object {
|
1321 |
|
|
int dummy[sizeof (void *) >= 4 ? 1 : -1];
|
1322 |
|
|
}]
|
1323 |
|
|
}
|
1324 |
|
|
|
1325 |
|
|
# Return 1 if we support 32-bit or larger array and structure sizes
|
1326 |
|
|
# using default options, 0 otherwise.
|
1327 |
|
|
|
1328 |
|
|
proc check_effective_target_size32plus { } {
|
1329 |
|
|
return [check_no_compiler_messages size32plus object {
|
1330 |
|
|
char dummy[65537];
|
1331 |
|
|
}]
|
1332 |
|
|
}
|
1333 |
|
|
|
1334 |
|
|
# Returns 1 if we're generating 16-bit or smaller integers with the
|
1335 |
|
|
# default options, 0 otherwise.
|
1336 |
|
|
|
1337 |
|
|
proc check_effective_target_int16 { } {
|
1338 |
|
|
return [check_no_compiler_messages int16 object {
|
1339 |
|
|
int dummy[sizeof (int) < 4 ? 1 : -1];
|
1340 |
|
|
}]
|
1341 |
|
|
}
|
1342 |
|
|
|
1343 |
|
|
# Return 1 if we're generating 64-bit code using default options, 0
|
1344 |
|
|
# otherwise.
|
1345 |
|
|
|
1346 |
|
|
proc check_effective_target_lp64 { } {
|
1347 |
|
|
return [check_no_compiler_messages lp64 object {
|
1348 |
|
|
int dummy[sizeof (int) == 4
|
1349 |
|
|
&& sizeof (void *) == 8
|
1350 |
|
|
&& sizeof (long) == 8 ? 1 : -1];
|
1351 |
|
|
}]
|
1352 |
|
|
}
|
1353 |
|
|
|
1354 |
|
|
# Return 1 if we're generating 64-bit code using default llp64 options,
|
1355 |
|
|
# 0 otherwise.
|
1356 |
|
|
|
1357 |
|
|
proc check_effective_target_llp64 { } {
|
1358 |
|
|
return [check_no_compiler_messages llp64 object {
|
1359 |
|
|
int dummy[sizeof (int) == 4
|
1360 |
|
|
&& sizeof (void *) == 8
|
1361 |
|
|
&& sizeof (long long) == 8
|
1362 |
|
|
&& sizeof (long) == 4 ? 1 : -1];
|
1363 |
|
|
}]
|
1364 |
|
|
}
|
1365 |
|
|
|
1366 |
|
|
# Return 1 if the target supports long double larger than double,
|
1367 |
|
|
# 0 otherwise.
|
1368 |
|
|
|
1369 |
|
|
proc check_effective_target_large_long_double { } {
|
1370 |
|
|
return [check_no_compiler_messages large_long_double object {
|
1371 |
|
|
int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
|
1372 |
|
|
}]
|
1373 |
|
|
}
|
1374 |
|
|
|
1375 |
|
|
# Return 1 if the target supports double larger than float,
|
1376 |
|
|
# 0 otherwise.
|
1377 |
|
|
|
1378 |
|
|
proc check_effective_target_large_double { } {
|
1379 |
|
|
return [check_no_compiler_messages large_double object {
|
1380 |
|
|
int dummy[sizeof(double) > sizeof(float) ? 1 : -1];
|
1381 |
|
|
}]
|
1382 |
|
|
}
|
1383 |
|
|
|
1384 |
|
|
# Return 1 if the target supports double of 64 bits,
|
1385 |
|
|
# 0 otherwise.
|
1386 |
|
|
|
1387 |
|
|
proc check_effective_target_double64 { } {
|
1388 |
|
|
return [check_no_compiler_messages double64 object {
|
1389 |
|
|
int dummy[sizeof(double) == 8 ? 1 : -1];
|
1390 |
|
|
}]
|
1391 |
|
|
}
|
1392 |
|
|
|
1393 |
|
|
# Return 1 if the target supports double of at least 64 bits,
|
1394 |
|
|
# 0 otherwise.
|
1395 |
|
|
|
1396 |
|
|
proc check_effective_target_double64plus { } {
|
1397 |
|
|
return [check_no_compiler_messages double64plus object {
|
1398 |
|
|
int dummy[sizeof(double) >= 8 ? 1 : -1];
|
1399 |
|
|
}]
|
1400 |
|
|
}
|
1401 |
|
|
|
1402 |
|
|
# Return 1 if the target supports compiling fixed-point,
|
1403 |
|
|
# 0 otherwise.
|
1404 |
|
|
|
1405 |
|
|
proc check_effective_target_fixed_point { } {
|
1406 |
|
|
return [check_no_compiler_messages fixed_point object {
|
1407 |
|
|
_Sat _Fract x; _Sat _Accum y;
|
1408 |
|
|
}]
|
1409 |
|
|
}
|
1410 |
|
|
|
1411 |
|
|
# Return 1 if the target supports compiling decimal floating point,
|
1412 |
|
|
# 0 otherwise.
|
1413 |
|
|
|
1414 |
|
|
proc check_effective_target_dfp_nocache { } {
|
1415 |
|
|
verbose "check_effective_target_dfp_nocache: compiling source" 2
|
1416 |
|
|
set ret [check_no_compiler_messages_nocache dfp object {
|
1417 |
|
|
float x __attribute__((mode(DD)));
|
1418 |
|
|
}]
|
1419 |
|
|
verbose "check_effective_target_dfp_nocache: returning $ret" 2
|
1420 |
|
|
return $ret
|
1421 |
|
|
}
|
1422 |
|
|
|
1423 |
|
|
proc check_effective_target_dfprt_nocache { } {
|
1424 |
|
|
return [check_runtime_nocache dfprt {
|
1425 |
|
|
typedef float d64 __attribute__((mode(DD)));
|
1426 |
|
|
d64 x = 1.2df, y = 2.3dd, z;
|
1427 |
|
|
int main () { z = x + y; return 0; }
|
1428 |
|
|
}]
|
1429 |
|
|
}
|
1430 |
|
|
|
1431 |
|
|
# Return 1 if the target supports compiling Decimal Floating Point,
|
1432 |
|
|
# 0 otherwise.
|
1433 |
|
|
#
|
1434 |
|
|
# This won't change for different subtargets so cache the result.
|
1435 |
|
|
|
1436 |
|
|
proc check_effective_target_dfp { } {
|
1437 |
|
|
return [check_cached_effective_target dfp {
|
1438 |
|
|
check_effective_target_dfp_nocache
|
1439 |
|
|
}]
|
1440 |
|
|
}
|
1441 |
|
|
|
1442 |
|
|
# Return 1 if the target supports linking and executing Decimal Floating
|
1443 |
|
|
# Point, 0 otherwise.
|
1444 |
|
|
#
|
1445 |
|
|
# This won't change for different subtargets so cache the result.
|
1446 |
|
|
|
1447 |
|
|
proc check_effective_target_dfprt { } {
|
1448 |
|
|
return [check_cached_effective_target dfprt {
|
1449 |
|
|
check_effective_target_dfprt_nocache
|
1450 |
|
|
}]
|
1451 |
|
|
}
|
1452 |
|
|
|
1453 |
|
|
# Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
|
1454 |
|
|
|
1455 |
|
|
proc check_effective_target_ucn_nocache { } {
|
1456 |
|
|
# -std=c99 is only valid for C
|
1457 |
|
|
if [check_effective_target_c] {
|
1458 |
|
|
set ucnopts "-std=c99"
|
1459 |
|
|
}
|
1460 |
|
|
append ucnopts " -fextended-identifiers"
|
1461 |
|
|
verbose "check_effective_target_ucn_nocache: compiling source" 2
|
1462 |
|
|
set ret [check_no_compiler_messages_nocache ucn object {
|
1463 |
|
|
int \u00C0;
|
1464 |
|
|
} $ucnopts]
|
1465 |
|
|
verbose "check_effective_target_ucn_nocache: returning $ret" 2
|
1466 |
|
|
return $ret
|
1467 |
|
|
}
|
1468 |
|
|
|
1469 |
|
|
# Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
|
1470 |
|
|
#
|
1471 |
|
|
# This won't change for different subtargets, so cache the result.
|
1472 |
|
|
|
1473 |
|
|
proc check_effective_target_ucn { } {
|
1474 |
|
|
return [check_cached_effective_target ucn {
|
1475 |
|
|
check_effective_target_ucn_nocache
|
1476 |
|
|
}]
|
1477 |
|
|
}
|
1478 |
|
|
|
1479 |
|
|
# Return 1 if the target needs a command line argument to enable a SIMD
|
1480 |
|
|
# instruction set.
|
1481 |
|
|
|
1482 |
|
|
proc check_effective_target_vect_cmdline_needed { } {
|
1483 |
|
|
global et_vect_cmdline_needed_saved
|
1484 |
|
|
global et_vect_cmdline_needed_target_name
|
1485 |
|
|
|
1486 |
|
|
if { ![info exists et_vect_cmdline_needed_target_name] } {
|
1487 |
|
|
set et_vect_cmdline_needed_target_name ""
|
1488 |
|
|
}
|
1489 |
|
|
|
1490 |
|
|
# If the target has changed since we set the cached value, clear it.
|
1491 |
|
|
set current_target [current_target_name]
|
1492 |
|
|
if { $current_target != $et_vect_cmdline_needed_target_name } {
|
1493 |
|
|
verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2
|
1494 |
|
|
set et_vect_cmdline_needed_target_name $current_target
|
1495 |
|
|
if { [info exists et_vect_cmdline_needed_saved] } {
|
1496 |
|
|
verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
|
1497 |
|
|
unset et_vect_cmdline_needed_saved
|
1498 |
|
|
}
|
1499 |
|
|
}
|
1500 |
|
|
|
1501 |
|
|
if [info exists et_vect_cmdline_needed_saved] {
|
1502 |
|
|
verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
|
1503 |
|
|
} else {
|
1504 |
|
|
set et_vect_cmdline_needed_saved 1
|
1505 |
|
|
if { [istarget alpha*-*-*]
|
1506 |
|
|
|| [istarget ia64-*-*]
|
1507 |
|
|
|| (([istarget x86_64-*-*] || [istarget i?86-*-*])
|
1508 |
|
|
&& [check_effective_target_lp64])
|
1509 |
|
|
|| ([istarget powerpc*-*-*]
|
1510 |
|
|
&& ([check_effective_target_powerpc_spe]
|
1511 |
|
|
|| [check_effective_target_powerpc_altivec]))
|
1512 |
|
|
|| [istarget spu-*-*]
|
1513 |
|
|
|| ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
|
1514 |
|
|
set et_vect_cmdline_needed_saved 0
|
1515 |
|
|
}
|
1516 |
|
|
}
|
1517 |
|
|
|
1518 |
|
|
verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
|
1519 |
|
|
return $et_vect_cmdline_needed_saved
|
1520 |
|
|
}
|
1521 |
|
|
|
1522 |
|
|
# Return 1 if the target supports hardware vectors of int, 0 otherwise.
|
1523 |
|
|
#
|
1524 |
|
|
# This won't change for different subtargets so cache the result.
|
1525 |
|
|
|
1526 |
|
|
proc check_effective_target_vect_int { } {
|
1527 |
|
|
global et_vect_int_saved
|
1528 |
|
|
|
1529 |
|
|
if [info exists et_vect_int_saved] {
|
1530 |
|
|
verbose "check_effective_target_vect_int: using cached result" 2
|
1531 |
|
|
} else {
|
1532 |
|
|
set et_vect_int_saved 0
|
1533 |
|
|
if { [istarget i?86-*-*]
|
1534 |
|
|
|| ([istarget powerpc*-*-*]
|
1535 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1536 |
|
|
|| [istarget spu-*-*]
|
1537 |
|
|
|| [istarget x86_64-*-*]
|
1538 |
|
|
|| [istarget sparc*-*-*]
|
1539 |
|
|
|| [istarget alpha*-*-*]
|
1540 |
|
|
|| [istarget ia64-*-*]
|
1541 |
|
|
|| [check_effective_target_arm32] } {
|
1542 |
|
|
set et_vect_int_saved 1
|
1543 |
|
|
}
|
1544 |
|
|
}
|
1545 |
|
|
|
1546 |
|
|
verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
|
1547 |
|
|
return $et_vect_int_saved
|
1548 |
|
|
}
|
1549 |
|
|
|
1550 |
|
|
# Return 1 if the target supports signed int->float conversion
|
1551 |
|
|
#
|
1552 |
|
|
|
1553 |
|
|
proc check_effective_target_vect_intfloat_cvt { } {
|
1554 |
|
|
global et_vect_intfloat_cvt_saved
|
1555 |
|
|
|
1556 |
|
|
if [info exists et_vect_intfloat_cvt_saved] {
|
1557 |
|
|
verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
|
1558 |
|
|
} else {
|
1559 |
|
|
set et_vect_intfloat_cvt_saved 0
|
1560 |
|
|
if { [istarget i?86-*-*]
|
1561 |
|
|
|| ([istarget powerpc*-*-*]
|
1562 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1563 |
|
|
|| [istarget x86_64-*-*] } {
|
1564 |
|
|
set et_vect_intfloat_cvt_saved 1
|
1565 |
|
|
}
|
1566 |
|
|
}
|
1567 |
|
|
|
1568 |
|
|
verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
|
1569 |
|
|
return $et_vect_intfloat_cvt_saved
|
1570 |
|
|
}
|
1571 |
|
|
|
1572 |
|
|
|
1573 |
|
|
# Return 1 if the target supports unsigned int->float conversion
|
1574 |
|
|
#
|
1575 |
|
|
|
1576 |
|
|
proc check_effective_target_vect_uintfloat_cvt { } {
|
1577 |
|
|
global et_vect_uintfloat_cvt_saved
|
1578 |
|
|
|
1579 |
|
|
if [info exists et_vect_uintfloat_cvt_saved] {
|
1580 |
|
|
verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
|
1581 |
|
|
} else {
|
1582 |
|
|
set et_vect_uintfloat_cvt_saved 0
|
1583 |
|
|
if { [istarget i?86-*-*]
|
1584 |
|
|
|| ([istarget powerpc*-*-*]
|
1585 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1586 |
|
|
|| [istarget x86_64-*-*] } {
|
1587 |
|
|
set et_vect_uintfloat_cvt_saved 1
|
1588 |
|
|
}
|
1589 |
|
|
}
|
1590 |
|
|
|
1591 |
|
|
verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
|
1592 |
|
|
return $et_vect_uintfloat_cvt_saved
|
1593 |
|
|
}
|
1594 |
|
|
|
1595 |
|
|
|
1596 |
|
|
# Return 1 if the target supports signed float->int conversion
|
1597 |
|
|
#
|
1598 |
|
|
|
1599 |
|
|
proc check_effective_target_vect_floatint_cvt { } {
|
1600 |
|
|
global et_vect_floatint_cvt_saved
|
1601 |
|
|
|
1602 |
|
|
if [info exists et_vect_floatint_cvt_saved] {
|
1603 |
|
|
verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
|
1604 |
|
|
} else {
|
1605 |
|
|
set et_vect_floatint_cvt_saved 0
|
1606 |
|
|
if { [istarget i?86-*-*]
|
1607 |
|
|
|| ([istarget powerpc*-*-*]
|
1608 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1609 |
|
|
|| [istarget x86_64-*-*] } {
|
1610 |
|
|
set et_vect_floatint_cvt_saved 1
|
1611 |
|
|
}
|
1612 |
|
|
}
|
1613 |
|
|
|
1614 |
|
|
verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
|
1615 |
|
|
return $et_vect_floatint_cvt_saved
|
1616 |
|
|
}
|
1617 |
|
|
|
1618 |
|
|
# Return 1 if the target supports unsigned float->int conversion
|
1619 |
|
|
#
|
1620 |
|
|
|
1621 |
|
|
proc check_effective_target_vect_floatuint_cvt { } {
|
1622 |
|
|
global et_vect_floatuint_cvt_saved
|
1623 |
|
|
|
1624 |
|
|
if [info exists et_vect_floatuint_cvt_saved] {
|
1625 |
|
|
verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
|
1626 |
|
|
} else {
|
1627 |
|
|
set et_vect_floatuint_cvt_saved 0
|
1628 |
|
|
if { ([istarget powerpc*-*-*]
|
1629 |
|
|
&& ![istarget powerpc-*-linux*paired*]) } {
|
1630 |
|
|
set et_vect_floatuint_cvt_saved 1
|
1631 |
|
|
}
|
1632 |
|
|
}
|
1633 |
|
|
|
1634 |
|
|
verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
|
1635 |
|
|
return $et_vect_floatuint_cvt_saved
|
1636 |
|
|
}
|
1637 |
|
|
|
1638 |
|
|
# Return 1 is this is an arm target using 32-bit instructions
|
1639 |
|
|
proc check_effective_target_arm32 { } {
|
1640 |
|
|
return [check_no_compiler_messages arm32 assembly {
|
1641 |
|
|
#if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
|
1642 |
|
|
#error FOO
|
1643 |
|
|
#endif
|
1644 |
|
|
}]
|
1645 |
|
|
}
|
1646 |
|
|
|
1647 |
|
|
# Return 1 if this is an ARM target supporting -mfpu=vfp
|
1648 |
|
|
# -mfloat-abi=softfp. Some multilibs may be incompatible with these
|
1649 |
|
|
# options.
|
1650 |
|
|
|
1651 |
|
|
proc check_effective_target_arm_vfp_ok { } {
|
1652 |
|
|
if { [check_effective_target_arm32] } {
|
1653 |
|
|
return [check_no_compiler_messages arm_vfp_ok object {
|
1654 |
|
|
int dummy;
|
1655 |
|
|
} "-mfpu=vfp -mfloat-abi=softfp"]
|
1656 |
|
|
} else {
|
1657 |
|
|
return 0
|
1658 |
|
|
}
|
1659 |
|
|
}
|
1660 |
|
|
|
1661 |
|
|
# Return 1 if this is an ARM target supporting -mfpu=vfp
|
1662 |
|
|
# -mfloat-abi=hard. Some multilibs may be incompatible with these
|
1663 |
|
|
# options.
|
1664 |
|
|
|
1665 |
|
|
proc check_effective_target_arm_hard_vfp_ok { } {
|
1666 |
|
|
if { [check_effective_target_arm32] } {
|
1667 |
|
|
return [check_no_compiler_messages arm_hard_vfp_ok executable {
|
1668 |
|
|
int main() { return 0;}
|
1669 |
|
|
} "-mfpu=vfp -mfloat-abi=hard"]
|
1670 |
|
|
} else {
|
1671 |
|
|
return 0
|
1672 |
|
|
}
|
1673 |
|
|
}
|
1674 |
|
|
|
1675 |
|
|
# Return 1 if this is an ARM target supporting -mfpu=neon
|
1676 |
|
|
# -mfloat-abi=softfp. Some multilibs may be incompatible with these
|
1677 |
|
|
# options.
|
1678 |
|
|
|
1679 |
|
|
proc check_effective_target_arm_neon_ok { } {
|
1680 |
|
|
if { [check_effective_target_arm32] } {
|
1681 |
|
|
return [check_no_compiler_messages arm_neon_ok object {
|
1682 |
|
|
#include "arm_neon.h"
|
1683 |
|
|
int dummy;
|
1684 |
|
|
} "-mfpu=neon -mfloat-abi=softfp"]
|
1685 |
|
|
} else {
|
1686 |
|
|
return 0
|
1687 |
|
|
}
|
1688 |
|
|
}
|
1689 |
|
|
|
1690 |
|
|
# Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
|
1691 |
|
|
# used.
|
1692 |
|
|
|
1693 |
|
|
proc check_effective_target_arm_thumb1_ok { } {
|
1694 |
|
|
return [check_no_compiler_messages arm_thumb1_ok assembly {
|
1695 |
|
|
#if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
|
1696 |
|
|
#error FOO
|
1697 |
|
|
#endif
|
1698 |
|
|
} "-mthumb"]
|
1699 |
|
|
}
|
1700 |
|
|
|
1701 |
|
|
# Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be
|
1702 |
|
|
# used.
|
1703 |
|
|
|
1704 |
|
|
proc check_effective_target_arm_thumb2_ok { } {
|
1705 |
|
|
return [check_no_compiler_messages arm_thumb2_ok assembly {
|
1706 |
|
|
#if !defined(__thumb2__)
|
1707 |
|
|
#error FOO
|
1708 |
|
|
#endif
|
1709 |
|
|
} "-mthumb"]
|
1710 |
|
|
}
|
1711 |
|
|
|
1712 |
|
|
# Return 1 if the target supports executing NEON instructions, 0
|
1713 |
|
|
# otherwise. Cache the result.
|
1714 |
|
|
|
1715 |
|
|
proc check_effective_target_arm_neon_hw { } {
|
1716 |
|
|
return [check_runtime arm_neon_hw_available {
|
1717 |
|
|
int
|
1718 |
|
|
main (void)
|
1719 |
|
|
{
|
1720 |
|
|
long long a = 0, b = 1;
|
1721 |
|
|
asm ("vorr %P0, %P1, %P2"
|
1722 |
|
|
: "=w" (a)
|
1723 |
|
|
: "0" (a), "w" (b));
|
1724 |
|
|
return (a != 1);
|
1725 |
|
|
}
|
1726 |
|
|
} "-mfpu=neon -mfloat-abi=softfp"]
|
1727 |
|
|
}
|
1728 |
|
|
|
1729 |
|
|
# Return 1 if this is a ARM target with NEON enabled.
|
1730 |
|
|
|
1731 |
|
|
proc check_effective_target_arm_neon { } {
|
1732 |
|
|
if { [check_effective_target_arm32] } {
|
1733 |
|
|
return [check_no_compiler_messages arm_neon object {
|
1734 |
|
|
#ifndef __ARM_NEON__
|
1735 |
|
|
#error not NEON
|
1736 |
|
|
#else
|
1737 |
|
|
int dummy;
|
1738 |
|
|
#endif
|
1739 |
|
|
}]
|
1740 |
|
|
} else {
|
1741 |
|
|
return 0
|
1742 |
|
|
}
|
1743 |
|
|
}
|
1744 |
|
|
|
1745 |
|
|
# Return 1 if this a Loongson-2E or -2F target using an ABI that supports
|
1746 |
|
|
# the Loongson vector modes.
|
1747 |
|
|
|
1748 |
|
|
proc check_effective_target_mips_loongson { } {
|
1749 |
|
|
return [check_no_compiler_messages loongson assembly {
|
1750 |
|
|
#if !defined(__mips_loongson_vector_rev)
|
1751 |
|
|
#error FOO
|
1752 |
|
|
#endif
|
1753 |
|
|
}]
|
1754 |
|
|
}
|
1755 |
|
|
|
1756 |
|
|
# Return 1 if this is an ARM target that adheres to the ABI for the ARM
|
1757 |
|
|
# Architecture.
|
1758 |
|
|
|
1759 |
|
|
proc check_effective_target_arm_eabi { } {
|
1760 |
|
|
return [check_no_compiler_messages arm_eabi object {
|
1761 |
|
|
#ifndef __ARM_EABI__
|
1762 |
|
|
#error not EABI
|
1763 |
|
|
#else
|
1764 |
|
|
int dummy;
|
1765 |
|
|
#endif
|
1766 |
|
|
}]
|
1767 |
|
|
}
|
1768 |
|
|
|
1769 |
|
|
# Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
|
1770 |
|
|
# Some multilibs may be incompatible with this option.
|
1771 |
|
|
|
1772 |
|
|
proc check_effective_target_arm_iwmmxt_ok { } {
|
1773 |
|
|
if { [check_effective_target_arm32] } {
|
1774 |
|
|
return [check_no_compiler_messages arm_iwmmxt_ok object {
|
1775 |
|
|
int dummy;
|
1776 |
|
|
} "-mcpu=iwmmxt"]
|
1777 |
|
|
} else {
|
1778 |
|
|
return 0
|
1779 |
|
|
}
|
1780 |
|
|
}
|
1781 |
|
|
|
1782 |
|
|
# Return 1 if this is a PowerPC target with floating-point registers.
|
1783 |
|
|
|
1784 |
|
|
proc check_effective_target_powerpc_fprs { } {
|
1785 |
|
|
if { [istarget powerpc*-*-*]
|
1786 |
|
|
|| [istarget rs6000-*-*] } {
|
1787 |
|
|
return [check_no_compiler_messages powerpc_fprs object {
|
1788 |
|
|
#ifdef __NO_FPRS__
|
1789 |
|
|
#error no FPRs
|
1790 |
|
|
#else
|
1791 |
|
|
int dummy;
|
1792 |
|
|
#endif
|
1793 |
|
|
}]
|
1794 |
|
|
} else {
|
1795 |
|
|
return 0
|
1796 |
|
|
}
|
1797 |
|
|
}
|
1798 |
|
|
|
1799 |
|
|
# Return 1 if this is a PowerPC target with hardware double-precision
|
1800 |
|
|
# floating point.
|
1801 |
|
|
|
1802 |
|
|
proc check_effective_target_powerpc_hard_double { } {
|
1803 |
|
|
if { [istarget powerpc*-*-*]
|
1804 |
|
|
|| [istarget rs6000-*-*] } {
|
1805 |
|
|
return [check_no_compiler_messages powerpc_hard_double object {
|
1806 |
|
|
#ifdef _SOFT_DOUBLE
|
1807 |
|
|
#error soft double
|
1808 |
|
|
#else
|
1809 |
|
|
int dummy;
|
1810 |
|
|
#endif
|
1811 |
|
|
}]
|
1812 |
|
|
} else {
|
1813 |
|
|
return 0
|
1814 |
|
|
}
|
1815 |
|
|
}
|
1816 |
|
|
|
1817 |
|
|
# Return 1 if this is a PowerPC target supporting -maltivec.
|
1818 |
|
|
|
1819 |
|
|
proc check_effective_target_powerpc_altivec_ok { } {
|
1820 |
|
|
if { ([istarget powerpc*-*-*]
|
1821 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1822 |
|
|
|| [istarget rs6000-*-*] } {
|
1823 |
|
|
# AltiVec is not supported on AIX before 5.3.
|
1824 |
|
|
if { [istarget powerpc*-*-aix4*]
|
1825 |
|
|
|| [istarget powerpc*-*-aix5.1*]
|
1826 |
|
|
|| [istarget powerpc*-*-aix5.2*] } {
|
1827 |
|
|
return 0
|
1828 |
|
|
}
|
1829 |
|
|
return [check_no_compiler_messages powerpc_altivec_ok object {
|
1830 |
|
|
int dummy;
|
1831 |
|
|
} "-maltivec"]
|
1832 |
|
|
} else {
|
1833 |
|
|
return 0
|
1834 |
|
|
}
|
1835 |
|
|
}
|
1836 |
|
|
|
1837 |
|
|
# Return 1 if this is a PowerPC target supporting -mvsx
|
1838 |
|
|
|
1839 |
|
|
proc check_effective_target_powerpc_vsx_ok { } {
|
1840 |
|
|
if { ([istarget powerpc*-*-*]
|
1841 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1842 |
|
|
|| [istarget rs6000-*-*] } {
|
1843 |
|
|
# AltiVec is not supported on AIX before 5.3.
|
1844 |
|
|
if { [istarget powerpc*-*-aix4*]
|
1845 |
|
|
|| [istarget powerpc*-*-aix5.1*]
|
1846 |
|
|
|| [istarget powerpc*-*-aix5.2*] } {
|
1847 |
|
|
return 0
|
1848 |
|
|
}
|
1849 |
|
|
return [check_no_compiler_messages powerpc_vsx_ok object {
|
1850 |
|
|
int main (void) {
|
1851 |
|
|
#ifdef __MACH__
|
1852 |
|
|
asm volatile ("xxlor vs0,vs0,vs0");
|
1853 |
|
|
#else
|
1854 |
|
|
asm volatile ("xxlor 0,0,0");
|
1855 |
|
|
#endif
|
1856 |
|
|
return 0;
|
1857 |
|
|
}
|
1858 |
|
|
} "-mvsx"]
|
1859 |
|
|
} else {
|
1860 |
|
|
return 0
|
1861 |
|
|
}
|
1862 |
|
|
}
|
1863 |
|
|
|
1864 |
|
|
# Return 1 if this is a PowerPC target supporting -mcpu=cell.
|
1865 |
|
|
|
1866 |
|
|
proc check_effective_target_powerpc_ppu_ok { } {
|
1867 |
|
|
if [check_effective_target_powerpc_altivec_ok] {
|
1868 |
|
|
return [check_no_compiler_messages cell_asm_available object {
|
1869 |
|
|
int main (void) {
|
1870 |
|
|
#ifdef __MACH__
|
1871 |
|
|
asm volatile ("lvlx v0,v0,v0");
|
1872 |
|
|
#else
|
1873 |
|
|
asm volatile ("lvlx 0,0,0");
|
1874 |
|
|
#endif
|
1875 |
|
|
return 0;
|
1876 |
|
|
}
|
1877 |
|
|
}]
|
1878 |
|
|
} else {
|
1879 |
|
|
return 0
|
1880 |
|
|
}
|
1881 |
|
|
}
|
1882 |
|
|
|
1883 |
|
|
# Return 1 if this is a PowerPC target that supports SPU.
|
1884 |
|
|
|
1885 |
|
|
proc check_effective_target_powerpc_spu { } {
|
1886 |
|
|
if [istarget powerpc*-*-linux*] {
|
1887 |
|
|
return [check_effective_target_powerpc_altivec_ok]
|
1888 |
|
|
} else {
|
1889 |
|
|
return 0
|
1890 |
|
|
}
|
1891 |
|
|
}
|
1892 |
|
|
|
1893 |
|
|
# Return 1 if this is a PowerPC SPE target. The check includes options
|
1894 |
|
|
# specified by dg-options for this test, so don't cache the result.
|
1895 |
|
|
|
1896 |
|
|
proc check_effective_target_powerpc_spe_nocache { } {
|
1897 |
|
|
if { [istarget powerpc*-*-*] } {
|
1898 |
|
|
return [check_no_compiler_messages_nocache powerpc_spe object {
|
1899 |
|
|
#ifndef __SPE__
|
1900 |
|
|
#error not SPE
|
1901 |
|
|
#else
|
1902 |
|
|
int dummy;
|
1903 |
|
|
#endif
|
1904 |
|
|
} [current_compiler_flags]]
|
1905 |
|
|
} else {
|
1906 |
|
|
return 0
|
1907 |
|
|
}
|
1908 |
|
|
}
|
1909 |
|
|
|
1910 |
|
|
# Return 1 if this is a PowerPC target with SPE enabled.
|
1911 |
|
|
|
1912 |
|
|
proc check_effective_target_powerpc_spe { } {
|
1913 |
|
|
if { [istarget powerpc*-*-*] } {
|
1914 |
|
|
return [check_no_compiler_messages powerpc_spe object {
|
1915 |
|
|
#ifndef __SPE__
|
1916 |
|
|
#error not SPE
|
1917 |
|
|
#else
|
1918 |
|
|
int dummy;
|
1919 |
|
|
#endif
|
1920 |
|
|
}]
|
1921 |
|
|
} else {
|
1922 |
|
|
return 0
|
1923 |
|
|
}
|
1924 |
|
|
}
|
1925 |
|
|
|
1926 |
|
|
# Return 1 if this is a PowerPC target with Altivec enabled.
|
1927 |
|
|
|
1928 |
|
|
proc check_effective_target_powerpc_altivec { } {
|
1929 |
|
|
if { [istarget powerpc*-*-*] } {
|
1930 |
|
|
return [check_no_compiler_messages powerpc_altivec object {
|
1931 |
|
|
#ifndef __ALTIVEC__
|
1932 |
|
|
#error not Altivec
|
1933 |
|
|
#else
|
1934 |
|
|
int dummy;
|
1935 |
|
|
#endif
|
1936 |
|
|
}]
|
1937 |
|
|
} else {
|
1938 |
|
|
return 0
|
1939 |
|
|
}
|
1940 |
|
|
}
|
1941 |
|
|
|
1942 |
|
|
# Return 1 if this is a PowerPC 405 target. The check includes options
|
1943 |
|
|
# specified by dg-options for this test, so don't cache the result.
|
1944 |
|
|
|
1945 |
|
|
proc check_effective_target_powerpc_405_nocache { } {
|
1946 |
|
|
if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
|
1947 |
|
|
return [check_no_compiler_messages_nocache powerpc_405 object {
|
1948 |
|
|
#ifdef __PPC405__
|
1949 |
|
|
int dummy;
|
1950 |
|
|
#else
|
1951 |
|
|
#error not a PPC405
|
1952 |
|
|
#endif
|
1953 |
|
|
} [current_compiler_flags]]
|
1954 |
|
|
} else {
|
1955 |
|
|
return 0
|
1956 |
|
|
}
|
1957 |
|
|
}
|
1958 |
|
|
|
1959 |
|
|
# Return 1 if this is a SPU target with a toolchain that
|
1960 |
|
|
# supports automatic overlay generation.
|
1961 |
|
|
|
1962 |
|
|
proc check_effective_target_spu_auto_overlay { } {
|
1963 |
|
|
if { [istarget spu*-*-elf*] } {
|
1964 |
|
|
return [check_no_compiler_messages spu_auto_overlay executable {
|
1965 |
|
|
int main (void) { }
|
1966 |
|
|
} "-Wl,--auto-overlay" ]
|
1967 |
|
|
} else {
|
1968 |
|
|
return 0
|
1969 |
|
|
}
|
1970 |
|
|
}
|
1971 |
|
|
|
1972 |
|
|
# The VxWorks SPARC simulator accepts only EM_SPARC executables and
|
1973 |
|
|
# chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
|
1974 |
|
|
# test environment appears to run executables on such a simulator.
|
1975 |
|
|
|
1976 |
|
|
proc check_effective_target_ultrasparc_hw { } {
|
1977 |
|
|
return [check_runtime ultrasparc_hw {
|
1978 |
|
|
int main() { return 0; }
|
1979 |
|
|
} "-mcpu=ultrasparc"]
|
1980 |
|
|
}
|
1981 |
|
|
|
1982 |
|
|
# Return 1 if the target supports hardware vector shift operation.
|
1983 |
|
|
|
1984 |
|
|
proc check_effective_target_vect_shift { } {
|
1985 |
|
|
global et_vect_shift_saved
|
1986 |
|
|
|
1987 |
|
|
if [info exists et_vect_shift_saved] {
|
1988 |
|
|
verbose "check_effective_target_vect_shift: using cached result" 2
|
1989 |
|
|
} else {
|
1990 |
|
|
set et_vect_shift_saved 0
|
1991 |
|
|
if { ([istarget powerpc*-*-*]
|
1992 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
1993 |
|
|
|| [istarget ia64-*-*]
|
1994 |
|
|
|| [istarget i?86-*-*]
|
1995 |
|
|
|| [istarget x86_64-*-*]
|
1996 |
|
|
|| [check_effective_target_arm32] } {
|
1997 |
|
|
set et_vect_shift_saved 1
|
1998 |
|
|
}
|
1999 |
|
|
}
|
2000 |
|
|
|
2001 |
|
|
verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
|
2002 |
|
|
return $et_vect_shift_saved
|
2003 |
|
|
}
|
2004 |
|
|
|
2005 |
|
|
# Return 1 if the target supports hardware vectors of long, 0 otherwise.
|
2006 |
|
|
#
|
2007 |
|
|
# This can change for different subtargets so do not cache the result.
|
2008 |
|
|
|
2009 |
|
|
proc check_effective_target_vect_long { } {
|
2010 |
|
|
if { [istarget i?86-*-*]
|
2011 |
|
|
|| (([istarget powerpc*-*-*]
|
2012 |
|
|
&& ![istarget powerpc-*-linux*paired*])
|
2013 |
|
|
&& [check_effective_target_ilp32])
|
2014 |
|
|
|| [istarget x86_64-*-*]
|
2015 |
|
|
|| [check_effective_target_arm32]
|
2016 |
|
|
|| ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
|
2017 |
|
|
set answer 1
|
2018 |
|
|
} else {
|
2019 |
|
|
set answer 0
|
2020 |
|
|
}
|
2021 |
|
|
|
2022 |
|
|
verbose "check_effective_target_vect_long: returning $answer" 2
|
2023 |
|
|
return $answer
|
2024 |
|
|
}
|
2025 |
|
|
|
2026 |
|
|
# Return 1 if the target supports hardware vectors of float, 0 otherwise.
|
2027 |
|
|
#
|
2028 |
|
|
# This won't change for different subtargets so cache the result.
|
2029 |
|
|
|
2030 |
|
|
proc check_effective_target_vect_float { } {
|
2031 |
|
|
global et_vect_float_saved
|
2032 |
|
|
|
2033 |
|
|
if [info exists et_vect_float_saved] {
|
2034 |
|
|
verbose "check_effective_target_vect_float: using cached result" 2
|
2035 |
|
|
} else {
|
2036 |
|
|
set et_vect_float_saved 0
|
2037 |
|
|
if { [istarget i?86-*-*]
|
2038 |
|
|
|| [istarget powerpc*-*-*]
|
2039 |
|
|
|| [istarget spu-*-*]
|
2040 |
|
|
|| [istarget mipsisa64*-*-*]
|
2041 |
|
|
|| [istarget x86_64-*-*]
|
2042 |
|
|
|| [istarget ia64-*-*]
|
2043 |
|
|
|| [check_effective_target_arm32] } {
|
2044 |
|
|
set et_vect_float_saved 1
|
2045 |
|
|
}
|
2046 |
|
|
}
|
2047 |
|
|
|
2048 |
|
|
verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
|
2049 |
|
|
return $et_vect_float_saved
|
2050 |
|
|
}
|
2051 |
|
|
|
2052 |
|
|
# Return 1 if the target supports hardware vectors of double, 0 otherwise.
|
2053 |
|
|
#
|
2054 |
|
|
# This won't change for different subtargets so cache the result.
|
2055 |
|
|
|
2056 |
|
|
proc check_effective_target_vect_double { } {
|
2057 |
|
|
global et_vect_double_saved
|
2058 |
|
|
|
2059 |
|
|
if [info exists et_vect_double_saved] {
|
2060 |
|
|
verbose "check_effective_target_vect_double: using cached result" 2
|
2061 |
|
|
} else {
|
2062 |
|
|
set et_vect_double_saved 0
|
2063 |
|
|
if { [istarget i?86-*-*]
|
2064 |
|
|
|| [istarget x86_64-*-*]
|
2065 |
|
|
|| [istarget spu-*-*] } {
|
2066 |
|
|
set et_vect_double_saved 1
|
2067 |
|
|
}
|
2068 |
|
|
}
|
2069 |
|
|
|
2070 |
|
|
verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
|
2071 |
|
|
return $et_vect_double_saved
|
2072 |
|
|
}
|
2073 |
|
|
|
2074 |
|
|
# Return 1 if the target supports hardware vectors of long long, 0 otherwise.
|
2075 |
|
|
#
|
2076 |
|
|
# This won't change for different subtargets so cache the result.
|
2077 |
|
|
|
2078 |
|
|
proc check_effective_target_vect_long_long { } {
|
2079 |
|
|
global et_vect_long_long_saved
|
2080 |
|
|
|
2081 |
|
|
if [info exists et_vect_long_long_saved] {
|
2082 |
|
|
verbose "check_effective_target_vect_long_long: using cached result" 2
|
2083 |
|
|
} else {
|
2084 |
|
|
set et_vect_long_long_saved 0
|
2085 |
|
|
if { [istarget i?86-*-*]
|
2086 |
|
|
|| [istarget x86_64-*-*] } {
|
2087 |
|
|
set et_vect_long_long_saved 1
|
2088 |
|
|
}
|
2089 |
|
|
}
|
2090 |
|
|
|
2091 |
|
|
verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
|
2092 |
|
|
return $et_vect_long_long_saved
|
2093 |
|
|
}
|
2094 |
|
|
|
2095 |
|
|
|
2096 |
|
|
# Return 1 if the target plus current options does not support a vector
|
2097 |
|
|
# max instruction on "int", 0 otherwise.
|
2098 |
|
|
#
|
2099 |
|
|
# This won't change for different subtargets so cache the result.
|
2100 |
|
|
|
2101 |
|
|
proc check_effective_target_vect_no_int_max { } {
|
2102 |
|
|
global et_vect_no_int_max_saved
|
2103 |
|
|
|
2104 |
|
|
if [info exists et_vect_no_int_max_saved] {
|
2105 |
|
|
verbose "check_effective_target_vect_no_int_max: using cached result" 2
|
2106 |
|
|
} else {
|
2107 |
|
|
set et_vect_no_int_max_saved 0
|
2108 |
|
|
if { [istarget sparc*-*-*]
|
2109 |
|
|
|| [istarget spu-*-*]
|
2110 |
|
|
|| [istarget alpha*-*-*] } {
|
2111 |
|
|
set et_vect_no_int_max_saved 1
|
2112 |
|
|
}
|
2113 |
|
|
}
|
2114 |
|
|
verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
|
2115 |
|
|
return $et_vect_no_int_max_saved
|
2116 |
|
|
}
|
2117 |
|
|
|
2118 |
|
|
# Return 1 if the target plus current options does not support a vector
|
2119 |
|
|
# add instruction on "int", 0 otherwise.
|
2120 |
|
|
#
|
2121 |
|
|
# This won't change for different subtargets so cache the result.
|
2122 |
|
|
|
2123 |
|
|
proc check_effective_target_vect_no_int_add { } {
|
2124 |
|
|
global et_vect_no_int_add_saved
|
2125 |
|
|
|
2126 |
|
|
if [info exists et_vect_no_int_add_saved] {
|
2127 |
|
|
verbose "check_effective_target_vect_no_int_add: using cached result" 2
|
2128 |
|
|
} else {
|
2129 |
|
|
set et_vect_no_int_add_saved 0
|
2130 |
|
|
# Alpha only supports vector add on V8QI and V4HI.
|
2131 |
|
|
if { [istarget alpha*-*-*] } {
|
2132 |
|
|
set et_vect_no_int_add_saved 1
|
2133 |
|
|
}
|
2134 |
|
|
}
|
2135 |
|
|
verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
|
2136 |
|
|
return $et_vect_no_int_add_saved
|
2137 |
|
|
}
|
2138 |
|
|
|
2139 |
|
|
# Return 1 if the target plus current options does not support vector
|
2140 |
|
|
# bitwise instructions, 0 otherwise.
|
2141 |
|
|
#
|
2142 |
|
|
# This won't change for different subtargets so cache the result.
|
2143 |
|
|
|
2144 |
|
|
proc check_effective_target_vect_no_bitwise { } {
|
2145 |
|
|
global et_vect_no_bitwise_saved
|
2146 |
|
|
|
2147 |
|
|
if [info exists et_vect_no_bitwise_saved] {
|
2148 |
|
|
verbose "check_effective_target_vect_no_bitwise: using cached result" 2
|
2149 |
|
|
} else {
|
2150 |
|
|
set et_vect_no_bitwise_saved 0
|
2151 |
|
|
}
|
2152 |
|
|
verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
|
2153 |
|
|
return $et_vect_no_bitwise_saved
|
2154 |
|
|
}
|
2155 |
|
|
|
2156 |
|
|
# Return 1 if the target plus current options supports vector permutation,
|
2157 |
|
|
# 0 otherwise.
|
2158 |
|
|
#
|
2159 |
|
|
# This won't change for different subtargets so cache the result.
|
2160 |
|
|
|
2161 |
|
|
proc check_effective_target_vect_perm { } {
|
2162 |
|
|
global et_vect_perm
|
2163 |
|
|
|
2164 |
|
|
if [info exists et_vect_perm_saved] {
|
2165 |
|
|
verbose "check_effective_target_vect_perm: using cached result" 2
|
2166 |
|
|
} else {
|
2167 |
|
|
set et_vect_perm_saved 0
|
2168 |
|
|
if { [istarget powerpc*-*-*]
|
2169 |
|
|
|| [istarget spu-*-*] } {
|
2170 |
|
|
set et_vect_perm_saved 1
|
2171 |
|
|
}
|
2172 |
|
|
}
|
2173 |
|
|
verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
|
2174 |
|
|
return $et_vect_perm_saved
|
2175 |
|
|
}
|
2176 |
|
|
|
2177 |
|
|
|
2178 |
|
|
# Return 1 if the target plus current options supports a vector
|
2179 |
|
|
# widening summation of *short* args into *int* result, 0 otherwise.
|
2180 |
|
|
# A target can also support this widening summation if it can support
|
2181 |
|
|
# promotion (unpacking) from shorts to ints.
|
2182 |
|
|
#
|
2183 |
|
|
# This won't change for different subtargets so cache the result.
|
2184 |
|
|
|
2185 |
|
|
proc check_effective_target_vect_widen_sum_hi_to_si { } {
|
2186 |
|
|
global et_vect_widen_sum_hi_to_si
|
2187 |
|
|
|
2188 |
|
|
if [info exists et_vect_widen_sum_hi_to_si_saved] {
|
2189 |
|
|
verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
|
2190 |
|
|
} else {
|
2191 |
|
|
set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
|
2192 |
|
|
if { [istarget powerpc*-*-*]
|
2193 |
|
|
|| [istarget ia64-*-*] } {
|
2194 |
|
|
set et_vect_widen_sum_hi_to_si_saved 1
|
2195 |
|
|
}
|
2196 |
|
|
}
|
2197 |
|
|
verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
|
2198 |
|
|
return $et_vect_widen_sum_hi_to_si_saved
|
2199 |
|
|
}
|
2200 |
|
|
|
2201 |
|
|
# Return 1 if the target plus current options supports a vector
|
2202 |
|
|
# widening summation of *char* args into *short* result, 0 otherwise.
|
2203 |
|
|
# A target can also support this widening summation if it can support
|
2204 |
|
|
# promotion (unpacking) from chars to shorts.
|
2205 |
|
|
#
|
2206 |
|
|
# This won't change for different subtargets so cache the result.
|
2207 |
|
|
|
2208 |
|
|
proc check_effective_target_vect_widen_sum_qi_to_hi { } {
|
2209 |
|
|
global et_vect_widen_sum_qi_to_hi
|
2210 |
|
|
|
2211 |
|
|
if [info exists et_vect_widen_sum_qi_to_hi_saved] {
|
2212 |
|
|
verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
|
2213 |
|
|
} else {
|
2214 |
|
|
set et_vect_widen_sum_qi_to_hi_saved 0
|
2215 |
|
|
if { [check_effective_target_vect_unpack]
|
2216 |
|
|
|| [istarget ia64-*-*] } {
|
2217 |
|
|
set et_vect_widen_sum_qi_to_hi_saved 1
|
2218 |
|
|
}
|
2219 |
|
|
}
|
2220 |
|
|
verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
|
2221 |
|
|
return $et_vect_widen_sum_qi_to_hi_saved
|
2222 |
|
|
}
|
2223 |
|
|
|
2224 |
|
|
# Return 1 if the target plus current options supports a vector
|
2225 |
|
|
# widening summation of *char* args into *int* result, 0 otherwise.
|
2226 |
|
|
#
|
2227 |
|
|
# This won't change for different subtargets so cache the result.
|
2228 |
|
|
|
2229 |
|
|
proc check_effective_target_vect_widen_sum_qi_to_si { } {
|
2230 |
|
|
global et_vect_widen_sum_qi_to_si
|
2231 |
|
|
|
2232 |
|
|
if [info exists et_vect_widen_sum_qi_to_si_saved] {
|
2233 |
|
|
verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
|
2234 |
|
|
} else {
|
2235 |
|
|
set et_vect_widen_sum_qi_to_si_saved 0
|
2236 |
|
|
if { [istarget powerpc*-*-*] } {
|
2237 |
|
|
set et_vect_widen_sum_qi_to_si_saved 1
|
2238 |
|
|
}
|
2239 |
|
|
}
|
2240 |
|
|
verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
|
2241 |
|
|
return $et_vect_widen_sum_qi_to_si_saved
|
2242 |
|
|
}
|
2243 |
|
|
|
2244 |
|
|
# Return 1 if the target plus current options supports a vector
|
2245 |
|
|
# widening multiplication of *char* args into *short* result, 0 otherwise.
|
2246 |
|
|
# A target can also support this widening multplication if it can support
|
2247 |
|
|
# promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
|
2248 |
|
|
# multiplication of shorts).
|
2249 |
|
|
#
|
2250 |
|
|
# This won't change for different subtargets so cache the result.
|
2251 |
|
|
|
2252 |
|
|
|
2253 |
|
|
proc check_effective_target_vect_widen_mult_qi_to_hi { } {
|
2254 |
|
|
global et_vect_widen_mult_qi_to_hi
|
2255 |
|
|
|
2256 |
|
|
if [info exists et_vect_widen_mult_qi_to_hi_saved] {
|
2257 |
|
|
verbose "check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
|
2258 |
|
|
} else {
|
2259 |
|
|
if { [check_effective_target_vect_unpack]
|
2260 |
|
|
&& [check_effective_target_vect_short_mult] } {
|
2261 |
|
|
set et_vect_widen_mult_qi_to_hi_saved 1
|
2262 |
|
|
} else {
|
2263 |
|
|
set et_vect_widen_mult_qi_to_hi_saved 0
|
2264 |
|
|
}
|
2265 |
|
|
if { [istarget powerpc*-*-*] } {
|
2266 |
|
|
set et_vect_widen_mult_qi_to_hi_saved 1
|
2267 |
|
|
}
|
2268 |
|
|
}
|
2269 |
|
|
verbose "check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
|
2270 |
|
|
return $et_vect_widen_mult_qi_to_hi_saved
|
2271 |
|
|
}
|
2272 |
|
|
|
2273 |
|
|
# Return 1 if the target plus current options supports a vector
|
2274 |
|
|
# widening multiplication of *short* args into *int* result, 0 otherwise.
|
2275 |
|
|
# A target can also support this widening multplication if it can support
|
2276 |
|
|
# promotion (unpacking) from shorts to ints, and vect_int_mult (non-widening
|
2277 |
|
|
# multiplication of ints).
|
2278 |
|
|
#
|
2279 |
|
|
# This won't change for different subtargets so cache the result.
|
2280 |
|
|
|
2281 |
|
|
|
2282 |
|
|
proc check_effective_target_vect_widen_mult_hi_to_si { } {
|
2283 |
|
|
global et_vect_widen_mult_hi_to_si
|
2284 |
|
|
|
2285 |
|
|
if [info exists et_vect_widen_mult_hi_to_si_saved] {
|
2286 |
|
|
verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
|
2287 |
|
|
} else {
|
2288 |
|
|
if { [check_effective_target_vect_unpack]
|
2289 |
|
|
&& [check_effective_target_vect_int_mult] } {
|
2290 |
|
|
set et_vect_widen_mult_hi_to_si_saved 1
|
2291 |
|
|
} else {
|
2292 |
|
|
set et_vect_widen_mult_hi_to_si_saved 0
|
2293 |
|
|
}
|
2294 |
|
|
if { [istarget powerpc*-*-*]
|
2295 |
|
|
|| [istarget spu-*-*]
|
2296 |
|
|
|| [istarget i?86-*-*]
|
2297 |
|
|
|| [istarget x86_64-*-*] } {
|
2298 |
|
|
set et_vect_widen_mult_hi_to_si_saved 1
|
2299 |
|
|
}
|
2300 |
|
|
}
|
2301 |
|
|
verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
|
2302 |
|
|
return $et_vect_widen_mult_hi_to_si_saved
|
2303 |
|
|
}
|
2304 |
|
|
|
2305 |
|
|
# Return 1 if the target plus current options supports a vector
|
2306 |
|
|
# dot-product of signed chars, 0 otherwise.
|
2307 |
|
|
#
|
2308 |
|
|
# This won't change for different subtargets so cache the result.
|
2309 |
|
|
|
2310 |
|
|
proc check_effective_target_vect_sdot_qi { } {
|
2311 |
|
|
global et_vect_sdot_qi
|
2312 |
|
|
|
2313 |
|
|
if [info exists et_vect_sdot_qi_saved] {
|
2314 |
|
|
verbose "check_effective_target_vect_sdot_qi: using cached result" 2
|
2315 |
|
|
} else {
|
2316 |
|
|
set et_vect_sdot_qi_saved 0
|
2317 |
|
|
}
|
2318 |
|
|
verbose "check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
|
2319 |
|
|
return $et_vect_sdot_qi_saved
|
2320 |
|
|
}
|
2321 |
|
|
|
2322 |
|
|
# Return 1 if the target plus current options supports a vector
|
2323 |
|
|
# dot-product of unsigned chars, 0 otherwise.
|
2324 |
|
|
#
|
2325 |
|
|
# This won't change for different subtargets so cache the result.
|
2326 |
|
|
|
2327 |
|
|
proc check_effective_target_vect_udot_qi { } {
|
2328 |
|
|
global et_vect_udot_qi
|
2329 |
|
|
|
2330 |
|
|
if [info exists et_vect_udot_qi_saved] {
|
2331 |
|
|
verbose "check_effective_target_vect_udot_qi: using cached result" 2
|
2332 |
|
|
} else {
|
2333 |
|
|
set et_vect_udot_qi_saved 0
|
2334 |
|
|
if { [istarget powerpc*-*-*] } {
|
2335 |
|
|
set et_vect_udot_qi_saved 1
|
2336 |
|
|
}
|
2337 |
|
|
}
|
2338 |
|
|
verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
|
2339 |
|
|
return $et_vect_udot_qi_saved
|
2340 |
|
|
}
|
2341 |
|
|
|
2342 |
|
|
# Return 1 if the target plus current options supports a vector
|
2343 |
|
|
# dot-product of signed shorts, 0 otherwise.
|
2344 |
|
|
#
|
2345 |
|
|
# This won't change for different subtargets so cache the result.
|
2346 |
|
|
|
2347 |
|
|
proc check_effective_target_vect_sdot_hi { } {
|
2348 |
|
|
global et_vect_sdot_hi
|
2349 |
|
|
|
2350 |
|
|
if [info exists et_vect_sdot_hi_saved] {
|
2351 |
|
|
verbose "check_effective_target_vect_sdot_hi: using cached result" 2
|
2352 |
|
|
} else {
|
2353 |
|
|
set et_vect_sdot_hi_saved 0
|
2354 |
|
|
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
|
2355 |
|
|
|| [istarget i?86-*-*]
|
2356 |
|
|
|| [istarget x86_64-*-*] } {
|
2357 |
|
|
set et_vect_sdot_hi_saved 1
|
2358 |
|
|
}
|
2359 |
|
|
}
|
2360 |
|
|
verbose "check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
|
2361 |
|
|
return $et_vect_sdot_hi_saved
|
2362 |
|
|
}
|
2363 |
|
|
|
2364 |
|
|
# Return 1 if the target plus current options supports a vector
|
2365 |
|
|
# dot-product of unsigned shorts, 0 otherwise.
|
2366 |
|
|
#
|
2367 |
|
|
# This won't change for different subtargets so cache the result.
|
2368 |
|
|
|
2369 |
|
|
proc check_effective_target_vect_udot_hi { } {
|
2370 |
|
|
global et_vect_udot_hi
|
2371 |
|
|
|
2372 |
|
|
if [info exists et_vect_udot_hi_saved] {
|
2373 |
|
|
verbose "check_effective_target_vect_udot_hi: using cached result" 2
|
2374 |
|
|
} else {
|
2375 |
|
|
set et_vect_udot_hi_saved 0
|
2376 |
|
|
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
|
2377 |
|
|
set et_vect_udot_hi_saved 1
|
2378 |
|
|
}
|
2379 |
|
|
}
|
2380 |
|
|
verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
|
2381 |
|
|
return $et_vect_udot_hi_saved
|
2382 |
|
|
}
|
2383 |
|
|
|
2384 |
|
|
|
2385 |
|
|
# Return 1 if the target plus current options supports a vector
|
2386 |
|
|
# demotion (packing) of shorts (to chars) and ints (to shorts)
|
2387 |
|
|
# using modulo arithmetic, 0 otherwise.
|
2388 |
|
|
#
|
2389 |
|
|
# This won't change for different subtargets so cache the result.
|
2390 |
|
|
|
2391 |
|
|
proc check_effective_target_vect_pack_trunc { } {
|
2392 |
|
|
global et_vect_pack_trunc
|
2393 |
|
|
|
2394 |
|
|
if [info exists et_vect_pack_trunc_saved] {
|
2395 |
|
|
verbose "check_effective_target_vect_pack_trunc: using cached result" 2
|
2396 |
|
|
} else {
|
2397 |
|
|
set et_vect_pack_trunc_saved 0
|
2398 |
|
|
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
|
2399 |
|
|
|| [istarget i?86-*-*]
|
2400 |
|
|
|| [istarget x86_64-*-*]
|
2401 |
|
|
|| [istarget spu-*-*] } {
|
2402 |
|
|
set et_vect_pack_trunc_saved 1
|
2403 |
|
|
}
|
2404 |
|
|
}
|
2405 |
|
|
verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
|
2406 |
|
|
return $et_vect_pack_trunc_saved
|
2407 |
|
|
}
|
2408 |
|
|
|
2409 |
|
|
# Return 1 if the target plus current options supports a vector
|
2410 |
|
|
# promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
|
2411 |
|
|
#
|
2412 |
|
|
# This won't change for different subtargets so cache the result.
|
2413 |
|
|
|
2414 |
|
|
proc check_effective_target_vect_unpack { } {
|
2415 |
|
|
global et_vect_unpack
|
2416 |
|
|
|
2417 |
|
|
if [info exists et_vect_unpack_saved] {
|
2418 |
|
|
verbose "check_effective_target_vect_unpack: using cached result" 2
|
2419 |
|
|
} else {
|
2420 |
|
|
set et_vect_unpack_saved 0
|
2421 |
|
|
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
|
2422 |
|
|
|| [istarget i?86-*-*]
|
2423 |
|
|
|| [istarget x86_64-*-*]
|
2424 |
|
|
|| [istarget spu-*-*] } {
|
2425 |
|
|
set et_vect_unpack_saved 1
|
2426 |
|
|
}
|
2427 |
|
|
}
|
2428 |
|
|
verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
|
2429 |
|
|
return $et_vect_unpack_saved
|
2430 |
|
|
}
|
2431 |
|
|
|
2432 |
|
|
# Return 1 if the target plus current options does not guarantee
|
2433 |
|
|
# that its STACK_BOUNDARY is >= the reguired vector alignment.
|
2434 |
|
|
#
|
2435 |
|
|
# This won't change for different subtargets so cache the result.
|
2436 |
|
|
|
2437 |
|
|
proc check_effective_target_unaligned_stack { } {
|
2438 |
|
|
global et_unaligned_stack_saved
|
2439 |
|
|
|
2440 |
|
|
if [info exists et_unaligned_stack_saved] {
|
2441 |
|
|
verbose "check_effective_target_unaligned_stack: using cached result" 2
|
2442 |
|
|
} else {
|
2443 |
|
|
set et_unaligned_stack_saved 0
|
2444 |
|
|
}
|
2445 |
|
|
verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
|
2446 |
|
|
return $et_unaligned_stack_saved
|
2447 |
|
|
}
|
2448 |
|
|
|
2449 |
|
|
# Return 1 if the target plus current options does not support a vector
|
2450 |
|
|
# alignment mechanism, 0 otherwise.
|
2451 |
|
|
#
|
2452 |
|
|
# This won't change for different subtargets so cache the result.
|
2453 |
|
|
|
2454 |
|
|
proc check_effective_target_vect_no_align { } {
|
2455 |
|
|
global et_vect_no_align_saved
|
2456 |
|
|
|
2457 |
|
|
if [info exists et_vect_no_align_saved] {
|
2458 |
|
|
verbose "check_effective_target_vect_no_align: using cached result" 2
|
2459 |
|
|
} else {
|
2460 |
|
|
set et_vect_no_align_saved 0
|
2461 |
|
|
if { [istarget mipsisa64*-*-*]
|
2462 |
|
|
|| [istarget sparc*-*-*]
|
2463 |
|
|
|| [istarget ia64-*-*]
|
2464 |
|
|
|| [check_effective_target_arm32] } {
|
2465 |
|
|
set et_vect_no_align_saved 1
|
2466 |
|
|
}
|
2467 |
|
|
}
|
2468 |
|
|
verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
|
2469 |
|
|
return $et_vect_no_align_saved
|
2470 |
|
|
}
|
2471 |
|
|
|
2472 |
|
|
# Return 1 if the target supports a vector misalign access, 0 otherwise.
|
2473 |
|
|
#
|
2474 |
|
|
# This won't change for different subtargets so cache the result.
|
2475 |
|
|
|
2476 |
|
|
proc check_effective_target_vect_hw_misalign { } {
|
2477 |
|
|
global et_vect_hw_misalign_saved
|
2478 |
|
|
|
2479 |
|
|
if [info exists et_vect_hw_misalign_saved] {
|
2480 |
|
|
verbose "check_effective_target_vect_hw_misalign: using cached result" 2
|
2481 |
|
|
} else {
|
2482 |
|
|
set et_vect_hw_misalign_saved 0
|
2483 |
|
|
if { ([istarget x86_64-*-*]
|
2484 |
|
|
|| [istarget i?86-*-*]) } {
|
2485 |
|
|
set et_vect_hw_misalign_saved 1
|
2486 |
|
|
}
|
2487 |
|
|
}
|
2488 |
|
|
verbose "check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
|
2489 |
|
|
return $et_vect_hw_misalign_saved
|
2490 |
|
|
}
|
2491 |
|
|
|
2492 |
|
|
|
2493 |
|
|
# Return 1 if arrays are aligned to the vector alignment
|
2494 |
|
|
# boundary, 0 otherwise.
|
2495 |
|
|
#
|
2496 |
|
|
# This won't change for different subtargets so cache the result.
|
2497 |
|
|
|
2498 |
|
|
proc check_effective_target_vect_aligned_arrays { } {
|
2499 |
|
|
global et_vect_aligned_arrays
|
2500 |
|
|
|
2501 |
|
|
if [info exists et_vect_aligned_arrays_saved] {
|
2502 |
|
|
verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
|
2503 |
|
|
} else {
|
2504 |
|
|
set et_vect_aligned_arrays_saved 0
|
2505 |
|
|
if { (([istarget x86_64-*-*]
|
2506 |
|
|
|| [istarget i?86-*-*]) && [is-effective-target lp64])
|
2507 |
|
|
|| [istarget spu-*-*] } {
|
2508 |
|
|
set et_vect_aligned_arrays_saved 1
|
2509 |
|
|
}
|
2510 |
|
|
}
|
2511 |
|
|
verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
|
2512 |
|
|
return $et_vect_aligned_arrays_saved
|
2513 |
|
|
}
|
2514 |
|
|
|
2515 |
|
|
# Return 1 if types of size 32 bit or less are naturally aligned
|
2516 |
|
|
# (aligned to their type-size), 0 otherwise.
|
2517 |
|
|
#
|
2518 |
|
|
# This won't change for different subtargets so cache the result.
|
2519 |
|
|
|
2520 |
|
|
proc check_effective_target_natural_alignment_32 { } {
|
2521 |
|
|
global et_natural_alignment_32
|
2522 |
|
|
|
2523 |
|
|
if [info exists et_natural_alignment_32_saved] {
|
2524 |
|
|
verbose "check_effective_target_natural_alignment_32: using cached result" 2
|
2525 |
|
|
} else {
|
2526 |
|
|
# FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
|
2527 |
|
|
set et_natural_alignment_32_saved 1
|
2528 |
|
|
if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
|
2529 |
|
|
set et_natural_alignment_32_saved 0
|
2530 |
|
|
}
|
2531 |
|
|
}
|
2532 |
|
|
verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
|
2533 |
|
|
return $et_natural_alignment_32_saved
|
2534 |
|
|
}
|
2535 |
|
|
|
2536 |
|
|
# Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
|
2537 |
|
|
# type-size), 0 otherwise.
|
2538 |
|
|
#
|
2539 |
|
|
# This won't change for different subtargets so cache the result.
|
2540 |
|
|
|
2541 |
|
|
proc check_effective_target_natural_alignment_64 { } {
|
2542 |
|
|
global et_natural_alignment_64
|
2543 |
|
|
|
2544 |
|
|
if [info exists et_natural_alignment_64_saved] {
|
2545 |
|
|
verbose "check_effective_target_natural_alignment_64: using cached result" 2
|
2546 |
|
|
} else {
|
2547 |
|
|
set et_natural_alignment_64_saved 0
|
2548 |
|
|
if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
|
2549 |
|
|
|| [istarget spu-*-*] } {
|
2550 |
|
|
set et_natural_alignment_64_saved 1
|
2551 |
|
|
}
|
2552 |
|
|
}
|
2553 |
|
|
verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
|
2554 |
|
|
return $et_natural_alignment_64_saved
|
2555 |
|
|
}
|
2556 |
|
|
|
2557 |
|
|
# Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
|
2558 |
|
|
#
|
2559 |
|
|
# This won't change for different subtargets so cache the result.
|
2560 |
|
|
|
2561 |
|
|
proc check_effective_target_vector_alignment_reachable { } {
|
2562 |
|
|
global et_vector_alignment_reachable
|
2563 |
|
|
|
2564 |
|
|
if [info exists et_vector_alignment_reachable_saved] {
|
2565 |
|
|
verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
|
2566 |
|
|
} else {
|
2567 |
|
|
if { [check_effective_target_vect_aligned_arrays]
|
2568 |
|
|
|| [check_effective_target_natural_alignment_32] } {
|
2569 |
|
|
set et_vector_alignment_reachable_saved 1
|
2570 |
|
|
} else {
|
2571 |
|
|
set et_vector_alignment_reachable_saved 0
|
2572 |
|
|
}
|
2573 |
|
|
}
|
2574 |
|
|
verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
|
2575 |
|
|
return $et_vector_alignment_reachable_saved
|
2576 |
|
|
}
|
2577 |
|
|
|
2578 |
|
|
# Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
|
2579 |
|
|
#
|
2580 |
|
|
# This won't change for different subtargets so cache the result.
|
2581 |
|
|
|
2582 |
|
|
proc check_effective_target_vector_alignment_reachable_for_64bit { } {
|
2583 |
|
|
global et_vector_alignment_reachable_for_64bit
|
2584 |
|
|
|
2585 |
|
|
if [info exists et_vector_alignment_reachable_for_64bit_saved] {
|
2586 |
|
|
verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
|
2587 |
|
|
} else {
|
2588 |
|
|
if { [check_effective_target_vect_aligned_arrays]
|
2589 |
|
|
|| [check_effective_target_natural_alignment_64] } {
|
2590 |
|
|
set et_vector_alignment_reachable_for_64bit_saved 1
|
2591 |
|
|
} else {
|
2592 |
|
|
set et_vector_alignment_reachable_for_64bit_saved 0
|
2593 |
|
|
}
|
2594 |
|
|
}
|
2595 |
|
|
verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
|
2596 |
|
|
return $et_vector_alignment_reachable_for_64bit_saved
|
2597 |
|
|
}
|
2598 |
|
|
|
2599 |
|
|
# Return 1 if the target supports vector conditional operations, 0 otherwise.
|
2600 |
|
|
|
2601 |
|
|
proc check_effective_target_vect_condition { } {
|
2602 |
|
|
global et_vect_cond_saved
|
2603 |
|
|
|
2604 |
|
|
if [info exists et_vect_cond_saved] {
|
2605 |
|
|
verbose "check_effective_target_vect_cond: using cached result" 2
|
2606 |
|
|
} else {
|
2607 |
|
|
set et_vect_cond_saved 0
|
2608 |
|
|
if { [istarget powerpc*-*-*]
|
2609 |
|
|
|| [istarget ia64-*-*]
|
2610 |
|
|
|| [istarget i?86-*-*]
|
2611 |
|
|
|| [istarget spu-*-*]
|
2612 |
|
|
|| [istarget x86_64-*-*] } {
|
2613 |
|
|
set et_vect_cond_saved 1
|
2614 |
|
|
}
|
2615 |
|
|
}
|
2616 |
|
|
|
2617 |
|
|
verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
|
2618 |
|
|
return $et_vect_cond_saved
|
2619 |
|
|
}
|
2620 |
|
|
|
2621 |
|
|
# Return 1 if the target supports vector char multiplication, 0 otherwise.
|
2622 |
|
|
|
2623 |
|
|
proc check_effective_target_vect_char_mult { } {
|
2624 |
|
|
global et_vect_char_mult_saved
|
2625 |
|
|
|
2626 |
|
|
if [info exists et_vect_char_mult_saved] {
|
2627 |
|
|
verbose "check_effective_target_vect_char_mult: using cached result" 2
|
2628 |
|
|
} else {
|
2629 |
|
|
set et_vect_char_mult_saved 0
|
2630 |
|
|
if { [istarget ia64-*-*]
|
2631 |
|
|
|| [istarget i?86-*-*]
|
2632 |
|
|
|| [istarget x86_64-*-*] } {
|
2633 |
|
|
set et_vect_char_mult_saved 1
|
2634 |
|
|
}
|
2635 |
|
|
}
|
2636 |
|
|
|
2637 |
|
|
verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
|
2638 |
|
|
return $et_vect_char_mult_saved
|
2639 |
|
|
}
|
2640 |
|
|
|
2641 |
|
|
# Return 1 if the target supports vector short multiplication, 0 otherwise.
|
2642 |
|
|
|
2643 |
|
|
proc check_effective_target_vect_short_mult { } {
|
2644 |
|
|
global et_vect_short_mult_saved
|
2645 |
|
|
|
2646 |
|
|
if [info exists et_vect_short_mult_saved] {
|
2647 |
|
|
verbose "check_effective_target_vect_short_mult: using cached result" 2
|
2648 |
|
|
} else {
|
2649 |
|
|
set et_vect_short_mult_saved 0
|
2650 |
|
|
if { [istarget ia64-*-*]
|
2651 |
|
|
|| [istarget spu-*-*]
|
2652 |
|
|
|| [istarget i?86-*-*]
|
2653 |
|
|
|| [istarget x86_64-*-*]
|
2654 |
|
|
|| [istarget powerpc*-*-*]
|
2655 |
|
|
|| [check_effective_target_arm32] } {
|
2656 |
|
|
set et_vect_short_mult_saved 1
|
2657 |
|
|
}
|
2658 |
|
|
}
|
2659 |
|
|
|
2660 |
|
|
verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
|
2661 |
|
|
return $et_vect_short_mult_saved
|
2662 |
|
|
}
|
2663 |
|
|
|
2664 |
|
|
# Return 1 if the target supports vector int multiplication, 0 otherwise.
|
2665 |
|
|
|
2666 |
|
|
proc check_effective_target_vect_int_mult { } {
|
2667 |
|
|
global et_vect_int_mult_saved
|
2668 |
|
|
|
2669 |
|
|
if [info exists et_vect_int_mult_saved] {
|
2670 |
|
|
verbose "check_effective_target_vect_int_mult: using cached result" 2
|
2671 |
|
|
} else {
|
2672 |
|
|
set et_vect_int_mult_saved 0
|
2673 |
|
|
if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
|
2674 |
|
|
|| [istarget spu-*-*]
|
2675 |
|
|
|| [istarget i?86-*-*]
|
2676 |
|
|
|| [istarget x86_64-*-*]
|
2677 |
|
|
|| [check_effective_target_arm32] } {
|
2678 |
|
|
set et_vect_int_mult_saved 1
|
2679 |
|
|
}
|
2680 |
|
|
}
|
2681 |
|
|
|
2682 |
|
|
verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
|
2683 |
|
|
return $et_vect_int_mult_saved
|
2684 |
|
|
}
|
2685 |
|
|
|
2686 |
|
|
# Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
|
2687 |
|
|
|
2688 |
|
|
proc check_effective_target_vect_extract_even_odd { } {
|
2689 |
|
|
global et_vect_extract_even_odd_saved
|
2690 |
|
|
|
2691 |
|
|
if [info exists et_vect_extract_even_odd_saved] {
|
2692 |
|
|
verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
|
2693 |
|
|
} else {
|
2694 |
|
|
set et_vect_extract_even_odd_saved 0
|
2695 |
|
|
if { [istarget powerpc*-*-*]
|
2696 |
|
|
|| [istarget i?86-*-*]
|
2697 |
|
|
|| [istarget x86_64-*-*]
|
2698 |
|
|
|| [istarget spu-*-*] } {
|
2699 |
|
|
set et_vect_extract_even_odd_saved 1
|
2700 |
|
|
}
|
2701 |
|
|
}
|
2702 |
|
|
|
2703 |
|
|
verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
|
2704 |
|
|
return $et_vect_extract_even_odd_saved
|
2705 |
|
|
}
|
2706 |
|
|
|
2707 |
|
|
# Return 1 if the target supports vector even/odd elements extraction of
|
2708 |
|
|
# vectors with SImode elements or larger, 0 otherwise.
|
2709 |
|
|
|
2710 |
|
|
proc check_effective_target_vect_extract_even_odd_wide { } {
|
2711 |
|
|
global et_vect_extract_even_odd_wide_saved
|
2712 |
|
|
|
2713 |
|
|
if [info exists et_vect_extract_even_odd_wide_saved] {
|
2714 |
|
|
verbose "check_effective_target_vect_extract_even_odd_wide: using cached result" 2
|
2715 |
|
|
} else {
|
2716 |
|
|
set et_vect_extract_even_odd_wide_saved 0
|
2717 |
|
|
if { [istarget powerpc*-*-*]
|
2718 |
|
|
|| [istarget i?86-*-*]
|
2719 |
|
|
|| [istarget x86_64-*-*]
|
2720 |
|
|
|| [istarget spu-*-*] } {
|
2721 |
|
|
set et_vect_extract_even_odd_wide_saved 1
|
2722 |
|
|
}
|
2723 |
|
|
}
|
2724 |
|
|
|
2725 |
|
|
verbose "check_effective_target_vect_extract_even_wide_odd: returning $et_vect_extract_even_odd_wide_saved" 2
|
2726 |
|
|
return $et_vect_extract_even_odd_wide_saved
|
2727 |
|
|
}
|
2728 |
|
|
|
2729 |
|
|
# Return 1 if the target supports vector interleaving, 0 otherwise.
|
2730 |
|
|
|
2731 |
|
|
proc check_effective_target_vect_interleave { } {
|
2732 |
|
|
global et_vect_interleave_saved
|
2733 |
|
|
|
2734 |
|
|
if [info exists et_vect_interleave_saved] {
|
2735 |
|
|
verbose "check_effective_target_vect_interleave: using cached result" 2
|
2736 |
|
|
} else {
|
2737 |
|
|
set et_vect_interleave_saved 0
|
2738 |
|
|
if { [istarget powerpc*-*-*]
|
2739 |
|
|
|| [istarget i?86-*-*]
|
2740 |
|
|
|| [istarget x86_64-*-*]
|
2741 |
|
|
|| [istarget spu-*-*] } {
|
2742 |
|
|
set et_vect_interleave_saved 1
|
2743 |
|
|
}
|
2744 |
|
|
}
|
2745 |
|
|
|
2746 |
|
|
verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
|
2747 |
|
|
return $et_vect_interleave_saved
|
2748 |
|
|
}
|
2749 |
|
|
|
2750 |
|
|
# Return 1 if the target supports vector interleaving and extract even/odd, 0 otherwise.
|
2751 |
|
|
proc check_effective_target_vect_strided { } {
|
2752 |
|
|
global et_vect_strided_saved
|
2753 |
|
|
|
2754 |
|
|
if [info exists et_vect_strided_saved] {
|
2755 |
|
|
verbose "check_effective_target_vect_strided: using cached result" 2
|
2756 |
|
|
} else {
|
2757 |
|
|
set et_vect_strided_saved 0
|
2758 |
|
|
if { [check_effective_target_vect_interleave]
|
2759 |
|
|
&& [check_effective_target_vect_extract_even_odd] } {
|
2760 |
|
|
set et_vect_strided_saved 1
|
2761 |
|
|
}
|
2762 |
|
|
}
|
2763 |
|
|
|
2764 |
|
|
verbose "check_effective_target_vect_strided: returning $et_vect_strided_saved" 2
|
2765 |
|
|
return $et_vect_strided_saved
|
2766 |
|
|
}
|
2767 |
|
|
|
2768 |
|
|
# Return 1 if the target supports vector interleaving and extract even/odd
|
2769 |
|
|
# for wide element types, 0 otherwise.
|
2770 |
|
|
proc check_effective_target_vect_strided_wide { } {
|
2771 |
|
|
global et_vect_strided_wide_saved
|
2772 |
|
|
|
2773 |
|
|
if [info exists et_vect_strided_wide_saved] {
|
2774 |
|
|
verbose "check_effective_target_vect_strided_wide: using cached result" 2
|
2775 |
|
|
} else {
|
2776 |
|
|
set et_vect_strided_wide_saved 0
|
2777 |
|
|
if { [check_effective_target_vect_interleave]
|
2778 |
|
|
&& [check_effective_target_vect_extract_even_odd_wide] } {
|
2779 |
|
|
set et_vect_strided_wide_saved 1
|
2780 |
|
|
}
|
2781 |
|
|
}
|
2782 |
|
|
|
2783 |
|
|
verbose "check_effective_target_vect_strided_wide: returning $et_vect_strided_wide_saved" 2
|
2784 |
|
|
return $et_vect_strided_wide_saved
|
2785 |
|
|
}
|
2786 |
|
|
|
2787 |
|
|
# Return 1 if the target supports section-anchors
|
2788 |
|
|
|
2789 |
|
|
proc check_effective_target_section_anchors { } {
|
2790 |
|
|
global et_section_anchors_saved
|
2791 |
|
|
|
2792 |
|
|
if [info exists et_section_anchors_saved] {
|
2793 |
|
|
verbose "check_effective_target_section_anchors: using cached result" 2
|
2794 |
|
|
} else {
|
2795 |
|
|
set et_section_anchors_saved 0
|
2796 |
|
|
if { [istarget powerpc*-*-*]
|
2797 |
|
|
|| [istarget arm*-*-*] } {
|
2798 |
|
|
set et_section_anchors_saved 1
|
2799 |
|
|
}
|
2800 |
|
|
}
|
2801 |
|
|
|
2802 |
|
|
verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
|
2803 |
|
|
return $et_section_anchors_saved
|
2804 |
|
|
}
|
2805 |
|
|
|
2806 |
|
|
# Return 1 if the target supports atomic operations on "int" and "long".
|
2807 |
|
|
|
2808 |
|
|
proc check_effective_target_sync_int_long { } {
|
2809 |
|
|
global et_sync_int_long_saved
|
2810 |
|
|
|
2811 |
|
|
if [info exists et_sync_int_long_saved] {
|
2812 |
|
|
verbose "check_effective_target_sync_int_long: using cached result" 2
|
2813 |
|
|
} else {
|
2814 |
|
|
set et_sync_int_long_saved 0
|
2815 |
|
|
# This is intentionally powerpc but not rs6000, rs6000 doesn't have the
|
2816 |
|
|
# load-reserved/store-conditional instructions.
|
2817 |
|
|
if { [istarget ia64-*-*]
|
2818 |
|
|
|| [istarget i?86-*-*]
|
2819 |
|
|
|| [istarget x86_64-*-*]
|
2820 |
|
|
|| [istarget alpha*-*-*]
|
2821 |
|
|
|| [istarget bfin*-*linux*]
|
2822 |
|
|
|| [istarget s390*-*-*]
|
2823 |
|
|
|| [istarget powerpc*-*-*]
|
2824 |
|
|
|| [istarget sparc64-*-*]
|
2825 |
|
|
|| [istarget sparcv9-*-*]
|
2826 |
|
|
|| [istarget mips*-*-*] } {
|
2827 |
|
|
set et_sync_int_long_saved 1
|
2828 |
|
|
}
|
2829 |
|
|
}
|
2830 |
|
|
|
2831 |
|
|
verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
|
2832 |
|
|
return $et_sync_int_long_saved
|
2833 |
|
|
}
|
2834 |
|
|
|
2835 |
|
|
# Return 1 if the target supports atomic operations on "char" and "short".
|
2836 |
|
|
|
2837 |
|
|
proc check_effective_target_sync_char_short { } {
|
2838 |
|
|
global et_sync_char_short_saved
|
2839 |
|
|
|
2840 |
|
|
if [info exists et_sync_char_short_saved] {
|
2841 |
|
|
verbose "check_effective_target_sync_char_short: using cached result" 2
|
2842 |
|
|
} else {
|
2843 |
|
|
set et_sync_char_short_saved 0
|
2844 |
|
|
# This is intentionally powerpc but not rs6000, rs6000 doesn't have the
|
2845 |
|
|
# load-reserved/store-conditional instructions.
|
2846 |
|
|
if { [istarget ia64-*-*]
|
2847 |
|
|
|| [istarget i?86-*-*]
|
2848 |
|
|
|| [istarget x86_64-*-*]
|
2849 |
|
|
|| [istarget alpha*-*-*]
|
2850 |
|
|
|| [istarget s390*-*-*]
|
2851 |
|
|
|| [istarget powerpc*-*-*]
|
2852 |
|
|
|| [istarget sparc64-*-*]
|
2853 |
|
|
|| [istarget sparcv9-*-*]
|
2854 |
|
|
|| [istarget mips*-*-*] } {
|
2855 |
|
|
set et_sync_char_short_saved 1
|
2856 |
|
|
}
|
2857 |
|
|
}
|
2858 |
|
|
|
2859 |
|
|
verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
|
2860 |
|
|
return $et_sync_char_short_saved
|
2861 |
|
|
}
|
2862 |
|
|
|
2863 |
|
|
# Return 1 if the target uses a ColdFire FPU.
|
2864 |
|
|
|
2865 |
|
|
proc check_effective_target_coldfire_fpu { } {
|
2866 |
|
|
return [check_no_compiler_messages coldfire_fpu assembly {
|
2867 |
|
|
#ifndef __mcffpu__
|
2868 |
|
|
#error FOO
|
2869 |
|
|
#endif
|
2870 |
|
|
}]
|
2871 |
|
|
}
|
2872 |
|
|
|
2873 |
|
|
# Return true if this is a uClibc target.
|
2874 |
|
|
|
2875 |
|
|
proc check_effective_target_uclibc {} {
|
2876 |
|
|
return [check_no_compiler_messages uclibc object {
|
2877 |
|
|
#include
|
2878 |
|
|
#if !defined (__UCLIBC__)
|
2879 |
|
|
#error FOO
|
2880 |
|
|
#endif
|
2881 |
|
|
}]
|
2882 |
|
|
}
|
2883 |
|
|
|
2884 |
|
|
# Return true if this is a uclibc target and if the uclibc feature
|
2885 |
|
|
# described by __$feature__ is not present.
|
2886 |
|
|
|
2887 |
|
|
proc check_missing_uclibc_feature {feature} {
|
2888 |
|
|
return [check_no_compiler_messages $feature object "
|
2889 |
|
|
#include
|
2890 |
490 |
jeremybenn |
#if !defined (__UCLIBC__) || defined (__${feature}__)
|
2891 |
306 |
jeremybenn |
#error FOO
|
2892 |
|
|
#endif
|
2893 |
|
|
"]
|
2894 |
|
|
}
|
2895 |
|
|
|
2896 |
|
|
# Return true if this is a Newlib target.
|
2897 |
|
|
|
2898 |
|
|
proc check_effective_target_newlib {} {
|
2899 |
|
|
return [check_no_compiler_messages newlib object {
|
2900 |
|
|
#include
|
2901 |
|
|
}]
|
2902 |
|
|
}
|
2903 |
|
|
|
2904 |
|
|
# Return 1 if
|
2905 |
|
|
# (a) an error of a few ULP is expected in string to floating-point
|
2906 |
|
|
# conversion functions; and
|
2907 |
|
|
# (b) overflow is not always detected correctly by those functions.
|
2908 |
|
|
|
2909 |
|
|
proc check_effective_target_lax_strtofp {} {
|
2910 |
|
|
# By default, assume that all uClibc targets suffer from this.
|
2911 |
|
|
return [check_effective_target_uclibc]
|
2912 |
|
|
}
|
2913 |
|
|
|
2914 |
|
|
# Return 1 if this is a target for which wcsftime is a dummy
|
2915 |
|
|
# function that always returns 0.
|
2916 |
|
|
|
2917 |
|
|
proc check_effective_target_dummy_wcsftime {} {
|
2918 |
|
|
# By default, assume that all uClibc targets suffer from this.
|
2919 |
|
|
return [check_effective_target_uclibc]
|
2920 |
|
|
}
|
2921 |
|
|
|
2922 |
|
|
# Return 1 if constructors with initialization priority arguments are
|
2923 |
|
|
# supposed on this target.
|
2924 |
|
|
|
2925 |
|
|
proc check_effective_target_init_priority {} {
|
2926 |
|
|
return [check_no_compiler_messages init_priority assembly "
|
2927 |
|
|
void f() __attribute__((constructor (1000)));
|
2928 |
|
|
void f() \{\}
|
2929 |
|
|
"]
|
2930 |
|
|
}
|
2931 |
|
|
|
2932 |
|
|
# Return 1 if the target matches the effective target 'arg', 0 otherwise.
|
2933 |
|
|
# This can be used with any check_* proc that takes no argument and
|
2934 |
|
|
# returns only 1 or 0. It could be used with check_* procs that take
|
2935 |
|
|
# arguments with keywords that pass particular arguments.
|
2936 |
|
|
|
2937 |
|
|
proc is-effective-target { arg } {
|
2938 |
|
|
set selected 0
|
2939 |
|
|
if { [info procs check_effective_target_${arg}] != [list] } {
|
2940 |
|
|
set selected [check_effective_target_${arg}]
|
2941 |
|
|
} else {
|
2942 |
|
|
switch $arg {
|
2943 |
|
|
"vmx_hw" { set selected [check_vmx_hw_available] }
|
2944 |
|
|
"named_sections" { set selected [check_named_sections_available] }
|
2945 |
|
|
"gc_sections" { set selected [check_gc_sections_available] }
|
2946 |
|
|
"cxa_atexit" { set selected [check_cxa_atexit_available] }
|
2947 |
|
|
default { error "unknown effective target keyword `$arg'" }
|
2948 |
|
|
}
|
2949 |
|
|
}
|
2950 |
|
|
verbose "is-effective-target: $arg $selected" 2
|
2951 |
|
|
return $selected
|
2952 |
|
|
}
|
2953 |
|
|
|
2954 |
|
|
# Return 1 if the argument is an effective-target keyword, 0 otherwise.
|
2955 |
|
|
|
2956 |
|
|
proc is-effective-target-keyword { arg } {
|
2957 |
|
|
if { [info procs check_effective_target_${arg}] != [list] } {
|
2958 |
|
|
return 1
|
2959 |
|
|
} else {
|
2960 |
|
|
# These have different names for their check_* procs.
|
2961 |
|
|
switch $arg {
|
2962 |
|
|
"vmx_hw" { return 1 }
|
2963 |
|
|
"named_sections" { return 1 }
|
2964 |
|
|
"gc_sections" { return 1 }
|
2965 |
|
|
"cxa_atexit" { return 1 }
|
2966 |
|
|
default { return 0 }
|
2967 |
|
|
}
|
2968 |
|
|
}
|
2969 |
|
|
}
|
2970 |
|
|
|
2971 |
|
|
# Return 1 if target default to short enums
|
2972 |
|
|
|
2973 |
|
|
proc check_effective_target_short_enums { } {
|
2974 |
|
|
return [check_no_compiler_messages short_enums assembly {
|
2975 |
|
|
enum foo { bar };
|
2976 |
|
|
int s[sizeof (enum foo) == 1 ? 1 : -1];
|
2977 |
|
|
}]
|
2978 |
|
|
}
|
2979 |
|
|
|
2980 |
|
|
# Return 1 if target supports merging string constants at link time.
|
2981 |
|
|
|
2982 |
|
|
proc check_effective_target_string_merging { } {
|
2983 |
|
|
return [check_no_messages_and_pattern string_merging \
|
2984 |
|
|
"rodata\\.str" assembly {
|
2985 |
|
|
const char *var = "String";
|
2986 |
|
|
} {-O2}]
|
2987 |
|
|
}
|
2988 |
|
|
|
2989 |
|
|
# Return 1 if target has the basic signed and unsigned types in
|
2990 |
|
|
# , 0 otherwise. This will be obsolete when GCC ensures a
|
2991 |
|
|
# working for all targets.
|
2992 |
|
|
|
2993 |
|
|
proc check_effective_target_stdint_types { } {
|
2994 |
|
|
return [check_no_compiler_messages stdint_types assembly {
|
2995 |
|
|
#include
|
2996 |
|
|
int8_t a; int16_t b; int32_t c; int64_t d;
|
2997 |
|
|
uint8_t e; uint16_t f; uint32_t g; uint64_t h;
|
2998 |
|
|
}]
|
2999 |
|
|
}
|
3000 |
|
|
|
3001 |
|
|
# Return 1 if target has the basic signed and unsigned types in
|
3002 |
|
|
# , 0 otherwise. This is for tests that GCC's notions of
|
3003 |
|
|
# these types agree with those in the header, as some systems have
|
3004 |
|
|
# only .
|
3005 |
|
|
|
3006 |
|
|
proc check_effective_target_inttypes_types { } {
|
3007 |
|
|
return [check_no_compiler_messages inttypes_types assembly {
|
3008 |
|
|
#include
|
3009 |
|
|
int8_t a; int16_t b; int32_t c; int64_t d;
|
3010 |
|
|
uint8_t e; uint16_t f; uint32_t g; uint64_t h;
|
3011 |
|
|
}]
|
3012 |
|
|
}
|
3013 |
|
|
|
3014 |
|
|
# Return 1 if programs are intended to be run on a simulator
|
3015 |
|
|
# (i.e. slowly) rather than hardware (i.e. fast).
|
3016 |
|
|
|
3017 |
|
|
proc check_effective_target_simulator { } {
|
3018 |
|
|
|
3019 |
|
|
# All "src/sim" simulators set this one.
|
3020 |
|
|
if [board_info target exists is_simulator] {
|
3021 |
|
|
return [board_info target is_simulator]
|
3022 |
|
|
}
|
3023 |
|
|
|
3024 |
|
|
# The "sid" simulators don't set that one, but at least they set
|
3025 |
|
|
# this one.
|
3026 |
|
|
if [board_info target exists slow_simulator] {
|
3027 |
|
|
return [board_info target slow_simulator]
|
3028 |
|
|
}
|
3029 |
|
|
|
3030 |
|
|
return 0
|
3031 |
|
|
}
|
3032 |
|
|
|
3033 |
|
|
# Return 1 if the target is a VxWorks kernel.
|
3034 |
|
|
|
3035 |
|
|
proc check_effective_target_vxworks_kernel { } {
|
3036 |
|
|
return [check_no_compiler_messages vxworks_kernel assembly {
|
3037 |
|
|
#if !defined __vxworks || defined __RTP__
|
3038 |
|
|
#error NO
|
3039 |
|
|
#endif
|
3040 |
|
|
}]
|
3041 |
|
|
}
|
3042 |
|
|
|
3043 |
|
|
# Return 1 if the target is a VxWorks RTP.
|
3044 |
|
|
|
3045 |
|
|
proc check_effective_target_vxworks_rtp { } {
|
3046 |
|
|
return [check_no_compiler_messages vxworks_rtp assembly {
|
3047 |
|
|
#if !defined __vxworks || !defined __RTP__
|
3048 |
|
|
#error NO
|
3049 |
|
|
#endif
|
3050 |
|
|
}]
|
3051 |
|
|
}
|
3052 |
|
|
|
3053 |
|
|
# Return 1 if the target is expected to provide wide character support.
|
3054 |
|
|
|
3055 |
|
|
proc check_effective_target_wchar { } {
|
3056 |
|
|
if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR]} {
|
3057 |
|
|
return 0
|
3058 |
|
|
}
|
3059 |
|
|
return [check_no_compiler_messages wchar assembly {
|
3060 |
|
|
#include
|
3061 |
|
|
}]
|
3062 |
|
|
}
|
3063 |
|
|
|
3064 |
|
|
# Return 1 if the target has .
|
3065 |
|
|
|
3066 |
|
|
proc check_effective_target_pthread_h { } {
|
3067 |
|
|
return [check_no_compiler_messages pthread_h assembly {
|
3068 |
|
|
#include
|
3069 |
|
|
}]
|
3070 |
|
|
}
|
3071 |
|
|
|
3072 |
|
|
# Return 1 if the target can truncate a file from a file-descriptor,
|
3073 |
|
|
# as used by libgfortran/io/unix.c:fd_truncate; i.e. ftruncate or
|
3074 |
|
|
# chsize. We test for a trivially functional truncation; no stubs.
|
3075 |
|
|
# As libgfortran uses _FILE_OFFSET_BITS 64, we do too; it'll cause a
|
3076 |
|
|
# different function to be used.
|
3077 |
|
|
|
3078 |
|
|
proc check_effective_target_fd_truncate { } {
|
3079 |
|
|
set prog {
|
3080 |
|
|
#define _FILE_OFFSET_BITS 64
|
3081 |
|
|
#include
|
3082 |
|
|
#include
|
3083 |
|
|
#include
|
3084 |
|
|
int main ()
|
3085 |
|
|
{
|
3086 |
|
|
FILE *f = fopen ("tst.tmp", "wb");
|
3087 |
|
|
int fd;
|
3088 |
|
|
const char t[] = "test writing more than ten characters";
|
3089 |
|
|
char s[11];
|
3090 |
|
|
fd = fileno (f);
|
3091 |
|
|
write (fd, t, sizeof (t) - 1);
|
3092 |
|
|
lseek (fd, 0, 0);
|
3093 |
|
|
if (ftruncate (fd, 10) != 0)
|
3094 |
|
|
exit (1);
|
3095 |
|
|
close (fd);
|
3096 |
|
|
f = fopen ("tst.tmp", "rb");
|
3097 |
|
|
if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
|
3098 |
|
|
exit (1);
|
3099 |
|
|
exit (0);
|
3100 |
|
|
}
|
3101 |
|
|
}
|
3102 |
|
|
|
3103 |
|
|
if { [check_runtime ftruncate $prog] } {
|
3104 |
|
|
return 1;
|
3105 |
|
|
}
|
3106 |
|
|
|
3107 |
|
|
regsub "ftruncate" $prog "chsize" prog
|
3108 |
|
|
return [check_runtime chsize $prog]
|
3109 |
|
|
}
|
3110 |
|
|
|
3111 |
|
|
# Add to FLAGS all the target-specific flags needed to access the c99 runtime.
|
3112 |
|
|
|
3113 |
|
|
proc add_options_for_c99_runtime { flags } {
|
3114 |
|
|
if { [istarget *-*-solaris2*] } {
|
3115 |
|
|
return "$flags -std=c99"
|
3116 |
|
|
}
|
3117 |
|
|
if { [istarget powerpc-*-darwin*] } {
|
3118 |
|
|
return "$flags -mmacosx-version-min=10.3"
|
3119 |
|
|
}
|
3120 |
|
|
return $flags
|
3121 |
|
|
}
|
3122 |
|
|
|
3123 |
|
|
# Add to FLAGS all the target-specific flags needed to enable
|
3124 |
|
|
# full IEEE compliance mode.
|
3125 |
|
|
|
3126 |
|
|
proc add_options_for_ieee { flags } {
|
3127 |
|
|
if { [istarget "alpha*-*-*"]
|
3128 |
|
|
|| [istarget "sh*-*-*"] } {
|
3129 |
|
|
return "$flags -mieee"
|
3130 |
|
|
}
|
3131 |
|
|
return $flags
|
3132 |
|
|
}
|
3133 |
|
|
|
3134 |
|
|
# Add to FLAGS the flags needed to enable functions to bind locally
|
3135 |
|
|
# when using pic/PIC passes in the testsuite.
|
3136 |
|
|
|
3137 |
|
|
proc add_options_for_bind_pic_locally { flags } {
|
3138 |
|
|
if {[check_no_compiler_messages using_pic2 assembly {
|
3139 |
|
|
#if __PIC__ != 2
|
3140 |
|
|
#error FOO
|
3141 |
|
|
#endif
|
3142 |
|
|
}]} {
|
3143 |
|
|
return "$flags -fPIE"
|
3144 |
|
|
}
|
3145 |
|
|
if {[check_no_compiler_messages using_pic1 assembly {
|
3146 |
|
|
#if __PIC__ != 1
|
3147 |
|
|
#error FOO
|
3148 |
|
|
#endif
|
3149 |
|
|
}]} {
|
3150 |
|
|
return "$flags -fpie"
|
3151 |
|
|
}
|
3152 |
|
|
|
3153 |
|
|
return $flags
|
3154 |
|
|
}
|
3155 |
|
|
|
3156 |
|
|
# Return 1 if the target provides a full C99 runtime.
|
3157 |
|
|
|
3158 |
|
|
proc check_effective_target_c99_runtime { } {
|
3159 |
|
|
return [check_cached_effective_target c99_runtime {
|
3160 |
|
|
global srcdir
|
3161 |
|
|
|
3162 |
|
|
set file [open "$srcdir/gcc.dg/builtins-config.h"]
|
3163 |
|
|
set contents [read $file]
|
3164 |
|
|
close $file
|
3165 |
|
|
append contents {
|
3166 |
|
|
#ifndef HAVE_C99_RUNTIME
|
3167 |
|
|
#error FOO
|
3168 |
|
|
#endif
|
3169 |
|
|
}
|
3170 |
|
|
check_no_compiler_messages_nocache c99_runtime assembly \
|
3171 |
|
|
$contents [add_options_for_c99_runtime ""]
|
3172 |
|
|
}]
|
3173 |
|
|
}
|
3174 |
|
|
|
3175 |
|
|
# Return 1 if target wchar_t is at least 4 bytes.
|
3176 |
|
|
|
3177 |
|
|
proc check_effective_target_4byte_wchar_t { } {
|
3178 |
|
|
return [check_no_compiler_messages 4byte_wchar_t object {
|
3179 |
|
|
int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
|
3180 |
|
|
}]
|
3181 |
|
|
}
|
3182 |
|
|
|
3183 |
|
|
# Return 1 if the target supports automatic stack alignment.
|
3184 |
|
|
|
3185 |
|
|
proc check_effective_target_automatic_stack_alignment { } {
|
3186 |
|
|
if { [istarget i?86*-*-*]
|
3187 |
|
|
|| [istarget x86_64-*-*] } then {
|
3188 |
|
|
return 1
|
3189 |
|
|
} else {
|
3190 |
|
|
return 0
|
3191 |
|
|
}
|
3192 |
|
|
}
|
3193 |
|
|
|
3194 |
|
|
# Return 1 if avx instructions can be compiled.
|
3195 |
|
|
|
3196 |
|
|
proc check_effective_target_avx { } {
|
3197 |
|
|
return [check_no_compiler_messages avx object {
|
3198 |
|
|
void _mm256_zeroall (void)
|
3199 |
|
|
{
|
3200 |
|
|
__builtin_ia32_vzeroall ();
|
3201 |
|
|
}
|
3202 |
|
|
} "-O2 -mavx" ]
|
3203 |
|
|
}
|
3204 |
|
|
|
3205 |
|
|
# Return 1 if sse instructions can be compiled.
|
3206 |
|
|
proc check_effective_target_sse { } {
|
3207 |
|
|
return [check_no_compiler_messages sse object {
|
3208 |
|
|
int main ()
|
3209 |
|
|
{
|
3210 |
|
|
__builtin_ia32_stmxcsr ();
|
3211 |
|
|
return 0;
|
3212 |
|
|
}
|
3213 |
|
|
} "-O2 -msse" ]
|
3214 |
|
|
}
|
3215 |
|
|
|
3216 |
|
|
# Return 1 if sse2 instructions can be compiled.
|
3217 |
|
|
proc check_effective_target_sse2 { } {
|
3218 |
|
|
return [check_no_compiler_messages sse2 object {
|
3219 |
|
|
typedef long long __m128i __attribute__ ((__vector_size__ (16)));
|
3220 |
|
|
|
3221 |
|
|
__m128i _mm_srli_si128 (__m128i __A, int __N)
|
3222 |
|
|
{
|
3223 |
|
|
return (__m128i)__builtin_ia32_psrldqi128 (__A, 8);
|
3224 |
|
|
}
|
3225 |
|
|
} "-O2 -msse2" ]
|
3226 |
|
|
}
|
3227 |
|
|
|
3228 |
|
|
# Return 1 if C wchar_t type is compatible with char16_t.
|
3229 |
|
|
|
3230 |
|
|
proc check_effective_target_wchar_t_char16_t_compatible { } {
|
3231 |
|
|
return [check_no_compiler_messages wchar_t_char16_t object {
|
3232 |
|
|
__WCHAR_TYPE__ wc;
|
3233 |
|
|
__CHAR16_TYPE__ *p16 = &wc;
|
3234 |
|
|
char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
|
3235 |
|
|
}]
|
3236 |
|
|
}
|
3237 |
|
|
|
3238 |
|
|
# Return 1 if C wchar_t type is compatible with char32_t.
|
3239 |
|
|
|
3240 |
|
|
proc check_effective_target_wchar_t_char32_t_compatible { } {
|
3241 |
|
|
return [check_no_compiler_messages wchar_t_char32_t object {
|
3242 |
|
|
__WCHAR_TYPE__ wc;
|
3243 |
|
|
__CHAR32_TYPE__ *p32 = &wc;
|
3244 |
|
|
char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
|
3245 |
|
|
}]
|
3246 |
|
|
}
|
3247 |
|
|
|
3248 |
|
|
# Return 1 if pow10 function exists.
|
3249 |
|
|
|
3250 |
|
|
proc check_effective_target_pow10 { } {
|
3251 |
|
|
return [check_runtime pow10 {
|
3252 |
|
|
#include
|
3253 |
|
|
int main () {
|
3254 |
|
|
double x;
|
3255 |
|
|
x = pow10 (1);
|
3256 |
|
|
return 0;
|
3257 |
|
|
}
|
3258 |
|
|
} "-lm" ]
|
3259 |
|
|
}
|
3260 |
|
|
|
3261 |
|
|
# Return 1 if current options generate DFP instructions, 0 otherwise.
|
3262 |
|
|
|
3263 |
|
|
proc check_effective_target_hard_dfp {} {
|
3264 |
|
|
return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
|
3265 |
|
|
typedef float d64 __attribute__((mode(DD)));
|
3266 |
|
|
d64 x, y, z;
|
3267 |
|
|
void foo (void) { z = x + y; }
|
3268 |
|
|
}]
|
3269 |
|
|
}
|
3270 |
|
|
|
3271 |
|
|
# Return 1 if string.h and wchar.h headers provide C++ requires overloads
|
3272 |
|
|
# for strchr etc. functions.
|
3273 |
|
|
|
3274 |
|
|
proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
|
3275 |
|
|
return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
|
3276 |
|
|
#include
|
3277 |
|
|
#include
|
3278 |
|
|
#if !defined(__cplusplus) \
|
3279 |
|
|
|| !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) \
|
3280 |
|
|
|| !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
|
3281 |
|
|
ISO C++ correct string.h and wchar.h protos not supported.
|
3282 |
|
|
#else
|
3283 |
|
|
int i;
|
3284 |
|
|
#endif
|
3285 |
|
|
}]
|
3286 |
|
|
}
|
3287 |
|
|
|
3288 |
|
|
# Return 1 if GNU as is used.
|
3289 |
|
|
|
3290 |
|
|
proc check_effective_target_gas { } {
|
3291 |
|
|
global use_gas_saved
|
3292 |
|
|
global tool
|
3293 |
|
|
|
3294 |
|
|
if {![info exists use_gas_saved]} {
|
3295 |
|
|
# Check if the as used by gcc is GNU as.
|
3296 |
|
|
set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
|
3297 |
|
|
# Provide /dev/null as input, otherwise gas times out reading from
|
3298 |
|
|
# stdin.
|
3299 |
|
|
set status [remote_exec host "$gcc_as" "-v /dev/null"]
|
3300 |
|
|
set as_output [lindex $status 1]
|
3301 |
|
|
if { [ string first "GNU" $as_output ] >= 0 } {
|
3302 |
|
|
set use_gas_saved 1
|
3303 |
|
|
} else {
|
3304 |
|
|
set use_gas_saved 0
|
3305 |
|
|
}
|
3306 |
|
|
}
|
3307 |
|
|
return $use_gas_saved
|
3308 |
|
|
}
|
3309 |
|
|
|
3310 |
|
|
# Return 1 if the compiler has been configure with link-time optimization
|
3311 |
|
|
# (LTO) support.
|
3312 |
|
|
|
3313 |
|
|
proc check_effective_target_lto { } {
|
3314 |
|
|
global ENABLE_LTO
|
3315 |
|
|
return [info exists ENABLE_LTO]
|
3316 |
|
|
}
|
3317 |
|
|
|
3318 |
|
|
# Return 1 if the language for the compiler under test is C.
|
3319 |
|
|
|
3320 |
|
|
proc check_effective_target_c { } {
|
3321 |
|
|
global tool
|
3322 |
|
|
if [string match $tool "gcc"] {
|
3323 |
|
|
return 1
|
3324 |
|
|
}
|
3325 |
|
|
return 0
|
3326 |
|
|
}
|
3327 |
|
|
|
3328 |
|
|
# Return 1 if the language for the compiler under test is C++.
|
3329 |
|
|
|
3330 |
|
|
proc check_effective_target_c++ { } {
|
3331 |
|
|
global tool
|
3332 |
|
|
if [string match $tool "g++"] {
|
3333 |
|
|
return 1
|
3334 |
|
|
}
|
3335 |
|
|
return 0
|
3336 |
|
|
}
|