1 # Copyright
(C
) 1999-2014 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC
; see the file COPYING3.
If not see
15 #
<http
://www.gnu.org
/licenses
/>.
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # gcc
-patches@gcc.gnu.org
20 # This file defines procs
for determining features supported by the target.
22 # Try to
compile the code given by CONTENTS into an output file of
23 # type TYPE
, where TYPE is as
for target_compile.
Return a list
24 # whose first element contains the compiler messages and whose
25 # second element is the
name of the output file.
27 # BASENAME is a prefix to use
for source and output files.
28 #
If ARGS is not empty
, its first element is a string that
29 # should be added to the command line.
31 # Assume by default that CONTENTS is C code.
32 # Otherwise
, code should contain
:
34 #
"! Fortran" for Fortran code,
36 #
"// ObjC++" for ObjC++
38 #
If the tool is ObjC
/ObjC
++ then we overide the extension to .m
/.mm to
39 # allow
for ObjC
/ObjC
++ specific flags.
40 proc check_compile
{basename type contents
args} {
42 verbose
"check_compile tool: $tool for $basename"
44 if { [llength $
args] > 0 } {
45 set options
[list
"additional_flags=[lindex $args 0]"]
49 switch -glob
-- $contents
{
50 "*! Fortran*" { set src ${basename}[pid].f90 }
51 "*// C++*" { set src ${basename}[pid].cc }
52 "*// ObjC++*" { set src ${basename}[pid].mm }
53 "*/* ObjC*" { set src ${basename}[pid].m }
54 "*// Go*" { set src ${basename}[pid].go }
57 "objc" { set src ${basename}[pid].m }
58 "obj-c++" { set src ${basename}[pid].mm }
59 default
{ set src $
{basename
}[pid
].c
}
64 set compile_type $type
66 assembly
{ set output $
{basename
}[pid
].s
}
67 object
{ set output $
{basename
}[pid
].o
}
68 executable
{ set output $
{basename
}[pid
].exe
}
70 set output $
{basename
}[pid
].s
71 lappend options
"additional_flags=-fdump-$type"
72 set compile_type assembly
78 set lines
[$
{tool
}_target_compile $src $output $compile_type
"$options"]
81 set scan_output $output
82 # Don
't try folding this into the switch above; calling "glob" before the
83 # file is created won't work.
84 if [regexp
"rtl-(.*)" $type dummy rtl_type] {
85 set scan_output
"[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
89 return [list $lines $scan_output
]
92 proc current_target_name
{ } {
94 if [info exists target_info
(target
,name)] {
95 set answer $target_info
(target
,name)
102 # Implement an effective
-target check
for property PROP by invoking
103 # the Tcl command
ARGS and seeing
if it returns true.
105 proc check_cached_effective_target
{ prop
args } {
108 set target
[current_target_name
]
109 if {![info exists et_cache
($prop
,target
)]
110 || $et_cache
($prop
,target
) != $target
} {
111 verbose
"check_cached_effective_target $prop: checking $target" 2
112 set et_cache
($prop
,target
) $target
113 set et_cache
($prop
,value
) [uplevel eval $
args]
115 set value $et_cache
($prop
,value
)
116 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
120 # Like check_compile
, but
delete the output file and
return true
if the
121 # compiler printed no messages.
122 proc check_no_compiler_messages_nocache
{args} {
123 set result
[eval check_compile $
args]
124 set lines
[lindex $result
0]
125 set output
[lindex $result
1]
126 remote_file build
delete $output
127 return [string match
"" $lines]
130 # Like check_no_compiler_messages_nocache
, but
cache the result.
131 # PROP is the
property we
're checking, and doubles as a prefix for
132 # temporary filenames.
133 proc check_no_compiler_messages {prop args} {
134 return [check_cached_effective_target $prop {
135 eval [list check_no_compiler_messages_nocache $prop] $args
139 # Like check_compile, but return true if the compiler printed no
140 # messages and if the contents of the output file satisfy PATTERN.
141 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
142 # don't match regular expression REGEXP
, otherwise they satisfy it
143 #
if they
do match regular expression PATTERN.
(PATTERN can start
144 # with something like
"[!]" if the regular expression needs to match
145 #
"!" as the first character.)
147 #
Delete the output file before returning. The other arguments are
148 # as
for check_compile.
149 proc check_no_messages_and_pattern_nocache
{basename pattern
args} {
152 set result
[eval
[list check_compile $basename
] $
args]
153 set lines
[lindex $result
0]
154 set output
[lindex $result
1]
157 if { [string match
"" $lines] } {
158 set chan
[open
"$output"]
159 set invert
[regexp
{^
!(.
*)} $pattern dummy pattern
]
160 set ok
[expr
{ [regexp $pattern
[read $chan
]] != $invert
}]
164 remote_file build
delete $output
168 # Like check_no_messages_and_pattern_nocache
, but
cache the result.
169 # PROP is the
property we
're checking, and doubles as a prefix for
170 # temporary filenames.
171 proc check_no_messages_and_pattern {prop pattern args} {
172 return [check_cached_effective_target $prop {
173 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
177 # Try to compile and run an executable from code CONTENTS. Return true
178 # if the compiler reports no messages and if execution "passes" in the
179 # usual DejaGNU sense. The arguments are as for check_compile, with
180 # TYPE implicitly being "executable".
181 proc check_runtime_nocache {basename contents args} {
184 set result [eval [list check_compile $basename executable $contents] $args]
185 set lines [lindex $result 0]
186 set output [lindex $result 1]
189 if { [string match "" $lines] } {
190 # No error messages, everything is OK.
191 set result [remote_load target "./$output" "" ""]
192 set status [lindex $result 0]
193 verbose "check_runtime_nocache $basename: status is <$status>" 2
194 if { $status == "pass" } {
198 remote_file build delete $output
202 # Like check_runtime_nocache, but cache the result. PROP is the
203 # property we're checking
, and doubles as a prefix
for temporary
205 proc check_runtime
{prop
args} {
208 return [check_cached_effective_target $prop
{
209 eval
[list check_runtime_nocache $prop
] $
args
213 ###############################
214 # proc check_weak_available
{ }
215 ###############################
217 # weak symbols are only supported in some configs
/object formats
218 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
220 proc check_weak_available
{ } {
223 # All mips targets should support it
225 if { [ string first
"mips" $target_cpu ] >= 0 } {
229 # All AIX targets should support it
231 if { [istarget
*-*-aix
*] } {
235 # All solaris2 targets should support it
237 if { [istarget
*-*-solaris2
*] } {
241 # Windows targets Cygwin and MingW32 support it
243 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
247 # HP
-UX
10.X doesn
't support it
249 if { [istarget hppa*-*-hpux10*] } {
253 # ELF and ECOFF support it. a.out does with gas/gld but may also with
254 # other linkers, so we should try it
256 set objformat [gcc_target_object_format]
264 unknown { return -1 }
269 ###############################
270 # proc check_weak_override_available { }
271 ###############################
273 # Like check_weak_available, but return 0 if weak symbol definitions
274 # cannot be overridden.
276 proc check_weak_override_available { } {
277 if { [istarget *-*-mingw*] } {
280 return [check_weak_available]
283 ###############################
284 # proc check_visibility_available { what_kind }
285 ###############################
287 # The visibility attribute is only support in some object formats
288 # This proc returns 1 if it is supported, 0 if not.
289 # The argument is the kind of visibility, default/protected/hidden/internal.
291 proc check_visibility_available { what_kind } {
292 if [string match "" $what_kind] { set what_kind "hidden" }
294 return [check_no_compiler_messages visibility_available_$what_kind object "
295 void f() __attribute__((visibility(\"$what_kind\")));
300 ###############################
301 # proc check_alias_available { }
302 ###############################
304 # Determine if the target toolchain supports the alias attribute.
306 # Returns 2 if the target supports aliases. Returns 1 if the target
307 # only supports weak aliased. Returns 0 if the target does not
308 # support aliases at all. Returns -1 if support for aliases could not
311 proc check_alias_available { } {
312 global alias_available_saved
315 if [info exists alias_available_saved] {
316 verbose "check_alias_available returning saved $alias_available_saved" 2
320 verbose "check_alias_available compiling testfile $src" 2
321 set f [open $src "w"]
322 # Compile a small test program. The definition of "g" is
323 # necessary to keep the Solaris assembler from complaining
325 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
326 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
328 set lines [${tool}_target_compile $src $obj object ""]
330 remote_file build delete $obj
332 if [string match "" $lines] then {
333 # No error messages, everything is OK.
334 set alias_available_saved 2
336 if [regexp "alias definitions not supported" $lines] {
337 verbose "check_alias_available target does not support aliases" 2
339 set objformat [gcc_target_object_format]
341 if { $objformat == "elf" } {
342 verbose "check_alias_available but target uses ELF format, so it ought to" 2
343 set alias_available_saved -1
345 set alias_available_saved 0
348 if [regexp "only weak aliases are supported" $lines] {
349 verbose "check_alias_available target supports only weak aliases" 2
350 set alias_available_saved 1
352 set alias_available_saved -1
357 verbose "check_alias_available returning $alias_available_saved" 2
360 return $alias_available_saved
363 # Returns 1 if the target toolchain supports strong aliases, 0 otherwise.
365 proc check_effective_target_alias { } {
366 if { [check_alias_available] < 2 } {
373 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
375 proc check_ifunc_available { } {
376 return [check_no_compiler_messages ifunc_available object {
381 void f() __attribute__((ifunc("g")));
385 # Returns true if --gc-sections is supported on the target.
387 proc check_gc_sections_available { } {
388 global gc_sections_available_saved
391 if {![info exists gc_sections_available_saved]} {
392 # Some targets don't support gc
-sections despite whatever
's
393 # advertised by ld's options.
394 if { [istarget alpha
*-*-*]
395 ||
[istarget ia64
-*-*] } {
396 set gc_sections_available_saved
0
400 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
402 if { [board_info target
exists ldflags
]
403 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
404 set gc_sections_available_saved
0
408 # VxWorks kernel modules are relocatable objects linked with
-r
,
409 #
while RTP executables are linked with
-q
(--emit
-relocs
).
410 # Both of these options are incompatible with
--gc
-sections.
411 if { [istarget
*-*-vxworks
*] } {
412 set gc_sections_available_saved
0
416 # Check
if the
ld used by gcc supports
--gc
-sections.
417 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
418 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
419 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
420 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
421 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
422 set gc_sections_available_saved
1
424 set gc_sections_available_saved
0
427 return $gc_sections_available_saved
430 #
Return 1 if according to target_info struct and explicit target list
431 # target is supposed to support trampolines.
433 proc check_effective_target_trampolines
{ } {
434 if [target_info
exists no_trampolines
] {
437 if { [istarget avr
-*-*]
438 ||
[istarget msp430
-*-*]
439 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
440 ||
[istarget hppa64
-hp
-hpux11.23
] } {
446 #
Return 1 if according to target_info struct and explicit target list
447 # target is supposed to keep null pointer checks. This could be due to
448 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
450 proc check_effective_target_keeps_null_pointer_checks
{ } {
451 if [target_info
exists keeps_null_pointer_checks
] {
454 if { [istarget avr
-*-*] } {
460 #
Return true
if profiling is supported
on the target.
462 proc check_profiling_available
{ test_what
} {
463 global profiling_available_saved
465 verbose
"Profiling argument is <$test_what>" 1
467 # These conditions depend
on the
argument so examine them before
468 # looking at the
cache variable.
470 # Tree profiling requires TLS runtime support.
471 if { $test_what
== "-fprofile-generate" } {
472 if { ![check_effective_target_tls_runtime
] } {
477 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
478 # vendor compiler. We cannot reliably predict the directory where the
479 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
480 # necessarily find mcrt1.o even if we have it.
481 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
485 # We don't yet support profiling
for MIPS16.
486 if { [istarget mips
*-*-*]
487 && ![check_effective_target_nomips16
]
488 && ($test_what
== "-p" || $test_what == "-pg") } {
492 # MinGW does not support
-p.
493 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
497 # cygwin does not support
-p.
498 if { [istarget
*-*-cygwin
*] && $test_what
== "-p" } {
502 # uClibc does not have gcrt1.o.
503 if { [check_effective_target_uclibc
]
504 && ($test_what
== "-p" || $test_what == "-pg") } {
508 # Now examine the
cache variable.
509 if {![info exists profiling_available_saved
]} {
510 # Some targets don
't have any implementation of __bb_init_func or are
511 # missing other needed machinery.
512 if { [istarget aarch64*-*-elf]
513 || [istarget am3*-*-linux*]
514 || [istarget arm*-*-eabi*]
515 || [istarget arm*-*-elf]
516 || [istarget arm*-*-symbianelf*]
517 || [istarget avr-*-*]
518 || [istarget bfin-*-*]
519 || [istarget cris-*-*]
520 || [istarget crisv32-*-*]
521 || [istarget fido-*-elf]
522 || [istarget h8300-*-*]
523 || [istarget lm32-*-*]
524 || [istarget m32c-*-elf]
525 || [istarget m68k-*-elf]
526 || [istarget m68k-*-uclinux*]
527 || [istarget mep-*-elf]
528 || [istarget mips*-*-elf*]
529 || [istarget mmix-*-*]
530 || [istarget mn10300-*-elf*]
531 || [istarget moxie-*-elf*]
532 || [istarget msp430-*-*]
533 || [istarget nds32*-*-elf]
534 || [istarget nios2-*-elf]
535 || [istarget picochip-*-*]
536 || [istarget powerpc-*-eabi*]
537 || [istarget powerpc-*-elf]
539 || [istarget tic6x-*-elf]
540 || [istarget xstormy16-*]
541 || [istarget xtensa*-*-elf]
542 || [istarget *-*-rtems*]
543 || [istarget *-*-vxworks*] } {
544 set profiling_available_saved 0
546 set profiling_available_saved 1
550 return $profiling_available_saved
553 # Check to see if a target is "freestanding". This is as per the definition
554 # in Section 4 of C99 standard. Effectively, it is a target which supports no
555 # extra headers or libraries other than what is considered essential.
556 proc check_effective_target_freestanding { } {
557 if { [istarget picochip-*-*] } then {
564 # Return 1 if target has packed layout of structure members by
565 # default, 0 otherwise. Note that this is slightly different than
566 # whether the target has "natural alignment": both attributes may be
569 proc check_effective_target_default_packed { } {
570 return [check_no_compiler_messages default_packed assembly {
571 struct x { char a; long b; } c;
572 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
576 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
577 # documentation, where the test also comes from.
579 proc check_effective_target_pcc_bitfield_type_matters { } {
580 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
581 # bitfields
, but let
's stick to the example code from the docs.
582 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
583 struct foo1 { char x; char :0; char y; };
584 struct foo2 { char x; int :0; char y; };
585 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
589 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
591 proc add_options_for_tls { flags } {
592 # On Solaris 9, __tls_get_addr/___tls_get_addr only lives in
593 # libthread, so always pass -pthread for native TLS. Same for AIX.
594 # Need to duplicate native TLS check from
595 # check_effective_target_tls_native to avoid recursion.
596 if { ([istarget powerpc-ibm-aix*]) &&
597 [check_no_messages_and_pattern tls_native "!emutls" assembly {
599 int f (void) { return i; }
600 void g (int j) { i = j; }
602 return "$flags -pthread"
607 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
609 proc check_effective_target_tls {} {
610 return [check_no_compiler_messages tls assembly {
612 int f (void) { return i; }
613 void g (int j) { i = j; }
617 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
619 proc check_effective_target_tls_native {} {
620 # VxWorks uses emulated TLS machinery, but with non-standard helper
621 # functions, so we fail to automatically detect it.
622 if { [istarget *-*-vxworks*] } {
626 return [check_no_messages_and_pattern tls_native "!emutls" assembly {
628 int f (void) { return i; }
629 void g (int j) { i = j; }
633 # Return 1 if *emulated* thread local storage (TLS) is supported, 0 otherwise.
635 proc check_effective_target_tls_emulated {} {
636 # VxWorks uses emulated TLS machinery, but with non-standard helper
637 # functions, so we fail to automatically detect it.
638 if { [istarget *-*-vxworks*] } {
642 return [check_no_messages_and_pattern tls_emulated "emutls" assembly {
644 int f (void) { return i; }
645 void g (int j) { i = j; }
649 # Return 1 if TLS executables can run correctly, 0 otherwise.
651 proc check_effective_target_tls_runtime {} {
652 # MSP430 runtime does not have TLS support, but just
653 # running the test below is insufficient to show this.
654 if { [istarget msp430-*-*] } {
657 return [check_runtime tls_runtime {
658 __thread int thr = 0;
659 int main (void) { return thr; }
660 } [add_options_for_tls ""]]
663 # Return 1 if atomic compare-and-swap is supported on 'int'
665 proc check_effective_target_cas_char {} {
666 return [check_no_compiler_messages cas_char assembly {
667 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
673 proc check_effective_target_cas_int {} {
674 return [check_no_compiler_messages cas_int assembly {
675 #if __INT_MAX__ == 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
677 #elif __INT_MAX__ == 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
685 # Return 1 if -ffunction-sections is supported, 0 otherwise.
687 proc check_effective_target_function_sections {} {
688 # Darwin has its own scheme and silently accepts -ffunction-sections.
689 if { [istarget *-*-darwin*] } {
693 return [check_no_compiler_messages functionsections assembly {
695 } "-ffunction-sections"]
698 # Return 1 if instruction scheduling is available, 0 otherwise.
700 proc check_effective_target_scheduling {} {
701 return [check_no_compiler_messages scheduling object {
703 } "-fschedule-insns"]
706 # Return 1 if trapping arithmetic is available, 0 otherwise.
708 proc check_effective_target_trapping {} {
709 return [check_no_compiler_messages trapping object {
710 add (int a, int b) { return a + b; }
714 # Return 1 if compilation with -fgraphite is error-free for trivial
717 proc check_effective_target_fgraphite {} {
718 return [check_no_compiler_messages fgraphite object {
723 # Return 1 if compilation with -fopenmp is error-free for trivial
726 proc check_effective_target_fopenmp {} {
727 return [check_no_compiler_messages fopenmp object {
732 # Return 1 if compilation with -fgnu-tm is error-free for trivial
735 proc check_effective_target_fgnu_tm {} {
736 return [check_no_compiler_messages fgnu_tm object {
741 # Return 1 if the target supports mmap, 0 otherwise.
743 proc check_effective_target_mmap {} {
744 return [check_function_available "mmap"]
747 # Return 1 if the target supports dlopen, 0 otherwise.
748 proc check_effective_target_dlopen {} {
749 return [check_no_compiler_messages dlopen executable {
751 int main(void) { dlopen ("dummy.so", RTLD_NOW); }
752 } [add_options_for_dlopen ""]]
755 proc add_options_for_dlopen { flags } {
759 # Return 1 if the target supports clone, 0 otherwise.
760 proc check_effective_target_clone {} {
761 return [check_function_available "clone"]
764 # Return 1 if the target supports setrlimit, 0 otherwise.
765 proc check_effective_target_setrlimit {} {
766 # Darwin has non-posix compliant RLIMIT_AS
767 if { [istarget *-*-darwin*] } {
770 return [check_function_available "setrlimit"]
773 # Return 1 if the target supports swapcontext, 0 otherwise.
774 proc check_effective_target_swapcontext {} {
775 return [check_no_compiler_messages swapcontext executable {
776 #include <ucontext.h>
779 ucontext_t orig_context,child_context;
780 if (swapcontext(&child_context, &orig_context) < 0) { }
785 # Return 1 if compilation with -pthread is error-free for trivial
788 proc check_effective_target_pthread {} {
789 return [check_no_compiler_messages pthread object {
794 # Return 1 if compilation with -mpe-aligned-commons is error-free
795 # for trivial code, 0 otherwise.
797 proc check_effective_target_pe_aligned_commons {} {
798 if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
799 return [check_no_compiler_messages pe_aligned_commons object {
801 } "-mpe-aligned-commons"]
806 # Return 1 if the target supports -static
807 proc check_effective_target_static {} {
808 return [check_no_compiler_messages static executable {
809 int main (void) { return 0; }
813 # Return 1 if the target supports -fstack-protector
814 proc check_effective_target_fstack_protector {} {
815 return [check_runtime fstack_protector {
816 int main (void) { return 0; }
817 } "-fstack-protector"]
820 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
821 # for trivial code, 0 otherwise.
823 proc check_effective_target_freorder {} {
824 return [check_no_compiler_messages freorder object {
826 } "-freorder-blocks-and-partition"]
829 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
830 # emitted, 0 otherwise. Whether a shared library can actually be built is
831 # out of scope for this test.
833 proc check_effective_target_fpic { } {
834 # Note that M68K has a multilib that supports -fpic but not
835 # -fPIC, so we need to check both. We test with a program that
836 # requires GOT references.
837 foreach arg {fpic fPIC} {
838 if [check_no_compiler_messages $arg object {
839 extern int foo (void); extern int bar;
840 int baz (void) { return foo () + bar; }
848 # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
850 proc check_effective_target_pie { } {
851 if { [istarget *-*-darwin\[912\]*]
852 || [istarget *-*-linux*]
853 || [istarget *-*-gnu*] } {
859 # Return true if the target supports -mpaired-single (as used on MIPS).
861 proc check_effective_target_mpaired_single { } {
862 return [check_no_compiler_messages mpaired_single object {
867 # Return true if the target has access to FPU instructions.
869 proc check_effective_target_hard_float { } {
870 if { [istarget mips*-*-*] } {
871 return [check_no_compiler_messages hard_float assembly {
872 #if (defined __mips_soft_float || defined __mips16)
878 # This proc is actually checking the availabilty of FPU
879 # support for doubles, so on the RX we must fail if the
880 # 64-bit double multilib has been selected.
881 if { [istarget rx-*-*] } {
883 # return [check_no_compiler_messages hard_float assembly {
884 #if defined __RX_64_BIT_DOUBLES__
890 # The generic test equates hard_float with "no call for adding doubles".
891 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
892 double a (double b, double c) { return b + c; }
896 # Return true if the target is a 64-bit MIPS target.
898 proc check_effective_target_mips64 { } {
899 return [check_no_compiler_messages mips64 assembly {
906 # Return true if the target is a MIPS target that does not produce
909 proc check_effective_target_nomips16 { } {
910 return [check_no_compiler_messages nomips16 object {
914 /* A cheap way of testing for -mflip-mips16. */
915 void foo (void) { asm ("addiu $20,$20,1"); }
916 void bar (void) { asm ("addiu $20,$20,1"); }
921 # Add the options needed for MIPS16 function attributes. At the moment,
922 # we don't support MIPS16 PIC.
924 proc add_options_for_mips16_attribute
{ flags
} {
925 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
928 #
Return true
if we can force a
mode that allows MIPS16 code generation.
929 # We don
't support MIPS16 PIC, and only support MIPS16 -mhard-float
932 proc check_effective_target_mips16_attribute { } {
933 return [check_no_compiler_messages mips16_attribute assembly {
937 #if defined __mips_hard_float \
938 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
939 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
942 } [add_options_for_mips16_attribute ""]]
945 # Return 1 if the target supports long double larger than double when
946 # using the new ABI, 0 otherwise.
948 proc check_effective_target_mips_newabi_large_long_double { } {
949 return [check_no_compiler_messages mips_newabi_large_long_double object {
950 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
954 # Return true if the target is a MIPS target that has access
955 # to the LL and SC instructions.
957 proc check_effective_target_mips_llsc { } {
958 if { ![istarget mips*-*-*] } {
961 # Assume that these instructions are always implemented for
962 # non-elf* targets, via emulation if necessary.
963 if { ![istarget *-*-elf*] } {
966 # Otherwise assume LL/SC support for everything but MIPS I.
967 return [check_no_compiler_messages mips_llsc assembly {
974 # Return true if the target is a MIPS target that uses in-place relocations.
976 proc check_effective_target_mips_rel { } {
977 if { ![istarget mips*-*-*] } {
980 return [check_no_compiler_messages mips_rel object {
981 #if (defined _ABIN32 && _MIPS_SIM == _ABIN32) \
982 || (defined _ABI64 && _MIPS_SIM == _ABI64)
988 # Return true if the target is a MIPS target that uses the EABI.
990 proc check_effective_target_mips_eabi { } {
991 if { ![istarget mips*-*-*] } {
994 return [check_no_compiler_messages mips_eabi object {
1001 # Return 1 if the current multilib does not generate PIC by default.
1003 proc check_effective_target_nonpic { } {
1004 return [check_no_compiler_messages nonpic assembly {
1011 # Return 1 if the target does not use a status wrapper.
1013 proc check_effective_target_unwrapped { } {
1014 if { [target_info needs_status_wrapper] != "" \
1015 && [target_info needs_status_wrapper] != "0" } {
1021 # Return true if iconv is supported on the target. In particular IBM1047.
1023 proc check_iconv_available { test_what } {
1026 # If the tool configuration file has not set libiconv, try "-liconv"
1027 if { ![info exists libiconv] } {
1028 set libiconv "-liconv"
1030 set test_what [lindex $test_what 1]
1031 return [check_runtime_nocache $test_what [subst {
1037 cd = iconv_open ("$test_what", "UTF-8");
1038 if (cd == (iconv_t) -1)
1045 # Return true if Cilk Library is supported on the target.
1046 proc check_libcilkrts_available { } {
1047 return [ check_no_compiler_messages_nocache libcilkrts_available executable {
1051 int __cilkrts_set_param (const char *, const char *);
1053 int x = __cilkrts_set_param ("nworkers", "0");
1056 } "-fcilkplus -lcilkrts" ]
1059 # Return 1 if an ASCII locale is supported on this host, 0 otherwise.
1061 proc check_ascii_locale_available { } {
1065 # Return true if named sections are supported on this target.
1067 proc check_named_sections_available { } {
1068 return [check_no_compiler_messages named_sections assembly {
1069 int __attribute__ ((section("whatever"))) foo;
1073 # Return true if the "naked" function attribute is supported on this target.
1075 proc check_effective_target_naked_functions { } {
1076 return [check_no_compiler_messages naked_functions assembly {
1077 void f() __attribute__((naked));
1081 # Return 1 if the target supports Fortran real kinds larger than real(8),
1084 # When the target name changes, replace the cached result.
1086 proc check_effective_target_fortran_large_real { } {
1087 return [check_no_compiler_messages fortran_large_real executable {
1089 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
1096 # Return 1 if the target supports Fortran real kind real(16),
1097 # 0 otherwise. Contrary to check_effective_target_fortran_large_real
1098 # this checks for Real(16) only; the other returned real(10) if
1099 # both real(10) and real(16) are available.
1101 # When the target name changes, replace the cached result.
1103 proc check_effective_target_fortran_real_16 { } {
1104 return [check_no_compiler_messages fortran_real_16 executable {
1113 # Return 1 if the target supports Fortran's IEEE modules
,
1116 # When the target
name changes
, replace the cached result.
1118 proc check_effective_target_fortran_ieee
{ flags
} {
1119 return [check_no_compiler_messages fortran_ieee executable
{
1121 use
, intrinsic
:: ieee_features
1127 #
Return 1 if the target supports
SQRT for the
largest floating
-point
1128 # type.
(Some targets lack the libm support
for this FP type.
)
1129 #
On most targets
, this check effectively checks either whether sqrtl is
1130 # available or
on __float128 systems whether libquadmath is installed
,
1131 # which provides sqrtq.
1133 # When the target
name changes
, replace the cached result.
1135 proc check_effective_target_fortran_largest_fp_has_sqrt
{ } {
1136 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable
{
1138 use iso_fortran_env
, only
: real_kinds
1139 integer,parameter
:: maxFP
= real_kinds
(ubound
(real_kinds
,dim
=1))
1140 real
(kind
=maxFP
), volatile
:: x
1148 #
Return 1 if the target supports Fortran
integer kinds larger than
1149 #
integer(8), 0 otherwise.
1151 # When the target
name changes
, replace the cached result.
1153 proc check_effective_target_fortran_large_int
{ } {
1154 return [check_no_compiler_messages fortran_large_int executable
{
1156 integer,parameter
:: k
= selected_int_kind
(range
(0_8
) + 1)
1157 integer(kind
=k
) :: i
1162 #
Return 1 if the target supports Fortran
integer(16), 0 otherwise.
1164 # When the target
name changes
, replace the cached result.
1166 proc check_effective_target_fortran_integer_16
{ } {
1167 return [check_no_compiler_messages fortran_integer_16 executable
{
1174 #
Return 1 if we can statically link libgfortran
, 0 otherwise.
1176 # When the target
name changes
, replace the cached result.
1178 proc check_effective_target_static_libgfortran
{ } {
1179 return [check_no_compiler_messages static_libgfortran executable
{
1186 #
Return 1 if cilk
-plus is supported by the target
, 0 otherwise.
1188 proc check_effective_target_cilkplus
{ } {
1189 # Skip cilk
-plus tests
on int16 and size16 targets
for now.
1190 # The cilk
-plus tests are not generic enough to cover these
1191 # cases and would throw hundreds of FAILs.
1192 if { [check_effective_target_int16
]
1193 ||
![check_effective_target_size32plus
] } {
1197 # Skip AVR
, its RAM is too small and too many tests would fail.
1198 if { [istarget avr
-*-*] } {
1204 proc check_linker_plugin_available
{ } {
1205 return [check_no_compiler_messages_nocache linker_plugin executable
{
1206 int main
() { return 0; }
1207 } "-flto -fuse-linker-plugin"]
1210 #
Return 1 if the target supports executing
750CL paired
-single instructions
, 0
1211 # otherwise.
Cache the result.
1213 proc check_750cl_hw_available
{ } {
1214 return [check_cached_effective_target
750cl_hw_available
{
1215 #
If this is not the right target
then we can skip the test.
1216 if { ![istarget powerpc
-*paired
*] } {
1219 check_runtime_nocache
750cl_hw_available
{
1223 asm volatile
("ps_mul v0,v0,v0");
1225 asm volatile
("ps_mul 0,0,0");
1234 #
Return 1 if the target OS supports running SSE executables
, 0
1235 # otherwise.
Cache the result.
1237 proc check_sse_os_support_available
{ } {
1238 return [check_cached_effective_target sse_os_support_available
{
1239 #
If this is not the right target
then we can skip the test.
1240 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1242 } elseif
{ [istarget i?
86-*-solaris2
*] } {
1243 # The Solaris
2 kernel doesn
't save and restore SSE registers
1244 # before Solaris 9 4/04. Before that, executables die with SIGILL.
1245 check_runtime_nocache sse_os_support_available {
1248 asm volatile ("movaps %xmm0,%xmm0");
1258 # Return 1 if the target OS supports running AVX executables, 0
1259 # otherwise. Cache the result.
1261 proc check_avx_os_support_available { } {
1262 return [check_cached_effective_target avx_os_support_available {
1263 # If this is not the right target then we can skip the test.
1264 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1267 # Check that OS has AVX and SSE saving enabled.
1268 check_runtime_nocache avx_os_support_available {
1271 unsigned int eax, edx;
1273 asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1274 return (eax & 6) != 6;
1281 # Return 1 if the target supports executing SSE instructions, 0
1282 # otherwise. Cache the result.
1284 proc check_sse_hw_available { } {
1285 return [check_cached_effective_target sse_hw_available {
1286 # If this is not the right target then we can skip the test.
1287 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1290 check_runtime_nocache sse_hw_available {
1294 unsigned int eax, ebx, ecx, edx;
1295 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1296 return !(edx & bit_SSE);
1304 # Return 1 if the target supports executing SSE2 instructions, 0
1305 # otherwise. Cache the result.
1307 proc check_sse2_hw_available { } {
1308 return [check_cached_effective_target sse2_hw_available {
1309 # If this is not the right target then we can skip the test.
1310 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1313 check_runtime_nocache sse2_hw_available {
1317 unsigned int eax, ebx, ecx, edx;
1318 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1319 return !(edx & bit_SSE2);
1327 # Return 1 if the target supports executing AVX instructions, 0
1328 # otherwise. Cache the result.
1330 proc check_avx_hw_available { } {
1331 return [check_cached_effective_target avx_hw_available {
1332 # If this is not the right target then we can skip the test.
1333 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1336 check_runtime_nocache avx_hw_available {
1340 unsigned int eax, ebx, ecx, edx;
1341 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1342 return ((ecx & (bit_AVX | bit_OSXSAVE))
1343 != (bit_AVX | bit_OSXSAVE));
1351 # Return 1 if the target supports running SSE executables, 0 otherwise.
1353 proc check_effective_target_sse_runtime { } {
1354 if { [check_effective_target_sse]
1355 && [check_sse_hw_available]
1356 && [check_sse_os_support_available] } {
1362 # Return 1 if the target supports running SSE2 executables, 0 otherwise.
1364 proc check_effective_target_sse2_runtime { } {
1365 if { [check_effective_target_sse2]
1366 && [check_sse2_hw_available]
1367 && [check_sse_os_support_available] } {
1373 # Return 1 if the target supports running AVX executables, 0 otherwise.
1375 proc check_effective_target_avx_runtime { } {
1376 if { [check_effective_target_avx]
1377 && [check_avx_hw_available]
1378 && [check_avx_os_support_available] } {
1384 # Return 1 if the target supports executing power8 vector instructions, 0
1385 # otherwise. Cache the result.
1387 proc check_p8vector_hw_available { } {
1388 return [check_cached_effective_target p8vector_hw_available {
1389 # Some simulators are known to not support VSX/power8 instructions.
1390 # For now, disable on Darwin
1391 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1394 set options "-mpower8-vector"
1395 check_runtime_nocache p8vector_hw_available {
1399 asm volatile ("xxlorc vs0,vs0,vs0");
1401 asm volatile ("xxlorc 0,0,0");
1410 # Return 1 if the target supports executing VSX instructions, 0
1411 # otherwise. Cache the result.
1413 proc check_vsx_hw_available { } {
1414 return [check_cached_effective_target vsx_hw_available {
1415 # Some simulators are known to not support VSX instructions.
1416 # For now, disable on Darwin
1417 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1421 check_runtime_nocache vsx_hw_available {
1425 asm volatile ("xxlor vs0,vs0,vs0");
1427 asm volatile ("xxlor 0,0,0");
1436 # Return 1 if the target supports executing AltiVec instructions, 0
1437 # otherwise. Cache the result.
1439 proc check_vmx_hw_available { } {
1440 return [check_cached_effective_target vmx_hw_available {
1441 # Some simulators are known to not support VMX instructions.
1442 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
1445 # Most targets don't require special flags
for this test case
, but
1446 # Darwin does. Just to be sure
, make sure VSX is not enabled
for
1447 # the altivec tests.
1448 if { [istarget
*-*-darwin
*]
1449 ||
[istarget
*-*-aix
*] } {
1450 set options
"-maltivec -mno-vsx"
1452 set options
"-mno-vsx"
1454 check_runtime_nocache vmx_hw_available
{
1458 asm volatile
("vor v0,v0,v0");
1460 asm volatile
("vor 0,0,0");
1469 proc check_ppc_recip_hw_available
{ } {
1470 return [check_cached_effective_target ppc_recip_hw_available
{
1471 # Some simulators may not support FRE
/FRES
/FRSQRTE
/FRSQRTES
1472 #
For now
, disable
on Darwin
1473 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1476 set options
"-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1477 check_runtime_nocache ppc_recip_hw_available
{
1478 volatile double d_recip
, d_rsqrt
, d_four
= 4.0;
1479 volatile float f_recip
, f_rsqrt
, f_four
= 4.0f
;
1482 asm volatile
("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1483 asm volatile
("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1484 asm volatile
("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1485 asm volatile
("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1493 #
Return 1 if the target supports executing AltiVec and Cell PPU
1494 # instructions
, 0 otherwise.
Cache the result.
1496 proc check_effective_target_cell_hw
{ } {
1497 return [check_cached_effective_target cell_hw_available
{
1498 # Some simulators are known to not support VMX and PPU instructions.
1499 if { [istarget powerpc
-*-eabi
*] } {
1502 # Most targets don
't require special flags for this test
1503 # case, but Darwin and AIX do.
1504 if { [istarget *-*-darwin*]
1505 || [istarget *-*-aix*] } {
1506 set options "-maltivec -mcpu=cell"
1508 set options "-mcpu=cell"
1510 check_runtime_nocache cell_hw_available {
1514 asm volatile ("vor v0,v0,v0");
1515 asm volatile ("lvlx v0,r0,r0");
1517 asm volatile ("vor 0,0,0");
1518 asm volatile ("lvlx 0,0,0");
1527 # Return 1 if the target supports executing 64-bit instructions, 0
1528 # otherwise. Cache the result.
1530 proc check_effective_target_powerpc64 { } {
1531 global powerpc64_available_saved
1534 if [info exists powerpc64_available_saved] {
1535 verbose "check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1537 set powerpc64_available_saved 0
1539 # Some simulators are known to not support powerpc64 instructions.
1540 if { [istarget powerpc-*-eabi*] || [istarget powerpc-ibm-aix*] } {
1541 verbose "check_effective_target_powerpc64 returning 0" 2
1542 return $powerpc64_available_saved
1545 # Set up, compile, and execute a test program containing a 64-bit
1546 # instruction. Include the current process ID in the file
1547 # names to prevent conflicts with invocations for multiple
1552 set f [open $src "w"]
1553 puts $f "int main() {"
1554 puts $f "#ifdef __MACH__"
1555 puts $f " asm volatile (\"extsw r0,r0\");"
1557 puts $f " asm volatile (\"extsw 0,0\");"
1559 puts $f " return 0; }"
1562 set opts "additional_flags=-mcpu=G5"
1564 verbose "check_effective_target_powerpc64 compiling testfile $src" 2
1565 set lines [${tool}_target_compile $src $exe executable "$opts"]
1568 if [string match "" $lines] then {
1569 # No error message, compilation succeeded.
1570 set result [${tool}_load "./$exe" "" ""]
1571 set status [lindex $result 0]
1572 remote_file build delete $exe
1573 verbose "check_effective_target_powerpc64 testfile status is <$status>" 2
1575 if { $status == "pass" } then {
1576 set powerpc64_available_saved 1
1579 verbose "check_effective_target_powerpc64 testfile compilation failed" 2
1583 return $powerpc64_available_saved
1586 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
1587 # complex float arguments. This affects gfortran tests that call cabsf
1588 # in libm built by an earlier compiler. Return 1 if libm uses the same
1589 # argument passing as the compiler under test, 0 otherwise.
1591 # When the target name changes, replace the cached result.
1593 proc check_effective_target_broken_cplxf_arg { } {
1594 return [check_cached_effective_target broken_cplxf_arg {
1595 # Skip the work for targets known not to be affected.
1596 if { ![istarget powerpc64-*-linux*] } {
1598 } elseif { ![is-effective-target lp64] } {
1601 check_runtime_nocache broken_cplxf_arg {
1602 #include <complex.h>
1603 extern void abort (void);
1604 float fabsf (float);
1605 float cabsf (_Complex float);
1612 if (fabsf (f - 5.0) > 0.0001)
1621 # Return 1 is this is a TI C6X target supporting C67X instructions
1622 proc check_effective_target_ti_c67x { } {
1623 return [check_no_compiler_messages ti_c67x assembly {
1624 #if !defined(_TMS320C6700)
1630 # Return 1 is this is a TI C6X target supporting C64X+ instructions
1631 proc check_effective_target_ti_c64xp { } {
1632 return [check_no_compiler_messages ti_c64xp assembly {
1633 #if !defined(_TMS320C6400_PLUS)
1640 proc check_alpha_max_hw_available { } {
1641 return [check_runtime alpha_max_hw_available {
1642 int main() { return __builtin_alpha_amask(1<<8) != 0; }
1646 # Returns true iff the FUNCTION is available on the target system.
1647 # (This is essentially a Tcl implementation of Autoconf's
1650 proc check_function_available
{ function
} {
1651 return [check_no_compiler_messages $
{function
}_available \
1657 int main
() { $function
(); }
1661 # Returns true iff
"fork" is available on the target system.
1663 proc check_fork_available
{} {
1664 return [check_function_available
"fork"]
1667 # Returns true iff
"mkfifo" is available on the target system.
1669 proc check_mkfifo_available
{} {
1670 if { [istarget
*-*-cygwin
*] } {
1671 # Cygwin has mkfifo
, but support is incomplete.
1675 return [check_function_available
"mkfifo"]
1678 # Returns true iff
"__cxa_atexit" is used on the target system.
1680 proc check_cxa_atexit_available
{ } {
1681 return [check_cached_effective_target cxa_atexit_available
{
1682 if { [istarget hppa
*-*-hpux10
*] } {
1683 # HP
-UX
10 doesn
't have __cxa_atexit but subsequent test passes.
1685 } elseif { [istarget *-*-vxworks] } {
1686 # vxworks doesn't have __cxa_atexit but subsequent test passes.
1689 check_runtime_nocache cxa_atexit_available
{
1692 static unsigned
int count;
1709 Y
() { f
(); count = 2; }
1718 int main
() { return 0; }
1724 proc check_effective_target_objc2
{ } {
1725 return [check_no_compiler_messages objc2 object
{
1734 proc check_effective_target_next_runtime
{ } {
1735 return [check_no_compiler_messages objc2 object
{
1736 #ifdef __NEXT_RUNTIME__
1744 #
Return 1 if we
're generating 32-bit code using default options, 0
1747 proc check_effective_target_ilp32 { } {
1748 return [check_no_compiler_messages ilp32 object {
1749 int dummy[sizeof (int) == 4
1750 && sizeof (void *) == 4
1751 && sizeof (long) == 4 ? 1 : -1];
1755 # Return 1 if we're generating ia32 code using default options
, 0
1758 proc check_effective_target_ia32
{ } {
1759 return [check_no_compiler_messages ia32 object
{
1760 int dummy
[sizeof
(int) == 4
1761 && sizeof
(void
*) == 4
1762 && sizeof
(long
) == 4 ?
1 : -1] = { __i386__
};
1766 #
Return 1 if we
're generating x32 code using default options, 0
1769 proc check_effective_target_x32 { } {
1770 return [check_no_compiler_messages x32 object {
1771 int dummy[sizeof (int) == 4
1772 && sizeof (void *) == 4
1773 && sizeof (long) == 4 ? 1 : -1] = { __x86_64__ };
1777 # Return 1 if we're generating
32-bit integers using default
1778 # options
, 0 otherwise.
1780 proc check_effective_target_int32
{ } {
1781 return [check_no_compiler_messages int32 object
{
1782 int dummy
[sizeof
(int) == 4 ?
1 : -1];
1786 #
Return 1 if we
're generating 32-bit or larger integers using default
1787 # options, 0 otherwise.
1789 proc check_effective_target_int32plus { } {
1790 return [check_no_compiler_messages int32plus object {
1791 int dummy[sizeof (int) >= 4 ? 1 : -1];
1795 # Return 1 if we're generating
32-bit or larger pointers using default
1796 # options
, 0 otherwise.
1798 proc check_effective_target_ptr32plus
{ } {
1799 # The msp430 has
16-bit or
20-bit pointers. The
20-bit pointer is stored
1800 # in a
32-bit slot when in memory
, so sizeof
(void
*) returns
4, but it
1801 # cannot really hold a
32-bit address
, so we always
return false here.
1802 if { [istarget msp430
-*-*] } {
1806 return [check_no_compiler_messages ptr32plus object
{
1807 int dummy
[sizeof
(void
*) >= 4 ?
1 : -1];
1811 #
Return 1 if we support
32-bit or larger array and structure sizes
1812 # using default options
, 0 otherwise. Avoid false positive
on
1813 # targets with
20 or
24 bit address spaces.
1815 proc check_effective_target_size32plus
{ } {
1816 return [check_no_compiler_messages size32plus object
{
1817 char dummy
[16777217L];
1821 # Returns
1 if we
're generating 16-bit or smaller integers with the
1822 # default options, 0 otherwise.
1824 proc check_effective_target_int16 { } {
1825 return [check_no_compiler_messages int16 object {
1826 int dummy[sizeof (int) < 4 ? 1 : -1];
1830 # Return 1 if we're generating
64-bit code using default options
, 0
1833 proc check_effective_target_lp64
{ } {
1834 return [check_no_compiler_messages lp64 object
{
1835 int dummy
[sizeof
(int) == 4
1836 && sizeof
(void
*) == 8
1837 && sizeof
(long
) == 8 ?
1 : -1];
1841 #
Return 1 if we
're generating 64-bit code using default llp64 options,
1844 proc check_effective_target_llp64 { } {
1845 return [check_no_compiler_messages llp64 object {
1846 int dummy[sizeof (int) == 4
1847 && sizeof (void *) == 8
1848 && sizeof (long long) == 8
1849 && sizeof (long) == 4 ? 1 : -1];
1853 # Return 1 if long and int have different sizes,
1856 proc check_effective_target_long_neq_int { } {
1857 return [check_no_compiler_messages long_ne_int object {
1858 int dummy[sizeof (int) != sizeof (long) ? 1 : -1];
1862 # Return 1 if the target supports long double larger than double,
1865 proc check_effective_target_large_long_double { } {
1866 return [check_no_compiler_messages large_long_double object {
1867 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
1871 # Return 1 if the target supports double larger than float,
1874 proc check_effective_target_large_double { } {
1875 return [check_no_compiler_messages large_double object {
1876 int dummy[sizeof(double) > sizeof(float) ? 1 : -1];
1880 # Return 1 if the target supports long double of 128 bits,
1883 proc check_effective_target_longdouble128 { } {
1884 return [check_no_compiler_messages longdouble128 object {
1885 int dummy[sizeof(long double) == 16 ? 1 : -1];
1889 # Return 1 if the target supports double of 64 bits,
1892 proc check_effective_target_double64 { } {
1893 return [check_no_compiler_messages double64 object {
1894 int dummy[sizeof(double) == 8 ? 1 : -1];
1898 # Return 1 if the target supports double of at least 64 bits,
1901 proc check_effective_target_double64plus { } {
1902 return [check_no_compiler_messages double64plus object {
1903 int dummy[sizeof(double) >= 8 ? 1 : -1];
1907 # Return 1 if the target supports 'w
' suffix on floating constant
1910 proc check_effective_target_has_w_floating_suffix { } {
1912 if [check_effective_target_c++] {
1913 append opts "-std=gnu++03"
1915 return [check_no_compiler_messages w_fp_suffix object {
1920 # Return 1 if the target supports 'q
' suffix on floating constant
1923 proc check_effective_target_has_q_floating_suffix { } {
1925 if [check_effective_target_c++] {
1926 append opts "-std=gnu++03"
1928 return [check_no_compiler_messages q_fp_suffix object {
1932 # Return 1 if the target supports compiling fixed-point,
1935 proc check_effective_target_fixed_point { } {
1936 return [check_no_compiler_messages fixed_point object {
1937 _Sat _Fract x; _Sat _Accum y;
1941 # Return 1 if the target supports compiling decimal floating point,
1944 proc check_effective_target_dfp_nocache { } {
1945 verbose "check_effective_target_dfp_nocache: compiling source" 2
1946 set ret [check_no_compiler_messages_nocache dfp object {
1947 float x __attribute__((mode(DD)));
1949 verbose "check_effective_target_dfp_nocache: returning $ret" 2
1953 proc check_effective_target_dfprt_nocache { } {
1954 return [check_runtime_nocache dfprt {
1955 typedef float d64 __attribute__((mode(DD)));
1956 d64 x = 1.2df, y = 2.3dd, z;
1957 int main () { z = x + y; return 0; }
1961 # Return 1 if the target supports compiling Decimal Floating Point,
1964 # This won't change
for different subtargets so
cache the result.
1966 proc check_effective_target_dfp
{ } {
1967 return [check_cached_effective_target dfp
{
1968 check_effective_target_dfp_nocache
1972 #
Return 1 if the target supports linking and executing Decimal Floating
1973 # Point
, 0 otherwise.
1975 # This won
't change for different subtargets so cache the result.
1977 proc check_effective_target_dfprt { } {
1978 return [check_cached_effective_target dfprt {
1979 check_effective_target_dfprt_nocache
1983 # Return 1 if the target supports executing DFP hardware instructions,
1984 # 0 otherwise. Cache the result.
1986 proc check_dfp_hw_available { } {
1987 return [check_cached_effective_target dfp_hw_available {
1988 # For now, disable on Darwin
1989 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1992 check_runtime_nocache dfp_hw_available {
1993 volatile _Decimal64 r;
1994 volatile _Decimal64 a = 4.0DD;
1995 volatile _Decimal64 b = 2.0DD;
1998 asm volatile ("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
1999 asm volatile ("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2000 asm volatile ("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2001 asm volatile ("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2004 } "-mcpu=power6 -mhard-float"
2009 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
2011 proc check_effective_target_ucn_nocache { } {
2012 # -std=c99 is only valid for C
2013 if [check_effective_target_c] {
2014 set ucnopts "-std=c99"
2016 append ucnopts " -fextended-identifiers"
2017 verbose "check_effective_target_ucn_nocache: compiling source" 2
2018 set ret [check_no_compiler_messages_nocache ucn object {
2021 verbose "check_effective_target_ucn_nocache: returning $ret" 2
2025 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
2027 # This won't change
for different subtargets
, so
cache the result.
2029 proc check_effective_target_ucn
{ } {
2030 return [check_cached_effective_target ucn
{
2031 check_effective_target_ucn_nocache
2035 #
Return 1 if the target needs a command line
argument to enable a SIMD
2038 proc check_effective_target_vect_cmdline_needed
{ } {
2039 global et_vect_cmdline_needed_saved
2040 global et_vect_cmdline_needed_target_name
2042 if { ![info exists et_vect_cmdline_needed_target_name
] } {
2043 set et_vect_cmdline_needed_target_name
""
2046 #
If the target has changed since we
set the cached value
, clear it.
2047 set current_target
[current_target_name
]
2048 if { $current_target
!= $et_vect_cmdline_needed_target_name
} {
2049 verbose
"check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2
2050 set et_vect_cmdline_needed_target_name $current_target
2051 if { [info exists et_vect_cmdline_needed_saved
] } {
2052 verbose
"check_effective_target_vect_cmdline_needed: removing cached result" 2
2053 unset et_vect_cmdline_needed_saved
2057 if [info exists et_vect_cmdline_needed_saved
] {
2058 verbose
"check_effective_target_vect_cmdline_needed: using cached result" 2
2060 set et_vect_cmdline_needed_saved
1
2061 if { [istarget alpha
*-*-*]
2062 ||
[istarget ia64
-*-*]
2063 ||
(([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
2064 && ([check_effective_target_x32
]
2065 ||
[check_effective_target_lp64
]))
2066 ||
([istarget powerpc
*-*-*]
2067 && ([check_effective_target_powerpc_spe
]
2068 ||
[check_effective_target_powerpc_altivec
]))
2069 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_vis
])
2070 ||
[istarget spu
-*-*]
2071 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon
])
2072 ||
[istarget aarch64
*-*-*] } {
2073 set et_vect_cmdline_needed_saved
0
2077 verbose
"check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2078 return $et_vect_cmdline_needed_saved
2081 #
Return 1 if the target supports hardware vectors of
int, 0 otherwise.
2083 # This won
't change for different subtargets so cache the result.
2085 proc check_effective_target_vect_int { } {
2086 global et_vect_int_saved
2088 if [info exists et_vect_int_saved] {
2089 verbose "check_effective_target_vect_int: using cached result" 2
2091 set et_vect_int_saved 0
2092 if { [istarget i?86-*-*]
2093 || ([istarget powerpc*-*-*]
2094 && ![istarget powerpc-*-linux*paired*])
2095 || [istarget spu-*-*]
2096 || [istarget x86_64-*-*]
2097 || [istarget sparc*-*-*]
2098 || [istarget alpha*-*-*]
2099 || [istarget ia64-*-*]
2100 || [istarget aarch64*-*-*]
2101 || [check_effective_target_arm32]
2102 || ([istarget mips*-*-*]
2103 && [check_effective_target_mips_loongson]) } {
2104 set et_vect_int_saved 1
2108 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
2109 return $et_vect_int_saved
2112 # Return 1 if the target supports signed int->float conversion
2115 proc check_effective_target_vect_intfloat_cvt { } {
2116 global et_vect_intfloat_cvt_saved
2118 if [info exists et_vect_intfloat_cvt_saved] {
2119 verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
2121 set et_vect_intfloat_cvt_saved 0
2122 if { [istarget i?86-*-*]
2123 || ([istarget powerpc*-*-*]
2124 && ![istarget powerpc-*-linux*paired*])
2125 || [istarget x86_64-*-*]
2126 || ([istarget arm*-*-*]
2127 && [check_effective_target_arm_neon_ok])} {
2128 set et_vect_intfloat_cvt_saved 1
2132 verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2133 return $et_vect_intfloat_cvt_saved
2136 #Return 1 if we're supporting __int128
for target
, 0 otherwise.
2138 proc check_effective_target_int128
{ } {
2139 return [check_no_compiler_messages int128 object
{
2141 #ifndef __SIZEOF_INT128__
2150 #
Return 1 if the target supports unsigned
int->float conversion
2153 proc check_effective_target_vect_uintfloat_cvt
{ } {
2154 global et_vect_uintfloat_cvt_saved
2156 if [info exists et_vect_uintfloat_cvt_saved
] {
2157 verbose
"check_effective_target_vect_uintfloat_cvt: using cached result" 2
2159 set et_vect_uintfloat_cvt_saved
0
2160 if { [istarget i?
86-*-*]
2161 ||
([istarget powerpc
*-*-*]
2162 && ![istarget powerpc
-*-linux
*paired
*])
2163 ||
[istarget x86_64
-*-*]
2164 ||
[istarget aarch64
*-*-*]
2165 ||
([istarget arm
*-*-*]
2166 && [check_effective_target_arm_neon_ok
])} {
2167 set et_vect_uintfloat_cvt_saved
1
2171 verbose
"check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2172 return $et_vect_uintfloat_cvt_saved
2176 #
Return 1 if the target supports signed float
->int conversion
2179 proc check_effective_target_vect_floatint_cvt
{ } {
2180 global et_vect_floatint_cvt_saved
2182 if [info exists et_vect_floatint_cvt_saved
] {
2183 verbose
"check_effective_target_vect_floatint_cvt: using cached result" 2
2185 set et_vect_floatint_cvt_saved
0
2186 if { [istarget i?
86-*-*]
2187 ||
([istarget powerpc
*-*-*]
2188 && ![istarget powerpc
-*-linux
*paired
*])
2189 ||
[istarget x86_64
-*-*]
2190 ||
([istarget arm
*-*-*]
2191 && [check_effective_target_arm_neon_ok
])} {
2192 set et_vect_floatint_cvt_saved
1
2196 verbose
"check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2197 return $et_vect_floatint_cvt_saved
2200 #
Return 1 if the target supports unsigned float
->int conversion
2203 proc check_effective_target_vect_floatuint_cvt
{ } {
2204 global et_vect_floatuint_cvt_saved
2206 if [info exists et_vect_floatuint_cvt_saved
] {
2207 verbose
"check_effective_target_vect_floatuint_cvt: using cached result" 2
2209 set et_vect_floatuint_cvt_saved
0
2210 if { ([istarget powerpc
*-*-*]
2211 && ![istarget powerpc
-*-linux
*paired
*])
2212 ||
([istarget arm
*-*-*]
2213 && [check_effective_target_arm_neon_ok
])} {
2214 set et_vect_floatuint_cvt_saved
1
2218 verbose
"check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2219 return $et_vect_floatuint_cvt_saved
2222 #
Return 1 if the target supports #pragma omp declare simd
, 0 otherwise.
2224 # This won
't change for different subtargets so cache the result.
2226 proc check_effective_target_vect_simd_clones { } {
2227 global et_vect_simd_clones_saved
2229 if [info exists et_vect_simd_clones_saved] {
2230 verbose "check_effective_target_vect_simd_clones: using cached result" 2
2232 set et_vect_simd_clones_saved 0
2233 if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
2234 # On i?86/x86_64 #pragma omp declare simd builds a sse2, avx and
2235 # avx2 clone. Only the right clone for the specified arch will be
2236 # chosen, but still we need to at least be able to assemble
2238 if { [check_effective_target_avx2] } {
2239 set et_vect_simd_clones_saved 1
2244 verbose "check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2245 return $et_vect_simd_clones_saved
2248 # Return 1 if this is a AArch64 target supporting big endian
2249 proc check_effective_target_aarch64_big_endian { } {
2250 return [check_no_compiler_messages aarch64_big_endian assembly {
2251 #if !defined(__aarch64__) || !defined(__AARCH64EB__)
2257 # Return 1 if this is a AArch64 target supporting little endian
2258 proc check_effective_target_aarch64_little_endian { } {
2259 return [check_no_compiler_messages aarch64_little_endian assembly {
2260 #if !defined(__aarch64__) || defined(__AARCH64EB__)
2266 # Return 1 if this is an arm target using 32-bit instructions
2267 proc check_effective_target_arm32 { } {
2268 return [check_no_compiler_messages arm32 assembly {
2269 #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
2275 # Return 1 if this is an arm target not using Thumb
2276 proc check_effective_target_arm_nothumb { } {
2277 return [check_no_compiler_messages arm_nothumb assembly {
2278 #if !defined(__arm__) || (defined(__thumb__) || defined(__thumb2__))
2284 # Return 1 if this is a little-endian ARM target
2285 proc check_effective_target_arm_little_endian { } {
2286 return [check_no_compiler_messages arm_little_endian assembly {
2287 #if !defined(__arm__) || !defined(__ARMEL__)
2293 # Return 1 if this is an ARM target that only supports aligned vector accesses
2294 proc check_effective_target_arm_vect_no_misalign { } {
2295 return [check_no_compiler_messages arm_vect_no_misalign assembly {
2296 #if !defined(__arm__) \
2297 || (defined(__ARMEL__) \
2298 && (!defined(__thumb__) || defined(__thumb2__)))
2305 # Return 1 if this is an ARM target supporting -mfpu=vfp
2306 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
2309 proc check_effective_target_arm_vfp_ok { } {
2310 if { [check_effective_target_arm32] } {
2311 return [check_no_compiler_messages arm_vfp_ok object {
2313 } "-mfpu=vfp -mfloat-abi=softfp"]
2319 # Return 1 if this is an ARM target supporting -mfpu=vfp3
2320 # -mfloat-abi=softfp.
2322 proc check_effective_target_arm_vfp3_ok { } {
2323 if { [check_effective_target_arm32] } {
2324 return [check_no_compiler_messages arm_vfp3_ok object {
2326 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2332 # Return 1 if this is an ARM target supporting -mfpu=fp-armv8
2333 # -mfloat-abi=softfp.
2334 proc check_effective_target_arm_v8_vfp_ok {} {
2335 if { [check_effective_target_arm32] } {
2336 return [check_no_compiler_messages arm_v8_vfp_ok object {
2339 __asm__ volatile ("vrinta.f32.f32 s0, s0");
2342 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2348 # Return 1 if this is an ARM target supporting -mfpu=vfp
2349 # -mfloat-abi=hard. Some multilibs may be incompatible with these
2352 proc check_effective_target_arm_hard_vfp_ok { } {
2353 if { [check_effective_target_arm32]
2354 && ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2355 return [check_no_compiler_messages arm_hard_vfp_ok executable {
2356 int main() { return 0;}
2357 } "-mfpu=vfp -mfloat-abi=hard"]
2363 # Return 1 if this is an ARM target that supports DSP multiply with
2364 # current multilib flags.
2366 proc check_effective_target_arm_dsp { } {
2367 return [check_no_compiler_messages arm_dsp assembly {
2368 #ifndef __ARM_FEATURE_DSP
2375 # Return 1 if this is an ARM target that supports unaligned word/halfword
2376 # load/store instructions.
2378 proc check_effective_target_arm_unaligned { } {
2379 return [check_no_compiler_messages arm_unaligned assembly {
2380 #ifndef __ARM_FEATURE_UNALIGNED
2381 #error no unaligned support
2387 # Return 1 if this is an ARM target supporting -mfpu=crypto-neon-fp-armv8
2388 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2389 # incompatible with these options. Also set et_arm_crypto_flags to the
2390 # best options to add.
2392 proc check_effective_target_arm_crypto_ok_nocache { } {
2393 global et_arm_crypto_flags
2394 set et_arm_crypto_flags ""
2395 if { [check_effective_target_arm32] } {
2396 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2397 if { [check_no_compiler_messages_nocache arm_crypto_ok object {
2398 #include "arm_neon.h"
2400 foo (uint8x16_t a, uint8x16_t b)
2402 return vaeseq_u8 (a, b);
2405 set et_arm_crypto_flags $flags
2414 # Return 1 if this is an ARM target supporting -mfpu=crypto-neon-fp-armv8
2416 proc check_effective_target_arm_crypto_ok { } {
2417 return [check_cached_effective_target arm_crypto_ok \
2418 check_effective_target_arm_crypto_ok_nocache]
2421 # Add options for crypto extensions.
2422 proc add_options_for_arm_crypto { flags } {
2423 if { ! [check_effective_target_arm_crypto_ok] } {
2426 global et_arm_crypto_flags
2427 return "$flags $et_arm_crypto_flags"
2430 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2431 # or -mfloat-abi=hard, but if one is already specified by the
2432 # multilib, use it. Similarly, if a -mfpu option already enables
2433 # NEON, do not add -mfpu=neon.
2435 proc add_options_for_arm_neon { flags } {
2436 if { ! [check_effective_target_arm_neon_ok] } {
2439 global et_arm_neon_flags
2440 return "$flags $et_arm_neon_flags"
2443 proc add_options_for_arm_v8_vfp { flags } {
2444 if { ! [check_effective_target_arm_v8_vfp_ok] } {
2447 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2450 proc add_options_for_arm_v8_neon { flags } {
2451 if { ! [check_effective_target_arm_v8_neon_ok] } {
2454 global et_arm_v8_neon_flags
2455 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2458 proc add_options_for_arm_crc { flags } {
2459 if { ! [check_effective_target_arm_crc_ok] } {
2462 global et_arm_crc_flags
2463 return "$flags $et_arm_crc_flags"
2466 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2467 # or -mfloat-abi=hard, but if one is already specified by the
2468 # multilib, use it. Similarly, if a -mfpu option already enables
2469 # NEON, do not add -mfpu=neon.
2471 proc add_options_for_arm_neonv2 { flags } {
2472 if { ! [check_effective_target_arm_neonv2_ok] } {
2475 global et_arm_neonv2_flags
2476 return "$flags $et_arm_neonv2_flags"
2479 # Add the options needed for vfp3.
2480 proc add_options_for_arm_vfp3 { flags } {
2481 if { ! [check_effective_target_arm_vfp3_ok] } {
2484 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2487 # Return 1 if this is an ARM target supporting -mfpu=neon
2488 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2489 # incompatible with these options. Also set et_arm_neon_flags to the
2490 # best options to add.
2492 proc check_effective_target_arm_neon_ok_nocache { } {
2493 global et_arm_neon_flags
2494 set et_arm_neon_flags ""
2495 if { [check_effective_target_arm32] } {
2496 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2497 if { [check_no_compiler_messages_nocache arm_neon_ok object {
2498 #include "arm_neon.h"
2501 set et_arm_neon_flags $flags
2510 proc check_effective_target_arm_neon_ok { } {
2511 return [check_cached_effective_target arm_neon_ok \
2512 check_effective_target_arm_neon_ok_nocache]
2515 proc check_effective_target_arm_crc_ok_nocache { } {
2516 global et_arm_crc_flags
2517 set et_arm_crc_flags "-march=armv8-a+crc"
2518 return [check_no_compiler_messages_nocache arm_crc_ok object {
2519 #if !defined (__ARM_FEATURE_CRC32)
2522 } "$et_arm_crc_flags"]
2525 proc check_effective_target_arm_crc_ok { } {
2526 return [check_cached_effective_target arm_crc_ok \
2527 check_effective_target_arm_crc_ok_nocache]
2530 # Return 1 if this is an ARM target supporting -mfpu=neon-fp16
2531 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2532 # incompatible with these options. Also set et_arm_neon_flags to the
2533 # best options to add.
2535 proc check_effective_target_arm_neon_fp16_ok_nocache { } {
2536 global et_arm_neon_fp16_flags
2537 set et_arm_neon_fp16_flags ""
2538 if { [check_effective_target_arm32] } {
2539 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2540 "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
2541 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object {
2542 #include "arm_neon.h"
2544 foo (float32x4_t arg)
2546 return vcvt_f16_f32 (arg);
2549 set et_arm_neon_fp16_flags $flags
2558 proc check_effective_target_arm_neon_fp16_ok { } {
2559 return [check_cached_effective_target arm_neon_fp16_ok \
2560 check_effective_target_arm_neon_fp16_ok_nocache]
2563 proc add_options_for_arm_neon_fp16 { flags } {
2564 if { ! [check_effective_target_arm_neon_fp16_ok] } {
2567 global et_arm_neon_fp16_flags
2568 return "$flags $et_arm_neon_fp16_flags"
2571 # Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8
2572 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2573 # incompatible with these options. Also set et_arm_v8_neon_flags to the
2574 # best options to add.
2576 proc check_effective_target_arm_v8_neon_ok_nocache { } {
2577 global et_arm_v8_neon_flags
2578 set et_arm_v8_neon_flags ""
2579 if { [check_effective_target_arm32] } {
2580 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2581 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
2583 #error not armv8 or later
2585 #include "arm_neon.h"
2589 __asm__ volatile ("vrintn.f32 q0, q0");
2591 } "$flags -march=armv8-a"] } {
2592 set et_arm_v8_neon_flags $flags
2601 proc check_effective_target_arm_v8_neon_ok { } {
2602 return [check_cached_effective_target arm_v8_neon_ok \
2603 check_effective_target_arm_v8_neon_ok_nocache]
2606 # Return 1 if this is an ARM target supporting -mfpu=neon-vfpv4
2607 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2608 # incompatible with these options. Also set et_arm_neonv2_flags to the
2609 # best options to add.
2611 proc check_effective_target_arm_neonv2_ok_nocache { } {
2612 global et_arm_neonv2_flags
2613 set et_arm_neonv2_flags ""
2614 if { [check_effective_target_arm32] } {
2615 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2616 if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
2617 #include "arm_neon.h"
2619 foo (float32x2_t a, float32x2_t b, float32x2_t c)
2621 return vfma_f32 (a, b, c);
2624 set et_arm_neonv2_flags $flags
2633 proc check_effective_target_arm_neonv2_ok { } {
2634 return [check_cached_effective_target arm_neonv2_ok \
2635 check_effective_target_arm_neonv2_ok_nocache]
2638 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2639 # or -mfloat-abi=hard, but if one is already specified by the
2642 proc add_options_for_arm_fp16 { flags } {
2643 if { ! [check_effective_target_arm_fp16_ok] } {
2646 global et_arm_fp16_flags
2647 return "$flags $et_arm_fp16_flags"
2650 # Return 1 if this is an ARM target that can support a VFP fp16 variant.
2651 # Skip multilibs that are incompatible with these options and set
2652 # et_arm_fp16_flags to the best options to add.
2654 proc check_effective_target_arm_fp16_ok_nocache { } {
2655 global et_arm_fp16_flags
2656 set et_arm_fp16_flags ""
2657 if { ! [check_effective_target_arm32] } {
2660 if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2661 # Multilib flags would override -mfpu.
2664 if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2665 # Must generate floating-point instructions.
2668 if [check_effective_target_arm_hf_eabi] {
2669 # Use existing float-abi and force an fpu which supports fp16
2670 set et_arm_fp16_flags "-mfpu=vfpv4"
2673 if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
2674 # The existing -mfpu value is OK; use it, but add softfp.
2675 set et_arm_fp16_flags "-mfloat-abi=softfp"
2678 # Add -mfpu for a VFP fp16 variant since there is no preprocessor
2679 # macro to check for this support.
2680 set flags "-mfpu=vfpv4 -mfloat-abi=softfp"
2681 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly {
2684 set et_arm_fp16_flags "$flags"
2691 proc check_effective_target_arm_fp16_ok { } {
2692 return [check_cached_effective_target arm_fp16_ok \
2693 check_effective_target_arm_fp16_ok_nocache]
2696 # Creates a series of routines that return 1 if the given architecture
2697 # can be selected and a routine to give the flags to select that architecture
2698 # Note: Extra flags may be added to disable options from newer compilers
2699 # (Thumb in particular - but others may be added in the future)
2700 # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
2701 # /* { dg-add-options arm_arch_v5 } */
2702 # /* { dg-require-effective-target arm_arch_v5_multilib } */
2703 foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
2704 v4t "-march=armv4t" __ARM_ARCH_4T__
2705 v5 "-march=armv5 -marm" __ARM_ARCH_5__
2706 v5t "-march=armv5t" __ARM_ARCH_5T__
2707 v5te "-march=armv5te" __ARM_ARCH_5TE__
2708 v6 "-march=armv6" __ARM_ARCH_6__
2709 v6k "-march=armv6k" __ARM_ARCH_6K__
2710 v6t2 "-march=armv6t2" __ARM_ARCH_6T2__
2711 v6z "-march=armv6z" __ARM_ARCH_6Z__
2712 v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
2713 v7a "-march=armv7-a" __ARM_ARCH_7A__
2714 v7ve "-march=armv7ve" __ARM_ARCH_7A__
2715 v7r "-march=armv7-r" __ARM_ARCH_7R__
2716 v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
2717 v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2718 v8a "-march=armv8-a" __ARM_ARCH_8A__ } {
2719 eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
2720 proc check_effective_target_arm_arch_FUNC_ok { } {
2721 if { [ string match "*-marm*" "FLAG" ] &&
2722 ![check_effective_target_arm_arm_ok] } {
2725 return [check_no_compiler_messages arm_arch_FUNC_ok assembly {
2732 proc add_options_for_arm_arch_FUNC { flags } {
2733 return "$flags FLAG"
2736 proc check_effective_target_arm_arch_FUNC_multilib { } {
2737 return [check_runtime arm_arch_FUNC_multilib {
2743 } [add_options_for_arm_arch_FUNC ""]]
2748 # Return 1 if this is an ARM target where -marm causes ARM to be
2751 proc check_effective_target_arm_arm_ok { } {
2752 return [check_no_compiler_messages arm_arm_ok assembly {
2753 #if !defined (__arm__) || defined (__thumb__) || defined (__thumb2__)
2760 # Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
2763 proc check_effective_target_arm_thumb1_ok { } {
2764 return [check_no_compiler_messages arm_thumb1_ok assembly {
2765 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
2768 int foo (int i) { return i; }
2772 # Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be
2775 proc check_effective_target_arm_thumb2_ok { } {
2776 return [check_no_compiler_messages arm_thumb2_ok assembly {
2777 #if !defined(__thumb2__)
2780 int foo (int i) { return i; }
2784 # Return 1 if this is an ARM target where Thumb-1 is used without options
2785 # added by the test.
2787 proc check_effective_target_arm_thumb1 { } {
2788 return [check_no_compiler_messages arm_thumb1 assembly {
2789 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
2796 # Return 1 if this is an ARM target where Thumb-2 is used without options
2797 # added by the test.
2799 proc check_effective_target_arm_thumb2 { } {
2800 return [check_no_compiler_messages arm_thumb2 assembly {
2801 #if !defined(__thumb2__)
2808 # Return 1 if this is an ARM target where conditional execution is available.
2810 proc check_effective_target_arm_cond_exec { } {
2811 return [check_no_compiler_messages arm_cond_exec assembly {
2812 #if defined(__arm__) && defined(__thumb__) && !defined(__thumb2__)
2819 # Return 1 if this is an ARM cortex-M profile cpu
2821 proc check_effective_target_arm_cortex_m { } {
2822 return [check_no_compiler_messages arm_cortex_m assembly {
2823 #if !defined(__ARM_ARCH_7M__) \
2824 && !defined (__ARM_ARCH_7EM__) \
2825 && !defined (__ARM_ARCH_6M__)
2832 # Return 1 if the target supports executing NEON instructions, 0
2833 # otherwise. Cache the result.
2835 proc check_effective_target_arm_neon_hw { } {
2836 return [check_runtime arm_neon_hw_available {
2840 long long a = 0, b = 1;
2841 asm ("vorr %P0, %P1, %P2"
2843 : "0" (a), "w" (b));
2846 } [add_options_for_arm_neon ""]]
2849 proc check_effective_target_arm_neonv2_hw { } {
2850 return [check_runtime arm_neon_hwv2_available {
2851 #include "arm_neon.h"
2855 float32x2_t a, b, c;
2856 asm ("vfma.f32 %P0, %P1, %P2"
2858 : "w" (b), "w" (c));
2861 } [add_options_for_arm_neonv2 ""]]
2864 # Return 1 if the target supports executing ARMv8 NEON instructions, 0
2867 proc check_effective_target_arm_v8_neon_hw { } {
2868 return [check_runtime arm_v8_neon_hw_available {
2869 #include "arm_neon.h"
2874 asm ("vrinta.f32 %P0, %P1"
2879 } [add_options_for_arm_v8_neon ""]]
2882 # Return 1 if this is a ARM target with NEON enabled.
2884 proc check_effective_target_arm_neon { } {
2885 if { [check_effective_target_arm32] } {
2886 return [check_no_compiler_messages arm_neon object {
2887 #ifndef __ARM_NEON__
2898 proc check_effective_target_arm_neonv2 { } {
2899 if { [check_effective_target_arm32] } {
2900 return [check_no_compiler_messages arm_neon object {
2901 #ifndef __ARM_NEON__
2904 #ifndef __ARM_FEATURE_FMA
2916 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
2917 # the Loongson vector modes.
2919 proc check_effective_target_mips_loongson { } {
2920 return [check_no_compiler_messages loongson assembly {
2921 #if !defined(__mips_loongson_vector_rev)
2927 # Return 1 if this is an ARM target that adheres to the ABI for the ARM
2930 proc check_effective_target_arm_eabi { } {
2931 return [check_no_compiler_messages arm_eabi object {
2932 #ifndef __ARM_EABI__
2940 # Return 1 if this is an ARM target that adheres to the hard-float variant of
2941 # the ABI for the ARM Architecture (e.g. -mfloat-abi=hard).
2943 proc check_effective_target_arm_hf_eabi { } {
2944 return [check_no_compiler_messages arm_hf_eabi object {
2945 #if !defined(__ARM_EABI__) || !defined(__ARM_PCS_VFP)
2946 #error not hard-float EABI
2953 # Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
2954 # Some multilibs may be incompatible with this option.
2956 proc check_effective_target_arm_iwmmxt_ok { } {
2957 if { [check_effective_target_arm32] } {
2958 return [check_no_compiler_messages arm_iwmmxt_ok object {
2966 # Return true if LDRD/STRD instructions are prefered over LDM/STM instructions
2967 # for an ARM target.
2968 proc check_effective_target_arm_prefer_ldrd_strd { } {
2969 if { ![check_effective_target_arm32] } {
2973 return [check_no_messages_and_pattern arm_prefer_ldrd_strd "strd\tr" assembly {
2974 void foo (int *p) { p[0] = 1; p[1] = 0;}
2978 # Return 1 if this is a PowerPC target supporting -meabi.
2980 proc check_effective_target_powerpc_eabi_ok { } {
2981 if { [istarget powerpc*-*-*] } {
2982 return [check_no_compiler_messages powerpc_eabi_ok object {
2990 # Return 1 if this is a PowerPC target with floating-point registers.
2992 proc check_effective_target_powerpc_fprs { } {
2993 if { [istarget powerpc*-*-*]
2994 || [istarget rs6000-*-*] } {
2995 return [check_no_compiler_messages powerpc_fprs object {
3007 # Return 1 if this is a PowerPC target with hardware double-precision
3010 proc check_effective_target_powerpc_hard_double { } {
3011 if { [istarget powerpc*-*-*]
3012 || [istarget rs6000-*-*] } {
3013 return [check_no_compiler_messages powerpc_hard_double object {
3025 # Return 1 if this is a PowerPC target supporting -maltivec.
3027 proc check_effective_target_powerpc_altivec_ok { } {
3028 if { ([istarget powerpc*-*-*]
3029 && ![istarget powerpc-*-linux*paired*])
3030 || [istarget rs6000-*-*] } {
3031 # AltiVec is not supported on AIX before 5.3.
3032 if { [istarget powerpc*-*-aix4*]
3033 || [istarget powerpc*-*-aix5.1*]
3034 || [istarget powerpc*-*-aix5.2*] } {
3037 return [check_no_compiler_messages powerpc_altivec_ok object {
3045 # Return 1 if this is a PowerPC target supporting -mpower8-vector
3047 proc check_effective_target_powerpc_p8vector_ok { } {
3048 if { ([istarget powerpc*-*-*]
3049 && ![istarget powerpc-*-linux*paired*])
3050 || [istarget rs6000-*-*] } {
3051 # AltiVec is not supported on AIX before 5.3.
3052 if { [istarget powerpc*-*-aix4*]
3053 || [istarget powerpc*-*-aix5.1*]
3054 || [istarget powerpc*-*-aix5.2*] } {
3057 return [check_no_compiler_messages powerpc_p8vector_ok object {
3060 asm volatile ("xxlorc vs0,vs0,vs0");
3062 asm volatile ("xxlorc 0,0,0");
3066 } "-mpower8-vector"]
3072 # Return 1 if this is a PowerPC target supporting -mvsx
3074 proc check_effective_target_powerpc_vsx_ok { } {
3075 if { ([istarget powerpc*-*-*]
3076 && ![istarget powerpc-*-linux*paired*])
3077 || [istarget rs6000-*-*] } {
3078 # VSX is not supported on AIX before 7.1.
3079 if { [istarget powerpc*-*-aix4*]
3080 || [istarget powerpc*-*-aix5*]
3081 || [istarget powerpc*-*-aix6*] } {
3084 return [check_no_compiler_messages powerpc_vsx_ok object {
3087 asm volatile ("xxlor vs0,vs0,vs0");
3089 asm volatile ("xxlor 0,0,0");
3099 # Return 1 if this is a PowerPC target supporting -mhtm
3101 proc check_effective_target_powerpc_htm_ok { } {
3102 if { ([istarget powerpc*-*-*]
3103 && ![istarget powerpc-*-linux*paired*])
3104 || [istarget rs6000-*-*] } {
3105 # HTM is not supported on AIX yet.
3106 if { [istarget powerpc*-*-aix*] } {
3109 return [check_no_compiler_messages powerpc_htm_ok object {
3111 asm volatile ("tbegin. 0");
3120 # Return 1 if this is a PowerPC target supporting -mcpu=cell.
3122 proc check_effective_target_powerpc_ppu_ok { } {
3123 if [check_effective_target_powerpc_altivec_ok] {
3124 return [check_no_compiler_messages cell_asm_available object {
3127 asm volatile ("lvlx v0,v0,v0");
3129 asm volatile ("lvlx 0,0,0");
3139 # Return 1 if this is a PowerPC target that supports SPU.
3141 proc check_effective_target_powerpc_spu { } {
3142 if { [istarget powerpc*-*-linux*] } {
3143 return [check_effective_target_powerpc_altivec_ok]
3149 # Return 1 if this is a PowerPC SPE target. The check includes options
3150 # specified by dg-options for this test, so don't
cache the result.
3152 proc check_effective_target_powerpc_spe_nocache
{ } {
3153 if { [istarget powerpc
*-*-*] } {
3154 return [check_no_compiler_messages_nocache powerpc_spe object
{
3160 } [current_compiler_flags
]]
3166 #
Return 1 if this is a PowerPC target with SPE enabled.
3168 proc check_effective_target_powerpc_spe
{ } {
3169 if { [istarget powerpc
*-*-*] } {
3170 return [check_no_compiler_messages powerpc_spe object
{
3182 #
Return 1 if this is a PowerPC target with Altivec enabled.
3184 proc check_effective_target_powerpc_altivec
{ } {
3185 if { [istarget powerpc
*-*-*] } {
3186 return [check_no_compiler_messages powerpc_altivec object
{
3198 #
Return 1 if this is a PowerPC
405 target. The check includes options
3199 # specified by dg
-options
for this test
, so don
't cache the result.
3201 proc check_effective_target_powerpc_405_nocache { } {
3202 if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
3203 return [check_no_compiler_messages_nocache powerpc_405 object {
3209 } [current_compiler_flags]]
3215 # Return 1 if this is a PowerPC target using the ELFv2 ABI.
3217 proc check_effective_target_powerpc_elfv2 { } {
3218 if { [istarget powerpc*-*-*] } {
3219 return [check_no_compiler_messages powerpc_elfv2 object {
3221 #error not ELF v2 ABI
3231 # Return 1 if this is a SPU target with a toolchain that
3232 # supports automatic overlay generation.
3234 proc check_effective_target_spu_auto_overlay { } {
3235 if { [istarget spu*-*-elf*] } {
3236 return [check_no_compiler_messages spu_auto_overlay executable {
3238 } "-Wl,--auto-overlay" ]
3244 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3245 # chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
3246 # test environment appears to run executables on such a simulator.
3248 proc check_effective_target_ultrasparc_hw { } {
3249 return [check_runtime ultrasparc_hw {
3250 int main() { return 0; }
3251 } "-mcpu=ultrasparc"]
3254 # Return 1 if the test environment supports executing UltraSPARC VIS2
3255 # instructions. We check this by attempting: "bmask %g0, %g0, %g0"
3257 proc check_effective_target_ultrasparc_vis2_hw { } {
3258 return [check_runtime ultrasparc_vis2_hw {
3259 int main() { __asm__(".word 0x81b00320"); return 0; }
3260 } "-mcpu=ultrasparc3"]
3263 # Return 1 if the test environment supports executing UltraSPARC VIS3
3264 # instructions. We check this by attempting: "addxc %g0, %g0, %g0"
3266 proc check_effective_target_ultrasparc_vis3_hw { } {
3267 return [check_runtime ultrasparc_vis3_hw {
3268 int main() { __asm__(".word 0x81b00220"); return 0; }
3272 # Return 1 if this is a SPARC-V9 target.
3274 proc check_effective_target_sparc_v9 { } {
3275 if { [istarget sparc*-*-*] } {
3276 return [check_no_compiler_messages sparc_v9 object {
3278 asm volatile ("return %i7+8");
3287 # Return 1 if this is a SPARC target with VIS enabled.
3289 proc check_effective_target_sparc_vis { } {
3290 if { [istarget sparc*-*-*] } {
3291 return [check_no_compiler_messages sparc_vis object {
3303 # Return 1 if the target supports hardware vector shift operation.
3305 proc check_effective_target_vect_shift { } {
3306 global et_vect_shift_saved
3308 if [info exists et_vect_shift_saved] {
3309 verbose "check_effective_target_vect_shift: using cached result" 2
3311 set et_vect_shift_saved 0
3312 if { ([istarget powerpc*-*-*]
3313 && ![istarget powerpc-*-linux*paired*])
3314 || [istarget ia64-*-*]
3315 || [istarget i?86-*-*]
3316 || [istarget x86_64-*-*]
3317 || [istarget aarch64*-*-*]
3318 || [check_effective_target_arm32]
3319 || ([istarget mips*-*-*]
3320 && [check_effective_target_mips_loongson]) } {
3321 set et_vect_shift_saved 1
3325 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3326 return $et_vect_shift_saved
3329 # Return 1 if the target supports vector bswap operations.
3331 proc check_effective_target_vect_bswap { } {
3332 global et_vect_bswap_saved
3334 if [info exists et_vect_bswap_saved] {
3335 verbose "check_effective_target_vect_bswap: using cached result" 2
3337 set et_vect_bswap_saved 0
3338 if { [istarget aarch64*-*-*]
3339 || ([istarget arm*-*-*]
3340 && [check_effective_target_arm_neon])
3342 set et_vect_bswap_saved 1
3346 verbose "check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
3347 return $et_vect_bswap_saved
3350 # Return 1 if the target supports hardware vector shift operation for char.
3352 proc check_effective_target_vect_shift_char { } {
3353 global et_vect_shift_char_saved
3355 if [info exists et_vect_shift_char_saved] {
3356 verbose "check_effective_target_vect_shift_char: using cached result" 2
3358 set et_vect_shift_char_saved 0
3359 if { ([istarget powerpc*-*-*]
3360 && ![istarget powerpc-*-linux*paired*])
3361 || [check_effective_target_arm32] } {
3362 set et_vect_shift_char_saved 1
3366 verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3367 return $et_vect_shift_char_saved
3370 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
3372 # This can change for different subtargets so do not cache the result.
3374 proc check_effective_target_vect_long { } {
3375 if { [istarget i?86-*-*]
3376 || (([istarget powerpc*-*-*]
3377 && ![istarget powerpc-*-linux*paired*])
3378 && [check_effective_target_ilp32])
3379 || [istarget x86_64-*-*]
3380 || [check_effective_target_arm32]
3381 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
3387 verbose "check_effective_target_vect_long: returning $answer" 2
3391 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
3393 # This won't change
for different subtargets so
cache the result.
3395 proc check_effective_target_vect_float
{ } {
3396 global et_vect_float_saved
3398 if [info exists et_vect_float_saved
] {
3399 verbose
"check_effective_target_vect_float: using cached result" 2
3401 set et_vect_float_saved
0
3402 if { [istarget i?
86-*-*]
3403 ||
[istarget powerpc
*-*-*]
3404 ||
[istarget spu
-*-*]
3405 ||
[istarget mips
-sde
-elf
]
3406 ||
[istarget mipsisa64
*-*-*]
3407 ||
[istarget x86_64
-*-*]
3408 ||
[istarget ia64
-*-*]
3409 ||
[istarget aarch64
*-*-*]
3410 ||
[check_effective_target_arm32
] } {
3411 set et_vect_float_saved
1
3415 verbose
"check_effective_target_vect_float: returning $et_vect_float_saved" 2
3416 return $et_vect_float_saved
3419 #
Return 1 if the target supports hardware vectors of double
, 0 otherwise.
3421 # This won
't change for different subtargets so cache the result.
3423 proc check_effective_target_vect_double { } {
3424 global et_vect_double_saved
3426 if [info exists et_vect_double_saved] {
3427 verbose "check_effective_target_vect_double: using cached result" 2
3429 set et_vect_double_saved 0
3430 if { [istarget i?86-*-*]
3431 || [istarget aarch64*-*-*]
3432 || [istarget x86_64-*-*] } {
3433 if { [check_no_compiler_messages vect_double assembly {
3434 #ifdef __tune_atom__
3435 # error No double vectorizer support.
3438 set et_vect_double_saved 1
3440 set et_vect_double_saved 0
3442 } elseif { [istarget spu-*-*] } {
3443 set et_vect_double_saved 1
3447 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
3448 return $et_vect_double_saved
3451 # Return 1 if the target supports hardware vectors of long long, 0 otherwise.
3453 # This won't change
for different subtargets so
cache the result.
3455 proc check_effective_target_vect_long_long
{ } {
3456 global et_vect_long_long_saved
3458 if [info exists et_vect_long_long_saved
] {
3459 verbose
"check_effective_target_vect_long_long: using cached result" 2
3461 set et_vect_long_long_saved
0
3462 if { [istarget i?
86-*-*]
3463 ||
[istarget x86_64
-*-*] } {
3464 set et_vect_long_long_saved
1
3468 verbose
"check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3469 return $et_vect_long_long_saved
3473 #
Return 1 if the target plus current options does not support a vector
3474 #
max instruction
on "int", 0 otherwise.
3476 # This won
't change for different subtargets so cache the result.
3478 proc check_effective_target_vect_no_int_max { } {
3479 global et_vect_no_int_max_saved
3481 if [info exists et_vect_no_int_max_saved] {
3482 verbose "check_effective_target_vect_no_int_max: using cached result" 2
3484 set et_vect_no_int_max_saved 0
3485 if { [istarget sparc*-*-*]
3486 || [istarget spu-*-*]
3487 || [istarget alpha*-*-*]
3488 || ([istarget mips*-*-*]
3489 && [check_effective_target_mips_loongson]) } {
3490 set et_vect_no_int_max_saved 1
3493 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3494 return $et_vect_no_int_max_saved
3497 # Return 1 if the target plus current options does not support a vector
3498 # add instruction on "int", 0 otherwise.
3500 # This won't change
for different subtargets so
cache the result.
3502 proc check_effective_target_vect_no_int_add
{ } {
3503 global et_vect_no_int_add_saved
3505 if [info exists et_vect_no_int_add_saved
] {
3506 verbose
"check_effective_target_vect_no_int_add: using cached result" 2
3508 set et_vect_no_int_add_saved
0
3509 # Alpha only supports vector add
on V8QI and V4HI.
3510 if { [istarget alpha
*-*-*] } {
3511 set et_vect_no_int_add_saved
1
3514 verbose
"check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3515 return $et_vect_no_int_add_saved
3518 #
Return 1 if the target plus current options does not support vector
3519 # bitwise instructions
, 0 otherwise.
3521 # This won
't change for different subtargets so cache the result.
3523 proc check_effective_target_vect_no_bitwise { } {
3524 global et_vect_no_bitwise_saved
3526 if [info exists et_vect_no_bitwise_saved] {
3527 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
3529 set et_vect_no_bitwise_saved 0
3531 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3532 return $et_vect_no_bitwise_saved
3535 # Return 1 if the target plus current options supports vector permutation,
3538 # This won't change
for different subtargets so
cache the result.
3540 proc check_effective_target_vect_perm
{ } {
3543 if [info exists et_vect_perm_saved
] {
3544 verbose
"check_effective_target_vect_perm: using cached result" 2
3546 set et_vect_perm_saved
0
3547 if { [is
-effective
-target arm_neon_ok
]
3548 ||
[istarget aarch64
*-*-*]
3549 ||
[istarget powerpc
*-*-*]
3550 ||
[istarget spu
-*-*]
3551 ||
[istarget i?
86-*-*]
3552 ||
[istarget x86_64
-*-*]
3553 ||
([istarget mips
*-*-*]
3554 && [check_effective_target_mpaired_single
]) } {
3555 set et_vect_perm_saved
1
3558 verbose
"check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3559 return $et_vect_perm_saved
3562 #
Return 1 if the target plus current options supports vector permutation
3563 #
on byte
-sized elements
, 0 otherwise.
3565 # This won
't change for different subtargets so cache the result.
3567 proc check_effective_target_vect_perm_byte { } {
3568 global et_vect_perm_byte
3570 if [info exists et_vect_perm_byte_saved] {
3571 verbose "check_effective_target_vect_perm_byte: using cached result" 2
3573 set et_vect_perm_byte_saved 0
3574 if { ([is-effective-target arm_neon_ok]
3575 && [is-effective-target arm_little_endian])
3576 || ([istarget aarch64*-*-*]
3577 && [is-effective-target aarch64_little_endian])
3578 || [istarget powerpc*-*-*]
3579 || [istarget spu-*-*] } {
3580 set et_vect_perm_byte_saved 1
3583 verbose "check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3584 return $et_vect_perm_byte_saved
3587 # Return 1 if the target plus current options supports vector permutation
3588 # on short-sized elements, 0 otherwise.
3590 # This won't change
for different subtargets so
cache the result.
3592 proc check_effective_target_vect_perm_short
{ } {
3593 global et_vect_perm_short
3595 if [info exists et_vect_perm_short_saved
] {
3596 verbose
"check_effective_target_vect_perm_short: using cached result" 2
3598 set et_vect_perm_short_saved
0
3599 if { ([is
-effective
-target arm_neon_ok
]
3600 && [is
-effective
-target arm_little_endian
])
3601 ||
([istarget aarch64
*-*-*]
3602 && [is
-effective
-target aarch64_little_endian
])
3603 ||
[istarget powerpc
*-*-*]
3604 ||
[istarget spu
-*-*] } {
3605 set et_vect_perm_short_saved
1
3608 verbose
"check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3609 return $et_vect_perm_short_saved
3612 #
Return 1 if the target plus current options supports a vector
3613 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3615 # This won
't change for different subtargets so cache the result.
3617 proc check_effective_target_vect_widen_sum_hi_to_si_pattern { } {
3618 global et_vect_widen_sum_hi_to_si_pattern
3620 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved] {
3621 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3623 set et_vect_widen_sum_hi_to_si_pattern_saved 0
3624 if { [istarget powerpc*-*-*]
3625 || [istarget ia64-*-*] } {
3626 set et_vect_widen_sum_hi_to_si_pattern_saved 1
3629 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3630 return $et_vect_widen_sum_hi_to_si_pattern_saved
3633 # Return 1 if the target plus current options supports a vector
3634 # widening summation of *short* args into *int* result, 0 otherwise.
3635 # A target can also support this widening summation if it can support
3636 # promotion (unpacking) from shorts to ints.
3638 # This won't change
for different subtargets so
cache the result.
3640 proc check_effective_target_vect_widen_sum_hi_to_si
{ } {
3641 global et_vect_widen_sum_hi_to_si
3643 if [info exists et_vect_widen_sum_hi_to_si_saved
] {
3644 verbose
"check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3646 set et_vect_widen_sum_hi_to_si_saved
[check_effective_target_vect_unpack
]
3647 if { [istarget powerpc
*-*-*]
3648 ||
[istarget ia64
-*-*] } {
3649 set et_vect_widen_sum_hi_to_si_saved
1
3652 verbose
"check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3653 return $et_vect_widen_sum_hi_to_si_saved
3656 #
Return 1 if the target plus current options supports a vector
3657 # widening summation of
*char
* args into
*short
* result
, 0 otherwise.
3658 # A target can also support this widening summation
if it can support
3659 # promotion
(unpacking
) from chars to shorts.
3661 # This won
't change for different subtargets so cache the result.
3663 proc check_effective_target_vect_widen_sum_qi_to_hi { } {
3664 global et_vect_widen_sum_qi_to_hi
3666 if [info exists et_vect_widen_sum_qi_to_hi_saved] {
3667 verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3669 set et_vect_widen_sum_qi_to_hi_saved 0
3670 if { [check_effective_target_vect_unpack]
3671 || [check_effective_target_arm_neon_ok]
3672 || [istarget ia64-*-*] } {
3673 set et_vect_widen_sum_qi_to_hi_saved 1
3676 verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3677 return $et_vect_widen_sum_qi_to_hi_saved
3680 # Return 1 if the target plus current options supports a vector
3681 # widening summation of *char* args into *int* result, 0 otherwise.
3683 # This won't change
for different subtargets so
cache the result.
3685 proc check_effective_target_vect_widen_sum_qi_to_si
{ } {
3686 global et_vect_widen_sum_qi_to_si
3688 if [info exists et_vect_widen_sum_qi_to_si_saved
] {
3689 verbose
"check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3691 set et_vect_widen_sum_qi_to_si_saved
0
3692 if { [istarget powerpc
*-*-*] } {
3693 set et_vect_widen_sum_qi_to_si_saved
1
3696 verbose
"check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3697 return $et_vect_widen_sum_qi_to_si_saved
3700 #
Return 1 if the target plus current options supports a vector
3701 # widening multiplication of
*char
* args into
*short
* result
, 0 otherwise.
3702 # A target can also support this widening multplication
if it can support
3703 # promotion
(unpacking
) from chars to shorts
, and vect_short_mult
(non
-widening
3704 # multiplication of shorts
).
3706 # This won
't change for different subtargets so cache the result.
3709 proc check_effective_target_vect_widen_mult_qi_to_hi { } {
3710 global et_vect_widen_mult_qi_to_hi
3712 if [info exists et_vect_widen_mult_qi_to_hi_saved] {
3713 verbose "check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3715 if { [check_effective_target_vect_unpack]
3716 && [check_effective_target_vect_short_mult] } {
3717 set et_vect_widen_mult_qi_to_hi_saved 1
3719 set et_vect_widen_mult_qi_to_hi_saved 0
3721 if { [istarget powerpc*-*-*]
3722 || [istarget aarch64*-*-*]
3723 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3724 set et_vect_widen_mult_qi_to_hi_saved 1
3727 verbose "check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3728 return $et_vect_widen_mult_qi_to_hi_saved
3731 # Return 1 if the target plus current options supports a vector
3732 # widening multiplication of *short* args into *int* result, 0 otherwise.
3733 # A target can also support this widening multplication if it can support
3734 # promotion (unpacking) from shorts to ints, and vect_int_mult (non-widening
3735 # multiplication of ints).
3737 # This won't change
for different subtargets so
cache the result.
3740 proc check_effective_target_vect_widen_mult_hi_to_si
{ } {
3741 global et_vect_widen_mult_hi_to_si
3743 if [info exists et_vect_widen_mult_hi_to_si_saved
] {
3744 verbose
"check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3746 if { [check_effective_target_vect_unpack
]
3747 && [check_effective_target_vect_int_mult
] } {
3748 set et_vect_widen_mult_hi_to_si_saved
1
3750 set et_vect_widen_mult_hi_to_si_saved
0
3752 if { [istarget powerpc
*-*-*]
3753 ||
[istarget spu
-*-*]
3754 ||
[istarget ia64
-*-*]
3755 ||
[istarget aarch64
*-*-*]
3756 ||
[istarget i?
86-*-*]
3757 ||
[istarget x86_64
-*-*]
3758 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3759 set et_vect_widen_mult_hi_to_si_saved
1
3762 verbose
"check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3763 return $et_vect_widen_mult_hi_to_si_saved
3766 #
Return 1 if the target plus current options supports a vector
3767 # widening multiplication of
*char
* args into
*short
* result
, 0 otherwise.
3769 # This won
't change for different subtargets so cache the result.
3771 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern { } {
3772 global et_vect_widen_mult_qi_to_hi_pattern
3774 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved] {
3775 verbose "check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3777 set et_vect_widen_mult_qi_to_hi_pattern_saved 0
3778 if { [istarget powerpc*-*-*]
3779 || ([istarget arm*-*-*]
3780 && [check_effective_target_arm_neon_ok]
3781 && [check_effective_target_arm_little_endian]) } {
3782 set et_vect_widen_mult_qi_to_hi_pattern_saved 1
3785 verbose "check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3786 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3789 # Return 1 if the target plus current options supports a vector
3790 # widening multiplication of *short* args into *int* result, 0 otherwise.
3792 # This won't change
for different subtargets so
cache the result.
3794 proc check_effective_target_vect_widen_mult_hi_to_si_pattern
{ } {
3795 global et_vect_widen_mult_hi_to_si_pattern
3797 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved
] {
3798 verbose
"check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3800 set et_vect_widen_mult_hi_to_si_pattern_saved
0
3801 if { [istarget powerpc
*-*-*]
3802 ||
[istarget spu
-*-*]
3803 ||
[istarget ia64
-*-*]
3804 ||
[istarget i?
86-*-*]
3805 ||
[istarget x86_64
-*-*]
3806 ||
([istarget arm
*-*-*]
3807 && [check_effective_target_arm_neon_ok
]
3808 && [check_effective_target_arm_little_endian
]) } {
3809 set et_vect_widen_mult_hi_to_si_pattern_saved
1
3812 verbose
"check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3813 return $et_vect_widen_mult_hi_to_si_pattern_saved
3816 #
Return 1 if the target plus current options supports a vector
3817 # widening multiplication of
*int* args into
*long
* result
, 0 otherwise.
3819 # This won
't change for different subtargets so cache the result.
3821 proc check_effective_target_vect_widen_mult_si_to_di_pattern { } {
3822 global et_vect_widen_mult_si_to_di_pattern
3824 if [info exists et_vect_widen_mult_si_to_di_pattern_saved] {
3825 verbose "check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
3827 set et_vect_widen_mult_si_to_di_pattern_saved 0
3828 if {[istarget ia64-*-*]
3829 || [istarget i?86-*-*]
3830 || [istarget x86_64-*-*] } {
3831 set et_vect_widen_mult_si_to_di_pattern_saved 1
3834 verbose "check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
3835 return $et_vect_widen_mult_si_to_di_pattern_saved
3838 # Return 1 if the target plus current options supports a vector
3839 # widening shift, 0 otherwise.
3841 # This won't change
for different subtargets so
cache the result.
3843 proc check_effective_target_vect_widen_shift
{ } {
3844 global et_vect_widen_shift_saved
3846 if [info exists et_vect_shift_saved
] {
3847 verbose
"check_effective_target_vect_widen_shift: using cached result" 2
3849 set et_vect_widen_shift_saved
0
3850 if { ([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3851 set et_vect_widen_shift_saved
1
3854 verbose
"check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3855 return $et_vect_widen_shift_saved
3858 #
Return 1 if the target plus current options supports a vector
3859 # dot
-product of signed chars
, 0 otherwise.
3861 # This won
't change for different subtargets so cache the result.
3863 proc check_effective_target_vect_sdot_qi { } {
3864 global et_vect_sdot_qi
3866 if [info exists et_vect_sdot_qi_saved] {
3867 verbose "check_effective_target_vect_sdot_qi: using cached result" 2
3869 set et_vect_sdot_qi_saved 0
3870 if { [istarget ia64-*-*] } {
3871 set et_vect_udot_qi_saved 1
3874 verbose "check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3875 return $et_vect_sdot_qi_saved
3878 # Return 1 if the target plus current options supports a vector
3879 # dot-product of unsigned chars, 0 otherwise.
3881 # This won't change
for different subtargets so
cache the result.
3883 proc check_effective_target_vect_udot_qi
{ } {
3884 global et_vect_udot_qi
3886 if [info exists et_vect_udot_qi_saved
] {
3887 verbose
"check_effective_target_vect_udot_qi: using cached result" 2
3889 set et_vect_udot_qi_saved
0
3890 if { [istarget powerpc
*-*-*]
3891 ||
[istarget ia64
-*-*] } {
3892 set et_vect_udot_qi_saved
1
3895 verbose
"check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
3896 return $et_vect_udot_qi_saved
3899 #
Return 1 if the target plus current options supports a vector
3900 # dot
-product of signed shorts
, 0 otherwise.
3902 # This won
't change for different subtargets so cache the result.
3904 proc check_effective_target_vect_sdot_hi { } {
3905 global et_vect_sdot_hi
3907 if [info exists et_vect_sdot_hi_saved] {
3908 verbose "check_effective_target_vect_sdot_hi: using cached result" 2
3910 set et_vect_sdot_hi_saved 0
3911 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
3912 || [istarget ia64-*-*]
3913 || [istarget i?86-*-*]
3914 || [istarget x86_64-*-*] } {
3915 set et_vect_sdot_hi_saved 1
3918 verbose "check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
3919 return $et_vect_sdot_hi_saved
3922 # Return 1 if the target plus current options supports a vector
3923 # dot-product of unsigned shorts, 0 otherwise.
3925 # This won't change
for different subtargets so
cache the result.
3927 proc check_effective_target_vect_udot_hi
{ } {
3928 global et_vect_udot_hi
3930 if [info exists et_vect_udot_hi_saved
] {
3931 verbose
"check_effective_target_vect_udot_hi: using cached result" 2
3933 set et_vect_udot_hi_saved
0
3934 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*]) } {
3935 set et_vect_udot_hi_saved
1
3938 verbose
"check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
3939 return $et_vect_udot_hi_saved
3942 #
Return 1 if the target plus current options supports a vector
3943 # sad operation of unsigned chars
, 0 otherwise.
3945 # This won
't change for different subtargets so cache the result.
3947 proc check_effective_target_vect_usad_char { } {
3948 global et_vect_usad_char
3950 if [info exists et_vect_usad_char_saved] {
3951 verbose "check_effective_target_vect_usad_char: using cached result" 2
3953 set et_vect_usad_char_saved 0
3954 if { ([istarget i?86-*-*]
3955 || [istarget x86_64-*-*]) } {
3956 set et_vect_usad_char_saved 1
3959 verbose "check_effective_target_vect_usad_char: returning $et_vect_usad_char_saved" 2
3960 return $et_vect_usad_char_saved
3963 # Return 1 if the target plus current options supports a vector
3964 # demotion (packing) of shorts (to chars) and ints (to shorts)
3965 # using modulo arithmetic, 0 otherwise.
3967 # This won't change
for different subtargets so
cache the result.
3969 proc check_effective_target_vect_pack_trunc
{ } {
3970 global et_vect_pack_trunc
3972 if [info exists et_vect_pack_trunc_saved
] {
3973 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
3975 set et_vect_pack_trunc_saved
0
3976 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3977 ||
[istarget i?
86-*-*]
3978 ||
[istarget x86_64
-*-*]
3979 ||
[istarget aarch64
*-*-*]
3980 ||
[istarget spu
-*-*]
3981 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
3982 && [check_effective_target_arm_little_endian
]) } {
3983 set et_vect_pack_trunc_saved
1
3986 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
3987 return $et_vect_pack_trunc_saved
3990 #
Return 1 if the target plus current options supports a vector
3991 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
3993 # This won
't change for different subtargets so cache the result.
3995 proc check_effective_target_vect_unpack { } {
3996 global et_vect_unpack
3998 if [info exists et_vect_unpack_saved] {
3999 verbose "check_effective_target_vect_unpack: using cached result" 2
4001 set et_vect_unpack_saved 0
4002 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
4003 || [istarget i?86-*-*]
4004 || [istarget x86_64-*-*]
4005 || [istarget spu-*-*]
4006 || [istarget ia64-*-*]
4007 || [istarget aarch64*-*-*]
4008 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
4009 && [check_effective_target_arm_little_endian]) } {
4010 set et_vect_unpack_saved 1
4013 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
4014 return $et_vect_unpack_saved
4017 # Return 1 if the target plus current options does not guarantee
4018 # that its STACK_BOUNDARY is >= the reguired vector alignment.
4020 # This won't change
for different subtargets so
cache the result.
4022 proc check_effective_target_unaligned_stack
{ } {
4023 global et_unaligned_stack_saved
4025 if [info exists et_unaligned_stack_saved
] {
4026 verbose
"check_effective_target_unaligned_stack: using cached result" 2
4028 set et_unaligned_stack_saved
0
4030 verbose
"check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
4031 return $et_unaligned_stack_saved
4034 #
Return 1 if the target plus current options does not support a vector
4035 # alignment mechanism
, 0 otherwise.
4037 # This won
't change for different subtargets so cache the result.
4039 proc check_effective_target_vect_no_align { } {
4040 global et_vect_no_align_saved
4042 if [info exists et_vect_no_align_saved] {
4043 verbose "check_effective_target_vect_no_align: using cached result" 2
4045 set et_vect_no_align_saved 0
4046 if { [istarget mipsisa64*-*-*]
4047 || [istarget mips-sde-elf]
4048 || [istarget sparc*-*-*]
4049 || [istarget ia64-*-*]
4050 || [check_effective_target_arm_vect_no_misalign]
4051 || ([istarget mips*-*-*]
4052 && [check_effective_target_mips_loongson]) } {
4053 set et_vect_no_align_saved 1
4056 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
4057 return $et_vect_no_align_saved
4060 # Return 1 if the target supports a vector misalign access, 0 otherwise.
4062 # This won't change
for different subtargets so
cache the result.
4064 proc check_effective_target_vect_hw_misalign
{ } {
4065 global et_vect_hw_misalign_saved
4067 if [info exists et_vect_hw_misalign_saved
] {
4068 verbose
"check_effective_target_vect_hw_misalign: using cached result" 2
4070 set et_vect_hw_misalign_saved
0
4071 if { ([istarget x86_64
-*-*]
4072 ||
[istarget aarch64
*-*-*]
4073 ||
[istarget i?
86-*-*]) } {
4074 set et_vect_hw_misalign_saved
1
4077 verbose
"check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
4078 return $et_vect_hw_misalign_saved
4082 #
Return 1 if arrays are aligned to the vector alignment
4083 # boundary
, 0 otherwise.
4085 # This won
't change for different subtargets so cache the result.
4087 proc check_effective_target_vect_aligned_arrays { } {
4088 global et_vect_aligned_arrays
4090 if [info exists et_vect_aligned_arrays_saved] {
4091 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
4093 set et_vect_aligned_arrays_saved 0
4094 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4095 if { ([is-effective-target lp64]
4096 && ( ![check_avx_available]
4097 || [check_prefer_avx128])) } {
4098 set et_vect_aligned_arrays_saved 1
4101 if [istarget spu-*-*] {
4102 set et_vect_aligned_arrays_saved 1
4105 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
4106 return $et_vect_aligned_arrays_saved
4109 # Return 1 if types of size 32 bit or less are naturally aligned
4110 # (aligned to their type-size), 0 otherwise.
4112 # This won't change
for different subtargets so
cache the result.
4114 proc check_effective_target_natural_alignment_32
{ } {
4115 global et_natural_alignment_32
4117 if [info exists et_natural_alignment_32_saved
] {
4118 verbose
"check_effective_target_natural_alignment_32: using cached result" 2
4120 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
4121 set et_natural_alignment_32_saved
1
4122 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
4123 set et_natural_alignment_32_saved
0
4126 verbose
"check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4127 return $et_natural_alignment_32_saved
4130 #
Return 1 if types of size
64 bit or less are naturally aligned
(aligned to their
4131 # type
-size
), 0 otherwise.
4133 # This won
't change for different subtargets so cache the result.
4135 proc check_effective_target_natural_alignment_64 { } {
4136 global et_natural_alignment_64
4138 if [info exists et_natural_alignment_64_saved] {
4139 verbose "check_effective_target_natural_alignment_64: using cached result" 2
4141 set et_natural_alignment_64_saved 0
4142 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
4143 || [istarget spu-*-*] } {
4144 set et_natural_alignment_64_saved 1
4147 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4148 return $et_natural_alignment_64_saved
4151 # Return 1 if all vector types are naturally aligned (aligned to their
4152 # type-size), 0 otherwise.
4154 # This won't change
for different subtargets so
cache the result.
4156 proc check_effective_target_vect_natural_alignment
{ } {
4157 global et_vect_natural_alignment
4159 if [info exists et_vect_natural_alignment_saved
] {
4160 verbose
"check_effective_target_vect_natural_alignment: using cached result" 2
4162 set et_vect_natural_alignment_saved
1
4163 if { [check_effective_target_arm_eabi
] } {
4164 set et_vect_natural_alignment_saved
0
4167 verbose
"check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4168 return $et_vect_natural_alignment_saved
4171 #
Return 1 if vector alignment
(for types of size
32 bit or less
) is reachable
, 0 otherwise.
4173 # This won
't change for different subtargets so cache the result.
4175 proc check_effective_target_vector_alignment_reachable { } {
4176 global et_vector_alignment_reachable
4178 if [info exists et_vector_alignment_reachable_saved] {
4179 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
4181 if { [check_effective_target_vect_aligned_arrays]
4182 || [check_effective_target_natural_alignment_32] } {
4183 set et_vector_alignment_reachable_saved 1
4185 set et_vector_alignment_reachable_saved 0
4188 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4189 return $et_vector_alignment_reachable_saved
4192 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
4194 # This won't change
for different subtargets so
cache the result.
4196 proc check_effective_target_vector_alignment_reachable_for_64bit
{ } {
4197 global et_vector_alignment_reachable_for_64bit
4199 if [info exists et_vector_alignment_reachable_for_64bit_saved
] {
4200 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4202 if { [check_effective_target_vect_aligned_arrays
]
4203 ||
[check_effective_target_natural_alignment_64
] } {
4204 set et_vector_alignment_reachable_for_64bit_saved
1
4206 set et_vector_alignment_reachable_for_64bit_saved
0
4209 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4210 return $et_vector_alignment_reachable_for_64bit_saved
4213 #
Return 1 if the target only requires element alignment
for vector accesses
4215 proc check_effective_target_vect_element_align
{ } {
4216 global et_vect_element_align
4218 if [info exists et_vect_element_align
] {
4219 verbose
"check_effective_target_vect_element_align: using cached result" 2
4221 set et_vect_element_align
0
4222 if { ([istarget arm
*-*-*]
4223 && ![check_effective_target_arm_vect_no_misalign
])
4224 ||
[check_effective_target_vect_hw_misalign
] } {
4225 set et_vect_element_align
1
4229 verbose
"check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4230 return $et_vect_element_align
4233 #
Return 1 if the target supports vector conditional operations
, 0 otherwise.
4235 proc check_effective_target_vect_condition
{ } {
4236 global et_vect_cond_saved
4238 if [info exists et_vect_cond_saved
] {
4239 verbose
"check_effective_target_vect_cond: using cached result" 2
4241 set et_vect_cond_saved
0
4242 if { [istarget aarch64
*-*-*]
4243 ||
[istarget powerpc
*-*-*]
4244 ||
[istarget ia64
-*-*]
4245 ||
[istarget i?
86-*-*]
4246 ||
[istarget spu
-*-*]
4247 ||
[istarget x86_64
-*-*]
4248 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
4249 set et_vect_cond_saved
1
4253 verbose
"check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4254 return $et_vect_cond_saved
4257 #
Return 1 if the target supports vector conditional operations where
4258 # the comparison has different type from the lhs
, 0 otherwise.
4260 proc check_effective_target_vect_cond_mixed
{ } {
4261 global et_vect_cond_mixed_saved
4263 if [info exists et_vect_cond_mixed_saved
] {
4264 verbose
"check_effective_target_vect_cond_mixed: using cached result" 2
4266 set et_vect_cond_mixed_saved
0
4267 if { [istarget i?
86-*-*]
4268 ||
[istarget x86_64
-*-*]
4269 ||
[istarget powerpc
*-*-*] } {
4270 set et_vect_cond_mixed_saved
1
4274 verbose
"check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4275 return $et_vect_cond_mixed_saved
4278 #
Return 1 if the target supports vector char multiplication
, 0 otherwise.
4280 proc check_effective_target_vect_char_mult
{ } {
4281 global et_vect_char_mult_saved
4283 if [info exists et_vect_char_mult_saved
] {
4284 verbose
"check_effective_target_vect_char_mult: using cached result" 2
4286 set et_vect_char_mult_saved
0
4287 if { [istarget aarch64
*-*-*]
4288 ||
[istarget ia64
-*-*]
4289 ||
[istarget i?
86-*-*]
4290 ||
[istarget x86_64
-*-*]
4291 ||
[check_effective_target_arm32
] } {
4292 set et_vect_char_mult_saved
1
4296 verbose
"check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4297 return $et_vect_char_mult_saved
4300 #
Return 1 if the target supports vector short multiplication
, 0 otherwise.
4302 proc check_effective_target_vect_short_mult
{ } {
4303 global et_vect_short_mult_saved
4305 if [info exists et_vect_short_mult_saved
] {
4306 verbose
"check_effective_target_vect_short_mult: using cached result" 2
4308 set et_vect_short_mult_saved
0
4309 if { [istarget ia64
-*-*]
4310 ||
[istarget spu
-*-*]
4311 ||
[istarget i?
86-*-*]
4312 ||
[istarget x86_64
-*-*]
4313 ||
[istarget powerpc
*-*-*]
4314 ||
[istarget aarch64
*-*-*]
4315 ||
[check_effective_target_arm32
]
4316 ||
([istarget mips
*-*-*]
4317 && [check_effective_target_mips_loongson
]) } {
4318 set et_vect_short_mult_saved
1
4322 verbose
"check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4323 return $et_vect_short_mult_saved
4326 #
Return 1 if the target supports vector
int multiplication
, 0 otherwise.
4328 proc check_effective_target_vect_int_mult
{ } {
4329 global et_vect_int_mult_saved
4331 if [info exists et_vect_int_mult_saved
] {
4332 verbose
"check_effective_target_vect_int_mult: using cached result" 2
4334 set et_vect_int_mult_saved
0
4335 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4336 ||
[istarget spu
-*-*]
4337 ||
[istarget i?
86-*-*]
4338 ||
[istarget x86_64
-*-*]
4339 ||
[istarget ia64
-*-*]
4340 ||
[istarget aarch64
*-*-*]
4341 ||
[check_effective_target_arm32
] } {
4342 set et_vect_int_mult_saved
1
4346 verbose
"check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4347 return $et_vect_int_mult_saved
4350 #
Return 1 if the target supports vector even
/odd elements extraction
, 0 otherwise.
4352 proc check_effective_target_vect_extract_even_odd
{ } {
4353 global et_vect_extract_even_odd_saved
4355 if [info exists et_vect_extract_even_odd_saved
] {
4356 verbose
"check_effective_target_vect_extract_even_odd: using cached result" 2
4358 set et_vect_extract_even_odd_saved
0
4359 if { [istarget aarch64
*-*-*]
4360 ||
[istarget powerpc
*-*-*]
4361 ||
[is
-effective
-target arm_neon_ok
]
4362 ||
[istarget i?
86-*-*]
4363 ||
[istarget x86_64
-*-*]
4364 ||
[istarget ia64
-*-*]
4365 ||
[istarget spu
-*-*]
4366 ||
([istarget mips
*-*-*]
4367 && [check_effective_target_mpaired_single
]) } {
4368 set et_vect_extract_even_odd_saved
1
4372 verbose
"check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4373 return $et_vect_extract_even_odd_saved
4376 #
Return 1 if the target supports vector interleaving
, 0 otherwise.
4378 proc check_effective_target_vect_interleave
{ } {
4379 global et_vect_interleave_saved
4381 if [info exists et_vect_interleave_saved
] {
4382 verbose
"check_effective_target_vect_interleave: using cached result" 2
4384 set et_vect_interleave_saved
0
4385 if { [istarget aarch64
*-*-*]
4386 ||
[istarget powerpc
*-*-*]
4387 ||
[is
-effective
-target arm_neon_ok
]
4388 ||
[istarget i?
86-*-*]
4389 ||
[istarget x86_64
-*-*]
4390 ||
[istarget ia64
-*-*]
4391 ||
[istarget spu
-*-*]
4392 ||
([istarget mips
*-*-*]
4393 && [check_effective_target_mpaired_single
]) } {
4394 set et_vect_interleave_saved
1
4398 verbose
"check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4399 return $et_vect_interleave_saved
4402 foreach N
{2 3 4 8} {
4403 eval
[string map
[list N $N
] {
4404 #
Return 1 if the target supports
2-vector interleaving
4405 proc check_effective_target_vect_stridedN
{ } {
4406 global et_vect_stridedN_saved
4408 if [info exists et_vect_stridedN_saved
] {
4409 verbose
"check_effective_target_vect_stridedN: using cached result" 2
4411 set et_vect_stridedN_saved
0
4413 && [check_effective_target_vect_interleave
]
4414 && [check_effective_target_vect_extract_even_odd
] } {
4415 set et_vect_stridedN_saved
1
4417 if { ([istarget arm
*-*-*]
4418 ||
[istarget aarch64
*-*-*]) && N
>= 2 && N
<= 4 } {
4419 set et_vect_stridedN_saved
1
4423 verbose
"check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4424 return $et_vect_stridedN_saved
4429 #
Return 1 if the target supports multiple vector sizes
4431 proc check_effective_target_vect_multiple_sizes
{ } {
4432 global et_vect_multiple_sizes_saved
4434 set et_vect_multiple_sizes_saved
0
4435 if { ([istarget aarch64
*-*-*]
4436 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
])) } {
4437 set et_vect_multiple_sizes_saved
1
4439 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
4440 if { ([check_avx_available
] && ![check_prefer_avx128
]) } {
4441 set et_vect_multiple_sizes_saved
1
4445 verbose
"check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4446 return $et_vect_multiple_sizes_saved
4449 #
Return 1 if the target supports vectors of
64 bits.
4451 proc check_effective_target_vect64
{ } {
4452 global et_vect64_saved
4454 if [info exists et_vect64_saved
] {
4455 verbose
"check_effective_target_vect64: using cached result" 2
4457 set et_vect64_saved
0
4458 if { ([istarget arm
*-*-*]
4459 && [check_effective_target_arm_neon_ok
]
4460 && [check_effective_target_arm_little_endian
]) } {
4461 set et_vect64_saved
1
4465 verbose
"check_effective_target_vect64: returning $et_vect64_saved" 2
4466 return $et_vect64_saved
4469 #
Return 1 if the target supports vector copysignf calls.
4471 proc check_effective_target_vect_call_copysignf
{ } {
4472 global et_vect_call_copysignf_saved
4474 if [info exists et_vect_call_copysignf_saved
] {
4475 verbose
"check_effective_target_vect_call_copysignf: using cached result" 2
4477 set et_vect_call_copysignf_saved
0
4478 if { [istarget i?
86-*-*]
4479 ||
[istarget x86_64
-*-*]
4480 ||
[istarget powerpc
*-*-*] } {
4481 set et_vect_call_copysignf_saved
1
4485 verbose
"check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4486 return $et_vect_call_copysignf_saved
4489 #
Return 1 if the target supports vector sqrtf calls.
4491 proc check_effective_target_vect_call_sqrtf
{ } {
4492 global et_vect_call_sqrtf_saved
4494 if [info exists et_vect_call_sqrtf_saved
] {
4495 verbose
"check_effective_target_vect_call_sqrtf: using cached result" 2
4497 set et_vect_call_sqrtf_saved
0
4498 if { [istarget aarch64
*-*-*]
4499 ||
[istarget i?
86-*-*]
4500 ||
[istarget x86_64
-*-*]
4501 ||
([istarget powerpc
*-*-*] && [check_vsx_hw_available
]) } {
4502 set et_vect_call_sqrtf_saved
1
4506 verbose
"check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4507 return $et_vect_call_sqrtf_saved
4510 #
Return 1 if the target supports vector lrint calls.
4512 proc check_effective_target_vect_call_lrint
{ } {
4513 set et_vect_call_lrint
0
4514 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) && [check_effective_target_ilp32
] } {
4515 set et_vect_call_lrint
1
4518 verbose
"check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4519 return $et_vect_call_lrint
4522 #
Return 1 if the target supports vector btrunc calls.
4524 proc check_effective_target_vect_call_btrunc
{ } {
4525 global et_vect_call_btrunc_saved
4527 if [info exists et_vect_call_btrunc_saved
] {
4528 verbose
"check_effective_target_vect_call_btrunc: using cached result" 2
4530 set et_vect_call_btrunc_saved
0
4531 if { [istarget aarch64
*-*-*] } {
4532 set et_vect_call_btrunc_saved
1
4536 verbose
"check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4537 return $et_vect_call_btrunc_saved
4540 #
Return 1 if the target supports vector btruncf calls.
4542 proc check_effective_target_vect_call_btruncf
{ } {
4543 global et_vect_call_btruncf_saved
4545 if [info exists et_vect_call_btruncf_saved
] {
4546 verbose
"check_effective_target_vect_call_btruncf: using cached result" 2
4548 set et_vect_call_btruncf_saved
0
4549 if { [istarget aarch64
*-*-*] } {
4550 set et_vect_call_btruncf_saved
1
4554 verbose
"check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4555 return $et_vect_call_btruncf_saved
4558 #
Return 1 if the target supports vector ceil calls.
4560 proc check_effective_target_vect_call_ceil
{ } {
4561 global et_vect_call_ceil_saved
4563 if [info exists et_vect_call_ceil_saved
] {
4564 verbose
"check_effective_target_vect_call_ceil: using cached result" 2
4566 set et_vect_call_ceil_saved
0
4567 if { [istarget aarch64
*-*-*] } {
4568 set et_vect_call_ceil_saved
1
4572 verbose
"check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4573 return $et_vect_call_ceil_saved
4576 #
Return 1 if the target supports vector ceilf calls.
4578 proc check_effective_target_vect_call_ceilf
{ } {
4579 global et_vect_call_ceilf_saved
4581 if [info exists et_vect_call_ceilf_saved
] {
4582 verbose
"check_effective_target_vect_call_ceilf: using cached result" 2
4584 set et_vect_call_ceilf_saved
0
4585 if { [istarget aarch64
*-*-*] } {
4586 set et_vect_call_ceilf_saved
1
4590 verbose
"check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4591 return $et_vect_call_ceilf_saved
4594 #
Return 1 if the target supports vector floor calls.
4596 proc check_effective_target_vect_call_floor
{ } {
4597 global et_vect_call_floor_saved
4599 if [info exists et_vect_call_floor_saved
] {
4600 verbose
"check_effective_target_vect_call_floor: using cached result" 2
4602 set et_vect_call_floor_saved
0
4603 if { [istarget aarch64
*-*-*] } {
4604 set et_vect_call_floor_saved
1
4608 verbose
"check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4609 return $et_vect_call_floor_saved
4612 #
Return 1 if the target supports vector floorf calls.
4614 proc check_effective_target_vect_call_floorf
{ } {
4615 global et_vect_call_floorf_saved
4617 if [info exists et_vect_call_floorf_saved
] {
4618 verbose
"check_effective_target_vect_call_floorf: using cached result" 2
4620 set et_vect_call_floorf_saved
0
4621 if { [istarget aarch64
*-*-*] } {
4622 set et_vect_call_floorf_saved
1
4626 verbose
"check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4627 return $et_vect_call_floorf_saved
4630 #
Return 1 if the target supports vector lceil calls.
4632 proc check_effective_target_vect_call_lceil
{ } {
4633 global et_vect_call_lceil_saved
4635 if [info exists et_vect_call_lceil_saved
] {
4636 verbose
"check_effective_target_vect_call_lceil: using cached result" 2
4638 set et_vect_call_lceil_saved
0
4639 if { [istarget aarch64
*-*-*] } {
4640 set et_vect_call_lceil_saved
1
4644 verbose
"check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4645 return $et_vect_call_lceil_saved
4648 #
Return 1 if the target supports vector lfloor calls.
4650 proc check_effective_target_vect_call_lfloor
{ } {
4651 global et_vect_call_lfloor_saved
4653 if [info exists et_vect_call_lfloor_saved
] {
4654 verbose
"check_effective_target_vect_call_lfloor: using cached result" 2
4656 set et_vect_call_lfloor_saved
0
4657 if { [istarget aarch64
*-*-*] } {
4658 set et_vect_call_lfloor_saved
1
4662 verbose
"check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4663 return $et_vect_call_lfloor_saved
4666 #
Return 1 if the target supports vector nearbyint calls.
4668 proc check_effective_target_vect_call_nearbyint
{ } {
4669 global et_vect_call_nearbyint_saved
4671 if [info exists et_vect_call_nearbyint_saved
] {
4672 verbose
"check_effective_target_vect_call_nearbyint: using cached result" 2
4674 set et_vect_call_nearbyint_saved
0
4675 if { [istarget aarch64
*-*-*] } {
4676 set et_vect_call_nearbyint_saved
1
4680 verbose
"check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4681 return $et_vect_call_nearbyint_saved
4684 #
Return 1 if the target supports vector nearbyintf calls.
4686 proc check_effective_target_vect_call_nearbyintf
{ } {
4687 global et_vect_call_nearbyintf_saved
4689 if [info exists et_vect_call_nearbyintf_saved
] {
4690 verbose
"check_effective_target_vect_call_nearbyintf: using cached result" 2
4692 set et_vect_call_nearbyintf_saved
0
4693 if { [istarget aarch64
*-*-*] } {
4694 set et_vect_call_nearbyintf_saved
1
4698 verbose
"check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4699 return $et_vect_call_nearbyintf_saved
4702 #
Return 1 if the target supports vector
round calls.
4704 proc check_effective_target_vect_call_round
{ } {
4705 global et_vect_call_round_saved
4707 if [info exists et_vect_call_round_saved
] {
4708 verbose
"check_effective_target_vect_call_round: using cached result" 2
4710 set et_vect_call_round_saved
0
4711 if { [istarget aarch64
*-*-*] } {
4712 set et_vect_call_round_saved
1
4716 verbose
"check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4717 return $et_vect_call_round_saved
4720 #
Return 1 if the target supports vector roundf calls.
4722 proc check_effective_target_vect_call_roundf
{ } {
4723 global et_vect_call_roundf_saved
4725 if [info exists et_vect_call_roundf_saved
] {
4726 verbose
"check_effective_target_vect_call_roundf: using cached result" 2
4728 set et_vect_call_roundf_saved
0
4729 if { [istarget aarch64
*-*-*] } {
4730 set et_vect_call_roundf_saved
1
4734 verbose
"check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4735 return $et_vect_call_roundf_saved
4738 #
Return 1 if the target supports section
-anchors
4740 proc check_effective_target_section_anchors
{ } {
4741 global et_section_anchors_saved
4743 if [info exists et_section_anchors_saved
] {
4744 verbose
"check_effective_target_section_anchors: using cached result" 2
4746 set et_section_anchors_saved
0
4747 if { [istarget powerpc
*-*-*]
4748 ||
[istarget arm
*-*-*] } {
4749 set et_section_anchors_saved
1
4753 verbose
"check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4754 return $et_section_anchors_saved
4757 #
Return 1 if the target supports atomic operations
on "int_128" values.
4759 proc check_effective_target_sync_int_128
{ } {
4760 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4761 && ![is
-effective
-target ia32
] } {
4768 #
Return 1 if the target supports atomic operations
on "int_128" values
4769 # and can
execute them.
4771 proc check_effective_target_sync_int_128_runtime
{ } {
4772 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4773 && ![is
-effective
-target ia32
] } {
4774 return [check_cached_effective_target sync_int_128_available
{
4775 check_runtime_nocache sync_int_128_available
{
4779 unsigned
int eax
, ebx
, ecx
, edx
;
4780 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4781 return !(ecx
& bit_CMPXCHG16B
);
4791 #
Return 1 if the target supports atomic operations
on "long long".
4793 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4795 proc check_effective_target_sync_long_long
{ } {
4796 if { [istarget x86_64
-*-*]
4797 ||
[istarget i?
86-*-*])
4798 ||
[istarget aarch64
*-*-*]
4799 ||
[istarget arm
*-*-*]
4800 ||
[istarget alpha
*-*-*]
4801 ||
([istarget sparc
*-*-*] && [check_effective_target_lp64
]) } {
4808 #
Return 1 if the target supports atomic operations
on "long long"
4809 # and can
execute them.
4811 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4813 proc check_effective_target_sync_long_long_runtime
{ } {
4814 if { [istarget x86_64
-*-*]
4815 ||
[istarget i?
86-*-*] } {
4816 return [check_cached_effective_target sync_long_long_available
{
4817 check_runtime_nocache sync_long_long_available
{
4821 unsigned
int eax
, ebx
, ecx
, edx
;
4822 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4823 return !(edx
& bit_CMPXCHG8B
);
4828 } elseif
{ [istarget aarch64
*-*-*] } {
4830 } elseif
{ [istarget arm
*-*-linux
-*] } {
4831 return [check_runtime sync_longlong_runtime
{
4837 if (sizeof
(long long
) != 8)
4840 /* Just check
for native
; checking
for kernel fallback is tricky.
*/
4841 asm volatile
("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4846 } elseif
{ [istarget alpha
*-*-*] } {
4848 } elseif
{ ([istarget sparc
*-*-*]
4849 && [check_effective_target_lp64
]
4850 && [check_effective_target_ultrasparc_hw
]) } {
4852 } elseif
{ [istarget powerpc
*-*-*] && [check_effective_target_lp64
] } {
4859 #
Return 1 if the target supports byte swap instructions.
4861 proc check_effective_target_bswap
{ } {
4862 global et_bswap_saved
4864 if [info exists et_bswap_saved
] {
4865 verbose
"check_effective_target_bswap: using cached result" 2
4867 set et_bswap_saved
0
4868 if { [istarget aarch64
-*-*]
4869 ||
[istarget alpha
*-*-*]
4870 ||
[istarget arm
*-*-*]
4871 ||
[istarget i?
86-*-*]
4872 ||
[istarget m68k
-*-*]
4873 ||
[istarget powerpc
*-*-*]
4874 ||
[istarget rs6000
-*-*]
4875 ||
[istarget s390
*-*-*]
4876 ||
[istarget x86_64
-*-*] } {
4877 set et_bswap_saved
1
4881 verbose
"check_effective_target_bswap: returning $et_bswap_saved" 2
4882 return $et_bswap_saved
4885 #
Return 1 if the target supports
16-bit byte swap instructions.
4887 proc check_effective_target_bswap16
{ } {
4888 global et_bswap16_saved
4890 if [info exists et_bswap16_saved
] {
4891 verbose
"check_effective_target_bswap16: using cached result" 2
4893 set et_bswap16_saved
0
4894 if { [is
-effective
-target bswap
]
4895 && ![istarget alpha
*-*-*]
4896 && ![istarget i?
86-*-*]
4897 && ![istarget x86_64
-*-*] } {
4898 set et_bswap16_saved
1
4902 verbose
"check_effective_target_bswap16: returning $et_bswap16_saved" 2
4903 return $et_bswap16_saved
4906 #
Return 1 if the target supports
32-bit byte swap instructions.
4908 proc check_effective_target_bswap32
{ } {
4909 global et_bswap32_saved
4911 if [info exists et_bswap32_saved
] {
4912 verbose
"check_effective_target_bswap32: using cached result" 2
4914 set et_bswap32_saved
0
4915 if { [is
-effective
-target bswap
] } {
4916 set et_bswap32_saved
1
4920 verbose
"check_effective_target_bswap32: returning $et_bswap32_saved" 2
4921 return $et_bswap32_saved
4924 #
Return 1 if the target supports
64-bit byte swap instructions.
4926 proc check_effective_target_bswap64
{ } {
4927 global et_bswap64_saved
4929 if [info exists et_bswap64_saved
] {
4930 verbose
"check_effective_target_bswap64: using cached result" 2
4932 set et_bswap64_saved
0
4933 if { [is
-effective
-target bswap
]
4934 && [is
-effective
-target lp64
] } {
4935 set et_bswap64_saved
1
4939 verbose
"check_effective_target_bswap64: returning $et_bswap64_saved" 2
4940 return $et_bswap64_saved
4943 #
Return 1 if the target supports atomic operations
on "int" and "long".
4945 proc check_effective_target_sync_int_long
{ } {
4946 global et_sync_int_long_saved
4948 if [info exists et_sync_int_long_saved
] {
4949 verbose
"check_effective_target_sync_int_long: using cached result" 2
4951 set et_sync_int_long_saved
0
4952 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
4953 # load-reserved/store-conditional instructions.
4954 if { [istarget ia64-*-*]
4955 || [istarget i?86-*-*]
4956 || [istarget x86_64-*-*]
4957 || [istarget aarch64*-*-*]
4958 || [istarget alpha*-*-*]
4959 || [istarget arm*-*-linux-*]
4960 || [istarget bfin*-*linux*]
4961 || [istarget hppa*-*linux*]
4962 || [istarget s390*-*-*]
4963 || [istarget powerpc*-*-*]
4964 || [istarget crisv32-*-*] || [istarget cris-*-*]
4965 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
4966 || [check_effective_target_mips_llsc] } {
4967 set et_sync_int_long_saved 1
4971 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
4972 return $et_sync_int_long_saved
4975 # Return 1 if the target supports atomic operations on "char" and "short".
4977 proc check_effective_target_sync_char_short { } {
4978 global et_sync_char_short_saved
4980 if [info exists et_sync_char_short_saved] {
4981 verbose "check_effective_target_sync_char_short: using cached result" 2
4983 set et_sync_char_short_saved 0
4984 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
4985 #
load-reserved/store
-conditional instructions.
4986 if { [istarget aarch64
*-*-*]
4987 ||
[istarget ia64
-*-*]
4988 ||
[istarget i?
86-*-*]
4989 ||
[istarget x86_64
-*-*]
4990 ||
[istarget alpha
*-*-*]
4991 ||
[istarget arm
*-*-linux
-*]
4992 ||
[istarget hppa
*-*linux
*]
4993 ||
[istarget s390
*-*-*]
4994 ||
[istarget powerpc
*-*-*]
4995 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
4996 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
4997 ||
[check_effective_target_mips_llsc
] } {
4998 set et_sync_char_short_saved
1
5002 verbose
"check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
5003 return $et_sync_char_short_saved
5006 #
Return 1 if the target uses a ColdFire FPU.
5008 proc check_effective_target_coldfire_fpu
{ } {
5009 return [check_no_compiler_messages coldfire_fpu assembly
{
5016 #
Return true
if this is a uClibc target.
5018 proc check_effective_target_uclibc
{} {
5019 return [check_no_compiler_messages uclibc object
{
5020 #
include <features.h
>
5021 #
if !defined
(__UCLIBC__
)
5027 #
Return true
if this is a uclibc target and
if the uclibc feature
5028 # described by __$feature__ is not present.
5030 proc check_missing_uclibc_feature
{feature
} {
5031 return [check_no_compiler_messages $feature object
"
5032 #
include <features.h
>
5033 #
if !defined
(__UCLIBC
) || defined
(__$
{feature
}__
)
5039 #
Return true
if this is a Newlib target.
5041 proc check_effective_target_newlib
{} {
5042 return [check_no_compiler_messages newlib object
{
5047 #
Return true
if this is NOT a Bionic target.
5049 proc check_effective_target_non_bionic
{} {
5050 return [check_no_compiler_messages non_bionic object
{
5052 #
if defined
(__BIONIC__
)
5059 #
(a
) an error of a few ULP is expected in string to floating
-point
5060 # conversion functions
; and
5061 #
(b
) overflow is not always detected correctly by those functions.
5063 proc check_effective_target_lax_strtofp
{} {
5064 # By default
, assume that all uClibc targets suffer from this.
5065 return [check_effective_target_uclibc
]
5068 #
Return 1 if this is a target
for which wcsftime is a dummy
5069 # function that always returns
0.
5071 proc check_effective_target_dummy_wcsftime
{} {
5072 # By default
, assume that all uClibc targets suffer from this.
5073 return [check_effective_target_uclibc
]
5076 #
Return 1 if constructors with initialization priority arguments are
5077 # supposed
on this target.
5079 proc check_effective_target_init_priority
{} {
5080 return [check_no_compiler_messages init_priority assembly
"
5081 void f
() __attribute__
((constructor
(1000)));
5086 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
5087 # This can be used with
any check_
* proc that takes no
argument and
5088 # returns only
1 or
0. It could be used with check_
* procs that take
5089 # arguments with keywords that pass particular arguments.
5091 proc is
-effective
-target
{ arg } {
5093 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5094 set selected
[check_effective_target_$
{arg}]
5097 "vmx_hw" { set selected [check_vmx_hw_available] }
5098 "vsx_hw" { set selected [check_vsx_hw_available] }
5099 "p8vector_hw" { set selected [check_p8vector_hw_available] }
5100 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
5101 "dfp_hw" { set selected [check_dfp_hw_available] }
5102 "named_sections" { set selected [check_named_sections_available] }
5103 "gc_sections" { set selected [check_gc_sections_available] }
5104 "cxa_atexit" { set selected [check_cxa_atexit_available] }
5105 default
{ error
"unknown effective target keyword `$arg'" }
5108 verbose
"is-effective-target: $arg $selected" 2
5112 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
5114 proc is
-effective
-target
-keyword
{ arg } {
5115 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5118 # These have different names
for their check_
* procs.
5120 "vmx_hw" { return 1 }
5121 "vsx_hw" { return 1 }
5122 "p8vector_hw" { return 1 }
5123 "ppc_recip_hw" { return 1 }
5124 "dfp_hw" { return 1 }
5125 "named_sections" { return 1 }
5126 "gc_sections" { return 1 }
5127 "cxa_atexit" { return 1 }
5128 default
{ return 0 }
5133 #
Return 1 if target default to short enums
5135 proc check_effective_target_short_enums
{ } {
5136 return [check_no_compiler_messages short_enums assembly
{
5138 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
5142 #
Return 1 if target supports merging string constants at link time.
5144 proc check_effective_target_string_merging
{ } {
5145 return [check_no_messages_and_pattern string_merging \
5146 "rodata\\.str" assembly {
5147 const char
*var
= "String";
5151 #
Return 1 if target has the basic signed and unsigned types in
5152 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
5153 # working
<stdint.h
> for all targets.
5155 proc check_effective_target_stdint_types
{ } {
5156 return [check_no_compiler_messages stdint_types assembly
{
5158 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
5159 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
5163 #
Return 1 if target has the basic signed and unsigned types in
5164 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
5165 # these types agree with those in the header, as some systems have
5166 # only <inttypes.h>.
5168 proc check_effective_target_inttypes_types { } {
5169 return [check_no_compiler_messages inttypes_types assembly {
5170 #include <inttypes.h>
5171 int8_t a; int16_t b; int32_t c; int64_t d;
5172 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
5176 # Return 1 if programs are intended to be run on a simulator
5177 # (i.e. slowly) rather than hardware (i.e. fast).
5179 proc check_effective_target_simulator { } {
5181 # All "src/sim" simulators set this one.
5182 if [board_info target exists is_simulator] {
5183 return [board_info target is_simulator]
5186 # The "sid" simulators don't
set that one
, but at least they
set
5188 if [board_info target
exists slow_simulator
] {
5189 return [board_info target slow_simulator
]
5195 #
Return 1 if programs are intended to be run
on hardware rather than
5198 proc check_effective_target_hw
{ } {
5200 # All
"src/sim" simulators set this one.
5201 if [board_info target
exists is_simulator
] {
5202 if [board_info target is_simulator
] {
5209 # The
"sid" simulators don't set that one, but at least they set
5211 if [board_info target
exists slow_simulator
] {
5212 if [board_info target slow_simulator
] {
5222 #
Return 1 if the target is a VxWorks kernel.
5224 proc check_effective_target_vxworks_kernel
{ } {
5225 return [check_no_compiler_messages vxworks_kernel assembly
{
5226 #
if !defined __vxworks || defined __RTP__
5232 #
Return 1 if the target is a VxWorks RTP.
5234 proc check_effective_target_vxworks_rtp
{ } {
5235 return [check_no_compiler_messages vxworks_rtp assembly
{
5236 #
if !defined __vxworks ||
!defined __RTP__
5242 #
Return 1 if the target is expected to provide wide character support.
5244 proc check_effective_target_wchar
{ } {
5245 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5248 return [check_no_compiler_messages wchar assembly
{
5253 #
Return 1 if the target has
<pthread.h
>.
5255 proc check_effective_target_pthread_h
{ } {
5256 return [check_no_compiler_messages pthread_h assembly
{
5257 #
include <pthread.h
>
5261 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5262 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5263 # chsize. We test
for a trivially functional truncation
; no stubs.
5264 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5265 # different function to be used.
5267 proc check_effective_target_fd_truncate { } {
5269 #define _FILE_OFFSET_BITS 64
5275 FILE *f = fopen ("tst.tmp", "wb");
5277 const char t[] = "test writing more than ten characters";
5281 write (fd, t, sizeof (t) - 1);
5283 if (ftruncate (fd, 10) != 0)
5292 f = fopen ("tst.tmp", "rb");
5293 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5301 if { [check_runtime ftruncate $prog] } {
5305 regsub "ftruncate" $prog "chsize" prog
5306 return [check_runtime chsize $prog]
5309 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5311 proc add_options_for_c99_runtime { flags } {
5312 if { [istarget *-*-solaris2*] } {
5313 return "$flags -std=c99"
5315 if { [istarget powerpc-*-darwin*] } {
5316 return "$flags -mmacosx-version-min=10.3"
5321 # Add to FLAGS all the target-specific flags needed to enable
5322 # full IEEE compliance mode.
5324 proc add_options_for_ieee { flags } {
5325 if { [istarget alpha*-*-*]
5326 || [istarget sh*-*-*] } {
5327 return "$flags -mieee"
5329 if { [istarget rx-*-*] } {
5330 return "$flags -mnofpu"
5335 if {![info exists flags_to_postpone]} {
5336 set flags_to_postpone ""
5339 # Add to FLAGS the flags needed to enable functions to bind locally
5340 # when using pic/PIC passes in the testsuite.
5341 proc add_options_for_bind_pic_locally { flags } {
5342 global flags_to_postpone
5344 # Instead of returning 'flags
' with the -fPIE or -fpie appended, we save it
5345 # in 'flags_to_postpone
' and append it later in gcc_target_compile procedure in
5346 # order to make sure that the multilib_flags doesn't override this.
5348 if {[check_no_compiler_messages using_pic2 assembly
{
5353 set flags_to_postpone
"-fPIE"
5356 if {[check_no_compiler_messages using_pic1 assembly
{
5361 set flags_to_postpone
"-fpie"
5367 # Add to FLAGS the flags needed to enable
64-bit vectors.
5369 proc add_options_for_double_vectors
{ flags
} {
5370 if [is
-effective
-target arm_neon_ok
] {
5371 return "$flags -mvectorize-with-neon-double"
5377 #
Return 1 if the target provides a full C99 runtime.
5379 proc check_effective_target_c99_runtime
{ } {
5380 return [check_cached_effective_target c99_runtime
{
5383 set file
[open
"$srcdir/gcc.dg/builtins-config.h"]
5384 set contents
[read $file
]
5387 #ifndef HAVE_C99_RUNTIME
5391 check_no_compiler_messages_nocache c99_runtime assembly \
5392 $contents
[add_options_for_c99_runtime
""]
5396 #
Return 1 if target wchar_t is at least
4 bytes.
5398 proc check_effective_target_4byte_wchar_t
{ } {
5399 return [check_no_compiler_messages
4byte_wchar_t object
{
5400 int dummy
[sizeof
(__WCHAR_TYPE__
) >= 4 ?
1 : -1];
5404 #
Return 1 if the target supports automatic stack alignment.
5406 proc check_effective_target_automatic_stack_alignment
{ } {
5407 # Ordinarily x86 supports automatic stack alignment ...
5408 if { [istarget i?
86*-*-*] ||
[istarget x86_64
-*-*] } then {
5409 if { [istarget
*-*-mingw
*] ||
[istarget
*-*-cygwin
*] } {
5410 # ... except Win64 SEH doesn
't. Succeed for Win32 though.
5411 return [check_effective_target_ilp32];
5418 # Return true if we are compiling for AVX target.
5420 proc check_avx_available { } {
5421 if { [check_no_compiler_messages avx_available assembly {
5431 # Return true if 32- and 16-bytes vectors are available.
5433 proc check_effective_target_vect_sizes_32B_16B { } {
5434 if { [check_avx_available] && ![check_prefer_avx128] } {
5441 # Return true if 128-bits vectors are preferred even if 256-bits vectors
5444 proc check_prefer_avx128 { } {
5445 if ![check_avx_available] {
5448 return [check_no_messages_and_pattern avx_explicit "xmm" assembly {
5449 float a[1024],b[1024],c[1024];
5450 void foo (void) { int i; for (i = 0; i < 1024; i++) a[i]=b[i]+c[i];}
5451 } "-O2 -ftree-vectorize"]
5455 # Return 1 if avx512f instructions can be compiled.
5457 proc check_effective_target_avx512f { } {
5458 return [check_no_compiler_messages avx512f object {
5459 typedef double __m512d __attribute__ ((__vector_size__ (64)));
5461 __m512d _mm512_add (__m512d a)
5463 return __builtin_ia32_addpd512_mask (a, a, a, 1, 4);
5468 # Return 1 if avx instructions can be compiled.
5470 proc check_effective_target_avx { } {
5471 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
5474 return [check_no_compiler_messages avx object {
5475 void _mm256_zeroall (void)
5477 __builtin_ia32_vzeroall ();
5482 # Return 1 if avx2 instructions can be compiled.
5483 proc check_effective_target_avx2 { } {
5484 return [check_no_compiler_messages avx2 object {
5485 typedef long long __v4di __attribute__ ((__vector_size__ (32)));
5487 mm256_is32_andnotsi256 (__v4di __X, __v4di __Y)
5489 return __builtin_ia32_andnotsi256 (__X, __Y);
5494 # Return 1 if sse instructions can be compiled.
5495 proc check_effective_target_sse { } {
5496 return [check_no_compiler_messages sse object {
5499 __builtin_ia32_stmxcsr ();
5505 # Return 1 if sse2 instructions can be compiled.
5506 proc check_effective_target_sse2 { } {
5507 return [check_no_compiler_messages sse2 object {
5508 typedef long long __m128i __attribute__ ((__vector_size__ (16)));
5510 __m128i _mm_srli_si128 (__m128i __A, int __N)
5512 return (__m128i)__builtin_ia32_psrldqi128 (__A, 8);
5517 # Return 1 if F16C instructions can be compiled.
5519 proc check_effective_target_f16c { } {
5520 return [check_no_compiler_messages f16c object {
5521 #include "immintrin.h"
5523 foo (unsigned short val)
5525 return _cvtsh_ss (val);
5530 # Return 1 if C wchar_t type is compatible with char16_t.
5532 proc check_effective_target_wchar_t_char16_t_compatible { } {
5533 return [check_no_compiler_messages wchar_t_char16_t object {
5535 __CHAR16_TYPE__ *p16 = &wc;
5536 char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5540 # Return 1 if C wchar_t type is compatible with char32_t.
5542 proc check_effective_target_wchar_t_char32_t_compatible { } {
5543 return [check_no_compiler_messages wchar_t_char32_t object {
5545 __CHAR32_TYPE__ *p32 = &wc;
5546 char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5550 # Return 1 if pow10 function exists.
5552 proc check_effective_target_pow10 { } {
5553 return [check_runtime pow10 {
5563 # Return 1 if current options generate DFP instructions, 0 otherwise.
5565 proc check_effective_target_hard_dfp {} {
5566 return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
5567 typedef float d64 __attribute__((mode(DD)));
5569 void foo (void) { z = x + y; }
5573 # Return 1 if string.h and wchar.h headers provide C++ requires overloads
5574 # for strchr etc. functions.
5576 proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
5577 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
5580 #if !defined(__cplusplus) \
5581 || !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) \
5582 || !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
5583 ISO C++ correct string.h and wchar.h protos not supported.
5590 # Return 1 if GNU as is used.
5592 proc check_effective_target_gas { } {
5593 global use_gas_saved
5596 if {![info exists use_gas_saved]} {
5597 # Check if the as used by gcc is GNU as.
5598 set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
5599 # Provide /dev/null as input, otherwise gas times out reading from
5601 set status [remote_exec host "$gcc_as" "-v /dev/null"]
5602 set as_output [lindex $status 1]
5603 if { [ string first "GNU" $as_output ] >= 0 } {
5609 return $use_gas_saved
5612 # Return 1 if GNU ld is used.
5614 proc check_effective_target_gld { } {
5615 global use_gld_saved
5618 if {![info exists use_gld_saved]} {
5619 # Check if the ld used by gcc is GNU ld.
5620 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0]
5621 set status [remote_exec host "$gcc_ld" "--version"]
5622 set ld_output [lindex $status 1]
5623 if { [ string first "GNU" $ld_output ] >= 0 } {
5629 return $use_gld_saved
5632 # Return 1 if the compiler has been configure with link-time optimization
5635 proc check_effective_target_lto { } {
5637 return [info exists ENABLE_LTO]
5640 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
5642 proc check_effective_target_maybe_x32 { } {
5643 return [check_no_compiler_messages maybe_x32 object {
5645 } "-mx32 -maddress-mode=short"]
5648 # Return 1 if this target supports the -fsplit-stack option, 0
5651 proc check_effective_target_split_stack {} {
5652 return [check_no_compiler_messages split_stack object {
5657 # Return 1 if this target supports the -masm=intel option, 0
5660 proc check_effective_target_masm_intel {} {
5661 return [check_no_compiler_messages masm_intel object {
5662 extern void abort (void);
5666 # Return 1 if the language for the compiler under test is C.
5668 proc check_effective_target_c { } {
5670 if [string match $tool "gcc"] {
5676 # Return 1 if the language for the compiler under test is C++.
5678 proc check_effective_target_c++ { } {
5680 if [string match $tool "g++"] {
5686 # Check whether the current active language standard supports the features
5687 # of C++11/C++14 by checking for the presence of one of the -std
5688 # flags. This assumes that the default for the compiler is C++98, and that
5689 # there will never be multiple -std= arguments on the command line.
5690 proc check_effective_target_c++11_only { } {
5691 if ![check_effective_target_c++] {
5694 return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
5696 proc check_effective_target_c++11 { } {
5697 if [check_effective_target_c++11_only] {
5700 return [check_effective_target_c++14]
5702 proc check_effective_target_c++11_down { } {
5703 if ![check_effective_target_c++] {
5706 return ![check_effective_target_c++14]
5709 proc check_effective_target_c++14_only { } {
5710 if ![check_effective_target_c++] {
5713 return [check-flags { { } { } { -std=c++1y -std=gnu++1y -std=c++14 -std=gnu++14 } }]
5716 proc check_effective_target_c++14 { } {
5717 if [check_effective_target_c++14_only] {
5720 return [check_effective_target_c++1z]
5722 proc check_effective_target_c++14_down { } {
5723 if ![check_effective_target_c++] {
5726 return ![check_effective_target_c++1z]
5729 proc check_effective_target_c++98_only { } {
5730 if ![check_effective_target_c++] {
5733 return ![check_effective_target_c++11]
5736 proc check_effective_target_c++1z_only { } {
5737 if ![check_effective_target_c++] {
5740 return [check-flags { { } { } { -std=c++1z -std=gnu++1z } }]
5742 proc check_effective_target_c++1z { } {
5743 return [check_effective_target_c++1z_only]
5746 # Return 1 if expensive testcases should be run.
5748 proc check_effective_target_run_expensive_tests { } {
5749 if { [getenv GCC_TEST_RUN_EXPENSIVE] != "" } {
5755 # Returns 1 if "mempcpy" is available on the target system.
5757 proc check_effective_target_mempcpy {} {
5758 return [check_function_available "mempcpy"]
5761 # Check whether the vectorizer tests are supported by the target and
5762 # append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
5763 # Set dg-do-what-default to either compile or run, depending on target
5764 # capabilities. Return 1 if vectorizer tests are supported by
5765 # target, 0 otherwise.
5767 proc check_vect_support_and_set_flags { } {
5768 global DEFAULT_VECTCFLAGS
5769 global dg-do-what-default
5771 if [istarget powerpc-*paired*] {
5772 lappend DEFAULT_VECTCFLAGS "-mpaired"
5773 if [check_750cl_hw_available] {
5774 set dg-do-what-default run
5776 set dg-do-what-default compile
5778 } elseif [istarget powerpc*-*-*] {
5779 # Skip targets not supporting -maltivec.
5780 if ![is-effective-target powerpc_altivec_ok] {
5784 lappend DEFAULT_VECTCFLAGS "-maltivec"
5785 if [check_p8vector_hw_available] {
5786 lappend DEFAULT_VECTCFLAGS "-mpower8-vector" "-mno-allow-movmisalign"
5787 } elseif [check_vsx_hw_available] {
5788 lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
5791 if [check_vmx_hw_available] {
5792 set dg-do-what-default run
5794 if [is-effective-target ilp32] {
5795 # Specify a cpu that supports VMX for compile-only tests.
5796 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
5798 set dg-do-what-default compile
5800 } elseif { [istarget spu-*-*] } {
5801 set dg-do-what-default run
5802 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
5803 lappend DEFAULT_VECTCFLAGS "-msse2"
5804 if { [check_effective_target_sse2_runtime] } {
5805 set dg-do-what-default run
5807 set dg-do-what-default compile
5809 } elseif { [istarget mips*-*-*]
5810 && ([check_effective_target_mpaired_single]
5811 || [check_effective_target_mips_loongson])
5812 && [check_effective_target_nomips16] } {
5813 if { [check_effective_target_mpaired_single] } {
5814 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
5816 set dg-do-what-default run
5817 } elseif [istarget sparc*-*-*] {
5818 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
5819 if [check_effective_target_ultrasparc_hw] {
5820 set dg-do-what-default run
5822 set dg-do-what-default compile
5824 } elseif [istarget alpha*-*-*] {
5825 # Alpha's vectorization capabilities are extremely limited.
5826 # It
's more effort than its worth disabling all of the tests
5827 # that it cannot pass. But if you actually want to see what
5828 # does work, command out the return.
5831 lappend DEFAULT_VECTCFLAGS "-mmax"
5832 if [check_alpha_max_hw_available] {
5833 set dg-do-what-default run
5835 set dg-do-what-default compile
5837 } elseif [istarget ia64-*-*] {
5838 set dg-do-what-default run
5839 } elseif [is-effective-target arm_neon_ok] {
5840 eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
5841 # NEON does not support denormals, so is not used for vectorization by
5842 # default to avoid loss of precision. We must pass -ffast-math to test
5843 # vectorization of float operations.
5844 lappend DEFAULT_VECTCFLAGS "-ffast-math"
5845 if [is-effective-target arm_neon_hw] {
5846 set dg-do-what-default run
5848 set dg-do-what-default compile
5850 } elseif [istarget "aarch64*-*-*"] {
5851 set dg-do-what-default run
5859 # Return 1 if the target does *not* require strict alignment.
5861 proc check_effective_target_non_strict_align {} {
5862 return [check_no_compiler_messages non_strict_align assembly {
5864 typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
5866 void foo(void) { z = (c *) y; }
5870 # Return 1 if the target has <ucontext.h>.
5872 proc check_effective_target_ucontext_h { } {
5873 return [check_no_compiler_messages ucontext_h assembly {
5874 #include <ucontext.h>
5878 proc check_effective_target_aarch64_tiny { } {
5879 if { [istarget aarch64*-*-*] } {
5880 return [check_no_compiler_messages aarch64_tiny object {
5881 #ifdef __AARCH64_CMODEL_TINY__
5884 #error target not AArch64 tiny code model
5892 proc check_effective_target_aarch64_small { } {
5893 if { [istarget aarch64*-*-*] } {
5894 return [check_no_compiler_messages aarch64_small object {
5895 #ifdef __AARCH64_CMODEL_SMALL__
5898 #error target not AArch64 small code model
5906 proc check_effective_target_aarch64_large { } {
5907 if { [istarget aarch64*-*-*] } {
5908 return [check_no_compiler_messages aarch64_large object {
5909 #ifdef __AARCH64_CMODEL_LARGE__
5912 #error target not AArch64 large code model
5920 # Return 1 if <fenv.h> is available with all the standard IEEE
5921 # exceptions and floating-point exceptions are raised by arithmetic
5922 # operations. (If the target requires special options for "inexact"
5923 # exceptions, those need to be specified in the testcases.)
5925 proc check_effective_target_fenv_exceptions {} {
5926 return [check_runtime fenv_exceptions {
5929 #ifndef FE_DIVBYZERO
5930 # error Missing FE_DIVBYZERO
5933 # error Missing FE_INEXACT
5936 # error Missing FE_INVALID
5939 # error Missing FE_OVERFLOW
5941 #ifndef FE_UNDERFLOW
5942 # error Missing FE_UNDERFLOW
5944 volatile float a = 0.0f, r;
5949 if (fetestexcept (FE_INVALID))
5954 } [add_options_for_ieee "-std=gnu99"]]
5957 proc check_effective_target_tiny {} {
5958 if { [istarget aarch64*-*-*]
5959 && [check_effective_target_aarch64_tiny] } {
5965 # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
5967 proc check_effective_target_logical_op_short_circuit {} {
5968 if { [istarget mips*-*-*]
5969 || [istarget arc*-*-*]
5970 || [istarget avr*-*-*]
5971 || [istarget crisv32-*-*] || [istarget cris-*-*]
5972 || [istarget mmix-*-*]
5973 || [istarget s390*-*-*]
5974 || [istarget powerpc*-*-*]
5975 || [istarget nios2*-*-*]
5976 || [check_effective_target_arm_cortex_m] } {
5982 # Record that dg-final test TEST requires convential compilation.
5984 proc force_conventional_output_for { test } {
5985 if { [info proc $test] == "" } {
5986 perror "$test does not exist"
5989 proc ${test}_required_options {} {
5990 global gcc_force_conventional_output
5991 return $gcc_force_conventional_output