1 # Copyright (C) 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # gcc-patches@gcc.gnu.org
20 # This file defines procs for determining features supported by the target.
22 # Try to compile some code and return the messages printed by the compiler.
24 # BASENAME is a basename to use for temporary files.
25 # TYPE is the type of compilation to perform (see target_compile).
26 # CONTENTS gives the contents of the input file.
27 # The rest is optional:
28 # OPTIONS: additional compiler options to use.
29 proc get_compiler_messages {basename type contents args} {
32 if { [llength $args] > 0 } {
33 set options "additional_flags=[lindex $args 0]"
38 set src ${basename}[pid].c
40 assembly { set output ${basename}[pid].s }
41 object { set output ${basename}[pid].o }
46 set lines [${tool}_target_compile $src $output $type "$options"]
48 remote_file build delete $output
53 proc current_target_name { } {
55 if [info exists target_info(target,name)] {
56 set answer $target_info(target,name)
63 ###############################
64 # proc check_weak_available { }
65 ###############################
67 # weak symbols are only supported in some configs/object formats
68 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
70 proc check_weak_available { } {
74 # All mips targets should support it
76 if { [ string first "mips" $target_cpu ] >= 0 } {
80 # All solaris2 targets should support it
82 if { [regexp ".*-solaris2.*" $target_triplet] } {
86 # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
88 if { [regexp "alpha.*osf.*" $target_triplet] } {
92 # Windows targets Cygwin and MingW32 support it
94 if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
98 # HP-UX 10.X doesn't support it
100 if { [regexp "hppa.*hpux10" $target_triplet] } {
104 # ELF and ECOFF support it. a.out does with gas/gld but may also with
105 # other linkers, so we should try it
107 set objformat [gcc_target_object_format]
115 unknown { return -1 }
120 ###############################
121 # proc check_visibility_available { what_kind }
122 ###############################
124 # The visibility attribute is only support in some object formats
125 # This proc returns 1 if it is supported, 0 if not.
126 # The argument is the kind of visibility, default/protected/hidden/internal.
128 proc check_visibility_available { what_kind } {
129 global visibility_available_saved
131 global target_triplet
133 # On NetWare, support makes no sense.
134 if { [string match "*-*-netware*" $target_triplet] } {
138 if [string match "" $what_kind] { set what_kind "hidden" }
140 if { [info exists visibility_available_saved] } {
141 verbose "Saved result is <$visibility_available_saved>" 1
142 if { [ lsearch -exact $visibility_available_saved $what_kind ] != -1 } {
144 } elseif { [ lsearch -exact $visibility_available_saved "!$what_kind" ] != -1 } {
149 set lines [get_compiler_messages visibility object "
150 void f() __attribute__((visibility(\"$what_kind\")));
153 if [string match "" $lines] then {
155 lappend visibility_available_saved $what_kind
158 lappend visibility_available_saved "!$what_kind"
163 ###############################
164 # proc check_alias_available { }
165 ###############################
167 # Determine if the target toolchain supports the alias attribute.
169 # Returns 2 if the target supports aliases. Returns 1 if the target
170 # only supports weak aliased. Returns 0 if the target does not
171 # support aliases at all. Returns -1 if support for aliases could not
174 proc check_alias_available { } {
175 global alias_available_saved
178 if [info exists alias_available_saved] {
179 verbose "check_alias_available returning saved $alias_available_saved" 2
183 verbose "check_alias_available compiling testfile $src" 2
184 set f [open $src "w"]
185 # Compile a small test program. The definition of "g" is
186 # necessary to keep the Solaris assembler from complaining
188 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
189 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
191 set lines [${tool}_target_compile $src $obj object ""]
193 remote_file build delete $obj
195 if [string match "" $lines] then {
196 # No error messages, everything is OK.
197 set alias_available_saved 2
199 if [regexp "alias definitions not supported" $lines] {
200 verbose "check_alias_available target does not support aliases" 2
202 set objformat [gcc_target_object_format]
204 if { $objformat == "elf" } {
205 verbose "check_alias_available but target uses ELF format, so it ought to" 2
206 set alias_available_saved -1
208 set alias_available_saved 0
211 if [regexp "only weak aliases are supported" $lines] {
212 verbose "check_alias_available target supports only weak aliases" 2
213 set alias_available_saved 1
215 set alias_available_saved -1
220 verbose "check_alias_available returning $alias_available_saved" 2
223 return $alias_available_saved
226 # Returns true if --gc-sections is supported on the target.
228 proc check_gc_sections_available { } {
229 global gc_sections_available_saved
232 if {![info exists gc_sections_available_saved]} {
233 # Some targets don't support gc-sections despite whatever's
234 # advertised by ld's options.
235 if { [istarget alpha*-*-*]
236 || [istarget ia64-*-*] } {
237 set gc_sections_available_saved 0
241 # Check if the ld used by gcc supports --gc-sections.
242 set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
243 regsub ".*\n\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
244 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
245 set ld_output [remote_exec host "$gcc_ld" "--help"]
246 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
247 set gc_sections_available_saved 1
249 set gc_sections_available_saved 0
252 return $gc_sections_available_saved
255 # Return true if profiling is supported on the target.
257 proc check_profiling_available { test_what } {
258 global profiling_available_saved
260 verbose "Profiling argument is <$test_what>" 1
262 # These conditions depend on the argument so examine them before
263 # looking at the cache variable.
265 # Support for -p on solaris2 relies on mcrt1.o which comes with the
266 # vendor compiler. We cannot reliably predict the directory where the
267 # vendor compiler (and thus mcrt1.o) is installed so we can't
268 # necessarily find mcrt1.o even if we have it.
269 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
273 # Support for -p on irix relies on libprof1.a which doesn't appear to
274 # exist on any irix6 system currently posting testsuite results.
275 # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
276 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
277 if { [istarget mips*-*-irix*]
278 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
282 # Now examine the cache variable.
283 if {![info exists profiling_available_saved]} {
284 # Some targets don't have any implementation of __bb_init_func or are
285 # missing other needed machinery.
286 if { [istarget mmix-*-*]
287 || [istarget arm*-*-eabi*]
288 || [istarget arm*-*-elf]
289 || [istarget arm*-*-symbianelf*]
290 || [istarget powerpc-*-eabi*]
291 || [istarget strongarm*-*-elf]
292 || [istarget xscale*-*-elf]
293 || [istarget cris-*-*]
294 || [istarget h8300-*-*]
295 || [istarget mips*-*-elf]
296 || [istarget xtensa-*-elf]
297 || [istarget *-*-windiss] } {
298 set profiling_available_saved 0
300 set profiling_available_saved 1
304 return $profiling_available_saved
307 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
308 # emitted, 0 otherwise. Whether a shared library can actually be built is
309 # out of scope for this test.
311 # When the target name changes, replace the cached result.
313 proc check_effective_target_fpic { } {
315 global et_fpic_target_name
317 if { ![info exists et_fpic_target_name] } {
318 set et_fpic_target_name ""
321 # If the target has changed since we set the cached value, clear it.
322 set current_target [current_target_name]
323 if { $current_target != $et_fpic_target_name } {
324 verbose "check_effective_target_fpic: `$et_fpic_target_name'" 2
325 set et_fpic_target_name $current_target
326 if [info exists et_fpic_saved] {
327 verbose "check_effective_target_fpic: removing cached result" 2
332 if [info exists et_fpic_saved] {
333 verbose "check_effective_target_fpic: using cached result" 2
335 verbose "check_effective_target_fpic: compiling source" 2
337 # Note that M68K has a multilib that supports -fpic but not
338 # -fPIC, so we need to check both. We test with a program that
339 # requires GOT references.
340 set et_fpic_saved [string match "" [get_compiler_messages fpic object {
341 extern int foo (void); extern int bar;
342 int baz (void) { return foo () + bar; }
345 if { $et_fpic_saved != 0 } {
346 set et_fpic_saved [string match "" [get_compiler_messages fpic object {
347 extern int foo (void); extern int bar;
348 int baz (void) { return foo () + bar; }
352 verbose "check_effective_target_fpic: returning $et_fpic_saved" 2
353 return $et_fpic_saved
356 # Return true if iconv is supported on the target. In particular IBM1047.
358 proc check_iconv_available { test_what } {
366 verbose "check_iconv_available compiling testfile $src" 2
367 set f [open $src "w"]
368 # Compile a small test program.
369 puts $f "#include <iconv.h>\n"
370 puts $f "int main (void)\n {\n iconv_t cd; \n"
371 puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n"
372 puts $f "if (cd == (iconv_t) -1)\n return 1;\n"
373 puts $f "return 0;\n}"
376 # If the tool configuration file has not set libiconv, try "-liconv"
377 if { ![info exists libiconv] } {
378 set libiconv "-liconv"
380 set lines [${tool}_target_compile $src $exe executable "libs=$libiconv" ]
383 if [string match "" $lines] then {
384 # No error messages, everything is OK.
386 set result [${tool}_load "./$exe" "" ""]
387 set status [lindex $result 0]
388 remote_file build delete $exe
390 verbose "check_iconv_available status is <$status>" 2
392 if { $status == "pass" } then {
400 # Return true if named sections are supported on this target.
401 # This proc does not cache results, because the answer may vary
402 # when cycling over subtarget options (e.g. irix o32/n32/n64) in
404 proc check_named_sections_available { } {
405 verbose "check_named_sections_available: compiling source" 2
406 set answer [string match "" [get_compiler_messages named object {
407 int __attribute__ ((section("whatever"))) foo;
409 verbose "check_named_sections_available: returning $answer" 2
413 # Return 1 if the target supports Fortran real kinds larger than real(8),
416 # When the target name changes, replace the cached result.
418 proc check_effective_target_fortran_large_real { } {
419 global et_fortran_large_real_saved
420 global et_fortran_large_real_target_name
423 if { ![info exists et_fortran_large_real_target_name] } {
424 set et_fortran_large_real_target_name ""
427 # If the target has changed since we set the cached value, clear it.
428 set current_target [current_target_name]
429 if { $current_target != $et_fortran_large_real_target_name } {
430 verbose "check_effective_target_fortran_large_real: `$et_fortran_large_real_target_name' `$current_target'" 2
431 set et_fortran_large_real_target_name $current_target
432 if [info exists et_fortran_large_real_saved] {
433 verbose "check_effective_target_fortran_large_real: removing cached result" 2
434 unset et_fortran_large_real_saved
438 if [info exists et_fortran_large_real_saved] {
439 verbose "check_effective_target_fortran_large_real returning saved $et_fortran_large_real_saved" 2
441 set et_fortran_large_real_saved 0
443 # Set up, compile, and execute a test program using large real
444 # kinds. Include the current process ID in the file names to
445 # prevent conflicts with invocations for multiple testsuites.
446 set src real[pid].f90
449 set f [open $src "w"]
450 puts $f "integer,parameter :: k = &"
451 puts $f " selected_real_kind (precision (0.0_8) + 1)"
452 puts $f "real(kind=k) :: x"
456 verbose "check_effective_target_fortran_large_real compiling testfile $src" 2
457 set lines [${tool}_target_compile $src $exe executable ""]
460 if [string match "" $lines] then {
461 # No error message, compilation succeeded.
462 set et_fortran_large_real_saved 1
466 return $et_fortran_large_real_saved
469 # Return 1 if the target supports Fortran integer kinds larger than
470 # integer(8), 0 otherwise.
472 # When the target name changes, replace the cached result.
474 proc check_effective_target_fortran_large_int { } {
475 global et_fortran_large_int_saved
476 global et_fortran_large_int_target_name
479 if { ![info exists et_fortran_large_int_target_name] } {
480 set et_fortran_large_int_target_name ""
483 # If the target has changed since we set the cached value, clear it.
484 set current_target [current_target_name]
485 if { $current_target != $et_fortran_large_int_target_name } {
486 verbose "check_effective_target_fortran_large_int: `$et_fortran_large_int_target_name' `$current_target'" 2
487 set et_fortran_large_int_target_name $current_target
488 if [info exists et_fortran_large_int_saved] {
489 verbose "check_effective_target_fortran_large_int: removing cached result" 2
490 unset et_fortran_large_int_saved
494 if [info exists et_fortran_large_int_saved] {
495 verbose "check_effective_target_fortran_large_int returning saved $et_fortran_large_int_saved" 2
497 set et_fortran_large_int_saved 0
499 # Set up, compile, and execute a test program using large integer
500 # kinds. Include the current process ID in the file names to
501 # prevent conflicts with invocations for multiple testsuites.
505 set f [open $src "w"]
506 puts $f "integer,parameter :: k = &"
507 puts $f " selected_int_kind (range (0_8) + 1)"
508 puts $f "integer(kind=k) :: i"
512 verbose "check_effective_target_fortran_large_int compiling testfile $src" 2
513 set lines [${tool}_target_compile $src $exe executable ""]
516 if [string match "" $lines] then {
517 # No error message, compilation succeeded.
518 set et_fortran_large_int_saved 1
522 return $et_fortran_large_int_saved
525 # Return 1 if the target supports executing AltiVec instructions, 0
526 # otherwise. Cache the result.
528 proc check_vmx_hw_available { } {
529 global vmx_hw_available_saved
532 if [info exists vmx_hw_available_saved] {
533 verbose "check_hw_available returning saved $vmx_hw_available_saved" 2
535 set vmx_hw_available_saved 0
537 # Some simulators are known to not support VMX instructions.
538 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
539 verbose "check_hw_available returning 0" 2
540 return $vmx_hw_available_saved
543 # Set up, compile, and execute a test program containing VMX
544 # instructions. Include the current process ID in the file
545 # names to prevent conflicts with invocations for multiple
550 set f [open $src "w"]
551 puts $f "int main() {"
552 puts $f "#ifdef __MACH__"
553 puts $f " asm volatile (\"vor v0,v0,v0\");"
555 puts $f " asm volatile (\"vor 0,0,0\");"
557 puts $f " return 0; }"
560 # Most targets don't require special flags for this test case, but
562 if [istarget *-*-darwin*] {
563 set opts "additional_flags=-maltivec"
568 verbose "check_vmx_hw_available compiling testfile $src" 2
569 set lines [${tool}_target_compile $src $exe executable "$opts"]
572 if [string match "" $lines] then {
573 # No error message, compilation succeeded.
574 set result [${tool}_load "./$exe" "" ""]
575 set status [lindex $result 0]
576 remote_file build delete $exe
577 verbose "check_vmx_hw_available testfile status is <$status>" 2
579 if { $status == "pass" } then {
580 set vmx_hw_available_saved 1
583 verbose "check_vmx_hw_availalble testfile compilation failed" 2
587 return $vmx_hw_available_saved
590 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
591 # complex float arguments. This affects gfortran tests that call cabsf
592 # in libm built by an earlier compiler. Return 1 if libm uses the same
593 # argument passing as the compiler under test, 0 otherwise.
595 # When the target name changes, replace the cached result.
597 proc check_effective_target_broken_cplxf_arg { } {
598 global et_broken_cplxf_arg_saved
599 global et_broken_cplxf_arg_target_name
602 # Skip the work for targets known not to be affected.
603 if { ![istarget powerpc64-*-linux*] } {
605 } elseif { [is-effective-target ilp32] } {
609 if { ![info exists et_broken_cplxf_arg_target_name] } {
610 set et_broken_cplxf_arg_target_name ""
613 # If the target has changed since we set the cached value, clear it.
614 set current_target [current_target_name]
615 if { $current_target != $et_broken_cplxf_arg_target_name } {
616 verbose "check_effective_target_broken_cplxf_arg: `$et_broken_cplxf_arg_target_name'" 2
617 set et_broken_cplxf_arg_target_name $current_target
618 if [info exists et_broken_cplxf_arg_saved] {
619 verbose "check_effective_target_broken_cplxf_arg: removing cached result" 2
620 unset et_broken_cplxf_arg_saved
624 if [info exists et_broken_cplxf_arg_saved] {
625 verbose "check_effective_target_broken_cplxf_arg: using cached result" 2
627 set et_broken_cplxf_arg_saved 0
628 # This is only known to affect one target.
629 if { ![istarget powerpc64-*-linux*] || ![is-effective-target lp64] } {
630 set et_broken_cplxf_arg_saved 0
631 verbose "check_effective_target_broken_cplxf_arg: caching 0" 2
632 return $et_broken_cplxf_arg_saved
635 # Set up, compile, and execute a C test program that calls cabsf.
639 set f [open $src "w"]
640 puts $f "#include <complex.h>"
641 puts $f "extern void abort (void);"
642 puts $f "float fabsf (float);"
643 puts $f "float cabsf (_Complex float);"
644 puts $f "int main ()"
646 puts $f " _Complex float cf;"
648 puts $f " cf = 3 + 4.0fi;"
649 puts $f " f = cabsf (cf);"
650 puts $f " if (fabsf (f - 5.0) > 0.0001) abort ();"
655 set lines [${tool}_target_compile $src $exe executable "-lm"]
658 if [string match "" $lines] {
659 # No error message, compilation succeeded.
660 set result [${tool}_load "./$exe" "" ""]
661 set status [lindex $result 0]
662 remote_file build delete $exe
664 verbose "check_effective_target_broken_cplxf_arg: status is <$status>" 2
666 if { $status != "pass" } {
667 set et_broken_cplxf_arg_saved 1
670 verbose "check_effective_target_broken_cplxf_arg: compilation failed" 2
673 return $et_broken_cplxf_arg_saved
676 proc check_alpha_max_hw_available { } {
677 global alpha_max_hw_available_saved
680 if [info exists alpha_max_hw_available_saved] {
681 verbose "check_alpha_max_hw_available returning saved $alpha_max_hw_available_saved" 2
683 set alpha_max_hw_available_saved 0
685 # Set up, compile, and execute a test program probing bit 8 of the
686 # architecture mask, which indicates presence of MAX instructions.
690 set f [open $src "w"]
691 puts $f "int main() { return __builtin_alpha_amask(1<<8) != 0; }"
694 verbose "check_alpha_max_hw_available compiling testfile $src" 2
695 set lines [${tool}_target_compile $src $exe executable ""]
698 if [string match "" $lines] then {
699 # No error message, compilation succeeded.
700 set result [${tool}_load "./$exe" "" ""]
701 set status [lindex $result 0]
702 remote_file build delete $exe
703 verbose "check_alpha_max_hw_available testfile status is <$status>" 2
705 if { $status == "pass" } then {
706 set alpha_max_hw_available_saved 1
709 verbose "check_alpha_max_hw_availalble testfile compilation failed" 2
713 return $alpha_max_hw_available_saved
716 # Returns true iff the FUNCTION is available on the target system.
717 # (This is essentially a Tcl implementation of Autoconf's
720 proc check_function_available { function } {
721 set var "${function}_available_saved"
725 if {![info exists $var]} {
728 # Check to make sure.
729 set src "function[pid].c"
730 set exe "function[pid].exe"
732 set f [open $src "w"]
733 puts $f "int main () { $function (); }"
736 set lines [${tool}_target_compile $src $exe executable ""]
740 if {![string match "" $lines]} then {
742 verbose -log "$function is not available"
744 verbose -log "$function is available"
751 # Returns true iff "fork" is available on the target system.
753 proc check_fork_available {} {
754 return [check_function_available "fork"]
757 # Returns true iff "mkfifo" is available on the target system.
759 proc check_mkfifo_available {} {
760 if {[istarget *-*-cygwin*]} {
761 # Cygwin has mkfifo, but support is incomplete.
765 return [check_function_available "mkfifo"]
768 # Return 1 if we're generating 32-bit code using default options, 0
771 # When the target name changes, replace the cached result.
773 proc check_effective_target_ilp32 { } {
774 global et_ilp32_saved
775 global et_ilp32_target_name
777 if { ![info exists et_ilp32_target_name] } {
778 set et_ilp32_target_name ""
781 # If the target has changed since we set the cached value, clear it.
782 set current_target [current_target_name]
783 if { $current_target != $et_ilp32_target_name } {
784 verbose "check_effective_target_ilp32: `$et_ilp32_target_name' `$current_target'" 2
785 set et_ilp32_target_name $current_target
786 if { [info exists et_ilp32_saved] } {
787 verbose "check_effective_target_ilp32: removing cached result" 2
792 if [info exists et_ilp32_saved] {
793 verbose "check-effective_target_ilp32: using cached result" 2
795 verbose "check_effective_target_ilp32: compiling source" 2
796 set et_ilp32_saved [string match "" [get_compiler_messages ilp32 object {
797 int dummy[(sizeof (int) == 4 && sizeof (void *) == 4 && sizeof (long) == 4 ) ? 1 : -1];
800 verbose "check_effective_target_ilp32: returning $et_ilp32_saved" 2
801 return $et_ilp32_saved
804 # Return 1 if we're generating 64-bit code using default options, 0
807 # When the target name changes, replace the cached result.
809 proc check_effective_target_lp64 { } {
811 global et_lp64_target_name
813 if { ![info exists et_lp64_target_name] } {
814 set et_lp64_target_name ""
817 # If the target has changed since we set the cached value, clear it.
818 set current_target [current_target_name]
819 if { $current_target != $et_lp64_target_name } {
820 verbose "check_effective_target_lp64: `$et_lp64_target_name' `$current_target'" 2
821 set et_lp64_target_name $current_target
822 if [info exists et_lp64_saved] {
823 verbose "check_effective_target_lp64: removing cached result" 2
828 if [info exists et_lp64_saved] {
829 verbose "check_effective_target_lp64: using cached result" 2
831 verbose "check_effective_target_lp64: compiling source" 2
832 set et_lp64_saved [string match "" [get_compiler_messages lp64 object {
833 int dummy[(sizeof (int) == 4 && sizeof (void *) == 8 && sizeof (long) == 8 ) ? 1 : -1];
836 verbose "check_effective_target_lp64: returning $et_lp64_saved" 2
837 return $et_lp64_saved
840 # Return 1 if the target needs a command line argument to enable a SIMD
843 # This won't change for different subtargets so cache the result.
845 proc check_effective_target_vect_cmdline_needed { } {
846 global et_vect_cmdline_needed_saved
848 if [info exists et_vect_cmdline_needed_saved] {
849 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
851 set et_vect_cmdline_needed_saved 1
852 if { [istarget ia64-*-*]
853 || [istarget x86_64-*-*] } {
854 set et_vect_cmdline_needed_saved 0
858 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
859 return $et_vect_cmdline_needed_saved
862 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
864 # This won't change for different subtargets so cache the result.
866 proc check_effective_target_vect_int { } {
867 global et_vect_int_saved
869 if [info exists et_vect_int_saved] {
870 verbose "check_effective_target_vect_int: using cached result" 2
872 set et_vect_int_saved 0
873 if { [istarget i?86-*-*]
874 || [istarget powerpc*-*-*]
875 || [istarget x86_64-*-*]
876 || [istarget sparc*-*-*]
877 || [istarget alpha*-*-*]
878 || [istarget ia64-*-*] } {
879 set et_vect_int_saved 1
883 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
884 return $et_vect_int_saved
887 # Return 1 is this is an arm target using 32-bit instructions
888 proc check_effective_target_arm32 { } {
889 global et_arm32_saved
890 global et_arm32_target_name
891 global compiler_flags
893 if { ![info exists et_arm32_target_name] } {
894 set et_arm32_target_name ""
897 # If the target has changed since we set the cached value, clear it.
898 set current_target [current_target_name]
899 if { $current_target != $et_arm32_target_name } {
900 verbose "check_effective_target_arm32: `$et_arm32_target_name' `$current_target'" 2
901 set et_arm32_target_name $current_target
902 if { [info exists et_arm32_saved] } {
903 verbose "check_effective_target_arm32: removing cached result" 2
908 if [info exists et_arm32_saved] {
909 verbose "check-effective_target_arm32: using cached result" 2
912 if { [istarget arm-*-*]
913 || [istarget strongarm*-*-*]
914 || [istarget xscale-*-*] } {
915 if ![string match "*-mthumb *" $compiler_flags] {
920 verbose "check_effective_target_arm32: returning $et_arm32_saved" 2
921 return $et_arm32_saved
924 # Return 1 if the target supports hardware vector shift operation.
926 proc check_effective_target_vect_shift { } {
927 global et_vect_shift_saved
929 if [info exists et_vect_shift_saved] {
930 verbose "check_effective_target_vect_shift: using cached result" 2
932 set et_vect_shift_saved 0
933 if { [istarget powerpc*-*-*]
934 || [istarget ia64-*-*]
935 || [istarget i?86-*-*]
936 || [istarget x86_64-*-*] } {
937 set et_vect_shift_saved 1
941 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
942 return $et_vect_shift_saved
945 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
947 # This can change for different subtargets so do not cache the result.
949 proc check_effective_target_vect_long { } {
950 if { [istarget i?86-*-*]
951 || ([istarget powerpc*-*-*] && [check_effective_target_ilp32])
952 || [istarget x86_64-*-*]
953 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
959 verbose "check_effective_target_vect_long: returning $answer" 2
963 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
965 # This won't change for different subtargets so cache the result.
967 proc check_effective_target_vect_float { } {
968 global et_vect_float_saved
970 if [info exists et_vect_float_saved] {
971 verbose "check_effective_target_vect_float: using cached result" 2
973 set et_vect_float_saved 0
974 if { [istarget i?86-*-*]
975 || [istarget powerpc*-*-*]
976 || [istarget mipsisa64*-*-*]
977 || [istarget x86_64-*-*]
978 || [istarget ia64-*-*] } {
979 set et_vect_float_saved 1
983 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
984 return $et_vect_float_saved
987 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
989 # This won't change for different subtargets so cache the result.
991 proc check_effective_target_vect_double { } {
992 global et_vect_double_saved
994 if [info exists et_vect_double_saved] {
995 verbose "check_effective_target_vect_double: using cached result" 2
997 set et_vect_double_saved 0
998 if { [istarget i?86-*-*]
999 || [istarget x86_64-*-*] } {
1000 set et_vect_double_saved 1
1004 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
1005 return $et_vect_double_saved
1008 # Return 1 if the target plus current options does not support a vector
1009 # max instruction on "int", 0 otherwise.
1011 # This won't change for different subtargets so cache the result.
1013 proc check_effective_target_vect_no_int_max { } {
1014 global et_vect_no_int_max_saved
1016 if [info exists et_vect_no_int_max_saved] {
1017 verbose "check_effective_target_vect_no_int_max: using cached result" 2
1019 set et_vect_no_int_max_saved 0
1020 if { [istarget sparc*-*-*]
1021 || [istarget alpha*-*-*] } {
1022 set et_vect_no_int_max_saved 1
1025 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
1026 return $et_vect_no_int_max_saved
1029 # Return 1 if the target plus current options does not support a vector
1030 # add instruction on "int", 0 otherwise.
1032 # This won't change for different subtargets so cache the result.
1034 proc check_effective_target_vect_no_int_add { } {
1035 global et_vect_no_int_add_saved
1037 if [info exists et_vect_no_int_add_saved] {
1038 verbose "check_effective_target_vect_no_int_add: using cached result" 2
1040 set et_vect_no_int_add_saved 0
1041 # Alpha only supports vector add on V8QI and V4HI.
1042 if { [istarget alpha*-*-*] } {
1043 set et_vect_no_int_add_saved 1
1046 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
1047 return $et_vect_no_int_add_saved
1050 # Return 1 if the target plus current options does not support vector
1051 # bitwise instructions, 0 otherwise.
1053 # This won't change for different subtargets so cache the result.
1055 proc check_effective_target_vect_no_bitwise { } {
1056 global et_vect_no_bitwise_saved
1058 if [info exists et_vect_no_bitwise_saved] {
1059 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
1061 set et_vect_no_bitwise_saved 0
1063 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
1064 return $et_vect_no_bitwise_saved
1067 # Return 1 if the target plus current options does not support a vector
1068 # alignment mechanism, 0 otherwise.
1070 # This won't change for different subtargets so cache the result.
1072 proc check_effective_target_vect_no_align { } {
1073 global et_vect_no_align_saved
1075 if [info exists et_vect_no_align_saved] {
1076 verbose "check_effective_target_vect_no_align: using cached result" 2
1078 set et_vect_no_align_saved 0
1079 if { [istarget mipsisa64*-*-*]
1080 || [istarget sparc*-*-*]
1081 || [istarget ia64-*-*] } {
1082 set et_vect_no_align_saved 1
1085 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
1086 return $et_vect_no_align_saved
1089 # Return 1 if the target supports vector conditional operations, 0 otherwise.
1091 proc check_effective_target_vect_condition { } {
1092 global et_vect_cond_saved
1094 if [info exists et_vect_cond_saved] {
1095 verbose "check_effective_target_vect_cond: using cached result" 2
1097 set et_vect_cond_saved 0
1098 if { [istarget powerpc*-*-*]
1099 || [istarget ia64-*-*]
1100 || [istarget i?86-*-*]
1101 || [istarget x86_64-*-*] } {
1102 set et_vect_cond_saved 1
1106 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
1107 return $et_vect_cond_saved
1110 # Return 1 if the target supports vector int multiplication, 0 otherwise.
1112 proc check_effective_target_vect_int_mult { } {
1113 global et_vect_int_mult_saved
1115 if [info exists et_vect_int_mult_saved] {
1116 verbose "check_effective_target_vect_int_mult: using cached result" 2
1118 set et_vect_int_mult_saved 0
1119 if { [istarget powerpc*-*-*]
1120 || [istarget i?86-*-*]
1121 || [istarget x86_64-*-*] } {
1122 set et_vect_int_mult_saved 1
1126 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
1127 return $et_vect_int_mult_saved
1130 # Return 1 if the target supports atomic operations on "int" and "long".
1132 proc check_effective_target_sync_int_long { } {
1133 global et_sync_int_long_saved
1135 if [info exists et_sync_int_long_saved] {
1136 verbose "check_effective_target_sync_int_long: using cached result" 2
1138 set et_sync_int_long_saved 0
1139 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
1140 # load-reserved/store-conditional instructions.
1141 if { [istarget ia64-*-*]
1142 || [istarget i?86-*-*]
1143 || [istarget x86_64-*-*]
1144 || [istarget alpha*-*-*]
1145 || [istarget s390*-*-*]
1146 || [istarget powerpc*-*-*] } {
1147 set et_sync_int_long_saved 1
1151 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
1152 return $et_sync_int_long_saved
1155 # Return 1 if the target supports atomic operations on "char" and "short".
1157 proc check_effective_target_sync_char_short { } {
1158 global et_sync_char_short_saved
1160 if [info exists et_sync_char_short_saved] {
1161 verbose "check_effective_target_sync_char_short: using cached result" 2
1163 set et_sync_char_short_saved 0
1164 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
1165 # load-reserved/store-conditional instructions.
1166 if { [istarget ia64-*-*]
1167 || [istarget i?86-*-*]
1168 || [istarget x86_64-*-*]
1169 || [istarget alpha*-*-*]
1170 || [istarget powerpc*-*-*] } {
1171 set et_sync_char_short_saved 1
1175 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
1176 return $et_sync_char_short_saved
1179 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
1180 # This can be used with any check_* proc that takes no argument and
1181 # returns only 1 or 0. It could be used with check_* procs that take
1182 # arguments with keywords that pass particular arguments.
1184 proc is-effective-target { arg } {
1186 if { [info procs check_effective_target_${arg}] != [list] } {
1187 set selected [check_effective_target_${arg}]
1190 "vmx_hw" { set selected [check_vmx_hw_available] }
1191 "named_sections" { set selected [check_named_sections_available] }
1192 "gc_sections" { set selected [check_gc_sections_available] }
1193 default { error "unknown effective target keyword `$arg'" }
1196 verbose "is-effective-target: $arg $selected" 2
1200 # Return 1 if the argument is an effective-target keyword, 0 otherwise.
1202 proc is-effective-target-keyword { arg } {
1203 if { [info procs check_effective_target_${arg}] != [list] } {
1206 # These have different names for their check_* procs.
1208 "vmx_hw" { return 1 }
1209 "named_sections" { return 1 }
1210 "gc_sections" { return 1 }
1211 default { return 0 }