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
{ } {
586 #
Return 1 if target has packed layout of structure members by
587 # default
, 0 otherwise. Note that this is slightly different than
588 # whether the target has
"natural alignment": both attributes may be
591 proc check_effective_target_default_packed
{ } {
592 return [check_no_compiler_messages default_packed assembly
{
593 struct x
{ char a
; long b
; } c
;
594 int s
[sizeof
(c
) == sizeof
(char
) + sizeof
(long
) ?
1 : -1];
598 #
Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
599 # documentation
, where the test also comes from.
601 proc check_effective_target_pcc_bitfield_type_matters
{ } {
602 # PCC_BITFIELD_TYPE_MATTERS isn
't just about unnamed or empty
603 # bitfields, but let's stick to the example code from the docs.
604 return [check_no_compiler_messages pcc_bitfield_type_matters assembly
{
605 struct foo1
{ char x
; char
:0; char y
; };
606 struct foo2
{ char x
; int :0; char y
; };
607 int s
[sizeof
(struct foo1
) != sizeof
(struct foo2
) ?
1 : -1];
611 # Add to FLAGS all the target
-specific flags needed to use thread
-local storage.
613 proc add_options_for_tls
{ flags
} {
614 #
On Solaris
9, __tls_get_addr
/___tls_get_addr only lives in
615 # libthread
, so always pass
-pthread
for native TLS. Same
for AIX.
616 # Need to duplicate native TLS check from
617 # check_effective_target_tls_native to avoid recursion.
618 if { ([istarget powerpc
-ibm
-aix
*]) &&
619 [check_no_messages_and_pattern tls_native
"!emutls" assembly {
621 int f
(void
) { return i
; }
622 void g
(int j
) { i
= j
; }
624 return "-pthread [g++_link_flags [get_multilibs "-pthread"] ] $flags "
629 #
Return 1 if indirect jumps are supported
, 0 otherwise.
631 proc check_effective_target_indirect_jumps
{} {
632 if { [istarget nvptx
-*-*] } {
638 #
Return 1 if nonlocal
goto is supported
, 0 otherwise.
640 proc check_effective_target_nonlocal_goto
{} {
641 if { [istarget nvptx
-*-*] } {
647 #
Return 1 if taking label
values is supported
, 0 otherwise.
649 proc check_effective_target_label_values
{} {
650 if { [istarget nvptx
-*-*] } {
653 return [check_no_compiler_messages label_values assembly
{
654 #ifdef NO_LABEL_VALUES
660 #
Return 1 if builtin_return_address and builtin_frame_address are
661 # supported
, 0 otherwise.
663 proc check_effective_target_return_address
{} {
664 if { [istarget nvptx
-*-*] } {
670 #
Return 1 if the assembler does not verify function types against
671 # calls
, 0 otherwise. Such verification will typically
show up problems
672 # with K
&R C function declarations.
674 proc check_effective_target_untyped_assembly
{} {
675 if { [istarget nvptx
-*-*] } {
681 #
Return 1 if alloca is supported
, 0 otherwise.
683 proc check_effective_target_alloca
{} {
684 if { [istarget nvptx
-*-*] } {
690 #
Return 1 if thread local storage
(TLS
) is supported
, 0 otherwise.
692 proc check_effective_target_tls
{} {
693 return [check_no_compiler_messages tls assembly
{
695 int f
(void
) { return i
; }
696 void g
(int j
) { i
= j
; }
700 #
Return 1 if *native
* thread local storage
(TLS
) is supported
, 0 otherwise.
702 proc check_effective_target_tls_native
{} {
703 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
704 # functions
, so we fail to automatically detect it.
705 if { [istarget
*-*-vxworks
*] } {
709 return [check_no_messages_and_pattern tls_native
"!emutls" assembly {
711 int f
(void
) { return i
; }
712 void g
(int j
) { i
= j
; }
716 #
Return 1 if *emulated
* thread local storage
(TLS
) is supported
, 0 otherwise.
718 proc check_effective_target_tls_emulated
{} {
719 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
720 # functions
, so we fail to automatically detect it.
721 if { [istarget
*-*-vxworks
*] } {
725 return [check_no_messages_and_pattern tls_emulated
"emutls" assembly {
727 int f
(void
) { return i
; }
728 void g
(int j
) { i
= j
; }
732 #
Return 1 if TLS executables can run correctly
, 0 otherwise.
734 proc check_effective_target_tls_runtime
{} {
735 # The runtime does not have TLS support
, but just
736 # running the test below is insufficient to
show this.
737 if { [istarget msp430
-*-*] ||
[istarget visium
-*-*] } {
740 return [check_runtime tls_runtime
{
741 __thread
int thr
= 0;
742 int main
(void
) { return thr
; }
743 } [add_options_for_tls
""]]
746 #
Return 1 if atomic compare
-and
-swap is supported
on 'int'
748 proc check_effective_target_cas_char
{} {
749 return [check_no_compiler_messages cas_char assembly
{
750 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
756 proc check_effective_target_cas_int
{} {
757 return [check_no_compiler_messages cas_int assembly
{
758 #
if __INT_MAX__
== 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
760 #elif __INT_MAX__
== 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
768 #
Return 1 if -ffunction
-sections is supported
, 0 otherwise.
770 proc check_effective_target_function_sections
{} {
771 # Darwin has its own scheme and silently accepts
-ffunction
-sections.
772 if { [istarget
*-*-darwin
*] } {
776 return [check_no_compiler_messages functionsections assembly
{
778 } "-ffunction-sections"]
781 #
Return 1 if instruction scheduling is available
, 0 otherwise.
783 proc check_effective_target_scheduling
{} {
784 return [check_no_compiler_messages scheduling object
{
786 } "-fschedule-insns"]
789 #
Return 1 if trapping arithmetic is available
, 0 otherwise.
791 proc check_effective_target_trapping
{} {
792 return [check_no_compiler_messages trapping object
{
793 int add
(int a
, int b
) { return a
+ b
; }
797 #
Return 1 if compilation with
-fgraphite is error
-free
for trivial
800 proc check_effective_target_fgraphite
{} {
801 return [check_no_compiler_messages fgraphite object
{
806 #
Return 1 if compilation with
-fopenacc is error
-free
for trivial
809 proc check_effective_target_fopenacc
{} {
810 return [check_no_compiler_messages fopenacc object
{
815 #
Return 1 if compilation with
-fopenmp is error
-free
for trivial
818 proc check_effective_target_fopenmp
{} {
819 return [check_no_compiler_messages fopenmp object
{
824 #
Return 1 if compilation with
-fgnu
-tm is error
-free
for trivial
827 proc check_effective_target_fgnu_tm
{} {
828 return [check_no_compiler_messages fgnu_tm object
{
833 #
Return 1 if the target supports mmap
, 0 otherwise.
835 proc check_effective_target_mmap
{} {
836 return [check_function_available
"mmap"]
839 #
Return 1 if the target supports dlopen
, 0 otherwise.
840 proc check_effective_target_dlopen
{} {
841 return [check_no_compiler_messages dlopen executable
{
843 int main
(void
) { dlopen
("dummy.so", RTLD_NOW); }
844 } [add_options_for_dlopen
""]]
847 proc add_options_for_dlopen
{ flags
} {
851 #
Return 1 if the target supports clone
, 0 otherwise.
852 proc check_effective_target_clone
{} {
853 return [check_function_available
"clone"]
856 #
Return 1 if the target supports setrlimit
, 0 otherwise.
857 proc check_effective_target_setrlimit
{} {
858 # Darwin has non
-posix compliant RLIMIT_AS
859 if { [istarget
*-*-darwin
*] } {
862 return [check_function_available
"setrlimit"]
865 #
Return 1 if the target supports swapcontext
, 0 otherwise.
866 proc check_effective_target_swapcontext
{} {
867 return [check_no_compiler_messages swapcontext executable
{
868 #
include <ucontext.h
>
871 ucontext_t orig_context
,child_context
;
872 if (swapcontext
(&child_context
, &orig_context
) < 0) { }
877 #
Return 1 if compilation with
-pthread is error
-free
for trivial
880 proc check_effective_target_pthread
{} {
881 return [check_no_compiler_messages pthread object
{
886 #
Return 1 if compilation with
-mpe
-aligned
-commons is error
-free
887 #
for trivial code
, 0 otherwise.
889 proc check_effective_target_pe_aligned_commons
{} {
890 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
891 return [check_no_compiler_messages pe_aligned_commons object
{
893 } "-mpe-aligned-commons"]
898 #
Return 1 if the target supports
-static
899 proc check_effective_target_static
{} {
900 return [check_no_compiler_messages static executable
{
901 int main
(void
) { return 0; }
905 #
Return 1 if the target supports
-fstack
-protector
906 proc check_effective_target_fstack_protector
{} {
907 return [check_runtime fstack_protector
{
908 int main
(void
) { return 0; }
909 } "-fstack-protector"]
912 #
Return 1 if compilation with
-freorder
-blocks
-and
-partition is error
-free
913 #
for trivial code
, 0 otherwise.
915 proc check_effective_target_freorder
{} {
916 return [check_no_compiler_messages freorder object
{
918 } "-freorder-blocks-and-partition"]
921 #
Return 1 if -fpic and
-fPIC are supported
, as in no warnings or errors
922 # emitted
, 0 otherwise. Whether a shared library can actually be built is
923 # out of scope
for this test.
925 proc check_effective_target_fpic
{ } {
926 # Note that M68K has a multilib that supports
-fpic but not
927 #
-fPIC
, so we need to check both. We test with a
program that
928 # requires GOT references.
929 foreach
arg {fpic fPIC
} {
930 if [check_no_compiler_messages $
arg object
{
931 extern
int foo
(void
); extern
int bar
;
932 int baz
(void
) { return foo
() + bar
; }
940 #
Return 1 if -shared is supported
, as in no warnings or errors
941 # emitted
, 0 otherwise.
943 proc check_effective_target_shared
{ } {
944 # Note that M68K has a multilib that supports
-fpic but not
945 #
-fPIC
, so we need to check both. We test with a
program that
946 # requires GOT references.
947 return [check_no_compiler_messages shared executable
{
948 extern
int foo
(void
); extern
int bar
;
949 int baz
(void
) { return foo
() + bar
; }
953 #
Return 1 if -pie
, -fpie and
-fPIE are supported
, 0 otherwise.
955 proc check_effective_target_pie
{ } {
956 if { [istarget
*-*-darwin\
[912\
]*]
957 ||
[istarget
*-*-linux
*]
958 ||
[istarget
*-*-gnu
*] } {
964 #
Return true
if the target supports
-mpaired
-single
(as used
on MIPS
).
966 proc check_effective_target_mpaired_single
{ } {
967 return [check_no_compiler_messages mpaired_single object
{
972 #
Return true
if the target has access to FPU instructions.
974 proc check_effective_target_hard_float
{ } {
975 if { [istarget mips
*-*-*] } {
976 return [check_no_compiler_messages hard_float assembly
{
977 #
if (defined __mips_soft_float || defined __mips16
)
978 #error __mips_soft_float || __mips16
983 # This proc is actually checking the availabilty of FPU
984 # support
for doubles
, so
on the RX we must fail
if the
985 #
64-bit double multilib has been selected.
986 if { [istarget rx
-*-*] } {
988 #
return [check_no_compiler_messages hard_float assembly
{
989 #
if defined __RX_64_BIT_DOUBLES__
990 #error __RX_64_BIT_DOUBLES__
995 # The generic test equates hard_float with
"no call for adding doubles".
996 return [check_no_messages_and_pattern hard_float
"!\\(call" rtl-expand {
997 double a
(double b
, double c
) { return b
+ c
; }
1001 #
Return true
if the target is a
64-bit MIPS target.
1003 proc check_effective_target_mips64
{ } {
1004 return [check_no_compiler_messages mips64 assembly
{
1011 #
Return true
if the target is a MIPS target that does not produce
1014 proc check_effective_target_nomips16
{ } {
1015 return [check_no_compiler_messages nomips16 object
{
1019 /* A cheap way of testing
for -mflip
-mips16.
*/
1020 void foo
(void
) { asm
("addiu $20,$20,1"); }
1021 void bar
(void
) { asm
("addiu $20,$20,1"); }
1026 # Add the options needed
for MIPS16 function attributes. At the moment
,
1027 # we don
't support MIPS16 PIC.
1029 proc add_options_for_mips16_attribute { flags } {
1030 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
1033 # Return true if we can force a mode that allows MIPS16 code generation.
1034 # We don't support MIPS16 PIC
, and only support MIPS16
-mhard
-float
1037 proc check_effective_target_mips16_attribute
{ } {
1038 return [check_no_compiler_messages mips16_attribute assembly
{
1042 #
if defined __mips_hard_float \
1043 && (!defined _ABIO32 || _MIPS_SIM
!= _ABIO32
) \
1044 && (!defined _ABIO64 || _MIPS_SIM
!= _ABIO64
)
1045 #error __mips_hard_float
&& (!_ABIO32 ||
!_ABIO64
)
1047 } [add_options_for_mips16_attribute
""]]
1050 #
Return 1 if the target supports long double larger than double when
1051 # using the new ABI
, 0 otherwise.
1053 proc check_effective_target_mips_newabi_large_long_double
{ } {
1054 return [check_no_compiler_messages mips_newabi_large_long_double object
{
1055 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1059 #
Return true
if the target is a MIPS target that has access
1060 # to the LL and SC instructions.
1062 proc check_effective_target_mips_llsc
{ } {
1063 if { ![istarget mips
*-*-*] } {
1066 # Assume that these instructions are always implemented
for
1067 # non
-elf
* targets
, via emulation
if necessary.
1068 if { ![istarget
*-*-elf
*] } {
1071 # Otherwise assume LL
/SC support
for everything but MIPS I.
1072 return [check_no_compiler_messages mips_llsc assembly
{
1079 #
Return true
if the target is a MIPS target that uses in
-place relocations.
1081 proc check_effective_target_mips_rel
{ } {
1082 if { ![istarget mips
*-*-*] } {
1085 return [check_no_compiler_messages mips_rel object
{
1086 #
if (defined _ABIN32
&& _MIPS_SIM
== _ABIN32
) \
1087 ||
(defined _ABI64
&& _MIPS_SIM
== _ABI64
)
1088 #error _ABIN32
&& (_ABIN32 || _ABI64
)
1093 #
Return true
if the target is a MIPS target that uses the EABI.
1095 proc check_effective_target_mips_eabi
{ } {
1096 if { ![istarget mips
*-*-*] } {
1099 return [check_no_compiler_messages mips_eabi object
{
1106 #
Return 1 if the current multilib does not generate PIC by default.
1108 proc check_effective_target_nonpic
{ } {
1109 return [check_no_compiler_messages nonpic assembly
{
1116 #
Return 1 if the current multilib generates PIE by default.
1118 proc check_effective_target_pie_enabled
{ } {
1119 return [check_no_compiler_messages pie_enabled assembly
{
1126 #
Return 1 if the target does not use a
status wrapper.
1128 proc check_effective_target_unwrapped
{ } {
1129 if { [target_info needs_status_wrapper
] != "" \
1130 && [target_info needs_status_wrapper
] != "0" } {
1136 #
Return true
if iconv is supported
on the target. In particular IBM1047.
1138 proc check_iconv_available
{ test_what
} {
1141 #
If the tool configuration file has not
set libiconv
, try
"-liconv"
1142 if { ![info exists libiconv
] } {
1143 set libiconv
"-liconv"
1145 set test_what
[lindex $test_what
1]
1146 return [check_runtime_nocache $test_what
[subst
{
1152 cd
= iconv_open
("$test_what", "UTF-8");
1153 if (cd
== (iconv_t
) -1)
1160 #
Return true
if Cilk Library is supported
on the target.
1161 proc check_libcilkrts_available
{ } {
1162 return [ check_no_compiler_messages_nocache libcilkrts_available executable
{
1166 int __cilkrts_set_param
(const char
*, const char
*);
1168 int x
= __cilkrts_set_param
("nworkers", "0");
1171 } "-fcilkplus -lcilkrts" ]
1174 #
Return true
if the atomic library is supported
on the target.
1175 proc check_effective_target_libatomic_available
{ } {
1176 return [check_no_compiler_messages libatomic_available executable
{
1177 int main
(void
) { return 0; }
1181 #
Return 1 if an ASCII locale is supported
on this host
, 0 otherwise.
1183 proc check_ascii_locale_available
{ } {
1187 #
Return true
if named sections are supported
on this target.
1189 proc check_named_sections_available
{ } {
1190 return [check_no_compiler_messages named_sections assembly
{
1191 int __attribute__
((section
("whatever"))) foo;
1195 #
Return true
if the
"naked" function attribute is supported on this target.
1197 proc check_effective_target_naked_functions
{ } {
1198 return [check_no_compiler_messages naked_functions assembly
{
1199 void f
() __attribute__
((naked
));
1203 #
Return 1 if the target supports Fortran real kinds larger than real
(8),
1206 # When the target
name changes
, replace the cached result.
1208 proc check_effective_target_fortran_large_real
{ } {
1209 return [check_no_compiler_messages fortran_large_real executable
{
1211 integer,parameter
:: k
= selected_real_kind
(precision
(0.0_8
) + 1)
1218 #
Return 1 if the target supports Fortran real kind real
(16),
1219 #
0 otherwise. Contrary to check_effective_target_fortran_large_real
1220 # this checks
for Real
(16) only
; the other returned real
(10) if
1221 # both real
(10) and real
(16) are available.
1223 # When the target
name changes
, replace the cached result.
1225 proc check_effective_target_fortran_real_16
{ } {
1226 return [check_no_compiler_messages fortran_real_16 executable
{
1235 #
Return 1 if the target supports Fortran
's IEEE modules,
1238 # When the target name changes, replace the cached result.
1240 proc check_effective_target_fortran_ieee { flags } {
1241 return [check_no_compiler_messages fortran_ieee executable {
1243 use, intrinsic :: ieee_features
1249 # Return 1 if the target supports SQRT for the largest floating-point
1250 # type. (Some targets lack the libm support for this FP type.)
1251 # On most targets, this check effectively checks either whether sqrtl is
1252 # available or on __float128 systems whether libquadmath is installed,
1253 # which provides sqrtq.
1255 # When the target name changes, replace the cached result.
1257 proc check_effective_target_fortran_largest_fp_has_sqrt { } {
1258 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
1260 use iso_fortran_env, only: real_kinds
1261 integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
1262 real(kind=maxFP), volatile :: x
1270 # Return 1 if the target supports Fortran integer kinds larger than
1271 # integer(8), 0 otherwise.
1273 # When the target name changes, replace the cached result.
1275 proc check_effective_target_fortran_large_int { } {
1276 return [check_no_compiler_messages fortran_large_int executable {
1278 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
1279 integer(kind=k) :: i
1284 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
1286 # When the target name changes, replace the cached result.
1288 proc check_effective_target_fortran_integer_16 { } {
1289 return [check_no_compiler_messages fortran_integer_16 executable {
1296 # Return 1 if we can statically link libgfortran, 0 otherwise.
1298 # When the target name changes, replace the cached result.
1300 proc check_effective_target_static_libgfortran { } {
1301 return [check_no_compiler_messages static_libgfortran executable {
1308 # Return 1 if cilk-plus is supported by the target, 0 otherwise.
1310 proc check_effective_target_cilkplus { } {
1311 # Skip cilk-plus tests on int16 and size16 targets for now.
1312 # The cilk-plus tests are not generic enough to cover these
1313 # cases and would throw hundreds of FAILs.
1314 if { [check_effective_target_int16]
1315 || ![check_effective_target_size32plus] } {
1319 # Skip AVR, its RAM is too small and too many tests would fail.
1320 if { [istarget avr-*-*] } {
1326 proc check_linker_plugin_available { } {
1327 return [check_no_compiler_messages_nocache linker_plugin executable {
1328 int main() { return 0; }
1329 } "-flto -fuse-linker-plugin"]
1332 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1333 # otherwise. Cache the result.
1335 proc check_750cl_hw_available { } {
1336 return [check_cached_effective_target 750cl_hw_available {
1337 # If this is not the right target then we can skip the test.
1338 if { ![istarget powerpc-*paired*] } {
1341 check_runtime_nocache 750cl_hw_available {
1345 asm volatile ("ps_mul v0,v0,v0");
1347 asm volatile ("ps_mul 0,0,0");
1356 # Return 1 if the target OS supports running SSE executables, 0
1357 # otherwise. Cache the result.
1359 proc check_sse_os_support_available { } {
1360 return [check_cached_effective_target sse_os_support_available {
1361 # If this is not the right target then we can skip the test.
1362 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1364 } elseif { [istarget i?86-*-solaris2*] } {
1365 # The Solaris 2 kernel doesn't save and restore SSE registers
1366 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1367 check_runtime_nocache sse_os_support_available
{
1370 asm volatile
("movaps %xmm0,%xmm0");
1380 #
Return 1 if the target OS supports running AVX executables
, 0
1381 # otherwise.
Cache the result.
1383 proc check_avx_os_support_available
{ } {
1384 return [check_cached_effective_target avx_os_support_available
{
1385 #
If this is not the right target
then we can skip the test.
1386 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1389 # Check that OS has AVX and SSE saving enabled.
1390 check_runtime_nocache avx_os_support_available
{
1393 unsigned
int eax
, edx
;
1395 asm
("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1396 return (eax
& 6) != 6;
1403 #
Return 1 if the target supports executing SSE instructions
, 0
1404 # otherwise.
Cache the result.
1406 proc check_sse_hw_available
{ } {
1407 return [check_cached_effective_target sse_hw_available
{
1408 #
If this is not the right target
then we can skip the test.
1409 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1412 check_runtime_nocache sse_hw_available
{
1416 unsigned
int eax
, ebx
, ecx
, edx
;
1417 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1418 return !(edx
& bit_SSE
);
1426 #
Return 1 if the target supports executing SSE2 instructions
, 0
1427 # otherwise.
Cache the result.
1429 proc check_sse2_hw_available
{ } {
1430 return [check_cached_effective_target sse2_hw_available
{
1431 #
If this is not the right target
then we can skip the test.
1432 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1435 check_runtime_nocache sse2_hw_available
{
1439 unsigned
int eax
, ebx
, ecx
, edx
;
1440 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1441 return !(edx
& bit_SSE2
);
1449 #
Return 1 if the target supports executing AVX instructions
, 0
1450 # otherwise.
Cache the result.
1452 proc check_avx_hw_available
{ } {
1453 return [check_cached_effective_target avx_hw_available
{
1454 #
If this is not the right target
then we can skip the test.
1455 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1458 check_runtime_nocache avx_hw_available
{
1462 unsigned
int eax
, ebx
, ecx
, edx
;
1463 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1464 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1465 != (bit_AVX | bit_OSXSAVE
));
1473 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1475 proc check_effective_target_sse_runtime
{ } {
1476 if { [check_effective_target_sse
]
1477 && [check_sse_hw_available
]
1478 && [check_sse_os_support_available
] } {
1484 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1486 proc check_effective_target_sse2_runtime
{ } {
1487 if { [check_effective_target_sse2
]
1488 && [check_sse2_hw_available
]
1489 && [check_sse_os_support_available
] } {
1495 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1497 proc check_effective_target_avx_runtime
{ } {
1498 if { [check_effective_target_avx
]
1499 && [check_avx_hw_available
]
1500 && [check_avx_os_support_available
] } {
1506 #
Return 1 if the target supports executing power8 vector instructions
, 0
1507 # otherwise.
Cache the result.
1509 proc check_p8vector_hw_available
{ } {
1510 return [check_cached_effective_target p8vector_hw_available
{
1511 # Some simulators are known to not support VSX
/power8 instructions.
1512 #
For now
, disable
on Darwin
1513 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1516 set options
"-mpower8-vector"
1517 check_runtime_nocache p8vector_hw_available
{
1521 asm volatile
("xxlorc vs0,vs0,vs0");
1523 asm volatile
("xxlorc 0,0,0");
1532 #
Return 1 if the target supports executing VSX instructions
, 0
1533 # otherwise.
Cache the result.
1535 proc check_vsx_hw_available
{ } {
1536 return [check_cached_effective_target vsx_hw_available
{
1537 # Some simulators are known to not support VSX instructions.
1538 #
For now
, disable
on Darwin
1539 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1543 check_runtime_nocache vsx_hw_available
{
1547 asm volatile
("xxlor vs0,vs0,vs0");
1549 asm volatile
("xxlor 0,0,0");
1558 #
Return 1 if the target supports executing AltiVec instructions
, 0
1559 # otherwise.
Cache the result.
1561 proc check_vmx_hw_available
{ } {
1562 return [check_cached_effective_target vmx_hw_available
{
1563 # Some simulators are known to not support VMX instructions.
1564 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1567 # Most targets don
't require special flags for this test case, but
1568 # Darwin does. Just to be sure, make sure VSX is not enabled for
1569 # the altivec tests.
1570 if { [istarget *-*-darwin*]
1571 || [istarget *-*-aix*] } {
1572 set options "-maltivec -mno-vsx"
1574 set options "-mno-vsx"
1576 check_runtime_nocache vmx_hw_available {
1580 asm volatile ("vor v0,v0,v0");
1582 asm volatile ("vor 0,0,0");
1591 proc check_ppc_recip_hw_available { } {
1592 return [check_cached_effective_target ppc_recip_hw_available {
1593 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1594 # For now, disable on Darwin
1595 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1598 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1599 check_runtime_nocache ppc_recip_hw_available {
1600 volatile double d_recip, d_rsqrt, d_four = 4.0;
1601 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1604 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1605 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1606 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1607 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1615 # Return 1 if the target supports executing AltiVec and Cell PPU
1616 # instructions, 0 otherwise. Cache the result.
1618 proc check_effective_target_cell_hw { } {
1619 return [check_cached_effective_target cell_hw_available {
1620 # Some simulators are known to not support VMX and PPU instructions.
1621 if { [istarget powerpc-*-eabi*] } {
1624 # Most targets don't require special flags
for this test
1625 # case
, but Darwin and AIX
do.
1626 if { [istarget
*-*-darwin
*]
1627 ||
[istarget
*-*-aix
*] } {
1628 set options
"-maltivec -mcpu=cell"
1630 set options
"-mcpu=cell"
1632 check_runtime_nocache cell_hw_available
{
1636 asm volatile
("vor v0,v0,v0");
1637 asm volatile
("lvlx v0,r0,r0");
1639 asm volatile
("vor 0,0,0");
1640 asm volatile
("lvlx 0,0,0");
1649 #
Return 1 if the target supports executing
64-bit instructions
, 0
1650 # otherwise.
Cache the result.
1652 proc check_effective_target_powerpc64
{ } {
1653 global powerpc64_available_saved
1656 if [info exists powerpc64_available_saved
] {
1657 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1659 set powerpc64_available_saved
0
1661 # Some simulators are known to not support powerpc64 instructions.
1662 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1663 verbose
"check_effective_target_powerpc64 returning 0" 2
1664 return $powerpc64_available_saved
1667 #
Set up
, compile, and
execute a test
program containing a
64-bit
1668 # instruction.
Include the current process ID in the file
1669 # names to prevent conflicts with invocations
for multiple
1674 set f
[open $src
"w"]
1675 puts $f
"int main() {"
1676 puts $f
"#ifdef __MACH__"
1677 puts $f
" asm volatile (\"extsw r0,r0\");"
1679 puts $f
" asm volatile (\"extsw 0,0\");"
1681 puts $f
" return 0; }"
1684 set opts
"additional_flags=-mcpu=G5"
1686 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1687 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1690 if [string match
"" $lines] then {
1691 # No error message
, compilation succeeded.
1692 set result
[$
{tool
}_load
"./$exe" "" ""]
1693 set status [lindex $result
0]
1694 remote_file build
delete $exe
1695 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1697 if { $
status == "pass" } then {
1698 set powerpc64_available_saved
1
1701 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1705 return $powerpc64_available_saved
1708 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1709 # complex float arguments. This affects gfortran tests that
call cabsf
1710 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1711 #
argument passing as the compiler under test
, 0 otherwise.
1713 # When the target
name changes
, replace the cached result.
1715 proc check_effective_target_broken_cplxf_arg
{ } {
1716 return [check_cached_effective_target broken_cplxf_arg
{
1717 # Skip the work
for targets known not to be affected.
1718 if { ![istarget powerpc64
-*-linux
*] } {
1720 } elseif
{ ![is
-effective
-target lp64
] } {
1723 check_runtime_nocache broken_cplxf_arg
{
1724 #
include <complex.h
>
1725 extern void abort
(void
);
1726 float fabsf
(float
);
1727 float cabsf
(_Complex float
);
1734 if (fabsf
(f
- 5.0) > 0.0001)
1743 #
Return 1 is this is a TI C6X target supporting C67X instructions
1744 proc check_effective_target_ti_c67x
{ } {
1745 return [check_no_compiler_messages ti_c67x assembly
{
1746 #
if !defined
(_TMS320C6700
)
1747 #error
!_TMS320C6700
1752 #
Return 1 is this is a TI C6X target supporting C64X
+ instructions
1753 proc check_effective_target_ti_c64xp
{ } {
1754 return [check_no_compiler_messages ti_c64xp assembly
{
1755 #
if !defined
(_TMS320C6400_PLUS
)
1756 #error
!_TMS320C6400_PLUS
1762 proc check_alpha_max_hw_available
{ } {
1763 return [check_runtime alpha_max_hw_available
{
1764 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1768 # Returns true iff the FUNCTION is available
on the target
system.
1769 #
(This is essentially a Tcl implementation of Autoconf
's
1772 proc check_function_available { function } {
1773 return [check_no_compiler_messages ${function}_available \
1779 int main () { $function (); }
1783 # Returns true iff "fork" is available on the target system.
1785 proc check_fork_available {} {
1786 return [check_function_available "fork"]
1789 # Returns true iff "mkfifo" is available on the target system.
1791 proc check_mkfifo_available {} {
1792 if { [istarget *-*-cygwin*] } {
1793 # Cygwin has mkfifo, but support is incomplete.
1797 return [check_function_available "mkfifo"]
1800 # Returns true iff "__cxa_atexit" is used on the target system.
1802 proc check_cxa_atexit_available { } {
1803 return [check_cached_effective_target cxa_atexit_available {
1804 if { [istarget hppa*-*-hpux10*] } {
1805 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1807 } elseif
{ [istarget
*-*-vxworks
] } {
1808 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1811 check_runtime_nocache cxa_atexit_available {
1814 static unsigned int count;
1831 Y() { f(); count = 2; }
1840 int main() { return 0; }
1846 proc check_effective_target_objc2 { } {
1847 return [check_no_compiler_messages objc2 object {
1856 proc check_effective_target_next_runtime { } {
1857 return [check_no_compiler_messages objc2 object {
1858 #ifdef __NEXT_RUNTIME__
1861 #error !__NEXT_RUNTIME__
1866 # Return 1 if we're generating
32-bit code using default options
, 0
1869 proc check_effective_target_ilp32
{ } {
1870 return [check_no_compiler_messages ilp32 object
{
1871 int dummy
[sizeof
(int) == 4
1872 && sizeof
(void
*) == 4
1873 && sizeof
(long
) == 4 ?
1 : -1];
1877 #
Return 1 if we
're generating ia32 code using default options, 0
1880 proc check_effective_target_ia32 { } {
1881 return [check_no_compiler_messages ia32 object {
1882 int dummy[sizeof (int) == 4
1883 && sizeof (void *) == 4
1884 && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
1888 # Return 1 if we're generating x32 code using default options
, 0
1891 proc check_effective_target_x32
{ } {
1892 return [check_no_compiler_messages x32 object
{
1893 int dummy
[sizeof
(int) == 4
1894 && sizeof
(void
*) == 4
1895 && sizeof
(long
) == 4 ?
1 : -1] = { __x86_64__
};
1899 #
Return 1 if we
're generating 32-bit integers using default
1900 # options, 0 otherwise.
1902 proc check_effective_target_int32 { } {
1903 return [check_no_compiler_messages int32 object {
1904 int dummy[sizeof (int) == 4 ? 1 : -1];
1908 # Return 1 if we're generating
32-bit or larger integers using default
1909 # options
, 0 otherwise.
1911 proc check_effective_target_int32plus
{ } {
1912 return [check_no_compiler_messages int32plus object
{
1913 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1917 #
Return 1 if we
're generating 32-bit or larger pointers using default
1918 # options, 0 otherwise.
1920 proc check_effective_target_ptr32plus { } {
1921 # The msp430 has 16-bit or 20-bit pointers. The 20-bit pointer is stored
1922 # in a 32-bit slot when in memory, so sizeof(void *) returns 4, but it
1923 # cannot really hold a 32-bit address, so we always return false here.
1924 if { [istarget msp430-*-*] } {
1928 return [check_no_compiler_messages ptr32plus object {
1929 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1933 # Return 1 if we support 32-bit or larger array and structure sizes
1934 # using default options, 0 otherwise. Avoid false positive on
1935 # targets with 20 or 24 bit address spaces.
1937 proc check_effective_target_size32plus { } {
1938 return [check_no_compiler_messages size32plus object {
1939 char dummy[16777217L];
1943 # Returns 1 if we're generating
16-bit or smaller integers with the
1944 # default options
, 0 otherwise.
1946 proc check_effective_target_int16
{ } {
1947 return [check_no_compiler_messages int16 object
{
1948 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1952 #
Return 1 if we
're generating 64-bit code using default options, 0
1955 proc check_effective_target_lp64 { } {
1956 return [check_no_compiler_messages lp64 object {
1957 int dummy[sizeof (int) == 4
1958 && sizeof (void *) == 8
1959 && sizeof (long) == 8 ? 1 : -1];
1963 # Return 1 if we're generating
64-bit code using default llp64 options
,
1966 proc check_effective_target_llp64
{ } {
1967 return [check_no_compiler_messages llp64 object
{
1968 int dummy
[sizeof
(int) == 4
1969 && sizeof
(void
*) == 8
1970 && sizeof
(long long
) == 8
1971 && sizeof
(long
) == 4 ?
1 : -1];
1975 #
Return 1 if long and
int have different sizes
,
1978 proc check_effective_target_long_neq_int
{ } {
1979 return [check_no_compiler_messages long_ne_int object
{
1980 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1984 #
Return 1 if the target supports long double larger than double
,
1987 proc check_effective_target_large_long_double
{ } {
1988 return [check_no_compiler_messages large_long_double object
{
1989 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1993 #
Return 1 if the target supports double larger than float
,
1996 proc check_effective_target_large_double
{ } {
1997 return [check_no_compiler_messages large_double object
{
1998 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
2002 #
Return 1 if the target supports long double of
128 bits
,
2005 proc check_effective_target_longdouble128
{ } {
2006 return [check_no_compiler_messages longdouble128 object
{
2007 int dummy
[sizeof
(long double
) == 16 ?
1 : -1];
2011 #
Return 1 if the target supports double of
64 bits
,
2014 proc check_effective_target_double64
{ } {
2015 return [check_no_compiler_messages double64 object
{
2016 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
2020 #
Return 1 if the target supports double of at least
64 bits
,
2023 proc check_effective_target_double64plus
{ } {
2024 return [check_no_compiler_messages double64plus object
{
2025 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
2029 #
Return 1 if the target supports
'w' suffix
on floating constant
2032 proc check_effective_target_has_w_floating_suffix
{ } {
2034 if [check_effective_target_c
++] {
2035 append opts
"-std=gnu++03"
2037 return [check_no_compiler_messages w_fp_suffix object
{
2042 #
Return 1 if the target supports
'q' suffix
on floating constant
2045 proc check_effective_target_has_q_floating_suffix
{ } {
2047 if [check_effective_target_c
++] {
2048 append opts
"-std=gnu++03"
2050 return [check_no_compiler_messages q_fp_suffix object
{
2054 #
Return 1 if the target supports compiling fixed
-point
,
2057 proc check_effective_target_fixed_point
{ } {
2058 return [check_no_compiler_messages fixed_point object
{
2059 _Sat _Fract x
; _Sat _Accum y
;
2063 #
Return 1 if the target supports compiling decimal floating point
,
2066 proc check_effective_target_dfp_nocache
{ } {
2067 verbose
"check_effective_target_dfp_nocache: compiling source" 2
2068 set ret
[check_no_compiler_messages_nocache dfp object
{
2069 float x __attribute__
((mode(DD
)));
2071 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
2075 proc check_effective_target_dfprt_nocache
{ } {
2076 return [check_runtime_nocache dfprt
{
2077 typedef float d64 __attribute__
((mode(DD
)));
2078 d64 x
= 1.2df
, y
= 2.3dd
, z
;
2079 int main
() { z
= x
+ y
; return 0; }
2083 #
Return 1 if the target supports compiling Decimal Floating Point
,
2086 # This won
't change for different subtargets so cache the result.
2088 proc check_effective_target_dfp { } {
2089 return [check_cached_effective_target dfp {
2090 check_effective_target_dfp_nocache
2094 # Return 1 if the target supports linking and executing Decimal Floating
2095 # Point, 0 otherwise.
2097 # This won't change
for different subtargets so
cache the result.
2099 proc check_effective_target_dfprt
{ } {
2100 return [check_cached_effective_target dfprt
{
2101 check_effective_target_dfprt_nocache
2105 #
Return 1 if the target supports executing DFP hardware instructions
,
2106 #
0 otherwise.
Cache the result.
2108 proc check_dfp_hw_available
{ } {
2109 return [check_cached_effective_target dfp_hw_available
{
2110 #
For now
, disable
on Darwin
2111 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
2114 check_runtime_nocache dfp_hw_available
{
2115 volatile _Decimal64 r
;
2116 volatile _Decimal64 a
= 4.0DD
;
2117 volatile _Decimal64 b
= 2.0DD
;
2120 asm volatile
("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2121 asm volatile
("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2122 asm volatile
("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2123 asm volatile
("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2126 } "-mcpu=power6 -mhard-float"
2131 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2133 proc check_effective_target_ucn_nocache
{ } {
2134 #
-std
=c99 is only valid
for C
2135 if [check_effective_target_c
] {
2136 set ucnopts
"-std=c99"
2140 verbose
"check_effective_target_ucn_nocache: compiling source" 2
2141 set ret
[check_no_compiler_messages_nocache ucn object
{
2144 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
2148 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2150 # This won
't change for different subtargets, so cache the result.
2152 proc check_effective_target_ucn { } {
2153 return [check_cached_effective_target ucn {
2154 check_effective_target_ucn_nocache
2158 # Return 1 if the target needs a command line argument to enable a SIMD
2161 proc check_effective_target_vect_cmdline_needed { } {
2162 global et_vect_cmdline_needed_saved
2163 global et_vect_cmdline_needed_target_name
2165 if { ![info exists et_vect_cmdline_needed_target_name] } {
2166 set et_vect_cmdline_needed_target_name ""
2169 # If the target has changed since we set the cached value, clear it.
2170 set current_target [current_target_name]
2171 if { $current_target != $et_vect_cmdline_needed_target_name } {
2172 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
2173 set et_vect_cmdline_needed_target_name $current_target
2174 if { [info exists et_vect_cmdline_needed_saved] } {
2175 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
2176 unset et_vect_cmdline_needed_saved
2180 if [info exists et_vect_cmdline_needed_saved] {
2181 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
2183 set et_vect_cmdline_needed_saved 1
2184 if { [istarget alpha*-*-*]
2185 || [istarget ia64-*-*]
2186 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
2187 && ([check_effective_target_x32]
2188 || [check_effective_target_lp64]))
2189 || ([istarget powerpc*-*-*]
2190 && ([check_effective_target_powerpc_spe]
2191 || [check_effective_target_powerpc_altivec]))
2192 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
2193 || [istarget spu-*-*]
2194 || ([istarget arm*-*-*] && [check_effective_target_arm_neon])
2195 || [istarget aarch64*-*-*] } {
2196 set et_vect_cmdline_needed_saved 0
2200 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2201 return $et_vect_cmdline_needed_saved
2204 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
2206 # This won't change
for different subtargets so
cache the result.
2208 proc check_effective_target_vect_int
{ } {
2209 global et_vect_int_saved
2211 if [info exists et_vect_int_saved
] {
2212 verbose
"check_effective_target_vect_int: using cached result" 2
2214 set et_vect_int_saved
0
2215 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
2216 ||
([istarget powerpc
*-*-*]
2217 && ![istarget powerpc
-*-linux
*paired
*])
2218 ||
[istarget spu
-*-*]
2219 ||
[istarget sparc
*-*-*]
2220 ||
[istarget alpha
*-*-*]
2221 ||
[istarget ia64
-*-*]
2222 ||
[istarget aarch64
*-*-*]
2223 ||
[check_effective_target_arm32
]
2224 ||
([istarget mips
*-*-*]
2225 && [check_effective_target_mips_loongson
]) } {
2226 set et_vect_int_saved
1
2230 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
2231 return $et_vect_int_saved
2234 #
Return 1 if the target supports signed
int->float conversion
2237 proc check_effective_target_vect_intfloat_cvt
{ } {
2238 global et_vect_intfloat_cvt_saved
2240 if [info exists et_vect_intfloat_cvt_saved
] {
2241 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
2243 set et_vect_intfloat_cvt_saved
0
2244 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
2245 ||
([istarget powerpc
*-*-*]
2246 && ![istarget powerpc
-*-linux
*paired
*])
2247 ||
([istarget arm
*-*-*]
2248 && [check_effective_target_arm_neon_ok
])} {
2249 set et_vect_intfloat_cvt_saved
1
2253 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2254 return $et_vect_intfloat_cvt_saved
2257 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
2259 proc check_effective_target_int128 { } {
2260 return [check_no_compiler_messages int128 object {
2262 #ifndef __SIZEOF_INT128__
2271 # Return 1 if the target supports unsigned int->float conversion
2274 proc check_effective_target_vect_uintfloat_cvt { } {
2275 global et_vect_uintfloat_cvt_saved
2277 if [info exists et_vect_uintfloat_cvt_saved] {
2278 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2280 set et_vect_uintfloat_cvt_saved 0
2281 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
2282 || ([istarget powerpc*-*-*]
2283 && ![istarget powerpc-*-linux*paired*])
2284 || [istarget aarch64*-*-*]
2285 || ([istarget arm*-*-*]
2286 && [check_effective_target_arm_neon_ok])} {
2287 set et_vect_uintfloat_cvt_saved 1
2291 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2292 return $et_vect_uintfloat_cvt_saved
2296 # Return 1 if the target supports signed float->int conversion
2299 proc check_effective_target_vect_floatint_cvt { } {
2300 global et_vect_floatint_cvt_saved
2302 if [info exists et_vect_floatint_cvt_saved] {
2303 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2305 set et_vect_floatint_cvt_saved 0
2306 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
2307 || ([istarget powerpc*-*-*]
2308 && ![istarget powerpc-*-linux*paired*])
2309 || ([istarget arm*-*-*]
2310 && [check_effective_target_arm_neon_ok])} {
2311 set et_vect_floatint_cvt_saved 1
2315 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2316 return $et_vect_floatint_cvt_saved
2319 # Return 1 if the target supports unsigned float->int conversion
2322 proc check_effective_target_vect_floatuint_cvt { } {
2323 global et_vect_floatuint_cvt_saved
2325 if [info exists et_vect_floatuint_cvt_saved] {
2326 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2328 set et_vect_floatuint_cvt_saved 0
2329 if { ([istarget powerpc*-*-*]
2330 && ![istarget powerpc-*-linux*paired*])
2331 || ([istarget arm*-*-*]
2332 && [check_effective_target_arm_neon_ok])} {
2333 set et_vect_floatuint_cvt_saved 1
2337 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2338 return $et_vect_floatuint_cvt_saved
2341 # Return 1 if the target supports #pragma omp declare simd, 0 otherwise.
2343 # This won't change
for different subtargets so
cache the result.
2345 proc check_effective_target_vect_simd_clones
{ } {
2346 global et_vect_simd_clones_saved
2348 if [info exists et_vect_simd_clones_saved
] {
2349 verbose
"check_effective_target_vect_simd_clones: using cached result" 2
2351 set et_vect_simd_clones_saved
0
2352 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
2353 #
On i?
86/x86_64 #pragma omp declare simd builds a sse2
, avx and
2354 # avx2 clone. Only the right clone
for the specified arch will be
2355 # chosen
, but still we need to at least be able to assemble
2357 if { [check_effective_target_avx2
] } {
2358 set et_vect_simd_clones_saved
1
2363 verbose
"check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2364 return $et_vect_simd_clones_saved
2367 #
Return 1 if this is a AArch64 target supporting big endian
2368 proc check_effective_target_aarch64_big_endian
{ } {
2369 return [check_no_compiler_messages aarch64_big_endian assembly
{
2370 #
if !defined
(__aarch64__
) ||
!defined
(__AARCH64EB__
)
2371 #error
!__aarch64__ ||
!__AARCH64EB__
2376 #
Return 1 if this is a AArch64 target supporting little endian
2377 proc check_effective_target_aarch64_little_endian
{ } {
2378 if { ![istarget aarch64
*-*-*] } {
2382 return [check_no_compiler_messages aarch64_little_endian assembly
{
2383 #
if !defined
(__aarch64__
) || defined
(__AARCH64EB__
)
2389 #
Return 1 if this is an arm target using
32-bit instructions
2390 proc check_effective_target_arm32
{ } {
2391 if { ![istarget arm
*-*-*] } {
2395 return [check_no_compiler_messages arm32 assembly
{
2396 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
2397 #error
!__arm || __thumb__
&& !__thumb2__
2402 #
Return 1 if this is an arm target not using Thumb
2403 proc check_effective_target_arm_nothumb
{ } {
2404 if { ![istarget arm
*-*-*] } {
2408 return [check_no_compiler_messages arm_nothumb assembly
{
2409 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) || defined
(__thumb2__
))
2410 #error
!__arm__ || __thumb || __thumb2__
2415 #
Return 1 if this is a little
-endian ARM target
2416 proc check_effective_target_arm_little_endian
{ } {
2417 if { ![istarget arm
*-*-*] } {
2421 return [check_no_compiler_messages arm_little_endian assembly
{
2422 #
if !defined
(__arm__
) ||
!defined
(__ARMEL__
)
2423 #error
!__arm__ ||
!__ARMEL__
2428 #
Return 1 if this is an ARM target that only supports aligned vector accesses
2429 proc check_effective_target_arm_vect_no_misalign
{ } {
2430 if { ![istarget arm
*-*-*] } {
2434 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
2435 #
if !defined
(__arm__
) \
2436 ||
(defined
(__ARM_FEATURE_UNALIGNED
) \
2437 && defined
(__ARMEL__
))
2438 #error
!__arm__ ||
(__ARMEL__
&& __ARM_FEATURE_UNALIGNED
)
2444 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2445 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
2448 proc check_effective_target_arm_vfp_ok
{ } {
2449 if { [check_effective_target_arm32
] } {
2450 return [check_no_compiler_messages arm_vfp_ok object
{
2452 } "-mfpu=vfp -mfloat-abi=softfp"]
2458 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp3
2459 #
-mfloat
-abi
=softfp.
2461 proc check_effective_target_arm_vfp3_ok
{ } {
2462 if { [check_effective_target_arm32
] } {
2463 return [check_no_compiler_messages arm_vfp3_ok object
{
2465 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2471 #
Return 1 if this is an ARM target supporting
-mfpu
=fp
-armv8
2472 #
-mfloat
-abi
=softfp.
2473 proc check_effective_target_arm_v8_vfp_ok
{} {
2474 if { [check_effective_target_arm32
] } {
2475 return [check_no_compiler_messages arm_v8_vfp_ok object
{
2478 __asm__ volatile
("vrinta.f32.f32 s0, s0");
2481 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2487 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2488 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
2491 proc check_effective_target_arm_hard_vfp_ok
{ } {
2492 if { [check_effective_target_arm32
]
2493 && ! [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2494 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
2495 int main
() { return 0;}
2496 } "-mfpu=vfp -mfloat-abi=hard"]
2502 #
Return 1 if this is an ARM target that supports DSP multiply with
2503 # current multilib flags.
2505 proc check_effective_target_arm_dsp
{ } {
2506 return [check_no_compiler_messages arm_dsp assembly
{
2507 #ifndef __ARM_FEATURE_DSP
2514 #
Return 1 if this is an ARM target that supports unaligned word
/halfword
2515 #
load/store instructions.
2517 proc check_effective_target_arm_unaligned
{ } {
2518 return [check_no_compiler_messages arm_unaligned assembly
{
2519 #ifndef __ARM_FEATURE_UNALIGNED
2520 #error no unaligned support
2526 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2527 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2528 # incompatible with these options. Also
set et_arm_crypto_flags to the
2529 # best options to add.
2531 proc check_effective_target_arm_crypto_ok_nocache
{ } {
2532 global et_arm_crypto_flags
2533 set et_arm_crypto_flags
""
2534 if { [check_effective_target_arm32
] } {
2535 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2536 if { [check_no_compiler_messages_nocache arm_crypto_ok object
{
2537 #
include "arm_neon.h"
2539 foo
(uint8x16_t a
, uint8x16_t b
)
2541 return vaeseq_u8
(a
, b
);
2544 set et_arm_crypto_flags $flags
2553 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2555 proc check_effective_target_arm_crypto_ok
{ } {
2556 return [check_cached_effective_target arm_crypto_ok \
2557 check_effective_target_arm_crypto_ok_nocache
]
2560 # Add options
for crypto extensions.
2561 proc add_options_for_arm_crypto
{ flags
} {
2562 if { ! [check_effective_target_arm_crypto_ok
] } {
2565 global et_arm_crypto_flags
2566 return "$flags $et_arm_crypto_flags"
2569 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2570 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2571 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2572 # NEON
, do not add
-mfpu
=neon.
2574 proc add_options_for_arm_neon
{ flags
} {
2575 if { ! [check_effective_target_arm_neon_ok
] } {
2578 global et_arm_neon_flags
2579 return "$flags $et_arm_neon_flags"
2582 proc add_options_for_arm_v8_vfp
{ flags
} {
2583 if { ! [check_effective_target_arm_v8_vfp_ok
] } {
2586 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2589 proc add_options_for_arm_v8_neon
{ flags
} {
2590 if { ! [check_effective_target_arm_v8_neon_ok
] } {
2593 global et_arm_v8_neon_flags
2594 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2597 proc add_options_for_arm_crc
{ flags
} {
2598 if { ! [check_effective_target_arm_crc_ok
] } {
2601 global et_arm_crc_flags
2602 return "$flags $et_arm_crc_flags"
2605 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2606 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2607 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2608 # NEON
, do not add
-mfpu
=neon.
2610 proc add_options_for_arm_neonv2
{ flags
} {
2611 if { ! [check_effective_target_arm_neonv2_ok
] } {
2614 global et_arm_neonv2_flags
2615 return "$flags $et_arm_neonv2_flags"
2618 # Add the options needed
for vfp3.
2619 proc add_options_for_arm_vfp3
{ flags
} {
2620 if { ! [check_effective_target_arm_vfp3_ok
] } {
2623 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2626 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
2627 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2628 # incompatible with these options. Also
set et_arm_neon_flags to the
2629 # best options to add.
2631 proc check_effective_target_arm_neon_ok_nocache
{ } {
2632 global et_arm_neon_flags
2633 set et_arm_neon_flags
""
2634 if { [check_effective_target_arm32
] } {
2635 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2636 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
2637 #
include "arm_neon.h"
2639 /* Avoid the case where a test adds
-mfpu
=neon
, but the toolchain is
2640 configured
for -mcpu
=arm926ej
-s
, for example.
*/
2642 #error Architecture too old
for NEON.
2645 set et_arm_neon_flags $flags
2654 proc check_effective_target_arm_neon_ok
{ } {
2655 return [check_cached_effective_target arm_neon_ok \
2656 check_effective_target_arm_neon_ok_nocache
]
2659 proc check_effective_target_arm_crc_ok_nocache
{ } {
2660 global et_arm_crc_flags
2661 set et_arm_crc_flags
"-march=armv8-a+crc"
2662 return [check_no_compiler_messages_nocache arm_crc_ok object
{
2663 #
if !defined
(__ARM_FEATURE_CRC32
)
2666 } "$et_arm_crc_flags"]
2669 proc check_effective_target_arm_crc_ok
{ } {
2670 return [check_cached_effective_target arm_crc_ok \
2671 check_effective_target_arm_crc_ok_nocache
]
2674 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
2675 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2676 # incompatible with these options. Also
set et_arm_neon_flags to the
2677 # best options to add.
2679 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
2680 global et_arm_neon_fp16_flags
2681 set et_arm_neon_fp16_flags
""
2682 if { [check_effective_target_arm32
] } {
2683 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2684 "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
2685 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object
{
2686 #
include "arm_neon.h"
2688 foo
(float32x4_t
arg)
2690 return vcvt_f16_f32
(arg);
2693 set et_arm_neon_fp16_flags $flags
2702 proc check_effective_target_arm_neon_fp16_ok
{ } {
2703 return [check_cached_effective_target arm_neon_fp16_ok \
2704 check_effective_target_arm_neon_fp16_ok_nocache
]
2707 proc add_options_for_arm_neon_fp16
{ flags
} {
2708 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
2711 global et_arm_neon_fp16_flags
2712 return "$flags $et_arm_neon_fp16_flags"
2715 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp
-armv8
2716 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2717 # incompatible with these options. Also
set et_arm_v8_neon_flags to the
2718 # best options to add.
2720 proc check_effective_target_arm_v8_neon_ok_nocache
{ } {
2721 global et_arm_v8_neon_flags
2722 set et_arm_v8_neon_flags
""
2723 if { [check_effective_target_arm32
] } {
2724 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2725 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object
{
2727 #error not armv8 or later
2729 #
include "arm_neon.h"
2733 __asm__ volatile
("vrintn.f32 q0, q0");
2735 } "$flags -march=armv8-a"] } {
2736 set et_arm_v8_neon_flags $flags
2745 proc check_effective_target_arm_v8_neon_ok
{ } {
2746 return [check_cached_effective_target arm_v8_neon_ok \
2747 check_effective_target_arm_v8_neon_ok_nocache
]
2750 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-vfpv4
2751 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2752 # incompatible with these options. Also
set et_arm_neonv2_flags to the
2753 # best options to add.
2755 proc check_effective_target_arm_neonv2_ok_nocache
{ } {
2756 global et_arm_neonv2_flags
2757 set et_arm_neonv2_flags
""
2758 if { [check_effective_target_arm32
] } {
2759 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2760 if { [check_no_compiler_messages_nocache arm_neonv2_ok object
{
2761 #
include "arm_neon.h"
2763 foo
(float32x2_t a
, float32x2_t b
, float32x2_t c
)
2765 return vfma_f32
(a
, b
, c
);
2768 set et_arm_neonv2_flags $flags
2777 proc check_effective_target_arm_neonv2_ok
{ } {
2778 return [check_cached_effective_target arm_neonv2_ok \
2779 check_effective_target_arm_neonv2_ok_nocache
]
2782 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2783 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2786 proc add_options_for_arm_fp16
{ flags
} {
2787 if { ! [check_effective_target_arm_fp16_ok
] } {
2790 global et_arm_fp16_flags
2791 return "$flags $et_arm_fp16_flags"
2794 #
Return 1 if this is an ARM target that can support a VFP fp16 variant.
2795 # Skip multilibs that are incompatible with these options and
set
2796 # et_arm_fp16_flags to the best options to add.
2798 proc check_effective_target_arm_fp16_ok_nocache
{ } {
2799 global et_arm_fp16_flags
2800 set et_arm_fp16_flags
""
2801 if { ! [check_effective_target_arm32
] } {
2804 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2805 # Multilib flags would override
-mfpu.
2808 if [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2809 # Must generate floating
-point instructions.
2812 if [check_effective_target_arm_hf_eabi
] {
2813 # Use existing float
-abi and force an fpu which supports fp16
2814 set et_arm_fp16_flags
"-mfpu=vfpv4"
2817 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "" } ]] {
2818 # The existing
-mfpu value is OK
; use it
, but add softfp.
2819 set et_arm_fp16_flags
"-mfloat-abi=softfp"
2822 # Add
-mfpu
for a VFP fp16 variant since there is no preprocessor
2823 # macro to check
for this support.
2824 set flags
"-mfpu=vfpv4 -mfloat-abi=softfp"
2825 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly
{
2828 set et_arm_fp16_flags
"$flags"
2835 proc check_effective_target_arm_fp16_ok
{ } {
2836 return [check_cached_effective_target arm_fp16_ok \
2837 check_effective_target_arm_fp16_ok_nocache
]
2840 # Creates a series of routines that
return 1 if the given architecture
2841 # can be selected and a routine to give the flags to select that architecture
2842 # Note
: Extra flags may be added to disable options from newer compilers
2843 #
(Thumb in particular
- but others may be added in the future
)
2844 # Usage
: /* { dg
-require
-effective
-target arm_arch_v5_ok
} */
2845 #
/* { dg
-add
-options arm_arch_v5
} */
2846 #
/* { dg
-require
-effective
-target arm_arch_v5_multilib
} */
2847 foreach
{ armfunc armflag armdef
} { v4
"-march=armv4 -marm" __ARM_ARCH_4__
2848 v4t
"-march=armv4t" __ARM_ARCH_4T__
2849 v5
"-march=armv5 -marm" __ARM_ARCH_5__
2850 v5t
"-march=armv5t" __ARM_ARCH_5T__
2851 v5te
"-march=armv5te" __ARM_ARCH_5TE__
2852 v6
"-march=armv6" __ARM_ARCH_6__
2853 v6k
"-march=armv6k" __ARM_ARCH_6K__
2854 v6t2
"-march=armv6t2" __ARM_ARCH_6T2__
2855 v6z
"-march=armv6z" __ARM_ARCH_6Z__
2856 v6m
"-march=armv6-m -mthumb" __ARM_ARCH_6M__
2857 v7a
"-march=armv7-a" __ARM_ARCH_7A__
2858 v7ve
"-march=armv7ve" __ARM_ARCH_7A__
2859 v7r
"-march=armv7-r" __ARM_ARCH_7R__
2860 v7m
"-march=armv7-m -mthumb" __ARM_ARCH_7M__
2861 v7em
"-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2862 v8a
"-march=armv8-a" __ARM_ARCH_8A__ } {
2863 eval
[string map
[list FUNC $armfunc FLAG $armflag DEF $armdef
] {
2864 proc check_effective_target_arm_arch_FUNC_ok
{ } {
2865 if { [ string match
"*-marm*" "FLAG" ] &&
2866 ![check_effective_target_arm_arm_ok
] } {
2869 return [check_no_compiler_messages arm_arch_FUNC_ok assembly
{
2876 proc add_options_for_arm_arch_FUNC
{ flags
} {
2877 return "$flags FLAG"
2880 proc check_effective_target_arm_arch_FUNC_multilib
{ } {
2881 return [check_runtime arm_arch_FUNC_multilib
{
2887 } [add_options_for_arm_arch_FUNC
""]]
2892 #
Return 1 if this is an ARM target where
-marm causes ARM to be
2895 proc check_effective_target_arm_arm_ok
{ } {
2896 return [check_no_compiler_messages arm_arm_ok assembly
{
2897 #
if !defined
(__arm__
) || defined
(__thumb__
) || defined
(__thumb2__
)
2898 #error
!__arm__ || __thumb__ || __thumb2__
2904 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
2907 proc check_effective_target_arm_thumb1_ok
{ } {
2908 return [check_no_compiler_messages arm_thumb1_ok assembly
{
2909 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2910 #error
!__arm__ ||
!__thumb__ || __thumb2__
2912 int foo
(int i
) { return i
; }
2916 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
2919 proc check_effective_target_arm_thumb2_ok
{ } {
2920 return [check_no_compiler_messages arm_thumb2_ok assembly
{
2921 #
if !defined
(__thumb2__
)
2924 int foo
(int i
) { return i
; }
2928 #
Return 1 if this is an ARM target where Thumb
-1 is used without options
2929 # added by the test.
2931 proc check_effective_target_arm_thumb1
{ } {
2932 return [check_no_compiler_messages arm_thumb1 assembly
{
2933 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2934 #error
!__arm__ ||
!__thumb__ || __thumb2__
2940 #
Return 1 if this is an ARM target where Thumb
-2 is used without options
2941 # added by the test.
2943 proc check_effective_target_arm_thumb2
{ } {
2944 return [check_no_compiler_messages arm_thumb2 assembly
{
2945 #
if !defined
(__thumb2__
)
2952 #
Return 1 if this is an ARM target where conditional execution is available.
2954 proc check_effective_target_arm_cond_exec
{ } {
2955 return [check_no_compiler_messages arm_cond_exec assembly
{
2956 #
if defined
(__arm__
) && defined
(__thumb__
) && !defined
(__thumb2__
)
2963 #
Return 1 if this is an ARM cortex
-M profile cpu
2965 proc check_effective_target_arm_cortex_m
{ } {
2966 if { ![istarget arm
*-*-*] } {
2969 return [check_no_compiler_messages arm_cortex_m assembly
{
2970 #
if !defined
(__ARM_ARCH_7M__
) \
2971 && !defined
(__ARM_ARCH_7EM__
) \
2972 && !defined
(__ARM_ARCH_6M__
)
2973 #error
!__ARM_ARCH_7M__
&& !__ARM_ARCH_7EM__
&& !__ARM_ARCH_6M__
2979 #
Return 1 if this compilation turns
on string_ops_prefer_neon
on.
2981 proc check_effective_target_arm_tune_string_ops_prefer_neon
{ } {
2982 return [check_no_messages_and_pattern arm_tune_string_ops_prefer_neon
"@string_ops_prefer_neon:\t1" assembly {
2983 int foo
(void
) { return 0; }
2984 } "-O2 -mprint-tune-info" ]
2987 #
Return 1 if the target supports executing NEON instructions
, 0
2988 # otherwise.
Cache the result.
2990 proc check_effective_target_arm_neon_hw
{ } {
2991 return [check_runtime arm_neon_hw_available
{
2995 long long a
= 0, b
= 1;
2996 asm
("vorr %P0, %P1, %P2"
2998 : "0" (a), "w" (b));
3001 } [add_options_for_arm_neon
""]]
3004 proc check_effective_target_arm_neonv2_hw
{ } {
3005 return [check_runtime arm_neon_hwv2_available
{
3006 #
include "arm_neon.h"
3010 float32x2_t a
, b
, c
;
3011 asm
("vfma.f32 %P0, %P1, %P2"
3013 : "w" (b), "w" (c));
3016 } [add_options_for_arm_neonv2
""]]
3019 #
Return 1 if the target supports executing ARMv8 NEON instructions
, 0
3022 proc check_effective_target_arm_v8_neon_hw
{ } {
3023 return [check_runtime arm_v8_neon_hw_available
{
3024 #
include "arm_neon.h"
3029 asm
("vrinta.f32 %P0, %P1"
3034 } [add_options_for_arm_v8_neon
""]]
3037 #
Return 1 if this is a ARM target with NEON enabled.
3039 proc check_effective_target_arm_neon
{ } {
3040 if { [check_effective_target_arm32
] } {
3041 return [check_no_compiler_messages arm_neon object
{
3042 #ifndef __ARM_NEON__
3053 proc check_effective_target_arm_neonv2
{ } {
3054 if { [check_effective_target_arm32
] } {
3055 return [check_no_compiler_messages arm_neon object
{
3056 #ifndef __ARM_NEON__
3059 #ifndef __ARM_FEATURE_FMA
3071 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
3072 # the Loongson vector modes.
3074 proc check_effective_target_mips_loongson
{ } {
3075 return [check_no_compiler_messages loongson assembly
{
3076 #
if !defined
(__mips_loongson_vector_rev
)
3077 #error
!__mips_loongson_vector_rev
3082 #
Return 1 if this is a MIPS target that supports the legacy NAN.
3084 proc check_effective_target_mips_nanlegacy
{ } {
3085 return [check_no_compiler_messages nanlegacy assembly
{
3087 int main
() { return 0; }
3091 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
3094 proc check_effective_target_arm_eabi
{ } {
3095 return [check_no_compiler_messages arm_eabi object
{
3096 #ifndef __ARM_EABI__
3104 #
Return 1 if this is an ARM target that adheres to the hard
-float variant of
3105 # the ABI
for the ARM Architecture
(e.g.
-mfloat
-abi
=hard
).
3107 proc check_effective_target_arm_hf_eabi
{ } {
3108 return [check_no_compiler_messages arm_hf_eabi object
{
3109 #
if !defined
(__ARM_EABI__
) ||
!defined
(__ARM_PCS_VFP
)
3110 #error not hard
-float EABI
3117 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
3118 # Some multilibs may be incompatible with this option.
3120 proc check_effective_target_arm_iwmmxt_ok
{ } {
3121 if { [check_effective_target_arm32
] } {
3122 return [check_no_compiler_messages arm_iwmmxt_ok object
{
3130 #
Return true
if LDRD
/STRD instructions are prefered over LDM
/STM instructions
3131 #
for an ARM target.
3132 proc check_effective_target_arm_prefer_ldrd_strd
{ } {
3133 if { ![check_effective_target_arm32
] } {
3137 return [check_no_messages_and_pattern arm_prefer_ldrd_strd
"strd\tr" assembly {
3138 void foo
(int *p
) { p
[0] = 1; p
[1] = 0;}
3142 #
Return 1 if this is a PowerPC target supporting
-meabi.
3144 proc check_effective_target_powerpc_eabi_ok
{ } {
3145 if { [istarget powerpc
*-*-*] } {
3146 return [check_no_compiler_messages powerpc_eabi_ok object
{
3154 #
Return 1 if this is a PowerPC target with floating
-point registers.
3156 proc check_effective_target_powerpc_fprs
{ } {
3157 if { [istarget powerpc
*-*-*]
3158 ||
[istarget rs6000
-*-*] } {
3159 return [check_no_compiler_messages powerpc_fprs object
{
3171 #
Return 1 if this is a PowerPC target with hardware double
-precision
3174 proc check_effective_target_powerpc_hard_double
{ } {
3175 if { [istarget powerpc
*-*-*]
3176 ||
[istarget rs6000
-*-*] } {
3177 return [check_no_compiler_messages powerpc_hard_double object
{
3189 #
Return 1 if this is a PowerPC target supporting
-maltivec.
3191 proc check_effective_target_powerpc_altivec_ok
{ } {
3192 if { ([istarget powerpc
*-*-*]
3193 && ![istarget powerpc
-*-linux
*paired
*])
3194 ||
[istarget rs6000
-*-*] } {
3195 # AltiVec is not supported
on AIX before
5.3.
3196 if { [istarget powerpc
*-*-aix4
*]
3197 ||
[istarget powerpc
*-*-aix5.1
*]
3198 ||
[istarget powerpc
*-*-aix5.2
*] } {
3201 return [check_no_compiler_messages powerpc_altivec_ok object
{
3209 #
Return 1 if this is a PowerPC target supporting
-mpower8
-vector
3211 proc check_effective_target_powerpc_p8vector_ok
{ } {
3212 if { ([istarget powerpc
*-*-*]
3213 && ![istarget powerpc
-*-linux
*paired
*])
3214 ||
[istarget rs6000
-*-*] } {
3215 # AltiVec is not supported
on AIX before
5.3.
3216 if { [istarget powerpc
*-*-aix4
*]
3217 ||
[istarget powerpc
*-*-aix5.1
*]
3218 ||
[istarget powerpc
*-*-aix5.2
*] } {
3221 return [check_no_compiler_messages powerpc_p8vector_ok object
{
3224 asm volatile
("xxlorc vs0,vs0,vs0");
3226 asm volatile
("xxlorc 0,0,0");
3230 } "-mpower8-vector"]
3236 #
Return 1 if this is a PowerPC target supporting
-mvsx
3238 proc check_effective_target_powerpc_vsx_ok
{ } {
3239 if { ([istarget powerpc
*-*-*]
3240 && ![istarget powerpc
-*-linux
*paired
*])
3241 ||
[istarget rs6000
-*-*] } {
3242 # VSX is not supported
on AIX before
7.1.
3243 if { [istarget powerpc
*-*-aix4
*]
3244 ||
[istarget powerpc
*-*-aix5
*]
3245 ||
[istarget powerpc
*-*-aix6
*] } {
3248 return [check_no_compiler_messages powerpc_vsx_ok object
{
3251 asm volatile
("xxlor vs0,vs0,vs0");
3253 asm volatile
("xxlor 0,0,0");
3263 #
Return 1 if this is a PowerPC target supporting
-mhtm
3265 proc check_effective_target_powerpc_htm_ok
{ } {
3266 if { ([istarget powerpc
*-*-*]
3267 && ![istarget powerpc
-*-linux
*paired
*])
3268 ||
[istarget rs6000
-*-*] } {
3269 # HTM is not supported
on AIX yet.
3270 if { [istarget powerpc
*-*-aix
*] } {
3273 return [check_no_compiler_messages powerpc_htm_ok object
{
3275 asm volatile
("tbegin. 0");
3284 #
Return 1 if the target supports executing HTM hardware instructions
,
3285 #
0 otherwise.
Cache the result.
3287 proc check_htm_hw_available
{ } {
3288 return [check_cached_effective_target htm_hw_available
{
3289 #
For now
, disable
on Darwin
3290 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
3293 check_runtime_nocache htm_hw_available
{
3303 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
3305 proc check_effective_target_powerpc_ppu_ok
{ } {
3306 if [check_effective_target_powerpc_altivec_ok
] {
3307 return [check_no_compiler_messages cell_asm_available object
{
3310 asm volatile
("lvlx v0,v0,v0");
3312 asm volatile
("lvlx 0,0,0");
3322 #
Return 1 if this is a PowerPC target that supports SPU.
3324 proc check_effective_target_powerpc_spu
{ } {
3325 if { [istarget powerpc
*-*-linux
*] } {
3326 return [check_effective_target_powerpc_altivec_ok
]
3332 #
Return 1 if this is a PowerPC SPE target. The check includes options
3333 # specified by dg
-options
for this test
, so don
't cache the result.
3335 proc check_effective_target_powerpc_spe_nocache { } {
3336 if { [istarget powerpc*-*-*] } {
3337 return [check_no_compiler_messages_nocache powerpc_spe object {
3343 } [current_compiler_flags]]
3349 # Return 1 if this is a PowerPC target with SPE enabled.
3351 proc check_effective_target_powerpc_spe { } {
3352 if { [istarget powerpc*-*-*] } {
3353 return [check_no_compiler_messages powerpc_spe object {
3365 # Return 1 if this is a PowerPC target with Altivec enabled.
3367 proc check_effective_target_powerpc_altivec { } {
3368 if { [istarget powerpc*-*-*] } {
3369 return [check_no_compiler_messages powerpc_altivec object {
3381 # Return 1 if this is a PowerPC 405 target. The check includes options
3382 # specified by dg-options for this test, so don't
cache the result.
3384 proc check_effective_target_powerpc_405_nocache
{ } {
3385 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
3386 return [check_no_compiler_messages_nocache powerpc_405 object
{
3392 } [current_compiler_flags
]]
3398 #
Return 1 if this is a PowerPC target using the ELFv2 ABI.
3400 proc check_effective_target_powerpc_elfv2
{ } {
3401 if { [istarget powerpc
*-*-*] } {
3402 return [check_no_compiler_messages powerpc_elfv2 object
{
3404 #error not ELF v2 ABI
3414 #
Return 1 if this is a SPU target with a toolchain that
3415 # supports automatic overlay generation.
3417 proc check_effective_target_spu_auto_overlay
{ } {
3418 if { [istarget spu
*-*-elf
*] } {
3419 return [check_no_compiler_messages spu_auto_overlay executable
{
3421 } "-Wl,--auto-overlay" ]
3427 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3428 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
3429 # test environment appears to run executables
on such a simulator.
3431 proc check_effective_target_ultrasparc_hw
{ } {
3432 return [check_runtime ultrasparc_hw
{
3433 int main
() { return 0; }
3434 } "-mcpu=ultrasparc"]
3437 #
Return 1 if the test environment supports executing UltraSPARC VIS2
3438 # instructions. We check this by attempting
: "bmask %g0, %g0, %g0"
3440 proc check_effective_target_ultrasparc_vis2_hw
{ } {
3441 return [check_runtime ultrasparc_vis2_hw
{
3442 int main
() { __asm__
(".word 0x81b00320"); return 0; }
3443 } "-mcpu=ultrasparc3"]
3446 #
Return 1 if the test environment supports executing UltraSPARC VIS3
3447 # instructions. We check this by attempting
: "addxc %g0, %g0, %g0"
3449 proc check_effective_target_ultrasparc_vis3_hw
{ } {
3450 return [check_runtime ultrasparc_vis3_hw
{
3451 int main
() { __asm__
(".word 0x81b00220"); return 0; }
3455 #
Return 1 if this is a SPARC
-V9 target.
3457 proc check_effective_target_sparc_v9
{ } {
3458 if { [istarget sparc
*-*-*] } {
3459 return [check_no_compiler_messages sparc_v9 object
{
3461 asm volatile
("return %i7+8");
3470 #
Return 1 if this is a SPARC target with VIS enabled.
3472 proc check_effective_target_sparc_vis
{ } {
3473 if { [istarget sparc
*-*-*] } {
3474 return [check_no_compiler_messages sparc_vis object
{
3486 #
Return 1 if the target supports hardware vector shift operation.
3488 proc check_effective_target_vect_shift
{ } {
3489 global et_vect_shift_saved
3491 if [info exists et_vect_shift_saved
] {
3492 verbose
"check_effective_target_vect_shift: using cached result" 2
3494 set et_vect_shift_saved
0
3495 if { ([istarget powerpc
*-*-*]
3496 && ![istarget powerpc
-*-linux
*paired
*])
3497 ||
[istarget ia64
-*-*]
3498 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3499 ||
[istarget aarch64
*-*-*]
3500 ||
[check_effective_target_arm32
]
3501 ||
([istarget mips
*-*-*]
3502 && [check_effective_target_mips_loongson
]) } {
3503 set et_vect_shift_saved
1
3507 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3508 return $et_vect_shift_saved
3511 proc check_effective_target_whole_vector_shift
{ } {
3512 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3513 ||
[istarget ia64
-*-*]
3514 ||
[istarget aarch64
*-*-*]
3515 ||
([check_effective_target_arm32
]
3516 && [check_effective_target_arm_little_endian
])
3517 ||
([istarget mips
*-*-*]
3518 && [check_effective_target_mips_loongson
]) } {
3524 verbose
"check_effective_target_vect_long: returning $answer" 2
3528 #
Return 1 if the target supports vector bswap operations.
3530 proc check_effective_target_vect_bswap
{ } {
3531 global et_vect_bswap_saved
3533 if [info exists et_vect_bswap_saved
] {
3534 verbose
"check_effective_target_vect_bswap: using cached result" 2
3536 set et_vect_bswap_saved
0
3537 if { [istarget aarch64
*-*-*]
3538 ||
([istarget arm
*-*-*]
3539 && [check_effective_target_arm_neon
])
3541 set et_vect_bswap_saved
1
3545 verbose
"check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
3546 return $et_vect_bswap_saved
3549 #
Return 1 if the target supports hardware vector shift operation
for char.
3551 proc check_effective_target_vect_shift_char
{ } {
3552 global et_vect_shift_char_saved
3554 if [info exists et_vect_shift_char_saved
] {
3555 verbose
"check_effective_target_vect_shift_char: using cached result" 2
3557 set et_vect_shift_char_saved
0
3558 if { ([istarget powerpc
*-*-*]
3559 && ![istarget powerpc
-*-linux
*paired
*])
3560 ||
[check_effective_target_arm32
] } {
3561 set et_vect_shift_char_saved
1
3565 verbose
"check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3566 return $et_vect_shift_char_saved
3569 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
3571 # This can change
for different subtargets so
do not
cache the result.
3573 proc check_effective_target_vect_long
{ } {
3574 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3575 ||
(([istarget powerpc
*-*-*]
3576 && ![istarget powerpc
-*-linux
*paired
*])
3577 && [check_effective_target_ilp32
])
3578 ||
[check_effective_target_arm32
]
3579 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
3585 verbose
"check_effective_target_vect_long: returning $answer" 2
3589 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
3591 # This won
't change for different subtargets so cache the result.
3593 proc check_effective_target_vect_float { } {
3594 global et_vect_float_saved
3596 if [info exists et_vect_float_saved] {
3597 verbose "check_effective_target_vect_float: using cached result" 2
3599 set et_vect_float_saved 0
3600 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
3601 || [istarget powerpc*-*-*]
3602 || [istarget spu-*-*]
3603 || [istarget mips-sde-elf]
3604 || [istarget mipsisa64*-*-*]
3605 || [istarget ia64-*-*]
3606 || [istarget aarch64*-*-*]
3607 || [check_effective_target_arm32] } {
3608 set et_vect_float_saved 1
3612 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
3613 return $et_vect_float_saved
3616 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
3618 # This won't change
for different subtargets so
cache the result.
3620 proc check_effective_target_vect_double
{ } {
3621 global et_vect_double_saved
3623 if [info exists et_vect_double_saved
] {
3624 verbose
"check_effective_target_vect_double: using cached result" 2
3626 set et_vect_double_saved
0
3627 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3628 ||
[istarget aarch64
*-*-*] } {
3629 if { [check_no_compiler_messages vect_double assembly
{
3630 #ifdef __tune_atom__
3631 # error No double vectorizer support.
3634 set et_vect_double_saved
1
3636 set et_vect_double_saved
0
3638 } elseif
{ [istarget spu
-*-*] } {
3639 set et_vect_double_saved
1
3643 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
3644 return $et_vect_double_saved
3647 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
3649 # This won
't change for different subtargets so cache the result.
3651 proc check_effective_target_vect_long_long { } {
3652 global et_vect_long_long_saved
3654 if [info exists et_vect_long_long_saved] {
3655 verbose "check_effective_target_vect_long_long: using cached result" 2
3657 set et_vect_long_long_saved 0
3658 if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
3659 set et_vect_long_long_saved 1
3663 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3664 return $et_vect_long_long_saved
3668 # Return 1 if the target plus current options does not support a vector
3669 # max instruction on "int", 0 otherwise.
3671 # This won't change
for different subtargets so
cache the result.
3673 proc check_effective_target_vect_no_int_max
{ } {
3674 global et_vect_no_int_max_saved
3676 if [info exists et_vect_no_int_max_saved
] {
3677 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
3679 set et_vect_no_int_max_saved
0
3680 if { [istarget sparc
*-*-*]
3681 ||
[istarget spu
-*-*]
3682 ||
[istarget alpha
*-*-*]
3683 ||
([istarget mips
*-*-*]
3684 && [check_effective_target_mips_loongson
]) } {
3685 set et_vect_no_int_max_saved
1
3688 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3689 return $et_vect_no_int_max_saved
3692 #
Return 1 if the target plus current options does not support a vector
3693 # add instruction
on "int", 0 otherwise.
3695 # This won
't change for different subtargets so cache the result.
3697 proc check_effective_target_vect_no_int_add { } {
3698 global et_vect_no_int_add_saved
3700 if [info exists et_vect_no_int_add_saved] {
3701 verbose "check_effective_target_vect_no_int_add: using cached result" 2
3703 set et_vect_no_int_add_saved 0
3704 # Alpha only supports vector add on V8QI and V4HI.
3705 if { [istarget alpha*-*-*] } {
3706 set et_vect_no_int_add_saved 1
3709 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3710 return $et_vect_no_int_add_saved
3713 # Return 1 if the target plus current options does not support vector
3714 # bitwise instructions, 0 otherwise.
3716 # This won't change
for different subtargets so
cache the result.
3718 proc check_effective_target_vect_no_bitwise
{ } {
3719 global et_vect_no_bitwise_saved
3721 if [info exists et_vect_no_bitwise_saved
] {
3722 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
3724 set et_vect_no_bitwise_saved
0
3726 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3727 return $et_vect_no_bitwise_saved
3730 #
Return 1 if the target plus current options supports vector permutation
,
3733 # This won
't change for different subtargets so cache the result.
3735 proc check_effective_target_vect_perm { } {
3738 if [info exists et_vect_perm_saved] {
3739 verbose "check_effective_target_vect_perm: using cached result" 2
3741 set et_vect_perm_saved 0
3742 if { [is-effective-target arm_neon_ok]
3743 || [istarget aarch64*-*-*]
3744 || [istarget powerpc*-*-*]
3745 || [istarget spu-*-*]
3746 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3747 || ([istarget mips*-*-*]
3748 && [check_effective_target_mpaired_single]) } {
3749 set et_vect_perm_saved 1
3752 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3753 return $et_vect_perm_saved
3756 # Return 1 if the target plus current options supports vector permutation
3757 # on byte-sized elements, 0 otherwise.
3759 # This won't change
for different subtargets so
cache the result.
3761 proc check_effective_target_vect_perm_byte
{ } {
3762 global et_vect_perm_byte
3764 if [info exists et_vect_perm_byte_saved
] {
3765 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
3767 set et_vect_perm_byte_saved
0
3768 if { ([is
-effective
-target arm_neon_ok
]
3769 && [is
-effective
-target arm_little_endian
])
3770 ||
([istarget aarch64
*-*-*]
3771 && [is
-effective
-target aarch64_little_endian
])
3772 ||
[istarget powerpc
*-*-*]
3773 ||
[istarget spu
-*-*] } {
3774 set et_vect_perm_byte_saved
1
3777 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3778 return $et_vect_perm_byte_saved
3781 #
Return 1 if the target plus current options supports vector permutation
3782 #
on short
-sized elements
, 0 otherwise.
3784 # This won
't change for different subtargets so cache the result.
3786 proc check_effective_target_vect_perm_short { } {
3787 global et_vect_perm_short
3789 if [info exists et_vect_perm_short_saved] {
3790 verbose "check_effective_target_vect_perm_short: using cached result" 2
3792 set et_vect_perm_short_saved 0
3793 if { ([is-effective-target arm_neon_ok]
3794 && [is-effective-target arm_little_endian])
3795 || ([istarget aarch64*-*-*]
3796 && [is-effective-target aarch64_little_endian])
3797 || [istarget powerpc*-*-*]
3798 || [istarget spu-*-*] } {
3799 set et_vect_perm_short_saved 1
3802 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3803 return $et_vect_perm_short_saved
3806 # Return 1 if the target plus current options supports a vector
3807 # widening summation of *short* args into *int* result, 0 otherwise.
3809 # This won't change
for different subtargets so
cache the result.
3811 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
3812 global et_vect_widen_sum_hi_to_si_pattern
3814 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
3815 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3817 set et_vect_widen_sum_hi_to_si_pattern_saved
0
3818 if { [istarget powerpc
*-*-*]
3819 ||
[istarget ia64
-*-*] } {
3820 set et_vect_widen_sum_hi_to_si_pattern_saved
1
3823 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3824 return $et_vect_widen_sum_hi_to_si_pattern_saved
3827 #
Return 1 if the target plus current options supports a vector
3828 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3829 # A target can also support this widening summation
if it can support
3830 # promotion
(unpacking
) from shorts to ints.
3832 # This won
't change for different subtargets so cache the result.
3834 proc check_effective_target_vect_widen_sum_hi_to_si { } {
3835 global et_vect_widen_sum_hi_to_si
3837 if [info exists et_vect_widen_sum_hi_to_si_saved] {
3838 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3840 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
3841 if { [istarget powerpc*-*-*]
3842 || [istarget ia64-*-*] } {
3843 set et_vect_widen_sum_hi_to_si_saved 1
3846 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3847 return $et_vect_widen_sum_hi_to_si_saved
3850 # Return 1 if the target plus current options supports a vector
3851 # widening summation of *char* args into *short* result, 0 otherwise.
3852 # A target can also support this widening summation if it can support
3853 # promotion (unpacking) from chars to shorts.
3855 # This won't change
for different subtargets so
cache the result.
3857 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
3858 global et_vect_widen_sum_qi_to_hi
3860 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
3861 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3863 set et_vect_widen_sum_qi_to_hi_saved
0
3864 if { [check_effective_target_vect_unpack
]
3865 ||
[check_effective_target_arm_neon_ok
]
3866 ||
[istarget ia64
-*-*] } {
3867 set et_vect_widen_sum_qi_to_hi_saved
1
3870 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3871 return $et_vect_widen_sum_qi_to_hi_saved
3874 #
Return 1 if the target plus current options supports a vector
3875 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
3877 # This won
't change for different subtargets so cache the result.
3879 proc check_effective_target_vect_widen_sum_qi_to_si { } {
3880 global et_vect_widen_sum_qi_to_si
3882 if [info exists et_vect_widen_sum_qi_to_si_saved] {
3883 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3885 set et_vect_widen_sum_qi_to_si_saved 0
3886 if { [istarget powerpc*-*-*] } {
3887 set et_vect_widen_sum_qi_to_si_saved 1
3890 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3891 return $et_vect_widen_sum_qi_to_si_saved
3894 # Return 1 if the target plus current options supports a vector
3895 # widening multiplication of *char* args into *short* result, 0 otherwise.
3896 # A target can also support this widening multplication if it can support
3897 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
3898 # multiplication of shorts).
3900 # This won't change
for different subtargets so
cache the result.
3903 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
3904 global et_vect_widen_mult_qi_to_hi
3906 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
3907 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3909 if { [check_effective_target_vect_unpack
]
3910 && [check_effective_target_vect_short_mult
] } {
3911 set et_vect_widen_mult_qi_to_hi_saved
1
3913 set et_vect_widen_mult_qi_to_hi_saved
0
3915 if { [istarget powerpc
*-*-*]
3916 ||
[istarget aarch64
*-*-*]
3917 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3918 set et_vect_widen_mult_qi_to_hi_saved
1
3921 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3922 return $et_vect_widen_mult_qi_to_hi_saved
3925 #
Return 1 if the target plus current options supports a vector
3926 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3927 # A target can also support this widening multplication
if it can support
3928 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
3929 # multiplication of ints
).
3931 # This won
't change for different subtargets so cache the result.
3934 proc check_effective_target_vect_widen_mult_hi_to_si { } {
3935 global et_vect_widen_mult_hi_to_si
3937 if [info exists et_vect_widen_mult_hi_to_si_saved] {
3938 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3940 if { [check_effective_target_vect_unpack]
3941 && [check_effective_target_vect_int_mult] } {
3942 set et_vect_widen_mult_hi_to_si_saved 1
3944 set et_vect_widen_mult_hi_to_si_saved 0
3946 if { [istarget powerpc*-*-*]
3947 || [istarget spu-*-*]
3948 || [istarget ia64-*-*]
3949 || [istarget aarch64*-*-*]
3950 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3951 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3952 set et_vect_widen_mult_hi_to_si_saved 1
3955 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3956 return $et_vect_widen_mult_hi_to_si_saved
3959 # Return 1 if the target plus current options supports a vector
3960 # widening multiplication of *char* args into *short* result, 0 otherwise.
3962 # This won't change
for different subtargets so
cache the result.
3964 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern
{ } {
3965 global et_vect_widen_mult_qi_to_hi_pattern
3967 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved
] {
3968 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3970 set et_vect_widen_mult_qi_to_hi_pattern_saved
0
3971 if { [istarget powerpc
*-*-*]
3972 ||
([istarget arm
*-*-*]
3973 && [check_effective_target_arm_neon_ok
]
3974 && [check_effective_target_arm_little_endian
]) } {
3975 set et_vect_widen_mult_qi_to_hi_pattern_saved
1
3978 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3979 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3982 #
Return 1 if the target plus current options supports a vector
3983 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3985 # This won
't change for different subtargets so cache the result.
3987 proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
3988 global et_vect_widen_mult_hi_to_si_pattern
3990 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved] {
3991 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3993 set et_vect_widen_mult_hi_to_si_pattern_saved 0
3994 if { [istarget powerpc*-*-*]
3995 || [istarget spu-*-*]
3996 || [istarget ia64-*-*]
3997 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3998 || ([istarget arm*-*-*]
3999 && [check_effective_target_arm_neon_ok]
4000 && [check_effective_target_arm_little_endian]) } {
4001 set et_vect_widen_mult_hi_to_si_pattern_saved 1
4004 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
4005 return $et_vect_widen_mult_hi_to_si_pattern_saved
4008 # Return 1 if the target plus current options supports a vector
4009 # widening multiplication of *int* args into *long* result, 0 otherwise.
4011 # This won't change
for different subtargets so
cache the result.
4013 proc check_effective_target_vect_widen_mult_si_to_di_pattern
{ } {
4014 global et_vect_widen_mult_si_to_di_pattern
4016 if [info exists et_vect_widen_mult_si_to_di_pattern_saved
] {
4017 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
4019 set et_vect_widen_mult_si_to_di_pattern_saved
0
4020 if {[istarget ia64
-*-*]
4021 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
4022 set et_vect_widen_mult_si_to_di_pattern_saved
1
4025 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
4026 return $et_vect_widen_mult_si_to_di_pattern_saved
4029 #
Return 1 if the target plus current options supports a vector
4030 # widening shift
, 0 otherwise.
4032 # This won
't change for different subtargets so cache the result.
4034 proc check_effective_target_vect_widen_shift { } {
4035 global et_vect_widen_shift_saved
4037 if [info exists et_vect_shift_saved] {
4038 verbose "check_effective_target_vect_widen_shift: using cached result" 2
4040 set et_vect_widen_shift_saved 0
4041 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4042 set et_vect_widen_shift_saved 1
4045 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
4046 return $et_vect_widen_shift_saved
4049 # Return 1 if the target plus current options supports a vector
4050 # dot-product of signed chars, 0 otherwise.
4052 # This won't change
for different subtargets so
cache the result.
4054 proc check_effective_target_vect_sdot_qi
{ } {
4055 global et_vect_sdot_qi
4057 if [info exists et_vect_sdot_qi_saved
] {
4058 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
4060 set et_vect_sdot_qi_saved
0
4061 if { [istarget ia64
-*-*] } {
4062 set et_vect_udot_qi_saved
1
4065 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
4066 return $et_vect_sdot_qi_saved
4069 #
Return 1 if the target plus current options supports a vector
4070 # dot
-product of unsigned chars
, 0 otherwise.
4072 # This won
't change for different subtargets so cache the result.
4074 proc check_effective_target_vect_udot_qi { } {
4075 global et_vect_udot_qi
4077 if [info exists et_vect_udot_qi_saved] {
4078 verbose "check_effective_target_vect_udot_qi: using cached result" 2
4080 set et_vect_udot_qi_saved 0
4081 if { [istarget powerpc*-*-*]
4082 || [istarget ia64-*-*] } {
4083 set et_vect_udot_qi_saved 1
4086 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
4087 return $et_vect_udot_qi_saved
4090 # Return 1 if the target plus current options supports a vector
4091 # dot-product of signed shorts, 0 otherwise.
4093 # This won't change
for different subtargets so
cache the result.
4095 proc check_effective_target_vect_sdot_hi
{ } {
4096 global et_vect_sdot_hi
4098 if [info exists et_vect_sdot_hi_saved
] {
4099 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
4101 set et_vect_sdot_hi_saved
0
4102 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4103 ||
[istarget ia64
-*-*]
4104 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
4105 set et_vect_sdot_hi_saved
1
4108 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
4109 return $et_vect_sdot_hi_saved
4112 #
Return 1 if the target plus current options supports a vector
4113 # dot
-product of unsigned shorts
, 0 otherwise.
4115 # This won
't change for different subtargets so cache the result.
4117 proc check_effective_target_vect_udot_hi { } {
4118 global et_vect_udot_hi
4120 if [info exists et_vect_udot_hi_saved] {
4121 verbose "check_effective_target_vect_udot_hi: using cached result" 2
4123 set et_vect_udot_hi_saved 0
4124 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
4125 set et_vect_udot_hi_saved 1
4128 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
4129 return $et_vect_udot_hi_saved
4132 # Return 1 if the target plus current options supports a vector
4133 # sad operation of unsigned chars, 0 otherwise.
4135 # This won't change
for different subtargets so
cache the result.
4137 proc check_effective_target_vect_usad_char
{ } {
4138 global et_vect_usad_char
4140 if [info exists et_vect_usad_char_saved
] {
4141 verbose
"check_effective_target_vect_usad_char: using cached result" 2
4143 set et_vect_usad_char_saved
0
4144 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) } {
4145 set et_vect_usad_char_saved
1
4148 verbose
"check_effective_target_vect_usad_char: returning $et_vect_usad_char_saved" 2
4149 return $et_vect_usad_char_saved
4152 #
Return 1 if the target plus current options supports a vector
4153 # demotion
(packing
) of shorts
(to chars
) and ints
(to shorts
)
4154 # using modulo arithmetic
, 0 otherwise.
4156 # This won
't change for different subtargets so cache the result.
4158 proc check_effective_target_vect_pack_trunc { } {
4159 global et_vect_pack_trunc
4161 if [info exists et_vect_pack_trunc_saved] {
4162 verbose "check_effective_target_vect_pack_trunc: using cached result" 2
4164 set et_vect_pack_trunc_saved 0
4165 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4166 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4167 || [istarget aarch64*-*-*]
4168 || [istarget spu-*-*]
4169 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
4170 && [check_effective_target_arm_little_endian]) } {
4171 set et_vect_pack_trunc_saved 1
4174 verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
4175 return $et_vect_pack_trunc_saved
4178 # Return 1 if the target plus current options supports a vector
4179 # promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
4181 # This won't change
for different subtargets so
cache the result.
4183 proc check_effective_target_vect_unpack
{ } {
4184 global et_vect_unpack
4186 if [info exists et_vect_unpack_saved
] {
4187 verbose
"check_effective_target_vect_unpack: using cached result" 2
4189 set et_vect_unpack_saved
0
4190 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*paired
*])
4191 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
4192 ||
[istarget spu
-*-*]
4193 ||
[istarget ia64
-*-*]
4194 ||
[istarget aarch64
*-*-*]
4195 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
4196 && [check_effective_target_arm_little_endian
]) } {
4197 set et_vect_unpack_saved
1
4200 verbose
"check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
4201 return $et_vect_unpack_saved
4204 #
Return 1 if the target plus current options does not guarantee
4205 # that its STACK_BOUNDARY is
>= the reguired vector alignment.
4207 # This won
't change for different subtargets so cache the result.
4209 proc check_effective_target_unaligned_stack { } {
4210 global et_unaligned_stack_saved
4212 if [info exists et_unaligned_stack_saved] {
4213 verbose "check_effective_target_unaligned_stack: using cached result" 2
4215 set et_unaligned_stack_saved 0
4217 verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
4218 return $et_unaligned_stack_saved
4221 # Return 1 if the target plus current options does not support a vector
4222 # alignment mechanism, 0 otherwise.
4224 # This won't change
for different subtargets so
cache the result.
4226 proc check_effective_target_vect_no_align
{ } {
4227 global et_vect_no_align_saved
4229 if [info exists et_vect_no_align_saved
] {
4230 verbose
"check_effective_target_vect_no_align: using cached result" 2
4232 set et_vect_no_align_saved
0
4233 if { [istarget mipsisa64
*-*-*]
4234 ||
[istarget mips
-sde
-elf
]
4235 ||
[istarget sparc
*-*-*]
4236 ||
[istarget ia64
-*-*]
4237 ||
[check_effective_target_arm_vect_no_misalign
]
4238 ||
([istarget powerpc
*-*-*] && [check_p8vector_hw_available
])
4239 ||
([istarget mips
*-*-*]
4240 && [check_effective_target_mips_loongson
]) } {
4241 set et_vect_no_align_saved
1
4244 verbose
"check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
4245 return $et_vect_no_align_saved
4248 #
Return 1 if the target supports a vector misalign access
, 0 otherwise.
4250 # This won
't change for different subtargets so cache the result.
4252 proc check_effective_target_vect_hw_misalign { } {
4253 global et_vect_hw_misalign_saved
4255 if [info exists et_vect_hw_misalign_saved] {
4256 verbose "check_effective_target_vect_hw_misalign: using cached result" 2
4258 set et_vect_hw_misalign_saved 0
4259 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4260 || ([istarget powerpc*-*-*] && [check_p8vector_hw_available])
4261 || [istarget aarch64*-*-*] } {
4262 set et_vect_hw_misalign_saved 1
4265 verbose "check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
4266 return $et_vect_hw_misalign_saved
4270 # Return 1 if arrays are aligned to the vector alignment
4271 # boundary, 0 otherwise.
4273 # This won't change
for different subtargets so
cache the result.
4275 proc check_effective_target_vect_aligned_arrays
{ } {
4276 global et_vect_aligned_arrays
4278 if [info exists et_vect_aligned_arrays_saved
] {
4279 verbose
"check_effective_target_vect_aligned_arrays: using cached result" 2
4281 set et_vect_aligned_arrays_saved
0
4282 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
4283 if { ([is
-effective
-target lp64
]
4284 && ( ![check_avx_available
]
4285 ||
[check_prefer_avx128
])) } {
4286 set et_vect_aligned_arrays_saved
1
4289 if [istarget spu
-*-*] {
4290 set et_vect_aligned_arrays_saved
1
4293 verbose
"check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
4294 return $et_vect_aligned_arrays_saved
4297 #
Return 1 if types of size
32 bit or less are naturally aligned
4298 #
(aligned to their type
-size
), 0 otherwise.
4300 # This won
't change for different subtargets so cache the result.
4302 proc check_effective_target_natural_alignment_32 { } {
4303 global et_natural_alignment_32
4305 if [info exists et_natural_alignment_32_saved] {
4306 verbose "check_effective_target_natural_alignment_32: using cached result" 2
4308 # FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
4309 set et_natural_alignment_32_saved 1
4310 if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
4311 set et_natural_alignment_32_saved 0
4314 verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4315 return $et_natural_alignment_32_saved
4318 # Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
4319 # type-size), 0 otherwise.
4321 # This won't change
for different subtargets so
cache the result.
4323 proc check_effective_target_natural_alignment_64
{ } {
4324 global et_natural_alignment_64
4326 if [info exists et_natural_alignment_64_saved
] {
4327 verbose
"check_effective_target_natural_alignment_64: using cached result" 2
4329 set et_natural_alignment_64_saved
0
4330 if { ([is
-effective
-target lp64
] && ![istarget
*-*-darwin
*])
4331 ||
[istarget spu
-*-*] } {
4332 set et_natural_alignment_64_saved
1
4335 verbose
"check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4336 return $et_natural_alignment_64_saved
4339 #
Return 1 if all vector types are naturally aligned
(aligned to their
4340 # type
-size
), 0 otherwise.
4342 # This won
't change for different subtargets so cache the result.
4344 proc check_effective_target_vect_natural_alignment { } {
4345 global et_vect_natural_alignment
4347 if [info exists et_vect_natural_alignment_saved] {
4348 verbose "check_effective_target_vect_natural_alignment: using cached result" 2
4350 set et_vect_natural_alignment_saved 1
4351 if { [check_effective_target_arm_eabi]
4352 || [istarget nvptx-*-*] } {
4353 set et_vect_natural_alignment_saved 0
4356 verbose "check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4357 return $et_vect_natural_alignment_saved
4360 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
4362 # This won't change
for different subtargets so
cache the result.
4364 proc check_effective_target_vector_alignment_reachable
{ } {
4365 global et_vector_alignment_reachable
4367 if [info exists et_vector_alignment_reachable_saved
] {
4368 verbose
"check_effective_target_vector_alignment_reachable: using cached result" 2
4370 if { [check_effective_target_vect_aligned_arrays
]
4371 ||
[check_effective_target_natural_alignment_32
] } {
4372 set et_vector_alignment_reachable_saved
1
4374 set et_vector_alignment_reachable_saved
0
4377 verbose
"check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4378 return $et_vector_alignment_reachable_saved
4381 #
Return 1 if vector alignment
for 64 bit is reachable
, 0 otherwise.
4383 # This won
't change for different subtargets so cache the result.
4385 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
4386 global et_vector_alignment_reachable_for_64bit
4388 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
4389 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4391 if { [check_effective_target_vect_aligned_arrays]
4392 || [check_effective_target_natural_alignment_64] } {
4393 set et_vector_alignment_reachable_for_64bit_saved 1
4395 set et_vector_alignment_reachable_for_64bit_saved 0
4398 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4399 return $et_vector_alignment_reachable_for_64bit_saved
4402 # Return 1 if the target only requires element alignment for vector accesses
4404 proc check_effective_target_vect_element_align { } {
4405 global et_vect_element_align
4407 if [info exists et_vect_element_align] {
4408 verbose "check_effective_target_vect_element_align: using cached result" 2
4410 set et_vect_element_align 0
4411 if { ([istarget arm*-*-*]
4412 && ![check_effective_target_arm_vect_no_misalign])
4413 || [check_effective_target_vect_hw_misalign] } {
4414 set et_vect_element_align 1
4418 verbose "check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4419 return $et_vect_element_align
4422 # Return 1 if the target supports vector conditional operations, 0 otherwise.
4424 proc check_effective_target_vect_condition { } {
4425 global et_vect_cond_saved
4427 if [info exists et_vect_cond_saved] {
4428 verbose "check_effective_target_vect_cond: using cached result" 2
4430 set et_vect_cond_saved 0
4431 if { [istarget aarch64*-*-*]
4432 || [istarget powerpc*-*-*]
4433 || [istarget ia64-*-*]
4434 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4435 || [istarget spu-*-*]
4436 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4437 set et_vect_cond_saved 1
4441 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4442 return $et_vect_cond_saved
4445 # Return 1 if the target supports vector conditional operations where
4446 # the comparison has different type from the lhs, 0 otherwise.
4448 proc check_effective_target_vect_cond_mixed { } {
4449 global et_vect_cond_mixed_saved
4451 if [info exists et_vect_cond_mixed_saved] {
4452 verbose "check_effective_target_vect_cond_mixed: using cached result" 2
4454 set et_vect_cond_mixed_saved 0
4455 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4456 || [istarget powerpc*-*-*] } {
4457 set et_vect_cond_mixed_saved 1
4461 verbose "check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4462 return $et_vect_cond_mixed_saved
4465 # Return 1 if the target supports vector char multiplication, 0 otherwise.
4467 proc check_effective_target_vect_char_mult { } {
4468 global et_vect_char_mult_saved
4470 if [info exists et_vect_char_mult_saved] {
4471 verbose "check_effective_target_vect_char_mult: using cached result" 2
4473 set et_vect_char_mult_saved 0
4474 if { [istarget aarch64*-*-*]
4475 || [istarget ia64-*-*]
4476 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4477 || [check_effective_target_arm32] } {
4478 set et_vect_char_mult_saved 1
4482 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4483 return $et_vect_char_mult_saved
4486 # Return 1 if the target supports vector short multiplication, 0 otherwise.
4488 proc check_effective_target_vect_short_mult { } {
4489 global et_vect_short_mult_saved
4491 if [info exists et_vect_short_mult_saved] {
4492 verbose "check_effective_target_vect_short_mult: using cached result" 2
4494 set et_vect_short_mult_saved 0
4495 if { [istarget ia64-*-*]
4496 || [istarget spu-*-*]
4497 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4498 || [istarget powerpc*-*-*]
4499 || [istarget aarch64*-*-*]
4500 || [check_effective_target_arm32]
4501 || ([istarget mips*-*-*]
4502 && [check_effective_target_mips_loongson]) } {
4503 set et_vect_short_mult_saved 1
4507 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4508 return $et_vect_short_mult_saved
4511 # Return 1 if the target supports vector int multiplication, 0 otherwise.
4513 proc check_effective_target_vect_int_mult { } {
4514 global et_vect_int_mult_saved
4516 if [info exists et_vect_int_mult_saved] {
4517 verbose "check_effective_target_vect_int_mult: using cached result" 2
4519 set et_vect_int_mult_saved 0
4520 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4521 || [istarget spu-*-*]
4522 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4523 || [istarget ia64-*-*]
4524 || [istarget aarch64*-*-*]
4525 || [check_effective_target_arm32] } {
4526 set et_vect_int_mult_saved 1
4530 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4531 return $et_vect_int_mult_saved
4534 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
4536 proc check_effective_target_vect_extract_even_odd { } {
4537 global et_vect_extract_even_odd_saved
4539 if [info exists et_vect_extract_even_odd_saved] {
4540 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
4542 set et_vect_extract_even_odd_saved 0
4543 if { [istarget aarch64*-*-*]
4544 || [istarget powerpc*-*-*]
4545 || [is-effective-target arm_neon_ok]
4546 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4547 || [istarget ia64-*-*]
4548 || [istarget spu-*-*]
4549 || ([istarget mips*-*-*]
4550 && [check_effective_target_mpaired_single]) } {
4551 set et_vect_extract_even_odd_saved 1
4555 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4556 return $et_vect_extract_even_odd_saved
4559 # Return 1 if the target supports vector interleaving, 0 otherwise.
4561 proc check_effective_target_vect_interleave { } {
4562 global et_vect_interleave_saved
4564 if [info exists et_vect_interleave_saved] {
4565 verbose "check_effective_target_vect_interleave: using cached result" 2
4567 set et_vect_interleave_saved 0
4568 if { [istarget aarch64*-*-*]
4569 || [istarget powerpc*-*-*]
4570 || [is-effective-target arm_neon_ok]
4571 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4572 || [istarget ia64-*-*]
4573 || [istarget spu-*-*]
4574 || ([istarget mips*-*-*]
4575 && [check_effective_target_mpaired_single]) } {
4576 set et_vect_interleave_saved 1
4580 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4581 return $et_vect_interleave_saved
4584 foreach N {2 3 4 8} {
4585 eval [string map [list N $N] {
4586 # Return 1 if the target supports 2-vector interleaving
4587 proc check_effective_target_vect_stridedN { } {
4588 global et_vect_stridedN_saved
4590 if [info exists et_vect_stridedN_saved] {
4591 verbose "check_effective_target_vect_stridedN: using cached result" 2
4593 set et_vect_stridedN_saved 0
4595 && [check_effective_target_vect_interleave]
4596 && [check_effective_target_vect_extract_even_odd] } {
4597 set et_vect_stridedN_saved 1
4599 if { ([istarget arm*-*-*]
4600 || [istarget aarch64*-*-*]) && N >= 2 && N <= 4 } {
4601 set et_vect_stridedN_saved 1
4605 verbose "check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4606 return $et_vect_stridedN_saved
4611 # Return 1 if the target supports multiple vector sizes
4613 proc check_effective_target_vect_multiple_sizes { } {
4614 global et_vect_multiple_sizes_saved
4616 set et_vect_multiple_sizes_saved 0
4617 if { ([istarget aarch64*-*-*]
4618 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])) } {
4619 set et_vect_multiple_sizes_saved 1
4621 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4622 if { ([check_avx_available] && ![check_prefer_avx128]) } {
4623 set et_vect_multiple_sizes_saved 1
4627 verbose "check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4628 return $et_vect_multiple_sizes_saved
4631 # Return 1 if the target supports vectors of 64 bits.
4633 proc check_effective_target_vect64 { } {
4634 global et_vect64_saved
4636 if [info exists et_vect64_saved] {
4637 verbose "check_effective_target_vect64: using cached result" 2
4639 set et_vect64_saved 0
4640 if { ([istarget arm*-*-*]
4641 && [check_effective_target_arm_neon_ok]
4642 && [check_effective_target_arm_little_endian])
4643 || [istarget sparc*-*-*] } {
4644 set et_vect64_saved 1
4648 verbose "check_effective_target_vect64: returning $et_vect64_saved" 2
4649 return $et_vect64_saved
4652 # Return 1 if the target supports vector copysignf calls.
4654 proc check_effective_target_vect_call_copysignf { } {
4655 global et_vect_call_copysignf_saved
4657 if [info exists et_vect_call_copysignf_saved] {
4658 verbose "check_effective_target_vect_call_copysignf: using cached result" 2
4660 set et_vect_call_copysignf_saved 0
4661 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4662 || [istarget powerpc*-*-*] } {
4663 set et_vect_call_copysignf_saved 1
4667 verbose "check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4668 return $et_vect_call_copysignf_saved
4671 # Return 1 if the target supports vector sqrtf calls.
4673 proc check_effective_target_vect_call_sqrtf { } {
4674 global et_vect_call_sqrtf_saved
4676 if [info exists et_vect_call_sqrtf_saved] {
4677 verbose "check_effective_target_vect_call_sqrtf: using cached result" 2
4679 set et_vect_call_sqrtf_saved 0
4680 if { [istarget aarch64*-*-*]
4681 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4682 || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } {
4683 set et_vect_call_sqrtf_saved 1
4687 verbose "check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4688 return $et_vect_call_sqrtf_saved
4691 # Return 1 if the target supports vector lrint calls.
4693 proc check_effective_target_vect_call_lrint { } {
4694 set et_vect_call_lrint 0
4695 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
4696 && [check_effective_target_ilp32] } {
4697 set et_vect_call_lrint 1
4700 verbose "check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4701 return $et_vect_call_lrint
4704 # Return 1 if the target supports vector btrunc calls.
4706 proc check_effective_target_vect_call_btrunc { } {
4707 global et_vect_call_btrunc_saved
4709 if [info exists et_vect_call_btrunc_saved] {
4710 verbose "check_effective_target_vect_call_btrunc: using cached result" 2
4712 set et_vect_call_btrunc_saved 0
4713 if { [istarget aarch64*-*-*] } {
4714 set et_vect_call_btrunc_saved 1
4718 verbose "check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4719 return $et_vect_call_btrunc_saved
4722 # Return 1 if the target supports vector btruncf calls.
4724 proc check_effective_target_vect_call_btruncf { } {
4725 global et_vect_call_btruncf_saved
4727 if [info exists et_vect_call_btruncf_saved] {
4728 verbose "check_effective_target_vect_call_btruncf: using cached result" 2
4730 set et_vect_call_btruncf_saved 0
4731 if { [istarget aarch64*-*-*] } {
4732 set et_vect_call_btruncf_saved 1
4736 verbose "check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4737 return $et_vect_call_btruncf_saved
4740 # Return 1 if the target supports vector ceil calls.
4742 proc check_effective_target_vect_call_ceil { } {
4743 global et_vect_call_ceil_saved
4745 if [info exists et_vect_call_ceil_saved] {
4746 verbose "check_effective_target_vect_call_ceil: using cached result" 2
4748 set et_vect_call_ceil_saved 0
4749 if { [istarget aarch64*-*-*] } {
4750 set et_vect_call_ceil_saved 1
4754 verbose "check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4755 return $et_vect_call_ceil_saved
4758 # Return 1 if the target supports vector ceilf calls.
4760 proc check_effective_target_vect_call_ceilf { } {
4761 global et_vect_call_ceilf_saved
4763 if [info exists et_vect_call_ceilf_saved] {
4764 verbose "check_effective_target_vect_call_ceilf: using cached result" 2
4766 set et_vect_call_ceilf_saved 0
4767 if { [istarget aarch64*-*-*] } {
4768 set et_vect_call_ceilf_saved 1
4772 verbose "check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4773 return $et_vect_call_ceilf_saved
4776 # Return 1 if the target supports vector floor calls.
4778 proc check_effective_target_vect_call_floor { } {
4779 global et_vect_call_floor_saved
4781 if [info exists et_vect_call_floor_saved] {
4782 verbose "check_effective_target_vect_call_floor: using cached result" 2
4784 set et_vect_call_floor_saved 0
4785 if { [istarget aarch64*-*-*] } {
4786 set et_vect_call_floor_saved 1
4790 verbose "check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4791 return $et_vect_call_floor_saved
4794 # Return 1 if the target supports vector floorf calls.
4796 proc check_effective_target_vect_call_floorf { } {
4797 global et_vect_call_floorf_saved
4799 if [info exists et_vect_call_floorf_saved] {
4800 verbose "check_effective_target_vect_call_floorf: using cached result" 2
4802 set et_vect_call_floorf_saved 0
4803 if { [istarget aarch64*-*-*] } {
4804 set et_vect_call_floorf_saved 1
4808 verbose "check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4809 return $et_vect_call_floorf_saved
4812 # Return 1 if the target supports vector lceil calls.
4814 proc check_effective_target_vect_call_lceil { } {
4815 global et_vect_call_lceil_saved
4817 if [info exists et_vect_call_lceil_saved] {
4818 verbose "check_effective_target_vect_call_lceil: using cached result" 2
4820 set et_vect_call_lceil_saved 0
4821 if { [istarget aarch64*-*-*] } {
4822 set et_vect_call_lceil_saved 1
4826 verbose "check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4827 return $et_vect_call_lceil_saved
4830 # Return 1 if the target supports vector lfloor calls.
4832 proc check_effective_target_vect_call_lfloor { } {
4833 global et_vect_call_lfloor_saved
4835 if [info exists et_vect_call_lfloor_saved] {
4836 verbose "check_effective_target_vect_call_lfloor: using cached result" 2
4838 set et_vect_call_lfloor_saved 0
4839 if { [istarget aarch64*-*-*] } {
4840 set et_vect_call_lfloor_saved 1
4844 verbose "check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4845 return $et_vect_call_lfloor_saved
4848 # Return 1 if the target supports vector nearbyint calls.
4850 proc check_effective_target_vect_call_nearbyint { } {
4851 global et_vect_call_nearbyint_saved
4853 if [info exists et_vect_call_nearbyint_saved] {
4854 verbose "check_effective_target_vect_call_nearbyint: using cached result" 2
4856 set et_vect_call_nearbyint_saved 0
4857 if { [istarget aarch64*-*-*] } {
4858 set et_vect_call_nearbyint_saved 1
4862 verbose "check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4863 return $et_vect_call_nearbyint_saved
4866 # Return 1 if the target supports vector nearbyintf calls.
4868 proc check_effective_target_vect_call_nearbyintf { } {
4869 global et_vect_call_nearbyintf_saved
4871 if [info exists et_vect_call_nearbyintf_saved] {
4872 verbose "check_effective_target_vect_call_nearbyintf: using cached result" 2
4874 set et_vect_call_nearbyintf_saved 0
4875 if { [istarget aarch64*-*-*] } {
4876 set et_vect_call_nearbyintf_saved 1
4880 verbose "check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4881 return $et_vect_call_nearbyintf_saved
4884 # Return 1 if the target supports vector round calls.
4886 proc check_effective_target_vect_call_round { } {
4887 global et_vect_call_round_saved
4889 if [info exists et_vect_call_round_saved] {
4890 verbose "check_effective_target_vect_call_round: using cached result" 2
4892 set et_vect_call_round_saved 0
4893 if { [istarget aarch64*-*-*] } {
4894 set et_vect_call_round_saved 1
4898 verbose "check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4899 return $et_vect_call_round_saved
4902 # Return 1 if the target supports vector roundf calls.
4904 proc check_effective_target_vect_call_roundf { } {
4905 global et_vect_call_roundf_saved
4907 if [info exists et_vect_call_roundf_saved] {
4908 verbose "check_effective_target_vect_call_roundf: using cached result" 2
4910 set et_vect_call_roundf_saved 0
4911 if { [istarget aarch64*-*-*] } {
4912 set et_vect_call_roundf_saved 1
4916 verbose "check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4917 return $et_vect_call_roundf_saved
4920 # Return 1 if the target supports section-anchors
4922 proc check_effective_target_section_anchors { } {
4923 global et_section_anchors_saved
4925 if [info exists et_section_anchors_saved] {
4926 verbose "check_effective_target_section_anchors: using cached result" 2
4928 set et_section_anchors_saved 0
4929 if { [istarget powerpc*-*-*]
4930 || [istarget arm*-*-*] } {
4931 set et_section_anchors_saved 1
4935 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4936 return $et_section_anchors_saved
4939 # Return 1 if the target supports atomic operations on "int_128" values.
4941 proc check_effective_target_sync_int_128 { } {
4942 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
4943 && ![is-effective-target ia32] } {
4950 # Return 1 if the target supports atomic operations on "int_128" values
4951 # and can execute them.
4953 proc check_effective_target_sync_int_128_runtime { } {
4954 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
4955 && ![is-effective-target ia32] } {
4956 return [check_cached_effective_target sync_int_128_available {
4957 check_runtime_nocache sync_int_128_available {
4961 unsigned int eax, ebx, ecx, edx;
4962 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
4963 return !(ecx & bit_CMPXCHG16B);
4973 # Return 1 if the target supports atomic operations on "long long".
4975 # Note: 32bit x86 targets require -march=pentium in dg-options.
4977 proc check_effective_target_sync_long_long { } {
4978 if { [istarget x86_64-*-*] || [istarget i?86-*-*])
4979 || [istarget aarch64*-*-*]
4980 || [istarget arm*-*-*]
4981 || [istarget alpha*-*-*]
4982 || ([istarget sparc*-*-*] && [check_effective_target_lp64]) } {
4989 # Return 1 if the target supports atomic operations on "long long"
4990 # and can execute them.
4992 # Note: 32bit x86 targets require -march=pentium in dg-options.
4994 proc check_effective_target_sync_long_long_runtime { } {
4995 if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
4996 return [check_cached_effective_target sync_long_long_available {
4997 check_runtime_nocache sync_long_long_available {
5001 unsigned int eax, ebx, ecx, edx;
5002 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
5003 return !(edx & bit_CMPXCHG8B);
5008 } elseif { [istarget aarch64*-*-*] } {
5010 } elseif { [istarget arm*-*-linux-*] } {
5011 return [check_runtime sync_longlong_runtime {
5017 if (sizeof (long long) != 8)
5020 /* Just check for native; checking for kernel fallback is tricky. */
5021 asm volatile ("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
5026 } elseif { [istarget alpha*-*-*] } {
5028 } elseif { ([istarget sparc*-*-*]
5029 && [check_effective_target_lp64]
5030 && [check_effective_target_ultrasparc_hw]) } {
5032 } elseif { [istarget powerpc*-*-*] && [check_effective_target_lp64] } {
5039 # Return 1 if the target supports byte swap instructions.
5041 proc check_effective_target_bswap { } {
5042 global et_bswap_saved
5044 if [info exists et_bswap_saved] {
5045 verbose "check_effective_target_bswap: using cached result" 2
5047 set et_bswap_saved 0
5048 if { [istarget aarch64*-*-*]
5049 || [istarget alpha*-*-*]
5050 || [istarget i?86-*-*] || [istarget x86_64-*-*]
5051 || [istarget m68k-*-*]
5052 || [istarget powerpc*-*-*]
5053 || [istarget rs6000-*-*]
5054 || [istarget s390*-*-*] } {
5055 set et_bswap_saved 1
5057 if { [istarget arm*-*-*]
5058 && [check_no_compiler_messages_nocache arm_v6_or_later object {
5060 #error not armv6 or later
5064 set et_bswap_saved 1
5069 verbose "check_effective_target_bswap: returning $et_bswap_saved" 2
5070 return $et_bswap_saved
5073 # Return 1 if the target supports 16-bit byte swap instructions.
5075 proc check_effective_target_bswap16 { } {
5076 global et_bswap16_saved
5078 if [info exists et_bswap16_saved] {
5079 verbose "check_effective_target_bswap16: using cached result" 2
5081 set et_bswap16_saved 0
5082 if { [is-effective-target bswap]
5083 && ![istarget alpha*-*-*]
5084 && !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
5085 set et_bswap16_saved 1
5089 verbose "check_effective_target_bswap16: returning $et_bswap16_saved" 2
5090 return $et_bswap16_saved
5093 # Return 1 if the target supports 32-bit byte swap instructions.
5095 proc check_effective_target_bswap32 { } {
5096 global et_bswap32_saved
5098 if [info exists et_bswap32_saved] {
5099 verbose "check_effective_target_bswap32: using cached result" 2
5101 set et_bswap32_saved 0
5102 if { [is-effective-target bswap] } {
5103 set et_bswap32_saved 1
5107 verbose "check_effective_target_bswap32: returning $et_bswap32_saved" 2
5108 return $et_bswap32_saved
5111 # Return 1 if the target supports 64-bit byte swap instructions.
5113 proc check_effective_target_bswap64 { } {
5114 global et_bswap64_saved
5116 # expand_unop can expand 64-bit byte swap on 32-bit targets
5117 if { [is-effective-target bswap] && [is-effective-target int32plus] } {
5123 # Return 1 if the target supports atomic operations on "int" and "long".
5125 proc check_effective_target_sync_int_long { } {
5126 global et_sync_int_long_saved
5128 if [info exists et_sync_int_long_saved] {
5129 verbose "check_effective_target_sync_int_long: using cached result" 2
5131 set et_sync_int_long_saved 0
5132 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
5133 #
load-reserved/store
-conditional instructions.
5134 if { [istarget ia64
-*-*]
5135 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
5136 ||
[istarget aarch64
*-*-*]
5137 ||
[istarget alpha
*-*-*]
5138 ||
[istarget arm
*-*-linux
-*]
5139 ||
[istarget bfin
*-*linux
*]
5140 ||
[istarget hppa
*-*linux
*]
5141 ||
[istarget s390
*-*-*]
5142 ||
[istarget powerpc
*-*-*]
5143 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
5144 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
5145 ||
[check_effective_target_mips_llsc
] } {
5146 set et_sync_int_long_saved
1
5150 verbose
"check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
5151 return $et_sync_int_long_saved
5154 #
Return 1 if the target supports atomic operations
on "char" and "short".
5156 proc check_effective_target_sync_char_short
{ } {
5157 global et_sync_char_short_saved
5159 if [info exists et_sync_char_short_saved
] {
5160 verbose
"check_effective_target_sync_char_short: using cached result" 2
5162 set et_sync_char_short_saved
0
5163 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
5164 # load-reserved/store-conditional instructions.
5165 if { [istarget aarch64*-*-*]
5166 || [istarget ia64-*-*]
5167 || [istarget i?86-*-*] || [istarget x86_64-*-*]
5168 || [istarget alpha*-*-*]
5169 || [istarget arm*-*-linux-*]
5170 || [istarget hppa*-*linux*]
5171 || [istarget s390*-*-*]
5172 || [istarget powerpc*-*-*]
5173 || [istarget crisv32-*-*] || [istarget cris-*-*]
5174 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
5175 || [check_effective_target_mips_llsc] } {
5176 set et_sync_char_short_saved 1
5180 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
5181 return $et_sync_char_short_saved
5184 # Return 1 if the target uses a ColdFire FPU.
5186 proc check_effective_target_coldfire_fpu { } {
5187 return [check_no_compiler_messages coldfire_fpu assembly {
5194 # Return true if this is a uClibc target.
5196 proc check_effective_target_uclibc {} {
5197 return [check_no_compiler_messages uclibc object {
5198 #include <features.h>
5199 #if !defined (__UCLIBC__)
5205 # Return true if this is a uclibc target and if the uclibc feature
5206 # described by __$feature__ is not present.
5208 proc check_missing_uclibc_feature {feature} {
5209 return [check_no_compiler_messages $feature object "
5210 #include <features.h>
5211 #if !defined (__UCLIBC) || defined (__${feature}__)
5217 # Return true if this is a Newlib target.
5219 proc check_effective_target_newlib {} {
5220 return [check_no_compiler_messages newlib object {
5225 # Return true if this is NOT a Bionic target.
5227 proc check_effective_target_non_bionic {} {
5228 return [check_no_compiler_messages non_bionic object {
5230 #if defined (__BIONIC__)
5236 # Return true if this target has error.h header.
5238 proc check_effective_target_error_h {} {
5239 return [check_no_compiler_messages error_h object {
5244 # Return true if this target has tgmath.h header.
5246 proc check_effective_target_tgmath_h {} {
5247 return [check_no_compiler_messages tgmath_h object {
5252 # Return true if target's libc supports complex functions.
5254 proc check_effective_target_libc_has_complex_functions
{} {
5255 return [check_no_compiler_messages libc_has_complex_functions object
{
5256 #
include <complex.h
>
5261 #
(a
) an error of a few ULP is expected in string to floating
-point
5262 # conversion functions
; and
5263 #
(b
) overflow is not always detected correctly by those functions.
5265 proc check_effective_target_lax_strtofp
{} {
5266 # By default
, assume that all uClibc targets suffer from this.
5267 return [check_effective_target_uclibc
]
5270 #
Return 1 if this is a target
for which wcsftime is a dummy
5271 # function that always returns
0.
5273 proc check_effective_target_dummy_wcsftime
{} {
5274 # By default
, assume that all uClibc targets suffer from this.
5275 return [check_effective_target_uclibc
]
5278 #
Return 1 if constructors with initialization priority arguments are
5279 # supposed
on this target.
5281 proc check_effective_target_init_priority
{} {
5282 return [check_no_compiler_messages init_priority assembly
"
5283 void f
() __attribute__
((constructor
(1000)));
5288 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
5289 # This can be used with
any check_
* proc that takes no
argument and
5290 # returns only
1 or
0. It could be used with check_
* procs that take
5291 # arguments with keywords that pass particular arguments.
5293 proc is
-effective
-target
{ arg } {
5295 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5296 set selected
[check_effective_target_$
{arg}]
5299 "vmx_hw" { set selected [check_vmx_hw_available] }
5300 "vsx_hw" { set selected [check_vsx_hw_available] }
5301 "p8vector_hw" { set selected [check_p8vector_hw_available] }
5302 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
5303 "dfp_hw" { set selected [check_dfp_hw_available] }
5304 "htm_hw" { set selected [check_htm_hw_available] }
5305 "named_sections" { set selected [check_named_sections_available] }
5306 "gc_sections" { set selected [check_gc_sections_available] }
5307 "cxa_atexit" { set selected [check_cxa_atexit_available] }
5308 default
{ error
"unknown effective target keyword `$arg'" }
5311 verbose
"is-effective-target: $arg $selected" 2
5315 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
5317 proc is
-effective
-target
-keyword
{ arg } {
5318 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5321 # These have different names
for their check_
* procs.
5323 "vmx_hw" { return 1 }
5324 "vsx_hw" { return 1 }
5325 "p8vector_hw" { return 1 }
5326 "ppc_recip_hw" { return 1 }
5327 "dfp_hw" { return 1 }
5328 "htm_hw" { return 1 }
5329 "named_sections" { return 1 }
5330 "gc_sections" { return 1 }
5331 "cxa_atexit" { return 1 }
5332 default
{ return 0 }
5337 #
Return 1 if target default to short enums
5339 proc check_effective_target_short_enums
{ } {
5340 return [check_no_compiler_messages short_enums assembly
{
5342 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
5346 #
Return 1 if target supports merging string constants at link time.
5348 proc check_effective_target_string_merging
{ } {
5349 return [check_no_messages_and_pattern string_merging \
5350 "rodata\\.str" assembly {
5351 const char
*var
= "String";
5355 #
Return 1 if target has the basic signed and unsigned types in
5356 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
5357 # working
<stdint.h
> for all targets.
5359 proc check_effective_target_stdint_types
{ } {
5360 return [check_no_compiler_messages stdint_types assembly
{
5362 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
5363 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
5367 #
Return 1 if target has the basic signed and unsigned types in
5368 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
5369 # these types agree with those in the header, as some systems have
5370 # only <inttypes.h>.
5372 proc check_effective_target_inttypes_types { } {
5373 return [check_no_compiler_messages inttypes_types assembly {
5374 #include <inttypes.h>
5375 int8_t a; int16_t b; int32_t c; int64_t d;
5376 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
5380 # Return 1 if programs are intended to be run on a simulator
5381 # (i.e. slowly) rather than hardware (i.e. fast).
5383 proc check_effective_target_simulator { } {
5385 # All "src/sim" simulators set this one.
5386 if [board_info target exists is_simulator] {
5387 return [board_info target is_simulator]
5390 # The "sid" simulators don't
set that one
, but at least they
set
5392 if [board_info target
exists slow_simulator
] {
5393 return [board_info target slow_simulator
]
5399 #
Return 1 if programs are intended to be run
on hardware rather than
5402 proc check_effective_target_hw
{ } {
5404 # All
"src/sim" simulators set this one.
5405 if [board_info target
exists is_simulator
] {
5406 if [board_info target is_simulator
] {
5413 # The
"sid" simulators don't set that one, but at least they set
5415 if [board_info target
exists slow_simulator
] {
5416 if [board_info target slow_simulator
] {
5426 #
Return 1 if the target is a VxWorks kernel.
5428 proc check_effective_target_vxworks_kernel
{ } {
5429 return [check_no_compiler_messages vxworks_kernel assembly
{
5430 #
if !defined __vxworks || defined __RTP__
5436 #
Return 1 if the target is a VxWorks RTP.
5438 proc check_effective_target_vxworks_rtp
{ } {
5439 return [check_no_compiler_messages vxworks_rtp assembly
{
5440 #
if !defined __vxworks ||
!defined __RTP__
5446 #
Return 1 if the target is expected to provide wide character support.
5448 proc check_effective_target_wchar
{ } {
5449 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5452 return [check_no_compiler_messages wchar assembly
{
5457 #
Return 1 if the target has
<pthread.h
>.
5459 proc check_effective_target_pthread_h
{ } {
5460 return [check_no_compiler_messages pthread_h assembly
{
5461 #
include <pthread.h
>
5465 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5466 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5467 # chsize. We test
for a trivially functional truncation
; no stubs.
5468 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5469 # different function to be used.
5471 proc check_effective_target_fd_truncate { } {
5473 #define _FILE_OFFSET_BITS 64
5480 FILE *f = fopen ("tst.tmp", "wb");
5482 const char t[] = "test writing more than ten characters";
5486 write (fd, t, sizeof (t) - 1);
5488 if (ftruncate (fd, 10) != 0)
5497 f = fopen ("tst.tmp", "rb");
5498 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5506 if { [check_runtime ftruncate $prog] } {
5510 regsub "ftruncate" $prog "chsize" prog
5511 return [check_runtime chsize $prog]
5514 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5516 proc add_options_for_c99_runtime { flags } {
5517 if { [istarget *-*-solaris2*] } {
5518 return "$flags -std=c99"
5520 if { [istarget powerpc-*-darwin*] } {
5521 return "$flags -mmacosx-version-min=10.3"
5526 # Add to FLAGS all the target-specific flags needed to enable
5527 # full IEEE compliance mode.
5529 proc add_options_for_ieee { flags } {
5530 if { [istarget alpha*-*-*]
5531 || [istarget sh*-*-*] } {
5532 return "$flags -mieee"
5534 if { [istarget rx-*-*] } {
5535 return "$flags -mnofpu"
5540 if {![info exists flags_to_postpone]} {
5541 set flags_to_postpone ""
5544 # Add to FLAGS the flags needed to enable functions to bind locally
5545 # when using pic/PIC passes in the testsuite.
5546 proc add_options_for_bind_pic_locally { flags } {
5547 global flags_to_postpone
5549 # Instead of returning 'flags
' with the -fPIE or -fpie appended, we save it
5550 # in 'flags_to_postpone
' and append it later in gcc_target_compile procedure in
5551 # order to make sure that the multilib_flags doesn't override this.
5553 if {[check_no_compiler_messages using_pic2 assembly
{
5558 set flags_to_postpone
"-fPIE"
5561 if {[check_no_compiler_messages using_pic1 assembly
{
5566 set flags_to_postpone
"-fpie"
5572 # Add to FLAGS the flags needed to enable
64-bit vectors.
5574 proc add_options_for_double_vectors
{ flags
} {
5575 if [is
-effective
-target arm_neon_ok
] {
5576 return "$flags -mvectorize-with-neon-double"
5582 #
Return 1 if the target provides a full C99 runtime.
5584 proc check_effective_target_c99_runtime
{ } {
5585 return [check_cached_effective_target c99_runtime
{
5588 set file
[open
"$srcdir/gcc.dg/builtins-config.h"]
5589 set contents
[read $file
]
5592 #ifndef HAVE_C99_RUNTIME
5593 #error
!HAVE_C99_RUNTIME
5596 check_no_compiler_messages_nocache c99_runtime assembly \
5597 $contents
[add_options_for_c99_runtime
""]
5601 #
Return 1 if target wchar_t is at least
4 bytes.
5603 proc check_effective_target_4byte_wchar_t
{ } {
5604 return [check_no_compiler_messages
4byte_wchar_t object
{
5605 int dummy
[sizeof
(__WCHAR_TYPE__
) >= 4 ?
1 : -1];
5609 #
Return 1 if the target supports automatic stack alignment.
5611 proc check_effective_target_automatic_stack_alignment
{ } {
5612 # Ordinarily x86 supports automatic stack alignment ...
5613 if { [istarget i?
86*-*-*] ||
[istarget x86_64
-*-*] } then {
5614 if { [istarget
*-*-mingw
*] ||
[istarget
*-*-cygwin
*] } {
5615 # ... except Win64 SEH doesn
't. Succeed for Win32 though.
5616 return [check_effective_target_ilp32];
5623 # Return true if we are compiling for AVX target.
5625 proc check_avx_available { } {
5626 if { [check_no_compiler_messages avx_available assembly {
5636 # Return true if 32- and 16-bytes vectors are available.
5638 proc check_effective_target_vect_sizes_32B_16B { } {
5639 if { [check_avx_available] && ![check_prefer_avx128] } {
5646 # Return true if 128-bits vectors are preferred even if 256-bits vectors
5649 proc check_prefer_avx128 { } {
5650 if ![check_avx_available] {
5653 return [check_no_messages_and_pattern avx_explicit "xmm" assembly {
5654 float a[1024],b[1024],c[1024];
5655 void foo (void) { int i; for (i = 0; i < 1024; i++) a[i]=b[i]+c[i];}
5656 } "-O2 -ftree-vectorize"]
5660 # Return 1 if avx512f instructions can be compiled.
5662 proc check_effective_target_avx512f { } {
5663 return [check_no_compiler_messages avx512f object {
5664 typedef double __m512d __attribute__ ((__vector_size__ (64)));
5666 __m512d _mm512_add (__m512d a)
5668 return __builtin_ia32_addpd512_mask (a, a, a, 1, 4);
5673 # Return 1 if avx instructions can be compiled.
5675 proc check_effective_target_avx { } {
5676 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
5679 return [check_no_compiler_messages avx object {
5680 void _mm256_zeroall (void)
5682 __builtin_ia32_vzeroall ();
5687 # Return 1 if avx2 instructions can be compiled.
5688 proc check_effective_target_avx2 { } {
5689 return [check_no_compiler_messages avx2 object {
5690 typedef long long __v4di __attribute__ ((__vector_size__ (32)));
5692 mm256_is32_andnotsi256 (__v4di __X, __v4di __Y)
5694 return __builtin_ia32_andnotsi256 (__X, __Y);
5699 # Return 1 if sse instructions can be compiled.
5700 proc check_effective_target_sse { } {
5701 return [check_no_compiler_messages sse object {
5704 __builtin_ia32_stmxcsr ();
5710 # Return 1 if sse2 instructions can be compiled.
5711 proc check_effective_target_sse2 { } {
5712 return [check_no_compiler_messages sse2 object {
5713 typedef long long __m128i __attribute__ ((__vector_size__ (16)));
5715 __m128i _mm_srli_si128 (__m128i __A, int __N)
5717 return (__m128i)__builtin_ia32_psrldqi128 (__A, 8);
5722 # Return 1 if F16C instructions can be compiled.
5724 proc check_effective_target_f16c { } {
5725 return [check_no_compiler_messages f16c object {
5726 #include "immintrin.h"
5728 foo (unsigned short val)
5730 return _cvtsh_ss (val);
5735 # Return 1 if C wchar_t type is compatible with char16_t.
5737 proc check_effective_target_wchar_t_char16_t_compatible { } {
5738 return [check_no_compiler_messages wchar_t_char16_t object {
5740 __CHAR16_TYPE__ *p16 = &wc;
5741 char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5745 # Return 1 if C wchar_t type is compatible with char32_t.
5747 proc check_effective_target_wchar_t_char32_t_compatible { } {
5748 return [check_no_compiler_messages wchar_t_char32_t object {
5750 __CHAR32_TYPE__ *p32 = &wc;
5751 char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5755 # Return 1 if pow10 function exists.
5757 proc check_effective_target_pow10 { } {
5758 return [check_runtime pow10 {
5768 # Return 1 if current options generate DFP instructions, 0 otherwise.
5770 proc check_effective_target_hard_dfp {} {
5771 return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
5772 typedef float d64 __attribute__((mode(DD)));
5774 void foo (void) { z = x + y; }
5778 # Return 1 if string.h and wchar.h headers provide C++ requires overloads
5779 # for strchr etc. functions.
5781 proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
5782 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
5785 #if !defined(__cplusplus) \
5786 || !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) \
5787 || !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
5788 ISO C++ correct string.h and wchar.h protos not supported.
5795 # Return 1 if GNU as is used.
5797 proc check_effective_target_gas { } {
5798 global use_gas_saved
5801 if {![info exists use_gas_saved]} {
5802 # Check if the as used by gcc is GNU as.
5803 set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
5804 # Provide /dev/null as input, otherwise gas times out reading from
5806 set status [remote_exec host "$gcc_as" "-v /dev/null"]
5807 set as_output [lindex $status 1]
5808 if { [ string first "GNU" $as_output ] >= 0 } {
5814 return $use_gas_saved
5817 # Return 1 if GNU ld is used.
5819 proc check_effective_target_gld { } {
5820 global use_gld_saved
5823 if {![info exists use_gld_saved]} {
5824 # Check if the ld used by gcc is GNU ld.
5825 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0]
5826 set status [remote_exec host "$gcc_ld" "--version"]
5827 set ld_output [lindex $status 1]
5828 if { [ string first "GNU" $ld_output ] >= 0 } {
5834 return $use_gld_saved
5837 # Return 1 if the compiler has been configure with link-time optimization
5840 proc check_effective_target_lto { } {
5841 if { [istarget nvptx-*-*] } {
5844 return [check_no_compiler_messages lto object {
5849 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
5851 proc check_effective_target_maybe_x32 { } {
5852 return [check_no_compiler_messages maybe_x32 object {
5854 } "-mx32 -maddress-mode=short"]
5857 # Return 1 if this target supports the -fsplit-stack option, 0
5860 proc check_effective_target_split_stack {} {
5861 return [check_no_compiler_messages split_stack object {
5866 # Return 1 if this target supports the -masm=intel option, 0
5869 proc check_effective_target_masm_intel {} {
5870 return [check_no_compiler_messages masm_intel object {
5871 extern void abort (void);
5875 # Return 1 if the language for the compiler under test is C.
5877 proc check_effective_target_c { } {
5879 if [string match $tool "gcc"] {
5885 # Return 1 if the language for the compiler under test is C++.
5887 proc check_effective_target_c++ { } {
5889 if [string match $tool "g++"] {
5895 # Check whether the current active language standard supports the features
5896 # of C++11/C++14 by checking for the presence of one of the -std
5897 # flags. This assumes that the default for the compiler is C++98, and that
5898 # there will never be multiple -std= arguments on the command line.
5899 proc check_effective_target_c++11_only { } {
5900 if ![check_effective_target_c++] {
5903 return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
5905 proc check_effective_target_c++11 { } {
5906 if [check_effective_target_c++11_only] {
5909 return [check_effective_target_c++14]
5911 proc check_effective_target_c++11_down { } {
5912 if ![check_effective_target_c++] {
5915 return ![check_effective_target_c++14]
5918 proc check_effective_target_c++14_only { } {
5919 if ![check_effective_target_c++] {
5922 return [check-flags { { } { } { -std=c++14 -std=gnu++14 -std=c++14 -std=gnu++14 } }]
5925 proc check_effective_target_c++14 { } {
5926 if [check_effective_target_c++14_only] {
5929 return [check_effective_target_c++1z]
5931 proc check_effective_target_c++14_down { } {
5932 if ![check_effective_target_c++] {
5935 return ![check_effective_target_c++1z]
5938 proc check_effective_target_c++98_only { } {
5939 if ![check_effective_target_c++] {
5942 return ![check_effective_target_c++11]
5945 proc check_effective_target_c++1z_only { } {
5946 if ![check_effective_target_c++] {
5949 return [check-flags { { } { } { -std=c++1z -std=gnu++1z } }]
5951 proc check_effective_target_c++1z { } {
5952 return [check_effective_target_c++1z_only]
5955 # Return 1 if expensive testcases should be run.
5957 proc check_effective_target_run_expensive_tests { } {
5958 if { [getenv GCC_TEST_RUN_EXPENSIVE] != "" } {
5964 # Returns 1 if "mempcpy" is available on the target system.
5966 proc check_effective_target_mempcpy {} {
5967 return [check_function_available "mempcpy"]
5970 # Returns 1 if "stpcpy" is available on the target system.
5972 proc check_effective_target_stpcpy {} {
5973 return [check_function_available "stpcpy"]
5976 # Check whether the vectorizer tests are supported by the target and
5977 # append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
5978 # Set dg-do-what-default to either compile or run, depending on target
5979 # capabilities. Return 1 if vectorizer tests are supported by
5980 # target, 0 otherwise.
5982 proc check_vect_support_and_set_flags { } {
5983 global DEFAULT_VECTCFLAGS
5984 global dg-do-what-default
5986 if [istarget powerpc-*paired*] {
5987 lappend DEFAULT_VECTCFLAGS "-mpaired"
5988 if [check_750cl_hw_available] {
5989 set dg-do-what-default run
5991 set dg-do-what-default compile
5993 } elseif [istarget powerpc*-*-*] {
5994 # Skip targets not supporting -maltivec.
5995 if ![is-effective-target powerpc_altivec_ok] {
5999 lappend DEFAULT_VECTCFLAGS "-maltivec"
6000 if [check_p8vector_hw_available] {
6001 lappend DEFAULT_VECTCFLAGS "-mpower8-vector"
6002 } elseif [check_vsx_hw_available] {
6003 lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
6006 if [check_vmx_hw_available] {
6007 set dg-do-what-default run
6009 if [is-effective-target ilp32] {
6010 # Specify a cpu that supports VMX for compile-only tests.
6011 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
6013 set dg-do-what-default compile
6015 } elseif { [istarget spu-*-*] } {
6016 set dg-do-what-default run
6017 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
6018 lappend DEFAULT_VECTCFLAGS "-msse2"
6019 if { [check_effective_target_sse2_runtime] } {
6020 set dg-do-what-default run
6022 set dg-do-what-default compile
6024 } elseif { [istarget mips*-*-*]
6025 && ([check_effective_target_mpaired_single]
6026 || [check_effective_target_mips_loongson])
6027 && [check_effective_target_nomips16] } {
6028 if { [check_effective_target_mpaired_single] } {
6029 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
6031 set dg-do-what-default run
6032 } elseif [istarget sparc*-*-*] {
6033 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
6034 if [check_effective_target_ultrasparc_hw] {
6035 set dg-do-what-default run
6037 set dg-do-what-default compile
6039 } elseif [istarget alpha*-*-*] {
6040 # Alpha's vectorization capabilities are extremely limited.
6041 # It
's more effort than its worth disabling all of the tests
6042 # that it cannot pass. But if you actually want to see what
6043 # does work, command out the return.
6046 lappend DEFAULT_VECTCFLAGS "-mmax"
6047 if [check_alpha_max_hw_available] {
6048 set dg-do-what-default run
6050 set dg-do-what-default compile
6052 } elseif [istarget ia64-*-*] {
6053 set dg-do-what-default run
6054 } elseif [is-effective-target arm_neon_ok] {
6055 eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
6056 # NEON does not support denormals, so is not used for vectorization by
6057 # default to avoid loss of precision. We must pass -ffast-math to test
6058 # vectorization of float operations.
6059 lappend DEFAULT_VECTCFLAGS "-ffast-math"
6060 if [is-effective-target arm_neon_hw] {
6061 set dg-do-what-default run
6063 set dg-do-what-default compile
6065 } elseif [istarget "aarch64*-*-*"] {
6066 set dg-do-what-default run
6074 # Return 1 if the target does *not* require strict alignment.
6076 proc check_effective_target_non_strict_align {} {
6077 return [check_no_compiler_messages non_strict_align assembly {
6079 typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
6081 void foo(void) { z = (c *) y; }
6085 # Return 1 if the target has <ucontext.h>.
6087 proc check_effective_target_ucontext_h { } {
6088 return [check_no_compiler_messages ucontext_h assembly {
6089 #include <ucontext.h>
6093 proc check_effective_target_aarch64_tiny { } {
6094 if { [istarget aarch64*-*-*] } {
6095 return [check_no_compiler_messages aarch64_tiny object {
6096 #ifdef __AARCH64_CMODEL_TINY__
6099 #error target not AArch64 tiny code model
6107 proc check_effective_target_aarch64_small { } {
6108 if { [istarget aarch64*-*-*] } {
6109 return [check_no_compiler_messages aarch64_small object {
6110 #ifdef __AARCH64_CMODEL_SMALL__
6113 #error target not AArch64 small code model
6121 proc check_effective_target_aarch64_large { } {
6122 if { [istarget aarch64*-*-*] } {
6123 return [check_no_compiler_messages aarch64_large object {
6124 #ifdef __AARCH64_CMODEL_LARGE__
6127 #error target not AArch64 large code model
6135 # Return 1 if <fenv.h> is available with all the standard IEEE
6136 # exceptions and floating-point exceptions are raised by arithmetic
6137 # operations. (If the target requires special options for "inexact"
6138 # exceptions, those need to be specified in the testcases.)
6140 proc check_effective_target_fenv_exceptions {} {
6141 return [check_runtime fenv_exceptions {
6144 #ifndef FE_DIVBYZERO
6145 # error Missing FE_DIVBYZERO
6148 # error Missing FE_INEXACT
6151 # error Missing FE_INVALID
6154 # error Missing FE_OVERFLOW
6156 #ifndef FE_UNDERFLOW
6157 # error Missing FE_UNDERFLOW
6159 volatile float a = 0.0f, r;
6164 if (fetestexcept (FE_INVALID))
6169 } [add_options_for_ieee "-std=gnu99"]]
6172 proc check_effective_target_tiny {} {
6173 global et_target_tiny_saved
6175 if [info exists et_target_tine_saved] {
6176 verbose "check_effective_target_tiny: using cached result" 2
6178 set et_target_tiny_saved 0
6179 if { [istarget aarch64*-*-*]
6180 && [check_effective_target_aarch64_tiny] } {
6181 set et_target_tiny_saved 1
6185 return $et_target_tiny_saved
6188 # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
6190 proc check_effective_target_logical_op_short_circuit {} {
6191 if { [istarget mips*-*-*]
6192 || [istarget arc*-*-*]
6193 || [istarget avr*-*-*]
6194 || [istarget crisv32-*-*] || [istarget cris-*-*]
6195 || [istarget mmix-*-*]
6196 || [istarget s390*-*-*]
6197 || [istarget powerpc*-*-*]
6198 || [istarget nios2*-*-*]
6199 || [istarget visium-*-*]
6200 || [check_effective_target_arm_cortex_m] } {
6206 # Record that dg-final test TEST requires convential compilation.
6208 proc force_conventional_output_for { test } {
6209 if { [info proc $test] == "" } {
6210 perror "$test does not exist"
6213 proc ${test}_required_options {} {
6214 global gcc_force_conventional_output
6215 return $gcc_force_conventional_output
6219 # Return 1 if the x86-64 target supports PIE with copy reloc, 0
6220 # otherwise. Cache the result.
6222 proc check_effective_target_pie_copyreloc { } {
6223 global pie_copyreloc_available_saved
6225 global GCC_UNDER_TEST
6227 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
6231 # Need auto-host.h to check linker support.
6232 if { ![file exists ../../auto-host.h ] } {
6236 if [info exists pie_copyreloc_available_saved] {
6237 verbose "check_effective_target_pie_copyreloc returning saved $pie_copyreloc_available_saved" 2
6239 # Set up and compile to see if linker supports PIE with copy
6240 # reloc. Include the current process ID in the file names to
6241 # prevent conflicts with invocations for multiple testsuites.
6246 set f [open $src "w"]
6247 puts $f "#include \"../../auto-host.h\""
6248 puts $f "#if HAVE_LD_PIE_COPYRELOC == 0"
6249 puts $f "# error Linker does not support PIE with copy reloc."
6253 verbose "check_effective_target_pie_copyreloc compiling testfile $src" 2
6254 set lines [${tool}_target_compile $src $obj object ""]
6259 if [string match "" $lines] then {
6260 verbose "check_effective_target_pie_copyreloc testfile compilation passed" 2
6261 set pie_copyreloc_available_saved 1
6263 verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2
6264 set pie_copyreloc_available_saved 0
6268 return $pie_copyreloc_available_saved
6271 # Return 1 if the target uses comdat groups.
6273 proc check_effective_target_comdat_group {} {
6274 return [check_no_messages_and_pattern comdat_group "\.section\[^\n\r]*,comdat" assembly {
6276 inline int foo () { return 1; }