1 # Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2 # 2011 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 the code given by CONTENTS into an output file of
24 # type TYPE, where TYPE is as for target_compile. Return a list
25 # whose first element contains the compiler messages and whose
26 # second element is the name of the output file.
28 # BASENAME is a prefix to use for source and output files.
29 # If ARGS is not empty, its first element is a string that
30 # should be added to the command line.
32 # Assume by default that CONTENTS is C code.
33 # Otherwise, code should contain:
35 # "! Fortran" for Fortran code,
37 # "// ObjC++" for ObjC++
39 # If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
40 # allow for ObjC/ObjC++ specific flags.
41 proc check_compile {basename type contents args} {
43 verbose "check_compile tool: $tool for $basename"
45 if { [llength $args] > 0 } {
46 set options [list "additional_flags=[lindex $args 0]"]
50 switch -glob -- $contents {
51 "*! Fortran*" { set src ${basename}[pid].f90 }
52 "*// C++*" { set src ${basename}[pid].cc }
53 "*// ObjC++*" { set src ${basename}[pid].mm }
54 "*/* ObjC*" { set src ${basename}[pid].m }
55 "*// Go*" { set src ${basename}[pid].go }
58 "objc" { set src ${basename}[pid].m }
59 "obj-c++" { set src ${basename}[pid].mm }
60 default { set src ${basename}[pid].c }
65 set compile_type $type
67 assembly { set output ${basename}[pid].s }
68 object { set output ${basename}[pid].o }
69 executable { set output ${basename}[pid].exe }
71 set output ${basename}[pid].s
72 lappend options "additional_flags=-fdump-$type"
73 set compile_type assembly
79 set lines [${tool}_target_compile $src $output $compile_type "$options"]
82 set scan_output $output
83 # Don't try folding this into the switch above; calling "glob" before the
84 # file is created won't work.
85 if [regexp "rtl-(.*)" $type dummy rtl_type] {
86 set scan_output "[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
90 return [list $lines $scan_output]
93 proc current_target_name { } {
95 if [info exists target_info(target,name)] {
96 set answer $target_info(target,name)
103 # Implement an effective-target check for property PROP by invoking
104 # the Tcl command ARGS and seeing if it returns true.
106 proc check_cached_effective_target { prop args } {
109 set target [current_target_name]
110 if {![info exists et_cache($prop,target)]
111 || $et_cache($prop,target) != $target} {
112 verbose "check_cached_effective_target $prop: checking $target" 2
113 set et_cache($prop,target) $target
114 set et_cache($prop,value) [uplevel eval $args]
116 set value $et_cache($prop,value)
117 verbose "check_cached_effective_target $prop: returning $value for $target" 2
121 # Like check_compile, but delete the output file and return true if the
122 # compiler printed no messages.
123 proc check_no_compiler_messages_nocache {args} {
124 set result [eval check_compile $args]
125 set lines [lindex $result 0]
126 set output [lindex $result 1]
127 remote_file build delete $output
128 return [string match "" $lines]
131 # Like check_no_compiler_messages_nocache, but cache the result.
132 # PROP is the property we're checking, and doubles as a prefix for
133 # temporary filenames.
134 proc check_no_compiler_messages {prop args} {
135 return [check_cached_effective_target $prop {
136 eval [list check_no_compiler_messages_nocache $prop] $args
140 # Like check_compile, but return true if the compiler printed no
141 # messages and if the contents of the output file satisfy PATTERN.
142 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
143 # don't match regular expression REGEXP, otherwise they satisfy it
144 # if they do match regular expression PATTERN. (PATTERN can start
145 # with something like "[!]" if the regular expression needs to match
146 # "!" as the first character.)
148 # Delete the output file before returning. The other arguments are
149 # as for check_compile.
150 proc check_no_messages_and_pattern_nocache {basename pattern args} {
153 set result [eval [list check_compile $basename] $args]
154 set lines [lindex $result 0]
155 set output [lindex $result 1]
158 if { [string match "" $lines] } {
159 set chan [open "$output"]
160 set invert [regexp {^!(.*)} $pattern dummy pattern]
161 set ok [expr { [regexp $pattern [read $chan]] != $invert }]
165 remote_file build delete $output
169 # Like check_no_messages_and_pattern_nocache, but cache the result.
170 # PROP is the property we're checking, and doubles as a prefix for
171 # temporary filenames.
172 proc check_no_messages_and_pattern {prop pattern args} {
173 return [check_cached_effective_target $prop {
174 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
178 # Try to compile and run an executable from code CONTENTS. Return true
179 # if the compiler reports no messages and if execution "passes" in the
180 # usual DejaGNU sense. The arguments are as for check_compile, with
181 # TYPE implicitly being "executable".
182 proc check_runtime_nocache {basename contents args} {
185 set result [eval [list check_compile $basename executable $contents] $args]
186 set lines [lindex $result 0]
187 set output [lindex $result 1]
190 if { [string match "" $lines] } {
191 # No error messages, everything is OK.
192 set result [remote_load target "./$output" "" ""]
193 set status [lindex $result 0]
194 verbose "check_runtime_nocache $basename: status is <$status>" 2
195 if { $status == "pass" } {
199 remote_file build delete $output
203 # Like check_runtime_nocache, but cache the result. PROP is the
204 # property we're checking, and doubles as a prefix for temporary
206 proc check_runtime {prop args} {
209 return [check_cached_effective_target $prop {
210 eval [list check_runtime_nocache $prop] $args
214 ###############################
215 # proc check_weak_available { }
216 ###############################
218 # weak symbols are only supported in some configs/object formats
219 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
221 proc check_weak_available { } {
222 global target_triplet
225 # All mips targets should support it
227 if { [ string first "mips" $target_cpu ] >= 0 } {
231 # All solaris2 targets should support it
233 if { [regexp ".*-solaris2.*" $target_triplet] } {
237 # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
239 if { [regexp "alpha.*osf.*" $target_triplet] } {
243 # Windows targets Cygwin and MingW32 support it
245 if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
249 # HP-UX 10.X doesn't support it
251 if { [istarget "hppa*-*-hpux10*"] } {
255 # ELF and ECOFF support it. a.out does with gas/gld but may also with
256 # other linkers, so we should try it
258 set objformat [gcc_target_object_format]
266 unknown { return -1 }
271 ###############################
272 # proc check_weak_override_available { }
273 ###############################
275 # Like check_weak_available, but return 0 if weak symbol definitions
276 # cannot be overridden.
278 proc check_weak_override_available { } {
279 if { [istarget "*-*-mingw*"] } {
282 return [check_weak_available]
285 ###############################
286 # proc check_visibility_available { what_kind }
287 ###############################
289 # The visibility attribute is only support in some object formats
290 # This proc returns 1 if it is supported, 0 if not.
291 # The argument is the kind of visibility, default/protected/hidden/internal.
293 proc check_visibility_available { what_kind } {
295 global target_triplet
297 # On NetWare, support makes no sense.
298 if { [istarget *-*-netware*] } {
302 if [string match "" $what_kind] { set what_kind "hidden" }
304 return [check_no_compiler_messages visibility_available_$what_kind object "
305 void f() __attribute__((visibility(\"$what_kind\")));
310 ###############################
311 # proc check_alias_available { }
312 ###############################
314 # Determine if the target toolchain supports the alias attribute.
316 # Returns 2 if the target supports aliases. Returns 1 if the target
317 # only supports weak aliased. Returns 0 if the target does not
318 # support aliases at all. Returns -1 if support for aliases could not
321 proc check_alias_available { } {
322 global alias_available_saved
325 if [info exists alias_available_saved] {
326 verbose "check_alias_available returning saved $alias_available_saved" 2
330 verbose "check_alias_available compiling testfile $src" 2
331 set f [open $src "w"]
332 # Compile a small test program. The definition of "g" is
333 # necessary to keep the Solaris assembler from complaining
335 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
336 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
338 set lines [${tool}_target_compile $src $obj object ""]
340 remote_file build delete $obj
342 if [string match "" $lines] then {
343 # No error messages, everything is OK.
344 set alias_available_saved 2
346 if [regexp "alias definitions not supported" $lines] {
347 verbose "check_alias_available target does not support aliases" 2
349 set objformat [gcc_target_object_format]
351 if { $objformat == "elf" } {
352 verbose "check_alias_available but target uses ELF format, so it ought to" 2
353 set alias_available_saved -1
355 set alias_available_saved 0
358 if [regexp "only weak aliases are supported" $lines] {
359 verbose "check_alias_available target supports only weak aliases" 2
360 set alias_available_saved 1
362 set alias_available_saved -1
367 verbose "check_alias_available returning $alias_available_saved" 2
370 return $alias_available_saved
373 ###############################
374 # proc check_ifunc_available { }
375 ###############################
377 # Determine if the target toolchain supports the ifunc attribute.
379 # Returns 1 if the target supports ifunc. Returns 0 if the target
380 # does not support ifunc.
382 proc check_ifunc_available { } {
383 global ifunc_available_saved
386 if [info exists ifunc_available_saved] {
387 verbose "check_ifunc_available returning saved $ifunc_available_saved" 2
391 verbose "check_ifunc_available compiling testfile $src" 2
392 set f [open $src "w"]
394 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif"
395 puts $f "void g() {}"
396 puts $f "void f() __attribute__((ifunc(\"g\")));"
398 set lines [${tool}_target_compile $src $obj object ""]
400 remote_file build delete $obj
402 if [string match "" $lines] then {
403 set ifunc_available_saved 1
405 set ifunc_available_saved 0
408 verbose "check_ifunc_available returning $ifunc_available_saved" 2
411 return $ifunc_available_saved
414 # Returns true if --gc-sections is supported on the target.
416 proc check_gc_sections_available { } {
417 global gc_sections_available_saved
420 if {![info exists gc_sections_available_saved]} {
421 # Some targets don't support gc-sections despite whatever's
422 # advertised by ld's options.
423 if { [istarget alpha*-*-*]
424 || [istarget ia64-*-*] } {
425 set gc_sections_available_saved 0
429 # elf2flt uses -q (--emit-relocs), which is incompatible with
431 if { [board_info target exists ldflags]
432 && [regexp " -elf2flt\[ =\]" " [board_info target ldflags] "] } {
433 set gc_sections_available_saved 0
437 # VxWorks kernel modules are relocatable objects linked with -r,
438 # while RTP executables are linked with -q (--emit-relocs).
439 # Both of these options are incompatible with --gc-sections.
440 if { [istarget *-*-vxworks*] } {
441 set gc_sections_available_saved 0
445 # Check if the ld used by gcc supports --gc-sections.
446 set gcc_spec [${tool}_target_compile "-dumpspecs" "" "none" ""]
447 regsub ".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
448 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=$linker" "" "none" ""] 0]
449 set ld_output [remote_exec host "$gcc_ld" "--help"]
450 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
451 set gc_sections_available_saved 1
453 set gc_sections_available_saved 0
456 return $gc_sections_available_saved
459 # Return 1 if according to target_info struct and explicit target list
460 # target is supposed to support trampolines.
462 proc check_effective_target_trampolines { } {
463 if [target_info exists no_trampolines] {
466 if { [istarget avr-*-*]
467 || [istarget hppa2.0w-hp-hpux11.23]
468 || [istarget hppa64-hp-hpux11.23] } {
474 # Return 1 if according to target_info struct and explicit target list
475 # target is supposed to keep null pointer checks. This could be due to
476 # use of option fno-delete-null-pointer-checks or hardwired in target.
478 proc check_effective_target_keeps_null_pointer_checks { } {
479 if [target_info exists keeps_null_pointer_checks] {
482 if { [istarget avr-*-*] } {
488 # Return true if profiling is supported on the target.
490 proc check_profiling_available { test_what } {
491 global profiling_available_saved
493 verbose "Profiling argument is <$test_what>" 1
495 # These conditions depend on the argument so examine them before
496 # looking at the cache variable.
498 # Support for -p on solaris2 relies on mcrt1.o which comes with the
499 # vendor compiler. We cannot reliably predict the directory where the
500 # vendor compiler (and thus mcrt1.o) is installed so we can't
501 # necessarily find mcrt1.o even if we have it.
502 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
506 # Support for -p on irix relies on libprof1.a which doesn't appear to
507 # exist on any irix6 system currently posting testsuite results.
508 # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
509 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
510 if { [istarget mips*-*-irix*]
511 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
515 # We don't yet support profiling for MIPS16.
516 if { [istarget mips*-*-*]
517 && ![check_effective_target_nomips16]
518 && ([lindex $test_what 1] == "-p"
519 || [lindex $test_what 1] == "-pg") } {
523 # MinGW does not support -p.
524 if { [istarget *-*-mingw*] && [lindex $test_what 1] == "-p" } {
528 # cygwin does not support -p.
529 if { [istarget *-*-cygwin*] && [lindex $test_what 1] == "-p" } {
533 # uClibc does not have gcrt1.o.
534 if { [check_effective_target_uclibc]
535 && ([lindex $test_what 1] == "-p"
536 || [lindex $test_what 1] == "-pg") } {
540 # Now examine the cache variable.
541 if {![info exists profiling_available_saved]} {
542 # Some targets don't have any implementation of __bb_init_func or are
543 # missing other needed machinery.
544 if { [istarget mmix-*-*]
545 || [istarget arm*-*-eabi*]
546 || [istarget picochip-*-*]
547 || [istarget *-*-netware*]
548 || [istarget arm*-*-elf]
549 || [istarget arm*-*-symbianelf*]
550 || [istarget avr-*-*]
551 || [istarget bfin-*-*]
552 || [istarget powerpc-*-eabi*]
553 || [istarget powerpc-*-elf]
554 || [istarget cris-*-*]
555 || [istarget crisv32-*-*]
556 || [istarget fido-*-elf]
557 || [istarget h8300-*-*]
558 || [istarget lm32-*-*]
559 || [istarget m32c-*-elf]
560 || [istarget m68k-*-elf]
561 || [istarget m68k-*-uclinux*]
562 || [istarget mep-*-elf]
563 || [istarget mips*-*-elf*]
564 || [istarget moxie-*-elf*]
566 || [istarget xstormy16-*]
567 || [istarget xtensa*-*-elf]
568 || [istarget *-*-rtems*]
569 || [istarget *-*-vxworks*] } {
570 set profiling_available_saved 0
572 set profiling_available_saved 1
576 return $profiling_available_saved
579 # Check to see if a target is "freestanding". This is as per the definition
580 # in Section 4 of C99 standard. Effectively, it is a target which supports no
581 # extra headers or libraries other than what is considered essential.
582 proc check_effective_target_freestanding { } {
583 if { [istarget picochip-*-*] } then {
590 # Return 1 if target has packed layout of structure members by
591 # default, 0 otherwise. Note that this is slightly different than
592 # whether the target has "natural alignment": both attributes may be
595 proc check_effective_target_default_packed { } {
596 return [check_no_compiler_messages default_packed assembly {
597 struct x { char a; long b; } c;
598 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
602 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
603 # documentation, where the test also comes from.
605 proc check_effective_target_pcc_bitfield_type_matters { } {
606 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
607 # bitfields, but let's stick to the example code from the docs.
608 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
609 struct foo1 { char x; char :0; char y; };
610 struct foo2 { char x; int :0; char y; };
611 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
615 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
617 proc add_options_for_tls { flags } {
618 # Tru64 UNIX uses emutls, which relies on a couple of pthread functions
619 # which only live in libpthread, so always pass -pthread for TLS.
620 if { [istarget *-*-osf*] } {
621 return "$flags -pthread"
623 # On Solaris 8 and 9, __tls_get_addr/___tls_get_addr only lives in
624 # libthread, so always pass -pthread for native TLS.
625 # Need to duplicate native TLS check from
626 # check_effective_target_tls_native to avoid recursion.
627 if { [istarget *-*-solaris2.\[89\]*] &&
628 [check_no_messages_and_pattern tls_native "!emutls" assembly {
630 int f (void) { return i; }
631 void g (int j) { i = j; }
633 return "$flags -pthread"
638 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
640 proc check_effective_target_tls {} {
641 return [check_no_compiler_messages tls assembly {
643 int f (void) { return i; }
644 void g (int j) { i = j; }
648 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
650 proc check_effective_target_tls_native {} {
651 # VxWorks uses emulated TLS machinery, but with non-standard helper
652 # functions, so we fail to automatically detect it.
653 global target_triplet
654 if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
658 return [check_no_messages_and_pattern tls_native "!emutls" assembly {
660 int f (void) { return i; }
661 void g (int j) { i = j; }
665 # Return 1 if *emulated* thread local storage (TLS) is supported, 0 otherwise.
667 proc check_effective_target_tls_emulated {} {
668 # VxWorks uses emulated TLS machinery, but with non-standard helper
669 # functions, so we fail to automatically detect it.
670 global target_triplet
671 if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
675 return [check_no_messages_and_pattern tls_emulated "emutls" assembly {
677 int f (void) { return i; }
678 void g (int j) { i = j; }
682 # Return 1 if TLS executables can run correctly, 0 otherwise.
684 proc check_effective_target_tls_runtime {} {
685 return [check_runtime tls_runtime {
686 __thread int thr = 0;
687 int main (void) { return thr; }
691 # Return 1 if -ffunction-sections is supported, 0 otherwise.
693 proc check_effective_target_function_sections {} {
694 # Darwin has its own scheme and silently accepts -ffunction-sections.
695 global target_triplet
696 if { [regexp ".*-.*-darwin.*" $target_triplet] } {
700 return [check_no_compiler_messages functionsections assembly {
702 } "-ffunction-sections"]
705 # Return 1 if compilation with -fgraphite is error-free for trivial
708 proc check_effective_target_fgraphite {} {
709 return [check_no_compiler_messages fgraphite object {
714 # Return 1 if compilation with -fopenmp is error-free for trivial
717 proc check_effective_target_fopenmp {} {
718 return [check_no_compiler_messages fopenmp object {
723 # Return 1 if compilation with -pthread is error-free for trivial
726 proc check_effective_target_pthread {} {
727 return [check_no_compiler_messages pthread object {
732 # Return 1 if compilation with -mpe-aligned-commons is error-free
733 # for trivial code, 0 otherwise.
735 proc check_effective_target_pe_aligned_commons {} {
736 if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
737 return [check_no_compiler_messages pe_aligned_commons object {
739 } "-mpe-aligned-commons"]
744 # Return 1 if the target supports -static
745 proc check_effective_target_static {} {
746 return [check_no_compiler_messages static executable {
747 int main (void) { return 0; }
751 # Return 1 if the target supports -fstack-protector
752 proc check_effective_target_fstack_protector {} {
753 return [check_runtime fstack_protector {
754 int main (void) { return 0; }
755 } "-fstack-protector"]
758 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
759 # for trivial code, 0 otherwise.
761 proc check_effective_target_freorder {} {
762 return [check_no_compiler_messages freorder object {
764 } "-freorder-blocks-and-partition"]
767 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
768 # emitted, 0 otherwise. Whether a shared library can actually be built is
769 # out of scope for this test.
771 proc check_effective_target_fpic { } {
772 # Note that M68K has a multilib that supports -fpic but not
773 # -fPIC, so we need to check both. We test with a program that
774 # requires GOT references.
775 foreach arg {fpic fPIC} {
776 if [check_no_compiler_messages $arg object {
777 extern int foo (void); extern int bar;
778 int baz (void) { return foo () + bar; }
786 # Return true if the target supports -mpaired-single (as used on MIPS).
788 proc check_effective_target_mpaired_single { } {
789 return [check_no_compiler_messages mpaired_single object {
794 # Return true if the target has access to FPU instructions.
796 proc check_effective_target_hard_float { } {
797 if { [istarget mips*-*-*] } {
798 return [check_no_compiler_messages hard_float assembly {
799 #if (defined __mips_soft_float || defined __mips16)
805 # This proc is actually checking the availabilty of FPU
806 # support for doubles, so on the RX we must fail if the
807 # 64-bit double multilib has been selected.
808 if { [istarget rx-*-*] } {
810 # return [check_no_compiler_messages hard_float assembly {
811 #if defined __RX_64_BIT_DOUBLES__
817 # The generic test equates hard_float with "no call for adding doubles".
818 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
819 double a (double b, double c) { return b + c; }
823 # Return true if the target is a 64-bit MIPS target.
825 proc check_effective_target_mips64 { } {
826 return [check_no_compiler_messages mips64 assembly {
833 # Return true if the target is a MIPS target that does not produce
836 proc check_effective_target_nomips16 { } {
837 return [check_no_compiler_messages nomips16 object {
841 /* A cheap way of testing for -mflip-mips16. */
842 void foo (void) { asm ("addiu $20,$20,1"); }
843 void bar (void) { asm ("addiu $20,$20,1"); }
848 # Add the options needed for MIPS16 function attributes. At the moment,
849 # we don't support MIPS16 PIC.
851 proc add_options_for_mips16_attribute { flags } {
852 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
855 # Return true if we can force a mode that allows MIPS16 code generation.
856 # We don't support MIPS16 PIC, and only support MIPS16 -mhard-float
859 proc check_effective_target_mips16_attribute { } {
860 return [check_no_compiler_messages mips16_attribute assembly {
864 #if defined __mips_hard_float \
865 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
866 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
869 } [add_options_for_mips16_attribute ""]]
872 # Return 1 if the target supports long double larger than double when
873 # using the new ABI, 0 otherwise.
875 proc check_effective_target_mips_newabi_large_long_double { } {
876 return [check_no_compiler_messages mips_newabi_large_long_double object {
877 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
881 # Return 1 if the current multilib does not generate PIC by default.
883 proc check_effective_target_nonpic { } {
884 return [check_no_compiler_messages nonpic assembly {
891 # Return 1 if the target does not use a status wrapper.
893 proc check_effective_target_unwrapped { } {
894 if { [target_info needs_status_wrapper] != "" \
895 && [target_info needs_status_wrapper] != "0" } {
901 # Return true if iconv is supported on the target. In particular IBM1047.
903 proc check_iconv_available { test_what } {
906 # If the tool configuration file has not set libiconv, try "-liconv"
907 if { ![info exists libiconv] } {
908 set libiconv "-liconv"
910 set test_what [lindex $test_what 1]
911 return [check_runtime_nocache $test_what [subst {
917 cd = iconv_open ("$test_what", "UTF-8");
918 if (cd == (iconv_t) -1)
925 # Return 1 if an ASCII locale is supported on this host, 0 otherwise.
927 proc check_ascii_locale_available { } {
928 if { ([ishost alpha*-dec-osf*] || [ishost mips-sgi-irix*]) } {
929 # Neither Tru64 UNIX nor IRIX support an ASCII locale.
936 # Return true if named sections are supported on this target.
938 proc check_named_sections_available { } {
939 return [check_no_compiler_messages named_sections assembly {
940 int __attribute__ ((section("whatever"))) foo;
944 # Return 1 if the target supports Fortran real kinds larger than real(8),
947 # When the target name changes, replace the cached result.
949 proc check_effective_target_fortran_large_real { } {
950 return [check_no_compiler_messages fortran_large_real executable {
952 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
959 # Return 1 if the target supports Fortran real kind real(16),
960 # 0 otherwise. Contrary to check_effective_target_fortran_large_real
961 # this checks for Real(16) only; the other returned real(10) if
962 # both real(10) and real(16) are available.
964 # When the target name changes, replace the cached result.
966 proc check_effective_target_fortran_real_16 { } {
967 return [check_no_compiler_messages fortran_real_16 executable {
975 # Return 1 if the target supports Fortran integer kinds larger than
976 # integer(8), 0 otherwise.
978 # When the target name changes, replace the cached result.
980 proc check_effective_target_fortran_large_int { } {
981 return [check_no_compiler_messages fortran_large_int executable {
983 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
989 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
991 # When the target name changes, replace the cached result.
993 proc check_effective_target_fortran_integer_16 { } {
994 return [check_no_compiler_messages fortran_integer_16 executable {
1001 # Return 1 if we can statically link libgfortran, 0 otherwise.
1003 # When the target name changes, replace the cached result.
1005 proc check_effective_target_static_libgfortran { } {
1006 return [check_no_compiler_messages static_libgfortran executable {
1013 proc check_linker_plugin_available { } {
1014 return [check_no_compiler_messages_nocache linker_plugin executable {
1015 int main() { return 0; }
1016 } "-flto -fuse-linker-plugin"]
1019 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1020 # otherwise. Cache the result.
1022 proc check_750cl_hw_available { } {
1023 return [check_cached_effective_target 750cl_hw_available {
1024 # If this is not the right target then we can skip the test.
1025 if { ![istarget powerpc-*paired*] } {
1028 check_runtime_nocache 750cl_hw_available {
1032 asm volatile ("ps_mul v0,v0,v0");
1034 asm volatile ("ps_mul 0,0,0");
1043 # Return 1 if the target OS supports running SSE executables, 0
1044 # otherwise. Cache the result.
1046 proc check_sse_os_support_available { } {
1047 return [check_cached_effective_target sse_os_support_available {
1048 # If this is not the right target then we can skip the test.
1049 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1051 } elseif { [istarget i?86-*-solaris2*] } {
1052 # The Solaris 2 kernel doesn't save and restore SSE registers
1053 # before Solaris 9 4/04. Before that, executables die with SIGILL.
1054 check_runtime_nocache sse_os_support_available {
1057 __asm__ volatile ("movss %xmm2,%xmm1");
1067 # Return 1 if the target supports executing SSE instructions, 0
1068 # otherwise. Cache the result.
1070 proc check_sse_hw_available { } {
1071 return [check_cached_effective_target sse_hw_available {
1072 # If this is not the right target then we can skip the test.
1073 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1076 check_runtime_nocache sse_hw_available {
1080 unsigned int eax, ebx, ecx, edx;
1081 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1082 return !(edx & bit_SSE);
1090 # Return 1 if the target supports executing SSE2 instructions, 0
1091 # otherwise. Cache the result.
1093 proc check_sse2_hw_available { } {
1094 return [check_cached_effective_target sse2_hw_available {
1095 # If this is not the right target then we can skip the test.
1096 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1099 check_runtime_nocache sse2_hw_available {
1103 unsigned int eax, ebx, ecx, edx;
1104 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1105 return !(edx & bit_SSE2);
1113 # Return 1 if the target supports executing AVX instructions, 0
1114 # otherwise. Cache the result.
1116 proc check_avx_hw_available { } {
1117 return [check_cached_effective_target avx_hw_available {
1118 # If this is not the right target then we can skip the test.
1119 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1122 check_runtime_nocache avx_hw_available {
1126 unsigned int eax, ebx, ecx, edx;
1127 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1128 return ((ecx & (bit_AVX | bit_OSXSAVE))
1129 != (bit_AVX | bit_OSXSAVE));
1137 # Return 1 if the target supports running SSE executables, 0 otherwise.
1139 proc check_effective_target_sse_runtime { } {
1140 if { [check_effective_target_sse]
1141 && [check_sse_hw_available]
1142 && [check_sse_os_support_available] } {
1148 # Return 1 if the target supports running SSE2 executables, 0 otherwise.
1150 proc check_effective_target_sse2_runtime { } {
1151 if { [check_effective_target_sse2]
1152 && [check_sse2_hw_available]
1153 && [check_sse_os_support_available] } {
1159 # Return 1 if the target supports running AVX executables, 0 otherwise.
1161 proc check_effective_target_avx_runtime { } {
1162 if { [check_effective_target_avx]
1163 && [check_avx_hw_available] } {
1169 # Return 1 if the target supports executing VSX instructions, 0
1170 # otherwise. Cache the result.
1172 proc check_vsx_hw_available { } {
1173 return [check_cached_effective_target vsx_hw_available {
1174 # Some simulators are known to not support VSX instructions.
1175 # For now, disable on Darwin
1176 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1180 check_runtime_nocache vsx_hw_available {
1184 asm volatile ("xxlor vs0,vs0,vs0");
1186 asm volatile ("xxlor 0,0,0");
1195 # Return 1 if the target supports executing AltiVec instructions, 0
1196 # otherwise. Cache the result.
1198 proc check_vmx_hw_available { } {
1199 return [check_cached_effective_target vmx_hw_available {
1200 # Some simulators are known to not support VMX instructions.
1201 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
1204 # Most targets don't require special flags for this test case, but
1205 # Darwin does. Just to be sure, make sure VSX is not enabled for
1206 # the altivec tests.
1207 if { [istarget *-*-darwin*]
1208 || [istarget *-*-aix*] } {
1209 set options "-maltivec -mno-vsx"
1211 set options "-mno-vsx"
1213 check_runtime_nocache vmx_hw_available {
1217 asm volatile ("vor v0,v0,v0");
1219 asm volatile ("vor 0,0,0");
1228 proc check_ppc_recip_hw_available { } {
1229 return [check_cached_effective_target ppc_recip_hw_available {
1230 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1231 # For now, disable on Darwin
1232 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1235 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1236 check_runtime_nocache ppc_recip_hw_available {
1237 volatile double d_recip, d_rsqrt, d_four = 4.0;
1238 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1241 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1242 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1243 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1244 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1252 # Return 1 if the target supports executing AltiVec and Cell PPU
1253 # instructions, 0 otherwise. Cache the result.
1255 proc check_effective_target_cell_hw { } {
1256 return [check_cached_effective_target cell_hw_available {
1257 # Some simulators are known to not support VMX and PPU instructions.
1258 if { [istarget powerpc-*-eabi*] } {
1261 # Most targets don't require special flags for this test
1262 # case, but Darwin and AIX do.
1263 if { [istarget *-*-darwin*]
1264 || [istarget *-*-aix*] } {
1265 set options "-maltivec -mcpu=cell"
1267 set options "-mcpu=cell"
1269 check_runtime_nocache cell_hw_available {
1273 asm volatile ("vor v0,v0,v0");
1274 asm volatile ("lvlx v0,r0,r0");
1276 asm volatile ("vor 0,0,0");
1277 asm volatile ("lvlx 0,0,0");
1286 # Return 1 if the target supports executing 64-bit instructions, 0
1287 # otherwise. Cache the result.
1289 proc check_effective_target_powerpc64 { } {
1290 global powerpc64_available_saved
1293 if [info exists powerpc64_available_saved] {
1294 verbose "check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1296 set powerpc64_available_saved 0
1298 # Some simulators are known to not support powerpc64 instructions.
1299 if { [istarget powerpc-*-eabi*] || [istarget powerpc-ibm-aix*] } {
1300 verbose "check_effective_target_powerpc64 returning 0" 2
1301 return $powerpc64_available_saved
1304 # Set up, compile, and execute a test program containing a 64-bit
1305 # instruction. Include the current process ID in the file
1306 # names to prevent conflicts with invocations for multiple
1311 set f [open $src "w"]
1312 puts $f "int main() {"
1313 puts $f "#ifdef __MACH__"
1314 puts $f " asm volatile (\"extsw r0,r0\");"
1316 puts $f " asm volatile (\"extsw 0,0\");"
1318 puts $f " return 0; }"
1321 set opts "additional_flags=-mcpu=G5"
1323 verbose "check_effective_target_powerpc64 compiling testfile $src" 2
1324 set lines [${tool}_target_compile $src $exe executable "$opts"]
1327 if [string match "" $lines] then {
1328 # No error message, compilation succeeded.
1329 set result [${tool}_load "./$exe" "" ""]
1330 set status [lindex $result 0]
1331 remote_file build delete $exe
1332 verbose "check_effective_target_powerpc64 testfile status is <$status>" 2
1334 if { $status == "pass" } then {
1335 set powerpc64_available_saved 1
1338 verbose "check_effective_target_powerpc64 testfile compilation failed" 2
1342 return $powerpc64_available_saved
1345 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
1346 # complex float arguments. This affects gfortran tests that call cabsf
1347 # in libm built by an earlier compiler. Return 1 if libm uses the same
1348 # argument passing as the compiler under test, 0 otherwise.
1350 # When the target name changes, replace the cached result.
1352 proc check_effective_target_broken_cplxf_arg { } {
1353 return [check_cached_effective_target broken_cplxf_arg {
1354 # Skip the work for targets known not to be affected.
1355 if { ![istarget powerpc64-*-linux*] } {
1357 } elseif { ![is-effective-target lp64] } {
1360 check_runtime_nocache broken_cplxf_arg {
1361 #include <complex.h>
1362 extern void abort (void);
1363 float fabsf (float);
1364 float cabsf (_Complex float);
1371 if (fabsf (f - 5.0) > 0.0001)
1380 proc check_alpha_max_hw_available { } {
1381 return [check_runtime alpha_max_hw_available {
1382 int main() { return __builtin_alpha_amask(1<<8) != 0; }
1386 # Returns true iff the FUNCTION is available on the target system.
1387 # (This is essentially a Tcl implementation of Autoconf's
1390 proc check_function_available { function } {
1391 return [check_no_compiler_messages ${function}_available \
1397 int main () { $function (); }
1401 # Returns true iff "fork" is available on the target system.
1403 proc check_fork_available {} {
1404 return [check_function_available "fork"]
1407 # Returns true iff "mkfifo" is available on the target system.
1409 proc check_mkfifo_available {} {
1410 if {[istarget *-*-cygwin*]} {
1411 # Cygwin has mkfifo, but support is incomplete.
1415 return [check_function_available "mkfifo"]
1418 # Returns true iff "__cxa_atexit" is used on the target system.
1420 proc check_cxa_atexit_available { } {
1421 return [check_cached_effective_target cxa_atexit_available {
1422 if { [istarget "hppa*-*-hpux10*"] } {
1423 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1425 } elseif { [istarget "*-*-vxworks"] } {
1426 # vxworks doesn't have __cxa_atexit but subsequent test passes.
1429 check_runtime_nocache cxa_atexit_available {
1432 static unsigned int count;
1449 Y() { f(); count = 2; }
1458 int main() { return 0; }
1464 proc check_effective_target_objc2 { } {
1465 return [check_no_compiler_messages objc2 object {
1474 proc check_effective_target_next_runtime { } {
1475 return [check_no_compiler_messages objc2 object {
1476 #ifdef __NEXT_RUNTIME__
1484 # Return 1 if we're generating 32-bit code using default options, 0
1487 proc check_effective_target_ilp32 { } {
1488 return [check_no_compiler_messages ilp32 object {
1489 int dummy[sizeof (int) == 4
1490 && sizeof (void *) == 4
1491 && sizeof (long) == 4 ? 1 : -1];
1495 # Return 1 if we're generating 32-bit or larger integers using default
1496 # options, 0 otherwise.
1498 proc check_effective_target_int32plus { } {
1499 return [check_no_compiler_messages int32plus object {
1500 int dummy[sizeof (int) >= 4 ? 1 : -1];
1504 # Return 1 if we're generating 32-bit or larger pointers using default
1505 # options, 0 otherwise.
1507 proc check_effective_target_ptr32plus { } {
1508 return [check_no_compiler_messages ptr32plus object {
1509 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1513 # Return 1 if we support 32-bit or larger array and structure sizes
1514 # using default options, 0 otherwise.
1516 proc check_effective_target_size32plus { } {
1517 return [check_no_compiler_messages size32plus object {
1522 # Returns 1 if we're generating 16-bit or smaller integers with the
1523 # default options, 0 otherwise.
1525 proc check_effective_target_int16 { } {
1526 return [check_no_compiler_messages int16 object {
1527 int dummy[sizeof (int) < 4 ? 1 : -1];
1531 # Return 1 if we're generating 64-bit code using default options, 0
1534 proc check_effective_target_lp64 { } {
1535 return [check_no_compiler_messages lp64 object {
1536 int dummy[sizeof (int) == 4
1537 && sizeof (void *) == 8
1538 && sizeof (long) == 8 ? 1 : -1];
1542 # Return 1 if we're generating 64-bit code using default llp64 options,
1545 proc check_effective_target_llp64 { } {
1546 return [check_no_compiler_messages llp64 object {
1547 int dummy[sizeof (int) == 4
1548 && sizeof (void *) == 8
1549 && sizeof (long long) == 8
1550 && sizeof (long) == 4 ? 1 : -1];
1554 # Return 1 if the target supports long double larger than double,
1557 proc check_effective_target_large_long_double { } {
1558 return [check_no_compiler_messages large_long_double object {
1559 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
1563 # Return 1 if the target supports double larger than float,
1566 proc check_effective_target_large_double { } {
1567 return [check_no_compiler_messages large_double object {
1568 int dummy[sizeof(double) > sizeof(float) ? 1 : -1];
1572 # Return 1 if the target supports double of 64 bits,
1575 proc check_effective_target_double64 { } {
1576 return [check_no_compiler_messages double64 object {
1577 int dummy[sizeof(double) == 8 ? 1 : -1];
1581 # Return 1 if the target supports double of at least 64 bits,
1584 proc check_effective_target_double64plus { } {
1585 return [check_no_compiler_messages double64plus object {
1586 int dummy[sizeof(double) >= 8 ? 1 : -1];
1590 # Return 1 if the target supports compiling fixed-point,
1593 proc check_effective_target_fixed_point { } {
1594 return [check_no_compiler_messages fixed_point object {
1595 _Sat _Fract x; _Sat _Accum y;
1599 # Return 1 if the target supports compiling decimal floating point,
1602 proc check_effective_target_dfp_nocache { } {
1603 verbose "check_effective_target_dfp_nocache: compiling source" 2
1604 set ret [check_no_compiler_messages_nocache dfp object {
1605 float x __attribute__((mode(DD)));
1607 verbose "check_effective_target_dfp_nocache: returning $ret" 2
1611 proc check_effective_target_dfprt_nocache { } {
1612 return [check_runtime_nocache dfprt {
1613 typedef float d64 __attribute__((mode(DD)));
1614 d64 x = 1.2df, y = 2.3dd, z;
1615 int main () { z = x + y; return 0; }
1619 # Return 1 if the target supports compiling Decimal Floating Point,
1622 # This won't change for different subtargets so cache the result.
1624 proc check_effective_target_dfp { } {
1625 return [check_cached_effective_target dfp {
1626 check_effective_target_dfp_nocache
1630 # Return 1 if the target supports linking and executing Decimal Floating
1631 # Point, 0 otherwise.
1633 # This won't change for different subtargets so cache the result.
1635 proc check_effective_target_dfprt { } {
1636 return [check_cached_effective_target dfprt {
1637 check_effective_target_dfprt_nocache
1641 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
1643 proc check_effective_target_ucn_nocache { } {
1644 # -std=c99 is only valid for C
1645 if [check_effective_target_c] {
1646 set ucnopts "-std=c99"
1648 append ucnopts " -fextended-identifiers"
1649 verbose "check_effective_target_ucn_nocache: compiling source" 2
1650 set ret [check_no_compiler_messages_nocache ucn object {
1653 verbose "check_effective_target_ucn_nocache: returning $ret" 2
1657 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
1659 # This won't change for different subtargets, so cache the result.
1661 proc check_effective_target_ucn { } {
1662 return [check_cached_effective_target ucn {
1663 check_effective_target_ucn_nocache
1667 # Return 1 if the target needs a command line argument to enable a SIMD
1670 proc check_effective_target_vect_cmdline_needed { } {
1671 global et_vect_cmdline_needed_saved
1672 global et_vect_cmdline_needed_target_name
1674 if { ![info exists et_vect_cmdline_needed_target_name] } {
1675 set et_vect_cmdline_needed_target_name ""
1678 # If the target has changed since we set the cached value, clear it.
1679 set current_target [current_target_name]
1680 if { $current_target != $et_vect_cmdline_needed_target_name } {
1681 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2
1682 set et_vect_cmdline_needed_target_name $current_target
1683 if { [info exists et_vect_cmdline_needed_saved] } {
1684 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
1685 unset et_vect_cmdline_needed_saved
1689 if [info exists et_vect_cmdline_needed_saved] {
1690 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
1692 set et_vect_cmdline_needed_saved 1
1693 if { [istarget alpha*-*-*]
1694 || [istarget ia64-*-*]
1695 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
1696 && [check_effective_target_lp64])
1697 || ([istarget powerpc*-*-*]
1698 && ([check_effective_target_powerpc_spe]
1699 || [check_effective_target_powerpc_altivec]))
1700 || [istarget spu-*-*]
1701 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
1702 set et_vect_cmdline_needed_saved 0
1706 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1707 return $et_vect_cmdline_needed_saved
1710 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
1712 # This won't change for different subtargets so cache the result.
1714 proc check_effective_target_vect_int { } {
1715 global et_vect_int_saved
1717 if [info exists et_vect_int_saved] {
1718 verbose "check_effective_target_vect_int: using cached result" 2
1720 set et_vect_int_saved 0
1721 if { [istarget i?86-*-*]
1722 || ([istarget powerpc*-*-*]
1723 && ![istarget powerpc-*-linux*paired*])
1724 || [istarget spu-*-*]
1725 || [istarget x86_64-*-*]
1726 || [istarget sparc*-*-*]
1727 || [istarget alpha*-*-*]
1728 || [istarget ia64-*-*]
1729 || [check_effective_target_arm32]
1730 || ([istarget mips*-*-*]
1731 && [check_effective_target_mips_loongson]) } {
1732 set et_vect_int_saved 1
1736 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
1737 return $et_vect_int_saved
1740 # Return 1 if the target supports signed int->float conversion
1743 proc check_effective_target_vect_intfloat_cvt { } {
1744 global et_vect_intfloat_cvt_saved
1746 if [info exists et_vect_intfloat_cvt_saved] {
1747 verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
1749 set et_vect_intfloat_cvt_saved 0
1750 if { [istarget i?86-*-*]
1751 || ([istarget powerpc*-*-*]
1752 && ![istarget powerpc-*-linux*paired*])
1753 || [istarget x86_64-*-*] } {
1754 set et_vect_intfloat_cvt_saved 1
1758 verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
1759 return $et_vect_intfloat_cvt_saved
1762 #Return 1 if we're supporting __int128 for target, 0 otherwise.
1764 proc check_effective_target_int128 { } {
1765 return [check_no_compiler_messages int128 object {
1767 #ifndef __SIZEOF_INT128__
1776 # Return 1 if the target supports unsigned int->float conversion
1779 proc check_effective_target_vect_uintfloat_cvt { } {
1780 global et_vect_uintfloat_cvt_saved
1782 if [info exists et_vect_uintfloat_cvt_saved] {
1783 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
1785 set et_vect_uintfloat_cvt_saved 0
1786 if { [istarget i?86-*-*]
1787 || ([istarget powerpc*-*-*]
1788 && ![istarget powerpc-*-linux*paired*])
1789 || [istarget x86_64-*-*] } {
1790 set et_vect_uintfloat_cvt_saved 1
1794 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
1795 return $et_vect_uintfloat_cvt_saved
1799 # Return 1 if the target supports signed float->int conversion
1802 proc check_effective_target_vect_floatint_cvt { } {
1803 global et_vect_floatint_cvt_saved
1805 if [info exists et_vect_floatint_cvt_saved] {
1806 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
1808 set et_vect_floatint_cvt_saved 0
1809 if { [istarget i?86-*-*]
1810 || ([istarget powerpc*-*-*]
1811 && ![istarget powerpc-*-linux*paired*])
1812 || [istarget x86_64-*-*] } {
1813 set et_vect_floatint_cvt_saved 1
1817 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
1818 return $et_vect_floatint_cvt_saved
1821 # Return 1 if the target supports unsigned float->int conversion
1824 proc check_effective_target_vect_floatuint_cvt { } {
1825 global et_vect_floatuint_cvt_saved
1827 if [info exists et_vect_floatuint_cvt_saved] {
1828 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
1830 set et_vect_floatuint_cvt_saved 0
1831 if { ([istarget powerpc*-*-*]
1832 && ![istarget powerpc-*-linux*paired*]) } {
1833 set et_vect_floatuint_cvt_saved 1
1837 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
1838 return $et_vect_floatuint_cvt_saved
1841 # Return 1 is this is an arm target using 32-bit instructions
1842 proc check_effective_target_arm32 { } {
1843 return [check_no_compiler_messages arm32 assembly {
1844 #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
1850 # Return 1 if this is an ARM target that only supports aligned vector accesses
1851 proc check_effective_target_arm_vect_no_misalign { } {
1852 return [check_no_compiler_messages arm_vect_no_misalign assembly {
1853 #if !defined(__arm__) \
1854 || (defined(__ARMEL__) \
1855 && (!defined(__thumb__) || defined(__thumb2__)))
1862 # Return 1 if this is an ARM target supporting -mfpu=vfp
1863 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
1866 proc check_effective_target_arm_vfp_ok { } {
1867 if { [check_effective_target_arm32] } {
1868 return [check_no_compiler_messages arm_vfp_ok object {
1870 } "-mfpu=vfp -mfloat-abi=softfp"]
1876 # Return 1 if this is an ARM target supporting -mfpu=vfp
1877 # -mfloat-abi=hard. Some multilibs may be incompatible with these
1880 proc check_effective_target_arm_hard_vfp_ok { } {
1881 if { [check_effective_target_arm32] } {
1882 return [check_no_compiler_messages arm_hard_vfp_ok executable {
1883 int main() { return 0;}
1884 } "-mfpu=vfp -mfloat-abi=hard"]
1890 # Add the options needed for NEON. We need either -mfloat-abi=softfp
1891 # or -mfloat-abi=hard, but if one is already specified by the
1892 # multilib, use it. Similarly, if a -mfpu option already enables
1893 # NEON, do not add -mfpu=neon.
1895 proc add_options_for_arm_neon { flags } {
1896 if { ! [check_effective_target_arm_neon_ok] } {
1899 global et_arm_neon_flags
1900 return "$flags $et_arm_neon_flags"
1903 # Return 1 if this is an ARM target supporting -mfpu=neon
1904 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
1905 # incompatible with these options. Also set et_arm_neon_flags to the
1906 # best options to add.
1908 proc check_effective_target_arm_neon_ok_nocache { } {
1909 global et_arm_neon_flags
1910 set et_arm_neon_flags ""
1911 if { [check_effective_target_arm32] } {
1912 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
1913 if { [check_no_compiler_messages_nocache arm_neon_ok object {
1914 #include "arm_neon.h"
1917 set et_arm_neon_flags $flags
1926 proc check_effective_target_arm_neon_ok { } {
1927 return [check_cached_effective_target arm_neon_ok \
1928 check_effective_target_arm_neon_ok_nocache]
1931 # Add the options needed for NEON. We need either -mfloat-abi=softfp
1932 # or -mfloat-abi=hard, but if one is already specified by the
1935 proc add_options_for_arm_neon_fp16 { flags } {
1936 if { ! [check_effective_target_arm_neon_fp16_ok] } {
1939 global et_arm_neon_fp16_flags
1940 return "$flags $et_arm_neon_fp16_flags"
1943 # Return 1 if this is an ARM target supporting -mfpu=neon-fp16
1944 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
1945 # incompatible with these options. Also set et_arm_neon_flags to the
1946 # best options to add.
1948 proc check_effective_target_arm_neon_fp16_ok_nocache { } {
1949 global et_arm_neon_fp16_flags
1950 set et_arm_neon_fp16_flags ""
1951 if { [check_effective_target_arm32] } {
1952 # Always add -mfpu=neon-fp16, since there is no preprocessor
1953 # macro for FP16 support.
1954 foreach flags {"-mfpu=neon-fp16" "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
1955 if { [check_no_compiler_messages_nocache arm_neon_fp16_ok object {
1956 #include "arm_neon.h"
1959 set et_arm_neon_fp16_flags $flags
1968 proc check_effective_target_arm_neon_fp16_ok { } {
1969 return [check_cached_effective_target arm_neon_fp16_ok \
1970 check_effective_target_arm_neon_fp16_ok_nocache]
1973 # Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
1976 proc check_effective_target_arm_thumb1_ok { } {
1977 return [check_no_compiler_messages arm_thumb1_ok assembly {
1978 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
1984 # Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be
1987 proc check_effective_target_arm_thumb2_ok { } {
1988 return [check_no_compiler_messages arm_thumb2_ok assembly {
1989 #if !defined(__thumb2__)
1995 # Return 1 if the target supports executing NEON instructions, 0
1996 # otherwise. Cache the result.
1998 proc check_effective_target_arm_neon_hw { } {
1999 return [check_runtime arm_neon_hw_available {
2003 long long a = 0, b = 1;
2004 asm ("vorr %P0, %P1, %P2"
2006 : "0" (a), "w" (b));
2009 } [add_options_for_arm_neon ""]]
2012 # Return 1 if this is a ARM target with NEON enabled.
2014 proc check_effective_target_arm_neon { } {
2015 if { [check_effective_target_arm32] } {
2016 return [check_no_compiler_messages arm_neon object {
2017 #ifndef __ARM_NEON__
2028 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
2029 # the Loongson vector modes.
2031 proc check_effective_target_mips_loongson { } {
2032 return [check_no_compiler_messages loongson assembly {
2033 #if !defined(__mips_loongson_vector_rev)
2039 # Return 1 if this is an ARM target that adheres to the ABI for the ARM
2042 proc check_effective_target_arm_eabi { } {
2043 return [check_no_compiler_messages arm_eabi object {
2044 #ifndef __ARM_EABI__
2052 # Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
2053 # Some multilibs may be incompatible with this option.
2055 proc check_effective_target_arm_iwmmxt_ok { } {
2056 if { [check_effective_target_arm32] } {
2057 return [check_no_compiler_messages arm_iwmmxt_ok object {
2065 # Return 1 if this is a PowerPC target with floating-point registers.
2067 proc check_effective_target_powerpc_fprs { } {
2068 if { [istarget powerpc*-*-*]
2069 || [istarget rs6000-*-*] } {
2070 return [check_no_compiler_messages powerpc_fprs object {
2082 # Return 1 if this is a PowerPC target with hardware double-precision
2085 proc check_effective_target_powerpc_hard_double { } {
2086 if { [istarget powerpc*-*-*]
2087 || [istarget rs6000-*-*] } {
2088 return [check_no_compiler_messages powerpc_hard_double object {
2100 # Return 1 if this is a PowerPC target supporting -maltivec.
2102 proc check_effective_target_powerpc_altivec_ok { } {
2103 if { ([istarget powerpc*-*-*]
2104 && ![istarget powerpc-*-linux*paired*])
2105 || [istarget rs6000-*-*] } {
2106 # AltiVec is not supported on AIX before 5.3.
2107 if { [istarget powerpc*-*-aix4*]
2108 || [istarget powerpc*-*-aix5.1*]
2109 || [istarget powerpc*-*-aix5.2*] } {
2112 return [check_no_compiler_messages powerpc_altivec_ok object {
2120 # Return 1 if this is a PowerPC target supporting -mvsx
2122 proc check_effective_target_powerpc_vsx_ok { } {
2123 if { ([istarget powerpc*-*-*]
2124 && ![istarget powerpc-*-linux*paired*])
2125 || [istarget rs6000-*-*] } {
2126 # AltiVec is not supported on AIX before 5.3.
2127 if { [istarget powerpc*-*-aix4*]
2128 || [istarget powerpc*-*-aix5.1*]
2129 || [istarget powerpc*-*-aix5.2*] } {
2132 return [check_no_compiler_messages powerpc_vsx_ok object {
2135 asm volatile ("xxlor vs0,vs0,vs0");
2137 asm volatile ("xxlor 0,0,0");
2147 # Return 1 if this is a PowerPC target supporting -mcpu=cell.
2149 proc check_effective_target_powerpc_ppu_ok { } {
2150 if [check_effective_target_powerpc_altivec_ok] {
2151 return [check_no_compiler_messages cell_asm_available object {
2154 asm volatile ("lvlx v0,v0,v0");
2156 asm volatile ("lvlx 0,0,0");
2166 # Return 1 if this is a PowerPC target that supports SPU.
2168 proc check_effective_target_powerpc_spu { } {
2169 if [istarget powerpc*-*-linux*] {
2170 return [check_effective_target_powerpc_altivec_ok]
2176 # Return 1 if this is a PowerPC SPE target. The check includes options
2177 # specified by dg-options for this test, so don't cache the result.
2179 proc check_effective_target_powerpc_spe_nocache { } {
2180 if { [istarget powerpc*-*-*] } {
2181 return [check_no_compiler_messages_nocache powerpc_spe object {
2187 } [current_compiler_flags]]
2193 # Return 1 if this is a PowerPC target with SPE enabled.
2195 proc check_effective_target_powerpc_spe { } {
2196 if { [istarget powerpc*-*-*] } {
2197 return [check_no_compiler_messages powerpc_spe object {
2209 # Return 1 if this is a PowerPC target with Altivec enabled.
2211 proc check_effective_target_powerpc_altivec { } {
2212 if { [istarget powerpc*-*-*] } {
2213 return [check_no_compiler_messages powerpc_altivec object {
2225 # Return 1 if this is a PowerPC 405 target. The check includes options
2226 # specified by dg-options for this test, so don't cache the result.
2228 proc check_effective_target_powerpc_405_nocache { } {
2229 if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
2230 return [check_no_compiler_messages_nocache powerpc_405 object {
2236 } [current_compiler_flags]]
2242 # Return 1 if this is a SPU target with a toolchain that
2243 # supports automatic overlay generation.
2245 proc check_effective_target_spu_auto_overlay { } {
2246 if { [istarget spu*-*-elf*] } {
2247 return [check_no_compiler_messages spu_auto_overlay executable {
2249 } "-Wl,--auto-overlay" ]
2255 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
2256 # chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
2257 # test environment appears to run executables on such a simulator.
2259 proc check_effective_target_ultrasparc_hw { } {
2260 return [check_runtime ultrasparc_hw {
2261 int main() { return 0; }
2262 } "-mcpu=ultrasparc"]
2265 # Return 1 if the target supports hardware vector shift operation.
2267 proc check_effective_target_vect_shift { } {
2268 global et_vect_shift_saved
2270 if [info exists et_vect_shift_saved] {
2271 verbose "check_effective_target_vect_shift: using cached result" 2
2273 set et_vect_shift_saved 0
2274 if { ([istarget powerpc*-*-*]
2275 && ![istarget powerpc-*-linux*paired*])
2276 || [istarget ia64-*-*]
2277 || [istarget i?86-*-*]
2278 || [istarget x86_64-*-*]
2279 || [check_effective_target_arm32]
2280 || ([istarget mips*-*-*]
2281 && [check_effective_target_mips_loongson]) } {
2282 set et_vect_shift_saved 1
2286 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
2287 return $et_vect_shift_saved
2290 # Return 1 if the target supports hardware vector shift operation with
2291 # scalar shift argument.
2293 proc check_effective_target_vect_shift_scalar { } {
2294 global et_vect_shift_scalar_saved
2296 if [info exists et_vect_shift_scalar_saved] {
2297 verbose "check_effective_target_vect_shift_scalar: using cached result" 2
2299 set et_vect_shift_scalar_saved 0
2300 if { [istarget x86_64-*-*]
2301 || [istarget i?86-*-*] } {
2302 set et_vect_shift_scalar_saved 1
2306 verbose "check_effective_target_vect_shift_scalar: returning $et_vect_shift_scalar_saved" 2
2307 return $et_vect_shift_scalar_saved
2311 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
2313 # This can change for different subtargets so do not cache the result.
2315 proc check_effective_target_vect_long { } {
2316 if { [istarget i?86-*-*]
2317 || (([istarget powerpc*-*-*]
2318 && ![istarget powerpc-*-linux*paired*])
2319 && [check_effective_target_ilp32])
2320 || [istarget x86_64-*-*]
2321 || [check_effective_target_arm32]
2322 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
2328 verbose "check_effective_target_vect_long: returning $answer" 2
2332 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
2334 # This won't change for different subtargets so cache the result.
2336 proc check_effective_target_vect_float { } {
2337 global et_vect_float_saved
2339 if [info exists et_vect_float_saved] {
2340 verbose "check_effective_target_vect_float: using cached result" 2
2342 set et_vect_float_saved 0
2343 if { [istarget i?86-*-*]
2344 || [istarget powerpc*-*-*]
2345 || [istarget spu-*-*]
2346 || [istarget mipsisa64*-*-*]
2347 || [istarget x86_64-*-*]
2348 || [istarget ia64-*-*]
2349 || [check_effective_target_arm32] } {
2350 set et_vect_float_saved 1
2354 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
2355 return $et_vect_float_saved
2358 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
2360 # This won't change for different subtargets so cache the result.
2362 proc check_effective_target_vect_double { } {
2363 global et_vect_double_saved
2365 if [info exists et_vect_double_saved] {
2366 verbose "check_effective_target_vect_double: using cached result" 2
2368 set et_vect_double_saved 0
2369 if { [istarget i?86-*-*]
2370 || [istarget x86_64-*-*] } {
2371 if { [check_no_compiler_messages vect_double assembly {
2372 #ifdef __tune_atom__
2373 # error No double vectorizer support.
2376 set et_vect_double_saved 1
2378 set et_vect_double_saved 0
2380 } elseif { [istarget spu-*-*] } {
2381 set et_vect_double_saved 1
2385 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
2386 return $et_vect_double_saved
2389 # Return 1 if the target supports hardware vectors of long long, 0 otherwise.
2391 # This won't change for different subtargets so cache the result.
2393 proc check_effective_target_vect_long_long { } {
2394 global et_vect_long_long_saved
2396 if [info exists et_vect_long_long_saved] {
2397 verbose "check_effective_target_vect_long_long: using cached result" 2
2399 set et_vect_long_long_saved 0
2400 if { [istarget i?86-*-*]
2401 || [istarget x86_64-*-*] } {
2402 set et_vect_long_long_saved 1
2406 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
2407 return $et_vect_long_long_saved
2411 # Return 1 if the target plus current options does not support a vector
2412 # max instruction on "int", 0 otherwise.
2414 # This won't change for different subtargets so cache the result.
2416 proc check_effective_target_vect_no_int_max { } {
2417 global et_vect_no_int_max_saved
2419 if [info exists et_vect_no_int_max_saved] {
2420 verbose "check_effective_target_vect_no_int_max: using cached result" 2
2422 set et_vect_no_int_max_saved 0
2423 if { [istarget sparc*-*-*]
2424 || [istarget spu-*-*]
2425 || [istarget alpha*-*-*]
2426 || ([istarget mips*-*-*]
2427 && [check_effective_target_mips_loongson]) } {
2428 set et_vect_no_int_max_saved 1
2431 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
2432 return $et_vect_no_int_max_saved
2435 # Return 1 if the target plus current options does not support a vector
2436 # add instruction on "int", 0 otherwise.
2438 # This won't change for different subtargets so cache the result.
2440 proc check_effective_target_vect_no_int_add { } {
2441 global et_vect_no_int_add_saved
2443 if [info exists et_vect_no_int_add_saved] {
2444 verbose "check_effective_target_vect_no_int_add: using cached result" 2
2446 set et_vect_no_int_add_saved 0
2447 # Alpha only supports vector add on V8QI and V4HI.
2448 if { [istarget alpha*-*-*] } {
2449 set et_vect_no_int_add_saved 1
2452 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
2453 return $et_vect_no_int_add_saved
2456 # Return 1 if the target plus current options does not support vector
2457 # bitwise instructions, 0 otherwise.
2459 # This won't change for different subtargets so cache the result.
2461 proc check_effective_target_vect_no_bitwise { } {
2462 global et_vect_no_bitwise_saved
2464 if [info exists et_vect_no_bitwise_saved] {
2465 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
2467 set et_vect_no_bitwise_saved 0
2469 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
2470 return $et_vect_no_bitwise_saved
2473 # Return 1 if the target plus current options supports vector permutation,
2476 # This won't change for different subtargets so cache the result.
2478 proc check_effective_target_vect_perm { } {
2481 if [info exists et_vect_perm_saved] {
2482 verbose "check_effective_target_vect_perm: using cached result" 2
2484 set et_vect_perm_saved 0
2485 if { [istarget powerpc*-*-*]
2486 || [istarget spu-*-*]
2487 || [istarget i?86-*-*]
2488 || [istarget x86_64-*-*] } {
2489 set et_vect_perm_saved 1
2492 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
2493 return $et_vect_perm_saved
2496 # Return 1 if the target plus current options supports vector permutation
2497 # on byte-sized elements, 0 otherwise.
2499 # This won't change for different subtargets so cache the result.
2501 proc check_effective_target_vect_perm_byte { } {
2502 global et_vect_perm_byte
2504 if [info exists et_vect_perm_byte_saved] {
2505 verbose "check_effective_target_vect_perm_byte: using cached result" 2
2507 set et_vect_perm_byte_saved 0
2508 if { [istarget powerpc*-*-*]
2509 || [istarget spu-*-*] } {
2510 set et_vect_perm_byte_saved 1
2513 verbose "check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
2514 return $et_vect_perm_byte_saved
2517 # Return 1 if the target plus current options supports vector permutation
2518 # on short-sized elements, 0 otherwise.
2520 # This won't change for different subtargets so cache the result.
2522 proc check_effective_target_vect_perm_short { } {
2523 global et_vect_perm_short
2525 if [info exists et_vect_perm_short_saved] {
2526 verbose "check_effective_target_vect_perm_short: using cached result" 2
2528 set et_vect_perm_short_saved 0
2529 if { [istarget powerpc*-*-*]
2530 || [istarget spu-*-*] } {
2531 set et_vect_perm_short_saved 1
2534 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
2535 return $et_vect_perm_short_saved
2538 # Return 1 if the target plus current options supports a vector
2539 # widening summation of *short* args into *int* result, 0 otherwise.
2541 # This won't change for different subtargets so cache the result.
2543 proc check_effective_target_vect_widen_sum_hi_to_si_pattern { } {
2544 global et_vect_widen_sum_hi_to_si_pattern
2546 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved] {
2547 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
2549 set et_vect_widen_sum_hi_to_si_pattern_saved 0
2550 if { [istarget powerpc*-*-*]
2551 || [istarget ia64-*-*] } {
2552 set et_vect_widen_sum_hi_to_si_pattern_saved 1
2555 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
2556 return $et_vect_widen_sum_hi_to_si_pattern_saved
2559 # Return 1 if the target plus current options supports a vector
2560 # widening summation of *short* args into *int* result, 0 otherwise.
2561 # A target can also support this widening summation if it can support
2562 # promotion (unpacking) from shorts to ints.
2564 # This won't change for different subtargets so cache the result.
2566 proc check_effective_target_vect_widen_sum_hi_to_si { } {
2567 global et_vect_widen_sum_hi_to_si
2569 if [info exists et_vect_widen_sum_hi_to_si_saved] {
2570 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
2572 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
2573 if { [istarget powerpc*-*-*]
2574 || [istarget ia64-*-*] } {
2575 set et_vect_widen_sum_hi_to_si_saved 1
2578 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
2579 return $et_vect_widen_sum_hi_to_si_saved
2582 # Return 1 if the target plus current options supports a vector
2583 # widening summation of *char* args into *short* result, 0 otherwise.
2584 # A target can also support this widening summation if it can support
2585 # promotion (unpacking) from chars to shorts.
2587 # This won't change for different subtargets so cache the result.
2589 proc check_effective_target_vect_widen_sum_qi_to_hi { } {
2590 global et_vect_widen_sum_qi_to_hi
2592 if [info exists et_vect_widen_sum_qi_to_hi_saved] {
2593 verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
2595 set et_vect_widen_sum_qi_to_hi_saved 0
2596 if { [check_effective_target_vect_unpack]
2597 || [istarget ia64-*-*] } {
2598 set et_vect_widen_sum_qi_to_hi_saved 1
2601 verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
2602 return $et_vect_widen_sum_qi_to_hi_saved
2605 # Return 1 if the target plus current options supports a vector
2606 # widening summation of *char* args into *int* result, 0 otherwise.
2608 # This won't change for different subtargets so cache the result.
2610 proc check_effective_target_vect_widen_sum_qi_to_si { } {
2611 global et_vect_widen_sum_qi_to_si
2613 if [info exists et_vect_widen_sum_qi_to_si_saved] {
2614 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
2616 set et_vect_widen_sum_qi_to_si_saved 0
2617 if { [istarget powerpc*-*-*] } {
2618 set et_vect_widen_sum_qi_to_si_saved 1
2621 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
2622 return $et_vect_widen_sum_qi_to_si_saved
2625 # Return 1 if the target plus current options supports a vector
2626 # widening multiplication of *char* args into *short* result, 0 otherwise.
2627 # A target can also support this widening multplication if it can support
2628 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
2629 # multiplication of shorts).
2631 # This won't change for different subtargets so cache the result.
2634 proc check_effective_target_vect_widen_mult_qi_to_hi { } {
2635 global et_vect_widen_mult_qi_to_hi
2637 if [info exists et_vect_widen_mult_qi_to_hi_saved] {
2638 verbose "check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
2640 if { [check_effective_target_vect_unpack]
2641 && [check_effective_target_vect_short_mult] } {
2642 set et_vect_widen_mult_qi_to_hi_saved 1
2644 set et_vect_widen_mult_qi_to_hi_saved 0
2646 if { [istarget powerpc*-*-*] } {
2647 set et_vect_widen_mult_qi_to_hi_saved 1
2650 verbose "check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
2651 return $et_vect_widen_mult_qi_to_hi_saved
2654 # Return 1 if the target plus current options supports a vector
2655 # widening multiplication of *short* args into *int* result, 0 otherwise.
2656 # A target can also support this widening multplication if it can support
2657 # promotion (unpacking) from shorts to ints, and vect_int_mult (non-widening
2658 # multiplication of ints).
2660 # This won't change for different subtargets so cache the result.
2663 proc check_effective_target_vect_widen_mult_hi_to_si { } {
2664 global et_vect_widen_mult_hi_to_si
2666 if [info exists et_vect_widen_mult_hi_to_si_saved] {
2667 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
2669 if { [check_effective_target_vect_unpack]
2670 && [check_effective_target_vect_int_mult] } {
2671 set et_vect_widen_mult_hi_to_si_saved 1
2673 set et_vect_widen_mult_hi_to_si_saved 0
2675 if { [istarget powerpc*-*-*]
2676 || [istarget spu-*-*]
2677 || [istarget ia64-*-*]
2678 || [istarget i?86-*-*]
2679 || [istarget x86_64-*-*] } {
2680 set et_vect_widen_mult_hi_to_si_saved 1
2683 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
2684 return $et_vect_widen_mult_hi_to_si_saved
2687 # Return 1 if the target plus current options supports a vector
2688 # dot-product of signed chars, 0 otherwise.
2690 # This won't change for different subtargets so cache the result.
2692 proc check_effective_target_vect_sdot_qi { } {
2693 global et_vect_sdot_qi
2695 if [info exists et_vect_sdot_qi_saved] {
2696 verbose "check_effective_target_vect_sdot_qi: using cached result" 2
2698 set et_vect_sdot_qi_saved 0
2699 if { [istarget ia64-*-*] } {
2700 set et_vect_udot_qi_saved 1
2703 verbose "check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
2704 return $et_vect_sdot_qi_saved
2707 # Return 1 if the target plus current options supports a vector
2708 # dot-product of unsigned chars, 0 otherwise.
2710 # This won't change for different subtargets so cache the result.
2712 proc check_effective_target_vect_udot_qi { } {
2713 global et_vect_udot_qi
2715 if [info exists et_vect_udot_qi_saved] {
2716 verbose "check_effective_target_vect_udot_qi: using cached result" 2
2718 set et_vect_udot_qi_saved 0
2719 if { [istarget powerpc*-*-*]
2720 || [istarget ia64-*-*] } {
2721 set et_vect_udot_qi_saved 1
2724 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
2725 return $et_vect_udot_qi_saved
2728 # Return 1 if the target plus current options supports a vector
2729 # dot-product of signed shorts, 0 otherwise.
2731 # This won't change for different subtargets so cache the result.
2733 proc check_effective_target_vect_sdot_hi { } {
2734 global et_vect_sdot_hi
2736 if [info exists et_vect_sdot_hi_saved] {
2737 verbose "check_effective_target_vect_sdot_hi: using cached result" 2
2739 set et_vect_sdot_hi_saved 0
2740 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
2741 || [istarget ia64-*-*]
2742 || [istarget i?86-*-*]
2743 || [istarget x86_64-*-*] } {
2744 set et_vect_sdot_hi_saved 1
2747 verbose "check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
2748 return $et_vect_sdot_hi_saved
2751 # Return 1 if the target plus current options supports a vector
2752 # dot-product of unsigned shorts, 0 otherwise.
2754 # This won't change for different subtargets so cache the result.
2756 proc check_effective_target_vect_udot_hi { } {
2757 global et_vect_udot_hi
2759 if [info exists et_vect_udot_hi_saved] {
2760 verbose "check_effective_target_vect_udot_hi: using cached result" 2
2762 set et_vect_udot_hi_saved 0
2763 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
2764 set et_vect_udot_hi_saved 1
2767 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
2768 return $et_vect_udot_hi_saved
2772 # Return 1 if the target plus current options supports a vector
2773 # demotion (packing) of shorts (to chars) and ints (to shorts)
2774 # using modulo arithmetic, 0 otherwise.
2776 # This won't change for different subtargets so cache the result.
2778 proc check_effective_target_vect_pack_trunc { } {
2779 global et_vect_pack_trunc
2781 if [info exists et_vect_pack_trunc_saved] {
2782 verbose "check_effective_target_vect_pack_trunc: using cached result" 2
2784 set et_vect_pack_trunc_saved 0
2785 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
2786 || [istarget i?86-*-*]
2787 || [istarget x86_64-*-*]
2788 || [istarget spu-*-*]
2789 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
2790 set et_vect_pack_trunc_saved 1
2793 verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
2794 return $et_vect_pack_trunc_saved
2797 # Return 1 if the target plus current options supports a vector
2798 # promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
2800 # This won't change for different subtargets so cache the result.
2802 proc check_effective_target_vect_unpack { } {
2803 global et_vect_unpack
2805 if [info exists et_vect_unpack_saved] {
2806 verbose "check_effective_target_vect_unpack: using cached result" 2
2808 set et_vect_unpack_saved 0
2809 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
2810 || [istarget i?86-*-*]
2811 || [istarget x86_64-*-*]
2812 || [istarget spu-*-*]
2813 || [istarget ia64-*-*]
2814 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
2815 set et_vect_unpack_saved 1
2818 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
2819 return $et_vect_unpack_saved
2822 # Return 1 if the target plus current options does not guarantee
2823 # that its STACK_BOUNDARY is >= the reguired vector alignment.
2825 # This won't change for different subtargets so cache the result.
2827 proc check_effective_target_unaligned_stack { } {
2828 global et_unaligned_stack_saved
2830 if [info exists et_unaligned_stack_saved] {
2831 verbose "check_effective_target_unaligned_stack: using cached result" 2
2833 set et_unaligned_stack_saved 0
2835 verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
2836 return $et_unaligned_stack_saved
2839 # Return 1 if the target plus current options does not support a vector
2840 # alignment mechanism, 0 otherwise.
2842 # This won't change for different subtargets so cache the result.
2844 proc check_effective_target_vect_no_align { } {
2845 global et_vect_no_align_saved
2847 if [info exists et_vect_no_align_saved] {
2848 verbose "check_effective_target_vect_no_align: using cached result" 2
2850 set et_vect_no_align_saved 0
2851 if { [istarget mipsisa64*-*-*]
2852 || [istarget sparc*-*-*]
2853 || [istarget ia64-*-*]
2854 || [check_effective_target_arm_vect_no_misalign]
2855 || ([istarget mips*-*-*]
2856 && [check_effective_target_mips_loongson]) } {
2857 set et_vect_no_align_saved 1
2860 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
2861 return $et_vect_no_align_saved
2864 # Return 1 if the target supports a vector misalign access, 0 otherwise.
2866 # This won't change for different subtargets so cache the result.
2868 proc check_effective_target_vect_hw_misalign { } {
2869 global et_vect_hw_misalign_saved
2871 if [info exists et_vect_hw_misalign_saved] {
2872 verbose "check_effective_target_vect_hw_misalign: using cached result" 2
2874 set et_vect_hw_misalign_saved 0
2875 if { ([istarget x86_64-*-*]
2876 || [istarget i?86-*-*]) } {
2877 set et_vect_hw_misalign_saved 1
2880 verbose "check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
2881 return $et_vect_hw_misalign_saved
2885 # Return 1 if arrays are aligned to the vector alignment
2886 # boundary, 0 otherwise.
2888 # This won't change for different subtargets so cache the result.
2890 proc check_effective_target_vect_aligned_arrays { } {
2891 global et_vect_aligned_arrays
2893 if [info exists et_vect_aligned_arrays_saved] {
2894 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
2896 set et_vect_aligned_arrays_saved 0
2897 if { (([istarget x86_64-*-*]
2898 || [istarget i?86-*-*]) && [is-effective-target lp64])
2899 || [istarget spu-*-*] } {
2900 set et_vect_aligned_arrays_saved 1
2903 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
2904 return $et_vect_aligned_arrays_saved
2907 # Return 1 if types of size 32 bit or less are naturally aligned
2908 # (aligned to their type-size), 0 otherwise.
2910 # This won't change for different subtargets so cache the result.
2912 proc check_effective_target_natural_alignment_32 { } {
2913 global et_natural_alignment_32
2915 if [info exists et_natural_alignment_32_saved] {
2916 verbose "check_effective_target_natural_alignment_32: using cached result" 2
2918 # FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
2919 set et_natural_alignment_32_saved 1
2920 if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
2921 set et_natural_alignment_32_saved 0
2924 verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
2925 return $et_natural_alignment_32_saved
2928 # Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
2929 # type-size), 0 otherwise.
2931 # This won't change for different subtargets so cache the result.
2933 proc check_effective_target_natural_alignment_64 { } {
2934 global et_natural_alignment_64
2936 if [info exists et_natural_alignment_64_saved] {
2937 verbose "check_effective_target_natural_alignment_64: using cached result" 2
2939 set et_natural_alignment_64_saved 0
2940 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
2941 || [istarget spu-*-*] } {
2942 set et_natural_alignment_64_saved 1
2945 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
2946 return $et_natural_alignment_64_saved
2949 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
2951 # This won't change for different subtargets so cache the result.
2953 proc check_effective_target_vector_alignment_reachable { } {
2954 global et_vector_alignment_reachable
2956 if [info exists et_vector_alignment_reachable_saved] {
2957 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
2959 if { [check_effective_target_vect_aligned_arrays]
2960 || [check_effective_target_natural_alignment_32] } {
2961 set et_vector_alignment_reachable_saved 1
2963 set et_vector_alignment_reachable_saved 0
2966 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
2967 return $et_vector_alignment_reachable_saved
2970 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
2972 # This won't change for different subtargets so cache the result.
2974 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
2975 global et_vector_alignment_reachable_for_64bit
2977 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
2978 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
2980 if { [check_effective_target_vect_aligned_arrays]
2981 || [check_effective_target_natural_alignment_64] } {
2982 set et_vector_alignment_reachable_for_64bit_saved 1
2984 set et_vector_alignment_reachable_for_64bit_saved 0
2987 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
2988 return $et_vector_alignment_reachable_for_64bit_saved
2991 # Return 1 if the target only requires element alignment for vector accesses
2993 proc check_effective_target_vect_element_align { } {
2994 global et_vect_element_align
2996 if [info exists et_vect_element_align] {
2997 verbose "check_effective_target_vect_element_align: using cached result" 2
2999 set et_vect_element_align 0
3000 if { [istarget arm*-*-*]
3001 || [check_effective_target_vect_hw_misalign] } {
3002 set et_vect_element_align 1
3006 verbose "check_effective_target_vect_element_align: returning $et_vect_element_align" 2
3007 return $et_vect_element_align
3010 # Return 1 if the target supports vector conditional operations, 0 otherwise.
3012 proc check_effective_target_vect_condition { } {
3013 global et_vect_cond_saved
3015 if [info exists et_vect_cond_saved] {
3016 verbose "check_effective_target_vect_cond: using cached result" 2
3018 set et_vect_cond_saved 0
3019 if { [istarget powerpc*-*-*]
3020 || [istarget ia64-*-*]
3021 || [istarget i?86-*-*]
3022 || [istarget spu-*-*]
3023 || [istarget x86_64-*-*] } {
3024 set et_vect_cond_saved 1
3028 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
3029 return $et_vect_cond_saved
3032 # Return 1 if the target supports vector char multiplication, 0 otherwise.
3034 proc check_effective_target_vect_char_mult { } {
3035 global et_vect_char_mult_saved
3037 if [info exists et_vect_char_mult_saved] {
3038 verbose "check_effective_target_vect_char_mult: using cached result" 2
3040 set et_vect_char_mult_saved 0
3041 if { [istarget ia64-*-*]
3042 || [istarget i?86-*-*]
3043 || [istarget x86_64-*-*] } {
3044 set et_vect_char_mult_saved 1
3048 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
3049 return $et_vect_char_mult_saved
3052 # Return 1 if the target supports vector short multiplication, 0 otherwise.
3054 proc check_effective_target_vect_short_mult { } {
3055 global et_vect_short_mult_saved
3057 if [info exists et_vect_short_mult_saved] {
3058 verbose "check_effective_target_vect_short_mult: using cached result" 2
3060 set et_vect_short_mult_saved 0
3061 if { [istarget ia64-*-*]
3062 || [istarget spu-*-*]
3063 || [istarget i?86-*-*]
3064 || [istarget x86_64-*-*]
3065 || [istarget powerpc*-*-*]
3066 || [check_effective_target_arm32]
3067 || ([istarget mips*-*-*]
3068 && [check_effective_target_mips_loongson]) } {
3069 set et_vect_short_mult_saved 1
3073 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
3074 return $et_vect_short_mult_saved
3077 # Return 1 if the target supports vector int multiplication, 0 otherwise.
3079 proc check_effective_target_vect_int_mult { } {
3080 global et_vect_int_mult_saved
3082 if [info exists et_vect_int_mult_saved] {
3083 verbose "check_effective_target_vect_int_mult: using cached result" 2
3085 set et_vect_int_mult_saved 0
3086 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
3087 || [istarget spu-*-*]
3088 || [istarget i?86-*-*]
3089 || [istarget x86_64-*-*]
3090 || [istarget ia64-*-*]
3091 || [check_effective_target_arm32] } {
3092 set et_vect_int_mult_saved 1
3096 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
3097 return $et_vect_int_mult_saved
3100 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
3102 proc check_effective_target_vect_extract_even_odd { } {
3103 global et_vect_extract_even_odd_saved
3105 if [info exists et_vect_extract_even_odd_saved] {
3106 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
3108 set et_vect_extract_even_odd_saved 0
3109 if { [istarget powerpc*-*-*]
3110 || [istarget i?86-*-*]
3111 || [istarget x86_64-*-*]
3112 || [istarget ia64-*-*]
3113 || [istarget spu-*-*] } {
3114 set et_vect_extract_even_odd_saved 1
3118 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
3119 return $et_vect_extract_even_odd_saved
3122 # Return 1 if the target supports vector even/odd elements extraction of
3123 # vectors with SImode elements or larger, 0 otherwise.
3125 proc check_effective_target_vect_extract_even_odd_wide { } {
3126 global et_vect_extract_even_odd_wide_saved
3128 if [info exists et_vect_extract_even_odd_wide_saved] {
3129 verbose "check_effective_target_vect_extract_even_odd_wide: using cached result" 2
3131 set et_vect_extract_even_odd_wide_saved 0
3132 if { [istarget powerpc*-*-*]
3133 || [istarget i?86-*-*]
3134 || [istarget x86_64-*-*]
3135 || [istarget ia64-*-*]
3136 || [istarget spu-*-*] } {
3137 set et_vect_extract_even_odd_wide_saved 1
3141 verbose "check_effective_target_vect_extract_even_wide_odd: returning $et_vect_extract_even_odd_wide_saved" 2
3142 return $et_vect_extract_even_odd_wide_saved
3145 # Return 1 if the target supports vector interleaving, 0 otherwise.
3147 proc check_effective_target_vect_interleave { } {
3148 global et_vect_interleave_saved
3150 if [info exists et_vect_interleave_saved] {
3151 verbose "check_effective_target_vect_interleave: using cached result" 2
3153 set et_vect_interleave_saved 0
3154 if { [istarget powerpc*-*-*]
3155 || [istarget i?86-*-*]
3156 || [istarget x86_64-*-*]
3157 || [istarget ia64-*-*]
3158 || [istarget spu-*-*] } {
3159 set et_vect_interleave_saved 1
3163 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
3164 return $et_vect_interleave_saved
3167 # Return 1 if the target supports vector interleaving and extract even/odd, 0 otherwise.
3168 proc check_effective_target_vect_strided { } {
3169 global et_vect_strided_saved
3171 if [info exists et_vect_strided_saved] {
3172 verbose "check_effective_target_vect_strided: using cached result" 2
3174 set et_vect_strided_saved 0
3175 if { [check_effective_target_vect_interleave]
3176 && [check_effective_target_vect_extract_even_odd] } {
3177 set et_vect_strided_saved 1
3181 verbose "check_effective_target_vect_strided: returning $et_vect_strided_saved" 2
3182 return $et_vect_strided_saved
3185 # Return 1 if the target supports vector interleaving and extract even/odd
3186 # for wide element types, 0 otherwise.
3187 proc check_effective_target_vect_strided_wide { } {
3188 global et_vect_strided_wide_saved
3190 if [info exists et_vect_strided_wide_saved] {
3191 verbose "check_effective_target_vect_strided_wide: using cached result" 2
3193 set et_vect_strided_wide_saved 0
3194 if { [check_effective_target_vect_interleave]
3195 && [check_effective_target_vect_extract_even_odd_wide] } {
3196 set et_vect_strided_wide_saved 1
3200 verbose "check_effective_target_vect_strided_wide: returning $et_vect_strided_wide_saved" 2
3201 return $et_vect_strided_wide_saved
3204 # Return 1 if the target supports section-anchors
3206 proc check_effective_target_section_anchors { } {
3207 global et_section_anchors_saved
3209 if [info exists et_section_anchors_saved] {
3210 verbose "check_effective_target_section_anchors: using cached result" 2
3212 set et_section_anchors_saved 0
3213 if { [istarget powerpc*-*-*]
3214 || [istarget arm*-*-*] } {
3215 set et_section_anchors_saved 1
3219 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
3220 return $et_section_anchors_saved
3223 # Return 1 if the target supports atomic operations on "int" and "long".
3225 proc check_effective_target_sync_int_long { } {
3226 global et_sync_int_long_saved
3228 if [info exists et_sync_int_long_saved] {
3229 verbose "check_effective_target_sync_int_long: using cached result" 2
3231 set et_sync_int_long_saved 0
3232 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
3233 # load-reserved/store-conditional instructions.
3234 if { [istarget ia64-*-*]
3235 || [istarget i?86-*-*]
3236 || [istarget x86_64-*-*]
3237 || [istarget alpha*-*-*]
3238 || [istarget arm*-*-linux-gnueabi]
3239 || [istarget bfin*-*linux*]
3240 || [istarget hppa*-*linux*]
3241 || [istarget s390*-*-*]
3242 || [istarget powerpc*-*-*]
3243 || [istarget sparc64-*-*]
3244 || [istarget sparcv9-*-*]
3245 || [istarget mips*-*-*] } {
3246 set et_sync_int_long_saved 1
3250 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
3251 return $et_sync_int_long_saved
3254 # Return 1 if the target supports atomic operations on "char" and "short".
3256 proc check_effective_target_sync_char_short { } {
3257 global et_sync_char_short_saved
3259 if [info exists et_sync_char_short_saved] {
3260 verbose "check_effective_target_sync_char_short: using cached result" 2
3262 set et_sync_char_short_saved 0
3263 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
3264 # load-reserved/store-conditional instructions.
3265 if { [istarget ia64-*-*]
3266 || [istarget i?86-*-*]
3267 || [istarget x86_64-*-*]
3268 || [istarget alpha*-*-*]
3269 || [istarget arm*-*-linux-gnueabi]
3270 || [istarget hppa*-*linux*]
3271 || [istarget s390*-*-*]
3272 || [istarget powerpc*-*-*]
3273 || [istarget sparc64-*-*]
3274 || [istarget sparcv9-*-*]
3275 || [istarget mips*-*-*] } {
3276 set et_sync_char_short_saved 1
3280 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
3281 return $et_sync_char_short_saved
3284 # Return 1 if the target uses a ColdFire FPU.
3286 proc check_effective_target_coldfire_fpu { } {
3287 return [check_no_compiler_messages coldfire_fpu assembly {
3294 # Return true if this is a uClibc target.
3296 proc check_effective_target_uclibc {} {
3297 return [check_no_compiler_messages uclibc object {
3298 #include <features.h>
3299 #if !defined (__UCLIBC__)
3305 # Return true if this is a uclibc target and if the uclibc feature