1 # Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006
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 2 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 this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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.
25 # BASENAME is a basename to use for temporary files.
26 # TYPE is the type of compilation to perform (see target_compile).
27 # CONTENTS gives the contents of the input file.
28 # The rest is optional:
29 # OPTIONS: additional compiler options to use.
30 proc get_compiler_messages {basename type contents args} {
33 if { [llength $args] > 0 } {
34 set options "additional_flags=[lindex $args 0]"
39 set src ${basename}[pid].c
41 assembly { set output ${basename}[pid].s }
42 object { set output ${basename}[pid].o }
47 set lines [${tool}_target_compile $src $output $type "$options"]
49 remote_file build delete $output
54 proc current_target_name { } {
56 if [info exists target_info(target,name)] {
57 set answer $target_info(target,name)
64 # Implement an effective-target check for property PROP by invoking
65 # the compiler and seeing if it prints any messages. Assume that the
66 # property holds if the compiler doesn't print anything. The other
67 # arguments are as for get_compiler_messages, starting with TYPE.
68 proc check_no_compiler_messages {prop args} {
71 set target [current_target_name]
72 if {![info exists et_cache($prop,target)]
73 || $et_cache($prop,target) != $target} {
74 verbose "check_effective_target $prop: compiling source for $target" 2
75 set et_cache($prop,target) $target
76 set et_cache($prop,value) \
77 [string match "" [eval get_compiler_messages $prop $args]]
79 set value $et_cache($prop,value)
80 verbose "check_effective_target $prop: returning $value for $target" 2
84 ###############################
85 # proc check_weak_available { }
86 ###############################
88 # weak symbols are only supported in some configs/object formats
89 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
91 proc check_weak_available { } {
95 # All mips targets should support it
97 if { [ string first "mips" $target_cpu ] >= 0 } {
101 # All solaris2 targets should support it
103 if { [regexp ".*-solaris2.*" $target_triplet] } {
107 # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
109 if { [regexp "alpha.*osf.*" $target_triplet] } {
113 # Windows targets Cygwin and MingW32 support it
115 if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
119 # HP-UX 10.X doesn't support it
121 if { [regexp "hppa.*hpux10" $target_triplet] } {
125 # ELF and ECOFF support it. a.out does with gas/gld but may also with
126 # other linkers, so we should try it
128 set objformat [gcc_target_object_format]
136 unknown { return -1 }
141 ###############################
142 # proc check_visibility_available { what_kind }
143 ###############################
145 # The visibility attribute is only support in some object formats
146 # This proc returns 1 if it is supported, 0 if not.
147 # The argument is the kind of visibility, default/protected/hidden/internal.
149 proc check_visibility_available { what_kind } {
151 global target_triplet
153 # On NetWare, support makes no sense.
154 if { [istarget *-*-netware*] } {
158 if [string match "" $what_kind] { set what_kind "hidden" }
160 return [check_no_compiler_messages visibility_available_$what_kind object "
161 void f() __attribute__((visibility(\"$what_kind\")));
166 ###############################
167 # proc check_alias_available { }
168 ###############################
170 # Determine if the target toolchain supports the alias attribute.
172 # Returns 2 if the target supports aliases. Returns 1 if the target
173 # only supports weak aliased. Returns 0 if the target does not
174 # support aliases at all. Returns -1 if support for aliases could not
177 proc check_alias_available { } {
178 global alias_available_saved
181 if [info exists alias_available_saved] {
182 verbose "check_alias_available returning saved $alias_available_saved" 2
186 verbose "check_alias_available compiling testfile $src" 2
187 set f [open $src "w"]
188 # Compile a small test program. The definition of "g" is
189 # necessary to keep the Solaris assembler from complaining
191 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
192 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
194 set lines [${tool}_target_compile $src $obj object ""]
196 remote_file build delete $obj
198 if [string match "" $lines] then {
199 # No error messages, everything is OK.
200 set alias_available_saved 2
202 if [regexp "alias definitions not supported" $lines] {
203 verbose "check_alias_available target does not support aliases" 2
205 set objformat [gcc_target_object_format]
207 if { $objformat == "elf" } {
208 verbose "check_alias_available but target uses ELF format, so it ought to" 2
209 set alias_available_saved -1
211 set alias_available_saved 0
214 if [regexp "only weak aliases are supported" $lines] {
215 verbose "check_alias_available target supports only weak aliases" 2
216 set alias_available_saved 1
218 set alias_available_saved -1
223 verbose "check_alias_available returning $alias_available_saved" 2
226 return $alias_available_saved
229 # Returns true if --gc-sections is supported on the target.
231 proc check_gc_sections_available { } {
232 global gc_sections_available_saved
235 if {![info exists gc_sections_available_saved]} {
236 # Some targets don't support gc-sections despite whatever's
237 # advertised by ld's options.
238 if { [istarget alpha*-*-*]
239 || [istarget ia64-*-*] } {
240 set gc_sections_available_saved 0
244 # Check if the ld used by gcc supports --gc-sections.
245 set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
246 regsub ".*\n\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
247 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
248 set ld_output [remote_exec host "$gcc_ld" "--help"]
249 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
250 set gc_sections_available_saved 1
252 set gc_sections_available_saved 0
255 return $gc_sections_available_saved
258 # Return true if profiling is supported on the target.
260 proc check_profiling_available { test_what } {
261 global profiling_available_saved
263 verbose "Profiling argument is <$test_what>" 1
265 # These conditions depend on the argument so examine them before
266 # looking at the cache variable.
268 # Support for -p on solaris2 relies on mcrt1.o which comes with the
269 # vendor compiler. We cannot reliably predict the directory where the
270 # vendor compiler (and thus mcrt1.o) is installed so we can't
271 # necessarily find mcrt1.o even if we have it.
272 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
276 # Support for -p on irix relies on libprof1.a which doesn't appear to
277 # exist on any irix6 system currently posting testsuite results.
278 # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
279 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
280 if { [istarget mips*-*-irix*]
281 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
285 # At present, there is no profiling support on NetWare.
286 if { [istarget *-*-netware*] } {
290 # Now examine the cache variable.
291 if {![info exists profiling_available_saved]} {
292 # Some targets don't have any implementation of __bb_init_func or are
293 # missing other needed machinery.
294 if { [istarget mmix-*-*]
295 || [istarget arm*-*-eabi*]
296 || [istarget arm*-*-elf]
297 || [istarget arm*-*-symbianelf*]
298 || [istarget powerpc-*-eabi*]
299 || [istarget strongarm*-*-elf]
300 || [istarget xscale*-*-elf]
301 || [istarget cris-*-*]
302 || [istarget h8300-*-*]
303 || [istarget m32c-*-elf]
304 || [istarget m68k-*-elf]
305 || [istarget mips*-*-elf]
306 || [istarget xtensa-*-elf]
307 || [istarget *-*-windiss] } {
308 set profiling_available_saved 0
310 set profiling_available_saved 1
314 return $profiling_available_saved
317 # Return 1 if target has packed layout of structure members by
318 # default, 0 otherwise. Note that this is slightly different than
319 # whether the target has "natural alignment": both attributes may be
322 proc check_effective_target_default_packed { } {
323 return [check_no_compiler_messages default_packed assembly {
324 struct x { char a; long b; } c;
325 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
329 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
330 # documentation, where the test also comes from.
332 proc check_effective_target_pcc_bitfield_type_matters { } {
333 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
334 # bitfields, but let's stick to the example code from the docs.
335 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
336 struct foo1 { char x; char :0; char y; };
337 struct foo2 { char x; int :0; char y; };
338 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
342 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
344 # This won't change for different subtargets so cache the result.
346 proc check_effective_target_tls {} {
349 if [info exists et_tls_saved] {
350 verbose "check_effective_target_tls: using cached result" 2
356 verbose "check_effective_target_tls: compiling testfile $src" 2
357 set f [open $src "w"]
358 # Compile a small test program.
359 puts $f "__thread int i;\n"
362 # Test for thread-local data supported by the platform.
364 [target_compile $src $asm assembly ""]
366 if { [string match "*not supported*" $comp_output] } {
369 remove-build-file $asm
371 verbose "check_effective_target_tls: returning $et_tls_saved" 2
375 # Return 1 if TLS executables can run correctly, 0 otherwise.
377 # This won't change for different subtargets so cache the result.
379 proc check_effective_target_tls_runtime {} {
380 global et_tls_runtime_saved
382 if [info exists et_tls_runtime_saved] {
383 verbose "check_effective_target_tls_runtime: using cached result" 2
385 set et_tls_runtime_saved 0
387 set src tls_runtime[pid].c
388 set exe tls_runtime[pid].x
389 verbose "check_effective_target_tls_runtime: compiling testfile $src" 2
390 set f [open $src "w"]
391 # Compile a small test program.
392 puts $f "__thread int thr = 0;\n"
393 puts $f "int main(void)\n {\n return thr;\n}"
397 [target_compile $src $exe executable ""]
400 if [string match "" $comp_output] then {
401 # No error messages, everything is OK.
403 set result [remote_load target "./$exe" "" ""]
404 set status [lindex $result 0]
405 remote_file build delete $exe
407 verbose "check_effective_target_tls_runtime status is <$status>" 2
409 if { $status == "pass" } {
410 set et_tls_runtime_saved 1
413 verbose "check_effective_target_tls_runtime: returning $et_tls_runtime_saved" 2
417 return $et_tls_runtime_saved
420 # Return 1 if compilation with -fopenmp is error-free for trivial
423 proc check_effective_target_fopenmp {} {
424 return [check_no_compiler_messages fopenmp object {
429 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
430 # for trivial code, 0 otherwise.
432 proc check_effective_target_freorder {} {
433 return [check_no_compiler_messages freorder object {
435 } "-freorder-blocks-and-partition"]
438 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
439 # emitted, 0 otherwise. Whether a shared library can actually be built is
440 # out of scope for this test.
442 proc check_effective_target_fpic { } {
443 # Note that M68K has a multilib that supports -fpic but not
444 # -fPIC, so we need to check both. We test with a program that
445 # requires GOT references.
446 foreach arg {fpic fPIC} {
447 if [check_no_compiler_messages $arg object {
448 extern int foo (void); extern int bar;
449 int baz (void) { return foo () + bar; }
457 # Return true if the target supports -mpaired-single (as used on MIPS).
459 proc check_effective_target_mpaired_single { } {
460 return [check_no_compiler_messages mpaired_single object {
465 # Return true if iconv is supported on the target. In particular IBM1047.
467 proc check_iconv_available { test_what } {
475 verbose "check_iconv_available compiling testfile $src" 2
476 set f [open $src "w"]
477 # Compile a small test program.
478 puts $f "#include <iconv.h>\n"
479 puts $f "int main (void)\n {\n iconv_t cd; \n"
480 puts $f "cd = iconv_open (\"[lindex $test_what 1]\", \"UTF-8\");\n"
481 puts $f "if (cd == (iconv_t) -1)\n return 1;\n"
482 puts $f "return 0;\n}"
485 # If the tool configuration file has not set libiconv, try "-liconv"
486 if { ![info exists libiconv] } {
487 set libiconv "-liconv"
489 set lines [${tool}_target_compile $src $exe executable "libs=$libiconv" ]
492 if [string match "" $lines] then {
493 # No error messages, everything is OK.
495 set result [${tool}_load "./$exe" "" ""]
496 set status [lindex $result 0]
497 remote_file build delete $exe
499 verbose "check_iconv_available status is <$status>" 2
501 if { $status == "pass" } then {
509 # Return true if named sections are supported on this target.
511 proc check_named_sections_available { } {
512 return [check_no_compiler_messages named_sections assembly {
513 int __attribute__ ((section("whatever"))) foo;
517 # Return 1 if the target supports Fortran real kinds larger than real(8),
520 # When the target name changes, replace the cached result.
522 proc check_effective_target_fortran_large_real { } {
523 global et_fortran_large_real_saved
524 global et_fortran_large_real_target_name
527 if { ![info exists et_fortran_large_real_target_name] } {
528 set et_fortran_large_real_target_name ""
531 # If the target has changed since we set the cached value, clear it.
532 set current_target [current_target_name]
533 if { $current_target != $et_fortran_large_real_target_name } {
534 verbose "check_effective_target_fortran_large_real: `$et_fortran_large_real_target_name' `$current_target'" 2
535 set et_fortran_large_real_target_name $current_target
536 if [info exists et_fortran_large_real_saved] {
537 verbose "check_effective_target_fortran_large_real: removing cached result" 2
538 unset et_fortran_large_real_saved
542 if [info exists et_fortran_large_real_saved] {
543 verbose "check_effective_target_fortran_large_real returning saved $et_fortran_large_real_saved" 2
545 set et_fortran_large_real_saved 0
547 # Set up, compile, and execute a test program using large real
548 # kinds. Include the current process ID in the file names to
549 # prevent conflicts with invocations for multiple testsuites.
550 set src real[pid].f90
553 set f [open $src "w"]
554 puts $f "integer,parameter :: k = &"
555 puts $f " selected_real_kind (precision (0.0_8) + 1)"
556 puts $f "real(kind=k) :: x"
557 puts $f "x = cos (x);"
561 verbose "check_effective_target_fortran_large_real compiling testfile $src" 2
562 set lines [${tool}_target_compile $src $exe executable ""]
565 if [string match "" $lines] then {
566 # No error message, compilation succeeded.
567 set et_fortran_large_real_saved 1
571 return $et_fortran_large_real_saved
574 # Return 1 if the target supports Fortran integer kinds larger than
575 # integer(8), 0 otherwise.
577 # When the target name changes, replace the cached result.
579 proc check_effective_target_fortran_large_int { } {
580 global et_fortran_large_int_saved
581 global et_fortran_large_int_target_name
584 if { ![info exists et_fortran_large_int_target_name] } {
585 set et_fortran_large_int_target_name ""
588 # If the target has changed since we set the cached value, clear it.
589 set current_target [current_target_name]
590 if { $current_target != $et_fortran_large_int_target_name } {
591 verbose "check_effective_target_fortran_large_int: `$et_fortran_large_int_target_name' `$current_target'" 2
592 set et_fortran_large_int_target_name $current_target
593 if [info exists et_fortran_large_int_saved] {
594 verbose "check_effective_target_fortran_large_int: removing cached result" 2
595 unset et_fortran_large_int_saved
599 if [info exists et_fortran_large_int_saved] {
600 verbose "check_effective_target_fortran_large_int returning saved $et_fortran_large_int_saved" 2
602 set et_fortran_large_int_saved 0
604 # Set up, compile, and execute a test program using large integer
605 # kinds. Include the current process ID in the file names to
606 # prevent conflicts with invocations for multiple testsuites.
610 set f [open $src "w"]
611 puts $f "integer,parameter :: k = &"
612 puts $f " selected_int_kind (range (0_8) + 1)"
613 puts $f "integer(kind=k) :: i"
617 verbose "check_effective_target_fortran_large_int compiling testfile $src" 2
618 set lines [${tool}_target_compile $src $exe executable ""]
621 if [string match "" $lines] then {
622 # No error message, compilation succeeded.
623 set et_fortran_large_int_saved 1
627 return $et_fortran_large_int_saved
630 # Return 1 if we can statically link libgfortran, 0 otherwise.
632 # When the target name changes, replace the cached result.
634 proc check_effective_target_static_libgfortran { } {
635 global et_static_libgfortran
636 global et_static_libgfortran_target_name
639 if { ![info exists et_static_libgfortran_target_name] } {
640 set et_static_libgfortran_target_name ""
643 # If the target has changed since we set the cached value, clear it.
644 set current_target [current_target_name]
645 if { $current_target != $et_static_libgfortran_target_name } {
646 verbose "check_effective_target_static_libgfortran: `$et_static_libgfortran_target_name' `$current_target'" 2
647 set et_static_libgfortran_target_name $current_target
648 if [info exists et_static_libgfortran_saved] {
649 verbose "check_effective_target_static_libgfortran: removing cached result" 2
650 unset et_static_libgfortran_saved
654 if [info exists et_static_libgfortran_saved] {
655 verbose "check_effective_target_static_libgfortran returning saved $et_static_libgfortran_saved" 2
657 set et_static_libgfortran_saved 0
659 # Set up, compile, and execute a test program using static linking.
660 # Include the current process ID in the file names to prevent
661 # conflicts with invocations for multiple testsuites.
662 set opts "additional_flags=-static"
663 set src static[pid].f
664 set exe static[pid].x
666 set f [open $src "w"]
667 puts $f " print *, 'test'"
671 verbose "check_effective_target_static_libgfortran compiling testfile $src" 2
672 set lines [${tool}_target_compile $src $exe executable "$opts"]
675 if [string match "" $lines] then {
676 # No error message, compilation succeeded.
677 set et_static_libgfortran_saved 1
681 return $et_static_libgfortran_saved
684 # Return 1 if the target supports executing AltiVec instructions, 0
685 # otherwise. Cache the result.
687 proc check_vmx_hw_available { } {
688 global vmx_hw_available_saved
691 if [info exists vmx_hw_available_saved] {
692 verbose "check_hw_available returning saved $vmx_hw_available_saved" 2
694 set vmx_hw_available_saved 0
696 # Some simulators are known to not support VMX instructions.
697 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
698 verbose "check_hw_available returning 0" 2
699 return $vmx_hw_available_saved
702 # Set up, compile, and execute a test program containing VMX
703 # instructions. Include the current process ID in the file
704 # names to prevent conflicts with invocations for multiple
709 set f [open $src "w"]
710 puts $f "int main() {"
711 puts $f "#ifdef __MACH__"
712 puts $f " asm volatile (\"vor v0,v0,v0\");"
714 puts $f " asm volatile (\"vor 0,0,0\");"
716 puts $f " return 0; }"
719 # Most targets don't require special flags for this test case, but
721 if [istarget *-*-darwin*] {
722 set opts "additional_flags=-maltivec"
727 verbose "check_vmx_hw_available compiling testfile $src" 2
728 set lines [${tool}_target_compile $src $exe executable "$opts"]
731 if [string match "" $lines] then {
732 # No error message, compilation succeeded.
733 set result [${tool}_load "./$exe" "" ""]
734 set status [lindex $result 0]
735 remote_file build delete $exe
736 verbose "check_vmx_hw_available testfile status is <$status>" 2
738 if { $status == "pass" } then {
739 set vmx_hw_available_saved 1
742 verbose "check_vmx_hw_availalble testfile compilation failed" 2
746 return $vmx_hw_available_saved
749 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
750 # complex float arguments. This affects gfortran tests that call cabsf
751 # in libm built by an earlier compiler. Return 1 if libm uses the same
752 # argument passing as the compiler under test, 0 otherwise.
754 # When the target name changes, replace the cached result.
756 proc check_effective_target_broken_cplxf_arg { } {
757 global et_broken_cplxf_arg_saved
758 global et_broken_cplxf_arg_target_name
761 # Skip the work for targets known not to be affected.
762 if { ![istarget powerpc64-*-linux*] } {
764 } elseif { [is-effective-target ilp32] } {
768 if { ![info exists et_broken_cplxf_arg_target_name] } {
769 set et_broken_cplxf_arg_target_name ""
772 # If the target has changed since we set the cached value, clear it.
773 set current_target [current_target_name]
774 if { $current_target != $et_broken_cplxf_arg_target_name } {
775 verbose "check_effective_target_broken_cplxf_arg: `$et_broken_cplxf_arg_target_name'" 2
776 set et_broken_cplxf_arg_target_name $current_target
777 if [info exists et_broken_cplxf_arg_saved] {
778 verbose "check_effective_target_broken_cplxf_arg: removing cached result" 2
779 unset et_broken_cplxf_arg_saved
783 if [info exists et_broken_cplxf_arg_saved] {
784 verbose "check_effective_target_broken_cplxf_arg: using cached result" 2
786 set et_broken_cplxf_arg_saved 0
787 # This is only known to affect one target.
788 if { ![istarget powerpc64-*-linux*] || ![is-effective-target lp64] } {
789 set et_broken_cplxf_arg_saved 0
790 verbose "check_effective_target_broken_cplxf_arg: caching 0" 2
791 return $et_broken_cplxf_arg_saved
794 # Set up, compile, and execute a C test program that calls cabsf.
798 set f [open $src "w"]
799 puts $f "#include <complex.h>"
800 puts $f "extern void abort (void);"
801 puts $f "float fabsf (float);"
802 puts $f "float cabsf (_Complex float);"
803 puts $f "int main ()"
805 puts $f " _Complex float cf;"
807 puts $f " cf = 3 + 4.0fi;"
808 puts $f " f = cabsf (cf);"
809 puts $f " if (fabsf (f - 5.0) > 0.0001) abort ();"
814 set lines [${tool}_target_compile $src $exe executable "-lm"]
817 if [string match "" $lines] {
818 # No error message, compilation succeeded.
819 set result [${tool}_load "./$exe" "" ""]
820 set status [lindex $result 0]
821 remote_file build delete $exe
823 verbose "check_effective_target_broken_cplxf_arg: status is <$status>" 2
825 if { $status != "pass" } {
826 set et_broken_cplxf_arg_saved 1
829 verbose "check_effective_target_broken_cplxf_arg: compilation failed" 2
832 return $et_broken_cplxf_arg_saved
835 proc check_alpha_max_hw_available { } {
836 global alpha_max_hw_available_saved
839 if [info exists alpha_max_hw_available_saved] {
840 verbose "check_alpha_max_hw_available returning saved $alpha_max_hw_available_saved" 2
842 set alpha_max_hw_available_saved 0
844 # Set up, compile, and execute a test program probing bit 8 of the
845 # architecture mask, which indicates presence of MAX instructions.
849 set f [open $src "w"]
850 puts $f "int main() { return __builtin_alpha_amask(1<<8) != 0; }"
853 verbose "check_alpha_max_hw_available compiling testfile $src" 2
854 set lines [${tool}_target_compile $src $exe executable ""]
857 if [string match "" $lines] then {
858 # No error message, compilation succeeded.
859 set result [${tool}_load "./$exe" "" ""]
860 set status [lindex $result 0]
861 remote_file build delete $exe
862 verbose "check_alpha_max_hw_available testfile status is <$status>" 2
864 if { $status == "pass" } then {
865 set alpha_max_hw_available_saved 1
868 verbose "check_alpha_max_hw_availalble testfile compilation failed" 2
872 return $alpha_max_hw_available_saved
875 # Returns true iff the FUNCTION is available on the target system.
876 # (This is essentially a Tcl implementation of Autoconf's
879 proc check_function_available { function } {
880 set var "${function}_available_saved"
884 if {![info exists $var]} {
887 # Check to make sure.
888 set src "function[pid].c"
889 set exe "function[pid].exe"
891 set f [open $src "w"]
892 puts $f "int main () { $function (); }"
895 set lines [${tool}_target_compile $src $exe executable ""]
899 if {![string match "" $lines]} then {
901 verbose -log "$function is not available"
903 verbose -log "$function is available"
910 # Returns true iff "fork" is available on the target system.
912 proc check_fork_available {} {
913 return [check_function_available "fork"]
916 # Returns true iff "mkfifo" is available on the target system.
918 proc check_mkfifo_available {} {
919 if {[istarget *-*-cygwin*]} {
920 # Cygwin has mkfifo, but support is incomplete.
924 return [check_function_available "mkfifo"]
927 # Returns true iff "__cxa_atexit" is used on the target system.
929 proc check_cxa_atexit_available { } {
931 global et_cxa_atexit_target_name
934 if { ![info exists et_cxa_atexit_target_name] } {
935 set et_cxa_atexit_target_name ""
938 # If the target has changed since we set the cached value, clear it.
939 set current_target [current_target_name]
940 if { $current_target != $et_cxa_atexit_target_name } {
941 verbose "check_cxa_atexit_available: `$et_cxa_atexit_target_name'" 2
942 set et_cxa_atexit_target_name $current_target
943 if [info exists et_cxa_atexit] {
944 verbose "check_cxa_atexit_available: removing cached result" 2
949 if [info exists et_cxa_atexit] {
950 verbose "check_cxa_atexit_available: using cached result" 2
954 # Set up, compile, and execute a C++ test program that depends
955 # on correct ordering of static object destructors. This is
956 # indicative of the presence and use of __cxa_atexit.
957 set src cxaatexit[pid].cc
958 set exe cxaatexit[pid].x
960 set f [open $src "w"]
961 puts $f "#include <stdlib.h>"
962 puts $f "static unsigned int count;"
965 puts $f " X() { count = 1; }"
968 puts $f " if (count != 3)"
970 puts $f " count = 4;"
975 puts $f " static X x;"
979 puts $f " Y() { f(); count = 2; }"
982 puts $f " if (count != 2)"
984 puts $f " count = 3;"
989 puts $f "{ return 0; }"
992 set lines [${tool}_target_compile $src $exe executable ""]
995 if [string match "" $lines] {
996 # No error message, compilation succeeded.
997 set result [${tool}_load "./$exe" "" ""]
998 set status [lindex $result 0]
999 remote_file build delete $exe
1001 verbose "check_cxa_atexit_available: status is <$status>" 2
1003 if { $status == "pass" } {
1007 verbose "check_cxa_atexit_available: compilation failed" 2
1010 return $et_cxa_atexit
1014 # Return 1 if we're generating 32-bit code using default options, 0
1017 proc check_effective_target_ilp32 { } {
1018 return [check_no_compiler_messages ilp32 object {
1019 int dummy[sizeof (int) == 4
1020 && sizeof (void *) == 4
1021 && sizeof (long) == 4 ? 1 : -1];
1025 # Return 1 if we're generating 32-bit or larger integers using default
1026 # options, 0 otherwise.
1028 proc check_effective_target_int32plus { } {
1029 return [check_no_compiler_messages int32plus object {
1030 int dummy[sizeof (int) >= 4 ? 1 : -1];
1034 # Return 1 if we're generating 32-bit or larger pointers using default
1035 # options, 0 otherwise.
1037 proc check_effective_target_ptr32plus { } {
1038 return [check_no_compiler_messages ptr32plus object {
1039 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1043 # Return 1 if we support 32-bit or larger array and structure sizes
1044 # using default options, 0 otherwise.
1046 proc check_effective_target_size32plus { } {
1047 return [check_no_compiler_messages size32plus object {
1052 # Returns 1 if we're generating 16-bit or smaller integers with the
1053 # default options, 0 otherwise.
1055 proc check_effective_target_int16 { } {
1056 return [check_no_compiler_messages int16 object {
1057 int dummy[sizeof (int) < 4 ? 1 : -1];
1061 # Return 1 if we're generating 64-bit code using default options, 0
1064 proc check_effective_target_lp64 { } {
1065 return [check_no_compiler_messages lp64 object {
1066 int dummy[sizeof (int) == 4
1067 && sizeof (void *) == 8
1068 && sizeof (long) == 8 ? 1 : -1];
1072 # Return 1 if the target supports compiling decimal floating point,
1075 proc check_effective_target_dfp_nocache { } {
1076 verbose "check_effective_target_dfp_nocache: compiling source" 2
1077 set ret [string match "" [get_compiler_messages dfp object {
1078 _Decimal32 x; _Decimal64 y; _Decimal128 z;
1080 verbose "check_effective_target_dfp_nocache: returning $ret" 2
1084 proc check_effective_target_dfprt_nocache { } {
1089 verbose "check_effective_target_dfprt_nocache: compiling source" 2
1090 # Set up, compile, and execute a test program containing decimal
1092 set src dfprt[pid].c
1093 set exe dfprt[pid].x
1095 set f [open $src "w"]
1096 puts $f "_Decimal32 x = 1.2df; _Decimal64 y = 2.3dd; _Decimal128 z;"
1097 puts $f "int main () { z = x + y; return 0; }"
1100 verbose "check_effective_target_dfprt_nocache: compiling testfile $src" 2
1101 set lines [${tool}_target_compile $src $exe executable ""]
1104 if [string match "" $lines] then {
1105 # No error message, compilation succeeded.
1106 set result [${tool}_load "./$exe" "" ""]
1107 set status [lindex $result 0]
1108 remote_file build delete $exe
1109 verbose "check_effective_target_dfprt_nocache: testfile status is <$status>" 2
1110 if { $status == "pass" } then {
1115 verbose "check_effective_target_dfprt_nocache: returning $ret" 2
1118 # Return 1 if the target supports compiling Decimal Floating Point,
1121 # This won't change for different subtargets so cache the result.
1123 proc check_effective_target_dfp { } {
1126 if [info exists et_dfp_saved] {
1127 verbose "check_effective_target_dfp: using cached result" 2
1129 set et_dfp_saved [check_effective_target_dfp_nocache]
1131 verbose "check_effective_target_dfp: returning $et_dfp_saved" 2
1132 return $et_dfp_saved
1135 # Return 1 if the target supports linking and executing Decimal Floating
1136 # Point, # 0 otherwise.
1138 # This won't change for different subtargets so cache the result.
1140 proc check_effective_target_dfprt { } {
1141 global et_dfprt_saved
1144 if [info exists et_dfprt_saved] {
1145 verbose "check_effective_target_dfprt: using cached result" 2
1147 set et_dfprt_saved [check_effective_target_dfprt_nocache]
1149 verbose "check_effective_target_dfprt: returning $et_dfprt_saved" 2
1150 return $et_dfprt_saved
1153 # Return 1 if the target needs a command line argument to enable a SIMD
1156 # This won't change for different subtargets so cache the result.
1158 proc check_effective_target_vect_cmdline_needed { } {
1159 global et_vect_cmdline_needed_saved
1161 if [info exists et_vect_cmdline_needed_saved] {
1162 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
1164 set et_vect_cmdline_needed_saved 1
1165 if { [istarget ia64-*-*]
1166 || [istarget x86_64-*-*] } {
1167 set et_vect_cmdline_needed_saved 0
1171 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1172 return $et_vect_cmdline_needed_saved
1175 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
1177 # This won't change for different subtargets so cache the result.
1179 proc check_effective_target_vect_int { } {
1180 global et_vect_int_saved
1182 if [info exists et_vect_int_saved] {
1183 verbose "check_effective_target_vect_int: using cached result" 2
1185 set et_vect_int_saved 0
1186 if { [istarget i?86-*-*]
1187 || [istarget powerpc*-*-*]
1188 || [istarget x86_64-*-*]
1189 || [istarget sparc*-*-*]
1190 || [istarget alpha*-*-*]
1191 || [istarget ia64-*-*] } {
1192 set et_vect_int_saved 1
1196 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
1197 return $et_vect_int_saved
1200 # Return 1 is this is an arm target using 32-bit instructions
1201 proc check_effective_target_arm32 { } {
1202 global et_arm32_saved
1203 global et_arm32_target_name
1204 global compiler_flags
1206 if { ![info exists et_arm32_target_name] } {
1207 set et_arm32_target_name ""
1210 # If the target has changed since we set the cached value, clear it.
1211 set current_target [current_target_name]
1212 if { $current_target != $et_arm32_target_name } {
1213 verbose "check_effective_target_arm32: `$et_arm32_target_name' `$current_target'" 2
1214 set et_arm32_target_name $current_target
1215 if { [info exists et_arm32_saved] } {
1216 verbose "check_effective_target_arm32: removing cached result" 2
1217 unset et_arm32_saved
1221 if [info exists et_arm32_saved] {
1222 verbose "check-effective_target_arm32: using cached result" 2
1224 set et_arm32_saved 0
1225 if { [istarget arm-*-*]
1226 || [istarget strongarm*-*-*]
1227 || [istarget xscale-*-*] } {
1228 if ![string match "*-mthumb *" $compiler_flags] {
1229 set et_arm32_saved 1
1233 verbose "check_effective_target_arm32: returning $et_arm32_saved" 2
1234 return $et_arm32_saved
1237 # Return 1 if this is a PowerPC target with floating-point registers.
1239 proc check_effective_target_powerpc_fprs { } {
1240 if { [istarget powerpc*-*-*]
1241 || [istarget rs6000-*-*] } {
1242 return [check_no_compiler_messages powerpc_fprs object {
1254 # Return 1 if this is a PowerPC target supporting -maltivec.
1256 proc check_effective_target_powerpc_altivec_ok { } {
1257 if { [istarget powerpc*-*-*]
1258 || [istarget rs6000-*-*] } {
1259 # AltiVec is not supported on Aix.
1260 if { [istarget powerpc*-*-aix*] } {
1263 return [check_no_compiler_messages powerpc_altivec_ok object {
1271 # Return 1 if the target supports hardware vector shift operation.
1273 proc check_effective_target_vect_shift { } {
1274 global et_vect_shift_saved
1276 if [info exists et_vect_shift_saved] {
1277 verbose "check_effective_target_vect_shift: using cached result" 2
1279 set et_vect_shift_saved 0
1280 if { [istarget powerpc*-*-*]
1281 || [istarget ia64-*-*]
1282 || [istarget i?86-*-*]
1283 || [istarget x86_64-*-*] } {
1284 set et_vect_shift_saved 1
1288 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
1289 return $et_vect_shift_saved
1292 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
1294 # This can change for different subtargets so do not cache the result.
1296 proc check_effective_target_vect_long { } {
1297 if { [istarget i?86-*-*]
1298 || ([istarget powerpc*-*-*] && [check_effective_target_ilp32])
1299 || [istarget x86_64-*-*]
1300 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
1306 verbose "check_effective_target_vect_long: returning $answer" 2
1310 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
1312 # This won't change for different subtargets so cache the result.
1314 proc check_effective_target_vect_float { } {
1315 global et_vect_float_saved
1317 if [info exists et_vect_float_saved] {
1318 verbose "check_effective_target_vect_float: using cached result" 2
1320 set et_vect_float_saved 0
1321 if { [istarget i?86-*-*]
1322 || [istarget powerpc*-*-*]
1323 || [istarget mipsisa64*-*-*]
1324 || [istarget x86_64-*-*]
1325 || [istarget ia64-*-*] } {
1326 set et_vect_float_saved 1
1330 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
1331 return $et_vect_float_saved
1334 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
1336 # This won't change for different subtargets so cache the result.
1338 proc check_effective_target_vect_double { } {
1339 global et_vect_double_saved
1341 if [info exists et_vect_double_saved] {
1342 verbose "check_effective_target_vect_double: using cached result" 2
1344 set et_vect_double_saved 0
1345 if { [istarget i?86-*-*]
1346 || [istarget x86_64-*-*] } {
1347 set et_vect_double_saved 1
1351 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
1352 return $et_vect_double_saved
1355 # Return 1 if the target plus current options does not support a vector
1356 # max instruction on "int", 0 otherwise.
1358 # This won't change for different subtargets so cache the result.
1360 proc check_effective_target_vect_no_int_max { } {
1361 global et_vect_no_int_max_saved
1363 if [info exists et_vect_no_int_max_saved] {
1364 verbose "check_effective_target_vect_no_int_max: using cached result" 2
1366 set et_vect_no_int_max_saved 0
1367 if { [istarget sparc*-*-*]
1368 || [istarget alpha*-*-*] } {
1369 set et_vect_no_int_max_saved 1
1372 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
1373 return $et_vect_no_int_max_saved
1376 # Return 1 if the target plus current options does not support a vector
1377 # add instruction on "int", 0 otherwise.
1379 # This won't change for different subtargets so cache the result.
1381 proc check_effective_target_vect_no_int_add { } {
1382 global et_vect_no_int_add_saved
1384 if [info exists et_vect_no_int_add_saved] {
1385 verbose "check_effective_target_vect_no_int_add: using cached result" 2
1387 set et_vect_no_int_add_saved 0
1388 # Alpha only supports vector add on V8QI and V4HI.
1389 if { [istarget alpha*-*-*] } {
1390 set et_vect_no_int_add_saved 1
1393 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
1394 return $et_vect_no_int_add_saved
1397 # Return 1 if the target plus current options does not support vector
1398 # bitwise instructions, 0 otherwise.
1400 # This won't change for different subtargets so cache the result.
1402 proc check_effective_target_vect_no_bitwise { } {
1403 global et_vect_no_bitwise_saved
1405 if [info exists et_vect_no_bitwise_saved] {
1406 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
1408 set et_vect_no_bitwise_saved 0
1410 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
1411 return $et_vect_no_bitwise_saved
1414 # Return 1 if the target plus current options supports a vector
1415 # widening summation of *short* args into *int* result, 0 otherwise.
1417 # This won't change for different subtargets so cache the result.
1419 proc check_effective_target_vect_widen_sum_hi_to_si { } {
1420 global et_vect_widen_sum_hi_to_si
1422 if [info exists et_vect_widen_sum_hi_to_si_saved] {
1423 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
1425 set et_vect_widen_sum_hi_to_si_saved 0
1426 if { [istarget powerpc*-*-*]
1427 || [istarget ia64-*-*] } {
1428 set et_vect_widen_sum_hi_to_si_saved 1
1431 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
1432 return $et_vect_widen_sum_hi_to_si_saved
1435 # Return 1 if the target plus current options supports a vector
1436 # widening summation of *char* args into *short* result, 0 otherwise.
1438 # This won't change for different subtargets so cache the result.
1440 proc check_effective_target_vect_widen_sum_qi_to_hi { } {
1441 global et_vect_widen_sum_qi_to_hi
1443 if [info exists et_vect_widen_sum_qi_to_hi_saved] {
1444 verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
1446 set et_vect_widen_sum_qi_to_hi_saved 0
1447 if { [istarget ia64-*-*] } {
1448 set et_vect_widen_sum_qi_to_hi_saved 1
1451 verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
1452 return $et_vect_widen_sum_qi_to_hi_saved
1455 # Return 1 if the target plus current options supports a vector
1456 # widening summation of *char* args into *int* result, 0 otherwise.
1458 # This won't change for different subtargets so cache the result.
1460 proc check_effective_target_vect_widen_sum_qi_to_si { } {
1461 global et_vect_widen_sum_qi_to_si
1463 if [info exists et_vect_widen_sum_qi_to_si_saved] {
1464 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
1466 set et_vect_widen_sum_qi_to_si_saved 0
1467 if { [istarget powerpc*-*-*] } {
1468 set et_vect_widen_sum_qi_to_si_saved 1
1471 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
1472 return $et_vect_widen_sum_qi_to_si_saved
1475 # Return 1 if the target plus current options supports a vector
1476 # widening summation, 0 otherwise.
1478 # This won't change for different subtargets so cache the result.
1480 proc check_effective_target_vect_widen_sum { } {
1481 global et_vect_widen_sum
1483 if [info exists et_vect_widen_sum_saved] {
1484 verbose "check_effective_target_vect_widen_sum: using cached result" 2
1486 set et_vect_widen_sum_saved 0
1487 if { [istarget powerpc*-*-*]
1488 || [istarget ia64-*-*] } {
1489 set et_vect_widen_sum_saved 1
1492 verbose "check_effective_target_vect_widen_sum: returning $et_vect_widen_sum_saved" 2
1493 return $et_vect_widen_sum_saved
1496 # Return 1 if the target plus current options supports a vector
1497 # dot-product of signed chars, 0 otherwise.
1499 # This won't change for different subtargets so cache the result.
1501 proc check_effective_target_vect_sdot_qi { } {
1502 global et_vect_sdot_qi
1504 if [info exists et_vect_sdot_qi_saved] {
1505 verbose "check_effective_target_vect_sdot_qi: using cached result" 2
1507 set et_vect_sdot_qi_saved 0
1508 if { [istarget ia64-*-*] } {
1509 set et_vect_sdot_qi_saved 1
1512 verbose "check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
1513 return $et_vect_sdot_qi_saved
1516 # Return 1 if the target plus current options supports a vector
1517 # dot-product of unsigned chars, 0 otherwise.
1519 # This won't change for different subtargets so cache the result.
1521 proc check_effective_target_vect_udot_qi { } {
1522 global et_vect_udot_qi
1524 if [info exists et_vect_udot_qi_saved] {
1525 verbose "check_effective_target_vect_udot_qi: using cached result" 2
1527 set et_vect_udot_qi_saved 0
1528 if { [istarget powerpc*-*-*]
1529 || [istarget ia64-*-*] } {
1530 set et_vect_udot_qi_saved 1
1533 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
1534 return $et_vect_udot_qi_saved
1537 # Return 1 if the target plus current options supports a vector
1538 # dot-product of signed shorts, 0 otherwise.
1540 # This won't change for different subtargets so cache the result.
1542 proc check_effective_target_vect_sdot_hi { } {
1543 global et_vect_sdot_hi
1545 if [info exists et_vect_sdot_hi_saved] {
1546 verbose "check_effective_target_vect_sdot_hi: using cached result" 2
1548 set et_vect_sdot_hi_saved 0
1549 if { [istarget powerpc*-*-*]
1550 || [istarget i?86-*-*]
1551 || [istarget x86_64-*-*]
1552 || [istarget ia64-*-*] } {
1553 set et_vect_sdot_hi_saved 1
1556 verbose "check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
1557 return $et_vect_sdot_hi_saved
1560 # Return 1 if the target plus current options supports a vector
1561 # dot-product of unsigned shorts, 0 otherwise.
1563 # This won't change for different subtargets so cache the result.
1565 proc check_effective_target_vect_udot_hi { } {
1566 global et_vect_udot_hi
1568 if [info exists et_vect_udot_hi_saved] {
1569 verbose "check_effective_target_vect_udot_hi: using cached result" 2
1571 set et_vect_udot_hi_saved 0
1572 if { [istarget powerpc*-*-*] } {
1573 set et_vect_udot_hi_saved 1
1576 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
1577 return $et_vect_udot_hi_saved
1581 # Return 1 if the target plus current options does not support a vector
1582 # alignment mechanism, 0 otherwise.
1584 # This won't change for different subtargets so cache the result.
1586 proc check_effective_target_vect_no_align { } {
1587 global et_vect_no_align_saved
1589 if [info exists et_vect_no_align_saved] {
1590 verbose "check_effective_target_vect_no_align: using cached result" 2
1592 set et_vect_no_align_saved 0
1593 if { [istarget mipsisa64*-*-*]
1594 || [istarget sparc*-*-*]
1595 || [istarget ia64-*-*] } {
1596 set et_vect_no_align_saved 1
1599 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
1600 return $et_vect_no_align_saved
1603 # Return 1 if the target supports vector conditional operations, 0 otherwise.
1605 proc check_effective_target_vect_condition { } {
1606 global et_vect_cond_saved
1608 if [info exists et_vect_cond_saved] {
1609 verbose "check_effective_target_vect_cond: using cached result" 2
1611 set et_vect_cond_saved 0
1612 if { [istarget powerpc*-*-*]
1613 || [istarget ia64-*-*]
1614 || [istarget i?86-*-*]
1615 || [istarget x86_64-*-*] } {
1616 set et_vect_cond_saved 1
1620 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
1621 return $et_vect_cond_saved
1624 # Return 1 if the target supports vector char multiplication, 0 otherwise.
1626 proc check_effective_target_vect_char_mult { } {
1627 global et_vect_char_mult_saved
1629 if [info exists et_vect_char_mult_saved] {
1630 verbose "check_effective_target_vect_char_mult: using cached result" 2
1632 set et_vect_char_mult_saved 0
1633 if { [istarget ia64-*-*]
1634 || [istarget i?86-*-*]
1635 || [istarget x86_64-*-*] } {
1636 set et_vect_char_mult_saved 1
1640 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
1641 return $et_vect_char_mult_saved
1644 # Return 1 if the target supports vector short multiplication, 0 otherwise.
1646 proc check_effective_target_vect_short_mult { } {
1647 global et_vect_short_mult_saved
1649 if [info exists et_vect_short_mult_saved] {
1650 verbose "check_effective_target_vect_short_mult: using cached result" 2
1652 set et_vect_short_mult_saved 0
1653 if { [istarget ia64-*-*]
1654 || [istarget i?86-*-*]
1655 || [istarget x86_64-*-*] } {
1656 set et_vect_short_mult_saved 1
1660 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
1661 return $et_vect_short_mult_saved
1664 # Return 1 if the target supports vector int multiplication, 0 otherwise.
1666 proc check_effective_target_vect_int_mult { } {
1667 global et_vect_int_mult_saved
1669 if [info exists et_vect_int_mult_saved] {
1670 verbose "check_effective_target_vect_int_mult: using cached result" 2
1672 set et_vect_int_mult_saved 0
1673 if { [istarget powerpc*-*-*]
1674 || [istarget i?86-*-*]
1675 || [istarget x86_64-*-*] } {
1676 set et_vect_int_mult_saved 1
1680 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
1681 return $et_vect_int_mult_saved
1684 # Return 1 if the target supports atomic operations on "int" and "long".
1686 proc check_effective_target_sync_int_long { } {
1687 global et_sync_int_long_saved
1689 if [info exists et_sync_int_long_saved] {
1690 verbose "check_effective_target_sync_int_long: using cached result" 2
1692 set et_sync_int_long_saved 0
1693 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
1694 # load-reserved/store-conditional instructions.
1695 if { [istarget ia64-*-*]
1696 || [istarget i?86-*-*]
1697 || [istarget x86_64-*-*]
1698 || [istarget alpha*-*-*]
1699 || [istarget s390*-*-*]
1700 || [istarget powerpc*-*-*]
1701 || [istarget sparc64-*-*]
1702 || [istarget sparcv9-*-*] } {
1703 set et_sync_int_long_saved 1
1707 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
1708 return $et_sync_int_long_saved
1711 # Return 1 if the target supports atomic operations on "char" and "short".
1713 proc check_effective_target_sync_char_short { } {
1714 global et_sync_char_short_saved
1716 if [info exists et_sync_char_short_saved] {
1717 verbose "check_effective_target_sync_char_short: using cached result" 2
1719 set et_sync_char_short_saved 0
1720 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
1721 # load-reserved/store-conditional instructions.
1722 if { [istarget ia64-*-*]
1723 || [istarget i?86-*-*]
1724 || [istarget x86_64-*-*]
1725 || [istarget alpha*-*-*]
1726 || [istarget s390*-*-*]
1727 || [istarget powerpc*-*-*]
1728 || [istarget sparc64-*-*]
1729 || [istarget sparcv9-*-*] } {
1730 set et_sync_char_short_saved 1
1734 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
1735 return $et_sync_char_short_saved
1738 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
1739 # This can be used with any check_* proc that takes no argument and
1740 # returns only 1 or 0. It could be used with check_* procs that take
1741 # arguments with keywords that pass particular arguments.
1743 proc is-effective-target { arg } {
1745 if { [info procs check_effective_target_${arg}] != [list] } {
1746 set selected [check_effective_target_${arg}]
1749 "vmx_hw" { set selected [check_vmx_hw_available] }
1750 "named_sections" { set selected [check_named_sections_available] }
1751 "gc_sections" { set selected [check_gc_sections_available] }
1752 default { error "unknown effective target keyword `$arg'" }
1755 verbose "is-effective-target: $arg $selected" 2
1759 # Return 1 if the argument is an effective-target keyword, 0 otherwise.
1761 proc is-effective-target-keyword { arg } {
1762 if { [info procs check_effective_target_${arg}] != [list] } {
1765 # These have different names for their check_* procs.
1767 "vmx_hw" { return 1 }
1768 "named_sections" { return 1 }
1769 "gc_sections" { return 1 }
1770 default { return 0 }
1775 # Return 1 if target default to short enums
1777 proc check_effective_target_short_enums { } {
1778 return [check_no_compiler_messages short_enums assembly {
1780 int s[sizeof (enum foo) == 1 ? 1 : -1];