1 # Copyright
(C
) 1999-2014 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC
; see the file COPYING3.
If not see
15 #
<http
://www.gnu.org
/licenses
/>.
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # gcc
-patches@gcc.gnu.org
20 # This file defines procs
for determining features supported by the target.
22 # Try to
compile the code given by CONTENTS into an output file of
23 # type TYPE
, where TYPE is as
for target_compile.
Return a list
24 # whose first element contains the compiler messages and whose
25 # second element is the
name of the output file.
27 # BASENAME is a prefix to use
for source and output files.
28 #
If ARGS is not empty
, its first element is a string that
29 # should be added to the command line.
31 # Assume by default that CONTENTS is C code.
32 # Otherwise
, code should contain
:
34 #
"! Fortran" for Fortran code,
36 #
"// ObjC++" for ObjC++
38 #
If the tool is ObjC
/ObjC
++ then we overide the extension to .m
/.mm to
39 # allow
for ObjC
/ObjC
++ specific flags.
40 proc check_compile
{basename type contents
args} {
42 verbose
"check_compile tool: $tool for $basename"
44 if { [llength $
args] > 0 } {
45 set options
[list
"additional_flags=[lindex $args 0]"]
49 switch -glob
-- $contents
{
50 "*! Fortran*" { set src ${basename}[pid].f90 }
51 "*// C++*" { set src ${basename}[pid].cc }
52 "*// ObjC++*" { set src ${basename}[pid].mm }
53 "*/* ObjC*" { set src ${basename}[pid].m }
54 "*// Go*" { set src ${basename}[pid].go }
57 "objc" { set src ${basename}[pid].m }
58 "obj-c++" { set src ${basename}[pid].mm }
59 default
{ set src $
{basename
}[pid
].c
}
64 set compile_type $type
66 assembly
{ set output $
{basename
}[pid
].s
}
67 object
{ set output $
{basename
}[pid
].o
}
68 executable
{ set output $
{basename
}[pid
].exe
}
70 set output $
{basename
}[pid
].s
71 lappend options
"additional_flags=-fdump-$type"
72 set compile_type assembly
78 set lines
[$
{tool
}_target_compile $src $output $compile_type
"$options"]
81 set scan_output $output
82 # Don
't try folding this into the switch above; calling "glob" before the
83 # file is created won't work.
84 if [regexp
"rtl-(.*)" $type dummy rtl_type] {
85 set scan_output
"[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
89 return [list $lines $scan_output
]
92 proc current_target_name
{ } {
94 if [info exists target_info
(target
,name)] {
95 set answer $target_info
(target
,name)
102 # Implement an effective
-target check
for property PROP by invoking
103 # the Tcl command
ARGS and seeing
if it returns true.
105 proc check_cached_effective_target
{ prop
args } {
108 set target
[current_target_name
]
109 if {![info exists et_cache
($prop
,target
)]
110 || $et_cache
($prop
,target
) != $target
} {
111 verbose
"check_cached_effective_target $prop: checking $target" 2
112 set et_cache
($prop
,target
) $target
113 set et_cache
($prop
,value
) [uplevel eval $
args]
115 set value $et_cache
($prop
,value
)
116 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
120 # Like check_compile
, but
delete the output file and
return true
if the
121 # compiler printed no messages.
122 proc check_no_compiler_messages_nocache
{args} {
123 set result
[eval check_compile $
args]
124 set lines
[lindex $result
0]
125 set output
[lindex $result
1]
126 remote_file build
delete $output
127 return [string match
"" $lines]
130 # Like check_no_compiler_messages_nocache
, but
cache the result.
131 # PROP is the
property we
're checking, and doubles as a prefix for
132 # temporary filenames.
133 proc check_no_compiler_messages {prop args} {
134 return [check_cached_effective_target $prop {
135 eval [list check_no_compiler_messages_nocache $prop] $args
139 # Like check_compile, but return true if the compiler printed no
140 # messages and if the contents of the output file satisfy PATTERN.
141 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
142 # don't match regular expression REGEXP
, otherwise they satisfy it
143 #
if they
do match regular expression PATTERN.
(PATTERN can start
144 # with something like
"[!]" if the regular expression needs to match
145 #
"!" as the first character.)
147 #
Delete the output file before returning. The other arguments are
148 # as
for check_compile.
149 proc check_no_messages_and_pattern_nocache
{basename pattern
args} {
152 set result
[eval
[list check_compile $basename
] $
args]
153 set lines
[lindex $result
0]
154 set output
[lindex $result
1]
157 if { [string match
"" $lines] } {
158 set chan
[open
"$output"]
159 set invert
[regexp
{^
!(.
*)} $pattern dummy pattern
]
160 set ok
[expr
{ [regexp $pattern
[read $chan
]] != $invert
}]
164 remote_file build
delete $output
168 # Like check_no_messages_and_pattern_nocache
, but
cache the result.
169 # PROP is the
property we
're checking, and doubles as a prefix for
170 # temporary filenames.
171 proc check_no_messages_and_pattern {prop pattern args} {
172 return [check_cached_effective_target $prop {
173 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
177 # Try to compile and run an executable from code CONTENTS. Return true
178 # if the compiler reports no messages and if execution "passes" in the
179 # usual DejaGNU sense. The arguments are as for check_compile, with
180 # TYPE implicitly being "executable".
181 proc check_runtime_nocache {basename contents args} {
184 set result [eval [list check_compile $basename executable $contents] $args]
185 set lines [lindex $result 0]
186 set output [lindex $result 1]
189 if { [string match "" $lines] } {
190 # No error messages, everything is OK.
191 set result [remote_load target "./$output" "" ""]
192 set status [lindex $result 0]
193 verbose "check_runtime_nocache $basename: status is <$status>" 2
194 if { $status == "pass" } {
198 remote_file build delete $output
202 # Like check_runtime_nocache, but cache the result. PROP is the
203 # property we're checking
, and doubles as a prefix
for temporary
205 proc check_runtime
{prop
args} {
208 return [check_cached_effective_target $prop
{
209 eval
[list check_runtime_nocache $prop
] $
args
213 ###############################
214 # proc check_weak_available
{ }
215 ###############################
217 # weak symbols are only supported in some configs
/object formats
218 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
220 proc check_weak_available
{ } {
223 # All mips targets should support it
225 if { [ string first
"mips" $target_cpu ] >= 0 } {
229 # All AIX targets should support it
231 if { [istarget
*-*-aix
*] } {
235 # All solaris2 targets should support it
237 if { [istarget
*-*-solaris2
*] } {
241 # Windows targets Cygwin and MingW32 support it
243 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
247 # HP
-UX
10.X doesn
't support it
249 if { [istarget hppa*-*-hpux10*] } {
253 # ELF and ECOFF support it. a.out does with gas/gld but may also with
254 # other linkers, so we should try it
256 set objformat [gcc_target_object_format]
264 unknown { return -1 }
269 ###############################
270 # proc check_weak_override_available { }
271 ###############################
273 # Like check_weak_available, but return 0 if weak symbol definitions
274 # cannot be overridden.
276 proc check_weak_override_available { } {
277 if { [istarget *-*-mingw*] } {
280 return [check_weak_available]
283 ###############################
284 # proc check_visibility_available { what_kind }
285 ###############################
287 # The visibility attribute is only support in some object formats
288 # This proc returns 1 if it is supported, 0 if not.
289 # The argument is the kind of visibility, default/protected/hidden/internal.
291 proc check_visibility_available { what_kind } {
292 if [string match "" $what_kind] { set what_kind "hidden" }
294 return [check_no_compiler_messages visibility_available_$what_kind object "
295 void f() __attribute__((visibility(\"$what_kind\")));
300 ###############################
301 # proc check_alias_available { }
302 ###############################
304 # Determine if the target toolchain supports the alias attribute.
306 # Returns 2 if the target supports aliases. Returns 1 if the target
307 # only supports weak aliased. Returns 0 if the target does not
308 # support aliases at all. Returns -1 if support for aliases could not
311 proc check_alias_available { } {
312 global alias_available_saved
315 if [info exists alias_available_saved] {
316 verbose "check_alias_available returning saved $alias_available_saved" 2
320 verbose "check_alias_available compiling testfile $src" 2
321 set f [open $src "w"]
322 # Compile a small test program. The definition of "g" is
323 # necessary to keep the Solaris assembler from complaining
325 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
326 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
328 set lines [${tool}_target_compile $src $obj object ""]
330 remote_file build delete $obj
332 if [string match "" $lines] then {
333 # No error messages, everything is OK.
334 set alias_available_saved 2
336 if [regexp "alias definitions not supported" $lines] {
337 verbose "check_alias_available target does not support aliases" 2
339 set objformat [gcc_target_object_format]
341 if { $objformat == "elf" } {
342 verbose "check_alias_available but target uses ELF format, so it ought to" 2
343 set alias_available_saved -1
345 set alias_available_saved 0
348 if [regexp "only weak aliases are supported" $lines] {
349 verbose "check_alias_available target supports only weak aliases" 2
350 set alias_available_saved 1
352 set alias_available_saved -1
357 verbose "check_alias_available returning $alias_available_saved" 2
360 return $alias_available_saved
363 # Returns 1 if the target toolchain supports strong aliases, 0 otherwise.
365 proc check_effective_target_alias { } {
366 if { [check_alias_available] < 2 } {
373 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
375 proc check_ifunc_available { } {
376 return [check_no_compiler_messages ifunc_available object {
381 void f() __attribute__((ifunc("g")));
385 # Returns true if --gc-sections is supported on the target.
387 proc check_gc_sections_available { } {
388 global gc_sections_available_saved
391 if {![info exists gc_sections_available_saved]} {
392 # Some targets don't support gc
-sections despite whatever
's
393 # advertised by ld's options.
394 if { [istarget alpha
*-*-*]
395 ||
[istarget ia64
-*-*] } {
396 set gc_sections_available_saved
0
400 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
402 if { [board_info target
exists ldflags
]
403 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
404 set gc_sections_available_saved
0
408 # VxWorks kernel modules are relocatable objects linked with
-r
,
409 #
while RTP executables are linked with
-q
(--emit
-relocs
).
410 # Both of these options are incompatible with
--gc
-sections.
411 if { [istarget
*-*-vxworks
*] } {
412 set gc_sections_available_saved
0
416 # Check
if the
ld used by gcc supports
--gc
-sections.
417 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
418 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
419 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
420 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
421 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
422 set gc_sections_available_saved
1
424 set gc_sections_available_saved
0
427 return $gc_sections_available_saved
430 #
Return 1 if according to target_info struct and explicit target list
431 # target is supposed to support trampolines.
433 proc check_effective_target_trampolines
{ } {
434 if [target_info
exists no_trampolines
] {
437 if { [istarget avr
-*-*]
438 ||
[istarget msp430
-*-*]
439 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
440 ||
[istarget hppa64
-hp
-hpux11.23
] } {
446 #
Return 1 if according to target_info struct and explicit target list
447 # target is supposed to keep null pointer checks. This could be due to
448 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
450 proc check_effective_target_keeps_null_pointer_checks
{ } {
451 if [target_info
exists keeps_null_pointer_checks
] {
454 if { [istarget avr
-*-*] } {
460 #
Return true
if profiling is supported
on the target.
462 proc check_profiling_available
{ test_what
} {
463 global profiling_available_saved
465 verbose
"Profiling argument is <$test_what>" 1
467 # These conditions depend
on the
argument so examine them before
468 # looking at the
cache variable.
470 # Tree profiling requires TLS runtime support.
471 if { $test_what
== "-fprofile-generate" } {
472 if { ![check_effective_target_tls_runtime
] } {
477 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
478 # vendor compiler. We cannot reliably predict the directory where the
479 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
480 # necessarily find mcrt1.o even if we have it.
481 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
485 # We don't yet support profiling
for MIPS16.
486 if { [istarget mips
*-*-*]
487 && ![check_effective_target_nomips16
]
488 && ($test_what
== "-p" || $test_what == "-pg") } {
492 # MinGW does not support
-p.
493 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
497 # cygwin does not support
-p.
498 if { [istarget
*-*-cygwin
*] && $test_what
== "-p" } {
502 # uClibc does not have gcrt1.o.
503 if { [check_effective_target_uclibc
]
504 && ($test_what
== "-p" || $test_what == "-pg") } {
508 # Now examine the
cache variable.
509 if {![info exists profiling_available_saved
]} {
510 # Some targets don
't have any implementation of __bb_init_func or are
511 # missing other needed machinery.
512 if { [istarget aarch64*-*-elf]
513 || [istarget am3*-*-linux*]
514 || [istarget arm*-*-eabi*]
515 || [istarget arm*-*-elf]
516 || [istarget arm*-*-symbianelf*]
517 || [istarget avr-*-*]
518 || [istarget bfin-*-*]
519 || [istarget cris-*-*]
520 || [istarget crisv32-*-*]
521 || [istarget fido-*-elf]
522 || [istarget h8300-*-*]
523 || [istarget lm32-*-*]
524 || [istarget m32c-*-elf]
525 || [istarget m68k-*-elf]
526 || [istarget m68k-*-uclinux*]
527 || [istarget mep-*-elf]
528 || [istarget mips*-*-elf*]
529 || [istarget mmix-*-*]
530 || [istarget mn10300-*-elf*]
531 || [istarget moxie-*-elf*]
532 || [istarget msp430-*-*]
533 || [istarget nds32*-*-elf]
534 || [istarget nios2-*-elf]
535 || [istarget picochip-*-*]
536 || [istarget powerpc-*-eabi*]
537 || [istarget powerpc-*-elf]
539 || [istarget tic6x-*-elf]
540 || [istarget xstormy16-*]
541 || [istarget xtensa*-*-elf]
542 || [istarget *-*-rtems*]
543 || [istarget *-*-vxworks*] } {
544 set profiling_available_saved 0
546 set profiling_available_saved 1
550 return $profiling_available_saved
553 # Check to see if a target is "freestanding". This is as per the definition
554 # in Section 4 of C99 standard. Effectively, it is a target which supports no
555 # extra headers or libraries other than what is considered essential.
556 proc check_effective_target_freestanding { } {
557 if { [istarget picochip-*-*] } then {
564 # Return 1 if target has packed layout of structure members by
565 # default, 0 otherwise. Note that this is slightly different than
566 # whether the target has "natural alignment": both attributes may be
569 proc check_effective_target_default_packed { } {
570 return [check_no_compiler_messages default_packed assembly {
571 struct x { char a; long b; } c;
572 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
576 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
577 # documentation, where the test also comes from.
579 proc check_effective_target_pcc_bitfield_type_matters { } {
580 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
581 # bitfields
, but let
's stick to the example code from the docs.
582 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
583 struct foo1 { char x; char :0; char y; };
584 struct foo2 { char x; int :0; char y; };
585 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
589 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
591 proc add_options_for_tls { flags } {
592 # On Solaris 9, __tls_get_addr/___tls_get_addr only lives in
593 # libthread, so always pass -pthread for native TLS. Same for AIX.
594 # Need to duplicate native TLS check from
595 # check_effective_target_tls_native to avoid recursion.
596 if { ([istarget powerpc-ibm-aix*]) &&
597 [check_no_messages_and_pattern tls_native "!emutls" assembly {
599 int f (void) { return i; }
600 void g (int j) { i = j; }
602 return "$flags -pthread"
607 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
609 proc check_effective_target_tls {} {
610 return [check_no_compiler_messages tls assembly {
612 int f (void) { return i; }
613 void g (int j) { i = j; }
617 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
619 proc check_effective_target_tls_native {} {
620 # VxWorks uses emulated TLS machinery, but with non-standard helper
621 # functions, so we fail to automatically detect it.
622 if { [istarget *-*-vxworks*] } {
626 return [check_no_messages_and_pattern tls_native "!emutls" assembly {
628 int f (void) { return i; }
629 void g (int j) { i = j; }
633 # Return 1 if *emulated* thread local storage (TLS) is supported, 0 otherwise.
635 proc check_effective_target_tls_emulated {} {
636 # VxWorks uses emulated TLS machinery, but with non-standard helper
637 # functions, so we fail to automatically detect it.
638 if { [istarget *-*-vxworks*] } {
642 return [check_no_messages_and_pattern tls_emulated "emutls" assembly {
644 int f (void) { return i; }
645 void g (int j) { i = j; }
649 # Return 1 if TLS executables can run correctly, 0 otherwise.
651 proc check_effective_target_tls_runtime {} {
652 # MSP430 runtime does not have TLS support, but just
653 # running the test below is insufficient to show this.
654 if { [istarget msp430-*-*] } {
657 return [check_runtime tls_runtime {
658 __thread int thr = 0;
659 int main (void) { return thr; }
660 } [add_options_for_tls ""]]
663 # Return 1 if atomic compare-and-swap is supported on 'int'
665 proc check_effective_target_cas_char {} {
666 return [check_no_compiler_messages cas_char assembly {
667 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
673 proc check_effective_target_cas_int {} {
674 return [check_no_compiler_messages cas_int assembly {
675 #if __INT_MAX__ == 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
677 #elif __INT_MAX__ == 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
685 # Return 1 if -ffunction-sections is supported, 0 otherwise.
687 proc check_effective_target_function_sections {} {
688 # Darwin has its own scheme and silently accepts -ffunction-sections.
689 if { [istarget *-*-darwin*] } {
693 return [check_no_compiler_messages functionsections assembly {
695 } "-ffunction-sections"]
698 # Return 1 if instruction scheduling is available, 0 otherwise.
700 proc check_effective_target_scheduling {} {
701 return [check_no_compiler_messages scheduling object {
703 } "-fschedule-insns"]
706 # Return 1 if trapping arithmetic is available, 0 otherwise.
708 proc check_effective_target_trapping {} {
709 return [check_no_compiler_messages scheduling object {
710 add (int a, int b) { return a + b; }
714 # Return 1 if compilation with -fgraphite is error-free for trivial
717 proc check_effective_target_fgraphite {} {
718 return [check_no_compiler_messages fgraphite object {
723 # Return 1 if compilation with -fopenmp is error-free for trivial
726 proc check_effective_target_fopenmp {} {
727 return [check_no_compiler_messages fopenmp object {
732 # Return 1 if compilation with -fgnu-tm is error-free for trivial
735 proc check_effective_target_fgnu_tm {} {
736 return [check_no_compiler_messages fgnu_tm object {
741 # Return 1 if the target supports mmap, 0 otherwise.
743 proc check_effective_target_mmap {} {
744 return [check_function_available "mmap"]
747 # Return 1 if the target supports dlopen, 0 otherwise.
748 proc check_effective_target_dlopen {} {
749 return [check_no_compiler_messages dlopen executable {
751 int main(void) { dlopen ("dummy.so", RTLD_NOW); }
752 } [add_options_for_dlopen ""]]
755 proc add_options_for_dlopen { flags } {
759 # Return 1 if the target supports clone, 0 otherwise.
760 proc check_effective_target_clone {} {
761 return [check_function_available "clone"]
764 # Return 1 if the target supports setrlimit, 0 otherwise.
765 proc check_effective_target_setrlimit {} {
766 # Darwin has non-posix compliant RLIMIT_AS
767 if { [istarget *-*-darwin*] } {
770 return [check_function_available "setrlimit"]
773 # Return 1 if the target supports swapcontext, 0 otherwise.
774 proc check_effective_target_swapcontext {} {
775 return [check_no_compiler_messages swapcontext executable {
776 #include <ucontext.h>
779 ucontext_t orig_context,child_context;
780 if (swapcontext(&child_context, &orig_context) < 0) { }
785 # Return 1 if compilation with -pthread is error-free for trivial
788 proc check_effective_target_pthread {} {
789 return [check_no_compiler_messages pthread object {
794 # Return 1 if compilation with -mpe-aligned-commons is error-free
795 # for trivial code, 0 otherwise.
797 proc check_effective_target_pe_aligned_commons {} {
798 if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
799 return [check_no_compiler_messages pe_aligned_commons object {
801 } "-mpe-aligned-commons"]
806 # Return 1 if the target supports -static
807 proc check_effective_target_static {} {
808 return [check_no_compiler_messages static executable {
809 int main (void) { return 0; }
813 # Return 1 if the target supports -fstack-protector
814 proc check_effective_target_fstack_protector {} {
815 return [check_runtime fstack_protector {
816 int main (void) { return 0; }
817 } "-fstack-protector"]
820 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
821 # for trivial code, 0 otherwise.
823 proc check_effective_target_freorder {} {
824 return [check_no_compiler_messages freorder object {
826 } "-freorder-blocks-and-partition"]
829 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
830 # emitted, 0 otherwise. Whether a shared library can actually be built is
831 # out of scope for this test.
833 proc check_effective_target_fpic { } {
834 # Note that M68K has a multilib that supports -fpic but not
835 # -fPIC, so we need to check both. We test with a program that
836 # requires GOT references.
837 foreach arg {fpic fPIC} {
838 if [check_no_compiler_messages $arg object {
839 extern int foo (void); extern int bar;
840 int baz (void) { return foo () + bar; }
848 # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
850 proc check_effective_target_pie { } {
851 if { [istarget *-*-darwin\[912\]*]
852 || [istarget *-*-linux*]
853 || [istarget *-*-gnu*] } {
859 # Return true if the target supports -mpaired-single (as used on MIPS).
861 proc check_effective_target_mpaired_single { } {
862 return [check_no_compiler_messages mpaired_single object {
867 # Return true if the target has access to FPU instructions.
869 proc check_effective_target_hard_float { } {
870 if { [istarget mips*-*-*] } {
871 return [check_no_compiler_messages hard_float assembly {
872 #if (defined __mips_soft_float || defined __mips16)
878 # This proc is actually checking the availabilty of FPU
879 # support for doubles, so on the RX we must fail if the
880 # 64-bit double multilib has been selected.
881 if { [istarget rx-*-*] } {
883 # return [check_no_compiler_messages hard_float assembly {
884 #if defined __RX_64_BIT_DOUBLES__
890 # The generic test equates hard_float with "no call for adding doubles".
891 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
892 double a (double b, double c) { return b + c; }
896 # Return true if the target is a 64-bit MIPS target.
898 proc check_effective_target_mips64 { } {
899 return [check_no_compiler_messages mips64 assembly {
906 # Return true if the target is a MIPS target that does not produce
909 proc check_effective_target_nomips16 { } {
910 return [check_no_compiler_messages nomips16 object {
914 /* A cheap way of testing for -mflip-mips16. */
915 void foo (void) { asm ("addiu $20,$20,1"); }
916 void bar (void) { asm ("addiu $20,$20,1"); }
921 # Add the options needed for MIPS16 function attributes. At the moment,
922 # we don't support MIPS16 PIC.
924 proc add_options_for_mips16_attribute
{ flags
} {
925 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
928 #
Return true
if we can force a
mode that allows MIPS16 code generation.
929 # We don
't support MIPS16 PIC, and only support MIPS16 -mhard-float
932 proc check_effective_target_mips16_attribute { } {
933 return [check_no_compiler_messages mips16_attribute assembly {
937 #if defined __mips_hard_float \
938 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
939 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
942 } [add_options_for_mips16_attribute ""]]
945 # Return 1 if the target supports long double larger than double when
946 # using the new ABI, 0 otherwise.
948 proc check_effective_target_mips_newabi_large_long_double { } {
949 return [check_no_compiler_messages mips_newabi_large_long_double object {
950 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
954 # Return true if the target is a MIPS target that has access
955 # to the LL and SC instructions.
957 proc check_effective_target_mips_llsc { } {
958 if { ![istarget mips*-*-*] } {
961 # Assume that these instructions are always implemented for
962 # non-elf* targets, via emulation if necessary.
963 if { ![istarget *-*-elf*] } {
966 # Otherwise assume LL/SC support for everything but MIPS I.
967 return [check_no_compiler_messages mips_llsc assembly {
974 # Return true if the target is a MIPS target that uses in-place relocations.
976 proc check_effective_target_mips_rel { } {
977 if { ![istarget mips*-*-*] } {
980 return [check_no_compiler_messages mips_rel object {
981 #if (defined _ABIN32 && _MIPS_SIM == _ABIN32) \
982 || (defined _ABI64 && _MIPS_SIM == _ABI64)
988 # Return true if the target is a MIPS target that uses the EABI.
990 proc check_effective_target_mips_eabi { } {
991 if { ![istarget mips*-*-*] } {
994 return [check_no_compiler_messages mips_eabi object {
1001 # Return 1 if the current multilib does not generate PIC by default.
1003 proc check_effective_target_nonpic { } {
1004 return [check_no_compiler_messages nonpic assembly {
1011 # Return 1 if the target does not use a status wrapper.
1013 proc check_effective_target_unwrapped { } {
1014 if { [target_info needs_status_wrapper] != "" \
1015 && [target_info needs_status_wrapper] != "0" } {
1021 # Return true if iconv is supported on the target. In particular IBM1047.
1023 proc check_iconv_available { test_what } {
1026 # If the tool configuration file has not set libiconv, try "-liconv"
1027 if { ![info exists libiconv] } {
1028 set libiconv "-liconv"
1030 set test_what [lindex $test_what 1]
1031 return [check_runtime_nocache $test_what [subst {
1037 cd = iconv_open ("$test_what", "UTF-8");
1038 if (cd == (iconv_t) -1)
1045 # Return true if Cilk Library is supported on the target.
1046 proc check_libcilkrts_available { } {
1047 return [ check_no_compiler_messages_nocache libcilkrts_available executable {
1051 int __cilkrts_set_param (const char *, const char *);
1053 int x = __cilkrts_set_param ("nworkers", "0");
1056 } "-fcilkplus -lcilkrts" ]
1059 # Return 1 if an ASCII locale is supported on this host, 0 otherwise.
1061 proc check_ascii_locale_available { } {
1065 # Return true if named sections are supported on this target.
1067 proc check_named_sections_available { } {
1068 return [check_no_compiler_messages named_sections assembly {
1069 int __attribute__ ((section("whatever"))) foo;
1073 # Return true if the "naked" function attribute is supported on this target.
1075 proc check_effective_target_naked_functions { } {
1076 return [check_no_compiler_messages naked_functions assembly {
1077 void f() __attribute__((naked));
1081 # Return 1 if the target supports Fortran real kinds larger than real(8),
1084 # When the target name changes, replace the cached result.
1086 proc check_effective_target_fortran_large_real { } {
1087 return [check_no_compiler_messages fortran_large_real executable {
1089 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
1096 # Return 1 if the target supports Fortran real kind real(16),
1097 # 0 otherwise. Contrary to check_effective_target_fortran_large_real
1098 # this checks for Real(16) only; the other returned real(10) if
1099 # both real(10) and real(16) are available.
1101 # When the target name changes, replace the cached result.
1103 proc check_effective_target_fortran_real_16 { } {
1104 return [check_no_compiler_messages fortran_real_16 executable {
1113 # Return 1 if the target supports SQRT for the largest floating-point
1114 # type. (Some targets lack the libm support for this FP type.)
1115 # On most targets, this check effectively checks either whether sqrtl is
1116 # available or on __float128 systems whether libquadmath is installed,
1117 # which provides sqrtq.
1119 # When the target name changes, replace the cached result.
1121 proc check_effective_target_fortran_largest_fp_has_sqrt { } {
1122 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
1124 use iso_fortran_env, only: real_kinds
1125 integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
1126 real(kind=maxFP), volatile :: x
1134 # Return 1 if the target supports Fortran integer kinds larger than
1135 # integer(8), 0 otherwise.
1137 # When the target name changes, replace the cached result.
1139 proc check_effective_target_fortran_large_int { } {
1140 return [check_no_compiler_messages fortran_large_int executable {
1142 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
1143 integer(kind=k) :: i
1148 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
1150 # When the target name changes, replace the cached result.
1152 proc check_effective_target_fortran_integer_16 { } {
1153 return [check_no_compiler_messages fortran_integer_16 executable {
1160 # Return 1 if we can statically link libgfortran, 0 otherwise.
1162 # When the target name changes, replace the cached result.
1164 proc check_effective_target_static_libgfortran { } {
1165 return [check_no_compiler_messages static_libgfortran executable {
1172 # Return 1 if cilk-plus is supported by the target, 0 otherwise.
1174 proc check_effective_target_cilkplus { } {
1175 # Skip cilk-plus tests on int16 and size16 targets for now.
1176 # The cilk-plus tests are not generic enough to cover these
1177 # cases and would throw hundreds of FAILs.
1178 if { [check_effective_target_int16]
1179 || ![check_effective_target_size32plus] } {
1183 # Skip AVR, its RAM is too small and too many tests would fail.
1184 if { [istarget avr-*-*] } {
1190 proc check_linker_plugin_available { } {
1191 return [check_no_compiler_messages_nocache linker_plugin executable {
1192 int main() { return 0; }
1193 } "-flto -fuse-linker-plugin"]
1196 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1197 # otherwise. Cache the result.
1199 proc check_750cl_hw_available { } {
1200 return [check_cached_effective_target 750cl_hw_available {
1201 # If this is not the right target then we can skip the test.
1202 if { ![istarget powerpc-*paired*] } {
1205 check_runtime_nocache 750cl_hw_available {
1209 asm volatile ("ps_mul v0,v0,v0");
1211 asm volatile ("ps_mul 0,0,0");
1220 # Return 1 if the target OS supports running SSE executables, 0
1221 # otherwise. Cache the result.
1223 proc check_sse_os_support_available { } {
1224 return [check_cached_effective_target sse_os_support_available {
1225 # If this is not the right target then we can skip the test.
1226 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1228 } elseif { [istarget i?86-*-solaris2*] } {
1229 # The Solaris 2 kernel doesn't save and restore SSE registers
1230 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1231 check_runtime_nocache sse_os_support_available
{
1234 asm volatile
("movaps %xmm0,%xmm0");
1244 #
Return 1 if the target OS supports running AVX executables
, 0
1245 # otherwise.
Cache the result.
1247 proc check_avx_os_support_available
{ } {
1248 return [check_cached_effective_target avx_os_support_available
{
1249 #
If this is not the right target
then we can skip the test.
1250 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1253 # Check that OS has AVX and SSE saving enabled.
1254 check_runtime_nocache avx_os_support_available
{
1257 unsigned
int eax
, edx
;
1259 asm
("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1260 return (eax
& 6) != 6;
1267 #
Return 1 if the target supports executing SSE instructions
, 0
1268 # otherwise.
Cache the result.
1270 proc check_sse_hw_available
{ } {
1271 return [check_cached_effective_target sse_hw_available
{
1272 #
If this is not the right target
then we can skip the test.
1273 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1276 check_runtime_nocache sse_hw_available
{
1280 unsigned
int eax
, ebx
, ecx
, edx
;
1281 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1282 return !(edx
& bit_SSE
);
1290 #
Return 1 if the target supports executing SSE2 instructions
, 0
1291 # otherwise.
Cache the result.
1293 proc check_sse2_hw_available
{ } {
1294 return [check_cached_effective_target sse2_hw_available
{
1295 #
If this is not the right target
then we can skip the test.
1296 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1299 check_runtime_nocache sse2_hw_available
{
1303 unsigned
int eax
, ebx
, ecx
, edx
;
1304 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1305 return !(edx
& bit_SSE2
);
1313 #
Return 1 if the target supports executing AVX instructions
, 0
1314 # otherwise.
Cache the result.
1316 proc check_avx_hw_available
{ } {
1317 return [check_cached_effective_target avx_hw_available
{
1318 #
If this is not the right target
then we can skip the test.
1319 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1322 check_runtime_nocache avx_hw_available
{
1326 unsigned
int eax
, ebx
, ecx
, edx
;
1327 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1328 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1329 != (bit_AVX | bit_OSXSAVE
));
1337 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1339 proc check_effective_target_sse_runtime
{ } {
1340 if { [check_effective_target_sse
]
1341 && [check_sse_hw_available
]
1342 && [check_sse_os_support_available
] } {
1348 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1350 proc check_effective_target_sse2_runtime
{ } {
1351 if { [check_effective_target_sse2
]
1352 && [check_sse2_hw_available
]
1353 && [check_sse_os_support_available
] } {
1359 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1361 proc check_effective_target_avx_runtime
{ } {
1362 if { [check_effective_target_avx
]
1363 && [check_avx_hw_available
]
1364 && [check_avx_os_support_available
] } {
1370 #
Return 1 if the target supports executing power8 vector instructions
, 0
1371 # otherwise.
Cache the result.
1373 proc check_p8vector_hw_available
{ } {
1374 return [check_cached_effective_target p8vector_hw_available
{
1375 # Some simulators are known to not support VSX
/power8 instructions.
1376 #
For now
, disable
on Darwin
1377 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1380 set options
"-mpower8-vector"
1381 check_runtime_nocache p8vector_hw_available
{
1385 asm volatile
("xxlorc vs0,vs0,vs0");
1387 asm volatile
("xxlorc 0,0,0");
1396 #
Return 1 if the target supports executing VSX instructions
, 0
1397 # otherwise.
Cache the result.
1399 proc check_vsx_hw_available
{ } {
1400 return [check_cached_effective_target vsx_hw_available
{
1401 # Some simulators are known to not support VSX instructions.
1402 #
For now
, disable
on Darwin
1403 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1407 check_runtime_nocache vsx_hw_available
{
1411 asm volatile
("xxlor vs0,vs0,vs0");
1413 asm volatile
("xxlor 0,0,0");
1422 #
Return 1 if the target supports executing AltiVec instructions
, 0
1423 # otherwise.
Cache the result.
1425 proc check_vmx_hw_available
{ } {
1426 return [check_cached_effective_target vmx_hw_available
{
1427 # Some simulators are known to not support VMX instructions.
1428 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1431 # Most targets don
't require special flags for this test case, but
1432 # Darwin does. Just to be sure, make sure VSX is not enabled for
1433 # the altivec tests.
1434 if { [istarget *-*-darwin*]
1435 || [istarget *-*-aix*] } {
1436 set options "-maltivec -mno-vsx"
1438 set options "-mno-vsx"
1440 check_runtime_nocache vmx_hw_available {
1444 asm volatile ("vor v0,v0,v0");
1446 asm volatile ("vor 0,0,0");
1455 proc check_ppc_recip_hw_available { } {
1456 return [check_cached_effective_target ppc_recip_hw_available {
1457 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1458 # For now, disable on Darwin
1459 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1462 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1463 check_runtime_nocache ppc_recip_hw_available {
1464 volatile double d_recip, d_rsqrt, d_four = 4.0;
1465 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1468 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1469 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1470 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1471 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1479 # Return 1 if the target supports executing AltiVec and Cell PPU
1480 # instructions, 0 otherwise. Cache the result.
1482 proc check_effective_target_cell_hw { } {
1483 return [check_cached_effective_target cell_hw_available {
1484 # Some simulators are known to not support VMX and PPU instructions.
1485 if { [istarget powerpc-*-eabi*] } {
1488 # Most targets don't require special flags
for this test
1489 # case
, but Darwin and AIX
do.
1490 if { [istarget
*-*-darwin
*]
1491 ||
[istarget
*-*-aix
*] } {
1492 set options
"-maltivec -mcpu=cell"
1494 set options
"-mcpu=cell"
1496 check_runtime_nocache cell_hw_available
{
1500 asm volatile
("vor v0,v0,v0");
1501 asm volatile
("lvlx v0,r0,r0");
1503 asm volatile
("vor 0,0,0");
1504 asm volatile
("lvlx 0,0,0");
1513 #
Return 1 if the target supports executing
64-bit instructions
, 0
1514 # otherwise.
Cache the result.
1516 proc check_effective_target_powerpc64
{ } {
1517 global powerpc64_available_saved
1520 if [info exists powerpc64_available_saved
] {
1521 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1523 set powerpc64_available_saved
0
1525 # Some simulators are known to not support powerpc64 instructions.
1526 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1527 verbose
"check_effective_target_powerpc64 returning 0" 2
1528 return $powerpc64_available_saved
1531 #
Set up
, compile, and
execute a test
program containing a
64-bit
1532 # instruction.
Include the current process ID in the file
1533 # names to prevent conflicts with invocations
for multiple
1538 set f
[open $src
"w"]
1539 puts $f
"int main() {"
1540 puts $f
"#ifdef __MACH__"
1541 puts $f
" asm volatile (\"extsw r0,r0\");"
1543 puts $f
" asm volatile (\"extsw 0,0\");"
1545 puts $f
" return 0; }"
1548 set opts
"additional_flags=-mcpu=G5"
1550 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1551 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1554 if [string match
"" $lines] then {
1555 # No error message
, compilation succeeded.
1556 set result
[$
{tool
}_load
"./$exe" "" ""]
1557 set status [lindex $result
0]
1558 remote_file build
delete $exe
1559 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1561 if { $
status == "pass" } then {
1562 set powerpc64_available_saved
1
1565 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1569 return $powerpc64_available_saved
1572 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1573 # complex float arguments. This affects gfortran tests that
call cabsf
1574 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1575 #
argument passing as the compiler under test
, 0 otherwise.
1577 # When the target
name changes
, replace the cached result.
1579 proc check_effective_target_broken_cplxf_arg
{ } {
1580 return [check_cached_effective_target broken_cplxf_arg
{
1581 # Skip the work
for targets known not to be affected.
1582 if { ![istarget powerpc64
-*-linux
*] } {
1584 } elseif
{ ![is
-effective
-target lp64
] } {
1587 check_runtime_nocache broken_cplxf_arg
{
1588 #
include <complex.h
>
1589 extern void abort
(void
);
1590 float fabsf
(float
);
1591 float cabsf
(_Complex float
);
1598 if (fabsf
(f
- 5.0) > 0.0001)
1607 #
Return 1 is this is a TI C6X target supporting C67X instructions
1608 proc check_effective_target_ti_c67x
{ } {
1609 return [check_no_compiler_messages ti_c67x assembly
{
1610 #
if !defined
(_TMS320C6700
)
1616 #
Return 1 is this is a TI C6X target supporting C64X
+ instructions
1617 proc check_effective_target_ti_c64xp
{ } {
1618 return [check_no_compiler_messages ti_c64xp assembly
{
1619 #
if !defined
(_TMS320C6400_PLUS
)
1626 proc check_alpha_max_hw_available
{ } {
1627 return [check_runtime alpha_max_hw_available
{
1628 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1632 # Returns true iff the FUNCTION is available
on the target
system.
1633 #
(This is essentially a Tcl implementation of Autoconf
's
1636 proc check_function_available { function } {
1637 return [check_no_compiler_messages ${function}_available \
1643 int main () { $function (); }
1647 # Returns true iff "fork" is available on the target system.
1649 proc check_fork_available {} {
1650 return [check_function_available "fork"]
1653 # Returns true iff "mkfifo" is available on the target system.
1655 proc check_mkfifo_available {} {
1656 if { [istarget *-*-cygwin*] } {
1657 # Cygwin has mkfifo, but support is incomplete.
1661 return [check_function_available "mkfifo"]
1664 # Returns true iff "__cxa_atexit" is used on the target system.
1666 proc check_cxa_atexit_available { } {
1667 return [check_cached_effective_target cxa_atexit_available {
1668 if { [istarget hppa*-*-hpux10*] } {
1669 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1671 } elseif
{ [istarget
*-*-vxworks
] } {
1672 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1675 check_runtime_nocache cxa_atexit_available {
1678 static unsigned int count;
1695 Y() { f(); count = 2; }
1704 int main() { return 0; }
1710 proc check_effective_target_objc2 { } {
1711 return [check_no_compiler_messages objc2 object {
1720 proc check_effective_target_next_runtime { } {
1721 return [check_no_compiler_messages objc2 object {
1722 #ifdef __NEXT_RUNTIME__
1730 # Return 1 if we're generating
32-bit code using default options
, 0
1733 proc check_effective_target_ilp32
{ } {
1734 return [check_no_compiler_messages ilp32 object
{
1735 int dummy
[sizeof
(int) == 4
1736 && sizeof
(void
*) == 4
1737 && sizeof
(long
) == 4 ?
1 : -1];
1741 #
Return 1 if we
're generating ia32 code using default options, 0
1744 proc check_effective_target_ia32 { } {
1745 return [check_no_compiler_messages ia32 object {
1746 int dummy[sizeof (int) == 4
1747 && sizeof (void *) == 4
1748 && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
1752 # Return 1 if we're generating x32 code using default options
, 0
1755 proc check_effective_target_x32
{ } {
1756 return [check_no_compiler_messages x32 object
{
1757 int dummy
[sizeof
(int) == 4
1758 && sizeof
(void
*) == 4
1759 && sizeof
(long
) == 4 ?
1 : -1] = { __x86_64__
};
1763 #
Return 1 if we
're generating 32-bit integers using default
1764 # options, 0 otherwise.
1766 proc check_effective_target_int32 { } {
1767 return [check_no_compiler_messages int32 object {
1768 int dummy[sizeof (int) == 4 ? 1 : -1];
1772 # Return 1 if we're generating
32-bit or larger integers using default
1773 # options
, 0 otherwise.
1775 proc check_effective_target_int32plus
{ } {
1776 return [check_no_compiler_messages int32plus object
{
1777 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1781 #
Return 1 if we
're generating 32-bit or larger pointers using default
1782 # options, 0 otherwise.
1784 proc check_effective_target_ptr32plus { } {
1785 # The msp430 has 16-bit or 20-bit pointers. The 20-bit pointer is stored
1786 # in a 32-bit slot when in memory, so sizeof(void *) returns 4, but it
1787 # cannot really hold a 32-bit address, so we always return false here.
1788 if { [istarget msp430-*-*] } {
1792 return [check_no_compiler_messages ptr32plus object {
1793 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1797 # Return 1 if we support 32-bit or larger array and structure sizes
1798 # using default options, 0 otherwise.
1800 proc check_effective_target_size32plus { } {
1801 return [check_no_compiler_messages size32plus object {
1806 # Returns 1 if we're generating
16-bit or smaller integers with the
1807 # default options
, 0 otherwise.
1809 proc check_effective_target_int16
{ } {
1810 return [check_no_compiler_messages int16 object
{
1811 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1815 #
Return 1 if we
're generating 64-bit code using default options, 0
1818 proc check_effective_target_lp64 { } {
1819 return [check_no_compiler_messages lp64 object {
1820 int dummy[sizeof (int) == 4
1821 && sizeof (void *) == 8
1822 && sizeof (long) == 8 ? 1 : -1];
1826 # Return 1 if we're generating
64-bit code using default llp64 options
,
1829 proc check_effective_target_llp64
{ } {
1830 return [check_no_compiler_messages llp64 object
{
1831 int dummy
[sizeof
(int) == 4
1832 && sizeof
(void
*) == 8
1833 && sizeof
(long long
) == 8
1834 && sizeof
(long
) == 4 ?
1 : -1];
1838 #
Return 1 if long and
int have different sizes
,
1841 proc check_effective_target_long_neq_int
{ } {
1842 return [check_no_compiler_messages long_ne_int object
{
1843 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1847 #
Return 1 if the target supports long double larger than double
,
1850 proc check_effective_target_large_long_double
{ } {
1851 return [check_no_compiler_messages large_long_double object
{
1852 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1856 #
Return 1 if the target supports double larger than float
,
1859 proc check_effective_target_large_double
{ } {
1860 return [check_no_compiler_messages large_double object
{
1861 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
1865 #
Return 1 if the target supports double of
64 bits
,
1868 proc check_effective_target_double64
{ } {
1869 return [check_no_compiler_messages double64 object
{
1870 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
1874 #
Return 1 if the target supports double of at least
64 bits
,
1877 proc check_effective_target_double64plus
{ } {
1878 return [check_no_compiler_messages double64plus object
{
1879 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
1883 #
Return 1 if the target supports
'w' suffix
on floating constant
1886 proc check_effective_target_has_w_floating_suffix
{ } {
1888 if [check_effective_target_c
++] {
1889 append opts
"-std=gnu++03"
1891 return [check_no_compiler_messages w_fp_suffix object
{
1896 #
Return 1 if the target supports
'q' suffix
on floating constant
1899 proc check_effective_target_has_q_floating_suffix
{ } {
1901 if [check_effective_target_c
++] {
1902 append opts
"-std=gnu++03"
1904 return [check_no_compiler_messages q_fp_suffix object
{
1908 #
Return 1 if the target supports compiling fixed
-point
,
1911 proc check_effective_target_fixed_point
{ } {
1912 return [check_no_compiler_messages fixed_point object
{
1913 _Sat _Fract x
; _Sat _Accum y
;
1917 #
Return 1 if the target supports compiling decimal floating point
,
1920 proc check_effective_target_dfp_nocache
{ } {
1921 verbose
"check_effective_target_dfp_nocache: compiling source" 2
1922 set ret
[check_no_compiler_messages_nocache dfp object
{
1923 float x __attribute__
((mode(DD
)));
1925 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
1929 proc check_effective_target_dfprt_nocache
{ } {
1930 return [check_runtime_nocache dfprt
{
1931 typedef float d64 __attribute__
((mode(DD
)));
1932 d64 x
= 1.2df
, y
= 2.3dd
, z
;
1933 int main
() { z
= x
+ y
; return 0; }
1937 #
Return 1 if the target supports compiling Decimal Floating Point
,
1940 # This won
't change for different subtargets so cache the result.
1942 proc check_effective_target_dfp { } {
1943 return [check_cached_effective_target dfp {
1944 check_effective_target_dfp_nocache
1948 # Return 1 if the target supports linking and executing Decimal Floating
1949 # Point, 0 otherwise.
1951 # This won't change
for different subtargets so
cache the result.
1953 proc check_effective_target_dfprt
{ } {
1954 return [check_cached_effective_target dfprt
{
1955 check_effective_target_dfprt_nocache
1959 #
Return 1 if the target supports executing DFP hardware instructions
,
1960 #
0 otherwise.
Cache the result.
1962 proc check_dfp_hw_available
{ } {
1963 return [check_cached_effective_target dfp_hw_available
{
1964 #
For now
, disable
on Darwin
1965 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1968 check_runtime_nocache dfp_hw_available
{
1969 volatile _Decimal64 r
;
1970 volatile _Decimal64 a
= 4.0DD
;
1971 volatile _Decimal64 b
= 2.0DD
;
1974 asm volatile
("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
1975 asm volatile
("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
1976 asm volatile
("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
1977 asm volatile
("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
1980 } "-mcpu=power6 -mhard-float"
1985 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1987 proc check_effective_target_ucn_nocache
{ } {
1988 #
-std
=c99 is only valid
for C
1989 if [check_effective_target_c
] {
1990 set ucnopts
"-std=c99"
1992 append ucnopts
" -fextended-identifiers"
1993 verbose
"check_effective_target_ucn_nocache: compiling source" 2
1994 set ret
[check_no_compiler_messages_nocache ucn object
{
1997 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
2001 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2003 # This won
't change for different subtargets, so cache the result.
2005 proc check_effective_target_ucn { } {
2006 return [check_cached_effective_target ucn {
2007 check_effective_target_ucn_nocache
2011 # Return 1 if the target needs a command line argument to enable a SIMD
2014 proc check_effective_target_vect_cmdline_needed { } {
2015 global et_vect_cmdline_needed_saved
2016 global et_vect_cmdline_needed_target_name
2018 if { ![info exists et_vect_cmdline_needed_target_name] } {
2019 set et_vect_cmdline_needed_target_name ""
2022 # If the target has changed since we set the cached value, clear it.
2023 set current_target [current_target_name]
2024 if { $current_target != $et_vect_cmdline_needed_target_name } {
2025 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
2026 set et_vect_cmdline_needed_target_name $current_target
2027 if { [info exists et_vect_cmdline_needed_saved] } {
2028 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
2029 unset et_vect_cmdline_needed_saved
2033 if [info exists et_vect_cmdline_needed_saved] {
2034 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
2036 set et_vect_cmdline_needed_saved 1
2037 if { [istarget alpha*-*-*]
2038 || [istarget ia64-*-*]
2039 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
2040 && ([check_effective_target_x32]
2041 || [check_effective_target_lp64]))
2042 || ([istarget powerpc*-*-*]
2043 && ([check_effective_target_powerpc_spe]
2044 || [check_effective_target_powerpc_altivec]))
2045 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
2046 || [istarget spu-*-*]
2047 || ([istarget arm*-*-*] && [check_effective_target_arm_neon])
2048 || [istarget aarch64*-*-*] } {
2049 set et_vect_cmdline_needed_saved 0
2053 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2054 return $et_vect_cmdline_needed_saved
2057 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
2059 # This won't change
for different subtargets so
cache the result.
2061 proc check_effective_target_vect_int
{ } {
2062 global et_vect_int_saved
2064 if [info exists et_vect_int_saved
] {
2065 verbose
"check_effective_target_vect_int: using cached result" 2
2067 set et_vect_int_saved
0
2068 if { [istarget i?
86-*-*]
2069 ||
([istarget powerpc
*-*-*]
2070 && ![istarget powerpc
-*-linux
*paired
*])
2071 ||
[istarget spu
-*-*]
2072 ||
[istarget x86_64
-*-*]
2073 ||
[istarget sparc
*-*-*]
2074 ||
[istarget alpha
*-*-*]
2075 ||
[istarget ia64
-*-*]
2076 ||
[istarget aarch64
*-*-*]
2077 ||
[check_effective_target_arm32
]
2078 ||
([istarget mips
*-*-*]
2079 && [check_effective_target_mips_loongson
]) } {
2080 set et_vect_int_saved
1
2084 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
2085 return $et_vect_int_saved
2088 #
Return 1 if the target supports signed
int->float conversion
2091 proc check_effective_target_vect_intfloat_cvt
{ } {
2092 global et_vect_intfloat_cvt_saved
2094 if [info exists et_vect_intfloat_cvt_saved
] {
2095 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
2097 set et_vect_intfloat_cvt_saved
0
2098 if { [istarget i?
86-*-*]
2099 ||
([istarget powerpc
*-*-*]
2100 && ![istarget powerpc
-*-linux
*paired
*])
2101 ||
[istarget x86_64
-*-*]
2102 ||
([istarget arm
*-*-*]
2103 && [check_effective_target_arm_neon_ok
])} {
2104 set et_vect_intfloat_cvt_saved
1
2108 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2109 return $et_vect_intfloat_cvt_saved
2112 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
2114 proc check_effective_target_int128 { } {
2115 return [check_no_compiler_messages int128 object {
2117 #ifndef __SIZEOF_INT128__
2126 # Return 1 if the target supports unsigned int->float conversion
2129 proc check_effective_target_vect_uintfloat_cvt { } {
2130 global et_vect_uintfloat_cvt_saved
2132 if [info exists et_vect_uintfloat_cvt_saved] {
2133 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2135 set et_vect_uintfloat_cvt_saved 0
2136 if { [istarget i?86-*-*]
2137 || ([istarget powerpc*-*-*]
2138 && ![istarget powerpc-*-linux*paired*])
2139 || [istarget x86_64-*-*]
2140 || [istarget aarch64*-*-*]
2141 || ([istarget arm*-*-*]
2142 && [check_effective_target_arm_neon_ok])} {
2143 set et_vect_uintfloat_cvt_saved 1
2147 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2148 return $et_vect_uintfloat_cvt_saved
2152 # Return 1 if the target supports signed float->int conversion
2155 proc check_effective_target_vect_floatint_cvt { } {
2156 global et_vect_floatint_cvt_saved
2158 if [info exists et_vect_floatint_cvt_saved] {
2159 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2161 set et_vect_floatint_cvt_saved 0
2162 if { [istarget i?86-*-*]
2163 || ([istarget powerpc*-*-*]
2164 && ![istarget powerpc-*-linux*paired*])
2165 || [istarget x86_64-*-*]
2166 || ([istarget arm*-*-*]
2167 && [check_effective_target_arm_neon_ok])} {
2168 set et_vect_floatint_cvt_saved 1
2172 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2173 return $et_vect_floatint_cvt_saved
2176 # Return 1 if the target supports unsigned float->int conversion
2179 proc check_effective_target_vect_floatuint_cvt { } {
2180 global et_vect_floatuint_cvt_saved
2182 if [info exists et_vect_floatuint_cvt_saved] {
2183 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2185 set et_vect_floatuint_cvt_saved 0
2186 if { ([istarget powerpc*-*-*]
2187 && ![istarget powerpc-*-linux*paired*])
2188 || ([istarget arm*-*-*]
2189 && [check_effective_target_arm_neon_ok])} {
2190 set et_vect_floatuint_cvt_saved 1
2194 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2195 return $et_vect_floatuint_cvt_saved
2198 # Return 1 if the target supports #pragma omp declare simd, 0 otherwise.
2200 # This won't change
for different subtargets so
cache the result.
2202 proc check_effective_target_vect_simd_clones
{ } {
2203 global et_vect_simd_clones_saved
2205 if [info exists et_vect_simd_clones_saved
] {
2206 verbose
"check_effective_target_vect_simd_clones: using cached result" 2
2208 set et_vect_simd_clones_saved
0
2209 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
2210 #
On i?
86/x86_64 #pragma omp declare simd builds a sse2
, avx and
2211 # avx2 clone. Only the right clone
for the specified arch will be
2212 # chosen
, but still we need to at least be able to assemble
2214 if { [check_effective_target_avx2
] } {
2215 set et_vect_simd_clones_saved
1
2220 verbose
"check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2221 return $et_vect_simd_clones_saved
2224 #
Return 1 if this is a AArch64 target supporting big endian
2225 proc check_effective_target_aarch64_big_endian
{ } {
2226 return [check_no_compiler_messages aarch64_big_endian assembly
{
2227 #
if !defined
(__aarch64__
) ||
!defined
(__AARCH64EB__
)
2233 #
Return 1 if this is a AArch64 target supporting little endian
2234 proc check_effective_target_aarch64_little_endian
{ } {
2235 return [check_no_compiler_messages aarch64_little_endian assembly
{
2236 #
if !defined
(__aarch64__
) || defined
(__AARCH64EB__
)
2242 #
Return 1 is this is an arm target using
32-bit instructions
2243 proc check_effective_target_arm32
{ } {
2244 return [check_no_compiler_messages arm32 assembly
{
2245 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
2251 #
Return 1 is this is an arm target not using Thumb
2252 proc check_effective_target_arm_nothumb
{ } {
2253 return [check_no_compiler_messages arm_nothumb assembly
{
2254 #
if (defined
(__thumb__
) || defined
(__thumb2__
))
2260 #
Return 1 if this is a little
-endian ARM target
2261 proc check_effective_target_arm_little_endian
{ } {
2262 return [check_no_compiler_messages arm_little_endian assembly
{
2263 #
if !defined
(__arm__
) ||
!defined
(__ARMEL__
)
2269 #
Return 1 if this is an ARM target that only supports aligned vector accesses
2270 proc check_effective_target_arm_vect_no_misalign
{ } {
2271 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
2272 #
if !defined
(__arm__
) \
2273 ||
(defined
(__ARMEL__
) \
2274 && (!defined
(__thumb__
) || defined
(__thumb2__
)))
2281 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2282 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
2285 proc check_effective_target_arm_vfp_ok
{ } {
2286 if { [check_effective_target_arm32
] } {
2287 return [check_no_compiler_messages arm_vfp_ok object
{
2289 } "-mfpu=vfp -mfloat-abi=softfp"]
2295 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp3
2296 #
-mfloat
-abi
=softfp.
2298 proc check_effective_target_arm_vfp3_ok
{ } {
2299 if { [check_effective_target_arm32
] } {
2300 return [check_no_compiler_messages arm_vfp3_ok object
{
2302 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2308 #
Return 1 if this is an ARM target supporting
-mfpu
=fp
-armv8
2309 #
-mfloat
-abi
=softfp.
2310 proc check_effective_target_arm_v8_vfp_ok
{} {
2311 if { [check_effective_target_arm32
] } {
2312 return [check_no_compiler_messages arm_v8_vfp_ok object
{
2315 __asm__ volatile
("vrinta.f32.f32 s0, s0");
2318 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2324 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2325 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
2328 proc check_effective_target_arm_hard_vfp_ok
{ } {
2329 if { [check_effective_target_arm32
]
2330 && ! [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2331 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
2332 int main
() { return 0;}
2333 } "-mfpu=vfp -mfloat-abi=hard"]
2339 #
Return 1 if this is an ARM target that supports DSP multiply with
2340 # current multilib flags.
2342 proc check_effective_target_arm_dsp
{ } {
2343 return [check_no_compiler_messages arm_dsp assembly
{
2344 #ifndef __ARM_FEATURE_DSP
2351 #
Return 1 if this is an ARM target that supports unaligned word
/halfword
2352 #
load/store instructions.
2354 proc check_effective_target_arm_unaligned
{ } {
2355 return [check_no_compiler_messages arm_unaligned assembly
{
2356 #ifndef __ARM_FEATURE_UNALIGNED
2357 #error no unaligned support
2363 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2364 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2365 # incompatible with these options. Also
set et_arm_crypto_flags to the
2366 # best options to add.
2368 proc check_effective_target_arm_crypto_ok_nocache
{ } {
2369 global et_arm_crypto_flags
2370 set et_arm_crypto_flags
""
2371 if { [check_effective_target_arm32
] } {
2372 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2373 if { [check_no_compiler_messages_nocache arm_crypto_ok object
{
2374 #
include "arm_neon.h"
2376 foo
(uint8x16_t a
, uint8x16_t b
)
2378 return vaeseq_u8
(a
, b
);
2381 set et_arm_crypto_flags $flags
2390 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2392 proc check_effective_target_arm_crypto_ok
{ } {
2393 return [check_cached_effective_target arm_crypto_ok \
2394 check_effective_target_arm_crypto_ok_nocache
]
2397 # Add options
for crypto extensions.
2398 proc add_options_for_arm_crypto
{ flags
} {
2399 if { ! [check_effective_target_arm_crypto_ok
] } {
2402 global et_arm_crypto_flags
2403 return "$flags $et_arm_crypto_flags"
2406 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2407 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2408 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2409 # NEON
, do not add
-mfpu
=neon.
2411 proc add_options_for_arm_neon
{ flags
} {
2412 if { ! [check_effective_target_arm_neon_ok
] } {
2415 global et_arm_neon_flags
2416 return "$flags $et_arm_neon_flags"
2419 proc add_options_for_arm_v8_vfp
{ flags
} {
2420 if { ! [check_effective_target_arm_v8_vfp_ok
] } {
2423 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2426 proc add_options_for_arm_v8_neon
{ flags
} {
2427 if { ! [check_effective_target_arm_v8_neon_ok
] } {
2430 global et_arm_v8_neon_flags
2431 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2434 proc add_options_for_arm_crc
{ flags
} {
2435 if { ! [check_effective_target_arm_crc_ok
] } {
2438 global et_arm_crc_flags
2439 return "$flags $et_arm_crc_flags"
2442 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2443 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2444 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2445 # NEON
, do not add
-mfpu
=neon.
2447 proc add_options_for_arm_neonv2
{ flags
} {
2448 if { ! [check_effective_target_arm_neonv2_ok
] } {
2451 global et_arm_neonv2_flags
2452 return "$flags $et_arm_neonv2_flags"
2455 # Add the options needed
for vfp3.
2456 proc add_options_for_arm_vfp3
{ flags
} {
2457 if { ! [check_effective_target_arm_vfp3_ok
] } {
2460 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2463 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
2464 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2465 # incompatible with these options. Also
set et_arm_neon_flags to the
2466 # best options to add.
2468 proc check_effective_target_arm_neon_ok_nocache
{ } {
2469 global et_arm_neon_flags
2470 set et_arm_neon_flags
""
2471 if { [check_effective_target_arm32
] } {
2472 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2473 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
2474 #
include "arm_neon.h"
2477 set et_arm_neon_flags $flags
2486 proc check_effective_target_arm_neon_ok
{ } {
2487 return [check_cached_effective_target arm_neon_ok \
2488 check_effective_target_arm_neon_ok_nocache
]
2491 proc check_effective_target_arm_crc_ok_nocache
{ } {
2492 global et_arm_crc_flags
2493 set et_arm_crc_flags
"-march=armv8-a+crc"
2494 return [check_no_compiler_messages_nocache arm_crc_ok object
{
2495 #
if !defined
(__ARM_FEATURE_CRC32
)
2498 } "$et_arm_crc_flags"]
2501 proc check_effective_target_arm_crc_ok
{ } {
2502 return [check_cached_effective_target arm_crc_ok \
2503 check_effective_target_arm_crc_ok_nocache
]
2506 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
2507 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2508 # incompatible with these options. Also
set et_arm_neon_flags to the
2509 # best options to add.
2511 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
2512 global et_arm_neon_fp16_flags
2513 set et_arm_neon_fp16_flags
""
2514 if { [check_effective_target_arm32
] } {
2515 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2516 "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
2517 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object
{
2518 #
include "arm_neon.h"
2520 foo
(float32x4_t
arg)
2522 return vcvt_f16_f32
(arg);
2525 set et_arm_neon_fp16_flags $flags
2534 proc check_effective_target_arm_neon_fp16_ok
{ } {
2535 return [check_cached_effective_target arm_neon_fp16_ok \
2536 check_effective_target_arm_neon_fp16_ok_nocache
]
2539 proc add_options_for_arm_neon_fp16
{ flags
} {
2540 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
2543 global et_arm_neon_fp16_flags
2544 return "$flags $et_arm_neon_fp16_flags"
2547 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp
-armv8
2548 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2549 # incompatible with these options. Also
set et_arm_v8_neon_flags to the
2550 # best options to add.
2552 proc check_effective_target_arm_v8_neon_ok_nocache
{ } {
2553 global et_arm_v8_neon_flags
2554 set et_arm_v8_neon_flags
""
2555 if { [check_effective_target_arm32
] } {
2556 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2557 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object
{
2558 #
include "arm_neon.h"
2562 __asm__ volatile
("vrintn.f32 q0, q0");
2565 set et_arm_v8_neon_flags $flags
2574 proc check_effective_target_arm_v8_neon_ok
{ } {
2575 return [check_cached_effective_target arm_v8_neon_ok \
2576 check_effective_target_arm_v8_neon_ok_nocache
]
2579 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-vfpv4
2580 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2581 # incompatible with these options. Also
set et_arm_neonv2_flags to the
2582 # best options to add.
2584 proc check_effective_target_arm_neonv2_ok_nocache
{ } {
2585 global et_arm_neonv2_flags
2586 set et_arm_neonv2_flags
""
2587 if { [check_effective_target_arm32
] } {
2588 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2589 if { [check_no_compiler_messages_nocache arm_neonv2_ok object
{
2590 #
include "arm_neon.h"
2592 foo
(float32x2_t a
, float32x2_t b
, float32x2_t c
)
2594 return vfma_f32
(a
, b
, c
);
2597 set et_arm_neonv2_flags $flags
2606 proc check_effective_target_arm_neonv2_ok
{ } {
2607 return [check_cached_effective_target arm_neonv2_ok \
2608 check_effective_target_arm_neonv2_ok_nocache
]
2611 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2612 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2615 proc add_options_for_arm_fp16
{ flags
} {
2616 if { ! [check_effective_target_arm_fp16_ok
] } {
2619 global et_arm_fp16_flags
2620 return "$flags $et_arm_fp16_flags"
2623 #
Return 1 if this is an ARM target that can support a VFP fp16 variant.
2624 # Skip multilibs that are incompatible with these options and
set
2625 # et_arm_fp16_flags to the best options to add.
2627 proc check_effective_target_arm_fp16_ok_nocache
{ } {
2628 global et_arm_fp16_flags
2629 set et_arm_fp16_flags
""
2630 if { ! [check_effective_target_arm32
] } {
2633 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2634 # Multilib flags would override
-mfpu.
2637 if [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2638 # Must generate floating
-point instructions.
2641 if [check_effective_target_arm_hf_eabi
] {
2642 # Use existing float
-abi and force an fpu which supports fp16
2643 set et_arm_fp16_flags
"-mfpu=vfpv4"
2646 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "" } ]] {
2647 # The existing
-mfpu value is OK
; use it
, but add softfp.
2648 set et_arm_fp16_flags
"-mfloat-abi=softfp"
2651 # Add
-mfpu
for a VFP fp16 variant since there is no preprocessor
2652 # macro to check
for this support.
2653 set flags
"-mfpu=vfpv4 -mfloat-abi=softfp"
2654 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly
{
2657 set et_arm_fp16_flags
"$flags"
2664 proc check_effective_target_arm_fp16_ok
{ } {
2665 return [check_cached_effective_target arm_fp16_ok \
2666 check_effective_target_arm_fp16_ok_nocache
]
2669 # Creates a series of routines that
return 1 if the given architecture
2670 # can be selected and a routine to give the flags to select that architecture
2671 # Note
: Extra flags may be added to disable options from newer compilers
2672 #
(Thumb in particular
- but others may be added in the future
)
2673 # Usage
: /* { dg
-require
-effective
-target arm_arch_v5_ok
} */
2674 #
/* { dg
-add
-options arm_arch_v5
} */
2675 #
/* { dg
-require
-effective
-target arm_arch_v5_multilib
} */
2676 foreach
{ armfunc armflag armdef
} { v4
"-march=armv4 -marm" __ARM_ARCH_4__
2677 v4t
"-march=armv4t" __ARM_ARCH_4T__
2678 v5
"-march=armv5 -marm" __ARM_ARCH_5__
2679 v5t
"-march=armv5t" __ARM_ARCH_5T__
2680 v5te
"-march=armv5te" __ARM_ARCH_5TE__
2681 v6
"-march=armv6" __ARM_ARCH_6__
2682 v6k
"-march=armv6k" __ARM_ARCH_6K__
2683 v6t2
"-march=armv6t2" __ARM_ARCH_6T2__
2684 v6z
"-march=armv6z" __ARM_ARCH_6Z__
2685 v6m
"-march=armv6-m -mthumb" __ARM_ARCH_6M__
2686 v7a
"-march=armv7-a" __ARM_ARCH_7A__
2687 v7ve
"-march=armv7ve" __ARM_ARCH_7A__
2688 v7r
"-march=armv7-r" __ARM_ARCH_7R__
2689 v7m
"-march=armv7-m -mthumb" __ARM_ARCH_7M__
2690 v7em
"-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2691 v8a
"-march=armv8-a" __ARM_ARCH_8A__ } {
2692 eval
[string map
[list FUNC $armfunc FLAG $armflag DEF $armdef
] {
2693 proc check_effective_target_arm_arch_FUNC_ok
{ } {
2694 if { [ string match
"*-marm*" "FLAG" ] &&
2695 ![check_effective_target_arm_arm_ok
] } {
2698 return [check_no_compiler_messages arm_arch_FUNC_ok assembly
{
2705 proc add_options_for_arm_arch_FUNC
{ flags
} {
2706 return "$flags FLAG"
2709 proc check_effective_target_arm_arch_FUNC_multilib
{ } {
2710 return [check_runtime arm_arch_FUNC_multilib
{
2716 } [add_options_for_arm_arch_FUNC
""]]
2721 #
Return 1 if this is an ARM target where
-marm causes ARM to be
2724 proc check_effective_target_arm_arm_ok
{ } {
2725 return [check_no_compiler_messages arm_arm_ok assembly
{
2726 #
if !defined
(__arm__
) || defined
(__thumb__
) || defined
(__thumb2__
)
2733 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
2736 proc check_effective_target_arm_thumb1_ok
{ } {
2737 return [check_no_compiler_messages arm_thumb1_ok assembly
{
2738 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2744 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
2747 proc check_effective_target_arm_thumb2_ok
{ } {
2748 return [check_no_compiler_messages arm_thumb2_ok assembly
{
2749 #
if !defined
(__thumb2__
)
2755 #
Return 1 if this is an ARM target where Thumb
-1 is used without options
2756 # added by the test.
2758 proc check_effective_target_arm_thumb1
{ } {
2759 return [check_no_compiler_messages arm_thumb1 assembly
{
2760 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2767 #
Return 1 if this is an ARM target where Thumb
-2 is used without options
2768 # added by the test.
2770 proc check_effective_target_arm_thumb2
{ } {
2771 return [check_no_compiler_messages arm_thumb2 assembly
{
2772 #
if !defined
(__thumb2__
)
2779 #
Return 1 if this is an ARM target where conditional execution is available.
2781 proc check_effective_target_arm_cond_exec
{ } {
2782 return [check_no_compiler_messages arm_cond_exec assembly
{
2783 #
if defined
(__arm__
) && defined
(__thumb__
) && !defined
(__thumb2__
)
2790 #
Return 1 if this is an ARM cortex
-M profile cpu
2792 proc check_effective_target_arm_cortex_m
{ } {
2793 return [check_no_compiler_messages arm_cortex_m assembly
{
2794 #
if !defined
(__ARM_ARCH_7M__
) \
2795 && !defined
(__ARM_ARCH_7EM__
) \
2796 && !defined
(__ARM_ARCH_6M__
)
2803 #
Return 1 if the target supports executing NEON instructions
, 0
2804 # otherwise.
Cache the result.
2806 proc check_effective_target_arm_neon_hw
{ } {
2807 return [check_runtime arm_neon_hw_available
{
2811 long long a
= 0, b
= 1;
2812 asm
("vorr %P0, %P1, %P2"
2814 : "0" (a), "w" (b));
2817 } [add_options_for_arm_neon
""]]
2820 proc check_effective_target_arm_neonv2_hw
{ } {
2821 return [check_runtime arm_neon_hwv2_available
{
2822 #
include "arm_neon.h"
2826 float32x2_t a
, b
, c
;
2827 asm
("vfma.f32 %P0, %P1, %P2"
2829 : "w" (b), "w" (c));
2832 } [add_options_for_arm_neonv2
""]]
2835 #
Return 1 if the target supports executing ARMv8 NEON instructions
, 0
2838 proc check_effective_target_arm_v8_neon_hw
{ } {
2839 return [check_runtime arm_v8_neon_hw_available
{
2840 #
include "arm_neon.h"
2845 asm
("vrinta.f32 %P0, %P1"
2850 } [add_options_for_arm_v8_neon
""]]
2853 #
Return 1 if this is a ARM target with NEON enabled.
2855 proc check_effective_target_arm_neon
{ } {
2856 if { [check_effective_target_arm32
] } {
2857 return [check_no_compiler_messages arm_neon object
{
2858 #ifndef __ARM_NEON__
2869 proc check_effective_target_arm_neonv2
{ } {
2870 if { [check_effective_target_arm32
] } {
2871 return [check_no_compiler_messages arm_neon object
{
2872 #ifndef __ARM_NEON__
2875 #ifndef __ARM_FEATURE_FMA
2887 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
2888 # the Loongson vector modes.
2890 proc check_effective_target_mips_loongson
{ } {
2891 return [check_no_compiler_messages loongson assembly
{
2892 #
if !defined
(__mips_loongson_vector_rev
)
2898 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
2901 proc check_effective_target_arm_eabi
{ } {
2902 return [check_no_compiler_messages arm_eabi object
{
2903 #ifndef __ARM_EABI__
2911 #
Return 1 if this is an ARM target that adheres to the hard
-float variant of
2912 # the ABI
for the ARM Architecture
(e.g.
-mfloat
-abi
=hard
).
2914 proc check_effective_target_arm_hf_eabi
{ } {
2915 return [check_no_compiler_messages arm_hf_eabi object
{
2916 #
if !defined
(__ARM_EABI__
) ||
!defined
(__ARM_PCS_VFP
)
2917 #error not hard
-float EABI
2924 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
2925 # Some multilibs may be incompatible with this option.
2927 proc check_effective_target_arm_iwmmxt_ok
{ } {
2928 if { [check_effective_target_arm32
] } {
2929 return [check_no_compiler_messages arm_iwmmxt_ok object
{
2937 #
Return true
if LDRD
/STRD instructions are prefered over LDM
/STM instructions
2938 #
for an ARM target.
2939 proc check_effective_target_arm_prefer_ldrd_strd
{ } {
2940 if { ![check_effective_target_arm32
] } {
2944 return [check_no_messages_and_pattern arm_prefer_ldrd_strd
"strd\tr" assembly {
2945 void foo
(int *p
) { p
[0] = 1; p
[1] = 0;}
2949 #
Return 1 if this is a PowerPC target supporting
-meabi.
2951 proc check_effective_target_powerpc_eabi_ok
{ } {
2952 if { [istarget powerpc
*-*-*] } {
2953 return [check_no_compiler_messages powerpc_eabi_ok object
{
2961 #
Return 1 if this is a PowerPC target with floating
-point registers.
2963 proc check_effective_target_powerpc_fprs
{ } {
2964 if { [istarget powerpc
*-*-*]
2965 ||
[istarget rs6000
-*-*] } {
2966 return [check_no_compiler_messages powerpc_fprs object
{
2978 #
Return 1 if this is a PowerPC target with hardware double
-precision
2981 proc check_effective_target_powerpc_hard_double
{ } {
2982 if { [istarget powerpc
*-*-*]
2983 ||
[istarget rs6000
-*-*] } {
2984 return [check_no_compiler_messages powerpc_hard_double object
{
2996 #
Return 1 if this is a PowerPC target supporting
-maltivec.
2998 proc check_effective_target_powerpc_altivec_ok
{ } {
2999 if { ([istarget powerpc
*-*-*]
3000 && ![istarget powerpc
-*-linux
*paired
*])
3001 ||
[istarget rs6000
-*-*] } {
3002 # AltiVec is not supported
on AIX before
5.3.
3003 if { [istarget powerpc
*-*-aix4
*]
3004 ||
[istarget powerpc
*-*-aix5.1
*]
3005 ||
[istarget powerpc
*-*-aix5.2
*] } {
3008 return [check_no_compiler_messages powerpc_altivec_ok object
{
3016 #
Return 1 if this is a PowerPC target supporting
-mpower8
-vector
3018 proc check_effective_target_powerpc_p8vector_ok
{ } {
3019 if { ([istarget powerpc
*-*-*]
3020 && ![istarget powerpc
-*-linux
*paired
*])
3021 ||
[istarget rs6000
-*-*] } {
3022 # AltiVec is not supported
on AIX before
5.3.
3023 if { [istarget powerpc
*-*-aix4
*]
3024 ||
[istarget powerpc
*-*-aix5.1
*]
3025 ||
[istarget powerpc
*-*-aix5.2
*] } {
3028 return [check_no_compiler_messages powerpc_p8vector_ok object
{
3031 asm volatile
("xxlorc vs0,vs0,vs0");
3033 asm volatile
("xxlorc 0,0,0");
3037 } "-mpower8-vector"]
3043 #
Return 1 if this is a PowerPC target supporting
-mvsx
3045 proc check_effective_target_powerpc_vsx_ok
{ } {
3046 if { ([istarget powerpc
*-*-*]
3047 && ![istarget powerpc
-*-linux
*paired
*])
3048 ||
[istarget rs6000
-*-*] } {
3049 # VSX is not supported
on AIX before
7.1.
3050 if { [istarget powerpc
*-*-aix4
*]
3051 ||
[istarget powerpc
*-*-aix5
*]
3052 ||
[istarget powerpc
*-*-aix6
*] } {
3055 return [check_no_compiler_messages powerpc_vsx_ok object
{
3058 asm volatile
("xxlor vs0,vs0,vs0");
3060 asm volatile
("xxlor 0,0,0");
3070 #
Return 1 if this is a PowerPC target supporting
-mhtm
3072 proc check_effective_target_powerpc_htm_ok
{ } {
3073 if { ([istarget powerpc
*-*-*]
3074 && ![istarget powerpc
-*-linux
*paired
*])
3075 ||
[istarget rs6000
-*-*] } {
3076 # HTM is not supported
on AIX yet.
3077 if { [istarget powerpc
*-*-aix
*] } {
3080 return [check_no_compiler_messages powerpc_htm_ok object
{
3082 asm volatile
("tbegin. 0");
3091 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
3093 proc check_effective_target_powerpc_ppu_ok
{ } {
3094 if [check_effective_target_powerpc_altivec_ok
] {
3095 return [check_no_compiler_messages cell_asm_available object
{
3098 asm volatile
("lvlx v0,v0,v0");
3100 asm volatile
("lvlx 0,0,0");
3110 #
Return 1 if this is a PowerPC target that supports SPU.
3112 proc check_effective_target_powerpc_spu
{ } {
3113 if { [istarget powerpc
*-*-linux
*] } {
3114 return [check_effective_target_powerpc_altivec_ok
]
3120 #
Return 1 if this is a PowerPC SPE target. The check includes options
3121 # specified by dg
-options
for this test
, so don
't cache the result.
3123 proc check_effective_target_powerpc_spe_nocache { } {
3124 if { [istarget powerpc*-*-*] } {
3125 return [check_no_compiler_messages_nocache powerpc_spe object {
3131 } [current_compiler_flags]]
3137 # Return 1 if this is a PowerPC target with SPE enabled.
3139 proc check_effective_target_powerpc_spe { } {
3140 if { [istarget powerpc*-*-*] } {
3141 return [check_no_compiler_messages powerpc_spe object {
3153 # Return 1 if this is a PowerPC target with Altivec enabled.
3155 proc check_effective_target_powerpc_altivec { } {
3156 if { [istarget powerpc*-*-*] } {
3157 return [check_no_compiler_messages powerpc_altivec object {
3169 # Return 1 if this is a PowerPC 405 target. The check includes options
3170 # specified by dg-options for this test, so don't
cache the result.
3172 proc check_effective_target_powerpc_405_nocache
{ } {
3173 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
3174 return [check_no_compiler_messages_nocache powerpc_405 object
{
3180 } [current_compiler_flags
]]
3186 #
Return 1 if this is a PowerPC target using the ELFv2 ABI.
3188 proc check_effective_target_powerpc_elfv2
{ } {
3189 if { [istarget powerpc
*-*-*] } {
3190 return [check_no_compiler_messages powerpc_elfv2 object
{
3192 #error not ELF v2 ABI
3202 #
Return 1 if this is a SPU target with a toolchain that
3203 # supports automatic overlay generation.
3205 proc check_effective_target_spu_auto_overlay
{ } {
3206 if { [istarget spu
*-*-elf
*] } {
3207 return [check_no_compiler_messages spu_auto_overlay executable
{
3209 } "-Wl,--auto-overlay" ]
3215 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3216 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
3217 # test environment appears to run executables
on such a simulator.
3219 proc check_effective_target_ultrasparc_hw
{ } {
3220 return [check_runtime ultrasparc_hw
{
3221 int main
() { return 0; }
3222 } "-mcpu=ultrasparc"]
3225 #
Return 1 if the test environment supports executing UltraSPARC VIS2
3226 # instructions. We check this by attempting
: "bmask %g0, %g0, %g0"
3228 proc check_effective_target_ultrasparc_vis2_hw
{ } {
3229 return [check_runtime ultrasparc_vis2_hw
{
3230 int main
() { __asm__
(".word 0x81b00320"); return 0; }
3231 } "-mcpu=ultrasparc3"]
3234 #
Return 1 if the test environment supports executing UltraSPARC VIS3
3235 # instructions. We check this by attempting
: "addxc %g0, %g0, %g0"
3237 proc check_effective_target_ultrasparc_vis3_hw
{ } {
3238 return [check_runtime ultrasparc_vis3_hw
{
3239 int main
() { __asm__
(".word 0x81b00220"); return 0; }
3243 #
Return 1 if this is a SPARC
-V9 target.
3245 proc check_effective_target_sparc_v9
{ } {
3246 if { [istarget sparc
*-*-*] } {
3247 return [check_no_compiler_messages sparc_v9 object
{
3249 asm volatile
("return %i7+8");
3258 #
Return 1 if this is a SPARC target with VIS enabled.
3260 proc check_effective_target_sparc_vis
{ } {
3261 if { [istarget sparc
*-*-*] } {
3262 return [check_no_compiler_messages sparc_vis object
{
3274 #
Return 1 if the target supports hardware vector shift operation.
3276 proc check_effective_target_vect_shift
{ } {
3277 global et_vect_shift_saved
3279 if [info exists et_vect_shift_saved
] {
3280 verbose
"check_effective_target_vect_shift: using cached result" 2
3282 set et_vect_shift_saved
0
3283 if { ([istarget powerpc
*-*-*]
3284 && ![istarget powerpc
-*-linux
*paired
*])
3285 ||
[istarget ia64
-*-*]
3286 ||
[istarget i?
86-*-*]
3287 ||
[istarget x86_64
-*-*]
3288 ||
[istarget aarch64
*-*-*]
3289 ||
[check_effective_target_arm32
]
3290 ||
([istarget mips
*-*-*]
3291 && [check_effective_target_mips_loongson
]) } {
3292 set et_vect_shift_saved
1
3296 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3297 return $et_vect_shift_saved
3300 #
Return 1 if the target supports vector bswap operations.
3302 proc check_effective_target_vect_bswap
{ } {
3303 global et_vect_bswap_saved
3305 if [info exists et_vect_bswap_saved
] {
3306 verbose
"check_effective_target_vect_bswap: using cached result" 2
3308 set et_vect_bswap_saved
0
3309 if { [istarget aarch64
*-*-*] } {
3310 set et_vect_bswap_saved
1
3314 verbose
"check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
3315 return $et_vect_bswap_saved
3318 #
Return 1 if the target supports hardware vector shift operation
for char.
3320 proc check_effective_target_vect_shift_char
{ } {
3321 global et_vect_shift_char_saved
3323 if [info exists et_vect_shift_char_saved
] {
3324 verbose
"check_effective_target_vect_shift_char: using cached result" 2
3326 set et_vect_shift_char_saved
0
3327 if { ([istarget powerpc
*-*-*]
3328 && ![istarget powerpc
-*-linux
*paired
*])
3329 ||
[check_effective_target_arm32
] } {
3330 set et_vect_shift_char_saved
1
3334 verbose
"check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3335 return $et_vect_shift_char_saved
3338 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
3340 # This can change
for different subtargets so
do not
cache the result.
3342 proc check_effective_target_vect_long
{ } {
3343 if { [istarget i?
86-*-*]
3344 ||
(([istarget powerpc
*-*-*]
3345 && ![istarget powerpc
-*-linux
*paired
*])
3346 && [check_effective_target_ilp32
])
3347 ||
[istarget x86_64
-*-*]
3348 ||
[check_effective_target_arm32
]
3349 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
3355 verbose
"check_effective_target_vect_long: returning $answer" 2
3359 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
3361 # This won
't change for different subtargets so cache the result.
3363 proc check_effective_target_vect_float { } {
3364 global et_vect_float_saved
3366 if [info exists et_vect_float_saved] {
3367 verbose "check_effective_target_vect_float: using cached result" 2
3369 set et_vect_float_saved 0
3370 if { [istarget i?86-*-*]
3371 || [istarget powerpc*-*-*]
3372 || [istarget spu-*-*]
3373 || [istarget mips-sde-elf]
3374 || [istarget mipsisa64*-*-*]
3375 || [istarget x86_64-*-*]
3376 || [istarget ia64-*-*]
3377 || [istarget aarch64*-*-*]
3378 || [check_effective_target_arm32] } {
3379 set et_vect_float_saved 1
3383 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
3384 return $et_vect_float_saved
3387 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
3389 # This won't change
for different subtargets so
cache the result.
3391 proc check_effective_target_vect_double
{ } {
3392 global et_vect_double_saved
3394 if [info exists et_vect_double_saved
] {
3395 verbose
"check_effective_target_vect_double: using cached result" 2
3397 set et_vect_double_saved
0
3398 if { [istarget i?
86-*-*]
3399 ||
[istarget aarch64
*-*-*]
3400 ||
[istarget x86_64
-*-*] } {
3401 if { [check_no_compiler_messages vect_double assembly
{
3402 #ifdef __tune_atom__
3403 # error No double vectorizer support.
3406 set et_vect_double_saved
1
3408 set et_vect_double_saved
0
3410 } elseif
{ [istarget spu
-*-*] } {
3411 set et_vect_double_saved
1
3415 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
3416 return $et_vect_double_saved
3419 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
3421 # This won
't change for different subtargets so cache the result.
3423 proc check_effective_target_vect_long_long { } {
3424 global et_vect_long_long_saved
3426 if [info exists et_vect_long_long_saved] {
3427 verbose "check_effective_target_vect_long_long: using cached result" 2
3429 set et_vect_long_long_saved 0
3430 if { [istarget i?86-*-*]
3431 || [istarget x86_64-*-*] } {
3432 set et_vect_long_long_saved 1
3436 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3437 return $et_vect_long_long_saved
3441 # Return 1 if the target plus current options does not support a vector
3442 # max instruction on "int", 0 otherwise.
3444 # This won't change
for different subtargets so
cache the result.
3446 proc check_effective_target_vect_no_int_max
{ } {
3447 global et_vect_no_int_max_saved
3449 if [info exists et_vect_no_int_max_saved
] {
3450 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
3452 set et_vect_no_int_max_saved
0
3453 if { [istarget sparc
*-*-*]
3454 ||
[istarget spu
-*-*]
3455 ||
[istarget alpha
*-*-*]
3456 ||
([istarget mips
*-*-*]
3457 && [check_effective_target_mips_loongson
]) } {
3458 set et_vect_no_int_max_saved
1
3461 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3462 return $et_vect_no_int_max_saved
3465 #
Return 1 if the target plus current options does not support a vector
3466 # add instruction
on "int", 0 otherwise.
3468 # This won
't change for different subtargets so cache the result.
3470 proc check_effective_target_vect_no_int_add { } {
3471 global et_vect_no_int_add_saved
3473 if [info exists et_vect_no_int_add_saved] {
3474 verbose "check_effective_target_vect_no_int_add: using cached result" 2
3476 set et_vect_no_int_add_saved 0
3477 # Alpha only supports vector add on V8QI and V4HI.
3478 if { [istarget alpha*-*-*] } {
3479 set et_vect_no_int_add_saved 1
3482 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3483 return $et_vect_no_int_add_saved
3486 # Return 1 if the target plus current options does not support vector
3487 # bitwise instructions, 0 otherwise.
3489 # This won't change
for different subtargets so
cache the result.
3491 proc check_effective_target_vect_no_bitwise
{ } {
3492 global et_vect_no_bitwise_saved
3494 if [info exists et_vect_no_bitwise_saved
] {
3495 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
3497 set et_vect_no_bitwise_saved
0
3499 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3500 return $et_vect_no_bitwise_saved
3503 #
Return 1 if the target plus current options supports vector permutation
,
3506 # This won
't change for different subtargets so cache the result.
3508 proc check_effective_target_vect_perm { } {
3511 if [info exists et_vect_perm_saved] {
3512 verbose "check_effective_target_vect_perm: using cached result" 2
3514 set et_vect_perm_saved 0
3515 if { [is-effective-target arm_neon_ok]
3516 || [istarget aarch64*-*-*]
3517 || [istarget powerpc*-*-*]
3518 || [istarget spu-*-*]
3519 || [istarget i?86-*-*]
3520 || [istarget x86_64-*-*]
3521 || ([istarget mips*-*-*]
3522 && [check_effective_target_mpaired_single]) } {
3523 set et_vect_perm_saved 1
3526 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3527 return $et_vect_perm_saved
3530 # Return 1 if the target plus current options supports vector permutation
3531 # on byte-sized elements, 0 otherwise.
3533 # This won't change
for different subtargets so
cache the result.
3535 proc check_effective_target_vect_perm_byte
{ } {
3536 global et_vect_perm_byte
3538 if [info exists et_vect_perm_byte_saved
] {
3539 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
3541 set et_vect_perm_byte_saved
0
3542 if { ([is
-effective
-target arm_neon_ok
]
3543 && [is
-effective
-target arm_little_endian
])
3544 ||
([istarget aarch64
*-*-*]
3545 && [is
-effective
-target aarch64_little_endian
])
3546 ||
[istarget powerpc
*-*-*]
3547 ||
[istarget spu
-*-*] } {
3548 set et_vect_perm_byte_saved
1
3551 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3552 return $et_vect_perm_byte_saved
3555 #
Return 1 if the target plus current options supports vector permutation
3556 #
on short
-sized elements
, 0 otherwise.
3558 # This won
't change for different subtargets so cache the result.
3560 proc check_effective_target_vect_perm_short { } {
3561 global et_vect_perm_short
3563 if [info exists et_vect_perm_short_saved] {
3564 verbose "check_effective_target_vect_perm_short: using cached result" 2
3566 set et_vect_perm_short_saved 0
3567 if { ([is-effective-target arm_neon_ok]
3568 && [is-effective-target arm_little_endian])
3569 || ([istarget aarch64*-*-*]
3570 && [is-effective-target aarch64_little_endian])
3571 || [istarget powerpc*-*-*]
3572 || [istarget spu-*-*] } {
3573 set et_vect_perm_short_saved 1
3576 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3577 return $et_vect_perm_short_saved
3580 # Return 1 if the target plus current options supports a vector
3581 # widening summation of *short* args into *int* result, 0 otherwise.
3583 # This won't change
for different subtargets so
cache the result.
3585 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
3586 global et_vect_widen_sum_hi_to_si_pattern
3588 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
3589 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3591 set et_vect_widen_sum_hi_to_si_pattern_saved
0
3592 if { [istarget powerpc
*-*-*]
3593 ||
[istarget ia64
-*-*] } {
3594 set et_vect_widen_sum_hi_to_si_pattern_saved
1
3597 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3598 return $et_vect_widen_sum_hi_to_si_pattern_saved
3601 #
Return 1 if the target plus current options supports a vector
3602 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3603 # A target can also support this widening summation
if it can support
3604 # promotion
(unpacking
) from shorts to ints.
3606 # This won
't change for different subtargets so cache the result.
3608 proc check_effective_target_vect_widen_sum_hi_to_si { } {
3609 global et_vect_widen_sum_hi_to_si
3611 if [info exists et_vect_widen_sum_hi_to_si_saved] {
3612 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3614 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
3615 if { [istarget powerpc*-*-*]
3616 || [istarget ia64-*-*] } {
3617 set et_vect_widen_sum_hi_to_si_saved 1
3620 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3621 return $et_vect_widen_sum_hi_to_si_saved
3624 # Return 1 if the target plus current options supports a vector
3625 # widening summation of *char* args into *short* result, 0 otherwise.
3626 # A target can also support this widening summation if it can support
3627 # promotion (unpacking) from chars to shorts.
3629 # This won't change
for different subtargets so
cache the result.
3631 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
3632 global et_vect_widen_sum_qi_to_hi
3634 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
3635 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3637 set et_vect_widen_sum_qi_to_hi_saved
0
3638 if { [check_effective_target_vect_unpack
]
3639 ||
[check_effective_target_arm_neon_ok
]
3640 ||
[istarget ia64
-*-*] } {
3641 set et_vect_widen_sum_qi_to_hi_saved
1
3644 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3645 return $et_vect_widen_sum_qi_to_hi_saved
3648 #
Return 1 if the target plus current options supports a vector
3649 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
3651 # This won
't change for different subtargets so cache the result.
3653 proc check_effective_target_vect_widen_sum_qi_to_si { } {
3654 global et_vect_widen_sum_qi_to_si
3656 if [info exists et_vect_widen_sum_qi_to_si_saved] {
3657 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3659 set et_vect_widen_sum_qi_to_si_saved 0
3660 if { [istarget powerpc*-*-*] } {
3661 set et_vect_widen_sum_qi_to_si_saved 1
3664 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3665 return $et_vect_widen_sum_qi_to_si_saved
3668 # Return 1 if the target plus current options supports a vector
3669 # widening multiplication of *char* args into *short* result, 0 otherwise.
3670 # A target can also support this widening multplication if it can support
3671 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
3672 # multiplication of shorts).
3674 # This won't change
for different subtargets so
cache the result.
3677 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
3678 global et_vect_widen_mult_qi_to_hi
3680 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
3681 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3683 if { [check_effective_target_vect_unpack
]
3684 && [check_effective_target_vect_short_mult
] } {
3685 set et_vect_widen_mult_qi_to_hi_saved
1
3687 set et_vect_widen_mult_qi_to_hi_saved
0
3689 if { [istarget powerpc
*-*-*]
3690 ||
[istarget aarch64
*-*-*]
3691 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3692 set et_vect_widen_mult_qi_to_hi_saved
1
3695 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3696 return $et_vect_widen_mult_qi_to_hi_saved
3699 #
Return 1 if the target plus current options supports a vector
3700 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3701 # A target can also support this widening multplication
if it can support
3702 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
3703 # multiplication of ints
).
3705 # This won
't change for different subtargets so cache the result.
3708 proc check_effective_target_vect_widen_mult_hi_to_si { } {
3709 global et_vect_widen_mult_hi_to_si
3711 if [info exists et_vect_widen_mult_hi_to_si_saved] {
3712 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3714 if { [check_effective_target_vect_unpack]
3715 && [check_effective_target_vect_int_mult] } {
3716 set et_vect_widen_mult_hi_to_si_saved 1
3718 set et_vect_widen_mult_hi_to_si_saved 0
3720 if { [istarget powerpc*-*-*]
3721 || [istarget spu-*-*]
3722 || [istarget ia64-*-*]
3723 || [istarget aarch64*-*-*]
3724 || [istarget i?86-*-*]
3725 || [istarget x86_64-*-*]
3726 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3727 set et_vect_widen_mult_hi_to_si_saved 1
3730 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3731 return $et_vect_widen_mult_hi_to_si_saved
3734 # Return 1 if the target plus current options supports a vector
3735 # widening multiplication of *char* args into *short* result, 0 otherwise.
3737 # This won't change
for different subtargets so
cache the result.
3739 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern
{ } {
3740 global et_vect_widen_mult_qi_to_hi_pattern
3742 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved
] {
3743 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3745 set et_vect_widen_mult_qi_to_hi_pattern_saved
0
3746 if { [istarget powerpc
*-*-*]
3747 ||
([istarget arm
*-*-*]
3748 && [check_effective_target_arm_neon_ok
]
3749 && [check_effective_target_arm_little_endian
]) } {
3750 set et_vect_widen_mult_qi_to_hi_pattern_saved
1
3753 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3754 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3757 #
Return 1 if the target plus current options supports a vector
3758 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3760 # This won
't change for different subtargets so cache the result.
3762 proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
3763 global et_vect_widen_mult_hi_to_si_pattern
3765 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved] {
3766 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3768 set et_vect_widen_mult_hi_to_si_pattern_saved 0
3769 if { [istarget powerpc*-*-*]
3770 || [istarget spu-*-*]
3771 || [istarget ia64-*-*]
3772 || [istarget i?86-*-*]
3773 || [istarget x86_64-*-*]
3774 || ([istarget arm*-*-*]
3775 && [check_effective_target_arm_neon_ok]
3776 && [check_effective_target_arm_little_endian]) } {
3777 set et_vect_widen_mult_hi_to_si_pattern_saved 1
3780 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3781 return $et_vect_widen_mult_hi_to_si_pattern_saved
3784 # Return 1 if the target plus current options supports a vector
3785 # widening multiplication of *int* args into *long* result, 0 otherwise.
3787 # This won't change
for different subtargets so
cache the result.
3789 proc check_effective_target_vect_widen_mult_si_to_di_pattern
{ } {
3790 global et_vect_widen_mult_si_to_di_pattern
3792 if [info exists et_vect_widen_mult_si_to_di_pattern_saved
] {
3793 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
3795 set et_vect_widen_mult_si_to_di_pattern_saved
0
3796 if {[istarget ia64
-*-*]
3797 ||
[istarget i?
86-*-*]
3798 ||
[istarget x86_64
-*-*] } {
3799 set et_vect_widen_mult_si_to_di_pattern_saved
1
3802 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
3803 return $et_vect_widen_mult_si_to_di_pattern_saved
3806 #
Return 1 if the target plus current options supports a vector
3807 # widening shift
, 0 otherwise.
3809 # This won
't change for different subtargets so cache the result.
3811 proc check_effective_target_vect_widen_shift { } {
3812 global et_vect_widen_shift_saved
3814 if [info exists et_vect_shift_saved] {
3815 verbose "check_effective_target_vect_widen_shift: using cached result" 2
3817 set et_vect_widen_shift_saved 0
3818 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3819 set et_vect_widen_shift_saved 1
3822 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3823 return $et_vect_widen_shift_saved
3826 # Return 1 if the target plus current options supports a vector
3827 # dot-product of signed chars, 0 otherwise.
3829 # This won't change
for different subtargets so
cache the result.
3831 proc check_effective_target_vect_sdot_qi
{ } {
3832 global et_vect_sdot_qi
3834 if [info exists et_vect_sdot_qi_saved
] {
3835 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
3837 set et_vect_sdot_qi_saved
0
3838 if { [istarget ia64
-*-*] } {
3839 set et_vect_udot_qi_saved
1
3842 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3843 return $et_vect_sdot_qi_saved
3846 #
Return 1 if the target plus current options supports a vector
3847 # dot
-product of unsigned chars
, 0 otherwise.
3849 # This won
't change for different subtargets so cache the result.
3851 proc check_effective_target_vect_udot_qi { } {
3852 global et_vect_udot_qi
3854 if [info exists et_vect_udot_qi_saved] {
3855 verbose "check_effective_target_vect_udot_qi: using cached result" 2
3857 set et_vect_udot_qi_saved 0
3858 if { [istarget powerpc*-*-*]
3859 || [istarget ia64-*-*] } {
3860 set et_vect_udot_qi_saved 1
3863 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
3864 return $et_vect_udot_qi_saved
3867 # Return 1 if the target plus current options supports a vector
3868 # dot-product of signed shorts, 0 otherwise.
3870 # This won't change
for different subtargets so
cache the result.
3872 proc check_effective_target_vect_sdot_hi
{ } {
3873 global et_vect_sdot_hi
3875 if [info exists et_vect_sdot_hi_saved
] {
3876 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
3878 set et_vect_sdot_hi_saved
0
3879 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3880 ||
[istarget ia64
-*-*]
3881 ||
[istarget i?
86-*-*]
3882 ||
[istarget x86_64
-*-*] } {
3883 set et_vect_sdot_hi_saved
1
3886 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
3887 return $et_vect_sdot_hi_saved
3890 #
Return 1 if the target plus current options supports a vector
3891 # dot
-product of unsigned shorts
, 0 otherwise.
3893 # This won
't change for different subtargets so cache the result.
3895 proc check_effective_target_vect_udot_hi { } {
3896 global et_vect_udot_hi
3898 if [info exists et_vect_udot_hi_saved] {
3899 verbose "check_effective_target_vect_udot_hi: using cached result" 2
3901 set et_vect_udot_hi_saved 0
3902 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
3903 set et_vect_udot_hi_saved 1
3906 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
3907 return $et_vect_udot_hi_saved
3911 # Return 1 if the target plus current options supports a vector
3912 # demotion (packing) of shorts (to chars) and ints (to shorts)
3913 # using modulo arithmetic, 0 otherwise.
3915 # This won't change
for different subtargets so
cache the result.
3917 proc check_effective_target_vect_pack_trunc
{ } {
3918 global et_vect_pack_trunc
3920 if [info exists et_vect_pack_trunc_saved
] {
3921 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
3923 set et_vect_pack_trunc_saved
0
3924 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3925 ||
[istarget i?
86-*-*]
3926 ||
[istarget x86_64
-*-*]
3927 ||
[istarget aarch64
*-*-*]
3928 ||
[istarget spu
-*-*]
3929 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
3930 && [check_effective_target_arm_little_endian
]) } {
3931 set et_vect_pack_trunc_saved
1
3934 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
3935 return $et_vect_pack_trunc_saved
3938 #
Return 1 if the target plus current options supports a vector
3939 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
3941 # This won
't change for different subtargets so cache the result.
3943 proc check_effective_target_vect_unpack { } {
3944 global et_vect_unpack
3946 if [info exists et_vect_unpack_saved] {
3947 verbose "check_effective_target_vect_unpack: using cached result" 2
3949 set et_vect_unpack_saved 0
3950 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
3951 || [istarget i?86-*-*]
3952 || [istarget x86_64-*-*]
3953 || [istarget spu-*-*]
3954 || [istarget ia64-*-*]
3955 || [istarget aarch64*-*-*]
3956 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
3957 && [check_effective_target_arm_little_endian]) } {
3958 set et_vect_unpack_saved 1
3961 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
3962 return $et_vect_unpack_saved
3965 # Return 1 if the target plus current options does not guarantee
3966 # that its STACK_BOUNDARY is >= the reguired vector alignment.
3968 # This won't change
for different subtargets so
cache the result.
3970 proc check_effective_target_unaligned_stack
{ } {
3971 global et_unaligned_stack_saved
3973 if [info exists et_unaligned_stack_saved
] {
3974 verbose
"check_effective_target_unaligned_stack: using cached result" 2
3976 set et_unaligned_stack_saved
0
3978 verbose
"check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
3979 return $et_unaligned_stack_saved
3982 #
Return 1 if the target plus current options does not support a vector
3983 # alignment mechanism
, 0 otherwise.
3985 # This won
't change for different subtargets so cache the result.
3987 proc check_effective_target_vect_no_align { } {
3988 global et_vect_no_align_saved
3990 if [info exists et_vect_no_align_saved] {
3991 verbose "check_effective_target_vect_no_align: using cached result" 2
3993 set et_vect_no_align_saved 0
3994 if { [istarget mipsisa64*-*-*]
3995 || [istarget mips-sde-elf]
3996 || [istarget sparc*-*-*]
3997 || [istarget ia64-*-*]
3998 || [check_effective_target_arm_vect_no_misalign]
3999 || ([istarget mips*-*-*]
4000 && [check_effective_target_mips_loongson]) } {
4001 set et_vect_no_align_saved 1
4004 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
4005 return $et_vect_no_align_saved
4008 # Return 1 if the target supports a vector misalign access, 0 otherwise.
4010 # This won't change
for different subtargets so
cache the result.
4012 proc check_effective_target_vect_hw_misalign
{ } {
4013 global et_vect_hw_misalign_saved
4015 if [info exists et_vect_hw_misalign_saved
] {
4016 verbose
"check_effective_target_vect_hw_misalign: using cached result" 2
4018 set et_vect_hw_misalign_saved
0
4019 if { ([istarget x86_64
-*-*]
4020 ||
[istarget aarch64
*-*-*]
4021 ||
[istarget i?
86-*-*]) } {
4022 set et_vect_hw_misalign_saved
1
4025 verbose
"check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
4026 return $et_vect_hw_misalign_saved
4030 #
Return 1 if arrays are aligned to the vector alignment
4031 # boundary
, 0 otherwise.
4033 # This won
't change for different subtargets so cache the result.
4035 proc check_effective_target_vect_aligned_arrays { } {
4036 global et_vect_aligned_arrays
4038 if [info exists et_vect_aligned_arrays_saved] {
4039 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
4041 set et_vect_aligned_arrays_saved 0
4042 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4043 if { ([is-effective-target lp64]
4044 && ( ![check_avx_available]
4045 || [check_prefer_avx128])) } {
4046 set et_vect_aligned_arrays_saved 1
4049 if [istarget spu-*-*] {
4050 set et_vect_aligned_arrays_saved 1
4053 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
4054 return $et_vect_aligned_arrays_saved
4057 # Return 1 if types of size 32 bit or less are naturally aligned
4058 # (aligned to their type-size), 0 otherwise.
4060 # This won't change
for different subtargets so
cache the result.
4062 proc check_effective_target_natural_alignment_32
{ } {
4063 global et_natural_alignment_32
4065 if [info exists et_natural_alignment_32_saved
] {
4066 verbose
"check_effective_target_natural_alignment_32: using cached result" 2
4068 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
4069 set et_natural_alignment_32_saved
1
4070 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
4071 set et_natural_alignment_32_saved
0
4074 verbose
"check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4075 return $et_natural_alignment_32_saved
4078 #
Return 1 if types of size
64 bit or less are naturally aligned
(aligned to their
4079 # type
-size
), 0 otherwise.
4081 # This won
't change for different subtargets so cache the result.
4083 proc check_effective_target_natural_alignment_64 { } {
4084 global et_natural_alignment_64
4086 if [info exists et_natural_alignment_64_saved] {
4087 verbose "check_effective_target_natural_alignment_64: using cached result" 2
4089 set et_natural_alignment_64_saved 0
4090 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
4091 || [istarget spu-*-*] } {
4092 set et_natural_alignment_64_saved 1
4095 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4096 return $et_natural_alignment_64_saved
4099 # Return 1 if all vector types are naturally aligned (aligned to their
4100 # type-size), 0 otherwise.
4102 # This won't change
for different subtargets so
cache the result.
4104 proc check_effective_target_vect_natural_alignment
{ } {
4105 global et_vect_natural_alignment
4107 if [info exists et_vect_natural_alignment_saved
] {
4108 verbose
"check_effective_target_vect_natural_alignment: using cached result" 2
4110 set et_vect_natural_alignment_saved
1
4111 if { [check_effective_target_arm_eabi
] } {
4112 set et_vect_natural_alignment_saved
0
4115 verbose
"check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4116 return $et_vect_natural_alignment_saved
4119 #
Return 1 if vector alignment
(for types of size
32 bit or less
) is reachable
, 0 otherwise.
4121 # This won
't change for different subtargets so cache the result.
4123 proc check_effective_target_vector_alignment_reachable { } {
4124 global et_vector_alignment_reachable
4126 if [info exists et_vector_alignment_reachable_saved] {
4127 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
4129 if { [check_effective_target_vect_aligned_arrays]
4130 || [check_effective_target_natural_alignment_32] } {
4131 set et_vector_alignment_reachable_saved 1
4133 set et_vector_alignment_reachable_saved 0
4136 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4137 return $et_vector_alignment_reachable_saved
4140 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
4142 # This won't change
for different subtargets so
cache the result.
4144 proc check_effective_target_vector_alignment_reachable_for_64bit
{ } {
4145 global et_vector_alignment_reachable_for_64bit
4147 if [info exists et_vector_alignment_reachable_for_64bit_saved
] {
4148 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4150 if { [check_effective_target_vect_aligned_arrays
]
4151 ||
[check_effective_target_natural_alignment_64
] } {
4152 set et_vector_alignment_reachable_for_64bit_saved
1
4154 set et_vector_alignment_reachable_for_64bit_saved
0
4157 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4158 return $et_vector_alignment_reachable_for_64bit_saved
4161 #
Return 1 if the target only requires element alignment
for vector accesses
4163 proc check_effective_target_vect_element_align
{ } {
4164 global et_vect_element_align
4166 if [info exists et_vect_element_align
] {
4167 verbose
"check_effective_target_vect_element_align: using cached result" 2
4169 set et_vect_element_align
0
4170 if { ([istarget arm
*-*-*]
4171 && ![check_effective_target_arm_vect_no_misalign
])
4172 ||
[check_effective_target_vect_hw_misalign
] } {
4173 set et_vect_element_align
1
4177 verbose
"check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4178 return $et_vect_element_align
4181 #
Return 1 if the target supports vector conditional operations
, 0 otherwise.
4183 proc check_effective_target_vect_condition
{ } {
4184 global et_vect_cond_saved
4186 if [info exists et_vect_cond_saved
] {
4187 verbose
"check_effective_target_vect_cond: using cached result" 2
4189 set et_vect_cond_saved
0
4190 if { [istarget aarch64
*-*-*]
4191 ||
[istarget powerpc
*-*-*]
4192 ||
[istarget ia64
-*-*]
4193 ||
[istarget i?
86-*-*]
4194 ||
[istarget spu
-*-*]
4195 ||
[istarget x86_64
-*-*]
4196 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
4197 set et_vect_cond_saved
1
4201 verbose
"check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4202 return $et_vect_cond_saved
4205 #
Return 1 if the target supports vector conditional operations where
4206 # the comparison has different type from the lhs
, 0 otherwise.
4208 proc check_effective_target_vect_cond_mixed
{ } {
4209 global et_vect_cond_mixed_saved
4211 if [info exists et_vect_cond_mixed_saved
] {
4212 verbose
"check_effective_target_vect_cond_mixed: using cached result" 2
4214 set et_vect_cond_mixed_saved
0
4215 if { [istarget i?
86-*-*]
4216 ||
[istarget x86_64
-*-*]
4217 ||
[istarget powerpc
*-*-*] } {
4218 set et_vect_cond_mixed_saved
1
4222 verbose
"check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4223 return $et_vect_cond_mixed_saved
4226 #
Return 1 if the target supports vector char multiplication
, 0 otherwise.
4228 proc check_effective_target_vect_char_mult
{ } {
4229 global et_vect_char_mult_saved
4231 if [info exists et_vect_char_mult_saved
] {
4232 verbose
"check_effective_target_vect_char_mult: using cached result" 2
4234 set et_vect_char_mult_saved
0
4235 if { [istarget aarch64
*-*-*]
4236 ||
[istarget ia64
-*-*]
4237 ||
[istarget i?
86-*-*]
4238 ||
[istarget x86_64
-*-*]
4239 ||
[check_effective_target_arm32
] } {
4240 set et_vect_char_mult_saved
1
4244 verbose
"check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4245 return $et_vect_char_mult_saved
4248 #
Return 1 if the target supports vector short multiplication
, 0 otherwise.
4250 proc check_effective_target_vect_short_mult
{ } {
4251 global et_vect_short_mult_saved
4253 if [info exists et_vect_short_mult_saved
] {
4254 verbose
"check_effective_target_vect_short_mult: using cached result" 2
4256 set et_vect_short_mult_saved
0
4257 if { [istarget ia64
-*-*]
4258 ||
[istarget spu
-*-*]
4259 ||
[istarget i?
86-*-*]
4260 ||
[istarget x86_64
-*-*]
4261 ||
[istarget powerpc
*-*-*]
4262 ||
[istarget aarch64
*-*-*]
4263 ||
[check_effective_target_arm32
]
4264 ||
([istarget mips
*-*-*]
4265 && [check_effective_target_mips_loongson
]) } {
4266 set et_vect_short_mult_saved
1
4270 verbose
"check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4271 return $et_vect_short_mult_saved
4274 #
Return 1 if the target supports vector
int multiplication
, 0 otherwise.
4276 proc check_effective_target_vect_int_mult
{ } {
4277 global et_vect_int_mult_saved
4279 if [info exists et_vect_int_mult_saved
] {
4280 verbose
"check_effective_target_vect_int_mult: using cached result" 2
4282 set et_vect_int_mult_saved
0
4283 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4284 ||
[istarget spu
-*-*]
4285 ||
[istarget i?
86-*-*]
4286 ||
[istarget x86_64
-*-*]
4287 ||
[istarget ia64
-*-*]
4288 ||
[istarget aarch64
*-*-*]
4289 ||
[check_effective_target_arm32
] } {
4290 set et_vect_int_mult_saved
1
4294 verbose
"check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4295 return $et_vect_int_mult_saved
4298 #
Return 1 if the target supports vector even
/odd elements extraction
, 0 otherwise.
4300 proc check_effective_target_vect_extract_even_odd
{ } {
4301 global et_vect_extract_even_odd_saved
4303 if [info exists et_vect_extract_even_odd_saved
] {
4304 verbose
"check_effective_target_vect_extract_even_odd: using cached result" 2
4306 set et_vect_extract_even_odd_saved
0
4307 if { [istarget aarch64
*-*-*]
4308 ||
[istarget powerpc
*-*-*]
4309 ||
[is
-effective
-target arm_neon_ok
]
4310 ||
[istarget i?
86-*-*]
4311 ||
[istarget x86_64
-*-*]
4312 ||
[istarget ia64
-*-*]
4313 ||
[istarget spu
-*-*]
4314 ||
([istarget mips
*-*-*]
4315 && [check_effective_target_mpaired_single
]) } {
4316 set et_vect_extract_even_odd_saved
1
4320 verbose
"check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4321 return $et_vect_extract_even_odd_saved
4324 #
Return 1 if the target supports vector interleaving
, 0 otherwise.
4326 proc check_effective_target_vect_interleave
{ } {
4327 global et_vect_interleave_saved
4329 if [info exists et_vect_interleave_saved
] {
4330 verbose
"check_effective_target_vect_interleave: using cached result" 2
4332 set et_vect_interleave_saved
0
4333 if { [istarget aarch64
*-*-*]
4334 ||
[istarget powerpc
*-*-*]
4335 ||
[is
-effective
-target arm_neon_ok
]
4336 ||
[istarget i?
86-*-*]
4337 ||
[istarget x86_64
-*-*]
4338 ||
[istarget ia64
-*-*]
4339 ||
[istarget spu
-*-*]
4340 ||
([istarget mips
*-*-*]
4341 && [check_effective_target_mpaired_single
]) } {
4342 set et_vect_interleave_saved
1
4346 verbose
"check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4347 return $et_vect_interleave_saved
4350 foreach N
{2 3 4 8} {
4351 eval
[string map
[list N $N
] {
4352 #
Return 1 if the target supports
2-vector interleaving
4353 proc check_effective_target_vect_stridedN
{ } {
4354 global et_vect_stridedN_saved
4356 if [info exists et_vect_stridedN_saved
] {
4357 verbose
"check_effective_target_vect_stridedN: using cached result" 2
4359 set et_vect_stridedN_saved
0
4361 && [check_effective_target_vect_interleave
]
4362 && [check_effective_target_vect_extract_even_odd
] } {
4363 set et_vect_stridedN_saved
1
4365 if { ([istarget arm
*-*-*]
4366 ||
[istarget aarch64
*-*-*]) && N
>= 2 && N
<= 4 } {
4367 set et_vect_stridedN_saved
1
4371 verbose
"check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4372 return $et_vect_stridedN_saved
4377 #
Return 1 if the target supports multiple vector sizes
4379 proc check_effective_target_vect_multiple_sizes
{ } {
4380 global et_vect_multiple_sizes_saved
4382 set et_vect_multiple_sizes_saved
0
4383 if { ([istarget aarch64
*-*-*]
4384 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
])) } {
4385 set et_vect_multiple_sizes_saved
1
4387 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
4388 if { ([check_avx_available
] && ![check_prefer_avx128
]) } {
4389 set et_vect_multiple_sizes_saved
1
4393 verbose
"check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4394 return $et_vect_multiple_sizes_saved
4397 #
Return 1 if the target supports vectors of
64 bits.
4399 proc check_effective_target_vect64
{ } {
4400 global et_vect64_saved
4402 if [info exists et_vect64_saved
] {
4403 verbose
"check_effective_target_vect64: using cached result" 2
4405 set et_vect64_saved
0
4406 if { ([istarget arm
*-*-*]
4407 && [check_effective_target_arm_neon_ok
]
4408 && [check_effective_target_arm_little_endian
]) } {
4409 set et_vect64_saved
1
4413 verbose
"check_effective_target_vect64: returning $et_vect64_saved" 2
4414 return $et_vect64_saved
4417 #
Return 1 if the target supports vector copysignf calls.
4419 proc check_effective_target_vect_call_copysignf
{ } {
4420 global et_vect_call_copysignf_saved
4422 if [info exists et_vect_call_copysignf_saved
] {
4423 verbose
"check_effective_target_vect_call_copysignf: using cached result" 2
4425 set et_vect_call_copysignf_saved
0
4426 if { [istarget i?
86-*-*]
4427 ||
[istarget x86_64
-*-*]
4428 ||
[istarget powerpc
*-*-*] } {
4429 set et_vect_call_copysignf_saved
1
4433 verbose
"check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4434 return $et_vect_call_copysignf_saved
4437 #
Return 1 if the target supports vector sqrtf calls.
4439 proc check_effective_target_vect_call_sqrtf
{ } {
4440 global et_vect_call_sqrtf_saved
4442 if [info exists et_vect_call_sqrtf_saved
] {
4443 verbose
"check_effective_target_vect_call_sqrtf: using cached result" 2
4445 set et_vect_call_sqrtf_saved
0
4446 if { [istarget aarch64
*-*-*]
4447 ||
[istarget i?
86-*-*]
4448 ||
[istarget x86_64
-*-*]
4449 ||
([istarget powerpc
*-*-*] && [check_vsx_hw_available
]) } {
4450 set et_vect_call_sqrtf_saved
1
4454 verbose
"check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4455 return $et_vect_call_sqrtf_saved
4458 #
Return 1 if the target supports vector lrint calls.
4460 proc check_effective_target_vect_call_lrint
{ } {
4461 set et_vect_call_lrint
0
4462 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) && [check_effective_target_ilp32
] } {
4463 set et_vect_call_lrint
1
4466 verbose
"check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4467 return $et_vect_call_lrint
4470 #
Return 1 if the target supports vector btrunc calls.
4472 proc check_effective_target_vect_call_btrunc
{ } {
4473 global et_vect_call_btrunc_saved
4475 if [info exists et_vect_call_btrunc_saved
] {
4476 verbose
"check_effective_target_vect_call_btrunc: using cached result" 2
4478 set et_vect_call_btrunc_saved
0
4479 if { [istarget aarch64
*-*-*] } {
4480 set et_vect_call_btrunc_saved
1
4484 verbose
"check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4485 return $et_vect_call_btrunc_saved
4488 #
Return 1 if the target supports vector btruncf calls.
4490 proc check_effective_target_vect_call_btruncf
{ } {
4491 global et_vect_call_btruncf_saved
4493 if [info exists et_vect_call_btruncf_saved
] {
4494 verbose
"check_effective_target_vect_call_btruncf: using cached result" 2
4496 set et_vect_call_btruncf_saved
0
4497 if { [istarget aarch64
*-*-*] } {
4498 set et_vect_call_btruncf_saved
1
4502 verbose
"check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4503 return $et_vect_call_btruncf_saved
4506 #
Return 1 if the target supports vector ceil calls.
4508 proc check_effective_target_vect_call_ceil
{ } {
4509 global et_vect_call_ceil_saved
4511 if [info exists et_vect_call_ceil_saved
] {
4512 verbose
"check_effective_target_vect_call_ceil: using cached result" 2
4514 set et_vect_call_ceil_saved
0
4515 if { [istarget aarch64
*-*-*] } {
4516 set et_vect_call_ceil_saved
1
4520 verbose
"check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4521 return $et_vect_call_ceil_saved
4524 #
Return 1 if the target supports vector ceilf calls.
4526 proc check_effective_target_vect_call_ceilf
{ } {
4527 global et_vect_call_ceilf_saved
4529 if [info exists et_vect_call_ceilf_saved
] {
4530 verbose
"check_effective_target_vect_call_ceilf: using cached result" 2
4532 set et_vect_call_ceilf_saved
0
4533 if { [istarget aarch64
*-*-*] } {
4534 set et_vect_call_ceilf_saved
1
4538 verbose
"check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4539 return $et_vect_call_ceilf_saved
4542 #
Return 1 if the target supports vector floor calls.
4544 proc check_effective_target_vect_call_floor
{ } {
4545 global et_vect_call_floor_saved
4547 if [info exists et_vect_call_floor_saved
] {
4548 verbose
"check_effective_target_vect_call_floor: using cached result" 2
4550 set et_vect_call_floor_saved
0
4551 if { [istarget aarch64
*-*-*] } {
4552 set et_vect_call_floor_saved
1
4556 verbose
"check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4557 return $et_vect_call_floor_saved
4560 #
Return 1 if the target supports vector floorf calls.
4562 proc check_effective_target_vect_call_floorf
{ } {
4563 global et_vect_call_floorf_saved
4565 if [info exists et_vect_call_floorf_saved
] {
4566 verbose
"check_effective_target_vect_call_floorf: using cached result" 2
4568 set et_vect_call_floorf_saved
0
4569 if { [istarget aarch64
*-*-*] } {
4570 set et_vect_call_floorf_saved
1
4574 verbose
"check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4575 return $et_vect_call_floorf_saved
4578 #
Return 1 if the target supports vector lceil calls.
4580 proc check_effective_target_vect_call_lceil
{ } {
4581 global et_vect_call_lceil_saved
4583 if [info exists et_vect_call_lceil_saved
] {
4584 verbose
"check_effective_target_vect_call_lceil: using cached result" 2
4586 set et_vect_call_lceil_saved
0
4587 if { [istarget aarch64
*-*-*] } {
4588 set et_vect_call_lceil_saved
1
4592 verbose
"check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4593 return $et_vect_call_lceil_saved
4596 #
Return 1 if the target supports vector lfloor calls.
4598 proc check_effective_target_vect_call_lfloor
{ } {
4599 global et_vect_call_lfloor_saved
4601 if [info exists et_vect_call_lfloor_saved
] {
4602 verbose
"check_effective_target_vect_call_lfloor: using cached result" 2
4604 set et_vect_call_lfloor_saved
0
4605 if { [istarget aarch64
*-*-*] } {
4606 set et_vect_call_lfloor_saved
1
4610 verbose
"check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4611 return $et_vect_call_lfloor_saved
4614 #
Return 1 if the target supports vector nearbyint calls.
4616 proc check_effective_target_vect_call_nearbyint
{ } {
4617 global et_vect_call_nearbyint_saved
4619 if [info exists et_vect_call_nearbyint_saved
] {
4620 verbose
"check_effective_target_vect_call_nearbyint: using cached result" 2
4622 set et_vect_call_nearbyint_saved
0
4623 if { [istarget aarch64
*-*-*] } {
4624 set et_vect_call_nearbyint_saved
1
4628 verbose
"check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4629 return $et_vect_call_nearbyint_saved
4632 #
Return 1 if the target supports vector nearbyintf calls.
4634 proc check_effective_target_vect_call_nearbyintf
{ } {
4635 global et_vect_call_nearbyintf_saved
4637 if [info exists et_vect_call_nearbyintf_saved
] {
4638 verbose
"check_effective_target_vect_call_nearbyintf: using cached result" 2
4640 set et_vect_call_nearbyintf_saved
0
4641 if { [istarget aarch64
*-*-*] } {
4642 set et_vect_call_nearbyintf_saved
1
4646 verbose
"check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4647 return $et_vect_call_nearbyintf_saved
4650 #
Return 1 if the target supports vector
round calls.
4652 proc check_effective_target_vect_call_round
{ } {
4653 global et_vect_call_round_saved
4655 if [info exists et_vect_call_round_saved
] {
4656 verbose
"check_effective_target_vect_call_round: using cached result" 2
4658 set et_vect_call_round_saved
0
4659 if { [istarget aarch64
*-*-*] } {
4660 set et_vect_call_round_saved
1
4664 verbose
"check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4665 return $et_vect_call_round_saved
4668 #
Return 1 if the target supports vector roundf calls.
4670 proc check_effective_target_vect_call_roundf
{ } {
4671 global et_vect_call_roundf_saved
4673 if [info exists et_vect_call_roundf_saved
] {
4674 verbose
"check_effective_target_vect_call_roundf: using cached result" 2
4676 set et_vect_call_roundf_saved
0
4677 if { [istarget aarch64
*-*-*] } {
4678 set et_vect_call_roundf_saved
1
4682 verbose
"check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4683 return $et_vect_call_roundf_saved
4686 #
Return 1 if the target supports section
-anchors
4688 proc check_effective_target_section_anchors
{ } {
4689 global et_section_anchors_saved
4691 if [info exists et_section_anchors_saved
] {
4692 verbose
"check_effective_target_section_anchors: using cached result" 2
4694 set et_section_anchors_saved
0
4695 if { [istarget powerpc
*-*-*]
4696 ||
[istarget arm
*-*-*] } {
4697 set et_section_anchors_saved
1
4701 verbose
"check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4702 return $et_section_anchors_saved
4705 #
Return 1 if the target supports atomic operations
on "int_128" values.
4707 proc check_effective_target_sync_int_128
{ } {
4708 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4709 && ![is
-effective
-target ia32
] } {
4716 #
Return 1 if the target supports atomic operations
on "int_128" values
4717 # and can
execute them.
4719 proc check_effective_target_sync_int_128_runtime
{ } {
4720 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4721 && ![is
-effective
-target ia32
] } {
4722 return [check_cached_effective_target sync_int_128_available
{
4723 check_runtime_nocache sync_int_128_available
{
4727 unsigned
int eax
, ebx
, ecx
, edx
;
4728 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4729 return !(ecx
& bit_CMPXCHG16B
);
4739 #
Return 1 if the target supports atomic operations
on "long long".
4741 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4743 proc check_effective_target_sync_long_long
{ } {
4744 if { [istarget x86_64
-*-*]
4745 ||
[istarget i?
86-*-*])
4746 ||
[istarget aarch64
*-*-*]
4747 ||
[istarget arm
*-*-*]
4748 ||
[istarget alpha
*-*-*]
4749 ||
([istarget sparc
*-*-*] && [check_effective_target_lp64
]) } {
4756 #
Return 1 if the target supports atomic operations
on "long long"
4757 # and can
execute them.
4759 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4761 proc check_effective_target_sync_long_long_runtime
{ } {
4762 if { [istarget x86_64
-*-*]
4763 ||
[istarget i?
86-*-*] } {
4764 return [check_cached_effective_target sync_long_long_available
{
4765 check_runtime_nocache sync_long_long_available
{
4769 unsigned
int eax
, ebx
, ecx
, edx
;
4770 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4771 return !(edx
& bit_CMPXCHG8B
);
4776 } elseif
{ [istarget aarch64
*-*-*] } {
4778 } elseif
{ [istarget arm
*-*-linux
-*] } {
4779 return [check_runtime sync_longlong_runtime
{
4785 if (sizeof
(long long
) != 8)
4788 /* Just check
for native
; checking
for kernel fallback is tricky.
*/
4789 asm volatile
("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4794 } elseif
{ [istarget alpha
*-*-*] } {
4796 } elseif
{ ([istarget sparc
*-*-*]
4797 && [check_effective_target_lp64
]
4798 && [check_effective_target_ultrasparc_hw
]) } {
4800 } elseif
{ [istarget powerpc
*-*-*] && [check_effective_target_lp64
] } {
4807 #
Return 1 if the target supports atomic operations
on "int" and "long".
4809 proc check_effective_target_sync_int_long
{ } {
4810 global et_sync_int_long_saved
4812 if [info exists et_sync_int_long_saved
] {
4813 verbose
"check_effective_target_sync_int_long: using cached result" 2
4815 set et_sync_int_long_saved
0
4816 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
4817 # load-reserved/store-conditional instructions.
4818 if { [istarget ia64-*-*]
4819 || [istarget i?86-*-*]
4820 || [istarget x86_64-*-*]
4821 || [istarget aarch64*-*-*]
4822 || [istarget alpha*-*-*]
4823 || [istarget arm*-*-linux-*]
4824 || [istarget bfin*-*linux*]
4825 || [istarget hppa*-*linux*]
4826 || [istarget s390*-*-*]
4827 || [istarget powerpc*-*-*]
4828 || [istarget crisv32-*-*] || [istarget cris-*-*]
4829 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
4830 || [check_effective_target_mips_llsc] } {
4831 set et_sync_int_long_saved 1
4835 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
4836 return $et_sync_int_long_saved
4839 # Return 1 if the target supports atomic operations on "char" and "short".
4841 proc check_effective_target_sync_char_short { } {
4842 global et_sync_char_short_saved
4844 if [info exists et_sync_char_short_saved] {
4845 verbose "check_effective_target_sync_char_short: using cached result" 2
4847 set et_sync_char_short_saved 0
4848 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
4849 #
load-reserved/store
-conditional instructions.
4850 if { [istarget aarch64
*-*-*]
4851 ||
[istarget ia64
-*-*]
4852 ||
[istarget i?
86-*-*]
4853 ||
[istarget x86_64
-*-*]
4854 ||
[istarget alpha
*-*-*]
4855 ||
[istarget arm
*-*-linux
-*]
4856 ||
[istarget hppa
*-*linux
*]
4857 ||
[istarget s390
*-*-*]
4858 ||
[istarget powerpc
*-*-*]
4859 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
4860 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
4861 ||
[check_effective_target_mips_llsc
] } {
4862 set et_sync_char_short_saved
1
4866 verbose
"check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
4867 return $et_sync_char_short_saved
4870 #
Return 1 if the target uses a ColdFire FPU.
4872 proc check_effective_target_coldfire_fpu
{ } {
4873 return [check_no_compiler_messages coldfire_fpu assembly
{
4880 #
Return true
if this is a uClibc target.
4882 proc check_effective_target_uclibc
{} {
4883 return [check_no_compiler_messages uclibc object
{
4884 #
include <features.h
>
4885 #
if !defined
(__UCLIBC__
)
4891 #
Return true
if this is a uclibc target and
if the uclibc feature
4892 # described by __$feature__ is not present.
4894 proc check_missing_uclibc_feature
{feature
} {
4895 return [check_no_compiler_messages $feature object
"
4896 #
include <features.h
>
4897 #
if !defined
(__UCLIBC
) || defined
(__$
{feature
}__
)
4903 #
Return true
if this is a Newlib target.
4905 proc check_effective_target_newlib
{} {
4906 return [check_no_compiler_messages newlib object
{
4911 #
Return true
if this is NOT a Bionic target.
4913 proc check_effective_target_non_bionic
{} {
4914 return [check_no_compiler_messages non_bionic object
{
4916 #
if defined
(__BIONIC__
)
4923 #
(a
) an error of a few ULP is expected in string to floating
-point
4924 # conversion functions
; and
4925 #
(b
) overflow is not always detected correctly by those functions.
4927 proc check_effective_target_lax_strtofp
{} {
4928 # By default
, assume that all uClibc targets suffer from this.
4929 return [check_effective_target_uclibc
]
4932 #
Return 1 if this is a target
for which wcsftime is a dummy
4933 # function that always returns
0.
4935 proc check_effective_target_dummy_wcsftime
{} {
4936 # By default
, assume that all uClibc targets suffer from this.
4937 return [check_effective_target_uclibc
]
4940 #
Return 1 if constructors with initialization priority arguments are
4941 # supposed
on this target.
4943 proc check_effective_target_init_priority
{} {
4944 return [check_no_compiler_messages init_priority assembly
"
4945 void f
() __attribute__
((constructor
(1000)));
4950 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
4951 # This can be used with
any check_
* proc that takes no
argument and
4952 # returns only
1 or
0. It could be used with check_
* procs that take
4953 # arguments with keywords that pass particular arguments.
4955 proc is
-effective
-target
{ arg } {
4957 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4958 set selected
[check_effective_target_$
{arg}]
4961 "vmx_hw" { set selected [check_vmx_hw_available] }
4962 "vsx_hw" { set selected [check_vsx_hw_available] }
4963 "p8vector_hw" { set selected [check_p8vector_hw_available] }
4964 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
4965 "dfp_hw" { set selected [check_dfp_hw_available] }
4966 "named_sections" { set selected [check_named_sections_available] }
4967 "gc_sections" { set selected [check_gc_sections_available] }
4968 "cxa_atexit" { set selected [check_cxa_atexit_available] }
4969 default
{ error
"unknown effective target keyword `$arg'" }
4972 verbose
"is-effective-target: $arg $selected" 2
4976 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
4978 proc is
-effective
-target
-keyword
{ arg } {
4979 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4982 # These have different names
for their check_
* procs.
4984 "vmx_hw" { return 1 }
4985 "vsx_hw" { return 1 }
4986 "p8vector_hw" { return 1 }
4987 "ppc_recip_hw" { return 1 }
4988 "dfp_hw" { return 1 }
4989 "named_sections" { return 1 }
4990 "gc_sections" { return 1 }
4991 "cxa_atexit" { return 1 }
4992 default
{ return 0 }
4997 #
Return 1 if target default to short enums
4999 proc check_effective_target_short_enums
{ } {
5000 return [check_no_compiler_messages short_enums assembly
{
5002 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
5006 #
Return 1 if target supports merging string constants at link time.
5008 proc check_effective_target_string_merging
{ } {
5009 return [check_no_messages_and_pattern string_merging \
5010 "rodata\\.str" assembly {
5011 const char
*var
= "String";
5015 #
Return 1 if target has the basic signed and unsigned types in
5016 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
5017 # working
<stdint.h
> for all targets.
5019 proc check_effective_target_stdint_types
{ } {
5020 return [check_no_compiler_messages stdint_types assembly
{
5022 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
5023 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
5027 #
Return 1 if target has the basic signed and unsigned types in
5028 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
5029 # these types agree with those in the header, as some systems have
5030 # only <inttypes.h>.
5032 proc check_effective_target_inttypes_types { } {
5033 return [check_no_compiler_messages inttypes_types assembly {
5034 #include <inttypes.h>
5035 int8_t a; int16_t b; int32_t c; int64_t d;
5036 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
5040 # Return 1 if programs are intended to be run on a simulator
5041 # (i.e. slowly) rather than hardware (i.e. fast).
5043 proc check_effective_target_simulator { } {
5045 # All "src/sim" simulators set this one.
5046 if [board_info target exists is_simulator] {
5047 return [board_info target is_simulator]
5050 # The "sid" simulators don't
set that one
, but at least they
set
5052 if [board_info target
exists slow_simulator
] {
5053 return [board_info target slow_simulator
]
5059 #
Return 1 if programs are intended to be run
on hardware rather than
5062 proc check_effective_target_hw
{ } {
5064 # All
"src/sim" simulators set this one.
5065 if [board_info target
exists is_simulator
] {
5066 if [board_info target is_simulator
] {
5073 # The
"sid" simulators don't set that one, but at least they set
5075 if [board_info target
exists slow_simulator
] {
5076 if [board_info target slow_simulator
] {
5086 #
Return 1 if the target is a VxWorks kernel.
5088 proc check_effective_target_vxworks_kernel
{ } {
5089 return [check_no_compiler_messages vxworks_kernel assembly
{
5090 #
if !defined __vxworks || defined __RTP__
5096 #
Return 1 if the target is a VxWorks RTP.
5098 proc check_effective_target_vxworks_rtp
{ } {
5099 return [check_no_compiler_messages vxworks_rtp assembly
{
5100 #
if !defined __vxworks ||
!defined __RTP__
5106 #
Return 1 if the target is expected to provide wide character support.
5108 proc check_effective_target_wchar
{ } {
5109 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5112 return [check_no_compiler_messages wchar assembly
{
5117 #
Return 1 if the target has
<pthread.h
>.
5119 proc check_effective_target_pthread_h
{ } {
5120 return [check_no_compiler_messages pthread_h assembly
{
5121 #
include <pthread.h
>
5125 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5126 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5127 # chsize. We test
for a trivially functional truncation
; no stubs.
5128 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5129 # different function to be used.
5131 proc check_effective_target_fd_truncate { } {
5133 #define _FILE_OFFSET_BITS 64
5139 FILE *f = fopen ("tst.tmp", "wb");
5141 const char t[] = "test writing more than ten characters";
5145 write (fd, t, sizeof (t) - 1);
5147 if (ftruncate (fd, 10) != 0)
5156 f = fopen ("tst.tmp", "rb");
5157 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5165 if { [check_runtime ftruncate $prog] } {
5169 regsub "ftruncate" $prog "chsize" prog
5170 return [check_runtime chsize $prog]
5173 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5175 proc add_options_for_c99_runtime { flags } {
5176 if { [istarget *-*-solaris2*] } {
5177 return "$flags -std=c99"
5179 if { [istarget powerpc-*-darwin*] } {
5180 return "$flags -mmacosx-version-min=10.3"
5185 # Add to FLAGS all the target-specific flags needed to enable
5186 # full IEEE compliance mode.
5188 proc add_options_for_ieee { flags } {
5189 if { [istarget alpha*-*-*]
5190 || [istarget sh*-*-*] } {
5191 return "$flags -mieee"
5193 if { [istarget rx-*-*] } {
5194 return "$flags -mnofpu"
5199 # Add to FLAGS the flags needed to enable functions to bind locally
5200 # when using pic/PIC passes in the testsuite.
5202 proc add_options_for_bind_pic_locally { flags } {
5203 if {[check_no_compiler_messages using_pic2 assembly {
5208 return "$flags -fPIE"
5210 if {[check_no_compiler_messages using_pic1 assembly {
5215 return "$flags -fpie"
5221 # Add to FLAGS the flags needed to enable 64-bit vectors.
5223 proc add_options_for_double_vectors { flags } {
5224 if [is-effective-target arm_neon_ok] {
5225 return "$flags -mvectorize-with-neon-double"
5231 # Return 1 if the target provides a full C99 runtime.
5233 proc check_effective_target_c99_runtime { } {
5234 return [check_cached_effective_target c99_runtime {
5237 set file [open "$srcdir/gcc.dg/builtins-config.h"]
5238 set contents [read $file]
5241 #ifndef HAVE_C99_RUNTIME
5245 check_no_compiler_messages_nocache c99_runtime assembly \
5246 $contents [add_options_for_c99_runtime ""]
5250 # Return 1 if target wchar_t is at least 4 bytes.
5252 proc check_effective_target_4byte_wchar_t { } {
5253 return [check_no_compiler_messages 4byte_wchar_t object {
5254 int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
5258 # Return 1 if the target supports automatic stack alignment.
5260 proc check_effective_target_automatic_stack_alignment { } {
5261 # Ordinarily x86 supports automatic stack alignment ...
5262 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
5263 if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
5264 # ... except Win64 SEH doesn't. Succeed
for Win32 though.
5265 return [check_effective_target_ilp32
];
5272 #
Return true
if we are compiling
for AVX target.
5274 proc check_avx_available
{ } {
5275 if { [check_no_compiler_messages avx_available assembly
{
5285 #
Return true
if 32- and
16-bytes vectors are available.
5287 proc check_effective_target_vect_sizes_32B_16B
{ } {
5288 if { [check_avx_available
] && ![check_prefer_avx128
] } {
5295 #
Return true
if 128-bits vectors are preferred even
if 256-bits vectors
5298 proc check_prefer_avx128
{ } {
5299 if ![check_avx_available
] {
5302 return [check_no_messages_and_pattern avx_explicit
"xmm" assembly {
5303 float a
[1024],b
[1024],c
[1024];
5304 void foo
(void
) { int i
; for (i
= 0; i
< 1024; i
++) a
[i
]=b
[i
]+c
[i
];}
5305 } "-O2 -ftree-vectorize"]
5309 #
Return 1 if avx512f instructions can be compiled.
5311 proc check_effective_target_avx512f
{ } {
5312 return [check_no_compiler_messages avx512f object
{
5313 typedef double __m512d __attribute__
((__vector_size__
(64)));
5315 __m512d _mm512_add
(__m512d a
)
5317 return __builtin_ia32_addpd512_mask
(a
, a
, a
, 1, 4);
5322 #
Return 1 if avx instructions can be compiled.
5324 proc check_effective_target_avx
{ } {
5325 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
5328 return [check_no_compiler_messages avx object
{
5329 void _mm256_zeroall
(void
)
5331 __builtin_ia32_vzeroall
();
5336 #
Return 1 if avx2 instructions can be compiled.
5337 proc check_effective_target_avx2
{ } {
5338 return [check_no_compiler_messages avx2 object
{
5339 typedef long long __v4di __attribute__
((__vector_size__
(32)));
5341 mm256_is32_andnotsi256
(__v4di __X
, __v4di __Y
)
5343 return __builtin_ia32_andnotsi256
(__X
, __Y
);
5348 #
Return 1 if sse instructions can be compiled.
5349 proc check_effective_target_sse
{ } {
5350 return [check_no_compiler_messages sse object
{
5353 __builtin_ia32_stmxcsr
();
5359 #
Return 1 if sse2 instructions can be compiled.
5360 proc check_effective_target_sse2
{ } {
5361 return [check_no_compiler_messages sse2 object
{
5362 typedef long long __m128i __attribute__
((__vector_size__
(16)));
5364 __m128i _mm_srli_si128
(__m128i __A
, int __N
)
5366 return (__m128i
)__builtin_ia32_psrldqi128
(__A
, 8);
5371 #
Return 1 if F16C instructions can be compiled.
5373 proc check_effective_target_f16c
{ } {
5374 return [check_no_compiler_messages f16c object
{
5375 #
include "immintrin.h"
5377 foo
(unsigned short val
)
5379 return _cvtsh_ss
(val
);
5384 #
Return 1 if C wchar_t type is compatible with char16_t.
5386 proc check_effective_target_wchar_t_char16_t_compatible
{ } {
5387 return [check_no_compiler_messages wchar_t_char16_t object
{
5389 __CHAR16_TYPE__
*p16
= &wc
;
5390 char t
[(((__CHAR16_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
5394 #
Return 1 if C wchar_t type is compatible with char32_t.
5396 proc check_effective_target_wchar_t_char32_t_compatible
{ } {
5397 return [check_no_compiler_messages wchar_t_char32_t object
{
5399 __CHAR32_TYPE__
*p32
= &wc
;
5400 char t
[(((__CHAR32_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
5404 #
Return 1 if pow10 function
exists.
5406 proc check_effective_target_pow10
{ } {
5407 return [check_runtime pow10
{
5417 #
Return 1 if current options generate DFP instructions
, 0 otherwise.
5419 proc check_effective_target_hard_dfp
{} {
5420 return [check_no_messages_and_pattern hard_dfp
"!adddd3" assembly {
5421 typedef float d64 __attribute__
((mode(DD
)));
5423 void foo
(void
) { z
= x
+ y
; }
5427 #
Return 1 if string.h and wchar.h headers provide C
++ requires overloads
5428 #
for strchr etc. functions.
5430 proc check_effective_target_correct_iso_cpp_string_wchar_protos
{ } {
5431 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly
{
5434 #
if !defined
(__cplusplus
) \
5435 ||
!defined
(__CORRECT_ISO_CPP_STRING_H_PROTO
) \
5436 ||
!defined
(__CORRECT_ISO_CPP_WCHAR_H_PROTO
)
5437 ISO C
++ correct string.h and wchar.h protos not supported.
5444 #
Return 1 if GNU as is used.
5446 proc check_effective_target_gas
{ } {
5447 global use_gas_saved
5450 if {![info exists use_gas_saved
]} {
5451 # Check
if the as used by gcc is GNU as.
5452 set gcc_as
[lindex
[$
{tool
}_target_compile
"-print-prog-name=as" "" "none" ""] 0]
5453 # Provide
/dev
/null as input
, otherwise gas times out reading from
5455 set status [remote_exec host
"$gcc_as" "-v /dev/null"]
5456 set as_output
[lindex $
status 1]
5457 if { [ string first
"GNU" $as_output ] >= 0 } {
5463 return $use_gas_saved
5466 #
Return 1 if GNU
ld is used.
5468 proc check_effective_target_gld
{ } {
5469 global use_gld_saved
5472 if {![info exists use_gld_saved
]} {
5473 # Check
if the
ld used by gcc is GNU
ld.
5474 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=ld" "" "none" ""] 0]
5475 set status [remote_exec host
"$gcc_ld" "--version"]
5476 set ld_output
[lindex $
status 1]
5477 if { [ string first
"GNU" $ld_output ] >= 0 } {
5483 return $use_gld_saved
5486 #
Return 1 if the compiler has been configure with link
-time optimization
5489 proc check_effective_target_lto
{ } {
5491 return [info exists ENABLE_LTO
]
5494 #
Return 1 if -mx32
-maddress
-mode=short can
compile, 0 otherwise.
5496 proc check_effective_target_maybe_x32
{ } {
5497 return [check_no_compiler_messages maybe_x32 object
{
5499 } "-mx32 -maddress-mode=short"]
5502 #
Return 1 if this target supports the
-fsplit
-stack option
, 0
5505 proc check_effective_target_split_stack
{} {
5506 return [check_no_compiler_messages split_stack object
{
5511 #
Return 1 if this target supports the
-masm
=intel option
, 0
5514 proc check_effective_target_masm_intel
{} {
5515 return [check_no_compiler_messages masm_intel object
{
5516 extern void abort
(void
);
5520 #
Return 1 if the language
for the compiler under test is C.
5522 proc check_effective_target_c
{ } {
5524 if [string match $tool
"gcc"] {
5530 #
Return 1 if the language
for the compiler under test is C
++.
5532 proc check_effective_target_c
++ { } {
5534 if [string match $tool
"g++"] {
5540 # Check whether the current active language standard supports the features
5541 # of C
++11/C
++1y by checking
for the presence of one of the
-std
5542 # flags. This assumes that the default
for the compiler is C
++98, and that
5543 # there will never be multiple
-std
= arguments
on the command line.
5544 proc check_effective_target_c
++11_only
{ } {
5545 if ![check_effective_target_c
++] {
5548 return [check
-flags
{ { } { } { -std
=c
++0x
-std
=gnu
++0x
-std
=c
++11 -std
=gnu
++11 } }]
5550 proc check_effective_target_c
++11 { } {
5551 if [check_effective_target_c
++11_only
] {
5554 return [check_effective_target_c
++1y
]
5556 proc check_effective_target_c
++11_down
{ } {
5557 if ![check_effective_target_c
++] {
5560 return ![check_effective_target_c
++1y
]
5563 proc check_effective_target_c
++1y_only
{ } {
5564 if ![check_effective_target_c
++] {
5567 return [check
-flags
{ { } { } { -std
=c
++1y
-std
=gnu
++1y
-std
=c
++14 -std
=gnu
++14 } }]
5569 proc check_effective_target_c
++1y
{ } {
5570 return [check_effective_target_c
++1y_only
]
5573 proc check_effective_target_c
++98_only
{ } {
5574 if ![check_effective_target_c
++] {
5577 return ![check_effective_target_c
++11]
5580 #
Return 1 if expensive testcases should be run.
5582 proc check_effective_target_run_expensive_tests
{ } {
5583 if { [getenv GCC_TEST_RUN_EXPENSIVE
] != "" } {
5589 # Returns
1 if "mempcpy" is available on the target system.
5591 proc check_effective_target_mempcpy
{} {
5592 return [check_function_available
"mempcpy"]
5595 # Check whether the vectorizer tests are supported by the target and
5596 # append additional target
-dependent
compile flags to DEFAULT_VECTCFLAGS.
5597 #
Set dg
-do-what
-default to either
compile or run
, depending
on target
5598 # capabilities.
Return 1 if vectorizer tests are supported by
5599 # target
, 0 otherwise.
5601 proc check_vect_support_and_set_flags
{ } {
5602 global DEFAULT_VECTCFLAGS
5603 global dg
-do-what
-default
5605 if [istarget powerpc
-*paired
*] {
5606 lappend DEFAULT_VECTCFLAGS
"-mpaired"
5607 if [check_750cl_hw_available
] {
5608 set dg
-do-what
-default run
5610 set dg
-do-what
-default
compile
5612 } elseif
[istarget powerpc
*-*-*] {
5613 # Skip targets not supporting
-maltivec.
5614 if ![is
-effective
-target powerpc_altivec_ok
] {
5618 lappend DEFAULT_VECTCFLAGS
"-maltivec"
5619 if [check_p8vector_hw_available
] {
5620 lappend DEFAULT_VECTCFLAGS
"-mpower8-vector" "-mno-allow-movmisalign"
5621 } elseif
[check_vsx_hw_available
] {
5622 lappend DEFAULT_VECTCFLAGS
"-mvsx" "-mno-allow-movmisalign"
5625 if [check_vmx_hw_available
] {
5626 set dg
-do-what
-default run
5628 if [is
-effective
-target ilp32
] {
5629 # Specify a cpu that supports VMX
for compile-only tests.
5630 lappend DEFAULT_VECTCFLAGS
"-mcpu=970"
5632 set dg
-do-what
-default
compile
5634 } elseif
{ [istarget spu
-*-*] } {
5635 set dg
-do-what
-default run
5636 } elseif
{ [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
5637 lappend DEFAULT_VECTCFLAGS
"-msse2"
5638 if { [check_effective_target_sse2_runtime
] } {
5639 set dg
-do-what
-default run
5641 set dg
-do-what
-default
compile
5643 } elseif
{ [istarget mips
*-*-*]
5644 && ([check_effective_target_mpaired_single
]
5645 ||
[check_effective_target_mips_loongson
])
5646 && [check_effective_target_nomips16
] } {
5647 if { [check_effective_target_mpaired_single
] } {
5648 lappend DEFAULT_VECTCFLAGS
"-mpaired-single"
5650 set dg
-do-what
-default run
5651 } elseif
[istarget sparc
*-*-*] {
5652 lappend DEFAULT_VECTCFLAGS
"-mcpu=ultrasparc" "-mvis"
5653 if [check_effective_target_ultrasparc_hw
] {
5654 set dg
-do-what
-default run
5656 set dg
-do-what
-default
compile
5658 } elseif
[istarget alpha
*-*-*] {
5659 # Alpha
's vectorization capabilities are extremely limited.
5660 # It's more effort than its worth disabling all of the tests
5661 # that it cannot pass. But
if you actually want to see what
5662 # does work
, command out the
return.
5665 lappend DEFAULT_VECTCFLAGS
"-mmax"
5666 if [check_alpha_max_hw_available
] {
5667 set dg
-do-what
-default run
5669 set dg
-do-what
-default
compile
5671 } elseif
[istarget ia64
-*-*] {
5672 set dg
-do-what
-default run
5673 } elseif
[is
-effective
-target arm_neon_ok
] {
5674 eval lappend DEFAULT_VECTCFLAGS
[add_options_for_arm_neon
""]
5675 # NEON does not support denormals
, so is not used
for vectorization by
5676 # default to avoid loss of precision. We must pass
-ffast
-math to test
5677 # vectorization of float operations.
5678 lappend DEFAULT_VECTCFLAGS
"-ffast-math"
5679 if [is
-effective
-target arm_neon_hw
] {
5680 set dg
-do-what
-default run
5682 set dg
-do-what
-default
compile
5684 } elseif
[istarget
"aarch64*-*-*"] {
5685 set dg
-do-what
-default run
5693 proc check_effective_target_non_strict_align
{} {
5694 return [check_no_compiler_messages non_strict_align assembly
{
5696 typedef char __attribute__
((__aligned__
(__BIGGEST_ALIGNMENT__
))) c
;
5698 void foo
(void
) { z
= (c
*) y
; }
5702 #
Return 1 if the target has
<ucontext.h
>.
5704 proc check_effective_target_ucontext_h
{ } {
5705 return [check_no_compiler_messages ucontext_h assembly
{
5706 #
include <ucontext.h
>
5710 proc check_effective_target_aarch64_tiny
{ } {
5711 if { [istarget aarch64
*-*-*] } {
5712 return [check_no_compiler_messages aarch64_tiny object
{
5713 #ifdef __AARCH64_CMODEL_TINY__
5716 #error target not AArch64 tiny code
model
5724 proc check_effective_target_aarch64_small
{ } {
5725 if { [istarget aarch64
*-*-*] } {
5726 return [check_no_compiler_messages aarch64_small object
{
5727 #ifdef __AARCH64_CMODEL_SMALL__
5730 #error target not AArch64 small code
model
5738 proc check_effective_target_aarch64_large
{ } {
5739 if { [istarget aarch64
*-*-*] } {
5740 return [check_no_compiler_messages aarch64_large object
{
5741 #ifdef __AARCH64_CMODEL_LARGE__
5744 #error target not AArch64 large code
model
5752 #
Return 1 if <fenv.h
> is available with all the standard IEEE
5753 # exceptions and floating
-point exceptions are raised by arithmetic
5754 # operations.
(If the target requires special options
for "inexact"
5755 # exceptions
, those need to be specified in the testcases.
)
5757 proc check_effective_target_fenv_exceptions
{} {
5758 return [check_runtime fenv_exceptions
{
5761 #ifndef FE_DIVBYZERO
5762 # error Missing FE_DIVBYZERO
5765 # error Missing FE_INEXACT
5768 # error Missing FE_INVALID
5771 # error Missing FE_OVERFLOW
5773 #ifndef FE_UNDERFLOW
5774 # error Missing FE_UNDERFLOW
5776 volatile float a
= 0.0f
, r
;
5781 if (fetestexcept
(FE_INVALID
))
5789 #
Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is
set to
0 for the current target.
5791 proc check_effective_target_logical_op_short_circuit
{} {
5792 if { [istarget mips
*-*-*]
5793 ||
[istarget arc
*-*-*]
5794 ||
[istarget avr
*-*-*]
5795 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
5796 ||
[istarget mmix
-*-*]
5797 ||
[istarget s390
*-*-*]
5798 ||
[check_effective_target_arm_cortex_m
] } {
5804 # Record that dg
-final test TEST requires convential compilation.
5806 proc force_conventional_output_for
{ test
} {
5807 if { [info proc $test
] == "" } {
5808 perror
"$test does not exist"
5811 proc $
{test
}_required_options
{} {
5812 global gcc_force_conventional_output
5813 return $gcc_force_conventional_output