1 # Copyright
(C
) 1999-2015 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC
; see the file COPYING3.
If not see
15 #
<http
://www.gnu.org
/licenses
/>.
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # gcc
-patches@gcc.gnu.org
20 # This file defines procs
for determining features supported by the target.
22 # Try to
compile the code given by CONTENTS into an output file of
23 # type TYPE
, where TYPE is as
for target_compile.
Return a list
24 # whose first element contains the compiler messages and whose
25 # second element is the
name of the output file.
27 # BASENAME is a prefix to use
for source and output files.
28 #
If ARGS is not empty
, its first element is a string that
29 # should be added to the command line.
31 # Assume by default that CONTENTS is C code.
32 # Otherwise
, code should contain
:
34 #
"! Fortran" for Fortran code,
36 #
"// ObjC++" for ObjC++
38 #
If the tool is ObjC
/ObjC
++ then we overide the extension to .m
/.mm to
39 # allow
for ObjC
/ObjC
++ specific flags.
40 proc check_compile
{basename type contents
args} {
42 verbose
"check_compile tool: $tool for $basename"
44 # Save additional_sources to avoid compiling testsuite
's sources
45 # against check_compile's source.
46 global additional_sources
47 if [info exists additional_sources
] {
48 set tmp_additional_sources
"$additional_sources"
49 set additional_sources
""
52 if { [llength $
args] > 0 } {
53 set options
[list
"additional_flags=[lindex $args 0]"]
57 switch -glob
-- $contents
{
58 "*! Fortran*" { set src ${basename}[pid].f90 }
59 "*// C++*" { set src ${basename}[pid].cc }
60 "*// ObjC++*" { set src ${basename}[pid].mm }
61 "*/* ObjC*" { set src ${basename}[pid].m }
62 "*// Go*" { set src ${basename}[pid].go }
65 "objc" { set src ${basename}[pid].m }
66 "obj-c++" { set src ${basename}[pid].mm }
67 default
{ set src $
{basename
}[pid
].c
}
72 set compile_type $type
74 assembly
{ set output $
{basename
}[pid
].s
}
75 object
{ set output $
{basename
}[pid
].o
}
76 executable
{ set output $
{basename
}[pid
].exe
}
78 set output $
{basename
}[pid
].s
79 lappend options
"additional_flags=-fdump-$type"
80 set compile_type assembly
86 set lines
[$
{tool
}_target_compile $src $output $compile_type
"$options"]
89 set scan_output $output
90 # Don
't try folding this into the switch above; calling "glob" before the
91 # file is created won't work.
92 if [regexp
"rtl-(.*)" $type dummy rtl_type] {
93 set scan_output
"[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
97 # Restore additional_sources.
98 if [info exists additional_sources
] {
99 set additional_sources
"$tmp_additional_sources"
102 return [list $lines $scan_output
]
105 proc current_target_name
{ } {
107 if [info exists target_info
(target
,name)] {
108 set answer $target_info
(target
,name)
115 # Implement an effective
-target check
for property PROP by invoking
116 # the Tcl command
ARGS and seeing
if it returns true.
118 proc check_cached_effective_target
{ prop
args } {
121 set target
[current_target_name
]
122 if {![info exists et_cache
($prop
,target
)]
123 || $et_cache
($prop
,target
) != $target
} {
124 verbose
"check_cached_effective_target $prop: checking $target" 2
125 set et_cache
($prop
,target
) $target
126 set et_cache
($prop
,value
) [uplevel eval $
args]
128 set value $et_cache
($prop
,value
)
129 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
133 # Like check_compile
, but
delete the output file and
return true
if the
134 # compiler printed no messages.
135 proc check_no_compiler_messages_nocache
{args} {
136 set result
[eval check_compile $
args]
137 set lines
[lindex $result
0]
138 set output
[lindex $result
1]
139 remote_file build
delete $output
140 return [string match
"" $lines]
143 # Like check_no_compiler_messages_nocache
, but
cache the result.
144 # PROP is the
property we
're checking, and doubles as a prefix for
145 # temporary filenames.
146 proc check_no_compiler_messages {prop args} {
147 return [check_cached_effective_target $prop {
148 eval [list check_no_compiler_messages_nocache $prop] $args
152 # Like check_compile, but return true if the compiler printed no
153 # messages and if the contents of the output file satisfy PATTERN.
154 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
155 # don't match regular expression REGEXP
, otherwise they satisfy it
156 #
if they
do match regular expression PATTERN.
(PATTERN can start
157 # with something like
"[!]" if the regular expression needs to match
158 #
"!" as the first character.)
160 #
Delete the output file before returning. The other arguments are
161 # as
for check_compile.
162 proc check_no_messages_and_pattern_nocache
{basename pattern
args} {
165 set result
[eval
[list check_compile $basename
] $
args]
166 set lines
[lindex $result
0]
167 set output
[lindex $result
1]
170 if { [string match
"" $lines] } {
171 set chan
[open
"$output"]
172 set invert
[regexp
{^
!(.
*)} $pattern dummy pattern
]
173 set ok
[expr
{ [regexp $pattern
[read $chan
]] != $invert
}]
177 remote_file build
delete $output
181 # Like check_no_messages_and_pattern_nocache
, but
cache the result.
182 # PROP is the
property we
're checking, and doubles as a prefix for
183 # temporary filenames.
184 proc check_no_messages_and_pattern {prop pattern args} {
185 return [check_cached_effective_target $prop {
186 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
190 # Try to compile and run an executable from code CONTENTS. Return true
191 # if the compiler reports no messages and if execution "passes" in the
192 # usual DejaGNU sense. The arguments are as for check_compile, with
193 # TYPE implicitly being "executable".
194 proc check_runtime_nocache {basename contents args} {
197 set result [eval [list check_compile $basename executable $contents] $args]
198 set lines [lindex $result 0]
199 set output [lindex $result 1]
202 if { [string match "" $lines] } {
203 # No error messages, everything is OK.
204 set result [remote_load target "./$output" "" ""]
205 set status [lindex $result 0]
206 verbose "check_runtime_nocache $basename: status is <$status>" 2
207 if { $status == "pass" } {
211 remote_file build delete $output
215 # Like check_runtime_nocache, but cache the result. PROP is the
216 # property we're checking
, and doubles as a prefix
for temporary
218 proc check_runtime
{prop
args} {
221 return [check_cached_effective_target $prop
{
222 eval
[list check_runtime_nocache $prop
] $
args
226 ###############################
227 # proc check_weak_available
{ }
228 ###############################
230 # weak symbols are only supported in some configs
/object formats
231 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
233 proc check_weak_available
{ } {
236 # All mips targets should support it
238 if { [ string first
"mips" $target_cpu ] >= 0 } {
242 # All AIX targets should support it
244 if { [istarget
*-*-aix
*] } {
248 # All solaris2 targets should support it
250 if { [istarget
*-*-solaris2
*] } {
254 # Windows targets Cygwin and MingW32 support it
256 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
260 # HP
-UX
10.X doesn
't support it
262 if { [istarget hppa*-*-hpux10*] } {
266 # ELF and ECOFF support it. a.out does with gas/gld but may also with
267 # other linkers, so we should try it
269 set objformat [gcc_target_object_format]
277 unknown { return -1 }
282 ###############################
283 # proc check_weak_override_available { }
284 ###############################
286 # Like check_weak_available, but return 0 if weak symbol definitions
287 # cannot be overridden.
289 proc check_weak_override_available { } {
290 if { [istarget *-*-mingw*] } {
293 return [check_weak_available]
296 ###############################
297 # proc check_visibility_available { what_kind }
298 ###############################
300 # The visibility attribute is only support in some object formats
301 # This proc returns 1 if it is supported, 0 if not.
302 # The argument is the kind of visibility, default/protected/hidden/internal.
304 proc check_visibility_available { what_kind } {
305 if [string match "" $what_kind] { set what_kind "hidden" }
307 return [check_no_compiler_messages visibility_available_$what_kind object "
308 void f() __attribute__((visibility(\"$what_kind\")));
313 ###############################
314 # proc check_alias_available { }
315 ###############################
317 # Determine if the target toolchain supports the alias attribute.
319 # Returns 2 if the target supports aliases. Returns 1 if the target
320 # only supports weak aliased. Returns 0 if the target does not
321 # support aliases at all. Returns -1 if support for aliases could not
324 proc check_alias_available { } {
325 global alias_available_saved
328 if [info exists alias_available_saved] {
329 verbose "check_alias_available returning saved $alias_available_saved" 2
333 verbose "check_alias_available compiling testfile $src" 2
334 set f [open $src "w"]
335 # Compile a small test program. The definition of "g" is
336 # necessary to keep the Solaris assembler from complaining
338 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
339 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
341 set lines [${tool}_target_compile $src $obj object ""]
343 remote_file build delete $obj
345 if [string match "" $lines] then {
346 # No error messages, everything is OK.
347 set alias_available_saved 2
349 if [regexp "alias definitions not supported" $lines] {
350 verbose "check_alias_available target does not support aliases" 2
352 set objformat [gcc_target_object_format]
354 if { $objformat == "elf" } {
355 verbose "check_alias_available but target uses ELF format, so it ought to" 2
356 set alias_available_saved -1
358 set alias_available_saved 0
361 if [regexp "only weak aliases are supported" $lines] {
362 verbose "check_alias_available target supports only weak aliases" 2
363 set alias_available_saved 1
365 set alias_available_saved -1
370 verbose "check_alias_available returning $alias_available_saved" 2
373 return $alias_available_saved
376 # Returns 1 if the target toolchain supports strong aliases, 0 otherwise.
378 proc check_effective_target_alias { } {
379 if { [check_alias_available] < 2 } {
386 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
388 proc check_ifunc_available { } {
389 return [check_no_compiler_messages ifunc_available object {
394 void f() __attribute__((ifunc("g")));
398 # Returns true if --gc-sections is supported on the target.
400 proc check_gc_sections_available { } {
401 global gc_sections_available_saved
404 if {![info exists gc_sections_available_saved]} {
405 # Some targets don't support gc
-sections despite whatever
's
406 # advertised by ld's options.
407 if { [istarget alpha
*-*-*]
408 ||
[istarget ia64
-*-*] } {
409 set gc_sections_available_saved
0
413 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
415 if { [board_info target
exists ldflags
]
416 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
417 set gc_sections_available_saved
0
421 # VxWorks kernel modules are relocatable objects linked with
-r
,
422 #
while RTP executables are linked with
-q
(--emit
-relocs
).
423 # Both of these options are incompatible with
--gc
-sections.
424 if { [istarget
*-*-vxworks
*] } {
425 set gc_sections_available_saved
0
429 # Check
if the
ld used by gcc supports
--gc
-sections.
430 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
431 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
432 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
433 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
434 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
435 set gc_sections_available_saved
1
437 set gc_sections_available_saved
0
440 return $gc_sections_available_saved
443 #
Return 1 if according to target_info struct and explicit target list
444 # target is supposed to support trampolines.
446 proc check_effective_target_trampolines
{ } {
447 if [target_info
exists no_trampolines
] {
450 if { [istarget avr
-*-*]
451 ||
[istarget msp430
-*-*]
452 ||
[istarget nvptx
-*-*]
453 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
454 ||
[istarget hppa64
-hp
-hpux11.23
] } {
460 #
Return 1 if according to target_info struct and explicit target list
461 # target disables
-fdelete
-null
-pointer
-checks. Targets should
return 0
462 #
if they simply default to
-fno
-delete-null
-pointer
-checks but obey
463 #
-fdelete
-null
-pointer
-checks when passed explicitly
(and tests that
464 # depend
on this option should
do that
).
466 proc check_effective_target_keeps_null_pointer_checks
{ } {
467 if [target_info
exists keeps_null_pointer_checks
] {
470 if { [istarget avr
-*-*] } {
476 #
Return true
if profiling is supported
on the target.
478 proc check_profiling_available
{ test_what
} {
479 global profiling_available_saved
481 verbose
"Profiling argument is <$test_what>" 1
483 # These conditions depend
on the
argument so examine them before
484 # looking at the
cache variable.
486 # Tree profiling requires TLS runtime support.
487 if { $test_what
== "-fprofile-generate" } {
488 if { ![check_effective_target_tls_runtime
] } {
493 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
494 # vendor compiler. We cannot reliably predict the directory where the
495 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
496 # necessarily find mcrt1.o even if we have it.
497 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
501 # We don't yet support profiling
for MIPS16.
502 if { [istarget mips
*-*-*]
503 && ![check_effective_target_nomips16
]
504 && ($test_what
== "-p" || $test_what == "-pg") } {
508 # MinGW does not support
-p.
509 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
513 # cygwin does not support
-p.
514 if { [istarget
*-*-cygwin
*] && $test_what
== "-p" } {
518 # uClibc does not have gcrt1.o.
519 if { [check_effective_target_uclibc
]
520 && ($test_what
== "-p" || $test_what == "-pg") } {
524 # Now examine the
cache variable.
525 if {![info exists profiling_available_saved
]} {
526 # Some targets don
't have any implementation of __bb_init_func or are
527 # missing other needed machinery.
528 if {[istarget aarch64*-*-elf]
529 || [istarget am3*-*-linux*]
530 || [istarget arm*-*-eabi*]
531 || [istarget arm*-*-elf]
532 || [istarget arm*-*-symbianelf*]
533 || [istarget avr-*-*]
534 || [istarget bfin-*-*]
535 || [istarget cris-*-*]
536 || [istarget crisv32-*-*]
537 || [istarget fido-*-elf]
538 || [istarget h8300-*-*]
539 || [istarget lm32-*-*]
540 || [istarget m32c-*-elf]
541 || [istarget m68k-*-elf]
542 || [istarget m68k-*-uclinux*]
543 || [istarget mep-*-elf]
544 || [istarget mips*-*-elf*]
545 || [istarget mmix-*-*]
546 || [istarget mn10300-*-elf*]
547 || [istarget moxie-*-elf*]
548 || [istarget msp430-*-*]
549 || [istarget nds32*-*-elf]
550 || [istarget nios2-*-elf]
551 || [istarget nvptx-*-*]
552 || [istarget powerpc-*-eabi*]
553 || [istarget powerpc-*-elf]
555 || [istarget tic6x-*-elf]
556 || [istarget visium-*-*]
557 || [istarget xstormy16-*]
558 || [istarget xtensa*-*-elf]
559 || [istarget *-*-rtems*]
560 || [istarget *-*-vxworks*] } {
561 set profiling_available_saved 0
563 set profiling_available_saved 1
567 # -pg link test result can't be cached since it may change between
569 set profiling_working $profiling_available_saved
570 if { $profiling_available_saved
== 1
571 && ![check_no_compiler_messages_nocache profiling executable
{
572 int main
() { return 0; } } "-pg"] } {
573 set profiling_working
0
576 return $profiling_working
579 # Check to see
if a target is
"freestanding". This is as per the definition
580 # in Section
4 of C99 standard. Effectively
, it is a target which supports no
581 # extra headers or libraries other than what is considered essential.
582 proc check_effective_target_freestanding
{ } {
583 if { [istarget nvptx
-*-*] } {
589 #
Return 1 if target has packed layout of structure members by
590 # default
, 0 otherwise. Note that this is slightly different than
591 # whether the target has
"natural alignment": both attributes may be
594 proc check_effective_target_default_packed
{ } {
595 return [check_no_compiler_messages default_packed assembly
{
596 struct x
{ char a
; long b
; } c
;
597 int s
[sizeof
(c
) == sizeof
(char
) + sizeof
(long
) ?
1 : -1];
601 #
Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
602 # documentation
, where the test also comes from.
604 proc check_effective_target_pcc_bitfield_type_matters
{ } {
605 # PCC_BITFIELD_TYPE_MATTERS isn
't just about unnamed or empty
606 # bitfields, but let's stick to the example code from the docs.
607 return [check_no_compiler_messages pcc_bitfield_type_matters assembly
{
608 struct foo1
{ char x
; char
:0; char y
; };
609 struct foo2
{ char x
; int :0; char y
; };
610 int s
[sizeof
(struct foo1
) != sizeof
(struct foo2
) ?
1 : -1];
614 # Add to FLAGS all the target
-specific flags needed to use thread
-local storage.
616 proc add_options_for_tls
{ flags
} {
617 #
On Solaris
9, __tls_get_addr
/___tls_get_addr only lives in
618 # libthread
, so always pass
-pthread
for native TLS. Same
for AIX.
619 # Need to duplicate native TLS check from
620 # check_effective_target_tls_native to avoid recursion.
621 if { ([istarget powerpc
-ibm
-aix
*]) &&
622 [check_no_messages_and_pattern tls_native
"!emutls" assembly {
624 int f
(void
) { return i
; }
625 void g
(int j
) { i
= j
; }
627 return "-pthread [g++_link_flags [get_multilibs "-pthread"] ] $flags "
632 #
Return 1 if indirect jumps are supported
, 0 otherwise.
634 proc check_effective_target_indirect_jumps
{} {
635 if { [istarget nvptx
-*-*] } {
641 #
Return 1 if nonlocal
goto is supported
, 0 otherwise.
643 proc check_effective_target_nonlocal_goto
{} {
644 if { [istarget nvptx
-*-*] } {
650 #
Return 1 if global constructors are supported
, 0 otherwise.
652 proc check_effective_target_global_constructor
{} {
653 if { [istarget nvptx
-*-*] } {
659 #
Return 1 if taking label
values is supported
, 0 otherwise.
661 proc check_effective_target_label_values
{} {
662 if { [istarget nvptx
-*-*] } {
665 return [check_no_compiler_messages label_values assembly
{
666 #ifdef NO_LABEL_VALUES
672 #
Return 1 if builtin_return_address and builtin_frame_address are
673 # supported
, 0 otherwise.
675 proc check_effective_target_return_address
{} {
676 if { [istarget nvptx
-*-*] } {
682 #
Return 1 if the assembler does not verify function types against
683 # calls
, 0 otherwise. Such verification will typically
show up problems
684 # with K
&R C function declarations.
686 proc check_effective_target_untyped_assembly
{} {
687 if { [istarget nvptx
-*-*] } {
693 #
Return 1 if alloca is supported
, 0 otherwise.
695 proc check_effective_target_alloca
{} {
696 if { [istarget nvptx
-*-*] } {
702 #
Return 1 if thread local storage
(TLS
) is supported
, 0 otherwise.
704 proc check_effective_target_tls
{} {
705 return [check_no_compiler_messages tls assembly
{
707 int f
(void
) { return i
; }
708 void g
(int j
) { i
= j
; }
712 #
Return 1 if *native
* thread local storage
(TLS
) is supported
, 0 otherwise.
714 proc check_effective_target_tls_native
{} {
715 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
716 # functions
, so we fail to automatically detect it.
717 if { [istarget
*-*-vxworks
*] } {
721 return [check_no_messages_and_pattern tls_native
"!emutls" assembly {
723 int f
(void
) { return i
; }
724 void g
(int j
) { i
= j
; }
728 #
Return 1 if *emulated
* thread local storage
(TLS
) is supported
, 0 otherwise.
730 proc check_effective_target_tls_emulated
{} {
731 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
732 # functions
, so we fail to automatically detect it.
733 if { [istarget
*-*-vxworks
*] } {
737 return [check_no_messages_and_pattern tls_emulated
"emutls" assembly {
739 int f
(void
) { return i
; }
740 void g
(int j
) { i
= j
; }
744 #
Return 1 if TLS executables can run correctly
, 0 otherwise.
746 proc check_effective_target_tls_runtime
{} {
747 # The runtime does not have TLS support
, but just
748 # running the test below is insufficient to
show this.
749 if { [istarget msp430
-*-*] ||
[istarget visium
-*-*] } {
752 return [check_runtime tls_runtime
{
753 __thread
int thr
= 0;
754 int main
(void
) { return thr
; }
755 } [add_options_for_tls
""]]
758 #
Return 1 if atomic compare
-and
-swap is supported
on 'int'
760 proc check_effective_target_cas_char
{} {
761 return [check_no_compiler_messages cas_char assembly
{
762 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
768 proc check_effective_target_cas_int
{} {
769 return [check_no_compiler_messages cas_int assembly
{
770 #
if __INT_MAX__
== 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
772 #elif __INT_MAX__
== 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
780 #
Return 1 if -ffunction
-sections is supported
, 0 otherwise.
782 proc check_effective_target_function_sections
{} {
783 # Darwin has its own scheme and silently accepts
-ffunction
-sections.
784 if { [istarget
*-*-darwin
*] } {
788 return [check_no_compiler_messages functionsections assembly
{
790 } "-ffunction-sections"]
793 #
Return 1 if instruction scheduling is available
, 0 otherwise.
795 proc check_effective_target_scheduling
{} {
796 return [check_no_compiler_messages scheduling object
{
798 } "-fschedule-insns"]
801 #
Return 1 if trapping arithmetic is available
, 0 otherwise.
803 proc check_effective_target_trapping
{} {
804 return [check_no_compiler_messages trapping object
{
805 int add
(int a
, int b
) { return a
+ b
; }
809 #
Return 1 if compilation with
-fgraphite is error
-free
for trivial
812 proc check_effective_target_fgraphite
{} {
813 return [check_no_compiler_messages fgraphite object
{
818 #
Return 1 if compilation with
-fopenacc is error
-free
for trivial
821 proc check_effective_target_fopenacc
{} {
822 # nvptx can be built with the device
-side bits of openacc
, but it
823 # does not make sense to test it as an openacc host.
824 if [istarget nvptx
-*-*] { return 0 }
826 return [check_no_compiler_messages fopenacc object
{
831 #
Return 1 if compilation with
-fopenmp is error
-free
for trivial
834 proc check_effective_target_fopenmp
{} {
835 # nvptx can be built with the device
-side bits of libgomp
, but it
836 # does not make sense to test it as an openmp host.
837 if [istarget nvptx
-*-*] { return 0 }
839 return [check_no_compiler_messages fopenmp object
{
844 #
Return 1 if compilation with
-fupc is error
-free
for trivial
847 proc check_effective_target_fupc
{} {
848 return [check_no_compiler_messages fupc object
{
850 } "-fupc -fno-upc-pre-include"]
853 #
Return 1 if compilation with
-fgnu
-tm is error
-free
for trivial
856 proc check_effective_target_fgnu_tm
{} {
857 return [check_no_compiler_messages fgnu_tm object
{
862 #
Return 1 if the target supports mmap
, 0 otherwise.
864 proc check_effective_target_mmap
{} {
865 return [check_function_available
"mmap"]
868 #
Return 1 if the target supports dlopen
, 0 otherwise.
869 proc check_effective_target_dlopen
{} {
870 return [check_no_compiler_messages dlopen executable
{
872 int main
(void
) { dlopen
("dummy.so", RTLD_NOW); }
873 } [add_options_for_dlopen
""]]
876 proc add_options_for_dlopen
{ flags
} {
880 #
Return 1 if the target supports clone
, 0 otherwise.
881 proc check_effective_target_clone
{} {
882 return [check_function_available
"clone"]
885 #
Return 1 if the target supports setrlimit
, 0 otherwise.
886 proc check_effective_target_setrlimit
{} {
887 # Darwin has non
-posix compliant RLIMIT_AS
888 if { [istarget
*-*-darwin
*] } {
891 return [check_function_available
"setrlimit"]
894 #
Return 1 if the target supports swapcontext
, 0 otherwise.
895 proc check_effective_target_swapcontext
{} {
896 return [check_no_compiler_messages swapcontext executable
{
897 #
include <ucontext.h
>
900 ucontext_t orig_context
,child_context
;
901 if (swapcontext
(&child_context
, &orig_context
) < 0) { }
906 #
Return 1 if compilation with
-pthread is error
-free
for trivial
909 proc check_effective_target_pthread
{} {
910 return [check_no_compiler_messages pthread object
{
915 #
Return 1 if compilation with
-mpe
-aligned
-commons is error
-free
916 #
for trivial code
, 0 otherwise.
918 proc check_effective_target_pe_aligned_commons
{} {
919 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
920 return [check_no_compiler_messages pe_aligned_commons object
{
922 } "-mpe-aligned-commons"]
927 #
Return 1 if the target supports
-static
928 proc check_effective_target_static
{} {
929 return [check_no_compiler_messages static executable
{
930 int main
(void
) { return 0; }
934 #
Return 1 if the target supports
-fstack
-protector
935 proc check_effective_target_fstack_protector
{} {
936 return [check_runtime fstack_protector
{
937 int main
(void
) { return 0; }
938 } "-fstack-protector"]
941 #
Return 1 if compilation with
-freorder
-blocks
-and
-partition is error
-free
942 #
for trivial code
, 0 otherwise.
944 proc check_effective_target_freorder
{} {
945 return [check_no_compiler_messages freorder object
{
947 } "-freorder-blocks-and-partition"]
950 #
Return 1 if -fpic and
-fPIC are supported
, as in no warnings or errors
951 # emitted
, 0 otherwise. Whether a shared library can actually be built is
952 # out of scope
for this test.
954 proc check_effective_target_fpic
{ } {
955 # Note that M68K has a multilib that supports
-fpic but not
956 #
-fPIC
, so we need to check both. We test with a
program that
957 # requires GOT references.
958 foreach
arg {fpic fPIC
} {
959 if [check_no_compiler_messages $
arg object
{
960 extern
int foo
(void
); extern
int bar
;
961 int baz
(void
) { return foo
() + bar
; }
969 #
On AArch64
, if -fpic is not supported
, then we will fall
back to
-fPIC
970 # silently. So
, we can
't rely on above "check_effective_target_fpic" as it
971 # assumes compiler will give warning if -fpic not supported. Here we check
972 # whether binutils supports those new -fpic relocation modifiers, and assume
973 # -fpic is supported if there is binutils support. GCC configuration will
974 # enable -fpic for AArch64 in this case.
976 # "check_effective_target_aarch64_small_fpic" is dedicated for checking small
977 # memory model -fpic relocation types.
979 proc check_effective_target_aarch64_small_fpic { } {
980 if { [istarget aarch64*-*-*] } {
981 return [check_no_compiler_messages aarch64_small_fpic object {
982 void foo (void) { asm ("ldr x0, [x2, #:gotpage_lo15:globalsym]"); }
989 # On AArch64, instruction sequence for TLS LE under -mtls-size=32 will utilize
990 # the relocation modifier "tprel_g0_nc" together with MOVK, it's only supported
991 # in binutils since
2015-03-04 as PR gas
/17843.
993 # This test directive make sure binutils support all features needed by TLS LE
994 # under
-mtls
-size
=32 on AArch64.
996 proc check_effective_target_aarch64_tlsle32
{ } {
997 if { [istarget aarch64
*-*-*] } {
998 return [check_no_compiler_messages aarch64_tlsle32 object
{
999 void foo
(void
) { asm
("movk x1,#:tprel_g0_nc:t1"); }
1006 #
Return 1 if -shared is supported
, as in no warnings or errors
1007 # emitted
, 0 otherwise.
1009 proc check_effective_target_shared
{ } {
1010 # Note that M68K has a multilib that supports
-fpic but not
1011 #
-fPIC
, so we need to check both. We test with a
program that
1012 # requires GOT references.
1013 return [check_no_compiler_messages shared executable
{
1014 extern
int foo
(void
); extern
int bar
;
1015 int baz
(void
) { return foo
() + bar
; }
1019 #
Return 1 if -pie
, -fpie and
-fPIE are supported
, 0 otherwise.
1021 proc check_effective_target_pie
{ } {
1022 if { [istarget
*-*-darwin\
[912\
]*]
1023 ||
[istarget
*-*-dragonfly
*]
1024 ||
[istarget
*-*-freebsd
*]
1025 ||
[istarget
*-*-linux
*]
1026 ||
[istarget
*-*-gnu
*] } {
1032 #
Return true
if the target supports
-mpaired
-single
(as used
on MIPS
).
1034 proc check_effective_target_mpaired_single
{ } {
1035 return [check_no_compiler_messages mpaired_single object
{
1037 } "-mpaired-single"]
1040 #
Return true
if the target has access to FPU instructions.
1042 proc check_effective_target_hard_float
{ } {
1043 if { [istarget mips
*-*-*] } {
1044 return [check_no_compiler_messages hard_float assembly
{
1045 #
if (defined __mips_soft_float || defined __mips16
)
1046 #error __mips_soft_float || __mips16
1051 # This proc is actually checking the availabilty of FPU
1052 # support
for doubles
, so
on the RX we must fail
if the
1053 #
64-bit double multilib has been selected.
1054 if { [istarget rx
-*-*] } {
1056 #
return [check_no_compiler_messages hard_float assembly
{
1057 #
if defined __RX_64_BIT_DOUBLES__
1058 #error __RX_64_BIT_DOUBLES__
1063 # The generic test equates hard_float with
"no call for adding doubles".
1064 return [check_no_messages_and_pattern hard_float
"!\\(call" rtl-expand {
1065 double a
(double b
, double c
) { return b
+ c
; }
1069 #
Return true
if the target is a
64-bit MIPS target.
1071 proc check_effective_target_mips64
{ } {
1072 return [check_no_compiler_messages mips64 assembly
{
1079 #
Return true
if the target is a MIPS target that does not produce
1082 proc check_effective_target_nomips16
{ } {
1083 return [check_no_compiler_messages nomips16 object
{
1087 /* A cheap way of testing
for -mflip
-mips16.
*/
1088 void foo
(void
) { asm
("addiu $20,$20,1"); }
1089 void bar
(void
) { asm
("addiu $20,$20,1"); }
1094 # Add the options needed
for MIPS16 function attributes. At the moment
,
1095 # we don
't support MIPS16 PIC.
1097 proc add_options_for_mips16_attribute { flags } {
1098 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
1101 # Return true if we can force a mode that allows MIPS16 code generation.
1102 # We don't support MIPS16 PIC
, and only support MIPS16
-mhard
-float
1105 proc check_effective_target_mips16_attribute
{ } {
1106 return [check_no_compiler_messages mips16_attribute assembly
{
1110 #
if defined __mips_hard_float \
1111 && (!defined _ABIO32 || _MIPS_SIM
!= _ABIO32
) \
1112 && (!defined _ABIO64 || _MIPS_SIM
!= _ABIO64
)
1113 #error __mips_hard_float
&& (!_ABIO32 ||
!_ABIO64
)
1115 } [add_options_for_mips16_attribute
""]]
1118 #
Return 1 if the target supports long double larger than double when
1119 # using the new ABI
, 0 otherwise.
1121 proc check_effective_target_mips_newabi_large_long_double
{ } {
1122 return [check_no_compiler_messages mips_newabi_large_long_double object
{
1123 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1127 #
Return true
if the target is a MIPS target that has access
1128 # to the LL and SC instructions.
1130 proc check_effective_target_mips_llsc
{ } {
1131 if { ![istarget mips
*-*-*] } {
1134 # Assume that these instructions are always implemented
for
1135 # non
-elf
* targets
, via emulation
if necessary.
1136 if { ![istarget
*-*-elf
*] } {
1139 # Otherwise assume LL
/SC support
for everything but MIPS I.
1140 return [check_no_compiler_messages mips_llsc assembly
{
1147 #
Return true
if the target is a MIPS target that uses in
-place relocations.
1149 proc check_effective_target_mips_rel
{ } {
1150 if { ![istarget mips
*-*-*] } {
1153 return [check_no_compiler_messages mips_rel object
{
1154 #
if (defined _ABIN32
&& _MIPS_SIM
== _ABIN32
) \
1155 ||
(defined _ABI64
&& _MIPS_SIM
== _ABI64
)
1156 #error _ABIN32
&& (_ABIN32 || _ABI64
)
1161 #
Return true
if the target is a MIPS target that uses the EABI.
1163 proc check_effective_target_mips_eabi
{ } {
1164 if { ![istarget mips
*-*-*] } {
1167 return [check_no_compiler_messages mips_eabi object
{
1174 #
Return 1 if the current multilib does not generate PIC by default.
1176 proc check_effective_target_nonpic
{ } {
1177 return [check_no_compiler_messages nonpic assembly
{
1184 #
Return 1 if the current multilib generates PIE by default.
1186 proc check_effective_target_pie_enabled
{ } {
1187 return [check_no_compiler_messages pie_enabled assembly
{
1194 #
Return 1 if the target generates
-fstack
-protector by default.
1196 proc check_effective_target_fstack_protector_enabled
{} {
1197 return [ check_no_compiler_messages fstack_protector_enabled assembly
{
1198 #
if !defined
(__SSP__
) && !defined
(__SSP_ALL__
) && \
1199 !defined
(__SSP_STRONG__
) && !defined
(__SSP_EXPICIT__
)
1205 #
Return 1 if the target does not use a
status wrapper.
1207 proc check_effective_target_unwrapped
{ } {
1208 if { [target_info needs_status_wrapper
] != "" \
1209 && [target_info needs_status_wrapper
] != "0" } {
1215 #
Return true
if iconv is supported
on the target. In particular IBM1047.
1217 proc check_iconv_available
{ test_what
} {
1220 #
If the tool configuration file has not
set libiconv
, try
"-liconv"
1221 if { ![info exists libiconv
] } {
1222 set libiconv
"-liconv"
1224 set test_what
[lindex $test_what
1]
1225 return [check_runtime_nocache $test_what
[subst
{
1231 cd
= iconv_open
("$test_what", "UTF-8");
1232 if (cd
== (iconv_t
) -1)
1239 #
Return true
if Cilk Library is supported
on the target.
1240 proc check_libcilkrts_available
{ } {
1241 return [ check_no_compiler_messages_nocache libcilkrts_available executable
{
1245 int __cilkrts_set_param
(const char
*, const char
*);
1247 int x
= __cilkrts_set_param
("nworkers", "0");
1250 } "-fcilkplus -lcilkrts" ]
1253 #
Return true
if the atomic library is supported
on the target.
1254 proc check_effective_target_libatomic_available
{ } {
1255 return [check_no_compiler_messages libatomic_available executable
{
1256 int main
(void
) { return 0; }
1260 #
Return 1 if an ASCII locale is supported
on this host
, 0 otherwise.
1262 proc check_ascii_locale_available
{ } {
1266 #
Return true
if named sections are supported
on this target.
1268 proc check_named_sections_available
{ } {
1269 return [check_no_compiler_messages named_sections assembly
{
1270 int __attribute__
((section
("whatever"))) foo;
1274 #
Return true
if the
"naked" function attribute is supported on this target.
1276 proc check_effective_target_naked_functions
{ } {
1277 return [check_no_compiler_messages naked_functions assembly
{
1278 void f
() __attribute__
((naked
));
1282 #
Return 1 if the target supports Fortran real kinds larger than real
(8),
1285 # When the target
name changes
, replace the cached result.
1287 proc check_effective_target_fortran_large_real
{ } {
1288 return [check_no_compiler_messages fortran_large_real executable
{
1290 integer,parameter
:: k
= selected_real_kind
(precision
(0.0_8
) + 1)
1297 #
Return 1 if the target supports Fortran real kind real
(16),
1298 #
0 otherwise. Contrary to check_effective_target_fortran_large_real
1299 # this checks
for Real
(16) only
; the other returned real
(10) if
1300 # both real
(10) and real
(16) are available.
1302 # When the target
name changes
, replace the cached result.
1304 proc check_effective_target_fortran_real_16
{ } {
1305 return [check_no_compiler_messages fortran_real_16 executable
{
1314 #
Return 1 if the target supports Fortran
's IEEE modules,
1317 # When the target name changes, replace the cached result.
1319 proc check_effective_target_fortran_ieee { flags } {
1320 return [check_no_compiler_messages fortran_ieee executable {
1322 use, intrinsic :: ieee_features
1328 # Return 1 if the target supports SQRT for the largest floating-point
1329 # type. (Some targets lack the libm support for this FP type.)
1330 # On most targets, this check effectively checks either whether sqrtl is
1331 # available or on __float128 systems whether libquadmath is installed,
1332 # which provides sqrtq.
1334 # When the target name changes, replace the cached result.
1336 proc check_effective_target_fortran_largest_fp_has_sqrt { } {
1337 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
1339 use iso_fortran_env, only: real_kinds
1340 integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
1341 real(kind=maxFP), volatile :: x
1349 # Return 1 if the target supports Fortran integer kinds larger than
1350 # integer(8), 0 otherwise.
1352 # When the target name changes, replace the cached result.
1354 proc check_effective_target_fortran_large_int { } {
1355 return [check_no_compiler_messages fortran_large_int executable {
1357 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
1358 integer(kind=k) :: i
1363 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
1365 # When the target name changes, replace the cached result.
1367 proc check_effective_target_fortran_integer_16 { } {
1368 return [check_no_compiler_messages fortran_integer_16 executable {
1375 # Return 1 if we can statically link libgfortran, 0 otherwise.
1377 # When the target name changes, replace the cached result.
1379 proc check_effective_target_static_libgfortran { } {
1380 return [check_no_compiler_messages static_libgfortran executable {
1387 # Return 1 if cilk-plus is supported by the target, 0 otherwise.
1389 proc check_effective_target_cilkplus { } {
1390 # Skip cilk-plus tests on int16 and size16 targets for now.
1391 # The cilk-plus tests are not generic enough to cover these
1392 # cases and would throw hundreds of FAILs.
1393 if { [check_effective_target_int16]
1394 || ![check_effective_target_size32plus] } {
1398 # Skip AVR, its RAM is too small and too many tests would fail.
1399 if { [istarget avr-*-*] } {
1405 proc check_linker_plugin_available { } {
1406 return [check_no_compiler_messages_nocache linker_plugin executable {
1407 int main() { return 0; }
1408 } "-flto -fuse-linker-plugin"]
1411 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1412 # otherwise. Cache the result.
1414 proc check_750cl_hw_available { } {
1415 return [check_cached_effective_target 750cl_hw_available {
1416 # If this is not the right target then we can skip the test.
1417 if { ![istarget powerpc-*paired*] } {
1420 check_runtime_nocache 750cl_hw_available {
1424 asm volatile ("ps_mul v0,v0,v0");
1426 asm volatile ("ps_mul 0,0,0");
1435 # Return 1 if the target OS supports running SSE executables, 0
1436 # otherwise. Cache the result.
1438 proc check_sse_os_support_available { } {
1439 return [check_cached_effective_target sse_os_support_available {
1440 # If this is not the right target then we can skip the test.
1441 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1443 } elseif { [istarget i?86-*-solaris2*] } {
1444 # The Solaris 2 kernel doesn't save and restore SSE registers
1445 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1446 check_runtime_nocache sse_os_support_available
{
1449 asm volatile
("movaps %xmm0,%xmm0");
1459 #
Return 1 if the target OS supports running AVX executables
, 0
1460 # otherwise.
Cache the result.
1462 proc check_avx_os_support_available
{ } {
1463 return [check_cached_effective_target avx_os_support_available
{
1464 #
If this is not the right target
then we can skip the test.
1465 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1468 # Check that OS has AVX and SSE saving enabled.
1469 check_runtime_nocache avx_os_support_available
{
1472 unsigned
int eax
, edx
;
1474 asm
("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1475 return (eax
& 6) != 6;
1482 #
Return 1 if the target supports executing SSE instructions
, 0
1483 # otherwise.
Cache the result.
1485 proc check_sse_hw_available
{ } {
1486 return [check_cached_effective_target sse_hw_available
{
1487 #
If this is not the right target
then we can skip the test.
1488 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1491 check_runtime_nocache sse_hw_available
{
1495 unsigned
int eax
, ebx
, ecx
, edx
;
1496 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1497 return !(edx
& bit_SSE
);
1505 #
Return 1 if the target supports executing SSE2 instructions
, 0
1506 # otherwise.
Cache the result.
1508 proc check_sse2_hw_available
{ } {
1509 return [check_cached_effective_target sse2_hw_available
{
1510 #
If this is not the right target
then we can skip the test.
1511 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1514 check_runtime_nocache sse2_hw_available
{
1518 unsigned
int eax
, ebx
, ecx
, edx
;
1519 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1520 return !(edx
& bit_SSE2
);
1528 #
Return 1 if the target supports executing AVX instructions
, 0
1529 # otherwise.
Cache the result.
1531 proc check_avx_hw_available
{ } {
1532 return [check_cached_effective_target avx_hw_available
{
1533 #
If this is not the right target
then we can skip the test.
1534 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1537 check_runtime_nocache avx_hw_available
{
1541 unsigned
int eax
, ebx
, ecx
, edx
;
1542 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1543 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1544 != (bit_AVX | bit_OSXSAVE
));
1552 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1554 proc check_effective_target_sse_runtime
{ } {
1555 if { [check_effective_target_sse
]
1556 && [check_sse_hw_available
]
1557 && [check_sse_os_support_available
] } {
1563 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1565 proc check_effective_target_sse2_runtime
{ } {
1566 if { [check_effective_target_sse2
]
1567 && [check_sse2_hw_available
]
1568 && [check_sse_os_support_available
] } {
1574 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1576 proc check_effective_target_avx_runtime
{ } {
1577 if { [check_effective_target_avx
]
1578 && [check_avx_hw_available
]
1579 && [check_avx_os_support_available
] } {
1585 #
Return 1 if the target supports executing power8 vector instructions
, 0
1586 # otherwise.
Cache the result.
1588 proc check_p8vector_hw_available
{ } {
1589 return [check_cached_effective_target p8vector_hw_available
{
1590 # Some simulators are known to not support VSX
/power8 instructions.
1591 #
For now
, disable
on Darwin
1592 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1595 set options
"-mpower8-vector"
1596 check_runtime_nocache p8vector_hw_available
{
1600 asm volatile
("xxlorc vs0,vs0,vs0");
1602 asm volatile
("xxlorc 0,0,0");
1611 #
Return 1 if the target supports executing VSX instructions
, 0
1612 # otherwise.
Cache the result.
1614 proc check_vsx_hw_available
{ } {
1615 return [check_cached_effective_target vsx_hw_available
{
1616 # Some simulators are known to not support VSX instructions.
1617 #
For now
, disable
on Darwin
1618 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1622 check_runtime_nocache vsx_hw_available
{
1626 asm volatile
("xxlor vs0,vs0,vs0");
1628 asm volatile
("xxlor 0,0,0");
1637 #
Return 1 if the target supports executing AltiVec instructions
, 0
1638 # otherwise.
Cache the result.
1640 proc check_vmx_hw_available
{ } {
1641 return [check_cached_effective_target vmx_hw_available
{
1642 # Some simulators are known to not support VMX instructions.
1643 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1646 # Most targets don
't require special flags for this test case, but
1647 # Darwin does. Just to be sure, make sure VSX is not enabled for
1648 # the altivec tests.
1649 if { [istarget *-*-darwin*]
1650 || [istarget *-*-aix*] } {
1651 set options "-maltivec -mno-vsx"
1653 set options "-mno-vsx"
1655 check_runtime_nocache vmx_hw_available {
1659 asm volatile ("vor v0,v0,v0");
1661 asm volatile ("vor 0,0,0");
1670 proc check_ppc_recip_hw_available { } {
1671 return [check_cached_effective_target ppc_recip_hw_available {
1672 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1673 # For now, disable on Darwin
1674 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1677 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1678 check_runtime_nocache ppc_recip_hw_available {
1679 volatile double d_recip, d_rsqrt, d_four = 4.0;
1680 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1683 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1684 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1685 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1686 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1694 # Return 1 if the target supports executing AltiVec and Cell PPU
1695 # instructions, 0 otherwise. Cache the result.
1697 proc check_effective_target_cell_hw { } {
1698 return [check_cached_effective_target cell_hw_available {
1699 # Some simulators are known to not support VMX and PPU instructions.
1700 if { [istarget powerpc-*-eabi*] } {
1703 # Most targets don't require special flags
for this test
1704 # case
, but Darwin and AIX
do.
1705 if { [istarget
*-*-darwin
*]
1706 ||
[istarget
*-*-aix
*] } {
1707 set options
"-maltivec -mcpu=cell"
1709 set options
"-mcpu=cell"
1711 check_runtime_nocache cell_hw_available
{
1715 asm volatile
("vor v0,v0,v0");
1716 asm volatile
("lvlx v0,r0,r0");
1718 asm volatile
("vor 0,0,0");
1719 asm volatile
("lvlx 0,0,0");
1728 #
Return 1 if the target supports executing
64-bit instructions
, 0
1729 # otherwise.
Cache the result.
1731 proc check_effective_target_powerpc64
{ } {
1732 global powerpc64_available_saved
1735 if [info exists powerpc64_available_saved
] {
1736 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1738 set powerpc64_available_saved
0
1740 # Some simulators are known to not support powerpc64 instructions.
1741 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1742 verbose
"check_effective_target_powerpc64 returning 0" 2
1743 return $powerpc64_available_saved
1746 #
Set up
, compile, and
execute a test
program containing a
64-bit
1747 # instruction.
Include the current process ID in the file
1748 # names to prevent conflicts with invocations
for multiple
1753 set f
[open $src
"w"]
1754 puts $f
"int main() {"
1755 puts $f
"#ifdef __MACH__"
1756 puts $f
" asm volatile (\"extsw r0,r0\");"
1758 puts $f
" asm volatile (\"extsw 0,0\");"
1760 puts $f
" return 0; }"
1763 set opts
"additional_flags=-mcpu=G5"
1765 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1766 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1769 if [string match
"" $lines] then {
1770 # No error message
, compilation succeeded.
1771 set result
[$
{tool
}_load
"./$exe" "" ""]
1772 set status [lindex $result
0]
1773 remote_file build
delete $exe
1774 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1776 if { $
status == "pass" } then {
1777 set powerpc64_available_saved
1
1780 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1784 return $powerpc64_available_saved
1787 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1788 # complex float arguments. This affects gfortran tests that
call cabsf
1789 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1790 #
argument passing as the compiler under test
, 0 otherwise.
1792 # When the target
name changes
, replace the cached result.
1794 proc check_effective_target_broken_cplxf_arg
{ } {
1795 return [check_cached_effective_target broken_cplxf_arg
{
1796 # Skip the work
for targets known not to be affected.
1797 if { ![istarget powerpc64
-*-linux
*] } {
1799 } elseif
{ ![is
-effective
-target lp64
] } {
1802 check_runtime_nocache broken_cplxf_arg
{
1803 #
include <complex.h
>
1804 extern void abort
(void
);
1805 float fabsf
(float
);
1806 float cabsf
(_Complex float
);
1813 if (fabsf
(f
- 5.0) > 0.0001)
1822 #
Return 1 is this is a TI C6X target supporting C67X instructions
1823 proc check_effective_target_ti_c67x
{ } {
1824 return [check_no_compiler_messages ti_c67x assembly
{
1825 #
if !defined
(_TMS320C6700
)
1826 #error
!_TMS320C6700
1831 #
Return 1 is this is a TI C6X target supporting C64X
+ instructions
1832 proc check_effective_target_ti_c64xp
{ } {
1833 return [check_no_compiler_messages ti_c64xp assembly
{
1834 #
if !defined
(_TMS320C6400_PLUS
)
1835 #error
!_TMS320C6400_PLUS
1841 proc check_alpha_max_hw_available
{ } {
1842 return [check_runtime alpha_max_hw_available
{
1843 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1847 # Returns true iff the FUNCTION is available
on the target
system.
1848 #
(This is essentially a Tcl implementation of Autoconf
's
1851 proc check_function_available { function } {
1852 return [check_no_compiler_messages ${function}_available \
1858 int main () { $function (); }
1862 # Returns true iff "fork" is available on the target system.
1864 proc check_fork_available {} {
1865 return [check_function_available "fork"]
1868 # Returns true iff "mkfifo" is available on the target system.
1870 proc check_mkfifo_available {} {
1871 if { [istarget *-*-cygwin*] } {
1872 # Cygwin has mkfifo, but support is incomplete.
1876 return [check_function_available "mkfifo"]
1879 # Returns true iff "__cxa_atexit" is used on the target system.
1881 proc check_cxa_atexit_available { } {
1882 return [check_cached_effective_target cxa_atexit_available {
1883 if { [istarget hppa*-*-hpux10*] } {
1884 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1886 } elseif
{ [istarget
*-*-vxworks
] } {
1887 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1890 check_runtime_nocache cxa_atexit_available {
1893 static unsigned int count;
1910 Y() { f(); count = 2; }
1919 int main() { return 0; }
1925 proc check_effective_target_objc2 { } {
1926 return [check_no_compiler_messages objc2 object {
1935 proc check_effective_target_next_runtime { } {
1936 return [check_no_compiler_messages objc2 object {
1937 #ifdef __NEXT_RUNTIME__
1940 #error !__NEXT_RUNTIME__
1945 # Return 1 if we're generating
32-bit code using default options
, 0
1948 proc check_effective_target_ilp32
{ } {
1949 return [check_no_compiler_messages ilp32 object
{
1950 int dummy
[sizeof
(int) == 4
1951 && sizeof
(void
*) == 4
1952 && sizeof
(long
) == 4 ?
1 : -1];
1956 #
Return 1 if we
're generating ia32 code using default options, 0
1959 proc check_effective_target_ia32 { } {
1960 return [check_no_compiler_messages ia32 object {
1961 int dummy[sizeof (int) == 4
1962 && sizeof (void *) == 4
1963 && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
1967 # Return 1 if we're generating x32 code using default options
, 0
1970 proc check_effective_target_x32
{ } {
1971 return [check_no_compiler_messages x32 object
{
1972 int dummy
[sizeof
(int) == 4
1973 && sizeof
(void
*) == 4
1974 && sizeof
(long
) == 4 ?
1 : -1] = { __x86_64__
};
1978 #
Return 1 if we
're generating 32-bit integers using default
1979 # options, 0 otherwise.
1981 proc check_effective_target_int32 { } {
1982 return [check_no_compiler_messages int32 object {
1983 int dummy[sizeof (int) == 4 ? 1 : -1];
1987 # Return 1 if we're generating
32-bit or larger integers using default
1988 # options
, 0 otherwise.
1990 proc check_effective_target_int32plus
{ } {
1991 return [check_no_compiler_messages int32plus object
{
1992 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1996 #
Return 1 if we
're generating 32-bit or larger pointers using default
1997 # options, 0 otherwise.
1999 proc check_effective_target_ptr32plus { } {
2000 # The msp430 has 16-bit or 20-bit pointers. The 20-bit pointer is stored
2001 # in a 32-bit slot when in memory, so sizeof(void *) returns 4, but it
2002 # cannot really hold a 32-bit address, so we always return false here.
2003 if { [istarget msp430-*-*] } {
2007 return [check_no_compiler_messages ptr32plus object {
2008 int dummy[sizeof (void *) >= 4 ? 1 : -1];
2012 # Return 1 if we support 32-bit or larger array and structure sizes
2013 # using default options, 0 otherwise. Avoid false positive on
2014 # targets with 20 or 24 bit address spaces.
2016 proc check_effective_target_size32plus { } {
2017 return [check_no_compiler_messages size32plus object {
2018 char dummy[16777217L];
2022 # Returns 1 if we're generating
16-bit or smaller integers with the
2023 # default options
, 0 otherwise.
2025 proc check_effective_target_int16
{ } {
2026 return [check_no_compiler_messages int16 object
{
2027 int dummy
[sizeof
(int) < 4 ?
1 : -1];
2031 #
Return 1 if we
're generating 64-bit code using default options, 0
2034 proc check_effective_target_lp64 { } {
2035 return [check_no_compiler_messages lp64 object {
2036 int dummy[sizeof (int) == 4
2037 && sizeof (void *) == 8
2038 && sizeof (long) == 8 ? 1 : -1];
2042 # Return 1 if we're generating
64-bit code using default llp64 options
,
2045 proc check_effective_target_llp64
{ } {
2046 return [check_no_compiler_messages llp64 object
{
2047 int dummy
[sizeof
(int) == 4
2048 && sizeof
(void
*) == 8
2049 && sizeof
(long long
) == 8
2050 && sizeof
(long
) == 4 ?
1 : -1];
2054 #
Return 1 if long and
int have different sizes
,
2057 proc check_effective_target_long_neq_int
{ } {
2058 return [check_no_compiler_messages long_ne_int object
{
2059 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
2063 #
Return 1 if the target supports long double larger than double
,
2066 proc check_effective_target_large_long_double
{ } {
2067 return [check_no_compiler_messages large_long_double object
{
2068 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
2072 #
Return 1 if the target supports double larger than float
,
2075 proc check_effective_target_large_double
{ } {
2076 return [check_no_compiler_messages large_double object
{
2077 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
2081 #
Return 1 if the target supports long double of
128 bits
,
2084 proc check_effective_target_longdouble128
{ } {
2085 return [check_no_compiler_messages longdouble128 object
{
2086 int dummy
[sizeof
(long double
) == 16 ?
1 : -1];
2090 #
Return 1 if the target supports double of
64 bits
,
2093 proc check_effective_target_double64
{ } {
2094 return [check_no_compiler_messages double64 object
{
2095 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
2099 #
Return 1 if the target supports double of at least
64 bits
,
2102 proc check_effective_target_double64plus
{ } {
2103 return [check_no_compiler_messages double64plus object
{
2104 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
2108 #
Return 1 if the target supports
'w' suffix
on floating constant
2111 proc check_effective_target_has_w_floating_suffix
{ } {
2113 if [check_effective_target_c
++] {
2114 append opts
"-std=gnu++03"
2116 return [check_no_compiler_messages w_fp_suffix object
{
2121 #
Return 1 if the target supports
'q' suffix
on floating constant
2124 proc check_effective_target_has_q_floating_suffix
{ } {
2126 if [check_effective_target_c
++] {
2127 append opts
"-std=gnu++03"
2129 return [check_no_compiler_messages q_fp_suffix object
{
2133 #
Return 1 if the target supports compiling fixed
-point
,
2136 proc check_effective_target_fixed_point
{ } {
2137 return [check_no_compiler_messages fixed_point object
{
2138 _Sat _Fract x
; _Sat _Accum y
;
2142 #
Return 1 if the target supports compiling decimal floating point
,
2145 proc check_effective_target_dfp_nocache
{ } {
2146 verbose
"check_effective_target_dfp_nocache: compiling source" 2
2147 set ret
[check_no_compiler_messages_nocache dfp object
{
2148 float x __attribute__
((mode(DD
)));
2150 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
2154 proc check_effective_target_dfprt_nocache
{ } {
2155 return [check_runtime_nocache dfprt
{
2156 typedef float d64 __attribute__
((mode(DD
)));
2157 d64 x
= 1.2df
, y
= 2.3dd
, z
;
2158 int main
() { z
= x
+ y
; return 0; }
2162 #
Return 1 if the target supports compiling Decimal Floating Point
,
2165 # This won
't change for different subtargets so cache the result.
2167 proc check_effective_target_dfp { } {
2168 return [check_cached_effective_target dfp {
2169 check_effective_target_dfp_nocache
2173 # Return 1 if the target supports linking and executing Decimal Floating
2174 # Point, 0 otherwise.
2176 # This won't change
for different subtargets so
cache the result.
2178 proc check_effective_target_dfprt
{ } {
2179 return [check_cached_effective_target dfprt
{
2180 check_effective_target_dfprt_nocache
2184 #
Return 1 if the target supports executing DFP hardware instructions
,
2185 #
0 otherwise.
Cache the result.
2187 proc check_dfp_hw_available
{ } {
2188 return [check_cached_effective_target dfp_hw_available
{
2189 #
For now
, disable
on Darwin
2190 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
2193 check_runtime_nocache dfp_hw_available
{
2194 volatile _Decimal64 r
;
2195 volatile _Decimal64 a
= 4.0DD
;
2196 volatile _Decimal64 b
= 2.0DD
;
2199 asm volatile
("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2200 asm volatile
("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2201 asm volatile
("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2202 asm volatile
("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2205 } "-mcpu=power6 -mhard-float"
2210 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2212 proc check_effective_target_ucn_nocache
{ } {
2213 #
-std
=c99 is only valid
for C
2214 if [check_effective_target_c
] {
2215 set ucnopts
"-std=c99"
2219 verbose
"check_effective_target_ucn_nocache: compiling source" 2
2220 set ret
[check_no_compiler_messages_nocache ucn object
{
2223 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
2227 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2229 # This won
't change for different subtargets, so cache the result.
2231 proc check_effective_target_ucn { } {
2232 return [check_cached_effective_target ucn {
2233 check_effective_target_ucn_nocache
2237 # Return 1 if the target needs a command line argument to enable a SIMD
2240 proc check_effective_target_vect_cmdline_needed { } {
2241 global et_vect_cmdline_needed_saved
2242 global et_vect_cmdline_needed_target_name
2244 if { ![info exists et_vect_cmdline_needed_target_name] } {
2245 set et_vect_cmdline_needed_target_name ""
2248 # If the target has changed since we set the cached value, clear it.
2249 set current_target [current_target_name]
2250 if { $current_target != $et_vect_cmdline_needed_target_name } {
2251 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
2252 set et_vect_cmdline_needed_target_name $current_target
2253 if { [info exists et_vect_cmdline_needed_saved] } {
2254 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
2255 unset et_vect_cmdline_needed_saved
2259 if [info exists et_vect_cmdline_needed_saved] {
2260 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
2262 set et_vect_cmdline_needed_saved 1
2263 if { [istarget alpha*-*-*]
2264 || [istarget ia64-*-*]
2265 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
2266 && ([check_effective_target_x32]
2267 || [check_effective_target_lp64]))
2268 || ([istarget powerpc*-*-*]
2269 && ([check_effective_target_powerpc_spe]
2270 || [check_effective_target_powerpc_altivec]))
2271 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
2272 || [istarget spu-*-*]
2273 || ([istarget arm*-*-*] && [check_effective_target_arm_neon])
2274 || [istarget aarch64*-*-*] } {
2275 set et_vect_cmdline_needed_saved 0
2279 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2280 return $et_vect_cmdline_needed_saved
2283 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
2285 # This won't change
for different subtargets so
cache the result.
2287 proc check_effective_target_vect_int
{ } {
2288 global et_vect_int_saved
2290 if [info exists et_vect_int_saved
] {
2291 verbose
"check_effective_target_vect_int: using cached result" 2
2293 set et_vect_int_saved
0
2294 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
2295 ||
([istarget powerpc
*-*-*]
2296 && ![istarget powerpc
-*-linux
*paired
*])
2297 ||
[istarget spu
-*-*]
2298 ||
[istarget sparc
*-*-*]
2299 ||
[istarget alpha
*-*-*]
2300 ||
[istarget ia64
-*-*]
2301 ||
[istarget aarch64
*-*-*]
2302 ||
[check_effective_target_arm32
]
2303 ||
([istarget mips
*-*-*]
2304 && [check_effective_target_mips_loongson
]) } {
2305 set et_vect_int_saved
1
2309 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
2310 return $et_vect_int_saved
2313 #
Return 1 if the target supports signed
int->float conversion
2316 proc check_effective_target_vect_intfloat_cvt
{ } {
2317 global et_vect_intfloat_cvt_saved
2319 if [info exists et_vect_intfloat_cvt_saved
] {
2320 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
2322 set et_vect_intfloat_cvt_saved
0
2323 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
2324 ||
([istarget powerpc
*-*-*]
2325 && ![istarget powerpc
-*-linux
*paired
*])
2326 ||
([istarget arm
*-*-*]
2327 && [check_effective_target_arm_neon_ok
])} {
2328 set et_vect_intfloat_cvt_saved
1
2332 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2333 return $et_vect_intfloat_cvt_saved
2336 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
2338 proc check_effective_target_int128 { } {
2339 return [check_no_compiler_messages int128 object {
2341 #ifndef __SIZEOF_INT128__
2350 # Return 1 if the target supports unsigned int->float conversion
2353 proc check_effective_target_vect_uintfloat_cvt { } {
2354 global et_vect_uintfloat_cvt_saved
2356 if [info exists et_vect_uintfloat_cvt_saved] {
2357 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2359 set et_vect_uintfloat_cvt_saved 0
2360 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
2361 || ([istarget powerpc*-*-*]
2362 && ![istarget powerpc-*-linux*paired*])
2363 || [istarget aarch64*-*-*]
2364 || ([istarget arm*-*-*]
2365 && [check_effective_target_arm_neon_ok])} {
2366 set et_vect_uintfloat_cvt_saved 1
2370 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2371 return $et_vect_uintfloat_cvt_saved
2375 # Return 1 if the target supports signed float->int conversion
2378 proc check_effective_target_vect_floatint_cvt { } {
2379 global et_vect_floatint_cvt_saved
2381 if [info exists et_vect_floatint_cvt_saved] {
2382 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2384 set et_vect_floatint_cvt_saved 0
2385 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
2386 || ([istarget powerpc*-*-*]
2387 && ![istarget powerpc-*-linux*paired*])
2388 || ([istarget arm*-*-*]
2389 && [check_effective_target_arm_neon_ok])} {
2390 set et_vect_floatint_cvt_saved 1
2394 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2395 return $et_vect_floatint_cvt_saved
2398 # Return 1 if the target supports unsigned float->int conversion
2401 proc check_effective_target_vect_floatuint_cvt { } {
2402 global et_vect_floatuint_cvt_saved
2404 if [info exists et_vect_floatuint_cvt_saved] {
2405 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2407 set et_vect_floatuint_cvt_saved 0
2408 if { ([istarget powerpc*-*-*]
2409 && ![istarget powerpc-*-linux*paired*])
2410 || ([istarget arm*-*-*]
2411 && [check_effective_target_arm_neon_ok])} {
2412 set et_vect_floatuint_cvt_saved 1
2416 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2417 return $et_vect_floatuint_cvt_saved
2420 # Return 1 if the target supports #pragma omp declare simd, 0 otherwise.
2422 # This won't change
for different subtargets so
cache the result.
2424 proc check_effective_target_vect_simd_clones
{ } {
2425 global et_vect_simd_clones_saved
2427 if [info exists et_vect_simd_clones_saved
] {
2428 verbose
"check_effective_target_vect_simd_clones: using cached result" 2
2430 set et_vect_simd_clones_saved
0
2431 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
2432 #
On i?
86/x86_64 #pragma omp declare simd builds a sse2
, avx and
2433 # avx2 clone. Only the right clone
for the specified arch will be
2434 # chosen
, but still we need to at least be able to assemble
2436 if { [check_effective_target_avx2
] } {
2437 set et_vect_simd_clones_saved
1
2442 verbose
"check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2443 return $et_vect_simd_clones_saved
2446 #
Return 1 if this is a AArch64 target supporting big endian
2447 proc check_effective_target_aarch64_big_endian
{ } {
2448 return [check_no_compiler_messages aarch64_big_endian assembly
{
2449 #
if !defined
(__aarch64__
) ||
!defined
(__AARCH64EB__
)
2450 #error
!__aarch64__ ||
!__AARCH64EB__
2455 #
Return 1 if this is a AArch64 target supporting little endian
2456 proc check_effective_target_aarch64_little_endian
{ } {
2457 if { ![istarget aarch64
*-*-*] } {
2461 return [check_no_compiler_messages aarch64_little_endian assembly
{
2462 #
if !defined
(__aarch64__
) || defined
(__AARCH64EB__
)
2468 #
Return 1 if this is an arm target using
32-bit instructions
2469 proc check_effective_target_arm32
{ } {
2470 if { ![istarget arm
*-*-*] } {
2474 return [check_no_compiler_messages arm32 assembly
{
2475 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
2476 #error
!__arm || __thumb__
&& !__thumb2__
2481 #
Return 1 if this is an arm target not using Thumb
2482 proc check_effective_target_arm_nothumb
{ } {
2483 if { ![istarget arm
*-*-*] } {
2487 return [check_no_compiler_messages arm_nothumb assembly
{
2488 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) || defined
(__thumb2__
))
2489 #error
!__arm__ || __thumb || __thumb2__
2494 #
Return 1 if this is a little
-endian ARM target
2495 proc check_effective_target_arm_little_endian
{ } {
2496 if { ![istarget arm
*-*-*] } {
2500 return [check_no_compiler_messages arm_little_endian assembly
{
2501 #
if !defined
(__arm__
) ||
!defined
(__ARMEL__
)
2502 #error
!__arm__ ||
!__ARMEL__
2507 #
Return 1 if this is an ARM target that only supports aligned vector accesses
2508 proc check_effective_target_arm_vect_no_misalign
{ } {
2509 if { ![istarget arm
*-*-*] } {
2513 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
2514 #
if !defined
(__arm__
) \
2515 ||
(defined
(__ARM_FEATURE_UNALIGNED
) \
2516 && defined
(__ARMEL__
))
2517 #error
!__arm__ ||
(__ARMEL__
&& __ARM_FEATURE_UNALIGNED
)
2523 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2524 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
2527 proc check_effective_target_arm_vfp_ok
{ } {
2528 if { [check_effective_target_arm32
] } {
2529 return [check_no_compiler_messages arm_vfp_ok object
{
2531 } "-mfpu=vfp -mfloat-abi=softfp"]
2537 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp3
2538 #
-mfloat
-abi
=softfp.
2540 proc check_effective_target_arm_vfp3_ok
{ } {
2541 if { [check_effective_target_arm32
] } {
2542 return [check_no_compiler_messages arm_vfp3_ok object
{
2544 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2550 #
Return 1 if this is an ARM target supporting
-mfpu
=fp
-armv8
2551 #
-mfloat
-abi
=softfp.
2552 proc check_effective_target_arm_v8_vfp_ok
{} {
2553 if { [check_effective_target_arm32
] } {
2554 return [check_no_compiler_messages arm_v8_vfp_ok object
{
2557 __asm__ volatile
("vrinta.f32.f32 s0, s0");
2560 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2566 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2567 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
2570 proc check_effective_target_arm_hard_vfp_ok
{ } {
2571 if { [check_effective_target_arm32
]
2572 && ! [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2573 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
2574 int main
() { return 0;}
2575 } "-mfpu=vfp -mfloat-abi=hard"]
2581 #
Return 1 if this is an ARM target that supports DSP multiply with
2582 # current multilib flags.
2584 proc check_effective_target_arm_dsp
{ } {
2585 return [check_no_compiler_messages arm_dsp assembly
{
2586 #ifndef __ARM_FEATURE_DSP
2593 #
Return 1 if this is an ARM target that supports unaligned word
/halfword
2594 #
load/store instructions.
2596 proc check_effective_target_arm_unaligned
{ } {
2597 return [check_no_compiler_messages arm_unaligned assembly
{
2598 #ifndef __ARM_FEATURE_UNALIGNED
2599 #error no unaligned support
2605 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2606 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2607 # incompatible with these options. Also
set et_arm_crypto_flags to the
2608 # best options to add.
2610 proc check_effective_target_arm_crypto_ok_nocache
{ } {
2611 global et_arm_crypto_flags
2612 set et_arm_crypto_flags
""
2613 if { [check_effective_target_arm32
] } {
2614 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2615 if { [check_no_compiler_messages_nocache arm_crypto_ok object
{
2616 #
include "arm_neon.h"
2618 foo
(uint8x16_t a
, uint8x16_t b
)
2620 return vaeseq_u8
(a
, b
);
2623 set et_arm_crypto_flags $flags
2632 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2634 proc check_effective_target_arm_crypto_ok
{ } {
2635 return [check_cached_effective_target arm_crypto_ok \
2636 check_effective_target_arm_crypto_ok_nocache
]
2639 # Add options
for crypto extensions.
2640 proc add_options_for_arm_crypto
{ flags
} {
2641 if { ! [check_effective_target_arm_crypto_ok
] } {
2644 global et_arm_crypto_flags
2645 return "$flags $et_arm_crypto_flags"
2648 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2649 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2650 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2651 # NEON
, do not add
-mfpu
=neon.
2653 proc add_options_for_arm_neon
{ flags
} {
2654 if { ! [check_effective_target_arm_neon_ok
] } {
2657 global et_arm_neon_flags
2658 return "$flags $et_arm_neon_flags"
2661 proc add_options_for_arm_v8_vfp
{ flags
} {
2662 if { ! [check_effective_target_arm_v8_vfp_ok
] } {
2665 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2668 proc add_options_for_arm_v8_neon
{ flags
} {
2669 if { ! [check_effective_target_arm_v8_neon_ok
] } {
2672 global et_arm_v8_neon_flags
2673 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2676 proc add_options_for_arm_crc
{ flags
} {
2677 if { ! [check_effective_target_arm_crc_ok
] } {
2680 global et_arm_crc_flags
2681 return "$flags $et_arm_crc_flags"
2684 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2685 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2686 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2687 # NEON
, do not add
-mfpu
=neon.
2689 proc add_options_for_arm_neonv2
{ flags
} {
2690 if { ! [check_effective_target_arm_neonv2_ok
] } {
2693 global et_arm_neonv2_flags
2694 return "$flags $et_arm_neonv2_flags"
2697 # Add the options needed
for vfp3.
2698 proc add_options_for_arm_vfp3
{ flags
} {
2699 if { ! [check_effective_target_arm_vfp3_ok
] } {
2702 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2705 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
2706 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2707 # incompatible with these options. Also
set et_arm_neon_flags to the
2708 # best options to add.
2710 proc check_effective_target_arm_neon_ok_nocache
{ } {
2711 global et_arm_neon_flags
2712 set et_arm_neon_flags
""
2713 if { [check_effective_target_arm32
] } {
2714 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2715 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
2716 #
include "arm_neon.h"
2718 /* Avoid the case where a test adds
-mfpu
=neon
, but the toolchain is
2719 configured
for -mcpu
=arm926ej
-s
, for example.
*/
2721 #error Architecture too old
for NEON.
2724 set et_arm_neon_flags $flags
2733 proc check_effective_target_arm_neon_ok
{ } {
2734 return [check_cached_effective_target arm_neon_ok \
2735 check_effective_target_arm_neon_ok_nocache
]
2738 proc check_effective_target_arm_crc_ok_nocache
{ } {
2739 global et_arm_crc_flags
2740 set et_arm_crc_flags
"-march=armv8-a+crc"
2741 return [check_no_compiler_messages_nocache arm_crc_ok object
{
2742 #
if !defined
(__ARM_FEATURE_CRC32
)
2745 } "$et_arm_crc_flags"]
2748 proc check_effective_target_arm_crc_ok
{ } {
2749 return [check_cached_effective_target arm_crc_ok \
2750 check_effective_target_arm_crc_ok_nocache
]
2753 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
2754 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2755 # incompatible with these options. Also
set et_arm_neon_flags to the
2756 # best options to add.
2758 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
2759 global et_arm_neon_fp16_flags
2760 set et_arm_neon_fp16_flags
""
2761 if { [check_effective_target_arm32
] } {
2762 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2763 "-mfpu=neon-fp16 -mfloat-abi=softfp"
2764 "-mfp16-format=ieee"
2765 "-mfloat-abi=softfp -mfp16-format=ieee"
2766 "-mfpu=neon-fp16 -mfp16-format=ieee"
2767 "-mfpu=neon-fp16 -mfloat-abi=softfp -mfp16-format=ieee"} {
2768 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object
{
2769 #
include "arm_neon.h"
2771 foo
(float32x4_t
arg)
2773 return vcvt_f16_f32
(arg);
2776 set et_arm_neon_fp16_flags $flags
2785 proc check_effective_target_arm_neon_fp16_ok
{ } {
2786 return [check_cached_effective_target arm_neon_fp16_ok \
2787 check_effective_target_arm_neon_fp16_ok_nocache
]
2790 proc add_options_for_arm_neon_fp16
{ flags
} {
2791 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
2794 global et_arm_neon_fp16_flags
2795 return "$flags $et_arm_neon_fp16_flags"
2798 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp
-armv8
2799 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2800 # incompatible with these options. Also
set et_arm_v8_neon_flags to the
2801 # best options to add.
2803 proc check_effective_target_arm_v8_neon_ok_nocache
{ } {
2804 global et_arm_v8_neon_flags
2805 set et_arm_v8_neon_flags
""
2806 if { [check_effective_target_arm32
] } {
2807 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2808 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object
{
2810 #error not armv8 or later
2812 #
include "arm_neon.h"
2816 __asm__ volatile
("vrintn.f32 q0, q0");
2818 } "$flags -march=armv8-a"] } {
2819 set et_arm_v8_neon_flags $flags
2828 proc check_effective_target_arm_v8_neon_ok
{ } {
2829 return [check_cached_effective_target arm_v8_neon_ok \
2830 check_effective_target_arm_v8_neon_ok_nocache
]
2833 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-vfpv4
2834 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2835 # incompatible with these options. Also
set et_arm_neonv2_flags to the
2836 # best options to add.
2838 proc check_effective_target_arm_neonv2_ok_nocache
{ } {
2839 global et_arm_neonv2_flags
2840 set et_arm_neonv2_flags
""
2841 if { [check_effective_target_arm32
] } {
2842 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2843 if { [check_no_compiler_messages_nocache arm_neonv2_ok object
{
2844 #
include "arm_neon.h"
2846 foo
(float32x2_t a
, float32x2_t b
, float32x2_t c
)
2848 return vfma_f32
(a
, b
, c
);
2851 set et_arm_neonv2_flags $flags
2860 proc check_effective_target_arm_neonv2_ok
{ } {
2861 return [check_cached_effective_target arm_neonv2_ok \
2862 check_effective_target_arm_neonv2_ok_nocache
]
2865 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2866 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2869 proc add_options_for_arm_fp16
{ flags
} {
2870 if { ! [check_effective_target_arm_fp16_ok
] } {
2873 global et_arm_fp16_flags
2874 return "$flags $et_arm_fp16_flags"
2877 #
Return 1 if this is an ARM target that can support a VFP fp16 variant.
2878 # Skip multilibs that are incompatible with these options and
set
2879 # et_arm_fp16_flags to the best options to add.
2881 proc check_effective_target_arm_fp16_ok_nocache
{ } {
2882 global et_arm_fp16_flags
2883 set et_arm_fp16_flags
""
2884 if { ! [check_effective_target_arm32
] } {
2887 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2888 # Multilib flags would override
-mfpu.
2891 if [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2892 # Must generate floating
-point instructions.
2895 if [check_effective_target_arm_hf_eabi
] {
2896 # Use existing float
-abi and force an fpu which supports fp16
2897 set et_arm_fp16_flags
"-mfpu=vfpv4"
2900 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "" } ]] {
2901 # The existing
-mfpu value is OK
; use it
, but add softfp.
2902 set et_arm_fp16_flags
"-mfloat-abi=softfp"
2905 # Add
-mfpu
for a VFP fp16 variant since there is no preprocessor
2906 # macro to check
for this support.
2907 set flags
"-mfpu=vfpv4 -mfloat-abi=softfp"
2908 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly
{
2911 set et_arm_fp16_flags
"$flags"
2918 proc check_effective_target_arm_fp16_ok
{ } {
2919 return [check_cached_effective_target arm_fp16_ok \
2920 check_effective_target_arm_fp16_ok_nocache
]
2923 # Creates a series of routines that
return 1 if the given architecture
2924 # can be selected and a routine to give the flags to select that architecture
2925 # Note
: Extra flags may be added to disable options from newer compilers
2926 #
(Thumb in particular
- but others may be added in the future
)
2927 # Usage
: /* { dg
-require
-effective
-target arm_arch_v5_ok
} */
2928 #
/* { dg
-add
-options arm_arch_v5
} */
2929 #
/* { dg
-require
-effective
-target arm_arch_v5_multilib
} */
2930 foreach
{ armfunc armflag armdef
} { v4
"-march=armv4 -marm" __ARM_ARCH_4__
2931 v4t
"-march=armv4t" __ARM_ARCH_4T__
2932 v5
"-march=armv5 -marm" __ARM_ARCH_5__
2933 v5t
"-march=armv5t" __ARM_ARCH_5T__
2934 v5te
"-march=armv5te" __ARM_ARCH_5TE__
2935 v6
"-march=armv6" __ARM_ARCH_6__
2936 v6k
"-march=armv6k" __ARM_ARCH_6K__
2937 v6t2
"-march=armv6t2" __ARM_ARCH_6T2__
2938 v6z
"-march=armv6z" __ARM_ARCH_6Z__
2939 v6m
"-march=armv6-m -mthumb" __ARM_ARCH_6M__
2940 v7a
"-march=armv7-a" __ARM_ARCH_7A__
2941 v7ve
"-march=armv7ve" __ARM_ARCH_7A__
2942 v7r
"-march=armv7-r" __ARM_ARCH_7R__
2943 v7m
"-march=armv7-m -mthumb" __ARM_ARCH_7M__
2944 v7em
"-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2945 v8a
"-march=armv8-a" __ARM_ARCH_8A__ } {
2946 eval
[string map
[list FUNC $armfunc FLAG $armflag DEF $armdef
] {
2947 proc check_effective_target_arm_arch_FUNC_ok
{ } {
2948 if { [ string match
"*-marm*" "FLAG" ] &&
2949 ![check_effective_target_arm_arm_ok
] } {
2952 return [check_no_compiler_messages arm_arch_FUNC_ok assembly
{
2959 proc add_options_for_arm_arch_FUNC
{ flags
} {
2960 return "$flags FLAG"
2963 proc check_effective_target_arm_arch_FUNC_multilib
{ } {
2964 return [check_runtime arm_arch_FUNC_multilib
{
2970 } [add_options_for_arm_arch_FUNC
""]]
2975 #
Return 1 if this is an ARM target where
-marm causes ARM to be
2978 proc check_effective_target_arm_arm_ok
{ } {
2979 return [check_no_compiler_messages arm_arm_ok assembly
{
2980 #
if !defined
(__arm__
) || defined
(__thumb__
) || defined
(__thumb2__
)
2981 #error
!__arm__ || __thumb__ || __thumb2__
2987 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
2990 proc check_effective_target_arm_thumb1_ok
{ } {
2991 return [check_no_compiler_messages arm_thumb1_ok assembly
{
2992 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2993 #error
!__arm__ ||
!__thumb__ || __thumb2__
2995 int foo
(int i
) { return i
; }
2999 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
3002 proc check_effective_target_arm_thumb2_ok
{ } {
3003 return [check_no_compiler_messages arm_thumb2_ok assembly
{
3004 #
if !defined
(__thumb2__
)
3007 int foo
(int i
) { return i
; }
3011 #
Return 1 if this is an ARM target where Thumb
-1 is used without options
3012 # added by the test.
3014 proc check_effective_target_arm_thumb1
{ } {
3015 return [check_no_compiler_messages arm_thumb1 assembly
{
3016 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
3017 #error
!__arm__ ||
!__thumb__ || __thumb2__
3023 #
Return 1 if this is an ARM target where Thumb
-2 is used without options
3024 # added by the test.
3026 proc check_effective_target_arm_thumb2
{ } {
3027 return [check_no_compiler_messages arm_thumb2 assembly
{
3028 #
if !defined
(__thumb2__
)
3035 #
Return 1 if this is an ARM target where conditional execution is available.
3037 proc check_effective_target_arm_cond_exec
{ } {
3038 return [check_no_compiler_messages arm_cond_exec assembly
{
3039 #
if defined
(__arm__
) && defined
(__thumb__
) && !defined
(__thumb2__
)
3046 #
Return 1 if this is an ARM cortex
-M profile cpu
3048 proc check_effective_target_arm_cortex_m
{ } {
3049 if { ![istarget arm
*-*-*] } {
3052 return [check_no_compiler_messages arm_cortex_m assembly
{
3053 #
if !defined
(__ARM_ARCH_7M__
) \
3054 && !defined
(__ARM_ARCH_7EM__
) \
3055 && !defined
(__ARM_ARCH_6M__
)
3056 #error
!__ARM_ARCH_7M__
&& !__ARM_ARCH_7EM__
&& !__ARM_ARCH_6M__
3062 #
Return 1 if this compilation turns
on string_ops_prefer_neon
on.
3064 proc check_effective_target_arm_tune_string_ops_prefer_neon
{ } {
3065 return [check_no_messages_and_pattern arm_tune_string_ops_prefer_neon
"@string_ops_prefer_neon:\t1" assembly {
3066 int foo
(void
) { return 0; }
3067 } "-O2 -mprint-tune-info" ]
3070 #
Return 1 if the target supports executing NEON instructions
, 0
3071 # otherwise.
Cache the result.
3073 proc check_effective_target_arm_neon_hw
{ } {
3074 return [check_runtime arm_neon_hw_available
{
3078 long long a
= 0, b
= 1;
3079 asm
("vorr %P0, %P1, %P2"
3081 : "0" (a), "w" (b));
3084 } [add_options_for_arm_neon
""]]
3087 proc check_effective_target_arm_neonv2_hw
{ } {
3088 return [check_runtime arm_neon_hwv2_available
{
3089 #
include "arm_neon.h"
3093 float32x2_t a
, b
, c
;
3094 asm
("vfma.f32 %P0, %P1, %P2"
3096 : "w" (b), "w" (c));
3099 } [add_options_for_arm_neonv2
""]]
3102 #
Return 1 if the target supports executing ARMv8 NEON instructions
, 0
3105 proc check_effective_target_arm_v8_neon_hw
{ } {
3106 return [check_runtime arm_v8_neon_hw_available
{
3107 #
include "arm_neon.h"
3112 asm
("vrinta.f32 %P0, %P1"
3117 } [add_options_for_arm_v8_neon
""]]
3120 #
Return 1 if this is a ARM target with NEON enabled.
3122 proc check_effective_target_arm_neon
{ } {
3123 if { [check_effective_target_arm32
] } {
3124 return [check_no_compiler_messages arm_neon object
{
3125 #ifndef __ARM_NEON__
3136 proc check_effective_target_arm_neonv2
{ } {
3137 if { [check_effective_target_arm32
] } {
3138 return [check_no_compiler_messages arm_neon object
{
3139 #ifndef __ARM_NEON__
3142 #ifndef __ARM_FEATURE_FMA
3154 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
3155 # the Loongson vector modes.
3157 proc check_effective_target_mips_loongson
{ } {
3158 return [check_no_compiler_messages loongson assembly
{
3159 #
if !defined
(__mips_loongson_vector_rev
)
3160 #error
!__mips_loongson_vector_rev
3165 #
Return 1 if this is a MIPS target that supports the legacy NAN.
3167 proc check_effective_target_mips_nanlegacy
{ } {
3168 return [check_no_compiler_messages nanlegacy assembly
{
3170 int main
() { return 0; }
3174 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
3177 proc check_effective_target_arm_eabi
{ } {
3178 return [check_no_compiler_messages arm_eabi object
{
3179 #ifndef __ARM_EABI__
3187 #
Return 1 if this is an ARM target that adheres to the hard
-float variant of
3188 # the ABI
for the ARM Architecture
(e.g.
-mfloat
-abi
=hard
).
3190 proc check_effective_target_arm_hf_eabi
{ } {
3191 return [check_no_compiler_messages arm_hf_eabi object
{
3192 #
if !defined
(__ARM_EABI__
) ||
!defined
(__ARM_PCS_VFP
)
3193 #error not hard
-float EABI
3200 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
3201 # Some multilibs may be incompatible with this option.
3203 proc check_effective_target_arm_iwmmxt_ok
{ } {
3204 if { [check_effective_target_arm32
] } {
3205 return [check_no_compiler_messages arm_iwmmxt_ok object
{
3213 #
Return true
if LDRD
/STRD instructions are prefered over LDM
/STM instructions
3214 #
for an ARM target.
3215 proc check_effective_target_arm_prefer_ldrd_strd
{ } {
3216 if { ![check_effective_target_arm32
] } {
3220 return [check_no_messages_and_pattern arm_prefer_ldrd_strd
"strd\tr" assembly {
3221 void foo
(int *p
) { p
[0] = 1; p
[1] = 0;}
3225 #
Return 1 if this is a PowerPC target supporting
-meabi.
3227 proc check_effective_target_powerpc_eabi_ok
{ } {
3228 if { [istarget powerpc
*-*-*] } {
3229 return [check_no_compiler_messages powerpc_eabi_ok object
{
3237 #
Return 1 if this is a PowerPC target with floating
-point registers.
3239 proc check_effective_target_powerpc_fprs
{ } {
3240 if { [istarget powerpc
*-*-*]
3241 ||
[istarget rs6000
-*-*] } {
3242 return [check_no_compiler_messages powerpc_fprs object
{
3254 #
Return 1 if this is a PowerPC target with hardware double
-precision
3257 proc check_effective_target_powerpc_hard_double
{ } {
3258 if { [istarget powerpc
*-*-*]
3259 ||
[istarget rs6000
-*-*] } {
3260 return [check_no_compiler_messages powerpc_hard_double object
{
3272 #
Return 1 if this is a PowerPC target supporting
-maltivec.
3274 proc check_effective_target_powerpc_altivec_ok
{ } {
3275 if { ([istarget powerpc
*-*-*]
3276 && ![istarget powerpc
-*-linux
*paired
*])
3277 ||
[istarget rs6000
-*-*] } {
3278 # AltiVec is not supported
on AIX before
5.3.
3279 if { [istarget powerpc
*-*-aix4
*]
3280 ||
[istarget powerpc
*-*-aix5.1
*]
3281 ||
[istarget powerpc
*-*-aix5.2
*] } {
3284 return [check_no_compiler_messages powerpc_altivec_ok object
{
3292 #
Return 1 if this is a PowerPC target supporting
-mpower8
-vector
3294 proc check_effective_target_powerpc_p8vector_ok
{ } {
3295 if { ([istarget powerpc
*-*-*]
3296 && ![istarget powerpc
-*-linux
*paired
*])
3297 ||
[istarget rs6000
-*-*] } {
3298 # AltiVec is not supported
on AIX before
5.3.
3299 if { [istarget powerpc
*-*-aix4
*]
3300 ||
[istarget powerpc
*-*-aix5.1
*]
3301 ||
[istarget powerpc
*-*-aix5.2
*] } {
3304 return [check_no_compiler_messages powerpc_p8vector_ok object
{
3307 asm volatile
("xxlorc vs0,vs0,vs0");
3309 asm volatile
("xxlorc 0,0,0");
3313 } "-mpower8-vector"]
3319 #
Return 1 if this is a PowerPC target supporting
-mvsx
3321 proc check_effective_target_powerpc_vsx_ok
{ } {
3322 if { ([istarget powerpc
*-*-*]
3323 && ![istarget powerpc
-*-linux
*paired
*])
3324 ||
[istarget rs6000
-*-*] } {
3325 # VSX is not supported
on AIX before
7.1.
3326 if { [istarget powerpc
*-*-aix4
*]
3327 ||
[istarget powerpc
*-*-aix5
*]
3328 ||
[istarget powerpc
*-*-aix6
*] } {
3331 return [check_no_compiler_messages powerpc_vsx_ok object
{
3334 asm volatile
("xxlor vs0,vs0,vs0");
3336 asm volatile
("xxlor 0,0,0");
3346 #
Return 1 if this is a PowerPC target supporting
-mhtm
3348 proc check_effective_target_powerpc_htm_ok
{ } {
3349 if { ([istarget powerpc
*-*-*]
3350 && ![istarget powerpc
-*-linux
*paired
*])
3351 ||
[istarget rs6000
-*-*] } {
3352 # HTM is not supported
on AIX yet.
3353 if { [istarget powerpc
*-*-aix
*] } {
3356 return [check_no_compiler_messages powerpc_htm_ok object
{
3358 asm volatile
("tbegin. 0");
3367 #
Return 1 if the target supports executing HTM hardware instructions
,
3368 #
0 otherwise.
Cache the result.
3370 proc check_htm_hw_available
{ } {
3371 return [check_cached_effective_target htm_hw_available
{
3372 #
For now
, disable
on Darwin
3373 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
3376 check_runtime_nocache htm_hw_available
{
3386 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
3388 proc check_effective_target_powerpc_ppu_ok
{ } {
3389 if [check_effective_target_powerpc_altivec_ok
] {
3390 return [check_no_compiler_messages cell_asm_available object
{
3393 asm volatile
("lvlx v0,v0,v0");
3395 asm volatile
("lvlx 0,0,0");
3405 #
Return 1 if this is a PowerPC target that supports SPU.
3407 proc check_effective_target_powerpc_spu
{ } {
3408 if { [istarget powerpc
*-*-linux
*] } {
3409 return [check_effective_target_powerpc_altivec_ok
]
3415 #
Return 1 if this is a PowerPC SPE target. The check includes options
3416 # specified by dg
-options
for this test
, so don
't cache the result.
3418 proc check_effective_target_powerpc_spe_nocache { } {
3419 if { [istarget powerpc*-*-*] } {
3420 return [check_no_compiler_messages_nocache powerpc_spe object {
3426 } [current_compiler_flags]]
3432 # Return 1 if this is a PowerPC target with SPE enabled.
3434 proc check_effective_target_powerpc_spe { } {
3435 if { [istarget powerpc*-*-*] } {
3436 return [check_no_compiler_messages powerpc_spe object {
3448 # Return 1 if this is a PowerPC target with Altivec enabled.
3450 proc check_effective_target_powerpc_altivec { } {
3451 if { [istarget powerpc*-*-*] } {
3452 return [check_no_compiler_messages powerpc_altivec object {
3464 # Return 1 if this is a PowerPC 405 target. The check includes options
3465 # specified by dg-options for this test, so don't
cache the result.
3467 proc check_effective_target_powerpc_405_nocache
{ } {
3468 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
3469 return [check_no_compiler_messages_nocache powerpc_405 object
{
3475 } [current_compiler_flags
]]
3481 #
Return 1 if this is a PowerPC target using the ELFv2 ABI.
3483 proc check_effective_target_powerpc_elfv2
{ } {
3484 if { [istarget powerpc
*-*-*] } {
3485 return [check_no_compiler_messages powerpc_elfv2 object
{
3487 #error not ELF v2 ABI
3497 #
Return 1 if this is a SPU target with a toolchain that
3498 # supports automatic overlay generation.
3500 proc check_effective_target_spu_auto_overlay
{ } {
3501 if { [istarget spu
*-*-elf
*] } {
3502 return [check_no_compiler_messages spu_auto_overlay executable
{
3504 } "-Wl,--auto-overlay" ]
3510 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3511 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
3512 # test environment appears to run executables
on such a simulator.
3514 proc check_effective_target_ultrasparc_hw
{ } {
3515 return [check_runtime ultrasparc_hw
{
3516 int main
() { return 0; }
3517 } "-mcpu=ultrasparc"]
3520 #
Return 1 if the test environment supports executing UltraSPARC VIS2
3521 # instructions. We check this by attempting
: "bmask %g0, %g0, %g0"
3523 proc check_effective_target_ultrasparc_vis2_hw
{ } {
3524 return [check_runtime ultrasparc_vis2_hw
{
3525 int main
() { __asm__
(".word 0x81b00320"); return 0; }
3526 } "-mcpu=ultrasparc3"]
3529 #
Return 1 if the test environment supports executing UltraSPARC VIS3
3530 # instructions. We check this by attempting
: "addxc %g0, %g0, %g0"
3532 proc check_effective_target_ultrasparc_vis3_hw
{ } {
3533 return [check_runtime ultrasparc_vis3_hw
{
3534 int main
() { __asm__
(".word 0x81b00220"); return 0; }
3538 #
Return 1 if this is a SPARC
-V9 target.
3540 proc check_effective_target_sparc_v9
{ } {
3541 if { [istarget sparc
*-*-*] } {
3542 return [check_no_compiler_messages sparc_v9 object
{
3544 asm volatile
("return %i7+8");
3553 #
Return 1 if this is a SPARC target with VIS enabled.
3555 proc check_effective_target_sparc_vis
{ } {
3556 if { [istarget sparc
*-*-*] } {
3557 return [check_no_compiler_messages sparc_vis object
{
3569 #
Return 1 if the target supports hardware vector shift operation.
3571 proc check_effective_target_vect_shift
{ } {
3572 global et_vect_shift_saved
3574 if [info exists et_vect_shift_saved
] {
3575 verbose
"check_effective_target_vect_shift: using cached result" 2
3577 set et_vect_shift_saved
0
3578 if { ([istarget powerpc
*-*-*]
3579 && ![istarget powerpc
-*-linux
*paired
*])
3580 ||
[istarget ia64
-*-*]
3581 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3582 ||
[istarget aarch64
*-*-*]
3583 ||
[check_effective_target_arm32
]
3584 ||
([istarget mips
*-*-*]
3585 && [check_effective_target_mips_loongson
]) } {
3586 set et_vect_shift_saved
1
3590 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3591 return $et_vect_shift_saved
3594 proc check_effective_target_whole_vector_shift
{ } {
3595 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3596 ||
[istarget ia64
-*-*]
3597 ||
[istarget aarch64
*-*-*]
3598 ||
([check_effective_target_arm32
]
3599 && [check_effective_target_arm_little_endian
])
3600 ||
([istarget mips
*-*-*]
3601 && [check_effective_target_mips_loongson
]) } {
3607 verbose
"check_effective_target_vect_long: returning $answer" 2
3611 #
Return 1 if the target supports vector bswap operations.
3613 proc check_effective_target_vect_bswap
{ } {
3614 global et_vect_bswap_saved
3616 if [info exists et_vect_bswap_saved
] {
3617 verbose
"check_effective_target_vect_bswap: using cached result" 2
3619 set et_vect_bswap_saved
0
3620 if { [istarget aarch64
*-*-*]
3621 ||
([istarget arm
*-*-*]
3622 && [check_effective_target_arm_neon
])
3624 set et_vect_bswap_saved
1
3628 verbose
"check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
3629 return $et_vect_bswap_saved
3632 #
Return 1 if the target supports hardware vector shift operation
for char.
3634 proc check_effective_target_vect_shift_char
{ } {
3635 global et_vect_shift_char_saved
3637 if [info exists et_vect_shift_char_saved
] {
3638 verbose
"check_effective_target_vect_shift_char: using cached result" 2
3640 set et_vect_shift_char_saved
0
3641 if { ([istarget powerpc
*-*-*]
3642 && ![istarget powerpc
-*-linux
*paired
*])
3643 ||
[check_effective_target_arm32
] } {
3644 set et_vect_shift_char_saved
1
3648 verbose
"check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3649 return $et_vect_shift_char_saved
3652 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
3654 # This can change
for different subtargets so
do not
cache the result.
3656 proc check_effective_target_vect_long
{ } {
3657 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3658 ||
(([istarget powerpc
*-*-*]
3659 && ![istarget powerpc
-*-linux
*paired
*])
3660 && [check_effective_target_ilp32
])
3661 ||
[check_effective_target_arm32
]
3662 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
3668 verbose
"check_effective_target_vect_long: returning $answer" 2
3672 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
3674 # This won
't change for different subtargets so cache the result.
3676 proc check_effective_target_vect_float { } {
3677 global et_vect_float_saved
3679 if [info exists et_vect_float_saved] {
3680 verbose "check_effective_target_vect_float: using cached result" 2
3682 set et_vect_float_saved 0
3683 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
3684 || [istarget powerpc*-*-*]
3685 || [istarget spu-*-*]
3686 || [istarget mips-sde-elf]
3687 || [istarget mipsisa64*-*-*]
3688 || [istarget ia64-*-*]
3689 || [istarget aarch64*-*-*]
3690 || [check_effective_target_arm32] } {
3691 set et_vect_float_saved 1
3695 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
3696 return $et_vect_float_saved
3699 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
3701 # This won't change
for different subtargets so
cache the result.
3703 proc check_effective_target_vect_double
{ } {
3704 global et_vect_double_saved
3706 if [info exists et_vect_double_saved
] {
3707 verbose
"check_effective_target_vect_double: using cached result" 2
3709 set et_vect_double_saved
0
3710 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3711 ||
[istarget aarch64
*-*-*] } {
3712 if { [check_no_compiler_messages vect_double assembly
{
3713 #ifdef __tune_atom__
3714 # error No double vectorizer support.
3717 set et_vect_double_saved
1
3719 set et_vect_double_saved
0
3721 } elseif
{ [istarget spu
-*-*] } {
3722 set et_vect_double_saved
1
3723 } elseif
{ [istarget powerpc
*-*-*] && [check_vsx_hw_available
] } {
3724 set et_vect_double_saved
1
3728 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
3729 return $et_vect_double_saved
3732 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
3734 # This won
't change for different subtargets so cache the result.
3736 proc check_effective_target_vect_long_long { } {
3737 global et_vect_long_long_saved
3739 if [info exists et_vect_long_long_saved] {
3740 verbose "check_effective_target_vect_long_long: using cached result" 2
3742 set et_vect_long_long_saved 0
3743 if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
3744 set et_vect_long_long_saved 1
3748 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3749 return $et_vect_long_long_saved
3753 # Return 1 if the target plus current options does not support a vector
3754 # max instruction on "int", 0 otherwise.
3756 # This won't change
for different subtargets so
cache the result.
3758 proc check_effective_target_vect_no_int_min_max
{ } {
3759 global et_vect_no_int_min_max_saved
3761 if [info exists et_vect_no_int_min_max_saved
] {
3762 verbose
"check_effective_target_vect_no_int_min_max: using cached result" 2
3764 set et_vect_no_int_min_max_saved
0
3765 if { [istarget sparc
*-*-*]
3766 ||
[istarget spu
-*-*]
3767 ||
[istarget alpha
*-*-*]
3768 ||
([istarget mips
*-*-*]
3769 && [check_effective_target_mips_loongson
]) } {
3770 set et_vect_no_int_min_max_saved
1
3773 verbose
"check_effective_target_vect_no_int_min_max: returning $et_vect_no_int_min_max_saved" 2
3774 return $et_vect_no_int_min_max_saved
3777 #
Return 1 if the target plus current options does not support a vector
3778 # add instruction
on "int", 0 otherwise.
3780 # This won
't change for different subtargets so cache the result.
3782 proc check_effective_target_vect_no_int_add { } {
3783 global et_vect_no_int_add_saved
3785 if [info exists et_vect_no_int_add_saved] {
3786 verbose "check_effective_target_vect_no_int_add: using cached result" 2
3788 set et_vect_no_int_add_saved 0
3789 # Alpha only supports vector add on V8QI and V4HI.
3790 if { [istarget alpha*-*-*] } {
3791 set et_vect_no_int_add_saved 1
3794 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3795 return $et_vect_no_int_add_saved
3798 # Return 1 if the target plus current options does not support vector
3799 # bitwise instructions, 0 otherwise.
3801 # This won't change
for different subtargets so
cache the result.
3803 proc check_effective_target_vect_no_bitwise
{ } {
3804 global et_vect_no_bitwise_saved
3806 if [info exists et_vect_no_bitwise_saved
] {
3807 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
3809 set et_vect_no_bitwise_saved
0
3811 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3812 return $et_vect_no_bitwise_saved
3815 #
Return 1 if the target plus current options supports vector permutation
,
3818 # This won
't change for different subtargets so cache the result.
3820 proc check_effective_target_vect_perm { } {
3823 if [info exists et_vect_perm_saved] {
3824 verbose "check_effective_target_vect_perm: using cached result" 2
3826 set et_vect_perm_saved 0
3827 if { [is-effective-target arm_neon_ok]
3828 || [istarget aarch64*-*-*]
3829 || [istarget powerpc*-*-*]
3830 || [istarget spu-*-*]
3831 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3832 || ([istarget mips*-*-*]
3833 && [check_effective_target_mpaired_single]) } {
3834 set et_vect_perm_saved 1
3837 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3838 return $et_vect_perm_saved
3841 # Return 1 if the target plus current options supports vector permutation
3842 # on byte-sized elements, 0 otherwise.
3844 # This won't change
for different subtargets so
cache the result.
3846 proc check_effective_target_vect_perm_byte
{ } {
3847 global et_vect_perm_byte
3849 if [info exists et_vect_perm_byte_saved
] {
3850 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
3852 set et_vect_perm_byte_saved
0
3853 if { ([is
-effective
-target arm_neon_ok
]
3854 && [is
-effective
-target arm_little_endian
])
3855 ||
([istarget aarch64
*-*-*]
3856 && [is
-effective
-target aarch64_little_endian
])
3857 ||
[istarget powerpc
*-*-*]
3858 ||
[istarget spu
-*-*] } {
3859 set et_vect_perm_byte_saved
1
3862 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3863 return $et_vect_perm_byte_saved
3866 #
Return 1 if the target plus current options supports vector permutation
3867 #
on short
-sized elements
, 0 otherwise.
3869 # This won
't change for different subtargets so cache the result.
3871 proc check_effective_target_vect_perm_short { } {
3872 global et_vect_perm_short
3874 if [info exists et_vect_perm_short_saved] {
3875 verbose "check_effective_target_vect_perm_short: using cached result" 2
3877 set et_vect_perm_short_saved 0
3878 if { ([is-effective-target arm_neon_ok]
3879 && [is-effective-target arm_little_endian])
3880 || ([istarget aarch64*-*-*]
3881 && [is-effective-target aarch64_little_endian])
3882 || [istarget powerpc*-*-*]
3883 || [istarget spu-*-*] } {
3884 set et_vect_perm_short_saved 1
3887 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3888 return $et_vect_perm_short_saved
3891 # Return 1 if the target plus current options supports a vector
3892 # widening summation of *short* args into *int* result, 0 otherwise.
3894 # This won't change
for different subtargets so
cache the result.
3896 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
3897 global et_vect_widen_sum_hi_to_si_pattern
3899 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
3900 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3902 set et_vect_widen_sum_hi_to_si_pattern_saved
0
3903 if { [istarget powerpc
*-*-*]
3904 ||
[istarget ia64
-*-*] } {
3905 set et_vect_widen_sum_hi_to_si_pattern_saved
1
3908 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3909 return $et_vect_widen_sum_hi_to_si_pattern_saved
3912 #
Return 1 if the target plus current options supports a vector
3913 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3914 # A target can also support this widening summation
if it can support
3915 # promotion
(unpacking
) from shorts to ints.
3917 # This won
't change for different subtargets so cache the result.
3919 proc check_effective_target_vect_widen_sum_hi_to_si { } {
3920 global et_vect_widen_sum_hi_to_si
3922 if [info exists et_vect_widen_sum_hi_to_si_saved] {
3923 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3925 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
3926 if { [istarget powerpc*-*-*]
3927 || [istarget ia64-*-*] } {
3928 set et_vect_widen_sum_hi_to_si_saved 1
3931 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3932 return $et_vect_widen_sum_hi_to_si_saved
3935 # Return 1 if the target plus current options supports a vector
3936 # widening summation of *char* args into *short* result, 0 otherwise.
3937 # A target can also support this widening summation if it can support
3938 # promotion (unpacking) from chars to shorts.
3940 # This won't change
for different subtargets so
cache the result.
3942 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
3943 global et_vect_widen_sum_qi_to_hi
3945 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
3946 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3948 set et_vect_widen_sum_qi_to_hi_saved
0
3949 if { [check_effective_target_vect_unpack
]
3950 ||
[check_effective_target_arm_neon_ok
]
3951 ||
[istarget ia64
-*-*] } {
3952 set et_vect_widen_sum_qi_to_hi_saved
1
3955 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3956 return $et_vect_widen_sum_qi_to_hi_saved
3959 #
Return 1 if the target plus current options supports a vector
3960 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
3962 # This won
't change for different subtargets so cache the result.
3964 proc check_effective_target_vect_widen_sum_qi_to_si { } {
3965 global et_vect_widen_sum_qi_to_si
3967 if [info exists et_vect_widen_sum_qi_to_si_saved] {
3968 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3970 set et_vect_widen_sum_qi_to_si_saved 0
3971 if { [istarget powerpc*-*-*] } {
3972 set et_vect_widen_sum_qi_to_si_saved 1
3975 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3976 return $et_vect_widen_sum_qi_to_si_saved
3979 # Return 1 if the target plus current options supports a vector
3980 # widening multiplication of *char* args into *short* result, 0 otherwise.
3981 # A target can also support this widening multplication if it can support
3982 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
3983 # multiplication of shorts).
3985 # This won't change
for different subtargets so
cache the result.
3988 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
3989 global et_vect_widen_mult_qi_to_hi
3991 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
3992 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3994 if { [check_effective_target_vect_unpack
]
3995 && [check_effective_target_vect_short_mult
] } {
3996 set et_vect_widen_mult_qi_to_hi_saved
1
3998 set et_vect_widen_mult_qi_to_hi_saved
0
4000 if { [istarget powerpc
*-*-*]
4001 ||
[istarget aarch64
*-*-*]
4002 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
4003 set et_vect_widen_mult_qi_to_hi_saved
1
4006 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
4007 return $et_vect_widen_mult_qi_to_hi_saved
4010 #
Return 1 if the target plus current options supports a vector
4011 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
4012 # A target can also support this widening multplication
if it can support
4013 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
4014 # multiplication of ints
).
4016 # This won
't change for different subtargets so cache the result.
4019 proc check_effective_target_vect_widen_mult_hi_to_si { } {
4020 global et_vect_widen_mult_hi_to_si
4022 if [info exists et_vect_widen_mult_hi_to_si_saved] {
4023 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
4025 if { [check_effective_target_vect_unpack]
4026 && [check_effective_target_vect_int_mult] } {
4027 set et_vect_widen_mult_hi_to_si_saved 1
4029 set et_vect_widen_mult_hi_to_si_saved 0
4031 if { [istarget powerpc*-*-*]
4032 || [istarget spu-*-*]
4033 || [istarget ia64-*-*]
4034 || [istarget aarch64*-*-*]
4035 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4036 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4037 set et_vect_widen_mult_hi_to_si_saved 1
4040 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
4041 return $et_vect_widen_mult_hi_to_si_saved
4044 # Return 1 if the target plus current options supports a vector
4045 # widening multiplication of *char* args into *short* result, 0 otherwise.
4047 # This won't change
for different subtargets so
cache the result.
4049 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern
{ } {
4050 global et_vect_widen_mult_qi_to_hi_pattern
4052 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved
] {
4053 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
4055 set et_vect_widen_mult_qi_to_hi_pattern_saved
0
4056 if { [istarget powerpc
*-*-*]
4057 ||
([istarget arm
*-*-*]
4058 && [check_effective_target_arm_neon_ok
]
4059 && [check_effective_target_arm_little_endian
]) } {
4060 set et_vect_widen_mult_qi_to_hi_pattern_saved
1
4063 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
4064 return $et_vect_widen_mult_qi_to_hi_pattern_saved
4067 #
Return 1 if the target plus current options supports a vector
4068 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
4070 # This won
't change for different subtargets so cache the result.
4072 proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
4073 global et_vect_widen_mult_hi_to_si_pattern
4075 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved] {
4076 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
4078 set et_vect_widen_mult_hi_to_si_pattern_saved 0
4079 if { [istarget powerpc*-*-*]
4080 || [istarget spu-*-*]
4081 || [istarget ia64-*-*]
4082 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4083 || ([istarget arm*-*-*]
4084 && [check_effective_target_arm_neon_ok]
4085 && [check_effective_target_arm_little_endian]) } {
4086 set et_vect_widen_mult_hi_to_si_pattern_saved 1
4089 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
4090 return $et_vect_widen_mult_hi_to_si_pattern_saved
4093 # Return 1 if the target plus current options supports a vector
4094 # widening multiplication of *int* args into *long* result, 0 otherwise.
4096 # This won't change
for different subtargets so
cache the result.
4098 proc check_effective_target_vect_widen_mult_si_to_di_pattern
{ } {
4099 global et_vect_widen_mult_si_to_di_pattern
4101 if [info exists et_vect_widen_mult_si_to_di_pattern_saved
] {
4102 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
4104 set et_vect_widen_mult_si_to_di_pattern_saved
0
4105 if {[istarget ia64
-*-*]
4106 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
4107 set et_vect_widen_mult_si_to_di_pattern_saved
1
4110 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
4111 return $et_vect_widen_mult_si_to_di_pattern_saved
4114 #
Return 1 if the target plus current options supports a vector
4115 # widening shift
, 0 otherwise.
4117 # This won
't change for different subtargets so cache the result.
4119 proc check_effective_target_vect_widen_shift { } {
4120 global et_vect_widen_shift_saved
4122 if [info exists et_vect_shift_saved] {
4123 verbose "check_effective_target_vect_widen_shift: using cached result" 2
4125 set et_vect_widen_shift_saved 0
4126 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4127 set et_vect_widen_shift_saved 1
4130 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
4131 return $et_vect_widen_shift_saved
4134 # Return 1 if the target plus current options supports a vector
4135 # dot-product of signed chars, 0 otherwise.
4137 # This won't change
for different subtargets so
cache the result.
4139 proc check_effective_target_vect_sdot_qi
{ } {
4140 global et_vect_sdot_qi
4142 if [info exists et_vect_sdot_qi_saved
] {
4143 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
4145 set et_vect_sdot_qi_saved
0
4146 if { [istarget ia64
-*-*] } {
4147 set et_vect_udot_qi_saved
1
4150 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
4151 return $et_vect_sdot_qi_saved
4154 #
Return 1 if the target plus current options supports a vector
4155 # dot
-product of unsigned chars
, 0 otherwise.
4157 # This won
't change for different subtargets so cache the result.
4159 proc check_effective_target_vect_udot_qi { } {
4160 global et_vect_udot_qi
4162 if [info exists et_vect_udot_qi_saved] {
4163 verbose "check_effective_target_vect_udot_qi: using cached result" 2
4165 set et_vect_udot_qi_saved 0
4166 if { [istarget powerpc*-*-*]
4167 || [istarget ia64-*-*] } {
4168 set et_vect_udot_qi_saved 1
4171 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
4172 return $et_vect_udot_qi_saved
4175 # Return 1 if the target plus current options supports a vector
4176 # dot-product of signed shorts, 0 otherwise.
4178 # This won't change
for different subtargets so
cache the result.
4180 proc check_effective_target_vect_sdot_hi
{ } {
4181 global et_vect_sdot_hi
4183 if [info exists et_vect_sdot_hi_saved
] {
4184 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
4186 set et_vect_sdot_hi_saved
0
4187 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4188 ||
[istarget ia64
-*-*]
4189 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
4190 set et_vect_sdot_hi_saved
1
4193 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
4194 return $et_vect_sdot_hi_saved
4197 #
Return 1 if the target plus current options supports a vector
4198 # dot
-product of unsigned shorts
, 0 otherwise.
4200 # This won
't change for different subtargets so cache the result.
4202 proc check_effective_target_vect_udot_hi { } {
4203 global et_vect_udot_hi
4205 if [info exists et_vect_udot_hi_saved] {
4206 verbose "check_effective_target_vect_udot_hi: using cached result" 2
4208 set et_vect_udot_hi_saved 0
4209 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
4210 set et_vect_udot_hi_saved 1
4213 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
4214 return $et_vect_udot_hi_saved
4217 # Return 1 if the target plus current options supports a vector
4218 # sad operation of unsigned chars, 0 otherwise.
4220 # This won't change
for different subtargets so
cache the result.
4222 proc check_effective_target_vect_usad_char
{ } {
4223 global et_vect_usad_char
4225 if [info exists et_vect_usad_char_saved
] {
4226 verbose
"check_effective_target_vect_usad_char: using cached result" 2
4228 set et_vect_usad_char_saved
0
4229 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) } {
4230 set et_vect_usad_char_saved
1
4233 verbose
"check_effective_target_vect_usad_char: returning $et_vect_usad_char_saved" 2
4234 return $et_vect_usad_char_saved
4237 #
Return 1 if the target plus current options supports a vector
4238 # demotion
(packing
) of shorts
(to chars
) and ints
(to shorts
)
4239 # using modulo arithmetic
, 0 otherwise.
4241 # This won
't change for different subtargets so cache the result.
4243 proc check_effective_target_vect_pack_trunc { } {
4244 global et_vect_pack_trunc
4246 if [info exists et_vect_pack_trunc_saved] {
4247 verbose "check_effective_target_vect_pack_trunc: using cached result" 2
4249 set et_vect_pack_trunc_saved 0
4250 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4251 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4252 || [istarget aarch64*-*-*]
4253 || [istarget spu-*-*]
4254 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
4255 && [check_effective_target_arm_little_endian]) } {
4256 set et_vect_pack_trunc_saved 1
4259 verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
4260 return $et_vect_pack_trunc_saved
4263 # Return 1 if the target plus current options supports a vector
4264 # promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
4266 # This won't change
for different subtargets so
cache the result.
4268 proc check_effective_target_vect_unpack
{ } {
4269 global et_vect_unpack
4271 if [info exists et_vect_unpack_saved
] {
4272 verbose
"check_effective_target_vect_unpack: using cached result" 2
4274 set et_vect_unpack_saved
0
4275 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*paired
*])
4276 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
4277 ||
[istarget spu
-*-*]
4278 ||
[istarget ia64
-*-*]
4279 ||
[istarget aarch64
*-*-*]
4280 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
4281 && [check_effective_target_arm_little_endian
]) } {
4282 set et_vect_unpack_saved
1
4285 verbose
"check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
4286 return $et_vect_unpack_saved
4289 #
Return 1 if the target plus current options does not guarantee
4290 # that its STACK_BOUNDARY is
>= the reguired vector alignment.
4292 # This won
't change for different subtargets so cache the result.
4294 proc check_effective_target_unaligned_stack { } {
4295 global et_unaligned_stack_saved
4297 if [info exists et_unaligned_stack_saved] {
4298 verbose "check_effective_target_unaligned_stack: using cached result" 2
4300 set et_unaligned_stack_saved 0
4302 verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
4303 return $et_unaligned_stack_saved
4306 # Return 1 if the target plus current options does not support a vector
4307 # alignment mechanism, 0 otherwise.
4309 # This won't change
for different subtargets so
cache the result.
4311 proc check_effective_target_vect_no_align
{ } {
4312 global et_vect_no_align_saved
4314 if [info exists et_vect_no_align_saved
] {
4315 verbose
"check_effective_target_vect_no_align: using cached result" 2
4317 set et_vect_no_align_saved
0
4318 if { [istarget mipsisa64
*-*-*]
4319 ||
[istarget mips
-sde
-elf
]
4320 ||
[istarget sparc
*-*-*]
4321 ||
[istarget ia64
-*-*]
4322 ||
[check_effective_target_arm_vect_no_misalign
]
4323 ||
([istarget powerpc
*-*-*] && [check_p8vector_hw_available
])
4324 ||
([istarget mips
*-*-*]
4325 && [check_effective_target_mips_loongson
]) } {
4326 set et_vect_no_align_saved
1
4329 verbose
"check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
4330 return $et_vect_no_align_saved
4333 #
Return 1 if the target supports a vector misalign access
, 0 otherwise.
4335 # This won
't change for different subtargets so cache the result.
4337 proc check_effective_target_vect_hw_misalign { } {
4338 global et_vect_hw_misalign_saved
4340 if [info exists et_vect_hw_misalign_saved] {
4341 verbose "check_effective_target_vect_hw_misalign: using cached result" 2
4343 set et_vect_hw_misalign_saved 0
4344 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4345 || ([istarget powerpc*-*-*] && [check_p8vector_hw_available])
4346 || [istarget aarch64*-*-*] } {
4347 set et_vect_hw_misalign_saved 1
4350 verbose "check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
4351 return $et_vect_hw_misalign_saved
4355 # Return 1 if arrays are aligned to the vector alignment
4356 # boundary, 0 otherwise.
4358 # This won't change
for different subtargets so
cache the result.
4360 proc check_effective_target_vect_aligned_arrays
{ } {
4361 global et_vect_aligned_arrays
4363 if [info exists et_vect_aligned_arrays_saved
] {
4364 verbose
"check_effective_target_vect_aligned_arrays: using cached result" 2
4366 set et_vect_aligned_arrays_saved
0
4367 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
4368 if { ([is
-effective
-target lp64
]
4369 && ( ![check_avx_available
]
4370 ||
[check_prefer_avx128
])) } {
4371 set et_vect_aligned_arrays_saved
1
4374 if [istarget spu
-*-*] {
4375 set et_vect_aligned_arrays_saved
1
4378 verbose
"check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
4379 return $et_vect_aligned_arrays_saved
4382 #
Return 1 if types of size
32 bit or less are naturally aligned
4383 #
(aligned to their type
-size
), 0 otherwise.
4385 # This won
't change for different subtargets so cache the result.
4387 proc check_effective_target_natural_alignment_32 { } {
4388 global et_natural_alignment_32
4390 if [info exists et_natural_alignment_32_saved] {
4391 verbose "check_effective_target_natural_alignment_32: using cached result" 2
4393 # FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
4394 set et_natural_alignment_32_saved 1
4395 if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
4396 set et_natural_alignment_32_saved 0
4399 verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4400 return $et_natural_alignment_32_saved
4403 # Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
4404 # type-size), 0 otherwise.
4406 # This won't change
for different subtargets so
cache the result.
4408 proc check_effective_target_natural_alignment_64
{ } {
4409 global et_natural_alignment_64
4411 if [info exists et_natural_alignment_64_saved
] {
4412 verbose
"check_effective_target_natural_alignment_64: using cached result" 2
4414 set et_natural_alignment_64_saved
0
4415 if { ([is
-effective
-target lp64
] && ![istarget
*-*-darwin
*])
4416 ||
[istarget spu
-*-*] } {
4417 set et_natural_alignment_64_saved
1
4420 verbose
"check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4421 return $et_natural_alignment_64_saved
4424 #
Return 1 if all vector types are naturally aligned
(aligned to their
4425 # type
-size
), 0 otherwise.
4427 # This won
't change for different subtargets so cache the result.
4429 proc check_effective_target_vect_natural_alignment { } {
4430 global et_vect_natural_alignment
4432 if [info exists et_vect_natural_alignment_saved] {
4433 verbose "check_effective_target_vect_natural_alignment: using cached result" 2
4435 set et_vect_natural_alignment_saved 1
4436 if { [check_effective_target_arm_eabi]
4437 || [istarget nvptx-*-*]
4438 || [istarget s390*-*-*] } {
4439 set et_vect_natural_alignment_saved 0
4442 verbose "check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4443 return $et_vect_natural_alignment_saved
4446 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
4448 # This won't change
for different subtargets so
cache the result.
4450 proc check_effective_target_vector_alignment_reachable
{ } {
4451 global et_vector_alignment_reachable
4453 if [info exists et_vector_alignment_reachable_saved
] {
4454 verbose
"check_effective_target_vector_alignment_reachable: using cached result" 2
4456 if { [check_effective_target_vect_aligned_arrays
]
4457 ||
[check_effective_target_natural_alignment_32
] } {
4458 set et_vector_alignment_reachable_saved
1
4460 set et_vector_alignment_reachable_saved
0
4463 verbose
"check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4464 return $et_vector_alignment_reachable_saved
4467 #
Return 1 if vector alignment
for 64 bit is reachable
, 0 otherwise.
4469 # This won
't change for different subtargets so cache the result.
4471 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
4472 global et_vector_alignment_reachable_for_64bit
4474 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
4475 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4477 if { [check_effective_target_vect_aligned_arrays]
4478 || [check_effective_target_natural_alignment_64] } {
4479 set et_vector_alignment_reachable_for_64bit_saved 1
4481 set et_vector_alignment_reachable_for_64bit_saved 0
4484 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4485 return $et_vector_alignment_reachable_for_64bit_saved
4488 # Return 1 if the target only requires element alignment for vector accesses
4490 proc check_effective_target_vect_element_align { } {
4491 global et_vect_element_align
4493 if [info exists et_vect_element_align] {
4494 verbose "check_effective_target_vect_element_align: using cached result" 2
4496 set et_vect_element_align 0
4497 if { ([istarget arm*-*-*]
4498 && ![check_effective_target_arm_vect_no_misalign])
4499 || [check_effective_target_vect_hw_misalign] } {
4500 set et_vect_element_align 1
4504 verbose "check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4505 return $et_vect_element_align
4508 # Return 1 if the target supports vector conditional operations, 0 otherwise.
4510 proc check_effective_target_vect_condition { } {
4511 global et_vect_cond_saved
4513 if [info exists et_vect_cond_saved] {
4514 verbose "check_effective_target_vect_cond: using cached result" 2
4516 set et_vect_cond_saved 0
4517 if { [istarget aarch64*-*-*]
4518 || [istarget powerpc*-*-*]
4519 || [istarget ia64-*-*]
4520 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4521 || [istarget spu-*-*]
4522 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4523 set et_vect_cond_saved 1
4527 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4528 return $et_vect_cond_saved
4531 # Return 1 if the target supports vector conditional operations where
4532 # the comparison has different type from the lhs, 0 otherwise.
4534 proc check_effective_target_vect_cond_mixed { } {
4535 global et_vect_cond_mixed_saved
4537 if [info exists et_vect_cond_mixed_saved] {
4538 verbose "check_effective_target_vect_cond_mixed: using cached result" 2
4540 set et_vect_cond_mixed_saved 0
4541 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4542 || [istarget powerpc*-*-*] } {
4543 set et_vect_cond_mixed_saved 1
4547 verbose "check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4548 return $et_vect_cond_mixed_saved
4551 # Return 1 if the target supports vector char multiplication, 0 otherwise.
4553 proc check_effective_target_vect_char_mult { } {
4554 global et_vect_char_mult_saved
4556 if [info exists et_vect_char_mult_saved] {
4557 verbose "check_effective_target_vect_char_mult: using cached result" 2
4559 set et_vect_char_mult_saved 0
4560 if { [istarget aarch64*-*-*]
4561 || [istarget ia64-*-*]
4562 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4563 || [check_effective_target_arm32] } {
4564 set et_vect_char_mult_saved 1
4568 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4569 return $et_vect_char_mult_saved
4572 # Return 1 if the target supports vector short multiplication, 0 otherwise.
4574 proc check_effective_target_vect_short_mult { } {
4575 global et_vect_short_mult_saved
4577 if [info exists et_vect_short_mult_saved] {
4578 verbose "check_effective_target_vect_short_mult: using cached result" 2
4580 set et_vect_short_mult_saved 0
4581 if { [istarget ia64-*-*]
4582 || [istarget spu-*-*]
4583 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4584 || [istarget powerpc*-*-*]
4585 || [istarget aarch64*-*-*]
4586 || [check_effective_target_arm32]
4587 || ([istarget mips*-*-*]
4588 && [check_effective_target_mips_loongson]) } {
4589 set et_vect_short_mult_saved 1
4593 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4594 return $et_vect_short_mult_saved
4597 # Return 1 if the target supports vector int multiplication, 0 otherwise.
4599 proc check_effective_target_vect_int_mult { } {
4600 global et_vect_int_mult_saved
4602 if [info exists et_vect_int_mult_saved] {
4603 verbose "check_effective_target_vect_int_mult: using cached result" 2
4605 set et_vect_int_mult_saved 0
4606 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4607 || [istarget spu-*-*]
4608 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4609 || [istarget ia64-*-*]
4610 || [istarget aarch64*-*-*]
4611 || [check_effective_target_arm32] } {
4612 set et_vect_int_mult_saved 1
4616 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4617 return $et_vect_int_mult_saved
4620 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
4622 proc check_effective_target_vect_extract_even_odd { } {
4623 global et_vect_extract_even_odd_saved
4625 if [info exists et_vect_extract_even_odd_saved] {
4626 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
4628 set et_vect_extract_even_odd_saved 0
4629 if { [istarget aarch64*-*-*]
4630 || [istarget powerpc*-*-*]
4631 || [is-effective-target arm_neon_ok]
4632 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4633 || [istarget ia64-*-*]
4634 || [istarget spu-*-*]
4635 || ([istarget mips*-*-*]
4636 && [check_effective_target_mpaired_single]) } {
4637 set et_vect_extract_even_odd_saved 1
4641 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4642 return $et_vect_extract_even_odd_saved
4645 # Return 1 if the target supports vector interleaving, 0 otherwise.
4647 proc check_effective_target_vect_interleave { } {
4648 global et_vect_interleave_saved
4650 if [info exists et_vect_interleave_saved] {
4651 verbose "check_effective_target_vect_interleave: using cached result" 2
4653 set et_vect_interleave_saved 0
4654 if { [istarget aarch64*-*-*]
4655 || [istarget powerpc*-*-*]
4656 || [is-effective-target arm_neon_ok]
4657 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4658 || [istarget ia64-*-*]
4659 || [istarget spu-*-*]
4660 || ([istarget mips*-*-*]
4661 && [check_effective_target_mpaired_single]) } {
4662 set et_vect_interleave_saved 1
4666 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4667 return $et_vect_interleave_saved
4670 foreach N {2 3 4 8} {
4671 eval [string map [list N $N] {
4672 # Return 1 if the target supports 2-vector interleaving
4673 proc check_effective_target_vect_stridedN { } {
4674 global et_vect_stridedN_saved
4676 if [info exists et_vect_stridedN_saved] {
4677 verbose "check_effective_target_vect_stridedN: using cached result" 2
4679 set et_vect_stridedN_saved 0
4681 && [check_effective_target_vect_interleave]
4682 && [check_effective_target_vect_extract_even_odd] } {
4683 set et_vect_stridedN_saved 1
4685 if { ([istarget arm*-*-*]
4686 || [istarget aarch64*-*-*]) && N >= 2 && N <= 4 } {
4687 set et_vect_stridedN_saved 1
4691 verbose "check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4692 return $et_vect_stridedN_saved
4697 # Return 1 if the target supports multiple vector sizes
4699 proc check_effective_target_vect_multiple_sizes { } {
4700 global et_vect_multiple_sizes_saved
4702 set et_vect_multiple_sizes_saved 0
4703 if { ([istarget aarch64*-*-*]
4704 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])) } {
4705 set et_vect_multiple_sizes_saved 1
4707 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4708 if { ([check_avx_available] && ![check_prefer_avx128]) } {
4709 set et_vect_multiple_sizes_saved 1
4713 verbose "check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4714 return $et_vect_multiple_sizes_saved
4717 # Return 1 if the target supports vectors of 64 bits.
4719 proc check_effective_target_vect64 { } {
4720 global et_vect64_saved
4722 if [info exists et_vect64_saved] {
4723 verbose "check_effective_target_vect64: using cached result" 2
4725 set et_vect64_saved 0
4726 if { ([istarget arm*-*-*]
4727 && [check_effective_target_arm_neon_ok]
4728 && [check_effective_target_arm_little_endian])
4729 || [istarget sparc*-*-*] } {
4730 set et_vect64_saved 1
4734 verbose "check_effective_target_vect64: returning $et_vect64_saved" 2
4735 return $et_vect64_saved
4738 # Return 1 if the target supports vector copysignf calls.
4740 proc check_effective_target_vect_call_copysignf { } {
4741 global et_vect_call_copysignf_saved
4743 if [info exists et_vect_call_copysignf_saved] {
4744 verbose "check_effective_target_vect_call_copysignf: using cached result" 2
4746 set et_vect_call_copysignf_saved 0
4747 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4748 || [istarget powerpc*-*-*] } {
4749 set et_vect_call_copysignf_saved 1
4753 verbose "check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4754 return $et_vect_call_copysignf_saved
4757 # Return 1 if the target supports hardware square root instructions.
4759 proc check_effective_target_sqrt_insn { } {
4760 global et_sqrt_insn_saved
4762 if [info exists et_sqrt_insn_saved] {
4763 verbose "check_effective_target_hw_sqrt: using cached result" 2
4765 set et_sqrt_insn_saved 0
4766 if { [istarget x86_64-*-*]
4767 || [istarget powerpc*-*-*]
4768 || [istarget aarch64*-*-*]
4769 || ([istarget arm*-*-*] && [check_effective_target_arm_vfp_ok]) } {
4770 set et_sqrt_insn_saved 1
4774 verbose "check_effective_target_hw_sqrt: returning et_sqrt_insn_saved" 2
4775 return $et_sqrt_insn_saved
4778 # Return 1 if the target supports vector sqrtf calls.
4780 proc check_effective_target_vect_call_sqrtf { } {
4781 global et_vect_call_sqrtf_saved
4783 if [info exists et_vect_call_sqrtf_saved] {
4784 verbose "check_effective_target_vect_call_sqrtf: using cached result" 2
4786 set et_vect_call_sqrtf_saved 0
4787 if { [istarget aarch64*-*-*]
4788 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4789 || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } {
4790 set et_vect_call_sqrtf_saved 1
4794 verbose "check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4795 return $et_vect_call_sqrtf_saved
4798 # Return 1 if the target supports vector lrint calls.
4800 proc check_effective_target_vect_call_lrint { } {
4801 set et_vect_call_lrint 0
4802 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
4803 && [check_effective_target_ilp32] } {
4804 set et_vect_call_lrint 1
4807 verbose "check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4808 return $et_vect_call_lrint
4811 # Return 1 if the target supports vector btrunc calls.
4813 proc check_effective_target_vect_call_btrunc { } {
4814 global et_vect_call_btrunc_saved
4816 if [info exists et_vect_call_btrunc_saved] {
4817 verbose "check_effective_target_vect_call_btrunc: using cached result" 2
4819 set et_vect_call_btrunc_saved 0
4820 if { [istarget aarch64*-*-*] } {
4821 set et_vect_call_btrunc_saved 1
4825 verbose "check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4826 return $et_vect_call_btrunc_saved
4829 # Return 1 if the target supports vector btruncf calls.
4831 proc check_effective_target_vect_call_btruncf { } {
4832 global et_vect_call_btruncf_saved
4834 if [info exists et_vect_call_btruncf_saved] {
4835 verbose "check_effective_target_vect_call_btruncf: using cached result" 2
4837 set et_vect_call_btruncf_saved 0
4838 if { [istarget aarch64*-*-*] } {
4839 set et_vect_call_btruncf_saved 1
4843 verbose "check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4844 return $et_vect_call_btruncf_saved
4847 # Return 1 if the target supports vector ceil calls.
4849 proc check_effective_target_vect_call_ceil { } {
4850 global et_vect_call_ceil_saved
4852 if [info exists et_vect_call_ceil_saved] {
4853 verbose "check_effective_target_vect_call_ceil: using cached result" 2
4855 set et_vect_call_ceil_saved 0
4856 if { [istarget aarch64*-*-*] } {
4857 set et_vect_call_ceil_saved 1
4861 verbose "check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4862 return $et_vect_call_ceil_saved
4865 # Return 1 if the target supports vector ceilf calls.
4867 proc check_effective_target_vect_call_ceilf { } {
4868 global et_vect_call_ceilf_saved
4870 if [info exists et_vect_call_ceilf_saved] {
4871 verbose "check_effective_target_vect_call_ceilf: using cached result" 2
4873 set et_vect_call_ceilf_saved 0
4874 if { [istarget aarch64*-*-*] } {
4875 set et_vect_call_ceilf_saved 1
4879 verbose "check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4880 return $et_vect_call_ceilf_saved
4883 # Return 1 if the target supports vector floor calls.
4885 proc check_effective_target_vect_call_floor { } {
4886 global et_vect_call_floor_saved
4888 if [info exists et_vect_call_floor_saved] {
4889 verbose "check_effective_target_vect_call_floor: using cached result" 2
4891 set et_vect_call_floor_saved 0
4892 if { [istarget aarch64*-*-*] } {
4893 set et_vect_call_floor_saved 1
4897 verbose "check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4898 return $et_vect_call_floor_saved
4901 # Return 1 if the target supports vector floorf calls.
4903 proc check_effective_target_vect_call_floorf { } {
4904 global et_vect_call_floorf_saved
4906 if [info exists et_vect_call_floorf_saved] {
4907 verbose "check_effective_target_vect_call_floorf: using cached result" 2
4909 set et_vect_call_floorf_saved 0
4910 if { [istarget aarch64*-*-*] } {
4911 set et_vect_call_floorf_saved 1
4915 verbose "check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4916 return $et_vect_call_floorf_saved
4919 # Return 1 if the target supports vector lceil calls.
4921 proc check_effective_target_vect_call_lceil { } {
4922 global et_vect_call_lceil_saved
4924 if [info exists et_vect_call_lceil_saved] {
4925 verbose "check_effective_target_vect_call_lceil: using cached result" 2
4927 set et_vect_call_lceil_saved 0
4928 if { [istarget aarch64*-*-*] } {
4929 set et_vect_call_lceil_saved 1
4933 verbose "check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4934 return $et_vect_call_lceil_saved
4937 # Return 1 if the target supports vector lfloor calls.
4939 proc check_effective_target_vect_call_lfloor { } {
4940 global et_vect_call_lfloor_saved
4942 if [info exists et_vect_call_lfloor_saved] {
4943 verbose "check_effective_target_vect_call_lfloor: using cached result" 2
4945 set et_vect_call_lfloor_saved 0
4946 if { [istarget aarch64*-*-*] } {
4947 set et_vect_call_lfloor_saved 1
4951 verbose "check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4952 return $et_vect_call_lfloor_saved
4955 # Return 1 if the target supports vector nearbyint calls.
4957 proc check_effective_target_vect_call_nearbyint { } {
4958 global et_vect_call_nearbyint_saved
4960 if [info exists et_vect_call_nearbyint_saved] {
4961 verbose "check_effective_target_vect_call_nearbyint: using cached result" 2
4963 set et_vect_call_nearbyint_saved 0
4964 if { [istarget aarch64*-*-*] } {
4965 set et_vect_call_nearbyint_saved 1
4969 verbose "check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4970 return $et_vect_call_nearbyint_saved
4973 # Return 1 if the target supports vector nearbyintf calls.
4975 proc check_effective_target_vect_call_nearbyintf { } {
4976 global et_vect_call_nearbyintf_saved
4978 if [info exists et_vect_call_nearbyintf_saved] {
4979 verbose "check_effective_target_vect_call_nearbyintf: using cached result" 2
4981 set et_vect_call_nearbyintf_saved 0
4982 if { [istarget aarch64*-*-*] } {
4983 set et_vect_call_nearbyintf_saved 1
4987 verbose "check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4988 return $et_vect_call_nearbyintf_saved
4991 # Return 1 if the target supports vector round calls.
4993 proc check_effective_target_vect_call_round { } {
4994 global et_vect_call_round_saved
4996 if [info exists et_vect_call_round_saved] {
4997 verbose "check_effective_target_vect_call_round: using cached result" 2
4999 set et_vect_call_round_saved 0
5000 if { [istarget aarch64*-*-*] } {
5001 set et_vect_call_round_saved 1
5005 verbose "check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
5006 return $et_vect_call_round_saved
5009 # Return 1 if the target supports vector roundf calls.
5011 proc check_effective_target_vect_call_roundf { } {
5012 global et_vect_call_roundf_saved
5014 if [info exists et_vect_call_roundf_saved] {
5015 verbose "check_effective_target_vect_call_roundf: using cached result" 2
5017 set et_vect_call_roundf_saved 0
5018 if { [istarget aarch64*-*-*] } {
5019 set et_vect_call_roundf_saved 1
5023 verbose "check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
5024 return $et_vect_call_roundf_saved
5027 # Return 1 if the target supports section-anchors
5029 proc check_effective_target_section_anchors { } {
5030 global et_section_anchors_saved
5032 if [info exists et_section_anchors_saved] {
5033 verbose "check_effective_target_section_anchors: using cached result" 2
5035 set et_section_anchors_saved 0
5036 if { [istarget powerpc*-*-*]
5037 || [istarget arm*-*-*] } {
5038 set et_section_anchors_saved 1
5042 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
5043 return $et_section_anchors_saved
5046 # Return 1 if the target supports atomic operations on "int_128" values.
5048 proc check_effective_target_sync_int_128 { } {
5049 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
5050 && ![is-effective-target ia32] } {
5057 # Return 1 if the target supports atomic operations on "int_128" values
5058 # and can execute them.
5060 proc check_effective_target_sync_int_128_runtime { } {
5061 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
5062 && ![is-effective-target ia32] } {
5063 return [check_cached_effective_target sync_int_128_available {
5064 check_runtime_nocache sync_int_128_available {
5068 unsigned int eax, ebx, ecx, edx;
5069 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
5070 return !(ecx & bit_CMPXCHG16B);
5080 # Return 1 if the target supports atomic operations on "long long".
5082 # Note: 32bit x86 targets require -march=pentium in dg-options.
5084 proc check_effective_target_sync_long_long { } {
5085 if { [istarget x86_64-*-*] || [istarget i?86-*-*])
5086 || [istarget aarch64*-*-*]
5087 || [istarget arm*-*-*]
5088 || [istarget alpha*-*-*]
5089 || ([istarget sparc*-*-*] && [check_effective_target_lp64]) } {
5096 # Return 1 if the target supports atomic operations on "long long"
5097 # and can execute them.
5099 # Note: 32bit x86 targets require -march=pentium in dg-options.
5101 proc check_effective_target_sync_long_long_runtime { } {
5102 if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
5103 return [check_cached_effective_target sync_long_long_available {
5104 check_runtime_nocache sync_long_long_available {
5108 unsigned int eax, ebx, ecx, edx;
5109 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
5110 return !(edx & bit_CMPXCHG8B);
5115 } elseif { [istarget aarch64*-*-*] } {
5117 } elseif { [istarget arm*-*-linux-*] } {
5118 return [check_runtime sync_longlong_runtime {
5124 if (sizeof (long long) != 8)
5127 /* Just check for native; checking for kernel fallback is tricky. */
5128 asm volatile ("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
5133 } elseif { [istarget alpha*-*-*] } {
5135 } elseif { ([istarget sparc*-*-*]
5136 && [check_effective_target_lp64]
5137 && [check_effective_target_ultrasparc_hw]) } {
5139 } elseif { [istarget powerpc*-*-*] && [check_effective_target_lp64] } {
5146 # Return 1 if the target supports byte swap instructions.
5148 proc check_effective_target_bswap { } {
5149 global et_bswap_saved
5151 if [info exists et_bswap_saved] {
5152 verbose "check_effective_target_bswap: using cached result" 2
5154 set et_bswap_saved 0
5155 if { [istarget aarch64*-*-*]
5156 || [istarget alpha*-*-*]
5157 || [istarget i?86-*-*] || [istarget x86_64-*-*]
5158 || [istarget m68k-*-*]
5159 || [istarget powerpc*-*-*]
5160 || [istarget rs6000-*-*]
5161 || [istarget s390*-*-*] } {
5162 set et_bswap_saved 1
5164 if { [istarget arm*-*-*]
5165 && [check_no_compiler_messages_nocache arm_v6_or_later object {
5167 #error not armv6 or later
5171 set et_bswap_saved 1
5176 verbose "check_effective_target_bswap: returning $et_bswap_saved" 2
5177 return $et_bswap_saved
5180 # Return 1 if the target supports 16-bit byte swap instructions.
5182 proc check_effective_target_bswap16 { } {
5183 global et_bswap16_saved
5185 if [info exists et_bswap16_saved] {
5186 verbose "check_effective_target_bswap16: using cached result" 2
5188 set et_bswap16_saved 0
5189 if { [is-effective-target bswap]
5190 && ![istarget alpha*-*-*]
5191 && !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
5192 set et_bswap16_saved 1
5196 verbose "check_effective_target_bswap16: returning $et_bswap16_saved" 2
5197 return $et_bswap16_saved
5200 # Return 1 if the target supports 32-bit byte swap instructions.
5202 proc check_effective_target_bswap32 { } {
5203 global et_bswap32_saved
5205 if [info exists et_bswap32_saved] {
5206 verbose "check_effective_target_bswap32: using cached result" 2
5208 set et_bswap32_saved 0
5209 if { [is-effective-target bswap] } {
5210 set et_bswap32_saved 1
5214 verbose "check_effective_target_bswap32: returning $et_bswap32_saved" 2
5215 return $et_bswap32_saved
5218 # Return 1 if the target supports 64-bit byte swap instructions.
5220 proc check_effective_target_bswap64 { } {
5221 global et_bswap64_saved
5223 # expand_unop can expand 64-bit byte swap on 32-bit targets
5224 if { [is-effective-target bswap] && [is-effective-target int32plus] } {
5230 # Return 1 if the target supports atomic operations on "int" and "long".
5232 proc check_effective_target_sync_int_long { } {
5233 global et_sync_int_long_saved
5235 if [info exists et_sync_int_long_saved] {
5236 verbose "check_effective_target_sync_int_long: using cached result" 2
5238 set et_sync_int_long_saved 0
5239 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
5240 #
load-reserved/store
-conditional instructions.
5241 if { [istarget ia64
-*-*]
5242 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
5243 ||
[istarget aarch64
*-*-*]
5244 ||
[istarget alpha
*-*-*]
5245 ||
[istarget arm
*-*-linux
-*]
5246 ||
[istarget bfin
*-*linux
*]
5247 ||
[istarget hppa
*-*linux
*]
5248 ||
[istarget s390
*-*-*]
5249 ||
[istarget powerpc
*-*-*]
5250 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
5251 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
5252 ||
[check_effective_target_mips_llsc
] } {
5253 set et_sync_int_long_saved
1
5257 verbose
"check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
5258 return $et_sync_int_long_saved
5261 #
Return 1 if the target supports atomic operations
on "char" and "short".
5263 proc check_effective_target_sync_char_short
{ } {
5264 global et_sync_char_short_saved
5266 if [info exists et_sync_char_short_saved
] {
5267 verbose
"check_effective_target_sync_char_short: using cached result" 2
5269 set et_sync_char_short_saved
0
5270 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
5271 # load-reserved/store-conditional instructions.
5272 if { [istarget aarch64*-*-*]
5273 || [istarget ia64-*-*]
5274 || [istarget i?86-*-*] || [istarget x86_64-*-*]
5275 || [istarget alpha*-*-*]
5276 || [istarget arm*-*-linux-*]
5277 || [istarget hppa*-*linux*]
5278 || [istarget s390*-*-*]
5279 || [istarget powerpc*-*-*]
5280 || [istarget crisv32-*-*] || [istarget cris-*-*]
5281 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
5282 || [check_effective_target_mips_llsc] } {
5283 set et_sync_char_short_saved 1
5287 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
5288 return $et_sync_char_short_saved
5291 # Return 1 if the target uses a ColdFire FPU.
5293 proc check_effective_target_coldfire_fpu { } {
5294 return [check_no_compiler_messages coldfire_fpu assembly {
5301 # Return true if this is a uClibc target.
5303 proc check_effective_target_uclibc {} {
5304 return [check_no_compiler_messages uclibc object {
5305 #include <features.h>
5306 #if !defined (__UCLIBC__)
5312 # Return true if this is a uclibc target and if the uclibc feature
5313 # described by __$feature__ is not present.
5315 proc check_missing_uclibc_feature {feature} {
5316 return [check_no_compiler_messages $feature object "
5317 #include <features.h>
5318 #if !defined (__UCLIBC) || defined (__${feature}__)
5324 # Return true if this is a Newlib target.
5326 proc check_effective_target_newlib {} {
5327 return [check_no_compiler_messages newlib object {
5332 # Return true if this is NOT a Bionic target.
5334 proc check_effective_target_non_bionic {} {
5335 return [check_no_compiler_messages non_bionic object {
5337 #if defined (__BIONIC__)
5343 # Return true if this target has error.h header.
5345 proc check_effective_target_error_h {} {
5346 return [check_no_compiler_messages error_h object {
5351 # Return true if this target has tgmath.h header.
5353 proc check_effective_target_tgmath_h {} {
5354 return [check_no_compiler_messages tgmath_h object {
5359 # Return true if target's libc supports complex functions.
5361 proc check_effective_target_libc_has_complex_functions
{} {
5362 return [check_no_compiler_messages libc_has_complex_functions object
{
5363 #
include <complex.h
>
5368 #
(a
) an error of a few ULP is expected in string to floating
-point
5369 # conversion functions
; and
5370 #
(b
) overflow is not always detected correctly by those functions.
5372 proc check_effective_target_lax_strtofp
{} {
5373 # By default
, assume that all uClibc targets suffer from this.
5374 return [check_effective_target_uclibc
]
5377 #
Return 1 if this is a target
for which wcsftime is a dummy
5378 # function that always returns
0.
5380 proc check_effective_target_dummy_wcsftime
{} {
5381 # By default
, assume that all uClibc targets suffer from this.
5382 return [check_effective_target_uclibc
]
5385 #
Return 1 if constructors with initialization priority arguments are
5386 # supposed
on this target.
5388 proc check_effective_target_init_priority
{} {
5389 return [check_no_compiler_messages init_priority assembly
"
5390 void f
() __attribute__
((constructor
(1000)));
5395 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
5396 # This can be used with
any check_
* proc that takes no
argument and
5397 # returns only
1 or
0. It could be used with check_
* procs that take
5398 # arguments with keywords that pass particular arguments.
5400 proc is
-effective
-target
{ arg } {
5402 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5403 set selected
[check_effective_target_$
{arg}]
5406 "vmx_hw" { set selected [check_vmx_hw_available] }
5407 "vsx_hw" { set selected [check_vsx_hw_available] }
5408 "p8vector_hw" { set selected [check_p8vector_hw_available] }
5409 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
5410 "dfp_hw" { set selected [check_dfp_hw_available] }
5411 "htm_hw" { set selected [check_htm_hw_available] }
5412 "named_sections" { set selected [check_named_sections_available] }
5413 "gc_sections" { set selected [check_gc_sections_available] }
5414 "cxa_atexit" { set selected [check_cxa_atexit_available] }
5415 default
{ error
"unknown effective target keyword `$arg'" }
5418 verbose
"is-effective-target: $arg $selected" 2
5422 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
5424 proc is
-effective
-target
-keyword
{ arg } {
5425 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5428 # These have different names
for their check_
* procs.
5430 "vmx_hw" { return 1 }
5431 "vsx_hw" { return 1 }
5432 "p8vector_hw" { return 1 }
5433 "ppc_recip_hw" { return 1 }
5434 "dfp_hw" { return 1 }
5435 "htm_hw" { return 1 }
5436 "named_sections" { return 1 }
5437 "gc_sections" { return 1 }
5438 "cxa_atexit" { return 1 }
5439 default
{ return 0 }
5444 #
Return 1 if target default to short enums
5446 proc check_effective_target_short_enums
{ } {
5447 return [check_no_compiler_messages short_enums assembly
{
5449 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
5453 #
Return 1 if target supports merging string constants at link time.
5455 proc check_effective_target_string_merging
{ } {
5456 return [check_no_messages_and_pattern string_merging \
5457 "rodata\\.str" assembly {
5458 const char
*var
= "String";
5462 #
Return 1 if target has the basic signed and unsigned types in
5463 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
5464 # working
<stdint.h
> for all targets.
5466 proc check_effective_target_stdint_types
{ } {
5467 return [check_no_compiler_messages stdint_types assembly
{
5469 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
5470 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
5474 #
Return 1 if target has the basic signed and unsigned types in
5475 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
5476 # these types agree with those in the header, as some systems have
5477 # only <inttypes.h>.
5479 proc check_effective_target_inttypes_types { } {
5480 return [check_no_compiler_messages inttypes_types assembly {
5481 #include <inttypes.h>
5482 int8_t a; int16_t b; int32_t c; int64_t d;
5483 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
5487 # Return 1 if programs are intended to be run on a simulator
5488 # (i.e. slowly) rather than hardware (i.e. fast).
5490 proc check_effective_target_simulator { } {
5492 # All "src/sim" simulators set this one.
5493 if [board_info target exists is_simulator] {
5494 return [board_info target is_simulator]
5497 # The "sid" simulators don't
set that one
, but at least they
set
5499 if [board_info target
exists slow_simulator
] {
5500 return [board_info target slow_simulator
]
5506 #
Return 1 if programs are intended to be run
on hardware rather than
5509 proc check_effective_target_hw
{ } {
5511 # All
"src/sim" simulators set this one.
5512 if [board_info target
exists is_simulator
] {
5513 if [board_info target is_simulator
] {
5520 # The
"sid" simulators don't set that one, but at least they set
5522 if [board_info target
exists slow_simulator
] {
5523 if [board_info target slow_simulator
] {
5533 #
Return 1 if the target is a VxWorks kernel.
5535 proc check_effective_target_vxworks_kernel
{ } {
5536 return [check_no_compiler_messages vxworks_kernel assembly
{
5537 #
if !defined __vxworks || defined __RTP__
5543 #
Return 1 if the target is a VxWorks RTP.
5545 proc check_effective_target_vxworks_rtp
{ } {
5546 return [check_no_compiler_messages vxworks_rtp assembly
{
5547 #
if !defined __vxworks ||
!defined __RTP__
5553 #
Return 1 if the target is expected to provide wide character support.
5555 proc check_effective_target_wchar
{ } {
5556 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5559 return [check_no_compiler_messages wchar assembly
{
5564 #
Return 1 if the target has
<pthread.h
>.
5566 proc check_effective_target_pthread_h
{ } {
5567 return [check_no_compiler_messages pthread_h assembly
{
5568 #
include <pthread.h
>
5572 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5573 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5574 # chsize. We test
for a trivially functional truncation
; no stubs.
5575 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5576 # different function to be used.
5578 proc check_effective_target_fd_truncate { } {
5580 #define _FILE_OFFSET_BITS 64
5587 FILE *f = fopen ("tst.tmp", "wb");
5589 const char t[] = "test writing more than ten characters";
5593 write (fd, t, sizeof (t) - 1);
5595 if (ftruncate (fd, 10) != 0)
5604 f = fopen ("tst.tmp", "rb");
5605 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5613 if { [check_runtime ftruncate $prog] } {
5617 regsub "ftruncate" $prog "chsize" prog
5618 return [check_runtime chsize $prog]
5621 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5623 proc add_options_for_c99_runtime { flags } {
5624 if { [istarget *-*-solaris2*] } {
5625 return "$flags -std=c99"
5627 if { [istarget powerpc-*-darwin*] } {
5628 return "$flags -mmacosx-version-min=10.3"
5633 # Add to FLAGS all the target-specific flags needed to enable
5634 # full IEEE compliance mode.
5636 proc add_options_for_ieee { flags } {
5637 if { [istarget alpha*-*-*]
5638 || [istarget sh*-*-*] } {
5639 return "$flags -mieee"
5641 if { [istarget rx-*-*] } {
5642 return "$flags -mnofpu"
5647 if {![info exists flags_to_postpone]} {
5648 set flags_to_postpone ""
5651 # Add to FLAGS the flags needed to enable functions to bind locally
5652 # when using pic/PIC passes in the testsuite.
5653 proc add_options_for_bind_pic_locally { flags } {
5654 global flags_to_postpone
5656 # Instead of returning 'flags
' with the -fPIE or -fpie appended, we save it
5657 # in 'flags_to_postpone
' and append it later in gcc_target_compile procedure in
5658 # order to make sure that the multilib_flags doesn't override this.
5660 if {[check_no_compiler_messages using_pic2 assembly
{
5665 set flags_to_postpone
"-fPIE"
5668 if {[check_no_compiler_messages using_pic1 assembly
{
5673 set flags_to_postpone
"-fpie"
5679 # Add to FLAGS the flags needed to enable
64-bit vectors.
5681 proc add_options_for_double_vectors
{ flags
} {
5682 if [is
-effective
-target arm_neon_ok
] {
5683 return "$flags -mvectorize-with-neon-double"
5689 # Add to FLAGS the flags needed to disable inlining of
5690 # UPC run
-time access routines.
5692 proc add_options_for_upc_library_calls
{ flags
} {
5693 return "$flags -fno-upc-inline-lib"
5696 # Check
if UPC struct pts build
5698 proc check_effective_target_upc_struct_pts
{ } {
5699 return [check_no_compiler_messages upc_struct_pts object
{
5700 #ifndef __UPC_PTS_STRUCT_REP__
5701 # error struct PTS is not supported
5703 } "-fupc -fno-upc-pre-include" ]
5706 # Check
if UPC packed pts build
5708 proc check_effective_target_upc_packed_pts
{ } {
5709 return [check_no_compiler_messages upc_packed_pts object
{
5710 #ifndef __UPC_PTS_PACKED_REP__
5711 # error packed PTS is not supported
5713 } "-fupc -fno-upc-pre-include" ]
5716 #
Return 1 if the target provides a full C99 runtime.
5718 proc check_effective_target_c99_runtime
{ } {
5719 return [check_cached_effective_target c99_runtime
{
5722 set file
[open
"$srcdir/gcc.dg/builtins-config.h"]
5723 set contents
[read $file
]
5726 #ifndef HAVE_C99_RUNTIME
5727 #error
!HAVE_C99_RUNTIME
5730 check_no_compiler_messages_nocache c99_runtime assembly \
5731 $contents
[add_options_for_c99_runtime
""]
5735 #
Return 1 if target wchar_t is at least
4 bytes.
5737 proc check_effective_target_4byte_wchar_t
{ } {
5738 return [check_no_compiler_messages
4byte_wchar_t object
{
5739 int dummy
[sizeof
(__WCHAR_TYPE__
) >= 4 ?
1 : -1];
5743 #
Return 1 if the target supports automatic stack alignment.
5745 proc check_effective_target_automatic_stack_alignment
{ } {
5746 # Ordinarily x86 supports automatic stack alignment ...
5747 if { [istarget i?
86*-*-*] ||
[istarget x86_64
-*-*] } then {
5748 if { [istarget
*-*-mingw
*] ||
[istarget
*-*-cygwin
*] } {
5749 # ... except Win64 SEH doesn
't. Succeed for Win32 though.
5750 return [check_effective_target_ilp32];
5757 # Return true if we are compiling for AVX target.
5759 proc check_avx_available { } {
5760 if { [check_no_compiler_messages avx_available assembly {
5770 # Return true if 32- and 16-bytes vectors are available.
5772 proc check_effective_target_vect_sizes_32B_16B { } {
5773 if { [check_avx_available] && ![check_prefer_avx128] } {
5780 # Return true if 128-bits vectors are preferred even if 256-bits vectors
5783 proc check_prefer_avx128 { } {
5784 if ![check_avx_available] {
5787 return [check_no_messages_and_pattern avx_explicit "xmm" assembly {
5788 float a[1024],b[1024],c[1024];
5789 void foo (void) { int i; for (i = 0; i < 1024; i++) a[i]=b[i]+c[i];}
5790 } "-O2 -ftree-vectorize"]
5794 # Return 1 if avx512f instructions can be compiled.
5796 proc check_effective_target_avx512f { } {
5797 return [check_no_compiler_messages avx512f object {
5798 typedef double __m512d __attribute__ ((__vector_size__ (64)));
5800 __m512d _mm512_add (__m512d a)
5802 return __builtin_ia32_addpd512_mask (a, a, a, 1, 4);
5807 # Return 1 if avx instructions can be compiled.
5809 proc check_effective_target_avx { } {
5810 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
5813 return [check_no_compiler_messages avx object {
5814 void _mm256_zeroall (void)
5816 __builtin_ia32_vzeroall ();
5821 # Return 1 if avx2 instructions can be compiled.
5822 proc check_effective_target_avx2 { } {
5823 return [check_no_compiler_messages avx2 object {
5824 typedef long long __v4di __attribute__ ((__vector_size__ (32)));
5826 mm256_is32_andnotsi256 (__v4di __X, __v4di __Y)
5828 return __builtin_ia32_andnotsi256 (__X, __Y);
5833 # Return 1 if sse instructions can be compiled.
5834 proc check_effective_target_sse { } {
5835 return [check_no_compiler_messages sse object {
5838 __builtin_ia32_stmxcsr ();
5844 # Return 1 if sse2 instructions can be compiled.
5845 proc check_effective_target_sse2 { } {
5846 return [check_no_compiler_messages sse2 object {
5847 typedef long long __m128i __attribute__ ((__vector_size__ (16)));
5849 __m128i _mm_srli_si128 (__m128i __A, int __N)
5851 return (__m128i)__builtin_ia32_psrldqi128 (__A, 8);
5856 # Return 1 if F16C instructions can be compiled.
5858 proc check_effective_target_f16c { } {
5859 return [check_no_compiler_messages f16c object {
5860 #include "immintrin.h"
5862 foo (unsigned short val)
5864 return _cvtsh_ss (val);
5869 # Return 1 if C wchar_t type is compatible with char16_t.
5871 proc check_effective_target_wchar_t_char16_t_compatible { } {
5872 return [check_no_compiler_messages wchar_t_char16_t object {
5874 __CHAR16_TYPE__ *p16 = &wc;
5875 char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5879 # Return 1 if C wchar_t type is compatible with char32_t.
5881 proc check_effective_target_wchar_t_char32_t_compatible { } {
5882 return [check_no_compiler_messages wchar_t_char32_t object {
5884 __CHAR32_TYPE__ *p32 = &wc;
5885 char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5889 # Return 1 if pow10 function exists.
5891 proc check_effective_target_pow10 { } {
5892 return [check_runtime pow10 {
5902 # Return 1 if current options generate DFP instructions, 0 otherwise.
5904 proc check_effective_target_hard_dfp {} {
5905 return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
5906 typedef float d64 __attribute__((mode(DD)));
5908 void foo (void) { z = x + y; }
5912 # Return 1 if string.h and wchar.h headers provide C++ requires overloads
5913 # for strchr etc. functions.
5915 proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
5916 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
5919 #if !defined(__cplusplus) \
5920 || !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) \
5921 || !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
5922 ISO C++ correct string.h and wchar.h protos not supported.
5929 # Return 1 if GNU as is used.
5931 proc check_effective_target_gas { } {
5932 global use_gas_saved
5935 if {![info exists use_gas_saved]} {
5936 # Check if the as used by gcc is GNU as.
5937 set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
5938 # Provide /dev/null as input, otherwise gas times out reading from
5940 set status [remote_exec host "$gcc_as" "-v /dev/null"]
5941 set as_output [lindex $status 1]
5942 if { [ string first "GNU" $as_output ] >= 0 } {
5948 return $use_gas_saved
5951 # Return 1 if GNU ld is used.
5953 proc check_effective_target_gld { } {
5954 global use_gld_saved
5957 if {![info exists use_gld_saved]} {
5958 # Check if the ld used by gcc is GNU ld.
5959 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0]
5960 set status [remote_exec host "$gcc_ld" "--version"]
5961 set ld_output [lindex $status 1]
5962 if { [ string first "GNU" $ld_output ] >= 0 } {
5968 return $use_gld_saved
5971 # Return 1 if the compiler has been configure with link-time optimization
5974 proc check_effective_target_lto { } {
5975 if { [istarget nvptx-*-*] } {
5978 return [check_no_compiler_messages lto object {
5983 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
5985 proc check_effective_target_maybe_x32 { } {
5986 return [check_no_compiler_messages maybe_x32 object {
5988 } "-mx32 -maddress-mode=short"]
5991 # Return 1 if this target supports the -fsplit-stack option, 0
5994 proc check_effective_target_split_stack {} {
5995 return [check_no_compiler_messages split_stack object {
6000 # Return 1 if this target supports the -masm=intel option, 0
6003 proc check_effective_target_masm_intel {} {
6004 return [check_no_compiler_messages masm_intel object {
6005 extern void abort (void);
6009 # Return 1 if the language for the compiler under test is C.
6011 proc check_effective_target_c { } {
6013 if [string match $tool "gcc"] {
6019 # Return 1 if the language for the compiler under test is C++.
6021 proc check_effective_target_c++ { } {
6023 if [string match $tool "g++"] {
6029 set cxx_default "c++14"
6030 # Check whether the current active language standard supports the features
6031 # of C++11/C++14 by checking for the presence of one of the -std flags.
6032 # This assumes that the default for the compiler is $cxx_default, and that
6033 # there will never be multiple -std= arguments on the command line.
6034 proc check_effective_target_c++11_only { } {
6036 if ![check_effective_target_c++] {
6039 if [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }] {
6042 if { $cxx_default == "c++11" && [check-flags { { } { } { } { -std=* } }] } {
6047 proc check_effective_target_c++11 { } {
6048 if [check_effective_target_c++11_only] {
6051 return [check_effective_target_c++14]
6053 proc check_effective_target_c++11_down { } {
6054 if ![check_effective_target_c++] {
6057 return [expr ![check_effective_target_c++14] ]
6060 proc check_effective_target_c++14_only { } {
6062 if ![check_effective_target_c++] {
6065 if [check-flags { { } { } { -std=c++14 -std=gnu++14 -std=c++14 -std=gnu++14 } }] {
6068 if { $cxx_default == "c++14" && [check-flags { { } { } { } { -std=* } }] } {
6074 proc check_effective_target_c++14 { } {
6075 if [check_effective_target_c++14_only] {
6078 return [check_effective_target_c++1z]
6080 proc check_effective_target_c++14_down { } {
6081 if ![check_effective_target_c++] {
6084 return [expr ![check_effective_target_c++1z] ]
6087 proc check_effective_target_c++98_only { } {
6089 if ![check_effective_target_c++] {
6092 if [check-flags { { } { } { -std=c++98 -std=gnu++98 -std=c++03 -std=gnu++03 } }] {
6095 if { $cxx_default == "c++98" && [check-flags { { } { } { } { -std=* } }] } {
6101 proc check_effective_target_c++1z_only { } {
6103 if ![check_effective_target_c++] {
6106 if [check-flags { { } { } { -std=c++17 -std=gnu++17 -std=c++1z -std=gnu++1z } }] {
6109 if { $cxx_default == "c++17" && [check-flags { { } { } { } { -std=* } }] } {
6114 proc check_effective_target_c++1z { } {
6115 return [check_effective_target_c++1z_only]
6118 # Return 1 if expensive testcases should be run.
6120 proc check_effective_target_run_expensive_tests { } {
6121 if { [getenv GCC_TEST_RUN_EXPENSIVE] != "" } {
6127 # Returns 1 if "mempcpy" is available on the target system.
6129 proc check_effective_target_mempcpy {} {
6130 return [check_function_available "mempcpy"]
6133 # Returns 1 if "stpcpy" is available on the target system.
6135 proc check_effective_target_stpcpy {} {
6136 return [check_function_available "stpcpy"]
6139 # Check whether the vectorizer tests are supported by the target and
6140 # append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
6141 # Set dg-do-what-default to either compile or run, depending on target
6142 # capabilities. Return 1 if vectorizer tests are supported by
6143 # target, 0 otherwise.
6145 proc check_vect_support_and_set_flags { } {
6146 global DEFAULT_VECTCFLAGS
6147 global dg-do-what-default
6149 if [istarget powerpc-*paired*] {
6150 lappend DEFAULT_VECTCFLAGS "-mpaired"
6151 if [check_750cl_hw_available] {
6152 set dg-do-what-default run
6154 set dg-do-what-default compile
6156 } elseif [istarget powerpc*-*-*] {
6157 # Skip targets not supporting -maltivec.
6158 if ![is-effective-target powerpc_altivec_ok] {
6162 lappend DEFAULT_VECTCFLAGS "-maltivec"
6163 if [check_p8vector_hw_available] {
6164 lappend DEFAULT_VECTCFLAGS "-mpower8-vector"
6165 } elseif [check_vsx_hw_available] {
6166 lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
6169 if [check_vmx_hw_available] {
6170 set dg-do-what-default run
6172 if [is-effective-target ilp32] {
6173 # Specify a cpu that supports VMX for compile-only tests.
6174 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
6176 set dg-do-what-default compile
6178 } elseif { [istarget spu-*-*] } {
6179 set dg-do-what-default run
6180 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
6181 lappend DEFAULT_VECTCFLAGS "-msse2"
6182 if { [check_effective_target_sse2_runtime] } {
6183 set dg-do-what-default run
6185 set dg-do-what-default compile
6187 } elseif { [istarget mips*-*-*]
6188 && ([check_effective_target_mpaired_single]
6189 || [check_effective_target_mips_loongson])
6190 && [check_effective_target_nomips16] } {
6191 if { [check_effective_target_mpaired_single] } {
6192 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
6194 set dg-do-what-default run
6195 } elseif [istarget sparc*-*-*] {
6196 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
6197 if [check_effective_target_ultrasparc_hw] {
6198 set dg-do-what-default run
6200 set dg-do-what-default compile
6202 } elseif [istarget alpha*-*-*] {
6203 # Alpha's vectorization capabilities are extremely limited.
6204 # It
's more effort than its worth disabling all of the tests
6205 # that it cannot pass. But if you actually want to see what
6206 # does work, command out the return.
6209 lappend DEFAULT_VECTCFLAGS "-mmax"
6210 if [check_alpha_max_hw_available] {
6211 set dg-do-what-default run
6213 set dg-do-what-default compile
6215 } elseif [istarget ia64-*-*] {
6216 set dg-do-what-default run
6217 } elseif [is-effective-target arm_neon_ok] {
6218 eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
6219 # NEON does not support denormals, so is not used for vectorization by
6220 # default to avoid loss of precision. We must pass -ffast-math to test
6221 # vectorization of float operations.
6222 lappend DEFAULT_VECTCFLAGS "-ffast-math"
6223 if [is-effective-target arm_neon_hw] {
6224 set dg-do-what-default run
6226 set dg-do-what-default compile
6228 } elseif [istarget "aarch64*-*-*"] {
6229 set dg-do-what-default run
6237 # Return 1 if the target does *not* require strict alignment.
6239 proc check_effective_target_non_strict_align {} {
6240 return [check_no_compiler_messages non_strict_align assembly {
6242 typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
6244 void foo(void) { z = (c *) y; }
6248 # Return 1 if the target has <ucontext.h>.
6250 proc check_effective_target_ucontext_h { } {
6251 return [check_no_compiler_messages ucontext_h assembly {
6252 #include <ucontext.h>
6256 proc check_effective_target_aarch64_tiny { } {
6257 if { [istarget aarch64*-*-*] } {
6258 return [check_no_compiler_messages aarch64_tiny object {
6259 #ifdef __AARCH64_CMODEL_TINY__
6262 #error target not AArch64 tiny code model
6270 proc check_effective_target_aarch64_small { } {
6271 if { [istarget aarch64*-*-*] } {
6272 return [check_no_compiler_messages aarch64_small object {
6273 #ifdef __AARCH64_CMODEL_SMALL__
6276 #error target not AArch64 small code model
6284 proc check_effective_target_aarch64_large { } {
6285 if { [istarget aarch64*-*-*] } {
6286 return [check_no_compiler_messages aarch64_large object {
6287 #ifdef __AARCH64_CMODEL_LARGE__
6290 #error target not AArch64 large code model
6298 # Return 1 if <fenv.h> is available with all the standard IEEE
6299 # exceptions and floating-point exceptions are raised by arithmetic
6300 # operations. (If the target requires special options for "inexact"
6301 # exceptions, those need to be specified in the testcases.)
6303 proc check_effective_target_fenv_exceptions {} {
6304 return [check_runtime fenv_exceptions {
6307 #ifndef FE_DIVBYZERO
6308 # error Missing FE_DIVBYZERO
6311 # error Missing FE_INEXACT
6314 # error Missing FE_INVALID
6317 # error Missing FE_OVERFLOW
6319 #ifndef FE_UNDERFLOW
6320 # error Missing FE_UNDERFLOW
6322 volatile float a = 0.0f, r;
6327 if (fetestexcept (FE_INVALID))
6332 } [add_options_for_ieee "-std=gnu99"]]
6335 proc check_effective_target_tiny {} {
6336 global et_target_tiny_saved
6338 if [info exists et_target_tine_saved] {
6339 verbose "check_effective_target_tiny: using cached result" 2
6341 set et_target_tiny_saved 0
6342 if { [istarget aarch64*-*-*]
6343 && [check_effective_target_aarch64_tiny] } {
6344 set et_target_tiny_saved 1
6348 return $et_target_tiny_saved
6351 # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
6353 proc check_effective_target_logical_op_short_circuit {} {
6354 if { [istarget mips*-*-*]
6355 || [istarget arc*-*-*]
6356 || [istarget avr*-*-*]
6357 || [istarget crisv32-*-*] || [istarget cris-*-*]
6358 || [istarget mmix-*-*]
6359 || [istarget s390*-*-*]
6360 || [istarget powerpc*-*-*]
6361 || [istarget nios2*-*-*]
6362 || [istarget visium-*-*]
6363 || [check_effective_target_arm_cortex_m] } {
6369 # Record that dg-final test TEST requires convential compilation.
6371 proc force_conventional_output_for { test } {
6372 if { [info proc $test] == "" } {
6373 perror "$test does not exist"
6376 proc ${test}_required_options {} {
6377 global gcc_force_conventional_output
6378 return $gcc_force_conventional_output
6382 # Return 1 if the x86-64 target supports PIE with copy reloc, 0
6383 # otherwise. Cache the result.
6385 proc check_effective_target_pie_copyreloc { } {
6386 global pie_copyreloc_available_saved
6388 global GCC_UNDER_TEST
6390 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
6394 # Need auto-host.h to check linker support.
6395 if { ![file exists ../../auto-host.h ] } {
6399 if [info exists pie_copyreloc_available_saved] {
6400 verbose "check_effective_target_pie_copyreloc returning saved $pie_copyreloc_available_saved" 2
6402 # Set up and compile to see if linker supports PIE with copy
6403 # reloc. Include the current process ID in the file names to
6404 # prevent conflicts with invocations for multiple testsuites.
6409 set f [open $src "w"]
6410 puts $f "#include \"../../auto-host.h\""
6411 puts $f "#if HAVE_LD_PIE_COPYRELOC == 0"
6412 puts $f "# error Linker does not support PIE with copy reloc."
6416 verbose "check_effective_target_pie_copyreloc compiling testfile $src" 2
6417 set lines [${tool}_target_compile $src $obj object ""]
6422 if [string match "" $lines] then {
6423 verbose "check_effective_target_pie_copyreloc testfile compilation passed" 2
6424 set pie_copyreloc_available_saved 1
6426 verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2
6427 set pie_copyreloc_available_saved 0
6431 return $pie_copyreloc_available_saved
6434 # Return 1 if the target uses comdat groups.
6436 proc check_effective_target_comdat_group {} {
6437 return [check_no_messages_and_pattern comdat_group "\.section\[^\n\r]*,comdat" assembly {
6439 inline int foo () { return 1; }