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 *-*-solaris2.9*] || [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_function_available "dlopen"]
752 # Return 1 if the target supports clone, 0 otherwise.
753 proc check_effective_target_clone {} {
754 return [check_function_available "clone"]
757 # Return 1 if the target supports setrlimit, 0 otherwise.
758 proc check_effective_target_setrlimit {} {
759 # Darwin has non-posix compliant RLIMIT_AS
760 if { [istarget *-*-darwin*] } {
763 return [check_function_available "setrlimit"]
766 # Return 1 if the target supports swapcontext, 0 otherwise.
767 proc check_effective_target_swapcontext {} {
768 return [check_no_compiler_messages swapcontext executable {
769 #include <ucontext.h>
772 ucontext_t orig_context,child_context;
773 if (swapcontext(&child_context, &orig_context) < 0) { }
778 # Return 1 if compilation with -pthread is error-free for trivial
781 proc check_effective_target_pthread {} {
782 return [check_no_compiler_messages pthread object {
787 # Return 1 if compilation with -mpe-aligned-commons is error-free
788 # for trivial code, 0 otherwise.
790 proc check_effective_target_pe_aligned_commons {} {
791 if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
792 return [check_no_compiler_messages pe_aligned_commons object {
794 } "-mpe-aligned-commons"]
799 # Return 1 if the target supports -static
800 proc check_effective_target_static {} {
801 return [check_no_compiler_messages static executable {
802 int main (void) { return 0; }
806 # Return 1 if the target supports -fstack-protector
807 proc check_effective_target_fstack_protector {} {
808 return [check_runtime fstack_protector {
809 int main (void) { return 0; }
810 } "-fstack-protector"]
813 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
814 # for trivial code, 0 otherwise.
816 proc check_effective_target_freorder {} {
817 return [check_no_compiler_messages freorder object {
819 } "-freorder-blocks-and-partition"]
822 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
823 # emitted, 0 otherwise. Whether a shared library can actually be built is
824 # out of scope for this test.
826 proc check_effective_target_fpic { } {
827 # Note that M68K has a multilib that supports -fpic but not
828 # -fPIC, so we need to check both. We test with a program that
829 # requires GOT references.
830 foreach arg {fpic fPIC} {
831 if [check_no_compiler_messages $arg object {
832 extern int foo (void); extern int bar;
833 int baz (void) { return foo () + bar; }
841 # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
843 proc check_effective_target_pie { } {
844 if { [istarget *-*-darwin\[912\]*]
845 || [istarget *-*-linux*]
846 || [istarget *-*-gnu*] } {
852 # Return true if the target supports -mpaired-single (as used on MIPS).
854 proc check_effective_target_mpaired_single { } {
855 return [check_no_compiler_messages mpaired_single object {
860 # Return true if the target has access to FPU instructions.
862 proc check_effective_target_hard_float { } {
863 if { [istarget mips*-*-*] } {
864 return [check_no_compiler_messages hard_float assembly {
865 #if (defined __mips_soft_float || defined __mips16)
871 # This proc is actually checking the availabilty of FPU
872 # support for doubles, so on the RX we must fail if the
873 # 64-bit double multilib has been selected.
874 if { [istarget rx-*-*] } {
876 # return [check_no_compiler_messages hard_float assembly {
877 #if defined __RX_64_BIT_DOUBLES__
883 # The generic test equates hard_float with "no call for adding doubles".
884 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
885 double a (double b, double c) { return b + c; }
889 # Return true if the target is a 64-bit MIPS target.
891 proc check_effective_target_mips64 { } {
892 return [check_no_compiler_messages mips64 assembly {
899 # Return true if the target is a MIPS target that does not produce
902 proc check_effective_target_nomips16 { } {
903 return [check_no_compiler_messages nomips16 object {
907 /* A cheap way of testing for -mflip-mips16. */
908 void foo (void) { asm ("addiu $20,$20,1"); }
909 void bar (void) { asm ("addiu $20,$20,1"); }
914 # Add the options needed for MIPS16 function attributes. At the moment,
915 # we don't support MIPS16 PIC.
917 proc add_options_for_mips16_attribute
{ flags
} {
918 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
921 #
Return true
if we can force a
mode that allows MIPS16 code generation.
922 # We don
't support MIPS16 PIC, and only support MIPS16 -mhard-float
925 proc check_effective_target_mips16_attribute { } {
926 return [check_no_compiler_messages mips16_attribute assembly {
930 #if defined __mips_hard_float \
931 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
932 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
935 } [add_options_for_mips16_attribute ""]]
938 # Return 1 if the target supports long double larger than double when
939 # using the new ABI, 0 otherwise.
941 proc check_effective_target_mips_newabi_large_long_double { } {
942 return [check_no_compiler_messages mips_newabi_large_long_double object {
943 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
947 # Return true if the target is a MIPS target that has access
948 # to the LL and SC instructions.
950 proc check_effective_target_mips_llsc { } {
951 if { ![istarget mips*-*-*] } {
954 # Assume that these instructions are always implemented for
955 # non-elf* targets, via emulation if necessary.
956 if { ![istarget *-*-elf*] } {
959 # Otherwise assume LL/SC support for everything but MIPS I.
960 return [check_no_compiler_messages mips_llsc assembly {
967 # Return true if the target is a MIPS target that uses in-place relocations.
969 proc check_effective_target_mips_rel { } {
970 if { ![istarget mips*-*-*] } {
973 return [check_no_compiler_messages mips_rel object {
974 #if (defined _ABIN32 && _MIPS_SIM == _ABIN32) \
975 || (defined _ABI64 && _MIPS_SIM == _ABI64)
981 # Return true if the target is a MIPS target that uses the EABI.
983 proc check_effective_target_mips_eabi { } {
984 if { ![istarget mips*-*-*] } {
987 return [check_no_compiler_messages mips_eabi object {
994 # Return 1 if the current multilib does not generate PIC by default.
996 proc check_effective_target_nonpic { } {
997 return [check_no_compiler_messages nonpic assembly {
1004 # Return 1 if the target does not use a status wrapper.
1006 proc check_effective_target_unwrapped { } {
1007 if { [target_info needs_status_wrapper] != "" \
1008 && [target_info needs_status_wrapper] != "0" } {
1014 # Return true if iconv is supported on the target. In particular IBM1047.
1016 proc check_iconv_available { test_what } {
1019 # If the tool configuration file has not set libiconv, try "-liconv"
1020 if { ![info exists libiconv] } {
1021 set libiconv "-liconv"
1023 set test_what [lindex $test_what 1]
1024 return [check_runtime_nocache $test_what [subst {
1030 cd = iconv_open ("$test_what", "UTF-8");
1031 if (cd == (iconv_t) -1)
1038 # Return true if Cilk Library is supported on the target.
1039 proc check_libcilkrts_available { } {
1040 return [ check_no_compiler_messages_nocache libcilkrts_available executable {
1044 int __cilkrts_set_param (const char *, const char *);
1046 int x = __cilkrts_set_param ("nworkers", "0");
1049 } "-fcilkplus -lcilkrts" ]
1052 # Return 1 if an ASCII locale is supported on this host, 0 otherwise.
1054 proc check_ascii_locale_available { } {
1058 # Return true if named sections are supported on this target.
1060 proc check_named_sections_available { } {
1061 return [check_no_compiler_messages named_sections assembly {
1062 int __attribute__ ((section("whatever"))) foo;
1066 # Return true if the "naked" function attribute is supported on this target.
1068 proc check_effective_target_naked_functions { } {
1069 return [check_no_compiler_messages naked_functions assembly {
1070 void f() __attribute__((naked));
1074 # Return 1 if the target supports Fortran real kinds larger than real(8),
1077 # When the target name changes, replace the cached result.
1079 proc check_effective_target_fortran_large_real { } {
1080 return [check_no_compiler_messages fortran_large_real executable {
1082 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
1089 # Return 1 if the target supports Fortran real kind real(16),
1090 # 0 otherwise. Contrary to check_effective_target_fortran_large_real
1091 # this checks for Real(16) only; the other returned real(10) if
1092 # both real(10) and real(16) are available.
1094 # When the target name changes, replace the cached result.
1096 proc check_effective_target_fortran_real_16 { } {
1097 return [check_no_compiler_messages fortran_real_16 executable {
1106 # Return 1 if the target supports SQRT for the largest floating-point
1107 # type. (Some targets lack the libm support for this FP type.)
1108 # On most targets, this check effectively checks either whether sqrtl is
1109 # available or on __float128 systems whether libquadmath is installed,
1110 # which provides sqrtq.
1112 # When the target name changes, replace the cached result.
1114 proc check_effective_target_fortran_largest_fp_has_sqrt { } {
1115 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
1117 use iso_fortran_env, only: real_kinds
1118 integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
1119 real(kind=maxFP), volatile :: x
1127 # Return 1 if the target supports Fortran integer kinds larger than
1128 # integer(8), 0 otherwise.
1130 # When the target name changes, replace the cached result.
1132 proc check_effective_target_fortran_large_int { } {
1133 return [check_no_compiler_messages fortran_large_int executable {
1135 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
1136 integer(kind=k) :: i
1141 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
1143 # When the target name changes, replace the cached result.
1145 proc check_effective_target_fortran_integer_16 { } {
1146 return [check_no_compiler_messages fortran_integer_16 executable {
1153 # Return 1 if we can statically link libgfortran, 0 otherwise.
1155 # When the target name changes, replace the cached result.
1157 proc check_effective_target_static_libgfortran { } {
1158 return [check_no_compiler_messages static_libgfortran executable {
1165 # Return 1 if cilk-plus is supported by the target, 0 otherwise.
1167 proc check_effective_target_cilkplus { } {
1168 # Skip cilk-plus tests on int16 and size16 targets for now.
1169 # The cilk-plus tests are not generic enough to cover these
1170 # cases and would throw hundreds of FAILs.
1171 if { [check_effective_target_int16]
1172 || ![check_effective_target_size32plus] } {
1176 # Skip AVR, its RAM is too small and too many tests would fail.
1177 if { [istarget avr-*-*] } {
1183 proc check_linker_plugin_available { } {
1184 return [check_no_compiler_messages_nocache linker_plugin executable {
1185 int main() { return 0; }
1186 } "-flto -fuse-linker-plugin"]
1189 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1190 # otherwise. Cache the result.
1192 proc check_750cl_hw_available { } {
1193 return [check_cached_effective_target 750cl_hw_available {
1194 # If this is not the right target then we can skip the test.
1195 if { ![istarget powerpc-*paired*] } {
1198 check_runtime_nocache 750cl_hw_available {
1202 asm volatile ("ps_mul v0,v0,v0");
1204 asm volatile ("ps_mul 0,0,0");
1213 # Return 1 if the target OS supports running SSE executables, 0
1214 # otherwise. Cache the result.
1216 proc check_sse_os_support_available { } {
1217 return [check_cached_effective_target sse_os_support_available {
1218 # If this is not the right target then we can skip the test.
1219 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1221 } elseif { [istarget i?86-*-solaris2*] } {
1222 # The Solaris 2 kernel doesn't save and restore SSE registers
1223 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1224 check_runtime_nocache sse_os_support_available
{
1227 asm volatile
("movaps %xmm0,%xmm0");
1237 #
Return 1 if the target OS supports running AVX executables
, 0
1238 # otherwise.
Cache the result.
1240 proc check_avx_os_support_available
{ } {
1241 return [check_cached_effective_target avx_os_support_available
{
1242 #
If this is not the right target
then we can skip the test.
1243 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1246 # Check that OS has AVX and SSE saving enabled.
1247 check_runtime_nocache avx_os_support_available
{
1250 unsigned
int eax
, edx
;
1252 asm
("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1253 return (eax
& 6) != 6;
1260 #
Return 1 if the target supports executing SSE instructions
, 0
1261 # otherwise.
Cache the result.
1263 proc check_sse_hw_available
{ } {
1264 return [check_cached_effective_target sse_hw_available
{
1265 #
If this is not the right target
then we can skip the test.
1266 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1269 check_runtime_nocache sse_hw_available
{
1273 unsigned
int eax
, ebx
, ecx
, edx
;
1274 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1275 return !(edx
& bit_SSE
);
1283 #
Return 1 if the target supports executing SSE2 instructions
, 0
1284 # otherwise.
Cache the result.
1286 proc check_sse2_hw_available
{ } {
1287 return [check_cached_effective_target sse2_hw_available
{
1288 #
If this is not the right target
then we can skip the test.
1289 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1292 check_runtime_nocache sse2_hw_available
{
1296 unsigned
int eax
, ebx
, ecx
, edx
;
1297 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1298 return !(edx
& bit_SSE2
);
1306 #
Return 1 if the target supports executing AVX instructions
, 0
1307 # otherwise.
Cache the result.
1309 proc check_avx_hw_available
{ } {
1310 return [check_cached_effective_target avx_hw_available
{
1311 #
If this is not the right target
then we can skip the test.
1312 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1315 check_runtime_nocache avx_hw_available
{
1319 unsigned
int eax
, ebx
, ecx
, edx
;
1320 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1321 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1322 != (bit_AVX | bit_OSXSAVE
));
1330 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1332 proc check_effective_target_sse_runtime
{ } {
1333 if { [check_effective_target_sse
]
1334 && [check_sse_hw_available
]
1335 && [check_sse_os_support_available
] } {
1341 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1343 proc check_effective_target_sse2_runtime
{ } {
1344 if { [check_effective_target_sse2
]
1345 && [check_sse2_hw_available
]
1346 && [check_sse_os_support_available
] } {
1352 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1354 proc check_effective_target_avx_runtime
{ } {
1355 if { [check_effective_target_avx
]
1356 && [check_avx_hw_available
]
1357 && [check_avx_os_support_available
] } {
1363 #
Return 1 if the target supports executing power8 vector instructions
, 0
1364 # otherwise.
Cache the result.
1366 proc check_p8vector_hw_available
{ } {
1367 return [check_cached_effective_target p8vector_hw_available
{
1368 # Some simulators are known to not support VSX
/power8 instructions.
1369 #
For now
, disable
on Darwin
1370 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1373 set options
"-mpower8-vector"
1374 check_runtime_nocache p8vector_hw_available
{
1378 asm volatile
("xxlorc vs0,vs0,vs0");
1380 asm volatile
("xxlorc 0,0,0");
1389 #
Return 1 if the target supports executing VSX instructions
, 0
1390 # otherwise.
Cache the result.
1392 proc check_vsx_hw_available
{ } {
1393 return [check_cached_effective_target vsx_hw_available
{
1394 # Some simulators are known to not support VSX instructions.
1395 #
For now
, disable
on Darwin
1396 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1400 check_runtime_nocache vsx_hw_available
{
1404 asm volatile
("xxlor vs0,vs0,vs0");
1406 asm volatile
("xxlor 0,0,0");
1415 #
Return 1 if the target supports executing AltiVec instructions
, 0
1416 # otherwise.
Cache the result.
1418 proc check_vmx_hw_available
{ } {
1419 return [check_cached_effective_target vmx_hw_available
{
1420 # Some simulators are known to not support VMX instructions.
1421 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1424 # Most targets don
't require special flags for this test case, but
1425 # Darwin does. Just to be sure, make sure VSX is not enabled for
1426 # the altivec tests.
1427 if { [istarget *-*-darwin*]
1428 || [istarget *-*-aix*] } {
1429 set options "-maltivec -mno-vsx"
1431 set options "-mno-vsx"
1433 check_runtime_nocache vmx_hw_available {
1437 asm volatile ("vor v0,v0,v0");
1439 asm volatile ("vor 0,0,0");
1448 proc check_ppc_recip_hw_available { } {
1449 return [check_cached_effective_target ppc_recip_hw_available {
1450 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1451 # For now, disable on Darwin
1452 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1455 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1456 check_runtime_nocache ppc_recip_hw_available {
1457 volatile double d_recip, d_rsqrt, d_four = 4.0;
1458 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1461 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1462 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1463 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1464 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1472 # Return 1 if the target supports executing AltiVec and Cell PPU
1473 # instructions, 0 otherwise. Cache the result.
1475 proc check_effective_target_cell_hw { } {
1476 return [check_cached_effective_target cell_hw_available {
1477 # Some simulators are known to not support VMX and PPU instructions.
1478 if { [istarget powerpc-*-eabi*] } {
1481 # Most targets don't require special flags
for this test
1482 # case
, but Darwin and AIX
do.
1483 if { [istarget
*-*-darwin
*]
1484 ||
[istarget
*-*-aix
*] } {
1485 set options
"-maltivec -mcpu=cell"
1487 set options
"-mcpu=cell"
1489 check_runtime_nocache cell_hw_available
{
1493 asm volatile
("vor v0,v0,v0");
1494 asm volatile
("lvlx v0,r0,r0");
1496 asm volatile
("vor 0,0,0");
1497 asm volatile
("lvlx 0,0,0");
1506 #
Return 1 if the target supports executing
64-bit instructions
, 0
1507 # otherwise.
Cache the result.
1509 proc check_effective_target_powerpc64
{ } {
1510 global powerpc64_available_saved
1513 if [info exists powerpc64_available_saved
] {
1514 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1516 set powerpc64_available_saved
0
1518 # Some simulators are known to not support powerpc64 instructions.
1519 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1520 verbose
"check_effective_target_powerpc64 returning 0" 2
1521 return $powerpc64_available_saved
1524 #
Set up
, compile, and
execute a test
program containing a
64-bit
1525 # instruction.
Include the current process ID in the file
1526 # names to prevent conflicts with invocations
for multiple
1531 set f
[open $src
"w"]
1532 puts $f
"int main() {"
1533 puts $f
"#ifdef __MACH__"
1534 puts $f
" asm volatile (\"extsw r0,r0\");"
1536 puts $f
" asm volatile (\"extsw 0,0\");"
1538 puts $f
" return 0; }"
1541 set opts
"additional_flags=-mcpu=G5"
1543 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1544 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1547 if [string match
"" $lines] then {
1548 # No error message
, compilation succeeded.
1549 set result
[$
{tool
}_load
"./$exe" "" ""]
1550 set status [lindex $result
0]
1551 remote_file build
delete $exe
1552 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1554 if { $
status == "pass" } then {
1555 set powerpc64_available_saved
1
1558 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1562 return $powerpc64_available_saved
1565 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1566 # complex float arguments. This affects gfortran tests that
call cabsf
1567 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1568 #
argument passing as the compiler under test
, 0 otherwise.
1570 # When the target
name changes
, replace the cached result.
1572 proc check_effective_target_broken_cplxf_arg
{ } {
1573 return [check_cached_effective_target broken_cplxf_arg
{
1574 # Skip the work
for targets known not to be affected.
1575 if { ![istarget powerpc64
-*-linux
*] } {
1577 } elseif
{ ![is
-effective
-target lp64
] } {
1580 check_runtime_nocache broken_cplxf_arg
{
1581 #
include <complex.h
>
1582 extern void abort
(void
);
1583 float fabsf
(float
);
1584 float cabsf
(_Complex float
);
1591 if (fabsf
(f
- 5.0) > 0.0001)
1600 #
Return 1 is this is a TI C6X target supporting C67X instructions
1601 proc check_effective_target_ti_c67x
{ } {
1602 return [check_no_compiler_messages ti_c67x assembly
{
1603 #
if !defined
(_TMS320C6700
)
1609 #
Return 1 is this is a TI C6X target supporting C64X
+ instructions
1610 proc check_effective_target_ti_c64xp
{ } {
1611 return [check_no_compiler_messages ti_c64xp assembly
{
1612 #
if !defined
(_TMS320C6400_PLUS
)
1619 proc check_alpha_max_hw_available
{ } {
1620 return [check_runtime alpha_max_hw_available
{
1621 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1625 # Returns true iff the FUNCTION is available
on the target
system.
1626 #
(This is essentially a Tcl implementation of Autoconf
's
1629 proc check_function_available { function } {
1630 return [check_no_compiler_messages ${function}_available \
1636 int main () { $function (); }
1640 # Returns true iff "fork" is available on the target system.
1642 proc check_fork_available {} {
1643 return [check_function_available "fork"]
1646 # Returns true iff "mkfifo" is available on the target system.
1648 proc check_mkfifo_available {} {
1649 if { [istarget *-*-cygwin*] } {
1650 # Cygwin has mkfifo, but support is incomplete.
1654 return [check_function_available "mkfifo"]
1657 # Returns true iff "__cxa_atexit" is used on the target system.
1659 proc check_cxa_atexit_available { } {
1660 return [check_cached_effective_target cxa_atexit_available {
1661 if { [istarget hppa*-*-hpux10*] } {
1662 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1664 } elseif
{ [istarget
*-*-vxworks
] } {
1665 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1668 check_runtime_nocache cxa_atexit_available {
1671 static unsigned int count;
1688 Y() { f(); count = 2; }
1697 int main() { return 0; }
1703 proc check_effective_target_objc2 { } {
1704 return [check_no_compiler_messages objc2 object {
1713 proc check_effective_target_next_runtime { } {
1714 return [check_no_compiler_messages objc2 object {
1715 #ifdef __NEXT_RUNTIME__
1723 # Return 1 if we're generating
32-bit code using default options
, 0
1726 proc check_effective_target_ilp32
{ } {
1727 return [check_no_compiler_messages ilp32 object
{
1728 int dummy
[sizeof
(int) == 4
1729 && sizeof
(void
*) == 4
1730 && sizeof
(long
) == 4 ?
1 : -1];
1734 #
Return 1 if we
're generating ia32 code using default options, 0
1737 proc check_effective_target_ia32 { } {
1738 return [check_no_compiler_messages ia32 object {
1739 int dummy[sizeof (int) == 4
1740 && sizeof (void *) == 4
1741 && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
1745 # Return 1 if we're generating x32 code using default options
, 0
1748 proc check_effective_target_x32
{ } {
1749 return [check_no_compiler_messages x32 object
{
1750 int dummy
[sizeof
(int) == 4
1751 && sizeof
(void
*) == 4
1752 && sizeof
(long
) == 4 ?
1 : -1] = { __x86_64__
};
1756 #
Return 1 if we
're generating 32-bit integers using default
1757 # options, 0 otherwise.
1759 proc check_effective_target_int32 { } {
1760 return [check_no_compiler_messages int32 object {
1761 int dummy[sizeof (int) == 4 ? 1 : -1];
1765 # Return 1 if we're generating
32-bit or larger integers using default
1766 # options
, 0 otherwise.
1768 proc check_effective_target_int32plus
{ } {
1769 return [check_no_compiler_messages int32plus object
{
1770 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1774 #
Return 1 if we
're generating 32-bit or larger pointers using default
1775 # options, 0 otherwise.
1777 proc check_effective_target_ptr32plus { } {
1778 # The msp430 has 16-bit or 20-bit pointers. The 20-bit pointer is stored
1779 # in a 32-bit slot when in memory, so sizeof(void *) returns 4, but it
1780 # cannot really hold a 32-bit address, so we always return false here.
1781 if { [istarget msp430-*-*] } {
1785 return [check_no_compiler_messages ptr32plus object {
1786 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1790 # Return 1 if we support 32-bit or larger array and structure sizes
1791 # using default options, 0 otherwise.
1793 proc check_effective_target_size32plus { } {
1794 return [check_no_compiler_messages size32plus object {
1799 # Returns 1 if we're generating
16-bit or smaller integers with the
1800 # default options
, 0 otherwise.
1802 proc check_effective_target_int16
{ } {
1803 return [check_no_compiler_messages int16 object
{
1804 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1808 #
Return 1 if we
're generating 64-bit code using default options, 0
1811 proc check_effective_target_lp64 { } {
1812 return [check_no_compiler_messages lp64 object {
1813 int dummy[sizeof (int) == 4
1814 && sizeof (void *) == 8
1815 && sizeof (long) == 8 ? 1 : -1];
1819 # Return 1 if we're generating
64-bit code using default llp64 options
,
1822 proc check_effective_target_llp64
{ } {
1823 return [check_no_compiler_messages llp64 object
{
1824 int dummy
[sizeof
(int) == 4
1825 && sizeof
(void
*) == 8
1826 && sizeof
(long long
) == 8
1827 && sizeof
(long
) == 4 ?
1 : -1];
1831 #
Return 1 if long and
int have different sizes
,
1834 proc check_effective_target_long_neq_int
{ } {
1835 return [check_no_compiler_messages long_ne_int object
{
1836 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1840 #
Return 1 if the target supports long double larger than double
,
1843 proc check_effective_target_large_long_double
{ } {
1844 return [check_no_compiler_messages large_long_double object
{
1845 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1849 #
Return 1 if the target supports double larger than float
,
1852 proc check_effective_target_large_double
{ } {
1853 return [check_no_compiler_messages large_double object
{
1854 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
1858 #
Return 1 if the target supports double of
64 bits
,
1861 proc check_effective_target_double64
{ } {
1862 return [check_no_compiler_messages double64 object
{
1863 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
1867 #
Return 1 if the target supports double of at least
64 bits
,
1870 proc check_effective_target_double64plus
{ } {
1871 return [check_no_compiler_messages double64plus object
{
1872 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
1876 #
Return 1 if the target supports
'w' suffix
on floating constant
1879 proc check_effective_target_has_w_floating_suffix
{ } {
1881 if [check_effective_target_c
++] {
1882 append opts
"-std=gnu++03"
1884 return [check_no_compiler_messages w_fp_suffix object
{
1889 #
Return 1 if the target supports
'q' suffix
on floating constant
1892 proc check_effective_target_has_q_floating_suffix
{ } {
1894 if [check_effective_target_c
++] {
1895 append opts
"-std=gnu++03"
1897 return [check_no_compiler_messages q_fp_suffix object
{
1901 #
Return 1 if the target supports compiling fixed
-point
,
1904 proc check_effective_target_fixed_point
{ } {
1905 return [check_no_compiler_messages fixed_point object
{
1906 _Sat _Fract x
; _Sat _Accum y
;
1910 #
Return 1 if the target supports compiling decimal floating point
,
1913 proc check_effective_target_dfp_nocache
{ } {
1914 verbose
"check_effective_target_dfp_nocache: compiling source" 2
1915 set ret
[check_no_compiler_messages_nocache dfp object
{
1916 float x __attribute__
((mode(DD
)));
1918 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
1922 proc check_effective_target_dfprt_nocache
{ } {
1923 return [check_runtime_nocache dfprt
{
1924 typedef float d64 __attribute__
((mode(DD
)));
1925 d64 x
= 1.2df
, y
= 2.3dd
, z
;
1926 int main
() { z
= x
+ y
; return 0; }
1930 #
Return 1 if the target supports compiling Decimal Floating Point
,
1933 # This won
't change for different subtargets so cache the result.
1935 proc check_effective_target_dfp { } {
1936 return [check_cached_effective_target dfp {
1937 check_effective_target_dfp_nocache
1941 # Return 1 if the target supports linking and executing Decimal Floating
1942 # Point, 0 otherwise.
1944 # This won't change
for different subtargets so
cache the result.
1946 proc check_effective_target_dfprt
{ } {
1947 return [check_cached_effective_target dfprt
{
1948 check_effective_target_dfprt_nocache
1952 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1954 proc check_effective_target_ucn_nocache
{ } {
1955 #
-std
=c99 is only valid
for C
1956 if [check_effective_target_c
] {
1957 set ucnopts
"-std=c99"
1959 append ucnopts
" -fextended-identifiers"
1960 verbose
"check_effective_target_ucn_nocache: compiling source" 2
1961 set ret
[check_no_compiler_messages_nocache ucn object
{
1964 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
1968 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1970 # This won
't change for different subtargets, so cache the result.
1972 proc check_effective_target_ucn { } {
1973 return [check_cached_effective_target ucn {
1974 check_effective_target_ucn_nocache
1978 # Return 1 if the target needs a command line argument to enable a SIMD
1981 proc check_effective_target_vect_cmdline_needed { } {
1982 global et_vect_cmdline_needed_saved
1983 global et_vect_cmdline_needed_target_name
1985 if { ![info exists et_vect_cmdline_needed_target_name] } {
1986 set et_vect_cmdline_needed_target_name ""
1989 # If the target has changed since we set the cached value, clear it.
1990 set current_target [current_target_name]
1991 if { $current_target != $et_vect_cmdline_needed_target_name } {
1992 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
1993 set et_vect_cmdline_needed_target_name $current_target
1994 if { [info exists et_vect_cmdline_needed_saved] } {
1995 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
1996 unset et_vect_cmdline_needed_saved
2000 if [info exists et_vect_cmdline_needed_saved] {
2001 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
2003 set et_vect_cmdline_needed_saved 1
2004 if { [istarget alpha*-*-*]
2005 || [istarget ia64-*-*]
2006 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
2007 && ([check_effective_target_x32]
2008 || [check_effective_target_lp64]))
2009 || ([istarget powerpc*-*-*]
2010 && ([check_effective_target_powerpc_spe]
2011 || [check_effective_target_powerpc_altivec]))
2012 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
2013 || [istarget spu-*-*]
2014 || ([istarget arm*-*-*] && [check_effective_target_arm_neon])
2015 || [istarget aarch64*-*-*] } {
2016 set et_vect_cmdline_needed_saved 0
2020 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2021 return $et_vect_cmdline_needed_saved
2024 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
2026 # This won't change
for different subtargets so
cache the result.
2028 proc check_effective_target_vect_int
{ } {
2029 global et_vect_int_saved
2031 if [info exists et_vect_int_saved
] {
2032 verbose
"check_effective_target_vect_int: using cached result" 2
2034 set et_vect_int_saved
0
2035 if { [istarget i?
86-*-*]
2036 ||
([istarget powerpc
*-*-*]
2037 && ![istarget powerpc
-*-linux
*paired
*])
2038 ||
[istarget spu
-*-*]
2039 ||
[istarget x86_64
-*-*]
2040 ||
[istarget sparc
*-*-*]
2041 ||
[istarget alpha
*-*-*]
2042 ||
[istarget ia64
-*-*]
2043 ||
[istarget aarch64
*-*-*]
2044 ||
[check_effective_target_arm32
]
2045 ||
([istarget mips
*-*-*]
2046 && [check_effective_target_mips_loongson
]) } {
2047 set et_vect_int_saved
1
2051 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
2052 return $et_vect_int_saved
2055 #
Return 1 if the target supports signed
int->float conversion
2058 proc check_effective_target_vect_intfloat_cvt
{ } {
2059 global et_vect_intfloat_cvt_saved
2061 if [info exists et_vect_intfloat_cvt_saved
] {
2062 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
2064 set et_vect_intfloat_cvt_saved
0
2065 if { [istarget i?
86-*-*]
2066 ||
([istarget powerpc
*-*-*]
2067 && ![istarget powerpc
-*-linux
*paired
*])
2068 ||
[istarget x86_64
-*-*]
2069 ||
([istarget arm
*-*-*]
2070 && [check_effective_target_arm_neon_ok
])} {
2071 set et_vect_intfloat_cvt_saved
1
2075 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2076 return $et_vect_intfloat_cvt_saved
2079 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
2081 proc check_effective_target_int128 { } {
2082 return [check_no_compiler_messages int128 object {
2084 #ifndef __SIZEOF_INT128__
2093 # Return 1 if the target supports unsigned int->float conversion
2096 proc check_effective_target_vect_uintfloat_cvt { } {
2097 global et_vect_uintfloat_cvt_saved
2099 if [info exists et_vect_uintfloat_cvt_saved] {
2100 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2102 set et_vect_uintfloat_cvt_saved 0
2103 if { [istarget i?86-*-*]
2104 || ([istarget powerpc*-*-*]
2105 && ![istarget powerpc-*-linux*paired*])
2106 || [istarget x86_64-*-*]
2107 || [istarget aarch64*-*-*]
2108 || ([istarget arm*-*-*]
2109 && [check_effective_target_arm_neon_ok])} {
2110 set et_vect_uintfloat_cvt_saved 1
2114 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2115 return $et_vect_uintfloat_cvt_saved
2119 # Return 1 if the target supports signed float->int conversion
2122 proc check_effective_target_vect_floatint_cvt { } {
2123 global et_vect_floatint_cvt_saved
2125 if [info exists et_vect_floatint_cvt_saved] {
2126 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2128 set et_vect_floatint_cvt_saved 0
2129 if { [istarget i?86-*-*]
2130 || ([istarget powerpc*-*-*]
2131 && ![istarget powerpc-*-linux*paired*])
2132 || [istarget x86_64-*-*]
2133 || ([istarget arm*-*-*]
2134 && [check_effective_target_arm_neon_ok])} {
2135 set et_vect_floatint_cvt_saved 1
2139 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2140 return $et_vect_floatint_cvt_saved
2143 # Return 1 if the target supports unsigned float->int conversion
2146 proc check_effective_target_vect_floatuint_cvt { } {
2147 global et_vect_floatuint_cvt_saved
2149 if [info exists et_vect_floatuint_cvt_saved] {
2150 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2152 set et_vect_floatuint_cvt_saved 0
2153 if { ([istarget powerpc*-*-*]
2154 && ![istarget powerpc-*-linux*paired*])
2155 || ([istarget arm*-*-*]
2156 && [check_effective_target_arm_neon_ok])} {
2157 set et_vect_floatuint_cvt_saved 1
2161 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2162 return $et_vect_floatuint_cvt_saved
2165 # Return 1 if the target supports #pragma omp declare simd, 0 otherwise.
2167 # This won't change
for different subtargets so
cache the result.
2169 proc check_effective_target_vect_simd_clones
{ } {
2170 global et_vect_simd_clones_saved
2172 if [info exists et_vect_simd_clones_saved
] {
2173 verbose
"check_effective_target_vect_simd_clones: using cached result" 2
2175 set et_vect_simd_clones_saved
0
2176 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
2177 #
On i?
86/x86_64 #pragma omp declare simd builds a sse2
, avx and
2178 # avx2 clone. Only the right clone
for the specified arch will be
2179 # chosen
, but still we need to at least be able to assemble
2181 if { [check_effective_target_avx2
] } {
2182 set et_vect_simd_clones_saved
1
2187 verbose
"check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2188 return $et_vect_simd_clones_saved
2191 #
Return 1 if this is a AArch64 target supporting big endian
2192 proc check_effective_target_aarch64_big_endian
{ } {
2193 return [check_no_compiler_messages aarch64_big_endian assembly
{
2194 #
if !defined
(__aarch64__
) ||
!defined
(__AARCH64EB__
)
2200 #
Return 1 if this is a AArch64 target supporting little endian
2201 proc check_effective_target_aarch64_little_endian
{ } {
2202 return [check_no_compiler_messages aarch64_little_endian assembly
{
2203 #
if !defined
(__aarch64__
) || defined
(__AARCH64EB__
)
2209 #
Return 1 is this is an arm target using
32-bit instructions
2210 proc check_effective_target_arm32
{ } {
2211 return [check_no_compiler_messages arm32 assembly
{
2212 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
2218 #
Return 1 is this is an arm target not using Thumb
2219 proc check_effective_target_arm_nothumb
{ } {
2220 return [check_no_compiler_messages arm_nothumb assembly
{
2221 #
if (defined
(__thumb__
) || defined
(__thumb2__
))
2227 #
Return 1 if this is a little
-endian ARM target
2228 proc check_effective_target_arm_little_endian
{ } {
2229 return [check_no_compiler_messages arm_little_endian assembly
{
2230 #
if !defined
(__arm__
) ||
!defined
(__ARMEL__
)
2236 #
Return 1 if this is an ARM target that only supports aligned vector accesses
2237 proc check_effective_target_arm_vect_no_misalign
{ } {
2238 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
2239 #
if !defined
(__arm__
) \
2240 ||
(defined
(__ARMEL__
) \
2241 && (!defined
(__thumb__
) || defined
(__thumb2__
)))
2248 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2249 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
2252 proc check_effective_target_arm_vfp_ok
{ } {
2253 if { [check_effective_target_arm32
] } {
2254 return [check_no_compiler_messages arm_vfp_ok object
{
2256 } "-mfpu=vfp -mfloat-abi=softfp"]
2262 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp3
2263 #
-mfloat
-abi
=softfp.
2265 proc check_effective_target_arm_vfp3_ok
{ } {
2266 if { [check_effective_target_arm32
] } {
2267 return [check_no_compiler_messages arm_vfp3_ok object
{
2269 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2275 #
Return 1 if this is an ARM target supporting
-mfpu
=fp
-armv8
2276 #
-mfloat
-abi
=softfp.
2277 proc check_effective_target_arm_v8_vfp_ok
{} {
2278 if { [check_effective_target_arm32
] } {
2279 return [check_no_compiler_messages arm_v8_vfp_ok object
{
2282 __asm__ volatile
("vrinta.f32.f32 s0, s0");
2285 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2291 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2292 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
2295 proc check_effective_target_arm_hard_vfp_ok
{ } {
2296 if { [check_effective_target_arm32
]
2297 && ! [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2298 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
2299 int main
() { return 0;}
2300 } "-mfpu=vfp -mfloat-abi=hard"]
2306 #
Return 1 if this is an ARM target that supports DSP multiply with
2307 # current multilib flags.
2309 proc check_effective_target_arm_dsp
{ } {
2310 return [check_no_compiler_messages arm_dsp assembly
{
2311 #ifndef __ARM_FEATURE_DSP
2318 #
Return 1 if this is an ARM target that supports unaligned word
/halfword
2319 #
load/store instructions.
2321 proc check_effective_target_arm_unaligned
{ } {
2322 return [check_no_compiler_messages arm_unaligned assembly
{
2323 #ifndef __ARM_FEATURE_UNALIGNED
2324 #error no unaligned support
2330 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2331 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2332 # incompatible with these options. Also
set et_arm_crypto_flags to the
2333 # best options to add.
2335 proc check_effective_target_arm_crypto_ok_nocache
{ } {
2336 global et_arm_crypto_flags
2337 set et_arm_crypto_flags
""
2338 if { [check_effective_target_arm32
] } {
2339 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2340 if { [check_no_compiler_messages_nocache arm_crypto_ok object
{
2341 #
include "arm_neon.h"
2343 foo
(uint8x16_t a
, uint8x16_t b
)
2345 return vaeseq_u8
(a
, b
);
2348 set et_arm_crypto_flags $flags
2357 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2359 proc check_effective_target_arm_crypto_ok
{ } {
2360 return [check_cached_effective_target arm_crypto_ok \
2361 check_effective_target_arm_crypto_ok_nocache
]
2364 # Add options
for crypto extensions.
2365 proc add_options_for_arm_crypto
{ flags
} {
2366 if { ! [check_effective_target_arm_crypto_ok
] } {
2369 global et_arm_crypto_flags
2370 return "$flags $et_arm_crypto_flags"
2373 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2374 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2375 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2376 # NEON
, do not add
-mfpu
=neon.
2378 proc add_options_for_arm_neon
{ flags
} {
2379 if { ! [check_effective_target_arm_neon_ok
] } {
2382 global et_arm_neon_flags
2383 return "$flags $et_arm_neon_flags"
2386 proc add_options_for_arm_v8_vfp
{ flags
} {
2387 if { ! [check_effective_target_arm_v8_vfp_ok
] } {
2390 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2393 proc add_options_for_arm_v8_neon
{ flags
} {
2394 if { ! [check_effective_target_arm_v8_neon_ok
] } {
2397 global et_arm_v8_neon_flags
2398 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2401 proc add_options_for_arm_crc
{ flags
} {
2402 if { ! [check_effective_target_arm_crc_ok
] } {
2405 global et_arm_crc_flags
2406 return "$flags $et_arm_crc_flags"
2409 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2410 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2411 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2412 # NEON
, do not add
-mfpu
=neon.
2414 proc add_options_for_arm_neonv2
{ flags
} {
2415 if { ! [check_effective_target_arm_neonv2_ok
] } {
2418 global et_arm_neonv2_flags
2419 return "$flags $et_arm_neonv2_flags"
2422 # Add the options needed
for vfp3.
2423 proc add_options_for_arm_vfp3
{ flags
} {
2424 if { ! [check_effective_target_arm_vfp3_ok
] } {
2427 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2430 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
2431 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2432 # incompatible with these options. Also
set et_arm_neon_flags to the
2433 # best options to add.
2435 proc check_effective_target_arm_neon_ok_nocache
{ } {
2436 global et_arm_neon_flags
2437 set et_arm_neon_flags
""
2438 if { [check_effective_target_arm32
] } {
2439 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2440 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
2441 #
include "arm_neon.h"
2444 set et_arm_neon_flags $flags
2453 proc check_effective_target_arm_neon_ok
{ } {
2454 return [check_cached_effective_target arm_neon_ok \
2455 check_effective_target_arm_neon_ok_nocache
]
2458 proc check_effective_target_arm_crc_ok_nocache
{ } {
2459 global et_arm_crc_flags
2460 set et_arm_crc_flags
"-march=armv8-a+crc"
2461 return [check_no_compiler_messages_nocache arm_crc_ok object
{
2462 #
if !defined
(__ARM_FEATURE_CRC32
)
2465 } "$et_arm_crc_flags"]
2468 proc check_effective_target_arm_crc_ok
{ } {
2469 return [check_cached_effective_target arm_crc_ok \
2470 check_effective_target_arm_crc_ok_nocache
]
2473 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
2474 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2475 # incompatible with these options. Also
set et_arm_neon_flags to the
2476 # best options to add.
2478 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
2479 global et_arm_neon_fp16_flags
2480 set et_arm_neon_fp16_flags
""
2481 if { [check_effective_target_arm32
] } {
2482 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2483 "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
2484 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object
{
2485 #
include "arm_neon.h"
2487 foo
(float32x4_t
arg)
2489 return vcvt_f16_f32
(arg);
2492 set et_arm_neon_fp16_flags $flags
2501 proc check_effective_target_arm_neon_fp16_ok
{ } {
2502 return [check_cached_effective_target arm_neon_fp16_ok \
2503 check_effective_target_arm_neon_fp16_ok_nocache
]
2506 proc add_options_for_arm_neon_fp16
{ flags
} {
2507 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
2510 global et_arm_neon_fp16_flags
2511 return "$flags $et_arm_neon_fp16_flags"
2514 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp
-armv8
2515 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2516 # incompatible with these options. Also
set et_arm_v8_neon_flags to the
2517 # best options to add.
2519 proc check_effective_target_arm_v8_neon_ok_nocache
{ } {
2520 global et_arm_v8_neon_flags
2521 set et_arm_v8_neon_flags
""
2522 if { [check_effective_target_arm32
] } {
2523 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2524 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object
{
2525 #
include "arm_neon.h"
2529 __asm__ volatile
("vrintn.f32 q0, q0");
2532 set et_arm_v8_neon_flags $flags
2541 proc check_effective_target_arm_v8_neon_ok
{ } {
2542 return [check_cached_effective_target arm_v8_neon_ok \
2543 check_effective_target_arm_v8_neon_ok_nocache
]
2546 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-vfpv4
2547 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2548 # incompatible with these options. Also
set et_arm_neonv2_flags to the
2549 # best options to add.
2551 proc check_effective_target_arm_neonv2_ok_nocache
{ } {
2552 global et_arm_neonv2_flags
2553 set et_arm_neonv2_flags
""
2554 if { [check_effective_target_arm32
] } {
2555 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2556 if { [check_no_compiler_messages_nocache arm_neonv2_ok object
{
2557 #
include "arm_neon.h"
2559 foo
(float32x2_t a
, float32x2_t b
, float32x2_t c
)
2561 return vfma_f32
(a
, b
, c
);
2564 set et_arm_neonv2_flags $flags
2573 proc check_effective_target_arm_neonv2_ok
{ } {
2574 return [check_cached_effective_target arm_neonv2_ok \
2575 check_effective_target_arm_neonv2_ok_nocache
]
2578 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2579 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2582 proc add_options_for_arm_fp16
{ flags
} {
2583 if { ! [check_effective_target_arm_fp16_ok
] } {
2586 global et_arm_fp16_flags
2587 return "$flags $et_arm_fp16_flags"
2590 #
Return 1 if this is an ARM target that can support a VFP fp16 variant.
2591 # Skip multilibs that are incompatible with these options and
set
2592 # et_arm_fp16_flags to the best options to add.
2594 proc check_effective_target_arm_fp16_ok_nocache
{ } {
2595 global et_arm_fp16_flags
2596 set et_arm_fp16_flags
""
2597 if { ! [check_effective_target_arm32
] } {
2600 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2601 # Multilib flags would override
-mfpu.
2604 if [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2605 # Must generate floating
-point instructions.
2608 if [check_effective_target_arm_hf_eabi
] {
2609 # Use existing float
-abi and force an fpu which supports fp16
2610 set et_arm_fp16_flags
"-mfpu=vfpv4"
2613 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "" } ]] {
2614 # The existing
-mfpu value is OK
; use it
, but add softfp.
2615 set et_arm_fp16_flags
"-mfloat-abi=softfp"
2618 # Add
-mfpu
for a VFP fp16 variant since there is no preprocessor
2619 # macro to check
for this support.
2620 set flags
"-mfpu=vfpv4 -mfloat-abi=softfp"
2621 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly
{
2624 set et_arm_fp16_flags
"$flags"
2631 proc check_effective_target_arm_fp16_ok
{ } {
2632 return [check_cached_effective_target arm_fp16_ok \
2633 check_effective_target_arm_fp16_ok_nocache
]
2636 # Creates a series of routines that
return 1 if the given architecture
2637 # can be selected and a routine to give the flags to select that architecture
2638 # Note
: Extra flags may be added to disable options from newer compilers
2639 #
(Thumb in particular
- but others may be added in the future
)
2640 # Usage
: /* { dg
-require
-effective
-target arm_arch_v5_ok
} */
2641 #
/* { dg
-add
-options arm_arch_v5
} */
2642 #
/* { dg
-require
-effective
-target arm_arch_v5_multilib
} */
2643 foreach
{ armfunc armflag armdef
} { v4
"-march=armv4 -marm" __ARM_ARCH_4__
2644 v4t
"-march=armv4t" __ARM_ARCH_4T__
2645 v5
"-march=armv5 -marm" __ARM_ARCH_5__
2646 v5t
"-march=armv5t" __ARM_ARCH_5T__
2647 v5te
"-march=armv5te" __ARM_ARCH_5TE__
2648 v6
"-march=armv6" __ARM_ARCH_6__
2649 v6k
"-march=armv6k" __ARM_ARCH_6K__
2650 v6t2
"-march=armv6t2" __ARM_ARCH_6T2__
2651 v6z
"-march=armv6z" __ARM_ARCH_6Z__
2652 v6m
"-march=armv6-m -mthumb" __ARM_ARCH_6M__
2653 v7a
"-march=armv7-a" __ARM_ARCH_7A__
2654 v7ve
"-march=armv7ve" __ARM_ARCH_7A__
2655 v7r
"-march=armv7-r" __ARM_ARCH_7R__
2656 v7m
"-march=armv7-m -mthumb" __ARM_ARCH_7M__
2657 v7em
"-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2658 v8a
"-march=armv8-a" __ARM_ARCH_8A__ } {
2659 eval
[string map
[list FUNC $armfunc FLAG $armflag DEF $armdef
] {
2660 proc check_effective_target_arm_arch_FUNC_ok
{ } {
2661 if { [ string match
"*-marm*" "FLAG" ] &&
2662 ![check_effective_target_arm_arm_ok
] } {
2665 return [check_no_compiler_messages arm_arch_FUNC_ok assembly
{
2672 proc add_options_for_arm_arch_FUNC
{ flags
} {
2673 return "$flags FLAG"
2676 proc check_effective_target_arm_arch_FUNC_multilib
{ } {
2677 return [check_runtime arm_arch_FUNC_multilib
{
2683 } [add_options_for_arm_arch_FUNC
""]]
2688 #
Return 1 if this is an ARM target where
-marm causes ARM to be
2691 proc check_effective_target_arm_arm_ok
{ } {
2692 return [check_no_compiler_messages arm_arm_ok assembly
{
2693 #
if !defined
(__arm__
) || defined
(__thumb__
) || defined
(__thumb2__
)
2700 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
2703 proc check_effective_target_arm_thumb1_ok
{ } {
2704 return [check_no_compiler_messages arm_thumb1_ok assembly
{
2705 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2711 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
2714 proc check_effective_target_arm_thumb2_ok
{ } {
2715 return [check_no_compiler_messages arm_thumb2_ok assembly
{
2716 #
if !defined
(__thumb2__
)
2722 #
Return 1 if this is an ARM target where Thumb
-1 is used without options
2723 # added by the test.
2725 proc check_effective_target_arm_thumb1
{ } {
2726 return [check_no_compiler_messages arm_thumb1 assembly
{
2727 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2734 #
Return 1 if this is an ARM target where Thumb
-2 is used without options
2735 # added by the test.
2737 proc check_effective_target_arm_thumb2
{ } {
2738 return [check_no_compiler_messages arm_thumb2 assembly
{
2739 #
if !defined
(__thumb2__
)
2746 #
Return 1 if this is an ARM target where conditional execution is available.
2748 proc check_effective_target_arm_cond_exec
{ } {
2749 return [check_no_compiler_messages arm_cond_exec assembly
{
2750 #
if defined
(__arm__
) && defined
(__thumb__
) && !defined
(__thumb2__
)
2757 #
Return 1 if this is an ARM cortex
-M profile cpu
2759 proc check_effective_target_arm_cortex_m
{ } {
2760 return [check_no_compiler_messages arm_cortex_m assembly
{
2761 #
if !defined
(__ARM_ARCH_7M__
) \
2762 && !defined
(__ARM_ARCH_7EM__
) \
2763 && !defined
(__ARM_ARCH_6M__
)
2770 #
Return 1 if the target supports executing NEON instructions
, 0
2771 # otherwise.
Cache the result.
2773 proc check_effective_target_arm_neon_hw
{ } {
2774 return [check_runtime arm_neon_hw_available
{
2778 long long a
= 0, b
= 1;
2779 asm
("vorr %P0, %P1, %P2"
2781 : "0" (a), "w" (b));
2784 } [add_options_for_arm_neon
""]]
2787 proc check_effective_target_arm_neonv2_hw
{ } {
2788 return [check_runtime arm_neon_hwv2_available
{
2789 #
include "arm_neon.h"
2793 float32x2_t a
, b
, c
;
2794 asm
("vfma.f32 %P0, %P1, %P2"
2796 : "w" (b), "w" (c));
2799 } [add_options_for_arm_neonv2
""]]
2802 #
Return 1 if the target supports executing ARMv8 NEON instructions
, 0
2805 proc check_effective_target_arm_v8_neon_hw
{ } {
2806 return [check_runtime arm_v8_neon_hw_available
{
2807 #
include "arm_neon.h"
2812 asm
("vrinta.f32 %P0, %P1"
2817 } [add_options_for_arm_v8_neon
""]]
2820 #
Return 1 if this is a ARM target with NEON enabled.
2822 proc check_effective_target_arm_neon
{ } {
2823 if { [check_effective_target_arm32
] } {
2824 return [check_no_compiler_messages arm_neon object
{
2825 #ifndef __ARM_NEON__
2836 proc check_effective_target_arm_neonv2
{ } {
2837 if { [check_effective_target_arm32
] } {
2838 return [check_no_compiler_messages arm_neon object
{
2839 #ifndef __ARM_NEON__
2842 #ifndef __ARM_FEATURE_FMA
2854 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
2855 # the Loongson vector modes.
2857 proc check_effective_target_mips_loongson
{ } {
2858 return [check_no_compiler_messages loongson assembly
{
2859 #
if !defined
(__mips_loongson_vector_rev
)
2865 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
2868 proc check_effective_target_arm_eabi
{ } {
2869 return [check_no_compiler_messages arm_eabi object
{
2870 #ifndef __ARM_EABI__
2878 #
Return 1 if this is an ARM target that adheres to the hard
-float variant of
2879 # the ABI
for the ARM Architecture
(e.g.
-mfloat
-abi
=hard
).
2881 proc check_effective_target_arm_hf_eabi
{ } {
2882 return [check_no_compiler_messages arm_hf_eabi object
{
2883 #
if !defined
(__ARM_EABI__
) ||
!defined
(__ARM_PCS_VFP
)
2884 #error not hard
-float EABI
2891 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
2892 # Some multilibs may be incompatible with this option.
2894 proc check_effective_target_arm_iwmmxt_ok
{ } {
2895 if { [check_effective_target_arm32
] } {
2896 return [check_no_compiler_messages arm_iwmmxt_ok object
{
2904 #
Return true
if LDRD
/STRD instructions are prefered over LDM
/STM instructions
2905 #
for an ARM target.
2906 proc check_effective_target_arm_prefer_ldrd_strd
{ } {
2907 if { ![check_effective_target_arm32
] } {
2911 return [check_no_messages_and_pattern arm_prefer_ldrd_strd
"strd\tr" assembly {
2912 void foo
(int *p
) { p
[0] = 1; p
[1] = 0;}
2916 #
Return 1 if this is a PowerPC target supporting
-meabi.
2918 proc check_effective_target_powerpc_eabi_ok
{ } {
2919 if { [istarget powerpc
*-*-*] } {
2920 return [check_no_compiler_messages powerpc_eabi_ok object
{
2928 #
Return 1 if this is a PowerPC target with floating
-point registers.
2930 proc check_effective_target_powerpc_fprs
{ } {
2931 if { [istarget powerpc
*-*-*]
2932 ||
[istarget rs6000
-*-*] } {
2933 return [check_no_compiler_messages powerpc_fprs object
{
2945 #
Return 1 if this is a PowerPC target with hardware double
-precision
2948 proc check_effective_target_powerpc_hard_double
{ } {
2949 if { [istarget powerpc
*-*-*]
2950 ||
[istarget rs6000
-*-*] } {
2951 return [check_no_compiler_messages powerpc_hard_double object
{
2963 #
Return 1 if this is a PowerPC target supporting
-maltivec.
2965 proc check_effective_target_powerpc_altivec_ok
{ } {
2966 if { ([istarget powerpc
*-*-*]
2967 && ![istarget powerpc
-*-linux
*paired
*])
2968 ||
[istarget rs6000
-*-*] } {
2969 # AltiVec is not supported
on AIX before
5.3.
2970 if { [istarget powerpc
*-*-aix4
*]
2971 ||
[istarget powerpc
*-*-aix5.1
*]
2972 ||
[istarget powerpc
*-*-aix5.2
*] } {
2975 return [check_no_compiler_messages powerpc_altivec_ok object
{
2983 #
Return 1 if this is a PowerPC target supporting
-mpower8
-vector
2985 proc check_effective_target_powerpc_p8vector_ok
{ } {
2986 if { ([istarget powerpc
*-*-*]
2987 && ![istarget powerpc
-*-linux
*paired
*])
2988 ||
[istarget rs6000
-*-*] } {
2989 # AltiVec is not supported
on AIX before
5.3.
2990 if { [istarget powerpc
*-*-aix4
*]
2991 ||
[istarget powerpc
*-*-aix5.1
*]
2992 ||
[istarget powerpc
*-*-aix5.2
*] } {
2995 return [check_no_compiler_messages powerpc_p8vector_ok object
{
2998 asm volatile
("xxlorc vs0,vs0,vs0");
3000 asm volatile
("xxlorc 0,0,0");
3004 } "-mpower8-vector"]
3010 #
Return 1 if this is a PowerPC target supporting
-mvsx
3012 proc check_effective_target_powerpc_vsx_ok
{ } {
3013 if { ([istarget powerpc
*-*-*]
3014 && ![istarget powerpc
-*-linux
*paired
*])
3015 ||
[istarget rs6000
-*-*] } {
3016 # VSX is not supported
on AIX before
7.1.
3017 if { [istarget powerpc
*-*-aix4
*]
3018 ||
[istarget powerpc
*-*-aix5
*]
3019 ||
[istarget powerpc
*-*-aix6
*] } {
3022 return [check_no_compiler_messages powerpc_vsx_ok object
{
3025 asm volatile
("xxlor vs0,vs0,vs0");
3027 asm volatile
("xxlor 0,0,0");
3037 #
Return 1 if this is a PowerPC target supporting
-mhtm
3039 proc check_effective_target_powerpc_htm_ok
{ } {
3040 if { ([istarget powerpc
*-*-*]
3041 && ![istarget powerpc
-*-linux
*paired
*])
3042 ||
[istarget rs6000
-*-*] } {
3043 # HTM is not supported
on AIX yet.
3044 if { [istarget powerpc
*-*-aix
*] } {
3047 return [check_no_compiler_messages powerpc_htm_ok object
{
3049 asm volatile
("tbegin. 0");
3058 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
3060 proc check_effective_target_powerpc_ppu_ok
{ } {
3061 if [check_effective_target_powerpc_altivec_ok
] {
3062 return [check_no_compiler_messages cell_asm_available object
{
3065 asm volatile
("lvlx v0,v0,v0");
3067 asm volatile
("lvlx 0,0,0");
3077 #
Return 1 if this is a PowerPC target that supports SPU.
3079 proc check_effective_target_powerpc_spu
{ } {
3080 if { [istarget powerpc
*-*-linux
*] } {
3081 return [check_effective_target_powerpc_altivec_ok
]
3087 #
Return 1 if this is a PowerPC SPE target. The check includes options
3088 # specified by dg
-options
for this test
, so don
't cache the result.
3090 proc check_effective_target_powerpc_spe_nocache { } {
3091 if { [istarget powerpc*-*-*] } {
3092 return [check_no_compiler_messages_nocache powerpc_spe object {
3098 } [current_compiler_flags]]
3104 # Return 1 if this is a PowerPC target with SPE enabled.
3106 proc check_effective_target_powerpc_spe { } {
3107 if { [istarget powerpc*-*-*] } {
3108 return [check_no_compiler_messages powerpc_spe object {
3120 # Return 1 if this is a PowerPC target with Altivec enabled.
3122 proc check_effective_target_powerpc_altivec { } {
3123 if { [istarget powerpc*-*-*] } {
3124 return [check_no_compiler_messages powerpc_altivec object {
3136 # Return 1 if this is a PowerPC 405 target. The check includes options
3137 # specified by dg-options for this test, so don't
cache the result.
3139 proc check_effective_target_powerpc_405_nocache
{ } {
3140 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
3141 return [check_no_compiler_messages_nocache powerpc_405 object
{
3147 } [current_compiler_flags
]]
3153 #
Return 1 if this is a PowerPC target using the ELFv2 ABI.
3155 proc check_effective_target_powerpc_elfv2
{ } {
3156 if { [istarget powerpc
*-*-*] } {
3157 return [check_no_compiler_messages powerpc_elfv2 object
{
3159 #error not ELF v2 ABI
3169 #
Return 1 if this is a SPU target with a toolchain that
3170 # supports automatic overlay generation.
3172 proc check_effective_target_spu_auto_overlay
{ } {
3173 if { [istarget spu
*-*-elf
*] } {
3174 return [check_no_compiler_messages spu_auto_overlay executable
{
3176 } "-Wl,--auto-overlay" ]
3182 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3183 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
3184 # test environment appears to run executables
on such a simulator.
3186 proc check_effective_target_ultrasparc_hw
{ } {
3187 return [check_runtime ultrasparc_hw
{
3188 int main
() { return 0; }
3189 } "-mcpu=ultrasparc"]
3192 #
Return 1 if the test environment supports executing UltraSPARC VIS2
3193 # instructions. We check this by attempting
: "bmask %g0, %g0, %g0"
3195 proc check_effective_target_ultrasparc_vis2_hw
{ } {
3196 return [check_runtime ultrasparc_vis2_hw
{
3197 int main
() { __asm__
(".word 0x81b00320"); return 0; }
3198 } "-mcpu=ultrasparc3"]
3201 #
Return 1 if the test environment supports executing UltraSPARC VIS3
3202 # instructions. We check this by attempting
: "addxc %g0, %g0, %g0"
3204 proc check_effective_target_ultrasparc_vis3_hw
{ } {
3205 return [check_runtime ultrasparc_vis3_hw
{
3206 int main
() { __asm__
(".word 0x81b00220"); return 0; }
3210 #
Return 1 if this is a SPARC
-V9 target.
3212 proc check_effective_target_sparc_v9
{ } {
3213 if { [istarget sparc
*-*-*] } {
3214 return [check_no_compiler_messages sparc_v9 object
{
3216 asm volatile
("return %i7+8");
3225 #
Return 1 if this is a SPARC target with VIS enabled.
3227 proc check_effective_target_sparc_vis
{ } {
3228 if { [istarget sparc
*-*-*] } {
3229 return [check_no_compiler_messages sparc_vis object
{
3241 #
Return 1 if the target supports hardware vector shift operation.
3243 proc check_effective_target_vect_shift
{ } {
3244 global et_vect_shift_saved
3246 if [info exists et_vect_shift_saved
] {
3247 verbose
"check_effective_target_vect_shift: using cached result" 2
3249 set et_vect_shift_saved
0
3250 if { ([istarget powerpc
*-*-*]
3251 && ![istarget powerpc
-*-linux
*paired
*])
3252 ||
[istarget ia64
-*-*]
3253 ||
[istarget i?
86-*-*]
3254 ||
[istarget x86_64
-*-*]
3255 ||
[istarget aarch64
*-*-*]
3256 ||
[check_effective_target_arm32
]
3257 ||
([istarget mips
*-*-*]
3258 && [check_effective_target_mips_loongson
]) } {
3259 set et_vect_shift_saved
1
3263 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3264 return $et_vect_shift_saved
3267 #
Return 1 if the target supports hardware vector shift operation
for char.
3269 proc check_effective_target_vect_shift_char
{ } {
3270 global et_vect_shift_char_saved
3272 if [info exists et_vect_shift_char_saved
] {
3273 verbose
"check_effective_target_vect_shift_char: using cached result" 2
3275 set et_vect_shift_char_saved
0
3276 if { ([istarget powerpc
*-*-*]
3277 && ![istarget powerpc
-*-linux
*paired
*])
3278 ||
[check_effective_target_arm32
] } {
3279 set et_vect_shift_char_saved
1
3283 verbose
"check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3284 return $et_vect_shift_char_saved
3287 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
3289 # This can change
for different subtargets so
do not
cache the result.
3291 proc check_effective_target_vect_long
{ } {
3292 if { [istarget i?
86-*-*]
3293 ||
(([istarget powerpc
*-*-*]
3294 && ![istarget powerpc
-*-linux
*paired
*])
3295 && [check_effective_target_ilp32
])
3296 ||
[istarget x86_64
-*-*]
3297 ||
[check_effective_target_arm32
]
3298 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
3304 verbose
"check_effective_target_vect_long: returning $answer" 2
3308 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
3310 # This won
't change for different subtargets so cache the result.
3312 proc check_effective_target_vect_float { } {
3313 global et_vect_float_saved
3315 if [info exists et_vect_float_saved] {
3316 verbose "check_effective_target_vect_float: using cached result" 2
3318 set et_vect_float_saved 0
3319 if { [istarget i?86-*-*]
3320 || [istarget powerpc*-*-*]
3321 || [istarget spu-*-*]
3322 || [istarget mips-sde-elf]
3323 || [istarget mipsisa64*-*-*]
3324 || [istarget x86_64-*-*]
3325 || [istarget ia64-*-*]
3326 || [istarget aarch64*-*-*]
3327 || [check_effective_target_arm32] } {
3328 set et_vect_float_saved 1
3332 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
3333 return $et_vect_float_saved
3336 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
3338 # This won't change
for different subtargets so
cache the result.
3340 proc check_effective_target_vect_double
{ } {
3341 global et_vect_double_saved
3343 if [info exists et_vect_double_saved
] {
3344 verbose
"check_effective_target_vect_double: using cached result" 2
3346 set et_vect_double_saved
0
3347 if { [istarget i?
86-*-*]
3348 ||
[istarget aarch64
*-*-*]
3349 ||
[istarget x86_64
-*-*] } {
3350 if { [check_no_compiler_messages vect_double assembly
{
3351 #ifdef __tune_atom__
3352 # error No double vectorizer support.
3355 set et_vect_double_saved
1
3357 set et_vect_double_saved
0
3359 } elseif
{ [istarget spu
-*-*] } {
3360 set et_vect_double_saved
1
3364 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
3365 return $et_vect_double_saved
3368 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
3370 # This won
't change for different subtargets so cache the result.
3372 proc check_effective_target_vect_long_long { } {
3373 global et_vect_long_long_saved
3375 if [info exists et_vect_long_long_saved] {
3376 verbose "check_effective_target_vect_long_long: using cached result" 2
3378 set et_vect_long_long_saved 0
3379 if { [istarget i?86-*-*]
3380 || [istarget x86_64-*-*] } {
3381 set et_vect_long_long_saved 1
3385 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3386 return $et_vect_long_long_saved
3390 # Return 1 if the target plus current options does not support a vector
3391 # max instruction on "int", 0 otherwise.
3393 # This won't change
for different subtargets so
cache the result.
3395 proc check_effective_target_vect_no_int_max
{ } {
3396 global et_vect_no_int_max_saved
3398 if [info exists et_vect_no_int_max_saved
] {
3399 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
3401 set et_vect_no_int_max_saved
0
3402 if { [istarget sparc
*-*-*]
3403 ||
[istarget spu
-*-*]
3404 ||
[istarget alpha
*-*-*]
3405 ||
([istarget mips
*-*-*]
3406 && [check_effective_target_mips_loongson
]) } {
3407 set et_vect_no_int_max_saved
1
3410 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3411 return $et_vect_no_int_max_saved
3414 #
Return 1 if the target plus current options does not support a vector
3415 # add instruction
on "int", 0 otherwise.
3417 # This won
't change for different subtargets so cache the result.
3419 proc check_effective_target_vect_no_int_add { } {
3420 global et_vect_no_int_add_saved
3422 if [info exists et_vect_no_int_add_saved] {
3423 verbose "check_effective_target_vect_no_int_add: using cached result" 2
3425 set et_vect_no_int_add_saved 0
3426 # Alpha only supports vector add on V8QI and V4HI.
3427 if { [istarget alpha*-*-*] } {
3428 set et_vect_no_int_add_saved 1
3431 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3432 return $et_vect_no_int_add_saved
3435 # Return 1 if the target plus current options does not support vector
3436 # bitwise instructions, 0 otherwise.
3438 # This won't change
for different subtargets so
cache the result.
3440 proc check_effective_target_vect_no_bitwise
{ } {
3441 global et_vect_no_bitwise_saved
3443 if [info exists et_vect_no_bitwise_saved
] {
3444 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
3446 set et_vect_no_bitwise_saved
0
3448 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3449 return $et_vect_no_bitwise_saved
3452 #
Return 1 if the target plus current options supports vector permutation
,
3455 # This won
't change for different subtargets so cache the result.
3457 proc check_effective_target_vect_perm { } {
3460 if [info exists et_vect_perm_saved] {
3461 verbose "check_effective_target_vect_perm: using cached result" 2
3463 set et_vect_perm_saved 0
3464 if { [is-effective-target arm_neon_ok]
3465 || ([istarget aarch64*-*-*]
3466 && [is-effective-target aarch64_little_endian])
3467 || [istarget powerpc*-*-*]
3468 || [istarget spu-*-*]
3469 || [istarget i?86-*-*]
3470 || [istarget x86_64-*-*]
3471 || ([istarget mips*-*-*]
3472 && [check_effective_target_mpaired_single]) } {
3473 set et_vect_perm_saved 1
3476 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3477 return $et_vect_perm_saved
3480 # Return 1 if the target plus current options supports vector permutation
3481 # on byte-sized elements, 0 otherwise.
3483 # This won't change
for different subtargets so
cache the result.
3485 proc check_effective_target_vect_perm_byte
{ } {
3486 global et_vect_perm_byte
3488 if [info exists et_vect_perm_byte_saved
] {
3489 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
3491 set et_vect_perm_byte_saved
0
3492 if { ([is
-effective
-target arm_neon_ok
]
3493 && [is
-effective
-target arm_little_endian
])
3494 ||
([istarget aarch64
*-*-*]
3495 && [is
-effective
-target aarch64_little_endian
])
3496 ||
[istarget powerpc
*-*-*]
3497 ||
[istarget spu
-*-*] } {
3498 set et_vect_perm_byte_saved
1
3501 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3502 return $et_vect_perm_byte_saved
3505 #
Return 1 if the target plus current options supports vector permutation
3506 #
on short
-sized elements
, 0 otherwise.
3508 # This won
't change for different subtargets so cache the result.
3510 proc check_effective_target_vect_perm_short { } {
3511 global et_vect_perm_short
3513 if [info exists et_vect_perm_short_saved] {
3514 verbose "check_effective_target_vect_perm_short: using cached result" 2
3516 set et_vect_perm_short_saved 0
3517 if { ([is-effective-target arm_neon_ok]
3518 && [is-effective-target arm_little_endian])
3519 || ([istarget aarch64*-*-*]
3520 && [is-effective-target aarch64_little_endian])
3521 || [istarget powerpc*-*-*]
3522 || [istarget spu-*-*] } {
3523 set et_vect_perm_short_saved 1
3526 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3527 return $et_vect_perm_short_saved
3530 # Return 1 if the target plus current options supports a vector
3531 # widening summation of *short* args into *int* result, 0 otherwise.
3533 # This won't change
for different subtargets so
cache the result.
3535 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
3536 global et_vect_widen_sum_hi_to_si_pattern
3538 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
3539 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3541 set et_vect_widen_sum_hi_to_si_pattern_saved
0
3542 if { [istarget powerpc
*-*-*]
3543 ||
[istarget ia64
-*-*] } {
3544 set et_vect_widen_sum_hi_to_si_pattern_saved
1
3547 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3548 return $et_vect_widen_sum_hi_to_si_pattern_saved
3551 #
Return 1 if the target plus current options supports a vector
3552 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3553 # A target can also support this widening summation
if it can support
3554 # promotion
(unpacking
) from shorts to ints.
3556 # This won
't change for different subtargets so cache the result.
3558 proc check_effective_target_vect_widen_sum_hi_to_si { } {
3559 global et_vect_widen_sum_hi_to_si
3561 if [info exists et_vect_widen_sum_hi_to_si_saved] {
3562 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3564 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
3565 if { [istarget powerpc*-*-*]
3566 || [istarget ia64-*-*] } {
3567 set et_vect_widen_sum_hi_to_si_saved 1
3570 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3571 return $et_vect_widen_sum_hi_to_si_saved
3574 # Return 1 if the target plus current options supports a vector
3575 # widening summation of *char* args into *short* result, 0 otherwise.
3576 # A target can also support this widening summation if it can support
3577 # promotion (unpacking) from chars to shorts.
3579 # This won't change
for different subtargets so
cache the result.
3581 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
3582 global et_vect_widen_sum_qi_to_hi
3584 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
3585 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3587 set et_vect_widen_sum_qi_to_hi_saved
0
3588 if { [check_effective_target_vect_unpack
]
3589 ||
[check_effective_target_arm_neon_ok
]
3590 ||
[istarget ia64
-*-*] } {
3591 set et_vect_widen_sum_qi_to_hi_saved
1
3594 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3595 return $et_vect_widen_sum_qi_to_hi_saved
3598 #
Return 1 if the target plus current options supports a vector
3599 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
3601 # This won
't change for different subtargets so cache the result.
3603 proc check_effective_target_vect_widen_sum_qi_to_si { } {
3604 global et_vect_widen_sum_qi_to_si
3606 if [info exists et_vect_widen_sum_qi_to_si_saved] {
3607 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3609 set et_vect_widen_sum_qi_to_si_saved 0
3610 if { [istarget powerpc*-*-*] } {
3611 set et_vect_widen_sum_qi_to_si_saved 1
3614 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3615 return $et_vect_widen_sum_qi_to_si_saved
3618 # Return 1 if the target plus current options supports a vector
3619 # widening multiplication of *char* args into *short* result, 0 otherwise.
3620 # A target can also support this widening multplication if it can support
3621 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
3622 # multiplication of shorts).
3624 # This won't change
for different subtargets so
cache the result.
3627 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
3628 global et_vect_widen_mult_qi_to_hi
3630 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
3631 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3633 if { [check_effective_target_vect_unpack
]
3634 && [check_effective_target_vect_short_mult
] } {
3635 set et_vect_widen_mult_qi_to_hi_saved
1
3637 set et_vect_widen_mult_qi_to_hi_saved
0
3639 if { [istarget powerpc
*-*-*]
3640 ||
[istarget aarch64
*-*-*]
3641 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3642 set et_vect_widen_mult_qi_to_hi_saved
1
3645 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3646 return $et_vect_widen_mult_qi_to_hi_saved
3649 #
Return 1 if the target plus current options supports a vector
3650 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3651 # A target can also support this widening multplication
if it can support
3652 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
3653 # multiplication of ints
).
3655 # This won
't change for different subtargets so cache the result.
3658 proc check_effective_target_vect_widen_mult_hi_to_si { } {
3659 global et_vect_widen_mult_hi_to_si
3661 if [info exists et_vect_widen_mult_hi_to_si_saved] {
3662 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3664 if { [check_effective_target_vect_unpack]
3665 && [check_effective_target_vect_int_mult] } {
3666 set et_vect_widen_mult_hi_to_si_saved 1
3668 set et_vect_widen_mult_hi_to_si_saved 0
3670 if { [istarget powerpc*-*-*]
3671 || [istarget spu-*-*]
3672 || [istarget ia64-*-*]
3673 || [istarget aarch64*-*-*]
3674 || [istarget i?86-*-*]
3675 || [istarget x86_64-*-*]
3676 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3677 set et_vect_widen_mult_hi_to_si_saved 1
3680 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3681 return $et_vect_widen_mult_hi_to_si_saved
3684 # Return 1 if the target plus current options supports a vector
3685 # widening multiplication of *char* args into *short* result, 0 otherwise.
3687 # This won't change
for different subtargets so
cache the result.
3689 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern
{ } {
3690 global et_vect_widen_mult_qi_to_hi_pattern
3692 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved
] {
3693 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3695 set et_vect_widen_mult_qi_to_hi_pattern_saved
0
3696 if { [istarget powerpc
*-*-*]
3697 ||
([istarget arm
*-*-*]
3698 && [check_effective_target_arm_neon_ok
]
3699 && [check_effective_target_arm_little_endian
]) } {
3700 set et_vect_widen_mult_qi_to_hi_pattern_saved
1
3703 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3704 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3707 #
Return 1 if the target plus current options supports a vector
3708 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3710 # This won
't change for different subtargets so cache the result.
3712 proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
3713 global et_vect_widen_mult_hi_to_si_pattern
3715 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved] {
3716 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3718 set et_vect_widen_mult_hi_to_si_pattern_saved 0
3719 if { [istarget powerpc*-*-*]
3720 || [istarget spu-*-*]
3721 || [istarget ia64-*-*]
3722 || [istarget i?86-*-*]
3723 || [istarget x86_64-*-*]
3724 || ([istarget arm*-*-*]
3725 && [check_effective_target_arm_neon_ok]
3726 && [check_effective_target_arm_little_endian]) } {
3727 set et_vect_widen_mult_hi_to_si_pattern_saved 1
3730 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3731 return $et_vect_widen_mult_hi_to_si_pattern_saved
3734 # Return 1 if the target plus current options supports a vector
3735 # widening shift, 0 otherwise.
3737 # This won't change
for different subtargets so
cache the result.
3739 proc check_effective_target_vect_widen_shift
{ } {
3740 global et_vect_widen_shift_saved
3742 if [info exists et_vect_shift_saved
] {
3743 verbose
"check_effective_target_vect_widen_shift: using cached result" 2
3745 set et_vect_widen_shift_saved
0
3746 if { ([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3747 set et_vect_widen_shift_saved
1
3750 verbose
"check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3751 return $et_vect_widen_shift_saved
3754 #
Return 1 if the target plus current options supports a vector
3755 # dot
-product of signed chars
, 0 otherwise.
3757 # This won
't change for different subtargets so cache the result.
3759 proc check_effective_target_vect_sdot_qi { } {
3760 global et_vect_sdot_qi
3762 if [info exists et_vect_sdot_qi_saved] {
3763 verbose "check_effective_target_vect_sdot_qi: using cached result" 2
3765 set et_vect_sdot_qi_saved 0
3766 if { [istarget ia64-*-*] } {
3767 set et_vect_udot_qi_saved 1
3770 verbose "check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3771 return $et_vect_sdot_qi_saved
3774 # Return 1 if the target plus current options supports a vector
3775 # dot-product of unsigned chars, 0 otherwise.
3777 # This won't change
for different subtargets so
cache the result.
3779 proc check_effective_target_vect_udot_qi
{ } {
3780 global et_vect_udot_qi
3782 if [info exists et_vect_udot_qi_saved
] {
3783 verbose
"check_effective_target_vect_udot_qi: using cached result" 2
3785 set et_vect_udot_qi_saved
0
3786 if { [istarget powerpc
*-*-*]
3787 ||
[istarget ia64
-*-*] } {
3788 set et_vect_udot_qi_saved
1
3791 verbose
"check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
3792 return $et_vect_udot_qi_saved
3795 #
Return 1 if the target plus current options supports a vector
3796 # dot
-product of signed shorts
, 0 otherwise.
3798 # This won
't change for different subtargets so cache the result.
3800 proc check_effective_target_vect_sdot_hi { } {
3801 global et_vect_sdot_hi
3803 if [info exists et_vect_sdot_hi_saved] {
3804 verbose "check_effective_target_vect_sdot_hi: using cached result" 2
3806 set et_vect_sdot_hi_saved 0
3807 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
3808 || [istarget ia64-*-*]
3809 || [istarget i?86-*-*]
3810 || [istarget x86_64-*-*] } {
3811 set et_vect_sdot_hi_saved 1
3814 verbose "check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
3815 return $et_vect_sdot_hi_saved
3818 # Return 1 if the target plus current options supports a vector
3819 # dot-product of unsigned shorts, 0 otherwise.
3821 # This won't change
for different subtargets so
cache the result.
3823 proc check_effective_target_vect_udot_hi
{ } {
3824 global et_vect_udot_hi
3826 if [info exists et_vect_udot_hi_saved
] {
3827 verbose
"check_effective_target_vect_udot_hi: using cached result" 2
3829 set et_vect_udot_hi_saved
0
3830 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*]) } {
3831 set et_vect_udot_hi_saved
1
3834 verbose
"check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
3835 return $et_vect_udot_hi_saved
3839 #
Return 1 if the target plus current options supports a vector
3840 # demotion
(packing
) of shorts
(to chars
) and ints
(to shorts
)
3841 # using modulo arithmetic
, 0 otherwise.
3843 # This won
't change for different subtargets so cache the result.
3845 proc check_effective_target_vect_pack_trunc { } {
3846 global et_vect_pack_trunc
3848 if [info exists et_vect_pack_trunc_saved] {
3849 verbose "check_effective_target_vect_pack_trunc: using cached result" 2
3851 set et_vect_pack_trunc_saved 0
3852 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
3853 || [istarget i?86-*-*]
3854 || [istarget x86_64-*-*]
3855 || [istarget aarch64*-*-*]
3856 || [istarget spu-*-*]
3857 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
3858 && [check_effective_target_arm_little_endian]) } {
3859 set et_vect_pack_trunc_saved 1
3862 verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
3863 return $et_vect_pack_trunc_saved
3866 # Return 1 if the target plus current options supports a vector
3867 # promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
3869 # This won't change
for different subtargets so
cache the result.
3871 proc check_effective_target_vect_unpack
{ } {
3872 global et_vect_unpack
3874 if [info exists et_vect_unpack_saved
] {
3875 verbose
"check_effective_target_vect_unpack: using cached result" 2
3877 set et_vect_unpack_saved
0
3878 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*paired
*])
3879 ||
[istarget i?
86-*-*]
3880 ||
[istarget x86_64
-*-*]
3881 ||
[istarget spu
-*-*]
3882 ||
[istarget ia64
-*-*]
3883 ||
[istarget aarch64
*-*-*]
3884 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
3885 && [check_effective_target_arm_little_endian
]) } {
3886 set et_vect_unpack_saved
1
3889 verbose
"check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
3890 return $et_vect_unpack_saved
3893 #
Return 1 if the target plus current options does not guarantee
3894 # that its STACK_BOUNDARY is
>= the reguired vector alignment.
3896 # This won
't change for different subtargets so cache the result.
3898 proc check_effective_target_unaligned_stack { } {
3899 global et_unaligned_stack_saved
3901 if [info exists et_unaligned_stack_saved] {
3902 verbose "check_effective_target_unaligned_stack: using cached result" 2
3904 set et_unaligned_stack_saved 0
3906 verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
3907 return $et_unaligned_stack_saved
3910 # Return 1 if the target plus current options does not support a vector
3911 # alignment mechanism, 0 otherwise.
3913 # This won't change
for different subtargets so
cache the result.
3915 proc check_effective_target_vect_no_align
{ } {
3916 global et_vect_no_align_saved
3918 if [info exists et_vect_no_align_saved
] {
3919 verbose
"check_effective_target_vect_no_align: using cached result" 2
3921 set et_vect_no_align_saved
0
3922 if { [istarget mipsisa64
*-*-*]
3923 ||
[istarget mips
-sde
-elf
]
3924 ||
[istarget sparc
*-*-*]
3925 ||
[istarget ia64
-*-*]
3926 ||
[check_effective_target_arm_vect_no_misalign
]
3927 ||
([istarget mips
*-*-*]
3928 && [check_effective_target_mips_loongson
]) } {
3929 set et_vect_no_align_saved
1
3932 verbose
"check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
3933 return $et_vect_no_align_saved
3936 #
Return 1 if the target supports a vector misalign access
, 0 otherwise.
3938 # This won
't change for different subtargets so cache the result.
3940 proc check_effective_target_vect_hw_misalign { } {
3941 global et_vect_hw_misalign_saved
3943 if [info exists et_vect_hw_misalign_saved] {
3944 verbose "check_effective_target_vect_hw_misalign: using cached result" 2
3946 set et_vect_hw_misalign_saved 0
3947 if { ([istarget x86_64-*-*]
3948 || [istarget aarch64*-*-*]
3949 || [istarget i?86-*-*]) } {
3950 set et_vect_hw_misalign_saved 1
3953 verbose "check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
3954 return $et_vect_hw_misalign_saved
3958 # Return 1 if arrays are aligned to the vector alignment
3959 # boundary, 0 otherwise.
3961 # This won't change
for different subtargets so
cache the result.
3963 proc check_effective_target_vect_aligned_arrays
{ } {
3964 global et_vect_aligned_arrays
3966 if [info exists et_vect_aligned_arrays_saved
] {
3967 verbose
"check_effective_target_vect_aligned_arrays: using cached result" 2
3969 set et_vect_aligned_arrays_saved
0
3970 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
3971 if { ([is
-effective
-target lp64
]
3972 && ( ![check_avx_available
]
3973 ||
[check_prefer_avx128
])) } {
3974 set et_vect_aligned_arrays_saved
1
3977 if [istarget spu
-*-*] {
3978 set et_vect_aligned_arrays_saved
1
3981 verbose
"check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
3982 return $et_vect_aligned_arrays_saved
3985 #
Return 1 if types of size
32 bit or less are naturally aligned
3986 #
(aligned to their type
-size
), 0 otherwise.
3988 # This won
't change for different subtargets so cache the result.
3990 proc check_effective_target_natural_alignment_32 { } {
3991 global et_natural_alignment_32
3993 if [info exists et_natural_alignment_32_saved] {
3994 verbose "check_effective_target_natural_alignment_32: using cached result" 2
3996 # FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
3997 set et_natural_alignment_32_saved 1
3998 if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
3999 set et_natural_alignment_32_saved 0
4002 verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4003 return $et_natural_alignment_32_saved
4006 # Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
4007 # type-size), 0 otherwise.
4009 # This won't change
for different subtargets so
cache the result.
4011 proc check_effective_target_natural_alignment_64
{ } {
4012 global et_natural_alignment_64
4014 if [info exists et_natural_alignment_64_saved
] {
4015 verbose
"check_effective_target_natural_alignment_64: using cached result" 2
4017 set et_natural_alignment_64_saved
0
4018 if { ([is
-effective
-target lp64
] && ![istarget
*-*-darwin
*])
4019 ||
[istarget spu
-*-*] } {
4020 set et_natural_alignment_64_saved
1
4023 verbose
"check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4024 return $et_natural_alignment_64_saved
4027 #
Return 1 if all vector types are naturally aligned
(aligned to their
4028 # type
-size
), 0 otherwise.
4030 # This won
't change for different subtargets so cache the result.
4032 proc check_effective_target_vect_natural_alignment { } {
4033 global et_vect_natural_alignment
4035 if [info exists et_vect_natural_alignment_saved] {
4036 verbose "check_effective_target_vect_natural_alignment: using cached result" 2
4038 set et_vect_natural_alignment_saved 1
4039 if { [check_effective_target_arm_eabi] } {
4040 set et_vect_natural_alignment_saved 0
4043 verbose "check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4044 return $et_vect_natural_alignment_saved
4047 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
4049 # This won't change
for different subtargets so
cache the result.
4051 proc check_effective_target_vector_alignment_reachable
{ } {
4052 global et_vector_alignment_reachable
4054 if [info exists et_vector_alignment_reachable_saved
] {
4055 verbose
"check_effective_target_vector_alignment_reachable: using cached result" 2
4057 if { [check_effective_target_vect_aligned_arrays
]
4058 ||
[check_effective_target_natural_alignment_32
] } {
4059 set et_vector_alignment_reachable_saved
1
4061 set et_vector_alignment_reachable_saved
0
4064 verbose
"check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4065 return $et_vector_alignment_reachable_saved
4068 #
Return 1 if vector alignment
for 64 bit is reachable
, 0 otherwise.
4070 # This won
't change for different subtargets so cache the result.
4072 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
4073 global et_vector_alignment_reachable_for_64bit
4075 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
4076 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4078 if { [check_effective_target_vect_aligned_arrays]
4079 || [check_effective_target_natural_alignment_64] } {
4080 set et_vector_alignment_reachable_for_64bit_saved 1
4082 set et_vector_alignment_reachable_for_64bit_saved 0
4085 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4086 return $et_vector_alignment_reachable_for_64bit_saved
4089 # Return 1 if the target only requires element alignment for vector accesses
4091 proc check_effective_target_vect_element_align { } {
4092 global et_vect_element_align
4094 if [info exists et_vect_element_align] {
4095 verbose "check_effective_target_vect_element_align: using cached result" 2
4097 set et_vect_element_align 0
4098 if { ([istarget arm*-*-*]
4099 && ![check_effective_target_arm_vect_no_misalign])
4100 || [check_effective_target_vect_hw_misalign] } {
4101 set et_vect_element_align 1
4105 verbose "check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4106 return $et_vect_element_align
4109 # Return 1 if the target supports vector conditional operations, 0 otherwise.
4111 proc check_effective_target_vect_condition { } {
4112 global et_vect_cond_saved
4114 if [info exists et_vect_cond_saved] {
4115 verbose "check_effective_target_vect_cond: using cached result" 2
4117 set et_vect_cond_saved 0
4118 if { [istarget aarch64*-*-*]
4119 || [istarget powerpc*-*-*]
4120 || [istarget ia64-*-*]
4121 || [istarget i?86-*-*]
4122 || [istarget spu-*-*]
4123 || [istarget x86_64-*-*]
4124 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4125 set et_vect_cond_saved 1
4129 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4130 return $et_vect_cond_saved
4133 # Return 1 if the target supports vector conditional operations where
4134 # the comparison has different type from the lhs, 0 otherwise.
4136 proc check_effective_target_vect_cond_mixed { } {
4137 global et_vect_cond_mixed_saved
4139 if [info exists et_vect_cond_mixed_saved] {
4140 verbose "check_effective_target_vect_cond_mixed: using cached result" 2
4142 set et_vect_cond_mixed_saved 0
4143 if { [istarget i?86-*-*]
4144 || [istarget x86_64-*-*]
4145 || [istarget powerpc*-*-*] } {
4146 set et_vect_cond_mixed_saved 1
4150 verbose "check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4151 return $et_vect_cond_mixed_saved
4154 # Return 1 if the target supports vector char multiplication, 0 otherwise.
4156 proc check_effective_target_vect_char_mult { } {
4157 global et_vect_char_mult_saved
4159 if [info exists et_vect_char_mult_saved] {
4160 verbose "check_effective_target_vect_char_mult: using cached result" 2
4162 set et_vect_char_mult_saved 0
4163 if { [istarget aarch64*-*-*]
4164 || [istarget ia64-*-*]
4165 || [istarget i?86-*-*]
4166 || [istarget x86_64-*-*]
4167 || [check_effective_target_arm32] } {
4168 set et_vect_char_mult_saved 1
4172 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4173 return $et_vect_char_mult_saved
4176 # Return 1 if the target supports vector short multiplication, 0 otherwise.
4178 proc check_effective_target_vect_short_mult { } {
4179 global et_vect_short_mult_saved
4181 if [info exists et_vect_short_mult_saved] {
4182 verbose "check_effective_target_vect_short_mult: using cached result" 2
4184 set et_vect_short_mult_saved 0
4185 if { [istarget ia64-*-*]
4186 || [istarget spu-*-*]
4187 || [istarget i?86-*-*]
4188 || [istarget x86_64-*-*]
4189 || [istarget powerpc*-*-*]
4190 || [istarget aarch64*-*-*]
4191 || [check_effective_target_arm32]
4192 || ([istarget mips*-*-*]
4193 && [check_effective_target_mips_loongson]) } {
4194 set et_vect_short_mult_saved 1
4198 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4199 return $et_vect_short_mult_saved
4202 # Return 1 if the target supports vector int multiplication, 0 otherwise.
4204 proc check_effective_target_vect_int_mult { } {
4205 global et_vect_int_mult_saved
4207 if [info exists et_vect_int_mult_saved] {
4208 verbose "check_effective_target_vect_int_mult: using cached result" 2
4210 set et_vect_int_mult_saved 0
4211 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4212 || [istarget spu-*-*]
4213 || [istarget i?86-*-*]
4214 || [istarget x86_64-*-*]
4215 || [istarget ia64-*-*]
4216 || [istarget aarch64*-*-*]
4217 || [check_effective_target_arm32] } {
4218 set et_vect_int_mult_saved 1
4222 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4223 return $et_vect_int_mult_saved
4226 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
4228 proc check_effective_target_vect_extract_even_odd { } {
4229 global et_vect_extract_even_odd_saved
4231 if [info exists et_vect_extract_even_odd_saved] {
4232 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
4234 set et_vect_extract_even_odd_saved 0
4235 if { [istarget aarch64*-*-*]
4236 || [istarget powerpc*-*-*]
4237 || [is-effective-target arm_neon_ok]
4238 || [istarget i?86-*-*]
4239 || [istarget x86_64-*-*]
4240 || [istarget ia64-*-*]
4241 || [istarget spu-*-*]
4242 || ([istarget mips*-*-*]
4243 && [check_effective_target_mpaired_single]) } {
4244 set et_vect_extract_even_odd_saved 1
4248 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4249 return $et_vect_extract_even_odd_saved
4252 # Return 1 if the target supports vector interleaving, 0 otherwise.
4254 proc check_effective_target_vect_interleave { } {
4255 global et_vect_interleave_saved
4257 if [info exists et_vect_interleave_saved] {
4258 verbose "check_effective_target_vect_interleave: using cached result" 2
4260 set et_vect_interleave_saved 0
4261 if { [istarget aarch64*-*-*]
4262 || [istarget powerpc*-*-*]
4263 || [is-effective-target arm_neon_ok]
4264 || [istarget i?86-*-*]
4265 || [istarget x86_64-*-*]
4266 || [istarget ia64-*-*]
4267 || [istarget spu-*-*]
4268 || ([istarget mips*-*-*]
4269 && [check_effective_target_mpaired_single]) } {
4270 set et_vect_interleave_saved 1
4274 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4275 return $et_vect_interleave_saved
4278 foreach N {2 3 4 8} {
4279 eval [string map [list N $N] {
4280 # Return 1 if the target supports 2-vector interleaving
4281 proc check_effective_target_vect_stridedN { } {
4282 global et_vect_stridedN_saved
4284 if [info exists et_vect_stridedN_saved] {
4285 verbose "check_effective_target_vect_stridedN: using cached result" 2
4287 set et_vect_stridedN_saved 0
4289 && [check_effective_target_vect_interleave]
4290 && [check_effective_target_vect_extract_even_odd] } {
4291 set et_vect_stridedN_saved 1
4293 if { ([istarget arm*-*-*]
4294 || [istarget aarch64*-*-*]) && N >= 2 && N <= 4 } {
4295 set et_vect_stridedN_saved 1
4299 verbose "check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4300 return $et_vect_stridedN_saved
4305 # Return 1 if the target supports multiple vector sizes
4307 proc check_effective_target_vect_multiple_sizes { } {
4308 global et_vect_multiple_sizes_saved
4310 set et_vect_multiple_sizes_saved 0
4311 if { ([istarget aarch64*-*-*]
4312 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])) } {
4313 set et_vect_multiple_sizes_saved 1
4315 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4316 if { ([check_avx_available] && ![check_prefer_avx128]) } {
4317 set et_vect_multiple_sizes_saved 1
4321 verbose "check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4322 return $et_vect_multiple_sizes_saved
4325 # Return 1 if the target supports vectors of 64 bits.
4327 proc check_effective_target_vect64 { } {
4328 global et_vect64_saved
4330 if [info exists et_vect64_saved] {
4331 verbose "check_effective_target_vect64: using cached result" 2
4333 set et_vect64_saved 0
4334 if { ([istarget arm*-*-*]
4335 && [check_effective_target_arm_neon_ok]
4336 && [check_effective_target_arm_little_endian]) } {
4337 set et_vect64_saved 1
4341 verbose "check_effective_target_vect64: returning $et_vect64_saved" 2
4342 return $et_vect64_saved
4345 # Return 1 if the target supports vector copysignf calls.
4347 proc check_effective_target_vect_call_copysignf { } {
4348 global et_vect_call_copysignf_saved
4350 if [info exists et_vect_call_copysignf_saved] {
4351 verbose "check_effective_target_vect_call_copysignf: using cached result" 2
4353 set et_vect_call_copysignf_saved 0
4354 if { [istarget i?86-*-*]
4355 || [istarget x86_64-*-*]
4356 || [istarget powerpc*-*-*] } {
4357 set et_vect_call_copysignf_saved 1
4361 verbose "check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4362 return $et_vect_call_copysignf_saved
4365 # Return 1 if the target supports vector sqrtf calls.
4367 proc check_effective_target_vect_call_sqrtf { } {
4368 global et_vect_call_sqrtf_saved
4370 if [info exists et_vect_call_sqrtf_saved] {
4371 verbose "check_effective_target_vect_call_sqrtf: using cached result" 2
4373 set et_vect_call_sqrtf_saved 0
4374 if { [istarget aarch64*-*-*]
4375 || [istarget i?86-*-*]
4376 || [istarget x86_64-*-*]
4377 || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } {
4378 set et_vect_call_sqrtf_saved 1
4382 verbose "check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4383 return $et_vect_call_sqrtf_saved
4386 # Return 1 if the target supports vector lrint calls.
4388 proc check_effective_target_vect_call_lrint { } {
4389 set et_vect_call_lrint 0
4390 if { ([istarget i?86-*-*] || [istarget x86_64-*-*]) && [check_effective_target_ilp32] } {
4391 set et_vect_call_lrint 1
4394 verbose "check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4395 return $et_vect_call_lrint
4398 # Return 1 if the target supports vector btrunc calls.
4400 proc check_effective_target_vect_call_btrunc { } {
4401 global et_vect_call_btrunc_saved
4403 if [info exists et_vect_call_btrunc_saved] {
4404 verbose "check_effective_target_vect_call_btrunc: using cached result" 2
4406 set et_vect_call_btrunc_saved 0
4407 if { [istarget aarch64*-*-*] } {
4408 set et_vect_call_btrunc_saved 1
4412 verbose "check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4413 return $et_vect_call_btrunc_saved
4416 # Return 1 if the target supports vector btruncf calls.
4418 proc check_effective_target_vect_call_btruncf { } {
4419 global et_vect_call_btruncf_saved
4421 if [info exists et_vect_call_btruncf_saved] {
4422 verbose "check_effective_target_vect_call_btruncf: using cached result" 2
4424 set et_vect_call_btruncf_saved 0
4425 if { [istarget aarch64*-*-*] } {
4426 set et_vect_call_btruncf_saved 1
4430 verbose "check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4431 return $et_vect_call_btruncf_saved
4434 # Return 1 if the target supports vector ceil calls.
4436 proc check_effective_target_vect_call_ceil { } {
4437 global et_vect_call_ceil_saved
4439 if [info exists et_vect_call_ceil_saved] {
4440 verbose "check_effective_target_vect_call_ceil: using cached result" 2
4442 set et_vect_call_ceil_saved 0
4443 if { [istarget aarch64*-*-*] } {
4444 set et_vect_call_ceil_saved 1
4448 verbose "check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4449 return $et_vect_call_ceil_saved
4452 # Return 1 if the target supports vector ceilf calls.
4454 proc check_effective_target_vect_call_ceilf { } {
4455 global et_vect_call_ceilf_saved
4457 if [info exists et_vect_call_ceilf_saved] {
4458 verbose "check_effective_target_vect_call_ceilf: using cached result" 2
4460 set et_vect_call_ceilf_saved 0
4461 if { [istarget aarch64*-*-*] } {
4462 set et_vect_call_ceilf_saved 1
4466 verbose "check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4467 return $et_vect_call_ceilf_saved
4470 # Return 1 if the target supports vector floor calls.
4472 proc check_effective_target_vect_call_floor { } {
4473 global et_vect_call_floor_saved
4475 if [info exists et_vect_call_floor_saved] {
4476 verbose "check_effective_target_vect_call_floor: using cached result" 2
4478 set et_vect_call_floor_saved 0
4479 if { [istarget aarch64*-*-*] } {
4480 set et_vect_call_floor_saved 1
4484 verbose "check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4485 return $et_vect_call_floor_saved
4488 # Return 1 if the target supports vector floorf calls.
4490 proc check_effective_target_vect_call_floorf { } {
4491 global et_vect_call_floorf_saved
4493 if [info exists et_vect_call_floorf_saved] {
4494 verbose "check_effective_target_vect_call_floorf: using cached result" 2
4496 set et_vect_call_floorf_saved 0
4497 if { [istarget aarch64*-*-*] } {
4498 set et_vect_call_floorf_saved 1
4502 verbose "check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4503 return $et_vect_call_floorf_saved
4506 # Return 1 if the target supports vector lceil calls.
4508 proc check_effective_target_vect_call_lceil { } {
4509 global et_vect_call_lceil_saved
4511 if [info exists et_vect_call_lceil_saved] {
4512 verbose "check_effective_target_vect_call_lceil: using cached result" 2
4514 set et_vect_call_lceil_saved 0
4515 if { [istarget aarch64*-*-*] } {
4516 set et_vect_call_lceil_saved 1
4520 verbose "check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4521 return $et_vect_call_lceil_saved
4524 # Return 1 if the target supports vector lfloor calls.
4526 proc check_effective_target_vect_call_lfloor { } {
4527 global et_vect_call_lfloor_saved
4529 if [info exists et_vect_call_lfloor_saved] {
4530 verbose "check_effective_target_vect_call_lfloor: using cached result" 2
4532 set et_vect_call_lfloor_saved 0
4533 if { [istarget aarch64*-*-*] } {
4534 set et_vect_call_lfloor_saved 1
4538 verbose "check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4539 return $et_vect_call_lfloor_saved
4542 # Return 1 if the target supports vector nearbyint calls.
4544 proc check_effective_target_vect_call_nearbyint { } {
4545 global et_vect_call_nearbyint_saved
4547 if [info exists et_vect_call_nearbyint_saved] {
4548 verbose "check_effective_target_vect_call_nearbyint: using cached result" 2
4550 set et_vect_call_nearbyint_saved 0
4551 if { [istarget aarch64*-*-*] } {
4552 set et_vect_call_nearbyint_saved 1
4556 verbose "check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4557 return $et_vect_call_nearbyint_saved
4560 # Return 1 if the target supports vector nearbyintf calls.
4562 proc check_effective_target_vect_call_nearbyintf { } {
4563 global et_vect_call_nearbyintf_saved
4565 if [info exists et_vect_call_nearbyintf_saved] {
4566 verbose "check_effective_target_vect_call_nearbyintf: using cached result" 2
4568 set et_vect_call_nearbyintf_saved 0
4569 if { [istarget aarch64*-*-*] } {
4570 set et_vect_call_nearbyintf_saved 1
4574 verbose "check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4575 return $et_vect_call_nearbyintf_saved
4578 # Return 1 if the target supports vector round calls.
4580 proc check_effective_target_vect_call_round { } {
4581 global et_vect_call_round_saved
4583 if [info exists et_vect_call_round_saved] {
4584 verbose "check_effective_target_vect_call_round: using cached result" 2
4586 set et_vect_call_round_saved 0
4587 if { [istarget aarch64*-*-*] } {
4588 set et_vect_call_round_saved 1
4592 verbose "check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4593 return $et_vect_call_round_saved
4596 # Return 1 if the target supports vector roundf calls.
4598 proc check_effective_target_vect_call_roundf { } {
4599 global et_vect_call_roundf_saved
4601 if [info exists et_vect_call_roundf_saved] {
4602 verbose "check_effective_target_vect_call_roundf: using cached result" 2
4604 set et_vect_call_roundf_saved 0
4605 if { [istarget aarch64*-*-*] } {
4606 set et_vect_call_roundf_saved 1
4610 verbose "check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4611 return $et_vect_call_roundf_saved
4614 # Return 1 if the target supports section-anchors
4616 proc check_effective_target_section_anchors { } {
4617 global et_section_anchors_saved
4619 if [info exists et_section_anchors_saved] {
4620 verbose "check_effective_target_section_anchors: using cached result" 2
4622 set et_section_anchors_saved 0
4623 if { [istarget powerpc*-*-*]
4624 || [istarget arm*-*-*] } {
4625 set et_section_anchors_saved 1
4629 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4630 return $et_section_anchors_saved
4633 # Return 1 if the target supports atomic operations on "int_128" values.
4635 proc check_effective_target_sync_int_128 { } {
4636 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
4637 && ![is-effective-target ia32] } {
4644 # Return 1 if the target supports atomic operations on "int_128" values
4645 # and can execute them.
4647 proc check_effective_target_sync_int_128_runtime { } {
4648 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
4649 && ![is-effective-target ia32] } {
4650 return [check_cached_effective_target sync_int_128_available {
4651 check_runtime_nocache sync_int_128_available {
4655 unsigned int eax, ebx, ecx, edx;
4656 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
4657 return !(ecx & bit_CMPXCHG16B);
4667 # Return 1 if the target supports atomic operations on "long long".
4669 # Note: 32bit x86 targets require -march=pentium in dg-options.
4671 proc check_effective_target_sync_long_long { } {
4672 if { [istarget x86_64-*-*]
4673 || [istarget i?86-*-*])
4674 || [istarget aarch64*-*-*]
4675 || [istarget arm*-*-*]
4676 || [istarget alpha*-*-*]
4677 || ([istarget sparc*-*-*] && [check_effective_target_lp64]) } {
4684 # Return 1 if the target supports atomic operations on "long long"
4685 # and can execute them.
4687 # Note: 32bit x86 targets require -march=pentium in dg-options.
4689 proc check_effective_target_sync_long_long_runtime { } {
4690 if { [istarget x86_64-*-*]
4691 || [istarget i?86-*-*] } {
4692 return [check_cached_effective_target sync_long_long_available {
4693 check_runtime_nocache sync_long_long_available {
4697 unsigned int eax, ebx, ecx, edx;
4698 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
4699 return !(edx & bit_CMPXCHG8B);
4704 } elseif { [istarget aarch64*-*-*] } {
4706 } elseif { [istarget arm*-*-linux-*] } {
4707 return [check_runtime sync_longlong_runtime {
4713 if (sizeof (long long) != 8)
4716 /* Just check for native; checking for kernel fallback is tricky. */
4717 asm volatile ("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4722 } elseif { [istarget alpha*-*-*] } {
4724 } elseif { ([istarget sparc*-*-*]
4725 && [check_effective_target_lp64]
4726 && [check_effective_target_ultrasparc_hw]) } {
4728 } elseif { [istarget powerpc*-*-*] && [check_effective_target_lp64] } {
4735 # Return 1 if the target supports atomic operations on "int" and "long".
4737 proc check_effective_target_sync_int_long { } {
4738 global et_sync_int_long_saved
4740 if [info exists et_sync_int_long_saved] {
4741 verbose "check_effective_target_sync_int_long: using cached result" 2
4743 set et_sync_int_long_saved 0
4744 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
4745 #
load-reserved/store
-conditional instructions.
4746 if { [istarget ia64
-*-*]
4747 ||
[istarget i?
86-*-*]
4748 ||
[istarget x86_64
-*-*]
4749 ||
[istarget aarch64
*-*-*]
4750 ||
[istarget alpha
*-*-*]
4751 ||
[istarget arm
*-*-linux
-*]
4752 ||
[istarget bfin
*-*linux
*]
4753 ||
[istarget hppa
*-*linux
*]
4754 ||
[istarget s390
*-*-*]
4755 ||
[istarget powerpc
*-*-*]
4756 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
4757 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
4758 ||
[check_effective_target_mips_llsc
] } {
4759 set et_sync_int_long_saved
1
4763 verbose
"check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
4764 return $et_sync_int_long_saved
4767 #
Return 1 if the target supports atomic operations
on "char" and "short".
4769 proc check_effective_target_sync_char_short
{ } {
4770 global et_sync_char_short_saved
4772 if [info exists et_sync_char_short_saved
] {
4773 verbose
"check_effective_target_sync_char_short: using cached result" 2
4775 set et_sync_char_short_saved
0
4776 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
4777 # load-reserved/store-conditional instructions.
4778 if { [istarget aarch64*-*-*]
4779 || [istarget ia64-*-*]
4780 || [istarget i?86-*-*]
4781 || [istarget x86_64-*-*]
4782 || [istarget alpha*-*-*]
4783 || [istarget arm*-*-linux-*]
4784 || [istarget hppa*-*linux*]
4785 || [istarget s390*-*-*]
4786 || [istarget powerpc*-*-*]
4787 || [istarget crisv32-*-*] || [istarget cris-*-*]
4788 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
4789 || [check_effective_target_mips_llsc] } {
4790 set et_sync_char_short_saved 1
4794 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
4795 return $et_sync_char_short_saved
4798 # Return 1 if the target uses a ColdFire FPU.
4800 proc check_effective_target_coldfire_fpu { } {
4801 return [check_no_compiler_messages coldfire_fpu assembly {
4808 # Return true if this is a uClibc target.
4810 proc check_effective_target_uclibc {} {
4811 return [check_no_compiler_messages uclibc object {
4812 #include <features.h>
4813 #if !defined (__UCLIBC__)
4819 # Return true if this is a uclibc target and if the uclibc feature
4820 # described by __$feature__ is not present.
4822 proc check_missing_uclibc_feature {feature} {
4823 return [check_no_compiler_messages $feature object "
4824 #include <features.h>
4825 #if !defined (__UCLIBC) || defined (__${feature}__)
4831 # Return true if this is a Newlib target.
4833 proc check_effective_target_newlib {} {
4834 return [check_no_compiler_messages newlib object {
4839 # Return true if this is NOT a Bionic target.
4841 proc check_effective_target_non_bionic {} {
4842 return [check_no_compiler_messages non_bionic object {
4844 #if defined (__BIONIC__)
4851 # (a) an error of a few ULP is expected in string to floating-point
4852 # conversion functions; and
4853 # (b) overflow is not always detected correctly by those functions.
4855 proc check_effective_target_lax_strtofp {} {
4856 # By default, assume that all uClibc targets suffer from this.
4857 return [check_effective_target_uclibc]
4860 # Return 1 if this is a target for which wcsftime is a dummy
4861 # function that always returns 0.
4863 proc check_effective_target_dummy_wcsftime {} {
4864 # By default, assume that all uClibc targets suffer from this.
4865 return [check_effective_target_uclibc]
4868 # Return 1 if constructors with initialization priority arguments are
4869 # supposed on this target.
4871 proc check_effective_target_init_priority {} {
4872 return [check_no_compiler_messages init_priority assembly "
4873 void f() __attribute__((constructor (1000)));
4878 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
4879 # This can be used with any check_* proc that takes no argument and
4880 # returns only 1 or 0. It could be used with check_* procs that take
4881 # arguments with keywords that pass particular arguments.
4883 proc is-effective-target { arg } {
4885 if { [info procs check_effective_target_${arg}] != [list] } {
4886 set selected [check_effective_target_${arg}]
4889 "vmx_hw" { set selected [check_vmx_hw_available] }
4890 "vsx_hw" { set selected [check_vsx_hw_available] }
4891 "p8vector_hw" { set selected [check_p8vector_hw_available] }
4892 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
4893 "named_sections" { set selected [check_named_sections_available] }
4894 "gc_sections" { set selected [check_gc_sections_available] }
4895 "cxa_atexit" { set selected [check_cxa_atexit_available] }
4896 default { error "unknown effective target keyword `$arg'" }
4899 verbose
"is-effective-target: $arg $selected" 2
4903 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
4905 proc is
-effective
-target
-keyword
{ arg } {
4906 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4909 # These have different names
for their check_
* procs.
4911 "vmx_hw" { return 1 }
4912 "vsx_hw" { return 1 }
4913 "p8vector_hw" { return 1 }
4914 "ppc_recip_hw" { return 1 }
4915 "named_sections" { return 1 }
4916 "gc_sections" { return 1 }
4917 "cxa_atexit" { return 1 }
4918 default
{ return 0 }
4923 #
Return 1 if target default to short enums
4925 proc check_effective_target_short_enums
{ } {
4926 return [check_no_compiler_messages short_enums assembly
{
4928 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
4932 #
Return 1 if target supports merging string constants at link time.
4934 proc check_effective_target_string_merging
{ } {
4935 return [check_no_messages_and_pattern string_merging \
4936 "rodata\\.str" assembly {
4937 const char
*var
= "String";
4941 #
Return 1 if target has the basic signed and unsigned types in
4942 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
4943 # working
<stdint.h
> for all targets.
4945 proc check_effective_target_stdint_types
{ } {
4946 return [check_no_compiler_messages stdint_types assembly
{
4948 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
4949 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
4953 #
Return 1 if target has the basic signed and unsigned types in
4954 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
4955 # these types agree with those in the header, as some systems have
4956 # only <inttypes.h>.
4958 proc check_effective_target_inttypes_types { } {
4959 return [check_no_compiler_messages inttypes_types assembly {
4960 #include <inttypes.h>
4961 int8_t a; int16_t b; int32_t c; int64_t d;
4962 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
4966 # Return 1 if programs are intended to be run on a simulator
4967 # (i.e. slowly) rather than hardware (i.e. fast).
4969 proc check_effective_target_simulator { } {
4971 # All "src/sim" simulators set this one.
4972 if [board_info target exists is_simulator] {
4973 return [board_info target is_simulator]
4976 # The "sid" simulators don't
set that one
, but at least they
set
4978 if [board_info target
exists slow_simulator
] {
4979 return [board_info target slow_simulator
]
4985 #
Return 1 if programs are intended to be run
on hardware rather than
4988 proc check_effective_target_hw
{ } {
4990 # All
"src/sim" simulators set this one.
4991 if [board_info target
exists is_simulator
] {
4992 if [board_info target is_simulator
] {
4999 # The
"sid" simulators don't set that one, but at least they set
5001 if [board_info target
exists slow_simulator
] {
5002 if [board_info target slow_simulator
] {
5012 #
Return 1 if the target is a VxWorks kernel.
5014 proc check_effective_target_vxworks_kernel
{ } {
5015 return [check_no_compiler_messages vxworks_kernel assembly
{
5016 #
if !defined __vxworks || defined __RTP__
5022 #
Return 1 if the target is a VxWorks RTP.
5024 proc check_effective_target_vxworks_rtp
{ } {
5025 return [check_no_compiler_messages vxworks_rtp assembly
{
5026 #
if !defined __vxworks ||
!defined __RTP__
5032 #
Return 1 if the target is expected to provide wide character support.
5034 proc check_effective_target_wchar
{ } {
5035 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5038 return [check_no_compiler_messages wchar assembly
{
5043 #
Return 1 if the target has
<pthread.h
>.
5045 proc check_effective_target_pthread_h
{ } {
5046 return [check_no_compiler_messages pthread_h assembly
{
5047 #
include <pthread.h
>
5051 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5052 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5053 # chsize. We test
for a trivially functional truncation
; no stubs.
5054 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5055 # different function to be used.
5057 proc check_effective_target_fd_truncate { } {
5059 #define _FILE_OFFSET_BITS 64
5065 FILE *f = fopen ("tst.tmp", "wb");
5067 const char t[] = "test writing more than ten characters";
5071 write (fd, t, sizeof (t) - 1);
5073 if (ftruncate (fd, 10) != 0)
5082 f = fopen ("tst.tmp", "rb");
5083 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5091 if { [check_runtime ftruncate $prog] } {
5095 regsub "ftruncate" $prog "chsize" prog
5096 return [check_runtime chsize $prog]
5099 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5101 proc add_options_for_c99_runtime { flags } {
5102 if { [istarget *-*-solaris2*] } {
5103 return "$flags -std=c99"
5105 if { [istarget powerpc-*-darwin*] } {
5106 return "$flags -mmacosx-version-min=10.3"
5111 # Add to FLAGS all the target-specific flags needed to enable
5112 # full IEEE compliance mode.
5114 proc add_options_for_ieee { flags } {
5115 if { [istarget alpha*-*-*]
5116 || [istarget sh*-*-*] } {
5117 return "$flags -mieee"
5119 if { [istarget rx-*-*] } {
5120 return "$flags -mnofpu"
5125 # Add to FLAGS the flags needed to enable functions to bind locally
5126 # when using pic/PIC passes in the testsuite.
5128 proc add_options_for_bind_pic_locally { flags } {
5129 if {[check_no_compiler_messages using_pic2 assembly {
5134 return "$flags -fPIE"
5136 if {[check_no_compiler_messages using_pic1 assembly {
5141 return "$flags -fpie"
5147 # Add to FLAGS the flags needed to enable 64-bit vectors.
5149 proc add_options_for_double_vectors { flags } {
5150 if [is-effective-target arm_neon_ok] {
5151 return "$flags -mvectorize-with-neon-double"
5157 # Add to FLAGS the flags needed to disable inlining of
5158 # UPC run-time access routines.
5160 proc add_options_for_upc_library_calls { flags } {
5161 return "$flags -fno-upc-inline-lib"
5164 # Check if UPC struct pts build
5166 proc check_effective_target_upc_struct_pts { } {
5167 return [check_no_compiler_messages upc_struct_pts object {
5169 #ifndef __UPC_PTS_STRUCT_REP__
5170 # error struct PTS is not supported
5175 # Check if UPC packed pts build
5177 proc check_effective_target_upc_packed_pts { } {
5178 return [check_no_compiler_messages upc_packed_pts object {
5180 #ifndef __UPC_PTS_PACKED_REP__
5181 # error packed PTS is not supported
5186 # Return 1 if the target provides a full C99 runtime.
5188 proc check_effective_target_c99_runtime { } {
5189 return [check_cached_effective_target c99_runtime {
5192 set file [open "$srcdir/gcc.dg/builtins-config.h"]
5193 set contents [read $file]
5196 #ifndef HAVE_C99_RUNTIME
5200 check_no_compiler_messages_nocache c99_runtime assembly \
5201 $contents [add_options_for_c99_runtime ""]
5205 # Return 1 if target wchar_t is at least 4 bytes.
5207 proc check_effective_target_4byte_wchar_t { } {
5208 return [check_no_compiler_messages 4byte_wchar_t object {
5209 int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
5213 # Return 1 if the target supports automatic stack alignment.
5215 proc check_effective_target_automatic_stack_alignment { } {
5216 # Ordinarily x86 supports automatic stack alignment ...
5217 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
5218 if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
5219 # ... except Win64 SEH doesn't. Succeed
for Win32 though.
5220 return [check_effective_target_ilp32
];
5227 #
Return true
if we are compiling
for AVX target.
5229 proc check_avx_available
{ } {
5230 if { [check_no_compiler_messages avx_available assembly
{
5240 #
Return true
if 32- and
16-bytes vectors are available.
5242 proc check_effective_target_vect_sizes_32B_16B
{ } {
5243 return [check_avx_available
];
5246 #
Return true
if 128-bits vectors are preferred even
if 256-bits vectors
5249 proc check_prefer_avx128
{ } {
5250 if ![check_avx_available
] {
5253 return [check_no_messages_and_pattern avx_explicit
"xmm" assembly {
5254 float a
[1024],b
[1024],c
[1024];
5255 void foo
(void
) { int i
; for (i
= 0; i
< 1024; i
++) a
[i
]=b
[i
]+c
[i
];}
5256 } "-O2 -ftree-vectorize"]
5260 #
Return 1 if avx512f instructions can be compiled.
5262 proc check_effective_target_avx512f
{ } {
5263 return [check_no_compiler_messages avx512f object
{
5264 typedef double __m512d __attribute__
((__vector_size__
(64)));
5266 __m512d _mm512_add
(__m512d a
)
5268 return __builtin_ia32_addpd512_mask
(a
, a
, a
, 1, 4);
5273 #
Return 1 if avx instructions can be compiled.
5275 proc check_effective_target_avx
{ } {
5276 return [check_no_compiler_messages avx object
{
5277 void _mm256_zeroall
(void
)
5279 __builtin_ia32_vzeroall
();
5284 #
Return 1 if avx2 instructions can be compiled.
5285 proc check_effective_target_avx2
{ } {
5286 return [check_no_compiler_messages avx2 object
{
5287 typedef long long __v4di __attribute__
((__vector_size__
(32)));
5289 mm256_is32_andnotsi256
(__v4di __X
, __v4di __Y
)
5291 return __builtin_ia32_andnotsi256
(__X
, __Y
);
5296 #
Return 1 if sse instructions can be compiled.
5297 proc check_effective_target_sse
{ } {
5298 return [check_no_compiler_messages sse object
{
5301 __builtin_ia32_stmxcsr
();
5307 #
Return 1 if sse2 instructions can be compiled.
5308 proc check_effective_target_sse2
{ } {
5309 return [check_no_compiler_messages sse2 object
{
5310 typedef long long __m128i __attribute__
((__vector_size__
(16)));
5312 __m128i _mm_srli_si128
(__m128i __A
, int __N
)
5314 return (__m128i
)__builtin_ia32_psrldqi128
(__A
, 8);
5319 #
Return 1 if F16C instructions can be compiled.
5321 proc check_effective_target_f16c
{ } {
5322 return [check_no_compiler_messages f16c object
{
5323 #
include "immintrin.h"
5325 foo
(unsigned short val
)
5327 return _cvtsh_ss
(val
);
5332 #
Return 1 if C wchar_t type is compatible with char16_t.
5334 proc check_effective_target_wchar_t_char16_t_compatible
{ } {
5335 return [check_no_compiler_messages wchar_t_char16_t object
{
5337 __CHAR16_TYPE__
*p16
= &wc
;
5338 char t
[(((__CHAR16_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
5342 #
Return 1 if C wchar_t type is compatible with char32_t.
5344 proc check_effective_target_wchar_t_char32_t_compatible
{ } {
5345 return [check_no_compiler_messages wchar_t_char32_t object
{
5347 __CHAR32_TYPE__
*p32
= &wc
;
5348 char t
[(((__CHAR32_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
5352 #
Return 1 if pow10 function
exists.
5354 proc check_effective_target_pow10
{ } {
5355 return [check_runtime pow10
{
5365 #
Return 1 if current options generate DFP instructions
, 0 otherwise.
5367 proc check_effective_target_hard_dfp
{} {
5368 return [check_no_messages_and_pattern hard_dfp
"!adddd3" assembly {
5369 typedef float d64 __attribute__
((mode(DD
)));
5371 void foo
(void
) { z
= x
+ y
; }
5375 #
Return 1 if string.h and wchar.h headers provide C
++ requires overloads
5376 #
for strchr etc. functions.
5378 proc check_effective_target_correct_iso_cpp_string_wchar_protos
{ } {
5379 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly
{
5382 #
if !defined
(__cplusplus
) \
5383 ||
!defined
(__CORRECT_ISO_CPP_STRING_H_PROTO
) \
5384 ||
!defined
(__CORRECT_ISO_CPP_WCHAR_H_PROTO
)
5385 ISO C
++ correct string.h and wchar.h protos not supported.
5392 #
Return 1 if GNU as is used.
5394 proc check_effective_target_gas
{ } {
5395 global use_gas_saved
5398 if {![info exists use_gas_saved
]} {
5399 # Check
if the as used by gcc is GNU as.
5400 set gcc_as
[lindex
[$
{tool
}_target_compile
"-print-prog-name=as" "" "none" ""] 0]
5401 # Provide
/dev
/null as input
, otherwise gas times out reading from
5403 set status [remote_exec host
"$gcc_as" "-v /dev/null"]
5404 set as_output
[lindex $
status 1]
5405 if { [ string first
"GNU" $as_output ] >= 0 } {
5411 return $use_gas_saved
5414 #
Return 1 if GNU
ld is used.
5416 proc check_effective_target_gld
{ } {
5417 global use_gld_saved
5420 if {![info exists use_gld_saved
]} {
5421 # Check
if the
ld used by gcc is GNU
ld.
5422 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=ld" "" "none" ""] 0]
5423 set status [remote_exec host
"$gcc_ld" "--version"]
5424 set ld_output
[lindex $
status 1]
5425 if { [ string first
"GNU" $ld_output ] >= 0 } {
5431 return $use_gld_saved
5434 #
Return 1 if the compiler has been configure with link
-time optimization
5437 proc check_effective_target_lto
{ } {
5439 return [info exists ENABLE_LTO
]
5442 #
Return 1 if -mx32
-maddress
-mode=short can
compile, 0 otherwise.
5444 proc check_effective_target_maybe_x32
{ } {
5445 return [check_no_compiler_messages maybe_x32 object
{
5447 } "-mx32 -maddress-mode=short"]
5450 #
Return 1 if this target supports the
-fsplit
-stack option
, 0
5453 proc check_effective_target_split_stack
{} {
5454 return [check_no_compiler_messages split_stack object
{
5459 #
Return 1 if this target supports the
-masm
=intel option
, 0
5462 proc check_effective_target_masm_intel
{} {
5463 return [check_no_compiler_messages masm_intel object
{
5464 extern void abort
(void
);
5468 #
Return 1 if the language
for the compiler under test is C.
5470 proc check_effective_target_c
{ } {
5472 if [string match $tool
"gcc"] {
5478 #
Return 1 if the language
for the compiler under test is C
++.
5480 proc check_effective_target_c
++ { } {
5482 if [string match $tool
"g++"] {
5488 # Check whether the current active language standard supports the features
5489 # of C
++11/C
++1y by checking
for the presence of one of the
-std
5490 # flags. This assumes that the default
for the compiler is C
++98, and that
5491 # there will never be multiple
-std
= arguments
on the command line.
5492 proc check_effective_target_c
++11_only
{ } {
5493 if ![check_effective_target_c
++] {
5496 return [check
-flags
{ { } { } { -std
=c
++0x
-std
=gnu
++0x
-std
=c
++11 -std
=gnu
++11 } }]
5498 proc check_effective_target_c
++11 { } {
5499 if [check_effective_target_c
++11_only
] {
5502 return [check_effective_target_c
++1y
]
5504 proc check_effective_target_c
++11_down
{ } {
5505 if ![check_effective_target_c
++] {
5508 return ![check_effective_target_c
++1y
]
5511 proc check_effective_target_c
++1y_only
{ } {
5512 if ![check_effective_target_c
++] {
5515 return [check
-flags
{ { } { } { -std
=c
++1y
-std
=gnu
++1y
-std
=c
++14 -std
=gnu
++14 } }]
5517 proc check_effective_target_c
++1y
{ } {
5518 return [check_effective_target_c
++1y_only
]
5521 proc check_effective_target_c
++98_only
{ } {
5522 if ![check_effective_target_c
++] {
5525 return ![check_effective_target_c
++11]
5528 #
Return 1 if expensive testcases should be run.
5530 proc check_effective_target_run_expensive_tests
{ } {
5531 if { [getenv GCC_TEST_RUN_EXPENSIVE
] != "" } {
5537 # Returns
1 if "mempcpy" is available on the target system.
5539 proc check_effective_target_mempcpy
{} {
5540 return [check_function_available
"mempcpy"]
5543 # Check whether the vectorizer tests are supported by the target and
5544 # append additional target
-dependent
compile flags to DEFAULT_VECTCFLAGS.
5545 #
Set dg
-do-what
-default to either
compile or run
, depending
on target
5546 # capabilities.
Return 1 if vectorizer tests are supported by
5547 # target
, 0 otherwise.
5549 proc check_vect_support_and_set_flags
{ } {
5550 global DEFAULT_VECTCFLAGS
5551 global dg
-do-what
-default
5553 if [istarget powerpc
-*paired
*] {
5554 lappend DEFAULT_VECTCFLAGS
"-mpaired"
5555 if [check_750cl_hw_available
] {
5556 set dg
-do-what
-default run
5558 set dg
-do-what
-default
compile
5560 } elseif
[istarget powerpc
*-*-*] {
5561 # Skip targets not supporting
-maltivec.
5562 if ![is
-effective
-target powerpc_altivec_ok
] {
5566 lappend DEFAULT_VECTCFLAGS
"-maltivec"
5567 if [check_p8vector_hw_available
] {
5568 lappend DEFAULT_VECTCFLAGS
"-mpower8-vector" "-mno-allow-movmisalign"
5569 } elseif
[check_vsx_hw_available
] {
5570 lappend DEFAULT_VECTCFLAGS
"-mvsx" "-mno-allow-movmisalign"
5573 if [check_vmx_hw_available
] {
5574 set dg
-do-what
-default run
5576 if [is
-effective
-target ilp32
] {
5577 # Specify a cpu that supports VMX
for compile-only tests.
5578 lappend DEFAULT_VECTCFLAGS
"-mcpu=970"
5580 set dg
-do-what
-default
compile
5582 } elseif
{ [istarget spu
-*-*] } {
5583 set dg
-do-what
-default run
5584 } elseif
{ [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
5585 lappend DEFAULT_VECTCFLAGS
"-msse2"
5586 if { [check_effective_target_sse2_runtime
] } {
5587 set dg
-do-what
-default run
5589 set dg
-do-what
-default
compile
5591 } elseif
{ [istarget mips
*-*-*]
5592 && ([check_effective_target_mpaired_single
]
5593 ||
[check_effective_target_mips_loongson
])
5594 && [check_effective_target_nomips16
] } {
5595 if { [check_effective_target_mpaired_single
] } {
5596 lappend DEFAULT_VECTCFLAGS
"-mpaired-single"
5598 set dg
-do-what
-default run
5599 } elseif
[istarget sparc
*-*-*] {
5600 lappend DEFAULT_VECTCFLAGS
"-mcpu=ultrasparc" "-mvis"
5601 if [check_effective_target_ultrasparc_hw
] {
5602 set dg
-do-what
-default run
5604 set dg
-do-what
-default
compile
5606 } elseif
[istarget alpha
*-*-*] {
5607 # Alpha
's vectorization capabilities are extremely limited.
5608 # It's more effort than its worth disabling all of the tests
5609 # that it cannot pass. But
if you actually want to see what
5610 # does work
, command out the
return.
5613 lappend DEFAULT_VECTCFLAGS
"-mmax"
5614 if [check_alpha_max_hw_available
] {
5615 set dg
-do-what
-default run
5617 set dg
-do-what
-default
compile
5619 } elseif
[istarget ia64
-*-*] {
5620 set dg
-do-what
-default run
5621 } elseif
[is
-effective
-target arm_neon_ok
] {
5622 eval lappend DEFAULT_VECTCFLAGS
[add_options_for_arm_neon
""]
5623 # NEON does not support denormals
, so is not used
for vectorization by
5624 # default to avoid loss of precision. We must pass
-ffast
-math to test
5625 # vectorization of float operations.
5626 lappend DEFAULT_VECTCFLAGS
"-ffast-math"
5627 if [is
-effective
-target arm_neon_hw
] {
5628 set dg
-do-what
-default run
5630 set dg
-do-what
-default
compile
5632 } elseif
[istarget
"aarch64*-*-*"] {
5633 set dg
-do-what
-default run
5641 proc check_effective_target_non_strict_align
{} {
5642 return [check_no_compiler_messages non_strict_align assembly
{
5644 typedef char __attribute__
((__aligned__
(__BIGGEST_ALIGNMENT__
))) c
;
5646 void foo
(void
) { z
= (c
*) y
; }
5650 #
Return 1 if the target has
<ucontext.h
>.
5652 proc check_effective_target_ucontext_h
{ } {
5653 return [check_no_compiler_messages ucontext_h assembly
{
5654 #
include <ucontext.h
>
5658 proc check_effective_target_aarch64_tiny
{ } {
5659 if { [istarget aarch64
*-*-*] } {
5660 return [check_no_compiler_messages aarch64_tiny object
{
5661 #ifdef __AARCH64_CMODEL_TINY__
5664 #error target not AArch64 tiny code
model
5672 proc check_effective_target_aarch64_small
{ } {
5673 if { [istarget aarch64
*-*-*] } {
5674 return [check_no_compiler_messages aarch64_small object
{
5675 #ifdef __AARCH64_CMODEL_SMALL__
5678 #error target not AArch64 small code
model
5686 proc check_effective_target_aarch64_large
{ } {
5687 if { [istarget aarch64
*-*-*] } {
5688 return [check_no_compiler_messages aarch64_large object
{
5689 #ifdef __AARCH64_CMODEL_LARGE__
5692 #error target not AArch64 large code
model
5700 #
Return 1 if <fenv.h
> is available with all the standard IEEE
5701 # exceptions and floating
-point exceptions are raised by arithmetic
5702 # operations.
(If the target requires special options
for "inexact"
5703 # exceptions
, those need to be specified in the testcases.
)
5705 proc check_effective_target_fenv_exceptions
{} {
5706 return [check_runtime fenv_exceptions
{
5709 #ifndef FE_DIVBYZERO
5710 # error Missing FE_DIVBYZERO
5713 # error Missing FE_INEXACT
5716 # error Missing FE_INVALID
5719 # error Missing FE_OVERFLOW
5721 #ifndef FE_UNDERFLOW
5722 # error Missing FE_UNDERFLOW
5724 volatile float a
= 0.0f
, r
;
5729 if (fetestexcept
(FE_INVALID
))
5737 #
Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is
set to
0 for the current target.
5739 proc check_effective_target_logical_op_short_circuit
{} {
5740 if { [istarget mips
*-*-*]
5741 ||
[istarget arc
*-*-*]
5742 ||
[istarget avr
*-*-*]
5743 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
5744 ||
[check_effective_target_arm_cortex_m
] } {
5750 # Record that dg
-final test TEST requires convential compilation.
5752 proc force_conventional_output_for
{ test
} {
5753 if { [info proc $test
] == "" } {
5754 perror
"$test does not exist"
5757 proc $
{test
}_required_options
{} {
5758 global gcc_force_conventional_output
5759 return $gcc_force_conventional_output