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 # Save additional_sources to avoid compiling testsuite
's sources
45 # against check_compile's source.
46 global additional_sources
47 if [info exists additional_sources
] {
48 set tmp_additional_sources
"$additional_sources"
49 set additional_sources
""
52 if { [llength $
args] > 0 } {
53 set options
[list
"additional_flags=[lindex $args 0]"]
57 switch -glob
-- $contents
{
58 "*! Fortran*" { set src ${basename}[pid].f90 }
59 "*// C++*" { set src ${basename}[pid].cc }
60 "*// ObjC++*" { set src ${basename}[pid].mm }
61 "*/* ObjC*" { set src ${basename}[pid].m }
62 "*// Go*" { set src ${basename}[pid].go }
65 "objc" { set src ${basename}[pid].m }
66 "obj-c++" { set src ${basename}[pid].mm }
67 default
{ set src $
{basename
}[pid
].c
}
72 set compile_type $type
74 assembly
{ set output $
{basename
}[pid
].s
}
75 object
{ set output $
{basename
}[pid
].o
}
76 executable
{ set output $
{basename
}[pid
].exe
}
78 set output $
{basename
}[pid
].s
79 lappend options
"additional_flags=-fdump-$type"
80 set compile_type assembly
86 set lines
[$
{tool
}_target_compile $src $output $compile_type
"$options"]
89 set scan_output $output
90 # Don
't try folding this into the switch above; calling "glob" before the
91 # file is created won't work.
92 if [regexp
"rtl-(.*)" $type dummy rtl_type] {
93 set scan_output
"[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
97 # Restore additional_sources.
98 if [info exists additional_sources
] {
99 set additional_sources
"$tmp_additional_sources"
102 return [list $lines $scan_output
]
105 proc current_target_name
{ } {
107 if [info exists target_info
(target
,name)] {
108 set answer $target_info
(target
,name)
115 # Implement an effective
-target check
for property PROP by invoking
116 # the Tcl command
ARGS and seeing
if it returns true.
118 proc check_cached_effective_target
{ prop
args } {
121 set target
[current_target_name
]
122 if {![info exists et_cache
($prop
,target
)]
123 || $et_cache
($prop
,target
) != $target
} {
124 verbose
"check_cached_effective_target $prop: checking $target" 2
125 set et_cache
($prop
,target
) $target
126 set et_cache
($prop
,value
) [uplevel eval $
args]
128 set value $et_cache
($prop
,value
)
129 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
133 # Like check_compile
, but
delete the output file and
return true
if the
134 # compiler printed no messages.
135 proc check_no_compiler_messages_nocache
{args} {
136 set result
[eval check_compile $
args]
137 set lines
[lindex $result
0]
138 set output
[lindex $result
1]
139 remote_file build
delete $output
140 return [string match
"" $lines]
143 # Like check_no_compiler_messages_nocache
, but
cache the result.
144 # PROP is the
property we
're checking, and doubles as a prefix for
145 # temporary filenames.
146 proc check_no_compiler_messages {prop args} {
147 return [check_cached_effective_target $prop {
148 eval [list check_no_compiler_messages_nocache $prop] $args
152 # Like check_compile, but return true if the compiler printed no
153 # messages and if the contents of the output file satisfy PATTERN.
154 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
155 # don't match regular expression REGEXP
, otherwise they satisfy it
156 #
if they
do match regular expression PATTERN.
(PATTERN can start
157 # with something like
"[!]" if the regular expression needs to match
158 #
"!" as the first character.)
160 #
Delete the output file before returning. The other arguments are
161 # as
for check_compile.
162 proc check_no_messages_and_pattern_nocache
{basename pattern
args} {
165 set result
[eval
[list check_compile $basename
] $
args]
166 set lines
[lindex $result
0]
167 set output
[lindex $result
1]
170 if { [string match
"" $lines] } {
171 set chan
[open
"$output"]
172 set invert
[regexp
{^
!(.
*)} $pattern dummy pattern
]
173 set ok
[expr
{ [regexp $pattern
[read $chan
]] != $invert
}]
177 remote_file build
delete $output
181 # Like check_no_messages_and_pattern_nocache
, but
cache the result.
182 # PROP is the
property we
're checking, and doubles as a prefix for
183 # temporary filenames.
184 proc check_no_messages_and_pattern {prop pattern args} {
185 return [check_cached_effective_target $prop {
186 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
190 # Try to compile and run an executable from code CONTENTS. Return true
191 # if the compiler reports no messages and if execution "passes" in the
192 # usual DejaGNU sense. The arguments are as for check_compile, with
193 # TYPE implicitly being "executable".
194 proc check_runtime_nocache {basename contents args} {
197 set result [eval [list check_compile $basename executable $contents] $args]
198 set lines [lindex $result 0]
199 set output [lindex $result 1]
202 if { [string match "" $lines] } {
203 # No error messages, everything is OK.
204 set result [remote_load target "./$output" "" ""]
205 set status [lindex $result 0]
206 verbose "check_runtime_nocache $basename: status is <$status>" 2
207 if { $status == "pass" } {
211 remote_file build delete $output
215 # Like check_runtime_nocache, but cache the result. PROP is the
216 # property we're checking
, and doubles as a prefix
for temporary
218 proc check_runtime
{prop
args} {
221 return [check_cached_effective_target $prop
{
222 eval
[list check_runtime_nocache $prop
] $
args
226 ###############################
227 # proc check_weak_available
{ }
228 ###############################
230 # weak symbols are only supported in some configs
/object formats
231 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
233 proc check_weak_available
{ } {
236 # All mips targets should support it
238 if { [ string first
"mips" $target_cpu ] >= 0 } {
242 # All AIX targets should support it
244 if { [istarget
*-*-aix
*] } {
248 # All solaris2 targets should support it
250 if { [istarget
*-*-solaris2
*] } {
254 # Windows targets Cygwin and MingW32 support it
256 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
260 # HP
-UX
10.X doesn
't support it
262 if { [istarget hppa*-*-hpux10*] } {
266 # ELF and ECOFF support it. a.out does with gas/gld but may also with
267 # other linkers, so we should try it
269 set objformat [gcc_target_object_format]
277 unknown { return -1 }
282 ###############################
283 # proc check_weak_override_available { }
284 ###############################
286 # Like check_weak_available, but return 0 if weak symbol definitions
287 # cannot be overridden.
289 proc check_weak_override_available { } {
290 if { [istarget *-*-mingw*] } {
293 return [check_weak_available]
296 ###############################
297 # proc check_visibility_available { what_kind }
298 ###############################
300 # The visibility attribute is only support in some object formats
301 # This proc returns 1 if it is supported, 0 if not.
302 # The argument is the kind of visibility, default/protected/hidden/internal.
304 proc check_visibility_available { what_kind } {
305 if [string match "" $what_kind] { set what_kind "hidden" }
307 return [check_no_compiler_messages visibility_available_$what_kind object "
308 void f() __attribute__((visibility(\"$what_kind\")));
313 ###############################
314 # proc check_alias_available { }
315 ###############################
317 # Determine if the target toolchain supports the alias attribute.
319 # Returns 2 if the target supports aliases. Returns 1 if the target
320 # only supports weak aliased. Returns 0 if the target does not
321 # support aliases at all. Returns -1 if support for aliases could not
324 proc check_alias_available { } {
325 global alias_available_saved
328 if [info exists alias_available_saved] {
329 verbose "check_alias_available returning saved $alias_available_saved" 2
333 verbose "check_alias_available compiling testfile $src" 2
334 set f [open $src "w"]
335 # Compile a small test program. The definition of "g" is
336 # necessary to keep the Solaris assembler from complaining
338 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
339 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
341 set lines [${tool}_target_compile $src $obj object ""]
343 remote_file build delete $obj
345 if [string match "" $lines] then {
346 # No error messages, everything is OK.
347 set alias_available_saved 2
349 if [regexp "alias definitions not supported" $lines] {
350 verbose "check_alias_available target does not support aliases" 2
352 set objformat [gcc_target_object_format]
354 if { $objformat == "elf" } {
355 verbose "check_alias_available but target uses ELF format, so it ought to" 2
356 set alias_available_saved -1
358 set alias_available_saved 0
361 if [regexp "only weak aliases are supported" $lines] {
362 verbose "check_alias_available target supports only weak aliases" 2
363 set alias_available_saved 1
365 set alias_available_saved -1
370 verbose "check_alias_available returning $alias_available_saved" 2
373 return $alias_available_saved
376 # Returns 1 if the target toolchain supports strong aliases, 0 otherwise.
378 proc check_effective_target_alias { } {
379 if { [check_alias_available] < 2 } {
386 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
388 proc check_ifunc_available { } {
389 return [check_no_compiler_messages ifunc_available object {
394 void f() __attribute__((ifunc("g")));
398 # Returns true if --gc-sections is supported on the target.
400 proc check_gc_sections_available { } {
401 global gc_sections_available_saved
404 if {![info exists gc_sections_available_saved]} {
405 # Some targets don't support gc
-sections despite whatever
's
406 # advertised by ld's options.
407 if { [istarget alpha
*-*-*]
408 ||
[istarget ia64
-*-*] } {
409 set gc_sections_available_saved
0
413 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
415 if { [board_info target
exists ldflags
]
416 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
417 set gc_sections_available_saved
0
421 # VxWorks kernel modules are relocatable objects linked with
-r
,
422 #
while RTP executables are linked with
-q
(--emit
-relocs
).
423 # Both of these options are incompatible with
--gc
-sections.
424 if { [istarget
*-*-vxworks
*] } {
425 set gc_sections_available_saved
0
429 # Check
if the
ld used by gcc supports
--gc
-sections.
430 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
431 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
432 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
433 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
434 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
435 set gc_sections_available_saved
1
437 set gc_sections_available_saved
0
440 return $gc_sections_available_saved
443 #
Return 1 if according to target_info struct and explicit target list
444 # target is supposed to support trampolines.
446 proc check_effective_target_trampolines
{ } {
447 if [target_info
exists no_trampolines
] {
450 if { [istarget avr
-*-*]
451 ||
[istarget msp430
-*-*]
452 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
453 ||
[istarget hppa64
-hp
-hpux11.23
] } {
459 #
Return 1 if according to target_info struct and explicit target list
460 # target is supposed to keep null pointer checks. This could be due to
461 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
463 proc check_effective_target_keeps_null_pointer_checks
{ } {
464 if [target_info
exists keeps_null_pointer_checks
] {
467 if { [istarget avr
-*-*] } {
473 #
Return true
if profiling is supported
on the target.
475 proc check_profiling_available
{ test_what
} {
476 global profiling_available_saved
478 verbose
"Profiling argument is <$test_what>" 1
480 # These conditions depend
on the
argument so examine them before
481 # looking at the
cache variable.
483 # Tree profiling requires TLS runtime support.
484 if { $test_what
== "-fprofile-generate" } {
485 if { ![check_effective_target_tls_runtime
] } {
490 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
491 # vendor compiler. We cannot reliably predict the directory where the
492 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
493 # necessarily find mcrt1.o even if we have it.
494 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
498 # We don't yet support profiling
for MIPS16.
499 if { [istarget mips
*-*-*]
500 && ![check_effective_target_nomips16
]
501 && ($test_what
== "-p" || $test_what == "-pg") } {
505 # MinGW does not support
-p.
506 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
510 # cygwin does not support
-p.
511 if { [istarget
*-*-cygwin
*] && $test_what
== "-p" } {
515 # uClibc does not have gcrt1.o.
516 if { [check_effective_target_uclibc
]
517 && ($test_what
== "-p" || $test_what == "-pg") } {
521 # Now examine the
cache variable.
522 if {![info exists profiling_available_saved
]} {
523 # Some targets don
't have any implementation of __bb_init_func or are
524 # missing other needed machinery.
525 if { [istarget aarch64*-*-elf]
526 || [istarget am3*-*-linux*]
527 || [istarget arm*-*-eabi*]
528 || [istarget arm*-*-elf]
529 || [istarget arm*-*-symbianelf*]
530 || [istarget avr-*-*]
531 || [istarget bfin-*-*]
532 || [istarget cris-*-*]
533 || [istarget crisv32-*-*]
534 || [istarget fido-*-elf]
535 || [istarget h8300-*-*]
536 || [istarget lm32-*-*]
537 || [istarget m32c-*-elf]
538 || [istarget m68k-*-elf]
539 || [istarget m68k-*-uclinux*]
540 || [istarget mep-*-elf]
541 || [istarget mips*-*-elf*]
542 || [istarget mmix-*-*]
543 || [istarget mn10300-*-elf*]
544 || [istarget moxie-*-elf*]
545 || [istarget msp430-*-*]
546 || [istarget nds32*-*-elf]
547 || [istarget nios2-*-elf]
548 || [istarget picochip-*-*]
549 || [istarget powerpc-*-eabi*]
550 || [istarget powerpc-*-elf]
552 || [istarget tic6x-*-elf]
553 || [istarget xstormy16-*]
554 || [istarget xtensa*-*-elf]
555 || [istarget *-*-rtems*]
556 || [istarget *-*-vxworks*] } {
557 set profiling_available_saved 0
559 set profiling_available_saved 1
563 return $profiling_available_saved
566 # Check to see if a target is "freestanding". This is as per the definition
567 # in Section 4 of C99 standard. Effectively, it is a target which supports no
568 # extra headers or libraries other than what is considered essential.
569 proc check_effective_target_freestanding { } {
570 if { [istarget picochip-*-*] } then {
577 # Return 1 if target has packed layout of structure members by
578 # default, 0 otherwise. Note that this is slightly different than
579 # whether the target has "natural alignment": both attributes may be
582 proc check_effective_target_default_packed { } {
583 return [check_no_compiler_messages default_packed assembly {
584 struct x { char a; long b; } c;
585 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
589 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
590 # documentation, where the test also comes from.
592 proc check_effective_target_pcc_bitfield_type_matters { } {
593 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
594 # bitfields
, but let
's stick to the example code from the docs.
595 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
596 struct foo1 { char x; char :0; char y; };
597 struct foo2 { char x; int :0; char y; };
598 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
602 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
604 proc add_options_for_tls { flags } {
605 # On Solaris 9, __tls_get_addr/___tls_get_addr only lives in
606 # libthread, so always pass -pthread for native TLS. Same for AIX.
607 # Need to duplicate native TLS check from
608 # check_effective_target_tls_native to avoid recursion.
609 if { ([istarget *-*-solaris2.9*] || [istarget powerpc-ibm-aix*]) &&
610 [check_no_messages_and_pattern tls_native "!emutls" assembly {
612 int f (void) { return i; }
613 void g (int j) { i = j; }
615 return "$flags -pthread"
620 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
622 proc check_effective_target_tls {} {
623 return [check_no_compiler_messages tls assembly {
625 int f (void) { return i; }
626 void g (int j) { i = j; }
630 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
632 proc check_effective_target_tls_native {} {
633 # VxWorks uses emulated TLS machinery, but with non-standard helper
634 # functions, so we fail to automatically detect it.
635 if { [istarget *-*-vxworks*] } {
639 return [check_no_messages_and_pattern tls_native "!emutls" assembly {
641 int f (void) { return i; }
642 void g (int j) { i = j; }
646 # Return 1 if *emulated* thread local storage (TLS) is supported, 0 otherwise.
648 proc check_effective_target_tls_emulated {} {
649 # VxWorks uses emulated TLS machinery, but with non-standard helper
650 # functions, so we fail to automatically detect it.
651 if { [istarget *-*-vxworks*] } {
655 return [check_no_messages_and_pattern tls_emulated "emutls" assembly {
657 int f (void) { return i; }
658 void g (int j) { i = j; }
662 # Return 1 if TLS executables can run correctly, 0 otherwise.
664 proc check_effective_target_tls_runtime {} {
665 # MSP430 runtime does not have TLS support, but just
666 # running the test below is insufficient to show this.
667 if { [istarget msp430-*-*] } {
670 return [check_runtime tls_runtime {
671 __thread int thr = 0;
672 int main (void) { return thr; }
673 } [add_options_for_tls ""]]
676 # Return 1 if atomic compare-and-swap is supported on 'int'
678 proc check_effective_target_cas_char {} {
679 return [check_no_compiler_messages cas_char assembly {
680 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
686 proc check_effective_target_cas_int {} {
687 return [check_no_compiler_messages cas_int assembly {
688 #if __INT_MAX__ == 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
690 #elif __INT_MAX__ == 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
698 # Return 1 if -ffunction-sections is supported, 0 otherwise.
700 proc check_effective_target_function_sections {} {
701 # Darwin has its own scheme and silently accepts -ffunction-sections.
702 if { [istarget *-*-darwin*] } {
706 return [check_no_compiler_messages functionsections assembly {
708 } "-ffunction-sections"]
711 # Return 1 if instruction scheduling is available, 0 otherwise.
713 proc check_effective_target_scheduling {} {
714 return [check_no_compiler_messages scheduling object {
716 } "-fschedule-insns"]
719 # Return 1 if trapping arithmetic is available, 0 otherwise.
721 proc check_effective_target_trapping {} {
722 return [check_no_compiler_messages scheduling object {
723 add (int a, int b) { return a + b; }
727 # Return 1 if compilation with -fgraphite is error-free for trivial
730 proc check_effective_target_fgraphite {} {
731 return [check_no_compiler_messages fgraphite object {
736 # Return 1 if compilation with -fopenmp is error-free for trivial
739 proc check_effective_target_fopenmp {} {
740 return [check_no_compiler_messages fopenmp object {
745 # Return 1 if compilation with -fgnu-tm is error-free for trivial
748 proc check_effective_target_fgnu_tm {} {
749 return [check_no_compiler_messages fgnu_tm object {
754 # Return 1 if the target supports mmap, 0 otherwise.
756 proc check_effective_target_mmap {} {
757 return [check_function_available "mmap"]
760 # Return 1 if the target supports dlopen, 0 otherwise.
761 proc check_effective_target_dlopen {} {
762 return [check_no_compiler_messages dlopen executable {
764 int main(void) { dlopen ("dummy.so", RTLD_NOW); }
765 } [add_options_for_dlopen ""]]
768 proc add_options_for_dlopen { flags } {
772 # Return 1 if the target supports clone, 0 otherwise.
773 proc check_effective_target_clone {} {
774 return [check_function_available "clone"]
777 # Return 1 if the target supports setrlimit, 0 otherwise.
778 proc check_effective_target_setrlimit {} {
779 # Darwin has non-posix compliant RLIMIT_AS
780 if { [istarget *-*-darwin*] } {
783 return [check_function_available "setrlimit"]
786 # Return 1 if the target supports swapcontext, 0 otherwise.
787 proc check_effective_target_swapcontext {} {
788 return [check_no_compiler_messages swapcontext executable {
789 #include <ucontext.h>
792 ucontext_t orig_context,child_context;
793 if (swapcontext(&child_context, &orig_context) < 0) { }
798 # Return 1 if compilation with -pthread is error-free for trivial
801 proc check_effective_target_pthread {} {
802 return [check_no_compiler_messages pthread object {
807 # Return 1 if compilation with -mpe-aligned-commons is error-free
808 # for trivial code, 0 otherwise.
810 proc check_effective_target_pe_aligned_commons {} {
811 if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
812 return [check_no_compiler_messages pe_aligned_commons object {
814 } "-mpe-aligned-commons"]
819 # Return 1 if the target supports -static
820 proc check_effective_target_static {} {
821 return [check_no_compiler_messages static executable {
822 int main (void) { return 0; }
826 # Return 1 if the target supports -fstack-protector
827 proc check_effective_target_fstack_protector {} {
828 return [check_runtime fstack_protector {
829 int main (void) { return 0; }
830 } "-fstack-protector"]
833 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
834 # for trivial code, 0 otherwise.
836 proc check_effective_target_freorder {} {
837 return [check_no_compiler_messages freorder object {
839 } "-freorder-blocks-and-partition"]
842 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
843 # emitted, 0 otherwise. Whether a shared library can actually be built is
844 # out of scope for this test.
846 proc check_effective_target_fpic { } {
847 # Note that M68K has a multilib that supports -fpic but not
848 # -fPIC, so we need to check both. We test with a program that
849 # requires GOT references.
850 foreach arg {fpic fPIC} {
851 if [check_no_compiler_messages $arg object {
852 extern int foo (void); extern int bar;
853 int baz (void) { return foo () + bar; }
861 # Return 1 if -shared is supported, as in no warnings or errors
862 # emitted, 0 otherwise.
864 proc check_effective_target_shared { } {
865 # Note that M68K has a multilib that supports -fpic but not
866 # -fPIC, so we need to check both. We test with a program that
867 # requires GOT references.
868 return [check_no_compiler_messages shared executable {
869 extern int foo (void); extern int bar;
870 int baz (void) { return foo () + bar; }
874 # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
876 proc check_effective_target_pie { } {
877 if { [istarget *-*-darwin\[912\]*]
878 || [istarget *-*-linux*]
879 || [istarget *-*-gnu*] } {
885 # Return true if the target supports -mpaired-single (as used on MIPS).
887 proc check_effective_target_mpaired_single { } {
888 return [check_no_compiler_messages mpaired_single object {
893 # Return true if the target has access to FPU instructions.
895 proc check_effective_target_hard_float { } {
896 if { [istarget mips*-*-*] } {
897 return [check_no_compiler_messages hard_float assembly {
898 #if (defined __mips_soft_float || defined __mips16)
904 # This proc is actually checking the availabilty of FPU
905 # support for doubles, so on the RX we must fail if the
906 # 64-bit double multilib has been selected.
907 if { [istarget rx-*-*] } {
909 # return [check_no_compiler_messages hard_float assembly {
910 #if defined __RX_64_BIT_DOUBLES__
916 # The generic test equates hard_float with "no call for adding doubles".
917 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
918 double a (double b, double c) { return b + c; }
922 # Return true if the target is a 64-bit MIPS target.
924 proc check_effective_target_mips64 { } {
925 return [check_no_compiler_messages mips64 assembly {
932 # Return true if the target is a MIPS target that does not produce
935 proc check_effective_target_nomips16 { } {
936 return [check_no_compiler_messages nomips16 object {
940 /* A cheap way of testing for -mflip-mips16. */
941 void foo (void) { asm ("addiu $20,$20,1"); }
942 void bar (void) { asm ("addiu $20,$20,1"); }
947 # Add the options needed for MIPS16 function attributes. At the moment,
948 # we don't support MIPS16 PIC.
950 proc add_options_for_mips16_attribute
{ flags
} {
951 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
954 #
Return true
if we can force a
mode that allows MIPS16 code generation.
955 # We don
't support MIPS16 PIC, and only support MIPS16 -mhard-float
958 proc check_effective_target_mips16_attribute { } {
959 return [check_no_compiler_messages mips16_attribute assembly {
963 #if defined __mips_hard_float \
964 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
965 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
968 } [add_options_for_mips16_attribute ""]]
971 # Return 1 if the target supports long double larger than double when
972 # using the new ABI, 0 otherwise.
974 proc check_effective_target_mips_newabi_large_long_double { } {
975 return [check_no_compiler_messages mips_newabi_large_long_double object {
976 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
980 # Return true if the target is a MIPS target that has access
981 # to the LL and SC instructions.
983 proc check_effective_target_mips_llsc { } {
984 if { ![istarget mips*-*-*] } {
987 # Assume that these instructions are always implemented for
988 # non-elf* targets, via emulation if necessary.
989 if { ![istarget *-*-elf*] } {
992 # Otherwise assume LL/SC support for everything but MIPS I.
993 return [check_no_compiler_messages mips_llsc assembly {
1000 # Return true if the target is a MIPS target that uses in-place relocations.
1002 proc check_effective_target_mips_rel { } {
1003 if { ![istarget mips*-*-*] } {
1006 return [check_no_compiler_messages mips_rel object {
1007 #if (defined _ABIN32 && _MIPS_SIM == _ABIN32) \
1008 || (defined _ABI64 && _MIPS_SIM == _ABI64)
1014 # Return true if the target is a MIPS target that uses the EABI.
1016 proc check_effective_target_mips_eabi { } {
1017 if { ![istarget mips*-*-*] } {
1020 return [check_no_compiler_messages mips_eabi object {
1027 # Return 1 if the current multilib does not generate PIC by default.
1029 proc check_effective_target_nonpic { } {
1030 return [check_no_compiler_messages nonpic assembly {
1037 # Return 1 if the target does not use a status wrapper.
1039 proc check_effective_target_unwrapped { } {
1040 if { [target_info needs_status_wrapper] != "" \
1041 && [target_info needs_status_wrapper] != "0" } {
1047 # Return true if iconv is supported on the target. In particular IBM1047.
1049 proc check_iconv_available { test_what } {
1052 # If the tool configuration file has not set libiconv, try "-liconv"
1053 if { ![info exists libiconv] } {
1054 set libiconv "-liconv"
1056 set test_what [lindex $test_what 1]
1057 return [check_runtime_nocache $test_what [subst {
1063 cd = iconv_open ("$test_what", "UTF-8");
1064 if (cd == (iconv_t) -1)
1071 # Return true if Cilk Library is supported on the target.
1072 proc check_libcilkrts_available { } {
1073 return [ check_no_compiler_messages_nocache libcilkrts_available executable {
1077 int __cilkrts_set_param (const char *, const char *);
1079 int x = __cilkrts_set_param ("nworkers", "0");
1082 } "-fcilkplus -lcilkrts" ]
1085 # Return 1 if an ASCII locale is supported on this host, 0 otherwise.
1087 proc check_ascii_locale_available { } {
1091 # Return true if named sections are supported on this target.
1093 proc check_named_sections_available { } {
1094 return [check_no_compiler_messages named_sections assembly {
1095 int __attribute__ ((section("whatever"))) foo;
1099 # Return true if the "naked" function attribute is supported on this target.
1101 proc check_effective_target_naked_functions { } {
1102 return [check_no_compiler_messages naked_functions assembly {
1103 void f() __attribute__((naked));
1107 # Return 1 if the target supports Fortran real kinds larger than real(8),
1110 # When the target name changes, replace the cached result.
1112 proc check_effective_target_fortran_large_real { } {
1113 return [check_no_compiler_messages fortran_large_real executable {
1115 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
1122 # Return 1 if the target supports Fortran real kind real(16),
1123 # 0 otherwise. Contrary to check_effective_target_fortran_large_real
1124 # this checks for Real(16) only; the other returned real(10) if
1125 # both real(10) and real(16) are available.
1127 # When the target name changes, replace the cached result.
1129 proc check_effective_target_fortran_real_16 { } {
1130 return [check_no_compiler_messages fortran_real_16 executable {
1139 # Return 1 if the target supports SQRT for the largest floating-point
1140 # type. (Some targets lack the libm support for this FP type.)
1141 # On most targets, this check effectively checks either whether sqrtl is
1142 # available or on __float128 systems whether libquadmath is installed,
1143 # which provides sqrtq.
1145 # When the target name changes, replace the cached result.
1147 proc check_effective_target_fortran_largest_fp_has_sqrt { } {
1148 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
1150 use iso_fortran_env, only: real_kinds
1151 integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
1152 real(kind=maxFP), volatile :: x
1160 # Return 1 if the target supports Fortran integer kinds larger than
1161 # integer(8), 0 otherwise.
1163 # When the target name changes, replace the cached result.
1165 proc check_effective_target_fortran_large_int { } {
1166 return [check_no_compiler_messages fortran_large_int executable {
1168 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
1169 integer(kind=k) :: i
1174 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
1176 # When the target name changes, replace the cached result.
1178 proc check_effective_target_fortran_integer_16 { } {
1179 return [check_no_compiler_messages fortran_integer_16 executable {
1186 # Return 1 if we can statically link libgfortran, 0 otherwise.
1188 # When the target name changes, replace the cached result.
1190 proc check_effective_target_static_libgfortran { } {
1191 return [check_no_compiler_messages static_libgfortran executable {
1198 # Return 1 if cilk-plus is supported by the target, 0 otherwise.
1200 proc check_effective_target_cilkplus { } {
1201 # Skip cilk-plus tests on int16 and size16 targets for now.
1202 # The cilk-plus tests are not generic enough to cover these
1203 # cases and would throw hundreds of FAILs.
1204 if { [check_effective_target_int16]
1205 || ![check_effective_target_size32plus] } {
1209 # Skip AVR, its RAM is too small and too many tests would fail.
1210 if { [istarget avr-*-*] } {
1216 proc check_linker_plugin_available { } {
1217 return [check_no_compiler_messages_nocache linker_plugin executable {
1218 int main() { return 0; }
1219 } "-flto -fuse-linker-plugin"]
1222 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1223 # otherwise. Cache the result.
1225 proc check_750cl_hw_available { } {
1226 return [check_cached_effective_target 750cl_hw_available {
1227 # If this is not the right target then we can skip the test.
1228 if { ![istarget powerpc-*paired*] } {
1231 check_runtime_nocache 750cl_hw_available {
1235 asm volatile ("ps_mul v0,v0,v0");
1237 asm volatile ("ps_mul 0,0,0");
1246 # Return 1 if the target OS supports running SSE executables, 0
1247 # otherwise. Cache the result.
1249 proc check_sse_os_support_available { } {
1250 return [check_cached_effective_target sse_os_support_available {
1251 # If this is not the right target then we can skip the test.
1252 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1254 } elseif { [istarget i?86-*-solaris2*] } {
1255 # The Solaris 2 kernel doesn't save and restore SSE registers
1256 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1257 check_runtime_nocache sse_os_support_available
{
1260 asm volatile
("movaps %xmm0,%xmm0");
1270 #
Return 1 if the target OS supports running AVX executables
, 0
1271 # otherwise.
Cache the result.
1273 proc check_avx_os_support_available
{ } {
1274 return [check_cached_effective_target avx_os_support_available
{
1275 #
If this is not the right target
then we can skip the test.
1276 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1279 # Check that OS has AVX and SSE saving enabled.
1280 check_runtime_nocache avx_os_support_available
{
1283 unsigned
int eax
, edx
;
1285 asm
("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1286 return (eax
& 6) != 6;
1293 #
Return 1 if the target supports executing SSE instructions
, 0
1294 # otherwise.
Cache the result.
1296 proc check_sse_hw_available
{ } {
1297 return [check_cached_effective_target sse_hw_available
{
1298 #
If this is not the right target
then we can skip the test.
1299 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1302 check_runtime_nocache sse_hw_available
{
1306 unsigned
int eax
, ebx
, ecx
, edx
;
1307 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1308 return !(edx
& bit_SSE
);
1316 #
Return 1 if the target supports executing SSE2 instructions
, 0
1317 # otherwise.
Cache the result.
1319 proc check_sse2_hw_available
{ } {
1320 return [check_cached_effective_target sse2_hw_available
{
1321 #
If this is not the right target
then we can skip the test.
1322 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1325 check_runtime_nocache sse2_hw_available
{
1329 unsigned
int eax
, ebx
, ecx
, edx
;
1330 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1331 return !(edx
& bit_SSE2
);
1339 #
Return 1 if the target supports executing AVX instructions
, 0
1340 # otherwise.
Cache the result.
1342 proc check_avx_hw_available
{ } {
1343 return [check_cached_effective_target avx_hw_available
{
1344 #
If this is not the right target
then we can skip the test.
1345 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1348 check_runtime_nocache avx_hw_available
{
1352 unsigned
int eax
, ebx
, ecx
, edx
;
1353 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1354 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1355 != (bit_AVX | bit_OSXSAVE
));
1363 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1365 proc check_effective_target_sse_runtime
{ } {
1366 if { [check_effective_target_sse
]
1367 && [check_sse_hw_available
]
1368 && [check_sse_os_support_available
] } {
1374 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1376 proc check_effective_target_sse2_runtime
{ } {
1377 if { [check_effective_target_sse2
]
1378 && [check_sse2_hw_available
]
1379 && [check_sse_os_support_available
] } {
1385 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1387 proc check_effective_target_avx_runtime
{ } {
1388 if { [check_effective_target_avx
]
1389 && [check_avx_hw_available
]
1390 && [check_avx_os_support_available
] } {
1396 #
Return 1 if the target supports executing power8 vector instructions
, 0
1397 # otherwise.
Cache the result.
1399 proc check_p8vector_hw_available
{ } {
1400 return [check_cached_effective_target p8vector_hw_available
{
1401 # Some simulators are known to not support VSX
/power8 instructions.
1402 #
For now
, disable
on Darwin
1403 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1406 set options
"-mpower8-vector"
1407 check_runtime_nocache p8vector_hw_available
{
1411 asm volatile
("xxlorc vs0,vs0,vs0");
1413 asm volatile
("xxlorc 0,0,0");
1422 #
Return 1 if the target supports executing VSX instructions
, 0
1423 # otherwise.
Cache the result.
1425 proc check_vsx_hw_available
{ } {
1426 return [check_cached_effective_target vsx_hw_available
{
1427 # Some simulators are known to not support VSX instructions.
1428 #
For now
, disable
on Darwin
1429 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1433 check_runtime_nocache vsx_hw_available
{
1437 asm volatile
("xxlor vs0,vs0,vs0");
1439 asm volatile
("xxlor 0,0,0");
1448 #
Return 1 if the target supports executing AltiVec instructions
, 0
1449 # otherwise.
Cache the result.
1451 proc check_vmx_hw_available
{ } {
1452 return [check_cached_effective_target vmx_hw_available
{
1453 # Some simulators are known to not support VMX instructions.
1454 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1457 # Most targets don
't require special flags for this test case, but
1458 # Darwin does. Just to be sure, make sure VSX is not enabled for
1459 # the altivec tests.
1460 if { [istarget *-*-darwin*]
1461 || [istarget *-*-aix*] } {
1462 set options "-maltivec -mno-vsx"
1464 set options "-mno-vsx"
1466 check_runtime_nocache vmx_hw_available {
1470 asm volatile ("vor v0,v0,v0");
1472 asm volatile ("vor 0,0,0");
1481 proc check_ppc_recip_hw_available { } {
1482 return [check_cached_effective_target ppc_recip_hw_available {
1483 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1484 # For now, disable on Darwin
1485 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1488 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1489 check_runtime_nocache ppc_recip_hw_available {
1490 volatile double d_recip, d_rsqrt, d_four = 4.0;
1491 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1494 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1495 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1496 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1497 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1505 # Return 1 if the target supports executing AltiVec and Cell PPU
1506 # instructions, 0 otherwise. Cache the result.
1508 proc check_effective_target_cell_hw { } {
1509 return [check_cached_effective_target cell_hw_available {
1510 # Some simulators are known to not support VMX and PPU instructions.
1511 if { [istarget powerpc-*-eabi*] } {
1514 # Most targets don't require special flags
for this test
1515 # case
, but Darwin and AIX
do.
1516 if { [istarget
*-*-darwin
*]
1517 ||
[istarget
*-*-aix
*] } {
1518 set options
"-maltivec -mcpu=cell"
1520 set options
"-mcpu=cell"
1522 check_runtime_nocache cell_hw_available
{
1526 asm volatile
("vor v0,v0,v0");
1527 asm volatile
("lvlx v0,r0,r0");
1529 asm volatile
("vor 0,0,0");
1530 asm volatile
("lvlx 0,0,0");
1539 #
Return 1 if the target supports executing
64-bit instructions
, 0
1540 # otherwise.
Cache the result.
1542 proc check_effective_target_powerpc64
{ } {
1543 global powerpc64_available_saved
1546 if [info exists powerpc64_available_saved
] {
1547 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1549 set powerpc64_available_saved
0
1551 # Some simulators are known to not support powerpc64 instructions.
1552 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1553 verbose
"check_effective_target_powerpc64 returning 0" 2
1554 return $powerpc64_available_saved
1557 #
Set up
, compile, and
execute a test
program containing a
64-bit
1558 # instruction.
Include the current process ID in the file
1559 # names to prevent conflicts with invocations
for multiple
1564 set f
[open $src
"w"]
1565 puts $f
"int main() {"
1566 puts $f
"#ifdef __MACH__"
1567 puts $f
" asm volatile (\"extsw r0,r0\");"
1569 puts $f
" asm volatile (\"extsw 0,0\");"
1571 puts $f
" return 0; }"
1574 set opts
"additional_flags=-mcpu=G5"
1576 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1577 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1580 if [string match
"" $lines] then {
1581 # No error message
, compilation succeeded.
1582 set result
[$
{tool
}_load
"./$exe" "" ""]
1583 set status [lindex $result
0]
1584 remote_file build
delete $exe
1585 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1587 if { $
status == "pass" } then {
1588 set powerpc64_available_saved
1
1591 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1595 return $powerpc64_available_saved
1598 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1599 # complex float arguments. This affects gfortran tests that
call cabsf
1600 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1601 #
argument passing as the compiler under test
, 0 otherwise.
1603 # When the target
name changes
, replace the cached result.
1605 proc check_effective_target_broken_cplxf_arg
{ } {
1606 return [check_cached_effective_target broken_cplxf_arg
{
1607 # Skip the work
for targets known not to be affected.
1608 if { ![istarget powerpc64
-*-linux
*] } {
1610 } elseif
{ ![is
-effective
-target lp64
] } {
1613 check_runtime_nocache broken_cplxf_arg
{
1614 #
include <complex.h
>
1615 extern void abort
(void
);
1616 float fabsf
(float
);
1617 float cabsf
(_Complex float
);
1624 if (fabsf
(f
- 5.0) > 0.0001)
1633 #
Return 1 is this is a TI C6X target supporting C67X instructions
1634 proc check_effective_target_ti_c67x
{ } {
1635 return [check_no_compiler_messages ti_c67x assembly
{
1636 #
if !defined
(_TMS320C6700
)
1642 #
Return 1 is this is a TI C6X target supporting C64X
+ instructions
1643 proc check_effective_target_ti_c64xp
{ } {
1644 return [check_no_compiler_messages ti_c64xp assembly
{
1645 #
if !defined
(_TMS320C6400_PLUS
)
1652 proc check_alpha_max_hw_available
{ } {
1653 return [check_runtime alpha_max_hw_available
{
1654 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1658 # Returns true iff the FUNCTION is available
on the target
system.
1659 #
(This is essentially a Tcl implementation of Autoconf
's
1662 proc check_function_available { function } {
1663 return [check_no_compiler_messages ${function}_available \
1669 int main () { $function (); }
1673 # Returns true iff "fork" is available on the target system.
1675 proc check_fork_available {} {
1676 return [check_function_available "fork"]
1679 # Returns true iff "mkfifo" is available on the target system.
1681 proc check_mkfifo_available {} {
1682 if { [istarget *-*-cygwin*] } {
1683 # Cygwin has mkfifo, but support is incomplete.
1687 return [check_function_available "mkfifo"]
1690 # Returns true iff "__cxa_atexit" is used on the target system.
1692 proc check_cxa_atexit_available { } {
1693 return [check_cached_effective_target cxa_atexit_available {
1694 if { [istarget hppa*-*-hpux10*] } {
1695 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1697 } elseif
{ [istarget
*-*-vxworks
] } {
1698 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1701 check_runtime_nocache cxa_atexit_available {
1704 static unsigned int count;
1721 Y() { f(); count = 2; }
1730 int main() { return 0; }
1736 proc check_effective_target_objc2 { } {
1737 return [check_no_compiler_messages objc2 object {
1746 proc check_effective_target_next_runtime { } {
1747 return [check_no_compiler_messages objc2 object {
1748 #ifdef __NEXT_RUNTIME__
1756 # Return 1 if we're generating
32-bit code using default options
, 0
1759 proc check_effective_target_ilp32
{ } {
1760 return [check_no_compiler_messages ilp32 object
{
1761 int dummy
[sizeof
(int) == 4
1762 && sizeof
(void
*) == 4
1763 && sizeof
(long
) == 4 ?
1 : -1];
1767 #
Return 1 if we
're generating ia32 code using default options, 0
1770 proc check_effective_target_ia32 { } {
1771 return [check_no_compiler_messages ia32 object {
1772 int dummy[sizeof (int) == 4
1773 && sizeof (void *) == 4
1774 && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
1778 # Return 1 if we're generating x32 code using default options
, 0
1781 proc check_effective_target_x32
{ } {
1782 return [check_no_compiler_messages x32 object
{
1783 int dummy
[sizeof
(int) == 4
1784 && sizeof
(void
*) == 4
1785 && sizeof
(long
) == 4 ?
1 : -1] = { __x86_64__
};
1789 #
Return 1 if we
're generating 32-bit integers using default
1790 # options, 0 otherwise.
1792 proc check_effective_target_int32 { } {
1793 return [check_no_compiler_messages int32 object {
1794 int dummy[sizeof (int) == 4 ? 1 : -1];
1798 # Return 1 if we're generating
32-bit or larger integers using default
1799 # options
, 0 otherwise.
1801 proc check_effective_target_int32plus
{ } {
1802 return [check_no_compiler_messages int32plus object
{
1803 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1807 #
Return 1 if we
're generating 32-bit or larger pointers using default
1808 # options, 0 otherwise.
1810 proc check_effective_target_ptr32plus { } {
1811 # The msp430 has 16-bit or 20-bit pointers. The 20-bit pointer is stored
1812 # in a 32-bit slot when in memory, so sizeof(void *) returns 4, but it
1813 # cannot really hold a 32-bit address, so we always return false here.
1814 if { [istarget msp430-*-*] } {
1818 return [check_no_compiler_messages ptr32plus object {
1819 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1823 # Return 1 if we support 32-bit or larger array and structure sizes
1824 # using default options, 0 otherwise.
1826 proc check_effective_target_size32plus { } {
1827 return [check_no_compiler_messages size32plus object {
1832 # Returns 1 if we're generating
16-bit or smaller integers with the
1833 # default options
, 0 otherwise.
1835 proc check_effective_target_int16
{ } {
1836 return [check_no_compiler_messages int16 object
{
1837 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1841 #
Return 1 if we
're generating 64-bit code using default options, 0
1844 proc check_effective_target_lp64 { } {
1845 return [check_no_compiler_messages lp64 object {
1846 int dummy[sizeof (int) == 4
1847 && sizeof (void *) == 8
1848 && sizeof (long) == 8 ? 1 : -1];
1852 # Return 1 if we're generating
64-bit code using default llp64 options
,
1855 proc check_effective_target_llp64
{ } {
1856 return [check_no_compiler_messages llp64 object
{
1857 int dummy
[sizeof
(int) == 4
1858 && sizeof
(void
*) == 8
1859 && sizeof
(long long
) == 8
1860 && sizeof
(long
) == 4 ?
1 : -1];
1864 #
Return 1 if long and
int have different sizes
,
1867 proc check_effective_target_long_neq_int
{ } {
1868 return [check_no_compiler_messages long_ne_int object
{
1869 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1873 #
Return 1 if the target supports long double larger than double
,
1876 proc check_effective_target_large_long_double
{ } {
1877 return [check_no_compiler_messages large_long_double object
{
1878 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1882 #
Return 1 if the target supports double larger than float
,
1885 proc check_effective_target_large_double
{ } {
1886 return [check_no_compiler_messages large_double object
{
1887 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
1891 #
Return 1 if the target supports long double of
128 bits
,
1894 proc check_effective_target_longdouble128
{ } {
1895 return [check_no_compiler_messages longdouble128 object
{
1896 int dummy
[sizeof
(long double
) == 16 ?
1 : -1];
1900 #
Return 1 if the target supports double of
64 bits
,
1903 proc check_effective_target_double64
{ } {
1904 return [check_no_compiler_messages double64 object
{
1905 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
1909 #
Return 1 if the target supports double of at least
64 bits
,
1912 proc check_effective_target_double64plus
{ } {
1913 return [check_no_compiler_messages double64plus object
{
1914 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
1918 #
Return 1 if the target supports
'w' suffix
on floating constant
1921 proc check_effective_target_has_w_floating_suffix
{ } {
1923 if [check_effective_target_c
++] {
1924 append opts
"-std=gnu++03"
1926 return [check_no_compiler_messages w_fp_suffix object
{
1931 #
Return 1 if the target supports
'q' suffix
on floating constant
1934 proc check_effective_target_has_q_floating_suffix
{ } {
1936 if [check_effective_target_c
++] {
1937 append opts
"-std=gnu++03"
1939 return [check_no_compiler_messages q_fp_suffix object
{
1943 #
Return 1 if the target supports compiling fixed
-point
,
1946 proc check_effective_target_fixed_point
{ } {
1947 return [check_no_compiler_messages fixed_point object
{
1948 _Sat _Fract x
; _Sat _Accum y
;
1952 #
Return 1 if the target supports compiling decimal floating point
,
1955 proc check_effective_target_dfp_nocache
{ } {
1956 verbose
"check_effective_target_dfp_nocache: compiling source" 2
1957 set ret
[check_no_compiler_messages_nocache dfp object
{
1958 float x __attribute__
((mode(DD
)));
1960 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
1964 proc check_effective_target_dfprt_nocache
{ } {
1965 return [check_runtime_nocache dfprt
{
1966 typedef float d64 __attribute__
((mode(DD
)));
1967 d64 x
= 1.2df
, y
= 2.3dd
, z
;
1968 int main
() { z
= x
+ y
; return 0; }
1972 #
Return 1 if the target supports compiling Decimal Floating Point
,
1975 # This won
't change for different subtargets so cache the result.
1977 proc check_effective_target_dfp { } {
1978 return [check_cached_effective_target dfp {
1979 check_effective_target_dfp_nocache
1983 # Return 1 if the target supports linking and executing Decimal Floating
1984 # Point, 0 otherwise.
1986 # This won't change
for different subtargets so
cache the result.
1988 proc check_effective_target_dfprt
{ } {
1989 return [check_cached_effective_target dfprt
{
1990 check_effective_target_dfprt_nocache
1994 #
Return 1 if the target supports executing DFP hardware instructions
,
1995 #
0 otherwise.
Cache the result.
1997 proc check_dfp_hw_available
{ } {
1998 return [check_cached_effective_target dfp_hw_available
{
1999 #
For now
, disable
on Darwin
2000 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
2003 check_runtime_nocache dfp_hw_available
{
2004 volatile _Decimal64 r
;
2005 volatile _Decimal64 a
= 4.0DD
;
2006 volatile _Decimal64 b
= 2.0DD
;
2009 asm volatile
("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2010 asm volatile
("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2011 asm volatile
("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2012 asm volatile
("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2015 } "-mcpu=power6 -mhard-float"
2020 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2022 proc check_effective_target_ucn_nocache
{ } {
2023 #
-std
=c99 is only valid
for C
2024 if [check_effective_target_c
] {
2025 set ucnopts
"-std=c99"
2027 append ucnopts
" -fextended-identifiers"
2028 verbose
"check_effective_target_ucn_nocache: compiling source" 2
2029 set ret
[check_no_compiler_messages_nocache ucn object
{
2032 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
2036 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2038 # This won
't change for different subtargets, so cache the result.
2040 proc check_effective_target_ucn { } {
2041 return [check_cached_effective_target ucn {
2042 check_effective_target_ucn_nocache
2046 # Return 1 if the target needs a command line argument to enable a SIMD
2049 proc check_effective_target_vect_cmdline_needed { } {
2050 global et_vect_cmdline_needed_saved
2051 global et_vect_cmdline_needed_target_name
2053 if { ![info exists et_vect_cmdline_needed_target_name] } {
2054 set et_vect_cmdline_needed_target_name ""
2057 # If the target has changed since we set the cached value, clear it.
2058 set current_target [current_target_name]
2059 if { $current_target != $et_vect_cmdline_needed_target_name } {
2060 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
2061 set et_vect_cmdline_needed_target_name $current_target
2062 if { [info exists et_vect_cmdline_needed_saved] } {
2063 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
2064 unset et_vect_cmdline_needed_saved
2068 if [info exists et_vect_cmdline_needed_saved] {
2069 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
2071 set et_vect_cmdline_needed_saved 1
2072 if { [istarget alpha*-*-*]
2073 || [istarget ia64-*-*]
2074 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
2075 && ([check_effective_target_x32]
2076 || [check_effective_target_lp64]))
2077 || ([istarget powerpc*-*-*]
2078 && ([check_effective_target_powerpc_spe]
2079 || [check_effective_target_powerpc_altivec]))
2080 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
2081 || [istarget spu-*-*]
2082 || ([istarget arm*-*-*] && [check_effective_target_arm_neon])
2083 || [istarget aarch64*-*-*] } {
2084 set et_vect_cmdline_needed_saved 0
2088 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2089 return $et_vect_cmdline_needed_saved
2092 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
2094 # This won't change
for different subtargets so
cache the result.
2096 proc check_effective_target_vect_int
{ } {
2097 global et_vect_int_saved
2099 if [info exists et_vect_int_saved
] {
2100 verbose
"check_effective_target_vect_int: using cached result" 2
2102 set et_vect_int_saved
0
2103 if { [istarget i?
86-*-*]
2104 ||
([istarget powerpc
*-*-*]
2105 && ![istarget powerpc
-*-linux
*paired
*])
2106 ||
[istarget spu
-*-*]
2107 ||
[istarget x86_64
-*-*]
2108 ||
[istarget sparc
*-*-*]
2109 ||
[istarget alpha
*-*-*]
2110 ||
[istarget ia64
-*-*]
2111 ||
[istarget aarch64
*-*-*]
2112 ||
[check_effective_target_arm32
]
2113 ||
([istarget mips
*-*-*]
2114 && [check_effective_target_mips_loongson
]) } {
2115 set et_vect_int_saved
1
2119 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
2120 return $et_vect_int_saved
2123 #
Return 1 if the target supports signed
int->float conversion
2126 proc check_effective_target_vect_intfloat_cvt
{ } {
2127 global et_vect_intfloat_cvt_saved
2129 if [info exists et_vect_intfloat_cvt_saved
] {
2130 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
2132 set et_vect_intfloat_cvt_saved
0
2133 if { [istarget i?
86-*-*]
2134 ||
([istarget powerpc
*-*-*]
2135 && ![istarget powerpc
-*-linux
*paired
*])
2136 ||
[istarget x86_64
-*-*]
2137 ||
([istarget arm
*-*-*]
2138 && [check_effective_target_arm_neon_ok
])} {
2139 set et_vect_intfloat_cvt_saved
1
2143 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2144 return $et_vect_intfloat_cvt_saved
2147 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
2149 proc check_effective_target_int128 { } {
2150 return [check_no_compiler_messages int128 object {
2152 #ifndef __SIZEOF_INT128__
2161 # Return 1 if the target supports unsigned int->float conversion
2164 proc check_effective_target_vect_uintfloat_cvt { } {
2165 global et_vect_uintfloat_cvt_saved
2167 if [info exists et_vect_uintfloat_cvt_saved] {
2168 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2170 set et_vect_uintfloat_cvt_saved 0
2171 if { [istarget i?86-*-*]
2172 || ([istarget powerpc*-*-*]
2173 && ![istarget powerpc-*-linux*paired*])
2174 || [istarget x86_64-*-*]
2175 || [istarget aarch64*-*-*]
2176 || ([istarget arm*-*-*]
2177 && [check_effective_target_arm_neon_ok])} {
2178 set et_vect_uintfloat_cvt_saved 1
2182 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2183 return $et_vect_uintfloat_cvt_saved
2187 # Return 1 if the target supports signed float->int conversion
2190 proc check_effective_target_vect_floatint_cvt { } {
2191 global et_vect_floatint_cvt_saved
2193 if [info exists et_vect_floatint_cvt_saved] {
2194 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2196 set et_vect_floatint_cvt_saved 0
2197 if { [istarget i?86-*-*]
2198 || ([istarget powerpc*-*-*]
2199 && ![istarget powerpc-*-linux*paired*])
2200 || [istarget x86_64-*-*]
2201 || ([istarget arm*-*-*]
2202 && [check_effective_target_arm_neon_ok])} {
2203 set et_vect_floatint_cvt_saved 1
2207 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2208 return $et_vect_floatint_cvt_saved
2211 # Return 1 if the target supports unsigned float->int conversion
2214 proc check_effective_target_vect_floatuint_cvt { } {
2215 global et_vect_floatuint_cvt_saved
2217 if [info exists et_vect_floatuint_cvt_saved] {
2218 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2220 set et_vect_floatuint_cvt_saved 0
2221 if { ([istarget powerpc*-*-*]
2222 && ![istarget powerpc-*-linux*paired*])
2223 || ([istarget arm*-*-*]
2224 && [check_effective_target_arm_neon_ok])} {
2225 set et_vect_floatuint_cvt_saved 1
2229 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2230 return $et_vect_floatuint_cvt_saved
2233 # Return 1 if the target supports #pragma omp declare simd, 0 otherwise.
2235 # This won't change
for different subtargets so
cache the result.
2237 proc check_effective_target_vect_simd_clones
{ } {
2238 global et_vect_simd_clones_saved
2240 if [info exists et_vect_simd_clones_saved
] {
2241 verbose
"check_effective_target_vect_simd_clones: using cached result" 2
2243 set et_vect_simd_clones_saved
0
2244 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
2245 #
On i?
86/x86_64 #pragma omp declare simd builds a sse2
, avx and
2246 # avx2 clone. Only the right clone
for the specified arch will be
2247 # chosen
, but still we need to at least be able to assemble
2249 if { [check_effective_target_avx2
] } {
2250 set et_vect_simd_clones_saved
1
2255 verbose
"check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2256 return $et_vect_simd_clones_saved
2259 #
Return 1 if this is a AArch64 target supporting big endian
2260 proc check_effective_target_aarch64_big_endian
{ } {
2261 return [check_no_compiler_messages aarch64_big_endian assembly
{
2262 #
if !defined
(__aarch64__
) ||
!defined
(__AARCH64EB__
)
2268 #
Return 1 if this is a AArch64 target supporting little endian
2269 proc check_effective_target_aarch64_little_endian
{ } {
2270 return [check_no_compiler_messages aarch64_little_endian assembly
{
2271 #
if !defined
(__aarch64__
) || defined
(__AARCH64EB__
)
2277 #
Return 1 if this is an arm target using
32-bit instructions
2278 proc check_effective_target_arm32
{ } {
2279 return [check_no_compiler_messages arm32 assembly
{
2280 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
2286 #
Return 1 if this is an arm target not using Thumb
2287 proc check_effective_target_arm_nothumb
{ } {
2288 return [check_no_compiler_messages arm_nothumb assembly
{
2289 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) || defined
(__thumb2__
))
2295 #
Return 1 if this is a little
-endian ARM target
2296 proc check_effective_target_arm_little_endian
{ } {
2297 return [check_no_compiler_messages arm_little_endian assembly
{
2298 #
if !defined
(__arm__
) ||
!defined
(__ARMEL__
)
2304 #
Return 1 if this is an ARM target that only supports aligned vector accesses
2305 proc check_effective_target_arm_vect_no_misalign
{ } {
2306 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
2307 #
if !defined
(__arm__
) \
2308 ||
(defined
(__ARMEL__
) \
2309 && (!defined
(__thumb__
) || defined
(__thumb2__
)))
2316 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2317 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
2320 proc check_effective_target_arm_vfp_ok
{ } {
2321 if { [check_effective_target_arm32
] } {
2322 return [check_no_compiler_messages arm_vfp_ok object
{
2324 } "-mfpu=vfp -mfloat-abi=softfp"]
2330 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp3
2331 #
-mfloat
-abi
=softfp.
2333 proc check_effective_target_arm_vfp3_ok
{ } {
2334 if { [check_effective_target_arm32
] } {
2335 return [check_no_compiler_messages arm_vfp3_ok object
{
2337 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2343 #
Return 1 if this is an ARM target supporting
-mfpu
=fp
-armv8
2344 #
-mfloat
-abi
=softfp.
2345 proc check_effective_target_arm_v8_vfp_ok
{} {
2346 if { [check_effective_target_arm32
] } {
2347 return [check_no_compiler_messages arm_v8_vfp_ok object
{
2350 __asm__ volatile
("vrinta.f32.f32 s0, s0");
2353 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2359 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2360 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
2363 proc check_effective_target_arm_hard_vfp_ok
{ } {
2364 if { [check_effective_target_arm32
]
2365 && ! [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2366 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
2367 int main
() { return 0;}
2368 } "-mfpu=vfp -mfloat-abi=hard"]
2374 #
Return 1 if this is an ARM target that supports DSP multiply with
2375 # current multilib flags.
2377 proc check_effective_target_arm_dsp
{ } {
2378 return [check_no_compiler_messages arm_dsp assembly
{
2379 #ifndef __ARM_FEATURE_DSP
2386 #
Return 1 if this is an ARM target that supports unaligned word
/halfword
2387 #
load/store instructions.
2389 proc check_effective_target_arm_unaligned
{ } {
2390 return [check_no_compiler_messages arm_unaligned assembly
{
2391 #ifndef __ARM_FEATURE_UNALIGNED
2392 #error no unaligned support
2398 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2399 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2400 # incompatible with these options. Also
set et_arm_crypto_flags to the
2401 # best options to add.
2403 proc check_effective_target_arm_crypto_ok_nocache
{ } {
2404 global et_arm_crypto_flags
2405 set et_arm_crypto_flags
""
2406 if { [check_effective_target_arm32
] } {
2407 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2408 if { [check_no_compiler_messages_nocache arm_crypto_ok object
{
2409 #
include "arm_neon.h"
2411 foo
(uint8x16_t a
, uint8x16_t b
)
2413 return vaeseq_u8
(a
, b
);
2416 set et_arm_crypto_flags $flags
2425 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2427 proc check_effective_target_arm_crypto_ok
{ } {
2428 return [check_cached_effective_target arm_crypto_ok \
2429 check_effective_target_arm_crypto_ok_nocache
]
2432 # Add options
for crypto extensions.
2433 proc add_options_for_arm_crypto
{ flags
} {
2434 if { ! [check_effective_target_arm_crypto_ok
] } {
2437 global et_arm_crypto_flags
2438 return "$flags $et_arm_crypto_flags"
2441 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2442 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2443 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2444 # NEON
, do not add
-mfpu
=neon.
2446 proc add_options_for_arm_neon
{ flags
} {
2447 if { ! [check_effective_target_arm_neon_ok
] } {
2450 global et_arm_neon_flags
2451 return "$flags $et_arm_neon_flags"
2454 proc add_options_for_arm_v8_vfp
{ flags
} {
2455 if { ! [check_effective_target_arm_v8_vfp_ok
] } {
2458 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2461 proc add_options_for_arm_v8_neon
{ flags
} {
2462 if { ! [check_effective_target_arm_v8_neon_ok
] } {
2465 global et_arm_v8_neon_flags
2466 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2469 proc add_options_for_arm_crc
{ flags
} {
2470 if { ! [check_effective_target_arm_crc_ok
] } {
2473 global et_arm_crc_flags
2474 return "$flags $et_arm_crc_flags"
2477 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2478 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2479 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2480 # NEON
, do not add
-mfpu
=neon.
2482 proc add_options_for_arm_neonv2
{ flags
} {
2483 if { ! [check_effective_target_arm_neonv2_ok
] } {
2486 global et_arm_neonv2_flags
2487 return "$flags $et_arm_neonv2_flags"
2490 # Add the options needed
for vfp3.
2491 proc add_options_for_arm_vfp3
{ flags
} {
2492 if { ! [check_effective_target_arm_vfp3_ok
] } {
2495 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2498 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
2499 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2500 # incompatible with these options. Also
set et_arm_neon_flags to the
2501 # best options to add.
2503 proc check_effective_target_arm_neon_ok_nocache
{ } {
2504 global et_arm_neon_flags
2505 set et_arm_neon_flags
""
2506 if { [check_effective_target_arm32
] } {
2507 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2508 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
2509 #
include "arm_neon.h"
2512 set et_arm_neon_flags $flags
2521 proc check_effective_target_arm_neon_ok
{ } {
2522 return [check_cached_effective_target arm_neon_ok \
2523 check_effective_target_arm_neon_ok_nocache
]
2526 proc check_effective_target_arm_crc_ok_nocache
{ } {
2527 global et_arm_crc_flags
2528 set et_arm_crc_flags
"-march=armv8-a+crc"
2529 return [check_no_compiler_messages_nocache arm_crc_ok object
{
2530 #
if !defined
(__ARM_FEATURE_CRC32
)
2533 } "$et_arm_crc_flags"]
2536 proc check_effective_target_arm_crc_ok
{ } {
2537 return [check_cached_effective_target arm_crc_ok \
2538 check_effective_target_arm_crc_ok_nocache
]
2541 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
2542 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2543 # incompatible with these options. Also
set et_arm_neon_flags to the
2544 # best options to add.
2546 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
2547 global et_arm_neon_fp16_flags
2548 set et_arm_neon_fp16_flags
""
2549 if { [check_effective_target_arm32
] } {
2550 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2551 "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
2552 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object
{
2553 #
include "arm_neon.h"
2555 foo
(float32x4_t
arg)
2557 return vcvt_f16_f32
(arg);
2560 set et_arm_neon_fp16_flags $flags
2569 proc check_effective_target_arm_neon_fp16_ok
{ } {
2570 return [check_cached_effective_target arm_neon_fp16_ok \
2571 check_effective_target_arm_neon_fp16_ok_nocache
]
2574 proc add_options_for_arm_neon_fp16
{ flags
} {
2575 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
2578 global et_arm_neon_fp16_flags
2579 return "$flags $et_arm_neon_fp16_flags"
2582 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp
-armv8
2583 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2584 # incompatible with these options. Also
set et_arm_v8_neon_flags to the
2585 # best options to add.
2587 proc check_effective_target_arm_v8_neon_ok_nocache
{ } {
2588 global et_arm_v8_neon_flags
2589 set et_arm_v8_neon_flags
""
2590 if { [check_effective_target_arm32
] } {
2591 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2592 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object
{
2594 #error not armv8 or later
2596 #
include "arm_neon.h"
2600 __asm__ volatile
("vrintn.f32 q0, q0");
2602 } "$flags -march=armv8-a"] } {
2603 set et_arm_v8_neon_flags $flags
2612 proc check_effective_target_arm_v8_neon_ok
{ } {
2613 return [check_cached_effective_target arm_v8_neon_ok \
2614 check_effective_target_arm_v8_neon_ok_nocache
]
2617 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-vfpv4
2618 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2619 # incompatible with these options. Also
set et_arm_neonv2_flags to the
2620 # best options to add.
2622 proc check_effective_target_arm_neonv2_ok_nocache
{ } {
2623 global et_arm_neonv2_flags
2624 set et_arm_neonv2_flags
""
2625 if { [check_effective_target_arm32
] } {
2626 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2627 if { [check_no_compiler_messages_nocache arm_neonv2_ok object
{
2628 #
include "arm_neon.h"
2630 foo
(float32x2_t a
, float32x2_t b
, float32x2_t c
)
2632 return vfma_f32
(a
, b
, c
);
2635 set et_arm_neonv2_flags $flags
2644 proc check_effective_target_arm_neonv2_ok
{ } {
2645 return [check_cached_effective_target arm_neonv2_ok \
2646 check_effective_target_arm_neonv2_ok_nocache
]
2649 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2650 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2653 proc add_options_for_arm_fp16
{ flags
} {
2654 if { ! [check_effective_target_arm_fp16_ok
] } {
2657 global et_arm_fp16_flags
2658 return "$flags $et_arm_fp16_flags"
2661 #
Return 1 if this is an ARM target that can support a VFP fp16 variant.
2662 # Skip multilibs that are incompatible with these options and
set
2663 # et_arm_fp16_flags to the best options to add.
2665 proc check_effective_target_arm_fp16_ok_nocache
{ } {
2666 global et_arm_fp16_flags
2667 set et_arm_fp16_flags
""
2668 if { ! [check_effective_target_arm32
] } {
2671 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2672 # Multilib flags would override
-mfpu.
2675 if [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2676 # Must generate floating
-point instructions.
2679 if [check_effective_target_arm_hf_eabi
] {
2680 # Use existing float
-abi and force an fpu which supports fp16
2681 set et_arm_fp16_flags
"-mfpu=vfpv4"
2684 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "" } ]] {
2685 # The existing
-mfpu value is OK
; use it
, but add softfp.
2686 set et_arm_fp16_flags
"-mfloat-abi=softfp"
2689 # Add
-mfpu
for a VFP fp16 variant since there is no preprocessor
2690 # macro to check
for this support.
2691 set flags
"-mfpu=vfpv4 -mfloat-abi=softfp"
2692 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly
{
2695 set et_arm_fp16_flags
"$flags"
2702 proc check_effective_target_arm_fp16_ok
{ } {
2703 return [check_cached_effective_target arm_fp16_ok \
2704 check_effective_target_arm_fp16_ok_nocache
]
2707 # Creates a series of routines that
return 1 if the given architecture
2708 # can be selected and a routine to give the flags to select that architecture
2709 # Note
: Extra flags may be added to disable options from newer compilers
2710 #
(Thumb in particular
- but others may be added in the future
)
2711 # Usage
: /* { dg
-require
-effective
-target arm_arch_v5_ok
} */
2712 #
/* { dg
-add
-options arm_arch_v5
} */
2713 #
/* { dg
-require
-effective
-target arm_arch_v5_multilib
} */
2714 foreach
{ armfunc armflag armdef
} { v4
"-march=armv4 -marm" __ARM_ARCH_4__
2715 v4t
"-march=armv4t" __ARM_ARCH_4T__
2716 v5
"-march=armv5 -marm" __ARM_ARCH_5__
2717 v5t
"-march=armv5t" __ARM_ARCH_5T__
2718 v5te
"-march=armv5te" __ARM_ARCH_5TE__
2719 v6
"-march=armv6" __ARM_ARCH_6__
2720 v6k
"-march=armv6k" __ARM_ARCH_6K__
2721 v6t2
"-march=armv6t2" __ARM_ARCH_6T2__
2722 v6z
"-march=armv6z" __ARM_ARCH_6Z__
2723 v6m
"-march=armv6-m -mthumb" __ARM_ARCH_6M__
2724 v7a
"-march=armv7-a" __ARM_ARCH_7A__
2725 v7ve
"-march=armv7ve" __ARM_ARCH_7A__
2726 v7r
"-march=armv7-r" __ARM_ARCH_7R__
2727 v7m
"-march=armv7-m -mthumb" __ARM_ARCH_7M__
2728 v7em
"-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2729 v8a
"-march=armv8-a" __ARM_ARCH_8A__ } {
2730 eval
[string map
[list FUNC $armfunc FLAG $armflag DEF $armdef
] {
2731 proc check_effective_target_arm_arch_FUNC_ok
{ } {
2732 if { [ string match
"*-marm*" "FLAG" ] &&
2733 ![check_effective_target_arm_arm_ok
] } {
2736 return [check_no_compiler_messages arm_arch_FUNC_ok assembly
{
2743 proc add_options_for_arm_arch_FUNC
{ flags
} {
2744 return "$flags FLAG"
2747 proc check_effective_target_arm_arch_FUNC_multilib
{ } {
2748 return [check_runtime arm_arch_FUNC_multilib
{
2754 } [add_options_for_arm_arch_FUNC
""]]
2759 #
Return 1 if this is an ARM target where
-marm causes ARM to be
2762 proc check_effective_target_arm_arm_ok
{ } {
2763 return [check_no_compiler_messages arm_arm_ok assembly
{
2764 #
if !defined
(__arm__
) || defined
(__thumb__
) || defined
(__thumb2__
)
2771 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
2774 proc check_effective_target_arm_thumb1_ok
{ } {
2775 return [check_no_compiler_messages arm_thumb1_ok assembly
{
2776 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2779 int foo
(int i
) { return i
; }
2783 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
2786 proc check_effective_target_arm_thumb2_ok
{ } {
2787 return [check_no_compiler_messages arm_thumb2_ok assembly
{
2788 #
if !defined
(__thumb2__
)
2791 int foo
(int i
) { return i
; }
2795 #
Return 1 if this is an ARM target where Thumb
-1 is used without options
2796 # added by the test.
2798 proc check_effective_target_arm_thumb1
{ } {
2799 return [check_no_compiler_messages arm_thumb1 assembly
{
2800 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2807 #
Return 1 if this is an ARM target where Thumb
-2 is used without options
2808 # added by the test.
2810 proc check_effective_target_arm_thumb2
{ } {
2811 return [check_no_compiler_messages arm_thumb2 assembly
{
2812 #
if !defined
(__thumb2__
)
2819 #
Return 1 if this is an ARM target where conditional execution is available.
2821 proc check_effective_target_arm_cond_exec
{ } {
2822 return [check_no_compiler_messages arm_cond_exec assembly
{
2823 #
if defined
(__arm__
) && defined
(__thumb__
) && !defined
(__thumb2__
)
2830 #
Return 1 if this is an ARM cortex
-M profile cpu
2832 proc check_effective_target_arm_cortex_m
{ } {
2833 return [check_no_compiler_messages arm_cortex_m assembly
{
2834 #
if !defined
(__ARM_ARCH_7M__
) \
2835 && !defined
(__ARM_ARCH_7EM__
) \
2836 && !defined
(__ARM_ARCH_6M__
)
2843 #
Return 1 if the target supports executing NEON instructions
, 0
2844 # otherwise.
Cache the result.
2846 proc check_effective_target_arm_neon_hw
{ } {
2847 return [check_runtime arm_neon_hw_available
{
2851 long long a
= 0, b
= 1;
2852 asm
("vorr %P0, %P1, %P2"
2854 : "0" (a), "w" (b));
2857 } [add_options_for_arm_neon
""]]
2860 proc check_effective_target_arm_neonv2_hw
{ } {
2861 return [check_runtime arm_neon_hwv2_available
{
2862 #
include "arm_neon.h"
2866 float32x2_t a
, b
, c
;
2867 asm
("vfma.f32 %P0, %P1, %P2"
2869 : "w" (b), "w" (c));
2872 } [add_options_for_arm_neonv2
""]]
2875 #
Return 1 if the target supports executing ARMv8 NEON instructions
, 0
2878 proc check_effective_target_arm_v8_neon_hw
{ } {
2879 return [check_runtime arm_v8_neon_hw_available
{
2880 #
include "arm_neon.h"
2885 asm
("vrinta.f32 %P0, %P1"
2890 } [add_options_for_arm_v8_neon
""]]
2893 #
Return 1 if this is a ARM target with NEON enabled.
2895 proc check_effective_target_arm_neon
{ } {
2896 if { [check_effective_target_arm32
] } {
2897 return [check_no_compiler_messages arm_neon object
{
2898 #ifndef __ARM_NEON__
2909 proc check_effective_target_arm_neonv2
{ } {
2910 if { [check_effective_target_arm32
] } {
2911 return [check_no_compiler_messages arm_neon object
{
2912 #ifndef __ARM_NEON__
2915 #ifndef __ARM_FEATURE_FMA
2927 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
2928 # the Loongson vector modes.
2930 proc check_effective_target_mips_loongson
{ } {
2931 return [check_no_compiler_messages loongson assembly
{
2932 #
if !defined
(__mips_loongson_vector_rev
)
2938 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
2941 proc check_effective_target_arm_eabi
{ } {
2942 return [check_no_compiler_messages arm_eabi object
{
2943 #ifndef __ARM_EABI__
2951 #
Return 1 if this is an ARM target that adheres to the hard
-float variant of
2952 # the ABI
for the ARM Architecture
(e.g.
-mfloat
-abi
=hard
).
2954 proc check_effective_target_arm_hf_eabi
{ } {
2955 return [check_no_compiler_messages arm_hf_eabi object
{
2956 #
if !defined
(__ARM_EABI__
) ||
!defined
(__ARM_PCS_VFP
)
2957 #error not hard
-float EABI
2964 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
2965 # Some multilibs may be incompatible with this option.
2967 proc check_effective_target_arm_iwmmxt_ok
{ } {
2968 if { [check_effective_target_arm32
] } {
2969 return [check_no_compiler_messages arm_iwmmxt_ok object
{
2977 #
Return true
if LDRD
/STRD instructions are prefered over LDM
/STM instructions
2978 #
for an ARM target.
2979 proc check_effective_target_arm_prefer_ldrd_strd
{ } {
2980 if { ![check_effective_target_arm32
] } {
2984 return [check_no_messages_and_pattern arm_prefer_ldrd_strd
"strd\tr" assembly {
2985 void foo
(int *p
) { p
[0] = 1; p
[1] = 0;}
2989 #
Return 1 if this is a PowerPC target supporting
-meabi.
2991 proc check_effective_target_powerpc_eabi_ok
{ } {
2992 if { [istarget powerpc
*-*-*] } {
2993 return [check_no_compiler_messages powerpc_eabi_ok object
{
3001 #
Return 1 if this is a PowerPC target with floating
-point registers.
3003 proc check_effective_target_powerpc_fprs
{ } {
3004 if { [istarget powerpc
*-*-*]
3005 ||
[istarget rs6000
-*-*] } {
3006 return [check_no_compiler_messages powerpc_fprs object
{
3018 #
Return 1 if this is a PowerPC target with hardware double
-precision
3021 proc check_effective_target_powerpc_hard_double
{ } {
3022 if { [istarget powerpc
*-*-*]
3023 ||
[istarget rs6000
-*-*] } {
3024 return [check_no_compiler_messages powerpc_hard_double object
{
3036 #
Return 1 if this is a PowerPC target supporting
-maltivec.
3038 proc check_effective_target_powerpc_altivec_ok
{ } {
3039 if { ([istarget powerpc
*-*-*]
3040 && ![istarget powerpc
-*-linux
*paired
*])
3041 ||
[istarget rs6000
-*-*] } {
3042 # AltiVec is not supported
on AIX before
5.3.
3043 if { [istarget powerpc
*-*-aix4
*]
3044 ||
[istarget powerpc
*-*-aix5.1
*]
3045 ||
[istarget powerpc
*-*-aix5.2
*] } {
3048 return [check_no_compiler_messages powerpc_altivec_ok object
{
3056 #
Return 1 if this is a PowerPC target supporting
-mpower8
-vector
3058 proc check_effective_target_powerpc_p8vector_ok
{ } {
3059 if { ([istarget powerpc
*-*-*]
3060 && ![istarget powerpc
-*-linux
*paired
*])
3061 ||
[istarget rs6000
-*-*] } {
3062 # AltiVec is not supported
on AIX before
5.3.
3063 if { [istarget powerpc
*-*-aix4
*]
3064 ||
[istarget powerpc
*-*-aix5.1
*]
3065 ||
[istarget powerpc
*-*-aix5.2
*] } {
3068 return [check_no_compiler_messages powerpc_p8vector_ok object
{
3071 asm volatile
("xxlorc vs0,vs0,vs0");
3073 asm volatile
("xxlorc 0,0,0");
3077 } "-mpower8-vector"]
3083 #
Return 1 if this is a PowerPC target supporting
-mvsx
3085 proc check_effective_target_powerpc_vsx_ok
{ } {
3086 if { ([istarget powerpc
*-*-*]
3087 && ![istarget powerpc
-*-linux
*paired
*])
3088 ||
[istarget rs6000
-*-*] } {
3089 # VSX is not supported
on AIX before
7.1.
3090 if { [istarget powerpc
*-*-aix4
*]
3091 ||
[istarget powerpc
*-*-aix5
*]
3092 ||
[istarget powerpc
*-*-aix6
*] } {
3095 return [check_no_compiler_messages powerpc_vsx_ok object
{
3098 asm volatile
("xxlor vs0,vs0,vs0");
3100 asm volatile
("xxlor 0,0,0");
3110 #
Return 1 if this is a PowerPC target supporting
-mhtm
3112 proc check_effective_target_powerpc_htm_ok
{ } {
3113 if { ([istarget powerpc
*-*-*]
3114 && ![istarget powerpc
-*-linux
*paired
*])
3115 ||
[istarget rs6000
-*-*] } {
3116 # HTM is not supported
on AIX yet.
3117 if { [istarget powerpc
*-*-aix
*] } {
3120 return [check_no_compiler_messages powerpc_htm_ok object
{
3122 asm volatile
("tbegin. 0");
3131 #
Return 1 if the target supports executing HTM hardware instructions
,
3132 #
0 otherwise.
Cache the result.
3134 proc check_htm_hw_available
{ } {
3135 return [check_cached_effective_target htm_hw_available
{
3136 #
For now
, disable
on Darwin
3137 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
3140 check_runtime_nocache htm_hw_available
{
3150 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
3152 proc check_effective_target_powerpc_ppu_ok
{ } {
3153 if [check_effective_target_powerpc_altivec_ok
] {
3154 return [check_no_compiler_messages cell_asm_available object
{
3157 asm volatile
("lvlx v0,v0,v0");
3159 asm volatile
("lvlx 0,0,0");
3169 #
Return 1 if this is a PowerPC target that supports SPU.
3171 proc check_effective_target_powerpc_spu
{ } {
3172 if { [istarget powerpc
*-*-linux
*] } {
3173 return [check_effective_target_powerpc_altivec_ok
]
3179 #
Return 1 if this is a PowerPC SPE target. The check includes options
3180 # specified by dg
-options
for this test
, so don
't cache the result.
3182 proc check_effective_target_powerpc_spe_nocache { } {
3183 if { [istarget powerpc*-*-*] } {
3184 return [check_no_compiler_messages_nocache powerpc_spe object {
3190 } [current_compiler_flags]]
3196 # Return 1 if this is a PowerPC target with SPE enabled.
3198 proc check_effective_target_powerpc_spe { } {
3199 if { [istarget powerpc*-*-*] } {
3200 return [check_no_compiler_messages powerpc_spe object {
3212 # Return 1 if this is a PowerPC target with Altivec enabled.
3214 proc check_effective_target_powerpc_altivec { } {
3215 if { [istarget powerpc*-*-*] } {
3216 return [check_no_compiler_messages powerpc_altivec object {
3228 # Return 1 if this is a PowerPC 405 target. The check includes options
3229 # specified by dg-options for this test, so don't
cache the result.
3231 proc check_effective_target_powerpc_405_nocache
{ } {
3232 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
3233 return [check_no_compiler_messages_nocache powerpc_405 object
{
3239 } [current_compiler_flags
]]
3245 #
Return 1 if this is a PowerPC target using the ELFv2 ABI.
3247 proc check_effective_target_powerpc_elfv2
{ } {
3248 if { [istarget powerpc
*-*-*] } {
3249 return [check_no_compiler_messages powerpc_elfv2 object
{
3251 #error not ELF v2 ABI
3261 #
Return 1 if this is a SPU target with a toolchain that
3262 # supports automatic overlay generation.
3264 proc check_effective_target_spu_auto_overlay
{ } {
3265 if { [istarget spu
*-*-elf
*] } {
3266 return [check_no_compiler_messages spu_auto_overlay executable
{
3268 } "-Wl,--auto-overlay" ]
3274 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3275 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
3276 # test environment appears to run executables
on such a simulator.
3278 proc check_effective_target_ultrasparc_hw
{ } {
3279 return [check_runtime ultrasparc_hw
{
3280 int main
() { return 0; }
3281 } "-mcpu=ultrasparc"]
3284 #
Return 1 if the test environment supports executing UltraSPARC VIS2
3285 # instructions. We check this by attempting
: "bmask %g0, %g0, %g0"
3287 proc check_effective_target_ultrasparc_vis2_hw
{ } {
3288 return [check_runtime ultrasparc_vis2_hw
{
3289 int main
() { __asm__
(".word 0x81b00320"); return 0; }
3290 } "-mcpu=ultrasparc3"]
3293 #
Return 1 if the test environment supports executing UltraSPARC VIS3
3294 # instructions. We check this by attempting
: "addxc %g0, %g0, %g0"
3296 proc check_effective_target_ultrasparc_vis3_hw
{ } {
3297 return [check_runtime ultrasparc_vis3_hw
{
3298 int main
() { __asm__
(".word 0x81b00220"); return 0; }
3302 #
Return 1 if this is a SPARC
-V9 target.
3304 proc check_effective_target_sparc_v9
{ } {
3305 if { [istarget sparc
*-*-*] } {
3306 return [check_no_compiler_messages sparc_v9 object
{
3308 asm volatile
("return %i7+8");
3317 #
Return 1 if this is a SPARC target with VIS enabled.
3319 proc check_effective_target_sparc_vis
{ } {
3320 if { [istarget sparc
*-*-*] } {
3321 return [check_no_compiler_messages sparc_vis object
{
3333 #
Return 1 if the target supports hardware vector shift operation.
3335 proc check_effective_target_vect_shift
{ } {
3336 global et_vect_shift_saved
3338 if [info exists et_vect_shift_saved
] {
3339 verbose
"check_effective_target_vect_shift: using cached result" 2
3341 set et_vect_shift_saved
0
3342 if { ([istarget powerpc
*-*-*]
3343 && ![istarget powerpc
-*-linux
*paired
*])
3344 ||
[istarget ia64
-*-*]
3345 ||
[istarget i?
86-*-*]
3346 ||
[istarget x86_64
-*-*]
3347 ||
[istarget aarch64
*-*-*]
3348 ||
[check_effective_target_arm32
]
3349 ||
([istarget mips
*-*-*]
3350 && [check_effective_target_mips_loongson
]) } {
3351 set et_vect_shift_saved
1
3355 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3356 return $et_vect_shift_saved
3359 proc check_effective_target_whole_vector_shift
{ } {
3360 if { [istarget x86_64
-*-*]
3361 ||
[istarget ia64
-*-*]
3362 ||
([check_effective_target_arm32
]
3363 && [check_effective_target_arm_little_endian
])
3364 ||
([istarget mips
*-*-*]
3365 && [check_effective_target_mips_loongson
]) } {
3371 verbose
"check_effective_target_vect_long: returning $answer" 2
3375 #
Return 1 if the target supports vector bswap operations.
3377 proc check_effective_target_vect_bswap
{ } {
3378 global et_vect_bswap_saved
3380 if [info exists et_vect_bswap_saved
] {
3381 verbose
"check_effective_target_vect_bswap: using cached result" 2
3383 set et_vect_bswap_saved
0
3384 if { [istarget aarch64
*-*-*]
3385 ||
([istarget arm
*-*-*]
3386 && [check_effective_target_arm_neon
])
3388 set et_vect_bswap_saved
1
3392 verbose
"check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
3393 return $et_vect_bswap_saved
3396 #
Return 1 if the target supports hardware vector shift operation
for char.
3398 proc check_effective_target_vect_shift_char
{ } {
3399 global et_vect_shift_char_saved
3401 if [info exists et_vect_shift_char_saved
] {
3402 verbose
"check_effective_target_vect_shift_char: using cached result" 2
3404 set et_vect_shift_char_saved
0
3405 if { ([istarget powerpc
*-*-*]
3406 && ![istarget powerpc
-*-linux
*paired
*])
3407 ||
[check_effective_target_arm32
] } {
3408 set et_vect_shift_char_saved
1
3412 verbose
"check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3413 return $et_vect_shift_char_saved
3416 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
3418 # This can change
for different subtargets so
do not
cache the result.
3420 proc check_effective_target_vect_long
{ } {
3421 if { [istarget i?
86-*-*]
3422 ||
(([istarget powerpc
*-*-*]
3423 && ![istarget powerpc
-*-linux
*paired
*])
3424 && [check_effective_target_ilp32
])
3425 ||
[istarget x86_64
-*-*]
3426 ||
[check_effective_target_arm32
]
3427 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
3433 verbose
"check_effective_target_vect_long: returning $answer" 2
3437 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
3439 # This won
't change for different subtargets so cache the result.
3441 proc check_effective_target_vect_float { } {
3442 global et_vect_float_saved
3444 if [info exists et_vect_float_saved] {
3445 verbose "check_effective_target_vect_float: using cached result" 2
3447 set et_vect_float_saved 0
3448 if { [istarget i?86-*-*]
3449 || [istarget powerpc*-*-*]
3450 || [istarget spu-*-*]
3451 || [istarget mips-sde-elf]
3452 || [istarget mipsisa64*-*-*]
3453 || [istarget x86_64-*-*]
3454 || [istarget ia64-*-*]
3455 || [istarget aarch64*-*-*]
3456 || [check_effective_target_arm32] } {
3457 set et_vect_float_saved 1
3461 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
3462 return $et_vect_float_saved
3465 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
3467 # This won't change
for different subtargets so
cache the result.
3469 proc check_effective_target_vect_double
{ } {
3470 global et_vect_double_saved
3472 if [info exists et_vect_double_saved
] {
3473 verbose
"check_effective_target_vect_double: using cached result" 2
3475 set et_vect_double_saved
0
3476 if { [istarget i?
86-*-*]
3477 ||
[istarget aarch64
*-*-*]
3478 ||
[istarget x86_64
-*-*] } {
3479 if { [check_no_compiler_messages vect_double assembly
{
3480 #ifdef __tune_atom__
3481 # error No double vectorizer support.
3484 set et_vect_double_saved
1
3486 set et_vect_double_saved
0
3488 } elseif
{ [istarget spu
-*-*] } {
3489 set et_vect_double_saved
1
3493 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
3494 return $et_vect_double_saved
3497 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
3499 # This won
't change for different subtargets so cache the result.
3501 proc check_effective_target_vect_long_long { } {
3502 global et_vect_long_long_saved
3504 if [info exists et_vect_long_long_saved] {
3505 verbose "check_effective_target_vect_long_long: using cached result" 2
3507 set et_vect_long_long_saved 0
3508 if { [istarget i?86-*-*]
3509 || [istarget x86_64-*-*] } {
3510 set et_vect_long_long_saved 1
3514 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3515 return $et_vect_long_long_saved
3519 # Return 1 if the target plus current options does not support a vector
3520 # max instruction on "int", 0 otherwise.
3522 # This won't change
for different subtargets so
cache the result.
3524 proc check_effective_target_vect_no_int_max
{ } {
3525 global et_vect_no_int_max_saved
3527 if [info exists et_vect_no_int_max_saved
] {
3528 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
3530 set et_vect_no_int_max_saved
0
3531 if { [istarget sparc
*-*-*]
3532 ||
[istarget spu
-*-*]
3533 ||
[istarget alpha
*-*-*]
3534 ||
([istarget mips
*-*-*]
3535 && [check_effective_target_mips_loongson
]) } {
3536 set et_vect_no_int_max_saved
1
3539 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3540 return $et_vect_no_int_max_saved
3543 #
Return 1 if the target plus current options does not support a vector
3544 # add instruction
on "int", 0 otherwise.
3546 # This won
't change for different subtargets so cache the result.
3548 proc check_effective_target_vect_no_int_add { } {
3549 global et_vect_no_int_add_saved
3551 if [info exists et_vect_no_int_add_saved] {
3552 verbose "check_effective_target_vect_no_int_add: using cached result" 2
3554 set et_vect_no_int_add_saved 0
3555 # Alpha only supports vector add on V8QI and V4HI.
3556 if { [istarget alpha*-*-*] } {
3557 set et_vect_no_int_add_saved 1
3560 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3561 return $et_vect_no_int_add_saved
3564 # Return 1 if the target plus current options does not support vector
3565 # bitwise instructions, 0 otherwise.
3567 # This won't change
for different subtargets so
cache the result.
3569 proc check_effective_target_vect_no_bitwise
{ } {
3570 global et_vect_no_bitwise_saved
3572 if [info exists et_vect_no_bitwise_saved
] {
3573 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
3575 set et_vect_no_bitwise_saved
0
3577 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3578 return $et_vect_no_bitwise_saved
3581 #
Return 1 if the target plus current options supports vector permutation
,
3584 # This won
't change for different subtargets so cache the result.
3586 proc check_effective_target_vect_perm { } {
3589 if [info exists et_vect_perm_saved] {
3590 verbose "check_effective_target_vect_perm: using cached result" 2
3592 set et_vect_perm_saved 0
3593 if { [is-effective-target arm_neon_ok]
3594 || [istarget aarch64*-*-*]
3595 || [istarget powerpc*-*-*]
3596 || [istarget spu-*-*]
3597 || [istarget i?86-*-*]
3598 || [istarget x86_64-*-*]
3599 || ([istarget mips*-*-*]
3600 && [check_effective_target_mpaired_single]) } {
3601 set et_vect_perm_saved 1
3604 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3605 return $et_vect_perm_saved
3608 # Return 1 if the target plus current options supports vector permutation
3609 # on byte-sized elements, 0 otherwise.
3611 # This won't change
for different subtargets so
cache the result.
3613 proc check_effective_target_vect_perm_byte
{ } {
3614 global et_vect_perm_byte
3616 if [info exists et_vect_perm_byte_saved
] {
3617 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
3619 set et_vect_perm_byte_saved
0
3620 if { ([is
-effective
-target arm_neon_ok
]
3621 && [is
-effective
-target arm_little_endian
])
3622 ||
([istarget aarch64
*-*-*]
3623 && [is
-effective
-target aarch64_little_endian
])
3624 ||
[istarget powerpc
*-*-*]
3625 ||
[istarget spu
-*-*] } {
3626 set et_vect_perm_byte_saved
1
3629 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3630 return $et_vect_perm_byte_saved
3633 #
Return 1 if the target plus current options supports vector permutation
3634 #
on short
-sized elements
, 0 otherwise.
3636 # This won
't change for different subtargets so cache the result.
3638 proc check_effective_target_vect_perm_short { } {
3639 global et_vect_perm_short
3641 if [info exists et_vect_perm_short_saved] {
3642 verbose "check_effective_target_vect_perm_short: using cached result" 2
3644 set et_vect_perm_short_saved 0
3645 if { ([is-effective-target arm_neon_ok]
3646 && [is-effective-target arm_little_endian])
3647 || ([istarget aarch64*-*-*]
3648 && [is-effective-target aarch64_little_endian])
3649 || [istarget powerpc*-*-*]
3650 || [istarget spu-*-*] } {
3651 set et_vect_perm_short_saved 1
3654 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3655 return $et_vect_perm_short_saved
3658 # Return 1 if the target plus current options supports a vector
3659 # widening summation of *short* args into *int* result, 0 otherwise.
3661 # This won't change
for different subtargets so
cache the result.
3663 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
3664 global et_vect_widen_sum_hi_to_si_pattern
3666 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
3667 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3669 set et_vect_widen_sum_hi_to_si_pattern_saved
0
3670 if { [istarget powerpc
*-*-*]
3671 ||
[istarget ia64
-*-*] } {
3672 set et_vect_widen_sum_hi_to_si_pattern_saved
1
3675 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3676 return $et_vect_widen_sum_hi_to_si_pattern_saved
3679 #
Return 1 if the target plus current options supports a vector
3680 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3681 # A target can also support this widening summation
if it can support
3682 # promotion
(unpacking
) from shorts to ints.
3684 # This won
't change for different subtargets so cache the result.
3686 proc check_effective_target_vect_widen_sum_hi_to_si { } {
3687 global et_vect_widen_sum_hi_to_si
3689 if [info exists et_vect_widen_sum_hi_to_si_saved] {
3690 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3692 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
3693 if { [istarget powerpc*-*-*]
3694 || [istarget ia64-*-*] } {
3695 set et_vect_widen_sum_hi_to_si_saved 1
3698 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3699 return $et_vect_widen_sum_hi_to_si_saved
3702 # Return 1 if the target plus current options supports a vector
3703 # widening summation of *char* args into *short* result, 0 otherwise.
3704 # A target can also support this widening summation if it can support
3705 # promotion (unpacking) from chars to shorts.
3707 # This won't change
for different subtargets so
cache the result.
3709 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
3710 global et_vect_widen_sum_qi_to_hi
3712 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
3713 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3715 set et_vect_widen_sum_qi_to_hi_saved
0
3716 if { [check_effective_target_vect_unpack
]
3717 ||
[check_effective_target_arm_neon_ok
]
3718 ||
[istarget ia64
-*-*] } {
3719 set et_vect_widen_sum_qi_to_hi_saved
1
3722 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3723 return $et_vect_widen_sum_qi_to_hi_saved
3726 #
Return 1 if the target plus current options supports a vector
3727 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
3729 # This won
't change for different subtargets so cache the result.
3731 proc check_effective_target_vect_widen_sum_qi_to_si { } {
3732 global et_vect_widen_sum_qi_to_si
3734 if [info exists et_vect_widen_sum_qi_to_si_saved] {
3735 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3737 set et_vect_widen_sum_qi_to_si_saved 0
3738 if { [istarget powerpc*-*-*] } {
3739 set et_vect_widen_sum_qi_to_si_saved 1
3742 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3743 return $et_vect_widen_sum_qi_to_si_saved
3746 # Return 1 if the target plus current options supports a vector
3747 # widening multiplication of *char* args into *short* result, 0 otherwise.
3748 # A target can also support this widening multplication if it can support
3749 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
3750 # multiplication of shorts).
3752 # This won't change
for different subtargets so
cache the result.
3755 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
3756 global et_vect_widen_mult_qi_to_hi
3758 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
3759 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3761 if { [check_effective_target_vect_unpack
]
3762 && [check_effective_target_vect_short_mult
] } {
3763 set et_vect_widen_mult_qi_to_hi_saved
1
3765 set et_vect_widen_mult_qi_to_hi_saved
0
3767 if { [istarget powerpc
*-*-*]
3768 ||
[istarget aarch64
*-*-*]
3769 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3770 set et_vect_widen_mult_qi_to_hi_saved
1
3773 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3774 return $et_vect_widen_mult_qi_to_hi_saved
3777 #
Return 1 if the target plus current options supports a vector
3778 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3779 # A target can also support this widening multplication
if it can support
3780 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
3781 # multiplication of ints
).
3783 # This won
't change for different subtargets so cache the result.
3786 proc check_effective_target_vect_widen_mult_hi_to_si { } {
3787 global et_vect_widen_mult_hi_to_si
3789 if [info exists et_vect_widen_mult_hi_to_si_saved] {
3790 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3792 if { [check_effective_target_vect_unpack]
3793 && [check_effective_target_vect_int_mult] } {
3794 set et_vect_widen_mult_hi_to_si_saved 1
3796 set et_vect_widen_mult_hi_to_si_saved 0
3798 if { [istarget powerpc*-*-*]
3799 || [istarget spu-*-*]
3800 || [istarget ia64-*-*]
3801 || [istarget aarch64*-*-*]
3802 || [istarget i?86-*-*]
3803 || [istarget x86_64-*-*]
3804 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3805 set et_vect_widen_mult_hi_to_si_saved 1
3808 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3809 return $et_vect_widen_mult_hi_to_si_saved
3812 # Return 1 if the target plus current options supports a vector
3813 # widening multiplication of *char* args into *short* result, 0 otherwise.
3815 # This won't change
for different subtargets so
cache the result.
3817 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern
{ } {
3818 global et_vect_widen_mult_qi_to_hi_pattern
3820 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved
] {
3821 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3823 set et_vect_widen_mult_qi_to_hi_pattern_saved
0
3824 if { [istarget powerpc
*-*-*]
3825 ||
([istarget arm
*-*-*]
3826 && [check_effective_target_arm_neon_ok
]
3827 && [check_effective_target_arm_little_endian
]) } {
3828 set et_vect_widen_mult_qi_to_hi_pattern_saved
1
3831 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3832 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3835 #
Return 1 if the target plus current options supports a vector
3836 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3838 # This won
't change for different subtargets so cache the result.
3840 proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
3841 global et_vect_widen_mult_hi_to_si_pattern
3843 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved] {
3844 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3846 set et_vect_widen_mult_hi_to_si_pattern_saved 0
3847 if { [istarget powerpc*-*-*]
3848 || [istarget spu-*-*]
3849 || [istarget ia64-*-*]
3850 || [istarget i?86-*-*]
3851 || [istarget x86_64-*-*]
3852 || ([istarget arm*-*-*]
3853 && [check_effective_target_arm_neon_ok]
3854 && [check_effective_target_arm_little_endian]) } {
3855 set et_vect_widen_mult_hi_to_si_pattern_saved 1
3858 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3859 return $et_vect_widen_mult_hi_to_si_pattern_saved
3862 # Return 1 if the target plus current options supports a vector
3863 # widening multiplication of *int* args into *long* result, 0 otherwise.
3865 # This won't change
for different subtargets so
cache the result.
3867 proc check_effective_target_vect_widen_mult_si_to_di_pattern
{ } {
3868 global et_vect_widen_mult_si_to_di_pattern
3870 if [info exists et_vect_widen_mult_si_to_di_pattern_saved
] {
3871 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
3873 set et_vect_widen_mult_si_to_di_pattern_saved
0
3874 if {[istarget ia64
-*-*]
3875 ||
[istarget i?
86-*-*]
3876 ||
[istarget x86_64
-*-*] } {
3877 set et_vect_widen_mult_si_to_di_pattern_saved
1
3880 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
3881 return $et_vect_widen_mult_si_to_di_pattern_saved
3884 #
Return 1 if the target plus current options supports a vector
3885 # widening shift
, 0 otherwise.
3887 # This won
't change for different subtargets so cache the result.
3889 proc check_effective_target_vect_widen_shift { } {
3890 global et_vect_widen_shift_saved
3892 if [info exists et_vect_shift_saved] {
3893 verbose "check_effective_target_vect_widen_shift: using cached result" 2
3895 set et_vect_widen_shift_saved 0
3896 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3897 set et_vect_widen_shift_saved 1
3900 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3901 return $et_vect_widen_shift_saved
3904 # Return 1 if the target plus current options supports a vector
3905 # dot-product of signed chars, 0 otherwise.
3907 # This won't change
for different subtargets so
cache the result.
3909 proc check_effective_target_vect_sdot_qi
{ } {
3910 global et_vect_sdot_qi
3912 if [info exists et_vect_sdot_qi_saved
] {
3913 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
3915 set et_vect_sdot_qi_saved
0
3916 if { [istarget ia64
-*-*] } {
3917 set et_vect_udot_qi_saved
1
3920 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3921 return $et_vect_sdot_qi_saved
3924 #
Return 1 if the target plus current options supports a vector
3925 # dot
-product of unsigned chars
, 0 otherwise.
3927 # This won
't change for different subtargets so cache the result.
3929 proc check_effective_target_vect_udot_qi { } {
3930 global et_vect_udot_qi
3932 if [info exists et_vect_udot_qi_saved] {
3933 verbose "check_effective_target_vect_udot_qi: using cached result" 2
3935 set et_vect_udot_qi_saved 0
3936 if { [istarget powerpc*-*-*]
3937 || [istarget ia64-*-*] } {
3938 set et_vect_udot_qi_saved 1
3941 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
3942 return $et_vect_udot_qi_saved
3945 # Return 1 if the target plus current options supports a vector
3946 # dot-product of signed shorts, 0 otherwise.
3948 # This won't change
for different subtargets so
cache the result.
3950 proc check_effective_target_vect_sdot_hi
{ } {
3951 global et_vect_sdot_hi
3953 if [info exists et_vect_sdot_hi_saved
] {
3954 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
3956 set et_vect_sdot_hi_saved
0
3957 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3958 ||
[istarget ia64
-*-*]
3959 ||
[istarget i?
86-*-*]
3960 ||
[istarget x86_64
-*-*] } {
3961 set et_vect_sdot_hi_saved
1
3964 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
3965 return $et_vect_sdot_hi_saved
3968 #
Return 1 if the target plus current options supports a vector
3969 # dot
-product of unsigned shorts
, 0 otherwise.
3971 # This won
't change for different subtargets so cache the result.
3973 proc check_effective_target_vect_udot_hi { } {
3974 global et_vect_udot_hi
3976 if [info exists et_vect_udot_hi_saved] {
3977 verbose "check_effective_target_vect_udot_hi: using cached result" 2
3979 set et_vect_udot_hi_saved 0
3980 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
3981 set et_vect_udot_hi_saved 1
3984 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
3985 return $et_vect_udot_hi_saved
3989 # Return 1 if the target plus current options supports a vector
3990 # demotion (packing) of shorts (to chars) and ints (to shorts)
3991 # using modulo arithmetic, 0 otherwise.
3993 # This won't change
for different subtargets so
cache the result.
3995 proc check_effective_target_vect_pack_trunc
{ } {
3996 global et_vect_pack_trunc
3998 if [info exists et_vect_pack_trunc_saved
] {
3999 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
4001 set et_vect_pack_trunc_saved
0
4002 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4003 ||
[istarget i?
86-*-*]
4004 ||
[istarget x86_64
-*-*]
4005 ||
[istarget aarch64
*-*-*]
4006 ||
[istarget spu
-*-*]
4007 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
4008 && [check_effective_target_arm_little_endian
]) } {
4009 set et_vect_pack_trunc_saved
1
4012 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
4013 return $et_vect_pack_trunc_saved
4016 #
Return 1 if the target plus current options supports a vector
4017 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
4019 # This won
't change for different subtargets so cache the result.
4021 proc check_effective_target_vect_unpack { } {
4022 global et_vect_unpack
4024 if [info exists et_vect_unpack_saved] {
4025 verbose "check_effective_target_vect_unpack: using cached result" 2
4027 set et_vect_unpack_saved 0
4028 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
4029 || [istarget i?86-*-*]
4030 || [istarget x86_64-*-*]
4031 || [istarget spu-*-*]
4032 || [istarget ia64-*-*]
4033 || [istarget aarch64*-*-*]
4034 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
4035 && [check_effective_target_arm_little_endian]) } {
4036 set et_vect_unpack_saved 1
4039 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
4040 return $et_vect_unpack_saved
4043 # Return 1 if the target plus current options does not guarantee
4044 # that its STACK_BOUNDARY is >= the reguired vector alignment.
4046 # This won't change
for different subtargets so
cache the result.
4048 proc check_effective_target_unaligned_stack
{ } {
4049 global et_unaligned_stack_saved
4051 if [info exists et_unaligned_stack_saved
] {
4052 verbose
"check_effective_target_unaligned_stack: using cached result" 2
4054 set et_unaligned_stack_saved
0
4056 verbose
"check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
4057 return $et_unaligned_stack_saved
4060 #
Return 1 if the target plus current options does not support a vector
4061 # alignment mechanism
, 0 otherwise.
4063 # This won
't change for different subtargets so cache the result.
4065 proc check_effective_target_vect_no_align { } {
4066 global et_vect_no_align_saved
4068 if [info exists et_vect_no_align_saved] {
4069 verbose "check_effective_target_vect_no_align: using cached result" 2
4071 set et_vect_no_align_saved 0
4072 if { [istarget mipsisa64*-*-*]
4073 || [istarget mips-sde-elf]
4074 || [istarget sparc*-*-*]
4075 || [istarget ia64-*-*]
4076 || [check_effective_target_arm_vect_no_misalign]
4077 || ([istarget powerpc*-*-*] && [check_p8vector_hw_available])
4078 || ([istarget mips*-*-*]
4079 && [check_effective_target_mips_loongson]) } {
4080 set et_vect_no_align_saved 1
4083 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
4084 return $et_vect_no_align_saved
4087 # Return 1 if the target supports a vector misalign access, 0 otherwise.
4089 # This won't change
for different subtargets so
cache the result.
4091 proc check_effective_target_vect_hw_misalign
{ } {
4092 global et_vect_hw_misalign_saved
4094 if [info exists et_vect_hw_misalign_saved
] {
4095 verbose
"check_effective_target_vect_hw_misalign: using cached result" 2
4097 set et_vect_hw_misalign_saved
0
4098 if { ([istarget x86_64
-*-*]
4099 ||
([istarget powerpc
*-*-*] && [check_p8vector_hw_available
])
4100 ||
[istarget aarch64
*-*-*]
4101 ||
[istarget i?
86-*-*]) } {
4102 set et_vect_hw_misalign_saved
1
4105 verbose
"check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
4106 return $et_vect_hw_misalign_saved
4110 #
Return 1 if arrays are aligned to the vector alignment
4111 # boundary
, 0 otherwise.
4113 # This won
't change for different subtargets so cache the result.
4115 proc check_effective_target_vect_aligned_arrays { } {
4116 global et_vect_aligned_arrays
4118 if [info exists et_vect_aligned_arrays_saved] {
4119 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
4121 set et_vect_aligned_arrays_saved 0
4122 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4123 if { ([is-effective-target lp64]
4124 && ( ![check_avx_available]
4125 || [check_prefer_avx128])) } {
4126 set et_vect_aligned_arrays_saved 1
4129 if [istarget spu-*-*] {
4130 set et_vect_aligned_arrays_saved 1
4133 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
4134 return $et_vect_aligned_arrays_saved
4137 # Return 1 if types of size 32 bit or less are naturally aligned
4138 # (aligned to their type-size), 0 otherwise.
4140 # This won't change
for different subtargets so
cache the result.
4142 proc check_effective_target_natural_alignment_32
{ } {
4143 global et_natural_alignment_32
4145 if [info exists et_natural_alignment_32_saved
] {
4146 verbose
"check_effective_target_natural_alignment_32: using cached result" 2
4148 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
4149 set et_natural_alignment_32_saved
1
4150 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
4151 set et_natural_alignment_32_saved
0
4154 verbose
"check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4155 return $et_natural_alignment_32_saved
4158 #
Return 1 if types of size
64 bit or less are naturally aligned
(aligned to their
4159 # type
-size
), 0 otherwise.
4161 # This won
't change for different subtargets so cache the result.
4163 proc check_effective_target_natural_alignment_64 { } {
4164 global et_natural_alignment_64
4166 if [info exists et_natural_alignment_64_saved] {
4167 verbose "check_effective_target_natural_alignment_64: using cached result" 2
4169 set et_natural_alignment_64_saved 0
4170 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
4171 || [istarget spu-*-*] } {
4172 set et_natural_alignment_64_saved 1
4175 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4176 return $et_natural_alignment_64_saved
4179 # Return 1 if all vector types are naturally aligned (aligned to their
4180 # type-size), 0 otherwise.
4182 # This won't change
for different subtargets so
cache the result.
4184 proc check_effective_target_vect_natural_alignment
{ } {
4185 global et_vect_natural_alignment
4187 if [info exists et_vect_natural_alignment_saved
] {
4188 verbose
"check_effective_target_vect_natural_alignment: using cached result" 2
4190 set et_vect_natural_alignment_saved
1
4191 if { [check_effective_target_arm_eabi
] } {
4192 set et_vect_natural_alignment_saved
0
4195 verbose
"check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4196 return $et_vect_natural_alignment_saved
4199 #
Return 1 if vector alignment
(for types of size
32 bit or less
) is reachable
, 0 otherwise.
4201 # This won
't change for different subtargets so cache the result.
4203 proc check_effective_target_vector_alignment_reachable { } {
4204 global et_vector_alignment_reachable
4206 if [info exists et_vector_alignment_reachable_saved] {
4207 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
4209 if { [check_effective_target_vect_aligned_arrays]
4210 || [check_effective_target_natural_alignment_32] } {
4211 set et_vector_alignment_reachable_saved 1
4213 set et_vector_alignment_reachable_saved 0
4216 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4217 return $et_vector_alignment_reachable_saved
4220 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
4222 # This won't change
for different subtargets so
cache the result.
4224 proc check_effective_target_vector_alignment_reachable_for_64bit
{ } {
4225 global et_vector_alignment_reachable_for_64bit
4227 if [info exists et_vector_alignment_reachable_for_64bit_saved
] {
4228 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4230 if { [check_effective_target_vect_aligned_arrays
]
4231 ||
[check_effective_target_natural_alignment_64
] } {
4232 set et_vector_alignment_reachable_for_64bit_saved
1
4234 set et_vector_alignment_reachable_for_64bit_saved
0
4237 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4238 return $et_vector_alignment_reachable_for_64bit_saved
4241 #
Return 1 if the target only requires element alignment
for vector accesses
4243 proc check_effective_target_vect_element_align
{ } {
4244 global et_vect_element_align
4246 if [info exists et_vect_element_align
] {
4247 verbose
"check_effective_target_vect_element_align: using cached result" 2
4249 set et_vect_element_align
0
4250 if { ([istarget arm
*-*-*]
4251 && ![check_effective_target_arm_vect_no_misalign
])
4252 ||
[check_effective_target_vect_hw_misalign
] } {
4253 set et_vect_element_align
1
4257 verbose
"check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4258 return $et_vect_element_align
4261 #
Return 1 if the target supports vector conditional operations
, 0 otherwise.
4263 proc check_effective_target_vect_condition
{ } {
4264 global et_vect_cond_saved
4266 if [info exists et_vect_cond_saved
] {
4267 verbose
"check_effective_target_vect_cond: using cached result" 2
4269 set et_vect_cond_saved
0
4270 if { [istarget aarch64
*-*-*]
4271 ||
[istarget powerpc
*-*-*]
4272 ||
[istarget ia64
-*-*]
4273 ||
[istarget i?
86-*-*]
4274 ||
[istarget spu
-*-*]
4275 ||
[istarget x86_64
-*-*]
4276 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
4277 set et_vect_cond_saved
1
4281 verbose
"check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4282 return $et_vect_cond_saved
4285 #
Return 1 if the target supports vector conditional operations where
4286 # the comparison has different type from the lhs
, 0 otherwise.
4288 proc check_effective_target_vect_cond_mixed
{ } {
4289 global et_vect_cond_mixed_saved
4291 if [info exists et_vect_cond_mixed_saved
] {
4292 verbose
"check_effective_target_vect_cond_mixed: using cached result" 2
4294 set et_vect_cond_mixed_saved
0
4295 if { [istarget i?
86-*-*]
4296 ||
[istarget x86_64
-*-*]
4297 ||
[istarget powerpc
*-*-*] } {
4298 set et_vect_cond_mixed_saved
1
4302 verbose
"check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4303 return $et_vect_cond_mixed_saved
4306 #
Return 1 if the target supports vector char multiplication
, 0 otherwise.
4308 proc check_effective_target_vect_char_mult
{ } {
4309 global et_vect_char_mult_saved
4311 if [info exists et_vect_char_mult_saved
] {
4312 verbose
"check_effective_target_vect_char_mult: using cached result" 2
4314 set et_vect_char_mult_saved
0
4315 if { [istarget aarch64
*-*-*]
4316 ||
[istarget ia64
-*-*]
4317 ||
[istarget i?
86-*-*]
4318 ||
[istarget x86_64
-*-*]
4319 ||
[check_effective_target_arm32
] } {
4320 set et_vect_char_mult_saved
1
4324 verbose
"check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4325 return $et_vect_char_mult_saved
4328 #
Return 1 if the target supports vector short multiplication
, 0 otherwise.
4330 proc check_effective_target_vect_short_mult
{ } {
4331 global et_vect_short_mult_saved
4333 if [info exists et_vect_short_mult_saved
] {
4334 verbose
"check_effective_target_vect_short_mult: using cached result" 2
4336 set et_vect_short_mult_saved
0
4337 if { [istarget ia64
-*-*]
4338 ||
[istarget spu
-*-*]
4339 ||
[istarget i?
86-*-*]
4340 ||
[istarget x86_64
-*-*]
4341 ||
[istarget powerpc
*-*-*]
4342 ||
[istarget aarch64
*-*-*]
4343 ||
[check_effective_target_arm32
]
4344 ||
([istarget mips
*-*-*]
4345 && [check_effective_target_mips_loongson
]) } {
4346 set et_vect_short_mult_saved
1
4350 verbose
"check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4351 return $et_vect_short_mult_saved
4354 #
Return 1 if the target supports vector
int multiplication
, 0 otherwise.
4356 proc check_effective_target_vect_int_mult
{ } {
4357 global et_vect_int_mult_saved
4359 if [info exists et_vect_int_mult_saved
] {
4360 verbose
"check_effective_target_vect_int_mult: using cached result" 2
4362 set et_vect_int_mult_saved
0
4363 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4364 ||
[istarget spu
-*-*]
4365 ||
[istarget i?
86-*-*]
4366 ||
[istarget x86_64
-*-*]
4367 ||
[istarget ia64
-*-*]
4368 ||
[istarget aarch64
*-*-*]
4369 ||
[check_effective_target_arm32
] } {
4370 set et_vect_int_mult_saved
1
4374 verbose
"check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4375 return $et_vect_int_mult_saved
4378 #
Return 1 if the target supports vector even
/odd elements extraction
, 0 otherwise.
4380 proc check_effective_target_vect_extract_even_odd
{ } {
4381 global et_vect_extract_even_odd_saved
4383 if [info exists et_vect_extract_even_odd_saved
] {
4384 verbose
"check_effective_target_vect_extract_even_odd: using cached result" 2
4386 set et_vect_extract_even_odd_saved
0
4387 if { [istarget aarch64
*-*-*]
4388 ||
[istarget powerpc
*-*-*]
4389 ||
[is
-effective
-target arm_neon_ok
]
4390 ||
[istarget i?
86-*-*]
4391 ||
[istarget x86_64
-*-*]
4392 ||
[istarget ia64
-*-*]
4393 ||
[istarget spu
-*-*]
4394 ||
([istarget mips
*-*-*]
4395 && [check_effective_target_mpaired_single
]) } {
4396 set et_vect_extract_even_odd_saved
1
4400 verbose
"check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4401 return $et_vect_extract_even_odd_saved
4404 #
Return 1 if the target supports vector interleaving
, 0 otherwise.
4406 proc check_effective_target_vect_interleave
{ } {
4407 global et_vect_interleave_saved
4409 if [info exists et_vect_interleave_saved
] {
4410 verbose
"check_effective_target_vect_interleave: using cached result" 2
4412 set et_vect_interleave_saved
0
4413 if { [istarget aarch64
*-*-*]
4414 ||
[istarget powerpc
*-*-*]
4415 ||
[is
-effective
-target arm_neon_ok
]
4416 ||
[istarget i?
86-*-*]
4417 ||
[istarget x86_64
-*-*]
4418 ||
[istarget ia64
-*-*]
4419 ||
[istarget spu
-*-*]
4420 ||
([istarget mips
*-*-*]
4421 && [check_effective_target_mpaired_single
]) } {
4422 set et_vect_interleave_saved
1
4426 verbose
"check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4427 return $et_vect_interleave_saved
4430 foreach N
{2 3 4 8} {
4431 eval
[string map
[list N $N
] {
4432 #
Return 1 if the target supports
2-vector interleaving
4433 proc check_effective_target_vect_stridedN
{ } {
4434 global et_vect_stridedN_saved
4436 if [info exists et_vect_stridedN_saved
] {
4437 verbose
"check_effective_target_vect_stridedN: using cached result" 2
4439 set et_vect_stridedN_saved
0
4441 && [check_effective_target_vect_interleave
]
4442 && [check_effective_target_vect_extract_even_odd
] } {
4443 set et_vect_stridedN_saved
1
4445 if { ([istarget arm
*-*-*]
4446 ||
[istarget aarch64
*-*-*]) && N
>= 2 && N
<= 4 } {
4447 set et_vect_stridedN_saved
1
4451 verbose
"check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4452 return $et_vect_stridedN_saved
4457 #
Return 1 if the target supports multiple vector sizes
4459 proc check_effective_target_vect_multiple_sizes
{ } {
4460 global et_vect_multiple_sizes_saved
4462 set et_vect_multiple_sizes_saved
0
4463 if { ([istarget aarch64
*-*-*]
4464 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
])) } {
4465 set et_vect_multiple_sizes_saved
1
4467 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
4468 if { ([check_avx_available
] && ![check_prefer_avx128
]) } {
4469 set et_vect_multiple_sizes_saved
1
4473 verbose
"check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4474 return $et_vect_multiple_sizes_saved
4477 #
Return 1 if the target supports vectors of
64 bits.
4479 proc check_effective_target_vect64
{ } {
4480 global et_vect64_saved
4482 if [info exists et_vect64_saved
] {
4483 verbose
"check_effective_target_vect64: using cached result" 2
4485 set et_vect64_saved
0
4486 if { ([istarget arm
*-*-*]
4487 && [check_effective_target_arm_neon_ok
]
4488 && [check_effective_target_arm_little_endian
]) } {
4489 set et_vect64_saved
1
4493 verbose
"check_effective_target_vect64: returning $et_vect64_saved" 2
4494 return $et_vect64_saved
4497 #
Return 1 if the target supports vector copysignf calls.
4499 proc check_effective_target_vect_call_copysignf
{ } {
4500 global et_vect_call_copysignf_saved
4502 if [info exists et_vect_call_copysignf_saved
] {
4503 verbose
"check_effective_target_vect_call_copysignf: using cached result" 2
4505 set et_vect_call_copysignf_saved
0
4506 if { [istarget i?
86-*-*]
4507 ||
[istarget x86_64
-*-*]
4508 ||
[istarget powerpc
*-*-*] } {
4509 set et_vect_call_copysignf_saved
1
4513 verbose
"check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4514 return $et_vect_call_copysignf_saved
4517 #
Return 1 if the target supports vector sqrtf calls.
4519 proc check_effective_target_vect_call_sqrtf
{ } {
4520 global et_vect_call_sqrtf_saved
4522 if [info exists et_vect_call_sqrtf_saved
] {
4523 verbose
"check_effective_target_vect_call_sqrtf: using cached result" 2
4525 set et_vect_call_sqrtf_saved
0
4526 if { [istarget aarch64
*-*-*]
4527 ||
[istarget i?
86-*-*]
4528 ||
[istarget x86_64
-*-*]
4529 ||
([istarget powerpc
*-*-*] && [check_vsx_hw_available
]) } {
4530 set et_vect_call_sqrtf_saved
1
4534 verbose
"check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4535 return $et_vect_call_sqrtf_saved
4538 #
Return 1 if the target supports vector lrint calls.
4540 proc check_effective_target_vect_call_lrint
{ } {
4541 set et_vect_call_lrint
0
4542 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) && [check_effective_target_ilp32
] } {
4543 set et_vect_call_lrint
1
4546 verbose
"check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4547 return $et_vect_call_lrint
4550 #
Return 1 if the target supports vector btrunc calls.
4552 proc check_effective_target_vect_call_btrunc
{ } {
4553 global et_vect_call_btrunc_saved
4555 if [info exists et_vect_call_btrunc_saved
] {
4556 verbose
"check_effective_target_vect_call_btrunc: using cached result" 2
4558 set et_vect_call_btrunc_saved
0
4559 if { [istarget aarch64
*-*-*] } {
4560 set et_vect_call_btrunc_saved
1
4564 verbose
"check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4565 return $et_vect_call_btrunc_saved
4568 #
Return 1 if the target supports vector btruncf calls.
4570 proc check_effective_target_vect_call_btruncf
{ } {
4571 global et_vect_call_btruncf_saved
4573 if [info exists et_vect_call_btruncf_saved
] {
4574 verbose
"check_effective_target_vect_call_btruncf: using cached result" 2
4576 set et_vect_call_btruncf_saved
0
4577 if { [istarget aarch64
*-*-*] } {
4578 set et_vect_call_btruncf_saved
1
4582 verbose
"check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4583 return $et_vect_call_btruncf_saved
4586 #
Return 1 if the target supports vector ceil calls.
4588 proc check_effective_target_vect_call_ceil
{ } {
4589 global et_vect_call_ceil_saved
4591 if [info exists et_vect_call_ceil_saved
] {
4592 verbose
"check_effective_target_vect_call_ceil: using cached result" 2
4594 set et_vect_call_ceil_saved
0
4595 if { [istarget aarch64
*-*-*] } {
4596 set et_vect_call_ceil_saved
1
4600 verbose
"check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4601 return $et_vect_call_ceil_saved
4604 #
Return 1 if the target supports vector ceilf calls.
4606 proc check_effective_target_vect_call_ceilf
{ } {
4607 global et_vect_call_ceilf_saved
4609 if [info exists et_vect_call_ceilf_saved
] {
4610 verbose
"check_effective_target_vect_call_ceilf: using cached result" 2
4612 set et_vect_call_ceilf_saved
0
4613 if { [istarget aarch64
*-*-*] } {
4614 set et_vect_call_ceilf_saved
1
4618 verbose
"check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4619 return $et_vect_call_ceilf_saved
4622 #
Return 1 if the target supports vector floor calls.
4624 proc check_effective_target_vect_call_floor
{ } {
4625 global et_vect_call_floor_saved
4627 if [info exists et_vect_call_floor_saved
] {
4628 verbose
"check_effective_target_vect_call_floor: using cached result" 2
4630 set et_vect_call_floor_saved
0
4631 if { [istarget aarch64
*-*-*] } {
4632 set et_vect_call_floor_saved
1
4636 verbose
"check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4637 return $et_vect_call_floor_saved
4640 #
Return 1 if the target supports vector floorf calls.
4642 proc check_effective_target_vect_call_floorf
{ } {
4643 global et_vect_call_floorf_saved
4645 if [info exists et_vect_call_floorf_saved
] {
4646 verbose
"check_effective_target_vect_call_floorf: using cached result" 2
4648 set et_vect_call_floorf_saved
0
4649 if { [istarget aarch64
*-*-*] } {
4650 set et_vect_call_floorf_saved
1
4654 verbose
"check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4655 return $et_vect_call_floorf_saved
4658 #
Return 1 if the target supports vector lceil calls.
4660 proc check_effective_target_vect_call_lceil
{ } {
4661 global et_vect_call_lceil_saved
4663 if [info exists et_vect_call_lceil_saved
] {
4664 verbose
"check_effective_target_vect_call_lceil: using cached result" 2
4666 set et_vect_call_lceil_saved
0
4667 if { [istarget aarch64
*-*-*] } {
4668 set et_vect_call_lceil_saved
1
4672 verbose
"check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4673 return $et_vect_call_lceil_saved
4676 #
Return 1 if the target supports vector lfloor calls.
4678 proc check_effective_target_vect_call_lfloor
{ } {
4679 global et_vect_call_lfloor_saved
4681 if [info exists et_vect_call_lfloor_saved
] {
4682 verbose
"check_effective_target_vect_call_lfloor: using cached result" 2
4684 set et_vect_call_lfloor_saved
0
4685 if { [istarget aarch64
*-*-*] } {
4686 set et_vect_call_lfloor_saved
1
4690 verbose
"check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4691 return $et_vect_call_lfloor_saved
4694 #
Return 1 if the target supports vector nearbyint calls.
4696 proc check_effective_target_vect_call_nearbyint
{ } {
4697 global et_vect_call_nearbyint_saved
4699 if [info exists et_vect_call_nearbyint_saved
] {
4700 verbose
"check_effective_target_vect_call_nearbyint: using cached result" 2
4702 set et_vect_call_nearbyint_saved
0
4703 if { [istarget aarch64
*-*-*] } {
4704 set et_vect_call_nearbyint_saved
1
4708 verbose
"check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4709 return $et_vect_call_nearbyint_saved
4712 #
Return 1 if the target supports vector nearbyintf calls.
4714 proc check_effective_target_vect_call_nearbyintf
{ } {
4715 global et_vect_call_nearbyintf_saved
4717 if [info exists et_vect_call_nearbyintf_saved
] {
4718 verbose
"check_effective_target_vect_call_nearbyintf: using cached result" 2
4720 set et_vect_call_nearbyintf_saved
0
4721 if { [istarget aarch64
*-*-*] } {
4722 set et_vect_call_nearbyintf_saved
1
4726 verbose
"check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4727 return $et_vect_call_nearbyintf_saved
4730 #
Return 1 if the target supports vector
round calls.
4732 proc check_effective_target_vect_call_round
{ } {
4733 global et_vect_call_round_saved
4735 if [info exists et_vect_call_round_saved
] {
4736 verbose
"check_effective_target_vect_call_round: using cached result" 2
4738 set et_vect_call_round_saved
0
4739 if { [istarget aarch64
*-*-*] } {
4740 set et_vect_call_round_saved
1
4744 verbose
"check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4745 return $et_vect_call_round_saved
4748 #
Return 1 if the target supports vector roundf calls.
4750 proc check_effective_target_vect_call_roundf
{ } {
4751 global et_vect_call_roundf_saved
4753 if [info exists et_vect_call_roundf_saved
] {
4754 verbose
"check_effective_target_vect_call_roundf: using cached result" 2
4756 set et_vect_call_roundf_saved
0
4757 if { [istarget aarch64
*-*-*] } {
4758 set et_vect_call_roundf_saved
1
4762 verbose
"check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4763 return $et_vect_call_roundf_saved
4766 #
Return 1 if the target supports section
-anchors
4768 proc check_effective_target_section_anchors
{ } {
4769 global et_section_anchors_saved
4771 if [info exists et_section_anchors_saved
] {
4772 verbose
"check_effective_target_section_anchors: using cached result" 2
4774 set et_section_anchors_saved
0
4775 if { [istarget powerpc
*-*-*]
4776 ||
[istarget arm
*-*-*] } {
4777 set et_section_anchors_saved
1
4781 verbose
"check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4782 return $et_section_anchors_saved
4785 #
Return 1 if the target supports atomic operations
on "int_128" values.
4787 proc check_effective_target_sync_int_128
{ } {
4788 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4789 && ![is
-effective
-target ia32
] } {
4796 #
Return 1 if the target supports atomic operations
on "int_128" values
4797 # and can
execute them.
4799 proc check_effective_target_sync_int_128_runtime
{ } {
4800 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4801 && ![is
-effective
-target ia32
] } {
4802 return [check_cached_effective_target sync_int_128_available
{
4803 check_runtime_nocache sync_int_128_available
{
4807 unsigned
int eax
, ebx
, ecx
, edx
;
4808 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4809 return !(ecx
& bit_CMPXCHG16B
);
4819 #
Return 1 if the target supports atomic operations
on "long long".
4821 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4823 proc check_effective_target_sync_long_long
{ } {
4824 if { [istarget x86_64
-*-*]
4825 ||
[istarget i?
86-*-*])
4826 ||
[istarget aarch64
*-*-*]
4827 ||
[istarget arm
*-*-*]
4828 ||
[istarget alpha
*-*-*]
4829 ||
([istarget sparc
*-*-*] && [check_effective_target_lp64
]) } {
4836 #
Return 1 if the target supports atomic operations
on "long long"
4837 # and can
execute them.
4839 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4841 proc check_effective_target_sync_long_long_runtime
{ } {
4842 if { [istarget x86_64
-*-*]
4843 ||
[istarget i?
86-*-*] } {
4844 return [check_cached_effective_target sync_long_long_available
{
4845 check_runtime_nocache sync_long_long_available
{
4849 unsigned
int eax
, ebx
, ecx
, edx
;
4850 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4851 return !(edx
& bit_CMPXCHG8B
);
4856 } elseif
{ [istarget aarch64
*-*-*] } {
4858 } elseif
{ [istarget arm
*-*-linux
-*] } {
4859 return [check_runtime sync_longlong_runtime
{
4865 if (sizeof
(long long
) != 8)
4868 /* Just check
for native
; checking
for kernel fallback is tricky.
*/
4869 asm volatile
("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4874 } elseif
{ [istarget alpha
*-*-*] } {
4876 } elseif
{ ([istarget sparc
*-*-*]
4877 && [check_effective_target_lp64
]
4878 && [check_effective_target_ultrasparc_hw
]) } {
4880 } elseif
{ [istarget powerpc
*-*-*] && [check_effective_target_lp64
] } {
4887 #
Return 1 if the target supports atomic operations
on "int" and "long".
4889 proc check_effective_target_sync_int_long
{ } {
4890 global et_sync_int_long_saved
4892 if [info exists et_sync_int_long_saved
] {
4893 verbose
"check_effective_target_sync_int_long: using cached result" 2
4895 set et_sync_int_long_saved
0
4896 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
4897 # load-reserved/store-conditional instructions.
4898 if { [istarget ia64-*-*]
4899 || [istarget i?86-*-*]
4900 || [istarget x86_64-*-*]
4901 || [istarget aarch64*-*-*]
4902 || [istarget alpha*-*-*]
4903 || [istarget arm*-*-linux-*]
4904 || [istarget bfin*-*linux*]
4905 || [istarget hppa*-*linux*]
4906 || [istarget s390*-*-*]
4907 || [istarget powerpc*-*-*]
4908 || [istarget crisv32-*-*] || [istarget cris-*-*]
4909 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
4910 || [check_effective_target_mips_llsc] } {
4911 set et_sync_int_long_saved 1
4915 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
4916 return $et_sync_int_long_saved
4919 # Return 1 if the target supports atomic operations on "char" and "short".
4921 proc check_effective_target_sync_char_short { } {
4922 global et_sync_char_short_saved
4924 if [info exists et_sync_char_short_saved] {
4925 verbose "check_effective_target_sync_char_short: using cached result" 2
4927 set et_sync_char_short_saved 0
4928 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
4929 #
load-reserved/store
-conditional instructions.
4930 if { [istarget aarch64
*-*-*]
4931 ||
[istarget ia64
-*-*]
4932 ||
[istarget i?
86-*-*]
4933 ||
[istarget x86_64
-*-*]
4934 ||
[istarget alpha
*-*-*]
4935 ||
[istarget arm
*-*-linux
-*]
4936 ||
[istarget hppa
*-*linux
*]
4937 ||
[istarget s390
*-*-*]
4938 ||
[istarget powerpc
*-*-*]
4939 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
4940 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
4941 ||
[check_effective_target_mips_llsc
] } {
4942 set et_sync_char_short_saved
1
4946 verbose
"check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
4947 return $et_sync_char_short_saved
4950 #
Return 1 if the target uses a ColdFire FPU.
4952 proc check_effective_target_coldfire_fpu
{ } {
4953 return [check_no_compiler_messages coldfire_fpu assembly
{
4960 #
Return true
if this is a uClibc target.
4962 proc check_effective_target_uclibc
{} {
4963 return [check_no_compiler_messages uclibc object
{
4964 #
include <features.h
>
4965 #
if !defined
(__UCLIBC__
)
4971 #
Return true
if this is a uclibc target and
if the uclibc feature
4972 # described by __$feature__ is not present.
4974 proc check_missing_uclibc_feature
{feature
} {
4975 return [check_no_compiler_messages $feature object
"
4976 #
include <features.h
>
4977 #
if !defined
(__UCLIBC
) || defined
(__$
{feature
}__
)
4983 #
Return true
if this is a Newlib target.
4985 proc check_effective_target_newlib
{} {
4986 return [check_no_compiler_messages newlib object
{
4991 #
Return true
if this is NOT a Bionic target.
4993 proc check_effective_target_non_bionic
{} {
4994 return [check_no_compiler_messages non_bionic object
{
4996 #
if defined
(__BIONIC__
)
5003 #
(a
) an error of a few ULP is expected in string to floating
-point
5004 # conversion functions
; and
5005 #
(b
) overflow is not always detected correctly by those functions.
5007 proc check_effective_target_lax_strtofp
{} {
5008 # By default
, assume that all uClibc targets suffer from this.
5009 return [check_effective_target_uclibc
]
5012 #
Return 1 if this is a target
for which wcsftime is a dummy
5013 # function that always returns
0.
5015 proc check_effective_target_dummy_wcsftime
{} {
5016 # By default
, assume that all uClibc targets suffer from this.
5017 return [check_effective_target_uclibc
]
5020 #
Return 1 if constructors with initialization priority arguments are
5021 # supposed
on this target.
5023 proc check_effective_target_init_priority
{} {
5024 return [check_no_compiler_messages init_priority assembly
"
5025 void f
() __attribute__
((constructor
(1000)));
5030 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
5031 # This can be used with
any check_
* proc that takes no
argument and
5032 # returns only
1 or
0. It could be used with check_
* procs that take
5033 # arguments with keywords that pass particular arguments.
5035 proc is
-effective
-target
{ arg } {
5037 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5038 set selected
[check_effective_target_$
{arg}]
5041 "vmx_hw" { set selected [check_vmx_hw_available] }
5042 "vsx_hw" { set selected [check_vsx_hw_available] }
5043 "p8vector_hw" { set selected [check_p8vector_hw_available] }
5044 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
5045 "dfp_hw" { set selected [check_dfp_hw_available] }
5046 "htm_hw" { set selected [check_htm_hw_available] }
5047 "named_sections" { set selected [check_named_sections_available] }
5048 "gc_sections" { set selected [check_gc_sections_available] }
5049 "cxa_atexit" { set selected [check_cxa_atexit_available] }
5050 default
{ error
"unknown effective target keyword `$arg'" }
5053 verbose
"is-effective-target: $arg $selected" 2
5057 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
5059 proc is
-effective
-target
-keyword
{ arg } {
5060 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5063 # These have different names
for their check_
* procs.
5065 "vmx_hw" { return 1 }
5066 "vsx_hw" { return 1 }
5067 "p8vector_hw" { return 1 }
5068 "ppc_recip_hw" { return 1 }
5069 "dfp_hw" { return 1 }
5070 "htm_hw" { return 1 }
5071 "named_sections" { return 1 }
5072 "gc_sections" { return 1 }
5073 "cxa_atexit" { return 1 }
5074 default
{ return 0 }
5079 #
Return 1 if target default to short enums
5081 proc check_effective_target_short_enums
{ } {
5082 return [check_no_compiler_messages short_enums assembly
{
5084 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
5088 #
Return 1 if target supports merging string constants at link time.
5090 proc check_effective_target_string_merging
{ } {
5091 return [check_no_messages_and_pattern string_merging \
5092 "rodata\\.str" assembly {
5093 const char
*var
= "String";
5097 #
Return 1 if target has the basic signed and unsigned types in
5098 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
5099 # working
<stdint.h
> for all targets.
5101 proc check_effective_target_stdint_types
{ } {
5102 return [check_no_compiler_messages stdint_types assembly
{
5104 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
5105 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
5109 #
Return 1 if target has the basic signed and unsigned types in
5110 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
5111 # these types agree with those in the header, as some systems have
5112 # only <inttypes.h>.
5114 proc check_effective_target_inttypes_types { } {
5115 return [check_no_compiler_messages inttypes_types assembly {
5116 #include <inttypes.h>
5117 int8_t a; int16_t b; int32_t c; int64_t d;
5118 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
5122 # Return 1 if programs are intended to be run on a simulator
5123 # (i.e. slowly) rather than hardware (i.e. fast).
5125 proc check_effective_target_simulator { } {
5127 # All "src/sim" simulators set this one.
5128 if [board_info target exists is_simulator] {
5129 return [board_info target is_simulator]
5132 # The "sid" simulators don't
set that one
, but at least they
set
5134 if [board_info target
exists slow_simulator
] {
5135 return [board_info target slow_simulator
]
5141 #
Return 1 if programs are intended to be run
on hardware rather than
5144 proc check_effective_target_hw
{ } {
5146 # All
"src/sim" simulators set this one.
5147 if [board_info target
exists is_simulator
] {
5148 if [board_info target is_simulator
] {
5155 # The
"sid" simulators don't set that one, but at least they set
5157 if [board_info target
exists slow_simulator
] {
5158 if [board_info target slow_simulator
] {
5168 #
Return 1 if the target is a VxWorks kernel.
5170 proc check_effective_target_vxworks_kernel
{ } {
5171 return [check_no_compiler_messages vxworks_kernel assembly
{
5172 #
if !defined __vxworks || defined __RTP__
5178 #
Return 1 if the target is a VxWorks RTP.
5180 proc check_effective_target_vxworks_rtp
{ } {
5181 return [check_no_compiler_messages vxworks_rtp assembly
{
5182 #
if !defined __vxworks ||
!defined __RTP__
5188 #
Return 1 if the target is expected to provide wide character support.
5190 proc check_effective_target_wchar
{ } {
5191 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5194 return [check_no_compiler_messages wchar assembly
{
5199 #
Return 1 if the target has
<pthread.h
>.
5201 proc check_effective_target_pthread_h
{ } {
5202 return [check_no_compiler_messages pthread_h assembly
{
5203 #
include <pthread.h
>
5207 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5208 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5209 # chsize. We test
for a trivially functional truncation
; no stubs.
5210 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5211 # different function to be used.
5213 proc check_effective_target_fd_truncate { } {
5215 #define _FILE_OFFSET_BITS 64
5221 FILE *f = fopen ("tst.tmp", "wb");
5223 const char t[] = "test writing more than ten characters";
5227 write (fd, t, sizeof (t) - 1);
5229 if (ftruncate (fd, 10) != 0)
5238 f = fopen ("tst.tmp", "rb");
5239 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5247 if { [check_runtime ftruncate $prog] } {
5251 regsub "ftruncate" $prog "chsize" prog
5252 return [check_runtime chsize $prog]
5255 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5257 proc add_options_for_c99_runtime { flags } {
5258 if { [istarget *-*-solaris2*] } {
5259 return "$flags -std=c99"
5261 if { [istarget powerpc-*-darwin*] } {
5262 return "$flags -mmacosx-version-min=10.3"
5267 # Add to FLAGS all the target-specific flags needed to enable
5268 # full IEEE compliance mode.
5270 proc add_options_for_ieee { flags } {
5271 if { [istarget alpha*-*-*]
5272 || [istarget sh*-*-*] } {
5273 return "$flags -mieee"
5275 if { [istarget rx-*-*] } {
5276 return "$flags -mnofpu"
5281 if {![info exists flags_to_postpone]} {
5282 set flags_to_postpone ""
5285 # Add to FLAGS the flags needed to enable functions to bind locally
5286 # when using pic/PIC passes in the testsuite.
5287 proc add_options_for_bind_pic_locally { flags } {
5288 global flags_to_postpone
5290 # Instead of returning 'flags
' with the -fPIE or -fpie appended, we save it
5291 # in 'flags_to_postpone
' and append it later in gcc_target_compile procedure in
5292 # order to make sure that the multilib_flags doesn't override this.
5294 if {[check_no_compiler_messages using_pic2 assembly
{
5299 set flags_to_postpone
"-fPIE"
5302 if {[check_no_compiler_messages using_pic1 assembly
{
5307 set flags_to_postpone
"-fpie"
5313 # Add to FLAGS the flags needed to enable
64-bit vectors.
5315 proc add_options_for_double_vectors
{ flags
} {
5316 if [is
-effective
-target arm_neon_ok
] {
5317 return "$flags -mvectorize-with-neon-double"
5323 #
Return 1 if the target provides a full C99 runtime.
5325 proc check_effective_target_c99_runtime
{ } {
5326 return [check_cached_effective_target c99_runtime
{
5329 set file
[open
"$srcdir/gcc.dg/builtins-config.h"]
5330 set contents
[read $file
]
5333 #ifndef HAVE_C99_RUNTIME
5337 check_no_compiler_messages_nocache c99_runtime assembly \
5338 $contents
[add_options_for_c99_runtime
""]
5342 #
Return 1 if target wchar_t is at least
4 bytes.
5344 proc check_effective_target_4byte_wchar_t
{ } {
5345 return [check_no_compiler_messages
4byte_wchar_t object
{
5346 int dummy
[sizeof
(__WCHAR_TYPE__
) >= 4 ?
1 : -1];
5350 #
Return 1 if the target supports automatic stack alignment.
5352 proc check_effective_target_automatic_stack_alignment
{ } {
5353 # Ordinarily x86 supports automatic stack alignment ...
5354 if { [istarget i?
86*-*-*] ||
[istarget x86_64
-*-*] } then {
5355 if { [istarget
*-*-mingw
*] ||
[istarget
*-*-cygwin
*] } {
5356 # ... except Win64 SEH doesn
't. Succeed for Win32 though.
5357 return [check_effective_target_ilp32];
5364 # Return true if we are compiling for AVX target.
5366 proc check_avx_available { } {
5367 if { [check_no_compiler_messages avx_available assembly {
5377 # Return true if 32- and 16-bytes vectors are available.
5379 proc check_effective_target_vect_sizes_32B_16B { } {
5380 return [check_avx_available];
5383 # Return true if 128-bits vectors are preferred even if 256-bits vectors
5386 proc check_prefer_avx128 { } {
5387 if ![check_avx_available] {
5390 return [check_no_messages_and_pattern avx_explicit "xmm" assembly {
5391 float a[1024],b[1024],c[1024];
5392 void foo (void) { int i; for (i = 0; i < 1024; i++) a[i]=b[i]+c[i];}
5393 } "-O2 -ftree-vectorize"]
5397 # Return 1 if avx512f instructions can be compiled.
5399 proc check_effective_target_avx512f { } {
5400 return [check_no_compiler_messages avx512f object {
5401 typedef double __m512d __attribute__ ((__vector_size__ (64)));
5403 __m512d _mm512_add (__m512d a)
5405 return __builtin_ia32_addpd512_mask (a, a, a, 1, 4);
5410 # Return 1 if avx instructions can be compiled.
5412 proc check_effective_target_avx { } {
5413 return [check_no_compiler_messages avx object {
5414 void _mm256_zeroall (void)
5416 __builtin_ia32_vzeroall ();
5421 # Return 1 if avx2 instructions can be compiled.
5422 proc check_effective_target_avx2 { } {
5423 return [check_no_compiler_messages avx2 object {
5424 typedef long long __v4di __attribute__ ((__vector_size__ (32)));
5426 mm256_is32_andnotsi256 (__v4di __X, __v4di __Y)
5428 return __builtin_ia32_andnotsi256 (__X, __Y);
5433 # Return 1 if sse instructions can be compiled.
5434 proc check_effective_target_sse { } {
5435 return [check_no_compiler_messages sse object {
5438 __builtin_ia32_stmxcsr ();
5444 # Return 1 if sse2 instructions can be compiled.
5445 proc check_effective_target_sse2 { } {
5446 return [check_no_compiler_messages sse2 object {
5447 typedef long long __m128i __attribute__ ((__vector_size__ (16)));
5449 __m128i _mm_srli_si128 (__m128i __A, int __N)
5451 return (__m128i)__builtin_ia32_psrldqi128 (__A, 8);
5456 # Return 1 if F16C instructions can be compiled.
5458 proc check_effective_target_f16c { } {
5459 return [check_no_compiler_messages f16c object {
5460 #include "immintrin.h"
5462 foo (unsigned short val)
5464 return _cvtsh_ss (val);
5469 # Return 1 if C wchar_t type is compatible with char16_t.
5471 proc check_effective_target_wchar_t_char16_t_compatible { } {
5472 return [check_no_compiler_messages wchar_t_char16_t object {
5474 __CHAR16_TYPE__ *p16 = &wc;
5475 char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5479 # Return 1 if C wchar_t type is compatible with char32_t.
5481 proc check_effective_target_wchar_t_char32_t_compatible { } {
5482 return [check_no_compiler_messages wchar_t_char32_t object {
5484 __CHAR32_TYPE__ *p32 = &wc;
5485 char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5489 # Return 1 if pow10 function exists.
5491 proc check_effective_target_pow10 { } {
5492 return [check_runtime pow10 {
5502 # Return 1 if current options generate DFP instructions, 0 otherwise.
5504 proc check_effective_target_hard_dfp {} {
5505 return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
5506 typedef float d64 __attribute__((mode(DD)));
5508 void foo (void) { z = x + y; }
5512 # Return 1 if string.h and wchar.h headers provide C++ requires overloads
5513 # for strchr etc. functions.
5515 proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
5516 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
5519 #if !defined(__cplusplus) \
5520 || !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) \
5521 || !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
5522 ISO C++ correct string.h and wchar.h protos not supported.
5529 # Return 1 if GNU as is used.
5531 proc check_effective_target_gas { } {
5532 global use_gas_saved
5535 if {![info exists use_gas_saved]} {
5536 # Check if the as used by gcc is GNU as.
5537 set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
5538 # Provide /dev/null as input, otherwise gas times out reading from
5540 set status [remote_exec host "$gcc_as" "-v /dev/null"]
5541 set as_output [lindex $status 1]
5542 if { [ string first "GNU" $as_output ] >= 0 } {
5548 return $use_gas_saved
5551 # Return 1 if GNU ld is used.
5553 proc check_effective_target_gld { } {
5554 global use_gld_saved
5557 if {![info exists use_gld_saved]} {
5558 # Check if the ld used by gcc is GNU ld.
5559 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0]
5560 set status [remote_exec host "$gcc_ld" "--version"]
5561 set ld_output [lindex $status 1]
5562 if { [ string first "GNU" $ld_output ] >= 0 } {
5568 return $use_gld_saved
5571 # Return 1 if the compiler has been configure with link-time optimization
5574 proc check_effective_target_lto { } {
5576 return [info exists ENABLE_LTO]
5579 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
5581 proc check_effective_target_maybe_x32 { } {
5582 return [check_no_compiler_messages maybe_x32 object {
5584 } "-mx32 -maddress-mode=short"]
5587 # Return 1 if this target supports the -fsplit-stack option, 0
5590 proc check_effective_target_split_stack {} {
5591 return [check_no_compiler_messages split_stack object {
5596 # Return 1 if this target supports the -masm=intel option, 0
5599 proc check_effective_target_masm_intel {} {
5600 return [check_no_compiler_messages masm_intel object {
5601 extern void abort (void);
5605 # Return 1 if the language for the compiler under test is C.
5607 proc check_effective_target_c { } {
5609 if [string match $tool "gcc"] {
5615 # Return 1 if the language for the compiler under test is C++.
5617 proc check_effective_target_c++ { } {
5619 if [string match $tool "g++"] {
5625 # Check whether the current active language standard supports the features
5626 # of C++11/C++1y by checking for the presence of one of the -std
5627 # flags. This assumes that the default for the compiler is C++98, and that
5628 # there will never be multiple -std= arguments on the command line.
5629 proc check_effective_target_c++11_only { } {
5630 if ![check_effective_target_c++] {
5633 return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
5635 proc check_effective_target_c++11 { } {
5636 if [check_effective_target_c++11_only] {
5639 return [check_effective_target_c++1y]
5641 proc check_effective_target_c++11_down { } {
5642 if ![check_effective_target_c++] {
5645 return ![check_effective_target_c++1y]
5648 proc check_effective_target_c++1y_only { } {
5649 if ![check_effective_target_c++] {
5652 return [check-flags { { } { } { -std=c++1y -std=gnu++1y -std=c++14 -std=gnu++14 } }]
5654 proc check_effective_target_c++1y { } {
5655 return [check_effective_target_c++1y_only]
5658 proc check_effective_target_c++98_only { } {
5659 if ![check_effective_target_c++] {
5662 return ![check_effective_target_c++11]
5665 # Return 1 if expensive testcases should be run.
5667 proc check_effective_target_run_expensive_tests { } {
5668 if { [getenv GCC_TEST_RUN_EXPENSIVE] != "" } {
5674 # Returns 1 if "mempcpy" is available on the target system.
5676 proc check_effective_target_mempcpy {} {
5677 return [check_function_available "mempcpy"]
5680 # Check whether the vectorizer tests are supported by the target and
5681 # append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
5682 # Set dg-do-what-default to either compile or run, depending on target
5683 # capabilities. Return 1 if vectorizer tests are supported by
5684 # target, 0 otherwise.
5686 proc check_vect_support_and_set_flags { } {
5687 global DEFAULT_VECTCFLAGS
5688 global dg-do-what-default
5690 if [istarget powerpc-*paired*] {
5691 lappend DEFAULT_VECTCFLAGS "-mpaired"
5692 if [check_750cl_hw_available] {
5693 set dg-do-what-default run
5695 set dg-do-what-default compile
5697 } elseif [istarget powerpc*-*-*] {
5698 # Skip targets not supporting -maltivec.
5699 if ![is-effective-target powerpc_altivec_ok] {
5703 lappend DEFAULT_VECTCFLAGS "-maltivec"
5704 if [check_p8vector_hw_available] {
5705 lappend DEFAULT_VECTCFLAGS "-mpower8-vector"
5706 } elseif [check_vsx_hw_available] {
5707 lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
5710 if [check_vmx_hw_available] {
5711 set dg-do-what-default run
5713 if [is-effective-target ilp32] {
5714 # Specify a cpu that supports VMX for compile-only tests.
5715 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
5717 set dg-do-what-default compile
5719 } elseif { [istarget spu-*-*] } {
5720 set dg-do-what-default run
5721 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
5722 lappend DEFAULT_VECTCFLAGS "-msse2"
5723 if { [check_effective_target_sse2_runtime] } {
5724 set dg-do-what-default run
5726 set dg-do-what-default compile
5728 } elseif { [istarget mips*-*-*]
5729 && ([check_effective_target_mpaired_single]
5730 || [check_effective_target_mips_loongson])
5731 && [check_effective_target_nomips16] } {
5732 if { [check_effective_target_mpaired_single] } {
5733 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
5735 set dg-do-what-default run
5736 } elseif [istarget sparc*-*-*] {
5737 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
5738 if [check_effective_target_ultrasparc_hw] {
5739 set dg-do-what-default run
5741 set dg-do-what-default compile
5743 } elseif [istarget alpha*-*-*] {
5744 # Alpha's vectorization capabilities are extremely limited.
5745 # It
's more effort than its worth disabling all of the tests
5746 # that it cannot pass. But if you actually want to see what
5747 # does work, command out the return.
5750 lappend DEFAULT_VECTCFLAGS "-mmax"
5751 if [check_alpha_max_hw_available] {
5752 set dg-do-what-default run
5754 set dg-do-what-default compile
5756 } elseif [istarget ia64-*-*] {
5757 set dg-do-what-default run
5758 } elseif [is-effective-target arm_neon_ok] {
5759 eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
5760 # NEON does not support denormals, so is not used for vectorization by
5761 # default to avoid loss of precision. We must pass -ffast-math to test
5762 # vectorization of float operations.
5763 lappend DEFAULT_VECTCFLAGS "-ffast-math"
5764 if [is-effective-target arm_neon_hw] {
5765 set dg-do-what-default run
5767 set dg-do-what-default compile
5769 } elseif [istarget "aarch64*-*-*"] {
5770 set dg-do-what-default run
5778 proc check_effective_target_non_strict_align {} {
5779 return [check_no_compiler_messages non_strict_align assembly {
5781 typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
5783 void foo(void) { z = (c *) y; }
5787 # Return 1 if the target has <ucontext.h>.
5789 proc check_effective_target_ucontext_h { } {
5790 return [check_no_compiler_messages ucontext_h assembly {
5791 #include <ucontext.h>
5795 proc check_effective_target_aarch64_tiny { } {
5796 if { [istarget aarch64*-*-*] } {
5797 return [check_no_compiler_messages aarch64_tiny object {
5798 #ifdef __AARCH64_CMODEL_TINY__
5801 #error target not AArch64 tiny code model
5809 proc check_effective_target_aarch64_small { } {
5810 if { [istarget aarch64*-*-*] } {
5811 return [check_no_compiler_messages aarch64_small object {
5812 #ifdef __AARCH64_CMODEL_SMALL__
5815 #error target not AArch64 small code model
5823 proc check_effective_target_aarch64_large { } {
5824 if { [istarget aarch64*-*-*] } {
5825 return [check_no_compiler_messages aarch64_large object {
5826 #ifdef __AARCH64_CMODEL_LARGE__
5829 #error target not AArch64 large code model
5837 # Return 1 if <fenv.h> is available with all the standard IEEE
5838 # exceptions and floating-point exceptions are raised by arithmetic
5839 # operations. (If the target requires special options for "inexact"
5840 # exceptions, those need to be specified in the testcases.)
5842 proc check_effective_target_fenv_exceptions {} {
5843 return [check_runtime fenv_exceptions {
5846 #ifndef FE_DIVBYZERO
5847 # error Missing FE_DIVBYZERO
5850 # error Missing FE_INEXACT
5853 # error Missing FE_INVALID
5856 # error Missing FE_OVERFLOW
5858 #ifndef FE_UNDERFLOW
5859 # error Missing FE_UNDERFLOW
5861 volatile float a = 0.0f, r;
5866 if (fetestexcept (FE_INVALID))
5874 # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
5876 proc check_effective_target_logical_op_short_circuit {} {
5877 if { [istarget mips*-*-*]
5878 || [istarget arc*-*-*]
5879 || [istarget avr*-*-*]
5880 || [istarget crisv32-*-*] || [istarget cris-*-*]
5881 || [istarget s390*-*-*]
5882 || [check_effective_target_arm_cortex_m] } {
5888 # Record that dg-final test TEST requires convential compilation.
5890 proc force_conventional_output_for { test } {
5891 if { [info proc $test] == "" } {
5892 perror "$test does not exist"
5895 proc ${test}_required_options {} {
5896 global gcc_force_conventional_output
5897 return $gcc_force_conventional_output