1 # Copyright
(C
) 1999, 2001, 2003, 2004, 2005, 2006, 2007
2 # Free Software Foundation
, Inc.
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.
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.
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 #
<http
://www.gnu.org
/licenses
/>.
18 # Please email
any bugs
, comments
, and
/or additions to this file to
:
19 # gcc
-patches@gcc.gnu.org
21 # This file defines procs
for determining features supported by the target.
23 # Try to
compile some code and
return the messages printed by the compiler
,
24 # and optionally the contents
for assembly files. Either a string or
25 # a list of two strings are returned
, depending
on WANT_OUTPUT.
27 # BASENAME is a basename to use
for temporary files.
28 # WANT_OUTPUT is a flag which is
0 to request returning just the
29 # compiler messages
, or
1 to
return the messages and the contents
30 # of the assembly file. TYPE should be
"assembly" if WANT_OUTPUT
32 # TYPE is the type of compilation to perform
(see target_compile
).
33 # CONTENTS gives the contents of the input file.
34 # The rest is optional
:
35 # OPTIONS
: additional compiler options to use.
36 proc get_compiler_messages
{basename want_output type contents
args} {
39 if { [llength $
args] > 0 } {
40 set options
[list
"additional_flags=[lindex $args 0]"]
45 set src $
{basename
}[pid
].c
47 assembly
{ set output $
{basename
}[pid
].s
}
48 object
{ set output $
{basename
}[pid
].o
}
53 set lines
[$
{tool
}_target_compile $src $output $type
"$options"]
57 if { $type
!= "assembly" } {
58 error
"WANT_OUTPUT can only be used with assembly output"
59 } elseif
{ ![string match
"" $lines] } {
61 set result
[list $lines
""]
64 set chan
[open
"$output"]
65 while {[gets $chan line
] >= 0} {
69 set result
[list $lines $
text]
75 remote_file build
delete $output
79 proc current_target_name
{ } {
81 if [info exists target_info
(target
,name)] {
82 set answer $target_info
(target
,name)
89 # Implement an effective
-target check
for property PROP by invoking
90 # the Tcl command
ARGS and seeing
if it returns true.
92 proc check_cached_effective_target
{ prop
args } {
95 set target
[current_target_name
]
96 if {![info exists et_cache
($prop
,target
)]
97 || $et_cache
($prop
,target
) != $target
} {
98 verbose
"check_cached_effective_target $prop: checking $target" 2
99 set et_cache
($prop
,target
) $target
100 set et_cache
($prop
,value
) [uplevel eval $
args]
102 set value $et_cache
($prop
,value
)
103 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
107 # Implement an effective
-target check
for property PROP by invoking
108 # the compiler and seeing
if it prints
any messages. Assume that the
109 #
property holds
if the compiler doesn
't print anything. The other
110 # arguments are as for get_compiler_messages, starting with TYPE.
111 proc check_no_compiler_messages {prop args} {
112 return [check_cached_effective_target $prop {
113 string match "" [eval get_compiler_messages $prop 0 $args]
117 # Similar to check_no_compiler_messages, but also verify that the regular
118 # expression PATTERN matches the compiler's output.
119 proc check_no_messages_and_pattern
{prop pattern
args} {
120 return [check_cached_effective_target $prop
{
121 set results
[eval get_compiler_messages $prop
1 $
args]
122 expr
{ [string match
"" [lindex $results 0]]
123 && [regexp $pattern
[lindex $results
1]] }
127 ###############################
128 # proc check_weak_available
{ }
129 ###############################
131 # weak symbols are only supported in some configs
/object formats
132 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
134 proc check_weak_available
{ } {
135 global target_triplet
138 # All mips targets should support it
140 if { [ string first
"mips" $target_cpu ] >= 0 } {
144 # All solaris2 targets should support it
146 if { [regexp
".*-solaris2.*" $target_triplet] } {
150 # DEC OSF
/1/Digital UNIX
/Tru64 UNIX supports it
152 if { [regexp
"alpha.*osf.*" $target_triplet] } {
156 # Windows targets Cygwin and MingW32 support it
158 if { [regexp
".*mingw32|.*cygwin" $target_triplet] } {
162 # HP
-UX
10.X doesn
't support it
164 if { [istarget "hppa*-*-hpux10*"] } {
168 # ELF and ECOFF support it. a.out does with gas/gld but may also with
169 # other linkers, so we should try it
171 set objformat [gcc_target_object_format]
179 unknown { return -1 }
184 ###############################
185 # proc check_visibility_available { what_kind }
186 ###############################
188 # The visibility attribute is only support in some object formats
189 # This proc returns 1 if it is supported, 0 if not.
190 # The argument is the kind of visibility, default/protected/hidden/internal.
192 proc check_visibility_available { what_kind } {
194 global target_triplet
196 # On NetWare, support makes no sense.
197 if { [istarget *-*-netware*] } {
201 if [string match "" $what_kind] { set what_kind "hidden" }
203 return [check_no_compiler_messages visibility_available_$what_kind object "
204 void f() __attribute__((visibility(\"$what_kind\")));
209 ###############################
210 # proc check_alias_available { }
211 ###############################
213 # Determine if the target toolchain supports the alias attribute.
215 # Returns 2 if the target supports aliases. Returns 1 if the target
216 # only supports weak aliased. Returns 0 if the target does not
217 # support aliases at all. Returns -1 if support for aliases could not
220 proc check_alias_available { } {
221 global alias_available_saved
224 if [info exists alias_available_saved] {
225 verbose "check_alias_available returning saved $alias_available_saved" 2
229 verbose "check_alias_available compiling testfile $src" 2
230 set f [open $src "w"]
231 # Compile a small test program. The definition of "g" is
232 # necessary to keep the Solaris assembler from complaining
234 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
235 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
237 set lines [${tool}_target_compile $src $obj object ""]
239 remote_file build delete $obj
241 if [string match "" $lines] then {
242 # No error messages, everything is OK.
243 set alias_available_saved 2
245 if [regexp "alias definitions not supported" $lines] {
246 verbose "check_alias_available target does not support aliases" 2
248 set objformat [gcc_target_object_format]
250 if { $objformat == "elf" } {
251 verbose "check_alias_available but target uses ELF format, so it ought to" 2
252 set alias_available_saved -1
254 set alias_available_saved 0
257 if [regexp "only weak aliases are supported" $lines] {
258 verbose "check_alias_available target supports only weak aliases" 2
259 set alias_available_saved 1
261 set alias_available_saved -1
266 verbose "check_alias_available returning $alias_available_saved" 2
269 return $alias_available_saved
272 # Returns true if --gc-sections is supported on the target.
274 proc check_gc_sections_available { } {
275 global gc_sections_available_saved
278 if {![info exists gc_sections_available_saved]} {
279 # Some targets don't support gc
-sections despite whatever
's
280 # advertised by ld's options.
281 if { [istarget alpha
*-*-*]
282 ||
[istarget ia64
-*-*] } {
283 set gc_sections_available_saved
0
287 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
289 if { [board_info target
exists ldflags
]
290 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
291 set gc_sections_available_saved
0
295 # VxWorks kernel modules are relocatable objects linked with
-r
,
296 #
while RTP executables are linked with
-q
(--emit
-relocs
).
297 # Both of these options are incompatible with
--gc
-sections.
298 if { [istarget
*-*-vxworks
*] } {
299 set gc_sections_available_saved
0
303 # Check
if the
ld used by gcc supports
--gc
-sections.
304 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
305 regsub
".*\n\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
306 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
307 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
308 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
309 set gc_sections_available_saved
1
311 set gc_sections_available_saved
0
314 return $gc_sections_available_saved
317 #
Return true
if profiling is supported
on the target.
319 proc check_profiling_available
{ test_what
} {
320 global profiling_available_saved
322 verbose
"Profiling argument is <$test_what>" 1
324 # These conditions depend
on the
argument so examine them before
325 # looking at the
cache variable.
327 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
328 # vendor compiler. We cannot reliably predict the directory where the
329 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
330 # necessarily find mcrt1.o even if we have it.
331 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
335 # Support for -p on irix relies on libprof1.a which doesn't appear to
336 # exist
on any irix6
system currently posting testsuite results.
337 # Support
for -pg
on irix relies
on gcrt1.o which doesn
't exist yet.
338 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
339 if { [istarget mips*-*-irix*]
340 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
344 # At present, there is no profiling support on NetWare.
345 if { [istarget *-*-netware*] } {
349 # uClibc does not have gcrt1.o.
350 if { [check_effective_target_uclibc]
351 && ([lindex $test_what 1] == "-p"
352 || [lindex $test_what 1] == "-pg") } {
356 # Now examine the cache variable.
357 if {![info exists profiling_available_saved]} {
358 # Some targets don't have
any implementation of __bb_init_func or are
359 # missing other needed machinery.
360 if { [istarget mmix
-*-*]
361 ||
[istarget arm
*-*-eabi
*]
362 ||
[istarget arm
*-*-elf
]
363 ||
[istarget arm
*-*-symbianelf
*]
364 ||
[istarget bfin
-*-*]
365 ||
[istarget powerpc
-*-eabi
*]
366 ||
[istarget strongarm
*-*-elf
]
367 ||
[istarget xscale
*-*-elf
]
368 ||
[istarget cris
-*-*]
369 ||
[istarget fido
-*-elf
]
370 ||
[istarget h8300
-*-*]
371 ||
[istarget m32c
-*-elf
]
372 ||
[istarget m68k
-*-elf
]
373 ||
[istarget m68k
-*-uclinux
*]
374 ||
[istarget mips
*-*-elf
*]
375 ||
[istarget xtensa
-*-elf
]
376 ||
[istarget
*-*-vxworks
*]
377 ||
[istarget
*-*-windiss
] } {
378 set profiling_available_saved
0
380 set profiling_available_saved
1
384 return $profiling_available_saved
387 #
Return 1 if target has packed layout of structure members by
388 # default
, 0 otherwise. Note that this is slightly different than
389 # whether the target has
"natural alignment": both attributes may be
392 proc check_effective_target_default_packed
{ } {
393 return [check_no_compiler_messages default_packed assembly
{
394 struct x
{ char a
; long b
; } c
;
395 int s
[sizeof
(c
) == sizeof
(char
) + sizeof
(long
) ?
1 : -1];
399 #
Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
400 # documentation
, where the test also comes from.
402 proc check_effective_target_pcc_bitfield_type_matters
{ } {
403 # PCC_BITFIELD_TYPE_MATTERS isn
't just about unnamed or empty
404 # bitfields, but let's stick to the example code from the docs.
405 return [check_no_compiler_messages pcc_bitfield_type_matters assembly
{
406 struct foo1
{ char x
; char
:0; char y
; };
407 struct foo2
{ char x
; int :0; char y
; };
408 int s
[sizeof
(struct foo1
) != sizeof
(struct foo2
) ?
1 : -1];
412 #
Return 1 if thread local storage
(TLS
) is supported
, 0 otherwise.
414 # This won
't change for different subtargets so cache the result.
416 proc check_effective_target_tls {} {
420 if [info exists et_tls_saved] {
421 verbose "check_effective_target_tls: using cached result" 2
427 verbose "check_effective_target_tls: compiling testfile $src" 2
428 set f [open $src "w"]
429 # Compile a small test program. Make sure that we test accesses
430 # as well as declarations.
431 puts $f "__thread int i;\n"
432 puts $f "int f (void) { return i; }\n"
433 puts $f "void g (int j) { i = j; }\n"
436 # Test for thread-local data supported by the platform.
438 [${tool}_target_compile $src $asm assembly ""]
440 if { [string match "" $comp_output] } {
441 # No error messages, everything is OK.
444 remove-build-file $asm
446 verbose "check_effective_target_tls: returning $et_tls_saved" 2
450 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
452 # This won't change
for different subtargets so
cache the result.
454 proc check_effective_target_tls_native
{} {
455 global et_tls_native_saved
458 if [info exists et_tls_saved
] {
459 verbose
"check_effective_target_tls_native: using cached result" 2
461 set et_tls_native_saved
0
465 verbose
"check_effective_target_tls_native: compiling testfile $src" 2
466 set f
[open $src
"w"]
467 #
Compile a small test
program. Make sure that we test accesses
468 # as well as declarations.
469 puts $f
"__thread int i;\n"
470 puts $f
"int f (void) { return i; }\n"
471 puts $f
"void g (int j) { i = j; }\n"
474 # Test
for thread
-local data supported by the platform.
475 set comp_output
[$
{tool
}_target_compile $src $asm assembly
""]
477 if { [string match
"" $comp_output] } {
478 # No error messages
, everything is OK.
482 if { [string match
"*emutls*" $text]} {
483 set et_tls_native_saved
0
485 set et_tls_native_saved
1
488 remove
-build
-file $asm
490 verbose
"check_effective_target_tls_native: returning $et_tls_native_saved" 2
491 return $et_tls_native_saved
494 #
Return 1 if TLS executables can run correctly
, 0 otherwise.
496 # This won
't change for different subtargets so cache the result.
498 proc check_effective_target_tls_runtime {} {
499 global et_tls_runtime_saved
502 if [info exists et_tls_runtime_saved] {
503 verbose "check_effective_target_tls_runtime: using cached result" 2
505 set et_tls_runtime_saved 0
507 set src tls_runtime[pid].c
508 set exe tls_runtime[pid].x
509 verbose "check_effective_target_tls_runtime: compiling testfile $src" 2
510 set f [open $src "w"]
511 # Compile a small test program.
512 puts $f "__thread int thr = 0;\n"
513 puts $f "int main(void)\n {\n return thr;\n}"
517 [${tool}_target_compile $src $exe executable ""]
520 if [string match "" $comp_output] then {
521 # No error messages, everything is OK.
523 set result [remote_load target "./$exe" "" ""]
524 set status [lindex $result 0]
525 remote_file build delete $exe
527 verbose "check_effective_target_tls_runtime status is <$status>" 2
529 if { $status == "pass" } {
530 set et_tls_runtime_saved 1
533 verbose "check_effective_target_tls_runtime: returning $et_tls_runtime_saved" 2
537 return $et_tls_runtime_saved
540 # Return 1 if compilation with -fopenmp is error-free for trivial
543 proc check_effective_target_fopenmp {} {
544 return [check_no_compiler_messages fopenmp object {
549 # Return 1 if the target supports -fstack-protector
550 proc check_effective_target_fstack_protector {} {
554 set src stack_prot[pid].c
555 set exe stack_prot[pid].x
557 verbose "check_effective_target_fstack_protector compiling testfile $src" 2
559 set f [open $src "w"]
560 # Compile a small test program.
561 puts $f "int main (void)\n { return 0; }\n"
564 set opts "additional_flags=-fstack-protector"
565 set lines [${tool}_target_compile $src $exe executable "$opts" ]
568 if [string match "" $lines] then {
569 # No error messages, everything is OK.
570 set result [${tool}_load "./$exe" "" ""]
571 set status [lindex $result 0]
572 remote_file build delete $exe
573 verbose "check_iconv_available status is <$status>" 2
575 if { $status == "pass" } then {
582 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
583 # for trivial code, 0 otherwise.
585 proc check_effective_target_freorder {} {
586 return [check_no_compiler_messages freorder object {
588 } "-freorder-blocks-and-partition"]
591 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
592 # emitted, 0 otherwise. Whether a shared library can actually be built is
593 # out of scope for this test.
595 proc check_effective_target_fpic { } {
596 # Note that M68K has a multilib that supports -fpic but not
597 # -fPIC, so we need to check both. We test with a program that
598 # requires GOT references.
599 foreach arg {fpic fPIC} {
600 if [check_no_compiler_messages $arg object {
601 extern int foo (void); extern int bar;
602 int baz (void) { return foo () + bar; }
610 # Return true if the target supports -mpaired-single (as used on MIPS).
612 proc check_effective_target_mpaired_single { } {
613 return [check_no_compiler_messages mpaired_single object {
618 # Return true if the target is a 64-bit MIPS target.
620 proc check_effective_target_mips64 { } {
621 return [check_no_compiler_messages mips64 assembly {
628 # Return true if the target is a MIPS target that does not produce
631 proc check_effective_target_nomips16 { } {
632 return [check_no_compiler_messages nomips16 object {
636 /* A cheap way of testing for -mflip-mips16. */
637 void foo (void) { asm ("addiu $20,$20,1"); }
638 void bar (void) { asm ("addiu $20,$20,1"); }
643 # Add the options needed for MIPS16 function attributes. At the moment,
644 # we don't support MIPS16 PIC.
646 proc add_options_for_mips16_attribute
{ flags
} {
647 return "$flags -mno-abicalls -fno-pic"
650 #
Return true
if we can force a
mode that allows MIPS16 code generation.
651 # We don
't support MIPS16 PIC, and only support MIPS16 -mhard-float
654 proc check_effective_target_mips16_attribute { } {
655 return [check_no_compiler_messages mips16_attribute assembly {
659 #if defined __mips_hard_float \
660 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
661 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
664 } [add_options_for_mips16_attribute ""]]
667 # Return 1 if the current multilib does not generate PIC by default.
669 proc check_effective_target_nonpic { } {
670 return [check_no_compiler_messages nonpic assembly {
677 # Return 1 if the target does not use a status wrapper.
679 proc check_effective_target_unwrapped { } {
680 if { [target_info needs_status_wrapper] != "" \
681 && [target_info needs_status_wrapper] != "0" } {
687 # Return true if iconv is supported on the target. In particular IBM1047.
689 proc check_iconv_available { test_what } {
697 verbose "check_iconv_available compiling testfile $src" 2
698 set f [open $src "w"]
699 # Compile a small test program.
700 puts $f "#include <iconv.h>\n"
701 puts $f "int main (void)\n {\n iconv_t cd; \n"
702 puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n"
703 puts $f "if (cd == (iconv_t) -1)\n return 1;\n"
704 puts $f "return 0;\n}"
707 # If the tool configuration file has not set libiconv, try "-liconv"
708 if { ![info exists libiconv] } {
709 set libiconv "-liconv"
711 set lines [${tool}_target_compile $src $exe executable "libs=$libiconv" ]
714 if [string match "" $lines] then {
715 # No error messages, everything is OK.
717 set result [${tool}_load "./$exe" "" ""]
718 set status [lindex $result 0]
719 remote_file build delete $exe
721 verbose "check_iconv_available status is <$status>" 2
723 if { $status == "pass" } then {
731 # Return true if named sections are supported on this target.
733 proc check_named_sections_available { } {
734 return [check_no_compiler_messages named_sections assembly {
735 int __attribute__ ((section("whatever"))) foo;
739 # Return 1 if the target supports Fortran real kinds larger than real(8),
742 # When the target name changes, replace the cached result.
744 proc check_effective_target_fortran_large_real { } {
745 global et_fortran_large_real_saved
746 global et_fortran_large_real_target_name
749 if { ![info exists et_fortran_large_real_target_name] } {
750 set et_fortran_large_real_target_name ""
753 # If the target has changed since we set the cached value, clear it.
754 set current_target [current_target_name]
755 if { $current_target != $et_fortran_large_real_target_name } {
756 verbose "check_effective_target_fortran_large_real: `$et_fortran_large_real_target_name' `$current_target
'" 2
757 set et_fortran_large_real_target_name $current_target
758 if [info exists et_fortran_large_real_saved] {
759 verbose "check_effective_target_fortran_large_real: removing cached result" 2
760 unset et_fortran_large_real_saved
764 if [info exists et_fortran_large_real_saved] {
765 verbose "check_effective_target_fortran_large_real returning saved $et_fortran_large_real_saved" 2
767 set et_fortran_large_real_saved 0
769 # Set up, compile, and execute a test program using large real
770 # kinds. Include the current process ID in the file names to
771 # prevent conflicts with invocations for multiple testsuites.
772 set src real[pid].f90
775 set f [open $src "w"]
776 puts $f "integer,parameter :: k = &"
777 puts $f " selected_real_kind (precision (0.0_8) + 1)"
778 puts $f "real(kind=k) :: x"
779 puts $f "x = cos (x);"
783 verbose "check_effective_target_fortran_large_real compiling testfile $src" 2
784 set lines [${tool}_target_compile $src $exe executable ""]
787 if [string match "" $lines] then {
788 # No error message, compilation succeeded.
789 remote_file build delete $exe
790 set et_fortran_large_real_saved 1
794 return $et_fortran_large_real_saved
797 # Return 1 if the target supports Fortran integer kinds larger than
798 # integer(8), 0 otherwise.
800 # When the target name changes, replace the cached result.
802 proc check_effective_target_fortran_large_int { } {
803 global et_fortran_large_int_saved
804 global et_fortran_large_int_target_name
807 if { ![info exists et_fortran_large_int_target_name] } {
808 set et_fortran_large_int_target_name ""
811 # If the target has changed since we set the cached value, clear it.
812 set current_target [current_target_name]
813 if { $current_target != $et_fortran_large_int_target_name } {
814 verbose "check_effective_target_fortran_large_int: `$et_fortran_large_int_target_name' `$current_target
'" 2
815 set et_fortran_large_int_target_name $current_target
816 if [info exists et_fortran_large_int_saved] {
817 verbose "check_effective_target_fortran_large_int: removing cached result" 2
818 unset et_fortran_large_int_saved
822 if [info exists et_fortran_large_int_saved] {
823 verbose "check_effective_target_fortran_large_int returning saved $et_fortran_large_int_saved" 2
825 set et_fortran_large_int_saved 0
827 # Set up, compile, and execute a test program using large integer
828 # kinds. Include the current process ID in the file names to
829 # prevent conflicts with invocations for multiple testsuites.
833 set f [open $src "w"]
834 puts $f "integer,parameter :: k = &"
835 puts $f " selected_int_kind (range (0_8) + 1)"
836 puts $f "integer(kind=k) :: i"
840 verbose "check_effective_target_fortran_large_int compiling testfile $src" 2
841 set lines [${tool}_target_compile $src $exe executable ""]
844 if [string match "" $lines] then {
845 # No error message, compilation succeeded.
846 remote_file build delete $exe
847 set et_fortran_large_int_saved 1
851 return $et_fortran_large_int_saved
854 # Return 1 if we can statically link libgfortran, 0 otherwise.
856 # When the target name changes, replace the cached result.
858 proc check_effective_target_static_libgfortran { } {
859 global et_static_libgfortran
860 global et_static_libgfortran_target_name
863 if { ![info exists et_static_libgfortran_target_name] } {
864 set et_static_libgfortran_target_name ""
867 # If the target has changed since we set the cached value, clear it.
868 set current_target [current_target_name]
869 if { $current_target != $et_static_libgfortran_target_name } {
870 verbose "check_effective_target_static_libgfortran: `$et_static_libgfortran_target_name' `$current_target
'" 2
871 set et_static_libgfortran_target_name $current_target
872 if [info exists et_static_libgfortran_saved] {
873 verbose "check_effective_target_static_libgfortran: removing cached result" 2
874 unset et_static_libgfortran_saved
878 if [info exists et_static_libgfortran_saved] {
879 verbose "check_effective_target_static_libgfortran returning saved $et_static_libgfortran_saved" 2
881 set et_static_libgfortran_saved 0
883 # Set up, compile, and execute a test program using static linking.
884 # Include the current process ID in the file names to prevent
885 # conflicts with invocations for multiple testsuites.
886 set opts "additional_flags=-static"
887 set src static[pid].f
888 set exe static[pid].x
890 set f [open $src "w"]
891 puts $f " print *, 'test
'"
895 verbose "check_effective_target_static_libgfortran compiling testfile $src" 2
896 set lines [${tool}_target_compile $src $exe executable "$opts"]
899 if [string match "" $lines] then {
900 # No error message, compilation succeeded.
901 remote_file build delete $exe
902 set et_static_libgfortran_saved 1
906 return $et_static_libgfortran_saved
909 # Return 1 if the target supports executing AltiVec instructions, 0
910 # otherwise. Cache the result.
912 proc check_vmx_hw_available { } {
913 global vmx_hw_available_saved
916 if [info exists vmx_hw_available_saved] {
917 verbose "check_hw_available returning saved $vmx_hw_available_saved" 2
919 set vmx_hw_available_saved 0
921 # Some simulators are known to not support VMX instructions.
922 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
923 verbose "check_hw_available returning 0" 2
924 return $vmx_hw_available_saved
927 # Set up, compile, and execute a test program containing VMX
928 # instructions. Include the current process ID in the file
929 # names to prevent conflicts with invocations for multiple
934 set f [open $src "w"]
935 puts $f "int main() {"
936 puts $f "#ifdef __MACH__"
937 puts $f " asm volatile (\"vor v0,v0,v0\");"
939 puts $f " asm volatile (\"vor 0,0,0\");"
941 puts $f " return 0; }"
944 # Most targets don't require special flags
for this test case
, but
946 if [istarget
*-*-darwin
*] {
947 set opts
"additional_flags=-maltivec"
952 verbose
"check_vmx_hw_available compiling testfile $src" 2
953 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
956 if [string match
"" $lines] then {
957 # No error message
, compilation succeeded.
958 set result
[$
{tool
}_load
"./$exe" "" ""]
959 set status [lindex $result
0]
960 remote_file build
delete $exe
961 verbose
"check_vmx_hw_available testfile status is <$status>" 2
963 if { $
status == "pass" } then {
964 set vmx_hw_available_saved
1
967 verbose
"check_vmx_hw_availalble testfile compilation failed" 2
971 return $vmx_hw_available_saved
974 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
975 # complex float arguments. This affects gfortran tests that
call cabsf
976 # in libm built by an earlier compiler.
Return 1 if libm uses the same
977 #
argument passing as the compiler under test
, 0 otherwise.
979 # When the target
name changes
, replace the cached result.
981 proc check_effective_target_broken_cplxf_arg
{ } {
982 global et_broken_cplxf_arg_saved
983 global et_broken_cplxf_arg_target_name
986 # Skip the work
for targets known not to be affected.
987 if { ![istarget powerpc64
-*-linux
*] } {
989 } elseif
{ [is
-effective
-target ilp32
] } {
993 if { ![info exists et_broken_cplxf_arg_target_name
] } {
994 set et_broken_cplxf_arg_target_name
""
997 #
If the target has changed since we
set the cached value
, clear it.
998 set current_target
[current_target_name
]
999 if { $current_target
!= $et_broken_cplxf_arg_target_name
} {
1000 verbose
"check_effective_target_broken_cplxf_arg: `$et_broken_cplxf_arg_target_name'" 2
1001 set et_broken_cplxf_arg_target_name $current_target
1002 if [info exists et_broken_cplxf_arg_saved
] {
1003 verbose
"check_effective_target_broken_cplxf_arg: removing cached result" 2
1004 unset et_broken_cplxf_arg_saved
1008 if [info exists et_broken_cplxf_arg_saved
] {
1009 verbose
"check_effective_target_broken_cplxf_arg: using cached result" 2
1011 set et_broken_cplxf_arg_saved
0
1012 # This is only known to affect one target.
1013 if { ![istarget powerpc64
-*-linux
*] ||
![is
-effective
-target lp64
] } {
1014 set et_broken_cplxf_arg_saved
0
1015 verbose
"check_effective_target_broken_cplxf_arg: caching 0" 2
1016 return $et_broken_cplxf_arg_saved
1019 #
Set up
, compile, and
execute a C test
program that calls cabsf.
1020 set src cabsf
[pid
].c
1021 set exe cabsf
[pid
].x
1023 set f
[open $src
"w"]
1024 puts $f
"#include <complex.h>"
1025 puts $f
"extern void abort (void);"
1026 puts $f
"float fabsf (float);"
1027 puts $f
"float cabsf (_Complex float);"
1028 puts $f
"int main ()"
1030 puts $f
" _Complex float cf;"
1032 puts $f
" cf = 3 + 4.0fi;"
1033 puts $f
" f = cabsf (cf);"
1034 puts $f
" if (fabsf (f - 5.0) > 0.0001) abort ();"
1035 puts $f
" return 0;"
1039 set lines
[$
{tool
}_target_compile $src $exe executable
"-lm"]
1042 if [string match
"" $lines] {
1043 # No error message
, compilation succeeded.
1044 set result
[$
{tool
}_load
"./$exe" "" ""]
1045 set status [lindex $result
0]
1046 remote_file build
delete $exe
1048 verbose
"check_effective_target_broken_cplxf_arg: status is <$status>" 2
1050 if { $
status != "pass" } {
1051 set et_broken_cplxf_arg_saved
1
1054 verbose
"check_effective_target_broken_cplxf_arg: compilation failed" 2
1057 return $et_broken_cplxf_arg_saved
1060 proc check_alpha_max_hw_available
{ } {
1061 global alpha_max_hw_available_saved
1064 if [info exists alpha_max_hw_available_saved
] {
1065 verbose
"check_alpha_max_hw_available returning saved $alpha_max_hw_available_saved" 2
1067 set alpha_max_hw_available_saved
0
1069 #
Set up
, compile, and
execute a test
program probing bit
8 of the
1070 # architecture mask
, which indicates presence of
MAX instructions.
1074 set f
[open $src
"w"]
1075 puts $f
"int main() { return __builtin_alpha_amask(1<<8) != 0; }"
1078 verbose
"check_alpha_max_hw_available compiling testfile $src" 2
1079 set lines
[$
{tool
}_target_compile $src $exe executable
""]
1082 if [string match
"" $lines] then {
1083 # No error message
, compilation succeeded.
1084 set result
[$
{tool
}_load
"./$exe" "" ""]
1085 set status [lindex $result
0]
1086 remote_file build
delete $exe
1087 verbose
"check_alpha_max_hw_available testfile status is <$status>" 2
1089 if { $
status == "pass" } then {
1090 set alpha_max_hw_available_saved
1
1093 verbose
"check_alpha_max_hw_availalble testfile compilation failed" 2
1097 return $alpha_max_hw_available_saved
1100 # Returns true iff the FUNCTION is available
on the target
system.
1101 #
(This is essentially a Tcl implementation of Autoconf
's
1104 proc check_function_available { function } {
1105 set var "${function}_available_saved"
1109 if {![info exists $var]} {
1112 # Check to make sure.
1113 set src "function[pid].c"
1114 set exe "function[pid].exe"
1116 set f [open $src "w"]
1117 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
1118 puts $f "char $function ();\n"
1119 puts $f "int main () { $function (); }"
1122 set lines [${tool}_target_compile $src $exe executable ""]
1126 if {![string match "" $lines]} then {
1128 verbose -log "$function is not available"
1130 verbose -log "$function is available"
1137 # Returns true iff "fork" is available on the target system.
1139 proc check_fork_available {} {
1140 return [check_function_available "fork"]
1143 # Returns true iff "mkfifo" is available on the target system.
1145 proc check_mkfifo_available {} {
1146 if {[istarget *-*-cygwin*]} {
1147 # Cygwin has mkfifo, but support is incomplete.
1151 return [check_function_available "mkfifo"]
1154 # Returns true iff "__cxa_atexit" is used on the target system.
1156 proc check_cxa_atexit_available { } {
1157 global et_cxa_atexit
1158 global et_cxa_atexit_target_name
1161 if { ![info exists et_cxa_atexit_target_name] } {
1162 set et_cxa_atexit_target_name ""
1165 # If the target has changed since we set the cached value, clear it.
1166 set current_target [current_target_name]
1167 if { $current_target != $et_cxa_atexit_target_name } {
1168 verbose "check_cxa_atexit_available: `$et_cxa_atexit_target_name'" 2
1169 set et_cxa_atexit_target_name $current_target
1170 if [info exists et_cxa_atexit
] {
1171 verbose
"check_cxa_atexit_available: removing cached result" 2
1176 if [info exists et_cxa_atexit
] {
1177 verbose
"check_cxa_atexit_available: using cached result" 2
1178 } elseif
{ [istarget
"hppa*-*-hpux10*"] } {
1179 # HP
-UX
10 doesn
't have __cxa_atexit but subsequent test passes.
1184 # Set up, compile, and execute a C++ test program that depends
1185 # on correct ordering of static object destructors. This is
1186 # indicative of the presence and use of __cxa_atexit.
1187 set src cxaatexit[pid].cc
1188 set exe cxaatexit[pid].x
1190 set f [open $src "w"]
1191 puts $f "#include <stdlib.h>"
1192 puts $f "static unsigned int count;"
1195 puts $f " X() { count = 1; }"
1198 puts $f " if (count != 3)"
1200 puts $f " count = 4;"
1205 puts $f " static X x;"
1209 puts $f " Y() { f(); count = 2; }"
1212 puts $f " if (count != 2)"
1214 puts $f " count = 3;"
1218 puts $f "int main()"
1219 puts $f "{ return 0; }"
1222 set lines [${tool}_target_compile $src $exe executable ""]
1225 if [string match "" $lines] {
1226 # No error message, compilation succeeded.
1227 set result [${tool}_load "./$exe" "" ""]
1228 set status [lindex $result 0]
1229 remote_file build delete $exe
1231 verbose "check_cxa_atexit_available: status is <$status>" 2
1233 if { $status == "pass" } {
1237 verbose "check_cxa_atexit_available: compilation failed" 2
1240 return $et_cxa_atexit
1244 # Return 1 if we're generating
32-bit code using default options
, 0
1247 proc check_effective_target_ilp32
{ } {
1248 return [check_no_compiler_messages ilp32 object
{
1249 int dummy
[sizeof
(int) == 4
1250 && sizeof
(void
*) == 4
1251 && sizeof
(long
) == 4 ?
1 : -1];
1255 #
Return 1 if we
're generating 32-bit or larger integers using default
1256 # options, 0 otherwise.
1258 proc check_effective_target_int32plus { } {
1259 return [check_no_compiler_messages int32plus object {
1260 int dummy[sizeof (int) >= 4 ? 1 : -1];
1264 # Return 1 if we're generating
32-bit or larger pointers using default
1265 # options
, 0 otherwise.
1267 proc check_effective_target_ptr32plus
{ } {
1268 return [check_no_compiler_messages ptr32plus object
{
1269 int dummy
[sizeof
(void
*) >= 4 ?
1 : -1];
1273 #
Return 1 if we support
32-bit or larger array and structure sizes
1274 # using default options
, 0 otherwise.
1276 proc check_effective_target_size32plus
{ } {
1277 return [check_no_compiler_messages size32plus object
{
1282 # Returns
1 if we
're generating 16-bit or smaller integers with the
1283 # default options, 0 otherwise.
1285 proc check_effective_target_int16 { } {
1286 return [check_no_compiler_messages int16 object {
1287 int dummy[sizeof (int) < 4 ? 1 : -1];
1291 # Return 1 if we're generating
64-bit code using default options
, 0
1294 proc check_effective_target_lp64
{ } {
1295 return [check_no_compiler_messages lp64 object
{
1296 int dummy
[sizeof
(int) == 4
1297 && sizeof
(void
*) == 8
1298 && sizeof
(long
) == 8 ?
1 : -1];
1302 #
Return 1 if the target supports long double larger than double
,
1305 proc check_effective_target_large_long_double
{ } {
1306 return [check_no_compiler_messages large_long_double object
{
1307 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1311 #
Return 1 if the target supports compiling fixed
-point
,
1314 proc check_effective_target_fixed_point
{ } {
1315 return [check_no_compiler_messages fixed_point object
{
1316 _Sat _Fract x
; _Sat _Accum y
;
1320 #
Return 1 if the target supports compiling decimal floating point
,
1323 proc check_effective_target_dfp_nocache
{ } {
1324 verbose
"check_effective_target_dfp_nocache: compiling source" 2
1325 set ret
[string match
"" [get_compiler_messages dfp 0 object {
1326 _Decimal32 x
; _Decimal64 y
; _Decimal128 z
;
1328 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
1332 proc check_effective_target_dfprt_nocache
{ } {
1337 verbose
"check_effective_target_dfprt_nocache: compiling source" 2
1338 #
Set up
, compile, and
execute a test
program containing decimal
1340 set src dfprt
[pid
].c
1341 set exe dfprt
[pid
].x
1343 set f
[open $src
"w"]
1344 puts $f
"_Decimal32 x = 1.2df; _Decimal64 y = 2.3dd; _Decimal128 z;"
1345 puts $f
"int main () { z = x + y; return 0; }"
1348 verbose
"check_effective_target_dfprt_nocache: compiling testfile $src" 2
1349 set lines
[$
{tool
}_target_compile $src $exe executable
""]
1352 if [string match
"" $lines] then {
1353 # No error message
, compilation succeeded.
1354 set result
[$
{tool
}_load
"./$exe" "" ""]
1355 set status [lindex $result
0]
1356 remote_file build
delete $exe
1357 verbose
"check_effective_target_dfprt_nocache: testfile status is <$status>" 2
1358 if { $
status == "pass" } then {
1363 verbose
"check_effective_target_dfprt_nocache: returning $ret" 2
1366 #
Return 1 if the target supports compiling Decimal Floating Point
,
1369 # This won
't change for different subtargets so cache the result.
1371 proc check_effective_target_dfp { } {
1374 if [info exists et_dfp_saved] {
1375 verbose "check_effective_target_dfp: using cached result" 2
1377 set et_dfp_saved [check_effective_target_dfp_nocache]
1379 verbose "check_effective_target_dfp: returning $et_dfp_saved" 2
1380 return $et_dfp_saved
1383 # Return 1 if the target supports linking and executing Decimal Floating
1384 # Point, # 0 otherwise.
1386 # This won't change
for different subtargets so
cache the result.
1388 proc check_effective_target_dfprt
{ } {
1389 global et_dfprt_saved
1392 if [info exists et_dfprt_saved
] {
1393 verbose
"check_effective_target_dfprt: using cached result" 2
1395 set et_dfprt_saved
[check_effective_target_dfprt_nocache
]
1397 verbose
"check_effective_target_dfprt: returning $et_dfprt_saved" 2
1398 return $et_dfprt_saved
1401 #
Return 1 if the target needs a command line
argument to enable a SIMD
1404 proc check_effective_target_vect_cmdline_needed
{ } {
1405 global et_vect_cmdline_needed_saved
1406 global et_vect_cmdline_needed_target_name
1408 if { ![info exists et_vect_cmdline_needed_target_name
] } {
1409 set et_vect_cmdline_needed_target_name
""
1412 #
If the target has changed since we
set the cached value
, clear it.
1413 set current_target
[current_target_name
]
1414 if { $current_target
!= $et_vect_cmdline_needed_target_name
} {
1415 verbose
"check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2
1416 set et_vect_cmdline_needed_target_name $current_target
1417 if { [info exists et_vect_cmdline_needed_saved
] } {
1418 verbose
"check_effective_target_vect_cmdline_needed: removing cached result" 2
1419 unset et_vect_cmdline_needed_saved
1423 if [info exists et_vect_cmdline_needed_saved
] {
1424 verbose
"check_effective_target_vect_cmdline_needed: using cached result" 2
1426 set et_vect_cmdline_needed_saved
1
1427 if { [istarget ia64
-*-*]
1428 ||
(([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
1429 && [check_effective_target_lp64
])
1430 ||
([istarget powerpc
*-*-*]
1431 && ([check_effective_target_powerpc_spe
]
1432 ||
[check_effective_target_powerpc_altivec
]))} {
1433 set et_vect_cmdline_needed_saved
0
1437 verbose
"check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1438 return $et_vect_cmdline_needed_saved
1441 #
Return 1 if the target supports hardware vectors of
int, 0 otherwise.
1443 # This won
't change for different subtargets so cache the result.
1445 proc check_effective_target_vect_int { } {
1446 global et_vect_int_saved
1448 if [info exists et_vect_int_saved] {
1449 verbose "check_effective_target_vect_int: using cached result" 2
1451 set et_vect_int_saved 0
1452 if { [istarget i?86-*-*]
1453 || [istarget powerpc*-*-*]
1454 || [istarget spu-*-*]
1455 || [istarget x86_64-*-*]
1456 || [istarget sparc*-*-*]
1457 || [istarget alpha*-*-*]
1458 || [istarget ia64-*-*] } {
1459 set et_vect_int_saved 1
1463 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
1464 return $et_vect_int_saved
1467 # Return 1 if the target supports int->float conversion
1470 proc check_effective_target_vect_intfloat_cvt { } {
1471 global et_vect_intfloat_cvt_saved
1473 if [info exists et_vect_intfloat_cvt_saved] {
1474 verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
1476 set et_vect_intfloat_cvt_saved 0
1477 if { [istarget i?86-*-*]
1478 || [istarget powerpc*-*-*]
1479 || [istarget x86_64-*-*] } {
1480 set et_vect_intfloat_cvt_saved 1
1484 verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
1485 return $et_vect_intfloat_cvt_saved
1489 # Return 1 if the target supports float->int conversion
1492 proc check_effective_target_vect_floatint_cvt { } {
1493 global et_vect_floatint_cvt_saved
1495 if [info exists et_vect_floatint_cvt_saved] {
1496 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
1498 set et_vect_floatint_cvt_saved 0
1499 if { [istarget i?86-*-*]
1500 || [istarget x86_64-*-*] } {
1501 set et_vect_floatint_cvt_saved 1
1505 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
1506 return $et_vect_floatint_cvt_saved
1510 # Return 1 is this is an arm target using 32-bit instructions
1511 proc check_effective_target_arm32 { } {
1512 return [check_no_compiler_messages arm32 assembly {
1513 #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
1519 # Return 1 if this is an ARM target supporting -mfpu=vfp
1520 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
1523 proc check_effective_target_arm_vfp_ok { } {
1524 if { [check_effective_target_arm32] } {
1525 return [check_no_compiler_messages arm_vfp_ok object {
1527 } "-mfpu=vfp -mfloat-abi=softfp"]
1533 # Return 1 if this is an ARM target supporting -mfpu=neon
1534 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
1537 proc check_effective_target_arm_neon_ok { } {
1538 if { [check_effective_target_arm32] } {
1539 return [check_no_compiler_messages arm_neon_ok object {
1541 } "-mfpu=neon -mfloat-abi=softfp"]
1547 # Return 1 if the target supports executing NEON instructions, 0
1548 # otherwise. Cache the result.
1550 proc check_effective_target_arm_neon_hw { } {
1551 global arm_neon_hw_available_saved
1554 if [info exists arm_neon_hw_available_saved] {
1555 verbose "check_arm_neon_hw_available returning saved $arm_neon_hw_avail
1558 set arm_neon_hw_available_saved 0
1560 # Set up, compile, and execute a test program containing NEON
1561 # instructions. Include the current process ID in the file
1562 # names to prevent conflicts with invocations for multiple
1567 set f [open $src "w"]
1568 puts $f "int main() {"
1569 puts $f " long long a = 0, b = 1;"
1570 puts $f " asm (\"vorr %P0, %P1, %P2\""
1571 puts $f " : \"=w\" (a)"
1572 puts $f " : \"0\" (a), \"w\" (b));"
1573 puts $f " return (a != 1);"
1577 set opts "additional_flags=-mfpu=neon additional_flags=-mfloat-abi=softfp"
1579 verbose "check_arm_neon_hw_available compiling testfile $src" 2
1580 set lines [${tool}_target_compile $src $exe executable "$opts"]
1583 if [string match "" $lines] then {
1584 # No error message, compilation succeeded.
1585 set result [${tool}_load "./$exe" "" ""]
1586 set status [lindex $result 0]
1587 remote_file build delete $exe
1588 verbose "check_arm_neon_hw_available testfile status is <$status>" 2
1590 if { $status == "pass" } then {
1591 set arm_neon_hw_available_saved 1
1594 verbose "check_arm_neon_hw_available testfile compilation failed" 2
1598 return $arm_neon_hw_available_saved
1601 # Return 1 if this is a PowerPC target with floating-point registers.
1603 proc check_effective_target_powerpc_fprs { } {
1604 if { [istarget powerpc*-*-*]
1605 || [istarget rs6000-*-*] } {
1606 return [check_no_compiler_messages powerpc_fprs object {
1618 # Return 1 if this is a PowerPC target supporting -maltivec.
1620 proc check_effective_target_powerpc_altivec_ok { } {
1621 if { [istarget powerpc*-*-*]
1622 || [istarget rs6000-*-*] } {
1623 # AltiVec is not supported on Aix.
1624 if { [istarget powerpc*-*-aix*] } {
1627 return [check_no_compiler_messages powerpc_altivec_ok object {
1635 # Return 1 if this is a PowerPC target with SPE enabled.
1637 proc check_effective_target_powerpc_spe { } {
1638 if { [istarget powerpc*-*-*] } {
1639 return [check_no_compiler_messages powerpc_spe object {
1651 # Return 1 if this is a PowerPC target with Altivec enabled.
1653 proc check_effective_target_powerpc_altivec { } {
1654 if { [istarget powerpc*-*-*] } {
1655 return [check_no_compiler_messages powerpc_altivec object {
1667 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
1668 # chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
1669 # test environment appears to run executables on such a simulator.
1671 proc check_effective_target_ultrasparc_hw { } {
1672 global et_ultrasparc_hw_saved
1675 if [info exists et_ultrasparc_hw_saved] {
1676 verbose "check_ultrasparc_hw_available returning saved $et_ultrasparc_hw_saved" 2
1678 set et_ultrasparc_hw_saved 0
1680 # Set up, compile, and execute a simple test program. The
1681 # program will be compiled with -mcpu=ultrasparc to instruct the
1682 # assembler to produce EM_SPARC32PLUS executables.
1683 set src svect[pid].c
1684 set exe svect[pid].x
1686 set f [open $src "w"]
1687 puts $f "int main() { return 0; }"
1690 verbose "check_ultrasparc_hw_available compiling testfile $src" 2
1691 set lines [${tool}_target_compile $src $exe executable "additional_flags=-mcpu=ultrasparc"]
1694 if [string match "" $lines] then {
1695 # No error message, compilation succeeded.
1696 set result [${tool}_load "./$exe" "" ""]
1697 set status [lindex $result 0]
1698 remote_file build delete $exe
1699 verbose "check_ultrasparc_hw_available testfile status is <$status>" 2
1701 if { $status == "pass" } then {
1702 set et_ultrasparc_hw_saved 1
1705 verbose "check_ultrasparc_hw_available testfile compilation failed" 2
1709 return $et_ultrasparc_hw_saved
1712 # Return 1 if the target supports hardware vector shift operation.
1714 proc check_effective_target_vect_shift { } {
1715 global et_vect_shift_saved
1717 if [info exists et_vect_shift_saved] {
1718 verbose "check_effective_target_vect_shift: using cached result" 2
1720 set et_vect_shift_saved 0
1721 if { [istarget powerpc*-*-*]
1722 || [istarget ia64-*-*]
1723 || [istarget i?86-*-*]
1724 || [istarget x86_64-*-*] } {
1725 set et_vect_shift_saved 1
1729 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
1730 return $et_vect_shift_saved
1733 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
1735 # This can change for different subtargets so do not cache the result.
1737 proc check_effective_target_vect_long { } {
1738 if { [istarget i?86-*-*]
1739 || ([istarget powerpc*-*-*] && [check_effective_target_ilp32])
1740 || [istarget x86_64-*-*]
1741 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
1747 verbose "check_effective_target_vect_long: returning $answer" 2
1751 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
1753 # This won't change
for different subtargets so
cache the result.
1755 proc check_effective_target_vect_float
{ } {
1756 global et_vect_float_saved
1758 if [info exists et_vect_float_saved
] {
1759 verbose
"check_effective_target_vect_float: using cached result" 2
1761 set et_vect_float_saved
0
1762 if { [istarget i?
86-*-*]
1763 ||
[istarget powerpc
*-*-*]
1764 ||
[istarget spu
-*-*]
1765 ||
[istarget mipsisa64
*-*-*]
1766 ||
[istarget x86_64
-*-*]
1767 ||
[istarget ia64
-*-*] } {
1768 set et_vect_float_saved
1
1772 verbose
"check_effective_target_vect_float: returning $et_vect_float_saved" 2
1773 return $et_vect_float_saved
1776 #
Return 1 if the target supports hardware vectors of double
, 0 otherwise.
1778 # This won
't change for different subtargets so cache the result.
1780 proc check_effective_target_vect_double { } {
1781 global et_vect_double_saved
1783 if [info exists et_vect_double_saved] {
1784 verbose "check_effective_target_vect_double: using cached result" 2
1786 set et_vect_double_saved 0
1787 if { [istarget i?86-*-*]
1788 || [istarget x86_64-*-*]
1789 || [istarget spu-*-*] } {
1790 set et_vect_double_saved 1
1794 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
1795 return $et_vect_double_saved
1798 # Return 1 if the target plus current options does not support a vector
1799 # max instruction on "int", 0 otherwise.
1801 # This won't change
for different subtargets so
cache the result.
1803 proc check_effective_target_vect_no_int_max
{ } {
1804 global et_vect_no_int_max_saved
1806 if [info exists et_vect_no_int_max_saved
] {
1807 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
1809 set et_vect_no_int_max_saved
0
1810 if { [istarget sparc
*-*-*]
1811 ||
[istarget spu
-*-*]
1812 ||
[istarget alpha
*-*-*] } {
1813 set et_vect_no_int_max_saved
1
1816 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
1817 return $et_vect_no_int_max_saved
1820 #
Return 1 if the target plus current options does not support a vector
1821 # add instruction
on "int", 0 otherwise.
1823 # This won
't change for different subtargets so cache the result.
1825 proc check_effective_target_vect_no_int_add { } {
1826 global et_vect_no_int_add_saved
1828 if [info exists et_vect_no_int_add_saved] {
1829 verbose "check_effective_target_vect_no_int_add: using cached result" 2
1831 set et_vect_no_int_add_saved 0
1832 # Alpha only supports vector add on V8QI and V4HI.
1833 if { [istarget alpha*-*-*] } {
1834 set et_vect_no_int_add_saved 1
1837 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
1838 return $et_vect_no_int_add_saved
1841 # Return 1 if the target plus current options does not support vector
1842 # bitwise instructions, 0 otherwise.
1844 # This won't change
for different subtargets so
cache the result.
1846 proc check_effective_target_vect_no_bitwise
{ } {
1847 global et_vect_no_bitwise_saved
1849 if [info exists et_vect_no_bitwise_saved
] {
1850 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
1852 set et_vect_no_bitwise_saved
0
1854 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
1855 return $et_vect_no_bitwise_saved
1858 #
Return 1 if the target plus current options supports a vector
1859 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
1860 # A target can also support this widening summation
if it can support
1861 # promotion
(unpacking
) from shorts to ints.
1863 # This won
't change for different subtargets so cache the result.
1865 proc check_effective_target_vect_widen_sum_hi_to_si { } {
1866 global et_vect_widen_sum_hi_to_si
1868 if [info exists et_vect_widen_sum_hi_to_si_saved] {
1869 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
1871 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
1872 if { [istarget powerpc*-*-*]
1873 || [istarget ia64-*-*] } {
1874 set et_vect_widen_sum_hi_to_si_saved 1
1877 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
1878 return $et_vect_widen_sum_hi_to_si_saved
1881 # Return 1 if the target plus current options supports a vector
1882 # widening summation of *char* args into *short* result, 0 otherwise.
1883 # A target can also support this widening summation if it can support
1884 # promotion (unpacking) from chars to shorts.
1886 # This won't change
for different subtargets so
cache the result.
1888 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
1889 global et_vect_widen_sum_qi_to_hi
1891 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
1892 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
1894 set et_vect_widen_sum_qi_to_hi_saved
0
1895 if { [check_effective_target_vect_unpack
]
1896 ||
[istarget ia64
-*-*] } {
1897 set et_vect_widen_sum_qi_to_hi_saved
1
1900 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
1901 return $et_vect_widen_sum_qi_to_hi_saved
1904 #
Return 1 if the target plus current options supports a vector
1905 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
1907 # This won
't change for different subtargets so cache the result.
1909 proc check_effective_target_vect_widen_sum_qi_to_si { } {
1910 global et_vect_widen_sum_qi_to_si
1912 if [info exists et_vect_widen_sum_qi_to_si_saved] {
1913 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
1915 set et_vect_widen_sum_qi_to_si_saved 0
1916 if { [istarget powerpc*-*-*] } {
1917 set et_vect_widen_sum_qi_to_si_saved 1
1920 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
1921 return $et_vect_widen_sum_qi_to_si_saved
1924 # Return 1 if the target plus current options supports a vector
1925 # widening multiplication of *char* args into *short* result, 0 otherwise.
1926 # A target can also support this widening multplication if it can support
1927 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
1928 # multiplication of shorts).
1930 # This won't change
for different subtargets so
cache the result.
1933 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
1934 global et_vect_widen_mult_qi_to_hi
1936 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
1937 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
1939 if { [check_effective_target_vect_unpack
]
1940 && [check_effective_target_vect_short_mult
] } {
1941 set et_vect_widen_mult_qi_to_hi_saved
1
1943 set et_vect_widen_mult_qi_to_hi_saved
0
1945 if { [istarget powerpc
*-*-*] } {
1946 set et_vect_widen_mult_qi_to_hi_saved
1
1949 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
1950 return $et_vect_widen_mult_qi_to_hi_saved
1953 #
Return 1 if the target plus current options supports a vector
1954 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
1955 # A target can also support this widening multplication
if it can support
1956 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
1957 # multiplication of ints
).
1959 # This won
't change for different subtargets so cache the result.
1962 proc check_effective_target_vect_widen_mult_hi_to_si { } {
1963 global et_vect_widen_mult_hi_to_si
1965 if [info exists et_vect_widen_mult_hi_to_si_saved] {
1966 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
1968 if { [check_effective_target_vect_unpack]
1969 && [check_effective_target_vect_int_mult] } {
1970 set et_vect_widen_mult_hi_to_si_saved 1
1972 set et_vect_widen_mult_hi_to_si_saved 0
1974 if { [istarget powerpc*-*-*]
1975 || [istarget spu-*-*]
1976 || [istarget i?86-*-*]
1977 || [istarget x86_64-*-*] } {
1978 set et_vect_widen_mult_hi_to_si_saved 1
1981 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
1982 return $et_vect_widen_mult_hi_to_si_saved
1985 # Return 1 if the target plus current options supports a vector
1986 # dot-product of signed chars, 0 otherwise.
1988 # This won't change
for different subtargets so
cache the result.
1990 proc check_effective_target_vect_sdot_qi
{ } {
1991 global et_vect_sdot_qi
1993 if [info exists et_vect_sdot_qi_saved
] {
1994 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
1996 set et_vect_sdot_qi_saved
0
1998 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
1999 return $et_vect_sdot_qi_saved
2002 #
Return 1 if the target plus current options supports a vector
2003 # dot
-product of unsigned chars
, 0 otherwise.
2005 # This won
't change for different subtargets so cache the result.
2007 proc check_effective_target_vect_udot_qi { } {
2008 global et_vect_udot_qi
2010 if [info exists et_vect_udot_qi_saved] {
2011 verbose "check_effective_target_vect_udot_qi: using cached result" 2
2013 set et_vect_udot_qi_saved 0
2014 if { [istarget powerpc*-*-*] } {
2015 set et_vect_udot_qi_saved 1
2018 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
2019 return $et_vect_udot_qi_saved
2022 # Return 1 if the target plus current options supports a vector
2023 # dot-product of signed shorts, 0 otherwise.
2025 # This won't change
for different subtargets so
cache the result.
2027 proc check_effective_target_vect_sdot_hi
{ } {
2028 global et_vect_sdot_hi
2030 if [info exists et_vect_sdot_hi_saved
] {
2031 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
2033 set et_vect_sdot_hi_saved
0
2034 if { [istarget powerpc
*-*-*]
2035 ||
[istarget i?
86-*-*]
2036 ||
[istarget x86_64
-*-*] } {
2037 set et_vect_sdot_hi_saved
1
2040 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
2041 return $et_vect_sdot_hi_saved
2044 #
Return 1 if the target plus current options supports a vector
2045 # dot
-product of unsigned shorts
, 0 otherwise.
2047 # This won
't change for different subtargets so cache the result.
2049 proc check_effective_target_vect_udot_hi { } {
2050 global et_vect_udot_hi
2052 if [info exists et_vect_udot_hi_saved] {
2053 verbose "check_effective_target_vect_udot_hi: using cached result" 2
2055 set et_vect_udot_hi_saved 0
2056 if { [istarget powerpc*-*-*] } {
2057 set et_vect_udot_hi_saved 1
2060 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
2061 return $et_vect_udot_hi_saved
2065 # Return 1 if the target plus current options supports a vector
2066 # demotion (packing) of shorts (to chars) and ints (to shorts)
2067 # using modulo arithmetic, 0 otherwise.
2069 # This won't change
for different subtargets so
cache the result.
2071 proc check_effective_target_vect_pack_trunc
{ } {
2072 global et_vect_pack_trunc
2074 if [info exists et_vect_pack_trunc_saved
] {
2075 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
2077 set et_vect_pack_trunc_saved
0
2078 if { [istarget powerpc
*-*-*]
2079 ||
[istarget i?
86-*-*]
2080 ||
[istarget x86_64
-*-*] } {
2081 set et_vect_pack_trunc_saved
1
2084 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
2085 return $et_vect_pack_trunc_saved
2088 #
Return 1 if the target plus current options supports a vector
2089 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
2091 # This won
't change for different subtargets so cache the result.
2093 proc check_effective_target_vect_unpack { } {
2094 global et_vect_unpack
2096 if [info exists et_vect_unpack_saved] {
2097 verbose "check_effective_target_vect_unpack: using cached result" 2
2099 set et_vect_unpack_saved 0
2100 if { [istarget powerpc*-*-*]
2101 || [istarget i?86-*-*]
2102 || [istarget x86_64-*-*] } {
2103 set et_vect_unpack_saved 1
2106 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
2107 return $et_vect_unpack_saved
2110 # Return 1 if the target plus current options does not support a vector
2111 # alignment mechanism, 0 otherwise.
2113 # This won't change
for different subtargets so
cache the result.
2115 proc check_effective_target_vect_no_align
{ } {
2116 global et_vect_no_align_saved
2118 if [info exists et_vect_no_align_saved
] {
2119 verbose
"check_effective_target_vect_no_align: using cached result" 2
2121 set et_vect_no_align_saved
0
2122 if { [istarget mipsisa64
*-*-*]
2123 ||
[istarget sparc
*-*-*]
2124 ||
[istarget ia64
-*-*] } {
2125 set et_vect_no_align_saved
1
2128 verbose
"check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
2129 return $et_vect_no_align_saved
2132 #
Return 1 if arrays are aligned to the vector alignment
2133 # boundary
, 0 otherwise.
2135 # This won
't change for different subtargets so cache the result.
2137 proc check_effective_target_vect_aligned_arrays { } {
2138 global et_vect_aligned_arrays
2140 if [info exists et_vect_aligned_arrays_saved] {
2141 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
2143 set et_vect_aligned_arrays_saved 0
2144 if { ([istarget x86_64-*-*]
2145 || [istarget i?86-*-*]) && [is-effective-target lp64] } {
2146 set et_vect_aligned_arrays_saved 1
2149 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
2150 return $et_vect_aligned_arrays_saved
2153 # Return 1 if types are naturally aligned (aligned to their type-size),
2156 # This won't change
for different subtargets so
cache the result.
2158 proc check_effective_target_natural_alignment
{ } {
2159 global et_natural_alignment
2161 if [info exists et_natural_alignment_saved
] {
2162 verbose
"check_effective_target_natural_alignment: using cached result" 2
2164 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
2165 set et_natural_alignment_saved
1
2166 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
2167 set et_natural_alignment_saved
0
2170 verbose
"check_effective_target_natural_alignment: returning $et_natural_alignment_saved" 2
2171 return $et_natural_alignment_saved
2174 #
Return 1 if vector alignment is reachable
, 0 otherwise.
2176 # This won
't change for different subtargets so cache the result.
2178 proc check_effective_target_vector_alignment_reachable { } {
2179 global et_vector_alignment_reachable
2181 if [info exists et_vector_alignment_reachable_saved] {
2182 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
2184 if { [check_effective_target_vect_aligned_arrays]
2185 || [check_effective_target_natural_alignment] } {
2186 set et_vector_alignment_reachable_saved 1
2188 set et_vector_alignment_reachable_saved 0
2191 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
2192 return $et_vector_alignment_reachable_saved
2195 # Return 1 if vector alignment for soubles is reachable, 0 otherwise.
2197 # This won't change
for different subtargets so
cache the result.
2199 proc check_effective_target_vector_alignment_reachable_for_double
{ } {
2200 global et_vector_alignment_reachable_for_double
2202 if [info exists et_vector_alignment_reachable_for_double_saved
] {
2203 verbose
"check_effective_target_vector_alignment_reachable_for_double: using cached result" 2
2205 if { [check_effective_target_vect_aligned_arrays
] } {
2206 set et_vector_alignment_reachable_for_double_saved
1
2208 set et_vector_alignment_reachable_for_double_saved
0
2211 verbose
"check_effective_target_vector_alignment_reachable_for_double: returning $et_vector_alignment_reachable_for_double_saved" 2
2212 return $et_vector_alignment_reachable_for_double_saved
2215 #
Return 1 if the target supports vector conditional operations
, 0 otherwise.
2217 proc check_effective_target_vect_condition
{ } {
2218 global et_vect_cond_saved
2220 if [info exists et_vect_cond_saved
] {
2221 verbose
"check_effective_target_vect_cond: using cached result" 2
2223 set et_vect_cond_saved
0
2224 if { [istarget powerpc
*-*-*]
2225 ||
[istarget ia64
-*-*]
2226 ||
[istarget i?
86-*-*]
2227 ||
[istarget spu
-*-*]
2228 ||
[istarget x86_64
-*-*] } {
2229 set et_vect_cond_saved
1
2233 verbose
"check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
2234 return $et_vect_cond_saved
2237 #
Return 1 if the target supports vector char multiplication
, 0 otherwise.
2239 proc check_effective_target_vect_char_mult
{ } {
2240 global et_vect_char_mult_saved
2242 if [info exists et_vect_char_mult_saved
] {
2243 verbose
"check_effective_target_vect_char_mult: using cached result" 2
2245 set et_vect_char_mult_saved
0
2246 if { [istarget ia64
-*-*]
2247 ||
[istarget i?
86-*-*]
2248 ||
[istarget x86_64
-*-*] } {
2249 set et_vect_char_mult_saved
1
2253 verbose
"check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
2254 return $et_vect_char_mult_saved
2257 #
Return 1 if the target supports vector short multiplication
, 0 otherwise.
2259 proc check_effective_target_vect_short_mult
{ } {
2260 global et_vect_short_mult_saved
2262 if [info exists et_vect_short_mult_saved
] {
2263 verbose
"check_effective_target_vect_short_mult: using cached result" 2
2265 set et_vect_short_mult_saved
0
2266 if { [istarget ia64
-*-*]
2267 ||
[istarget i?
86-*-*]
2268 ||
[istarget x86_64
-*-*] } {
2269 set et_vect_short_mult_saved
1
2273 verbose
"check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
2274 return $et_vect_short_mult_saved
2277 #
Return 1 if the target supports vector
int multiplication
, 0 otherwise.
2279 proc check_effective_target_vect_int_mult
{ } {
2280 global et_vect_int_mult_saved
2282 if [info exists et_vect_int_mult_saved
] {
2283 verbose
"check_effective_target_vect_int_mult: using cached result" 2
2285 set et_vect_int_mult_saved
0
2286 if { [istarget powerpc
*-*-*]
2287 ||
[istarget spu
-*-*]
2288 ||
[istarget i?
86-*-*]
2289 ||
[istarget x86_64
-*-*] } {
2290 set et_vect_int_mult_saved
1
2294 verbose
"check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
2295 return $et_vect_int_mult_saved
2298 #
Return 1 if the target supports vector even
/odd elements extraction
, 0 otherwise.
2300 proc check_effective_target_vect_extract_even_odd
{ } {
2301 global et_vect_extract_even_odd_saved
2303 if [info exists et_vect_extract_even_odd_saved
] {
2304 verbose
"check_effective_target_vect_extract_even_odd: using cached result" 2
2306 set et_vect_extract_even_odd_saved
0
2307 if { [istarget powerpc
*-*-*] } {
2308 set et_vect_extract_even_odd_saved
1
2312 verbose
"check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
2313 return $et_vect_extract_even_odd_saved
2316 #
Return 1 if the target supports vector interleaving
, 0 otherwise.
2318 proc check_effective_target_vect_interleave
{ } {
2319 global et_vect_interleave_saved
2321 if [info exists et_vect_interleave_saved
] {
2322 verbose
"check_effective_target_vect_interleave: using cached result" 2
2324 set et_vect_interleave_saved
0
2325 if { [istarget powerpc
*-*-*]
2326 ||
[istarget i?
86-*-*]
2327 ||
[istarget x86_64
-*-*] } {
2328 set et_vect_interleave_saved
1
2332 verbose
"check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
2333 return $et_vect_interleave_saved
2336 #
Return 1 if the target supports vector interleaving and extract even
/odd
, 0 otherwise.
2337 proc check_effective_target_vect_strided
{ } {
2338 global et_vect_strided_saved
2340 if [info exists et_vect_strided_saved
] {
2341 verbose
"check_effective_target_vect_strided: using cached result" 2
2343 set et_vect_strided_saved
0
2344 if { [check_effective_target_vect_interleave
]
2345 && [check_effective_target_vect_extract_even_odd
] } {
2346 set et_vect_strided_saved
1
2350 verbose
"check_effective_target_vect_strided: returning $et_vect_strided_saved" 2
2351 return $et_vect_strided_saved
2354 #
Return 1 if the target supports section
-anchors
2356 proc check_effective_target_section_anchors
{ } {
2357 global et_section_anchors_saved
2359 if [info exists et_section_anchors_saved
] {
2360 verbose
"check_effective_target_section_anchors: using cached result" 2
2362 set et_section_anchors_saved
0
2363 if { [istarget powerpc
*-*-*] } {
2364 set et_section_anchors_saved
1
2368 verbose
"check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
2369 return $et_section_anchors_saved
2372 #
Return 1 if the target supports atomic operations
on "int" and "long".
2374 proc check_effective_target_sync_int_long
{ } {
2375 global et_sync_int_long_saved
2377 if [info exists et_sync_int_long_saved
] {
2378 verbose
"check_effective_target_sync_int_long: using cached result" 2
2380 set et_sync_int_long_saved
0
2381 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
2382 # load-reserved/store-conditional instructions.
2383 if { [istarget ia64-*-*]
2384 || [istarget i?86-*-*]
2385 || [istarget x86_64-*-*]
2386 || [istarget alpha*-*-*]
2387 || [istarget s390*-*-*]
2388 || [istarget powerpc*-*-*]
2389 || [istarget sparc64-*-*]
2390 || [istarget sparcv9-*-*] } {
2391 set et_sync_int_long_saved 1
2395 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
2396 return $et_sync_int_long_saved
2399 # Return 1 if the target supports atomic operations on "char" and "short".
2401 proc check_effective_target_sync_char_short { } {
2402 global et_sync_char_short_saved
2404 if [info exists et_sync_char_short_saved] {
2405 verbose "check_effective_target_sync_char_short: using cached result" 2
2407 set et_sync_char_short_saved 0
2408 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
2409 #
load-reserved/store
-conditional instructions.
2410 if { [istarget ia64
-*-*]
2411 ||
[istarget i?
86-*-*]
2412 ||
[istarget x86_64
-*-*]
2413 ||
[istarget alpha
*-*-*]
2414 ||
[istarget s390
*-*-*]
2415 ||
[istarget powerpc
*-*-*]
2416 ||
[istarget sparc64
-*-*]
2417 ||
[istarget sparcv9
-*-*] } {
2418 set et_sync_char_short_saved
1
2422 verbose
"check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
2423 return $et_sync_char_short_saved
2426 #
Return 1 if the target uses a ColdFire FPU.
2428 proc check_effective_target_coldfire_fpu
{ } {
2429 return [check_no_compiler_messages coldfire_fpu assembly
{
2436 #
Return true
if this is a uClibc target.
2438 proc check_effective_target_uclibc
{} {
2439 return [check_no_compiler_messages uclibc object
{
2440 #
include <features.h
>
2441 #
if !defined
(__UCLIBC__
)
2447 #
Return true
if this is a uclibc target and
if the uclibc feature
2448 # described by __$feature__ is not present.
2450 proc check_missing_uclibc_feature
{feature
} {
2451 return [check_no_compiler_messages $feature object
"
2452 #
include <features.h
>
2453 #
if !defined
(__UCLIBC
) || defined
(__$
{feature
}__
)
2459 #
Return true
if this is a Newlib target.
2461 proc check_effective_target_newlib
{} {
2462 return [check_no_compiler_messages newlib object
{
2468 #
(a
) an error of a few ULP is expected in string to floating
-point
2469 # conversion functions
; and
2470 #
(b
) overflow is not always detected correctly by those functions.
2472 proc check_effective_target_lax_strtofp
{} {
2473 # By default
, assume that all uClibc targets suffer from this.
2474 return [check_effective_target_uclibc
]
2477 #
Return 1 if this is a target
for which wcsftime is a dummy
2478 # function that always returns
0.
2480 proc check_effective_target_dummy_wcsftime
{} {
2481 # By default
, assume that all uClibc targets suffer from this.
2482 return [check_effective_target_uclibc
]
2485 #
Return 1 if constructors with initialization priority arguments are
2486 # supposed
on this target.
2488 proc check_effective_target_init_priority
{} {
2489 return [check_no_compiler_messages init_priority assembly
"
2490 void f
() __attribute__
((constructor
(1000)));
2495 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
2496 # This can be used with
any check_
* proc that takes no
argument and
2497 # returns only
1 or
0. It could be used with check_
* procs that take
2498 # arguments with keywords that pass particular arguments.
2500 proc is
-effective
-target
{ arg } {
2502 if { [info procs check_effective_target_$
{arg}] != [list
] } {
2503 set selected
[check_effective_target_$
{arg}]
2506 "vmx_hw" { set selected [check_vmx_hw_available] }
2507 "named_sections" { set selected [check_named_sections_available] }
2508 "gc_sections" { set selected [check_gc_sections_available] }
2509 "cxa_atexit" { set selected [check_cxa_atexit_available] }
2510 default
{ error
"unknown effective target keyword `$arg'" }
2513 verbose
"is-effective-target: $arg $selected" 2
2517 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
2519 proc is
-effective
-target
-keyword
{ arg } {
2520 if { [info procs check_effective_target_$
{arg}] != [list
] } {
2523 # These have different names
for their check_
* procs.
2525 "vmx_hw" { return 1 }
2526 "named_sections" { return 1 }
2527 "gc_sections" { return 1 }
2528 "cxa_atexit" { return 1 }
2529 default
{ return 0 }
2534 #
Return 1 if target default to short enums
2536 proc check_effective_target_short_enums
{ } {
2537 return [check_no_compiler_messages short_enums assembly
{
2539 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
2543 #
Return 1 if target supports merging string constants at link time.
2545 proc check_effective_target_string_merging
{ } {
2546 return [check_no_messages_and_pattern string_merging \
2547 "rodata\\.str" assembly {
2548 const char
*var
= "String";
2552 #
Return 1 if target has the basic signed and unsigned types in
2553 #
<stdint.h
>, 0 otherwise.
2555 proc check_effective_target_stdint_types
{ } {
2556 return [check_no_compiler_messages stdint_types assembly
{
2558 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
2559 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
2563 #
Return 1 if programs are intended to be run
on a simulator
2564 #
(i.e. slowly
) rather than hardware
(i.e. fast
).
2566 proc check_effective_target_simulator
{ } {
2568 # All
"src/sim" simulators set this one.
2569 if [board_info target
exists is_simulator
] {
2570 return [board_info target is_simulator
]
2573 # The
"sid" simulators don't set that one, but at least they set
2575 if [board_info target
exists slow_simulator
] {
2576 return [board_info target slow_simulator
]
2582 #
Return 1 if the target is a VxWorks RTP.
2584 proc check_effective_target_vxworks_kernel
{ } {
2585 return [check_no_compiler_messages vxworks_kernel assembly
{
2586 #
if !defined __vxworks || defined __RTP__
2592 #
Return 1 if the target is expected to provide wide character support.
2594 proc check_effective_target_wchar
{ } {
2595 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
2598 return [check_no_compiler_messages wchar assembly
{
2603 # Add to FLAGS all the target
-specific flags needed to access the c99 runtime.
2605 proc add_options_for_c99_runtime
{ flags
} {
2606 if { [istarget
*-*-solaris2
*] } {
2607 return "$flags -std=c99"
2609 if { [istarget powerpc
-*-darwin
*] } {
2610 return "$flags -mmacosx-version-min=10.3"
2615 #
Return 1 if the target provides a full C99 runtime.
2617 proc check_effective_target_c99_runtime
{ } {
2618 return [check_cached_effective_target c99_runtime
{
2621 set file
[open
"$srcdir/gcc.dg/builtins-config.h"]
2622 set contents
[read $file
]
2625 #ifndef HAVE_C99_RUNTIME
2629 string match
"" [get_compiler_messages c99_runtime 0 assembly \
2630 $contents
[add_options_for_c99_runtime
""]]