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 if { [llength $
args] > 0 } {
45 set options
[list
"additional_flags=[lindex $args 0]"]
49 switch -glob
-- $contents
{
50 "*! Fortran*" { set src ${basename}[pid].f90 }
51 "*// C++*" { set src ${basename}[pid].cc }
52 "*// ObjC++*" { set src ${basename}[pid].mm }
53 "*/* ObjC*" { set src ${basename}[pid].m }
54 "*// Go*" { set src ${basename}[pid].go }
57 "objc" { set src ${basename}[pid].m }
58 "obj-c++" { set src ${basename}[pid].mm }
59 default
{ set src $
{basename
}[pid
].c
}
64 set compile_type $type
66 assembly
{ set output $
{basename
}[pid
].s
}
67 object
{ set output $
{basename
}[pid
].o
}
68 executable
{ set output $
{basename
}[pid
].exe
}
70 set output $
{basename
}[pid
].s
71 lappend options
"additional_flags=-fdump-$type"
72 set compile_type assembly
78 set lines
[$
{tool
}_target_compile $src $output $compile_type
"$options"]
81 set scan_output $output
82 # Don
't try folding this into the switch above; calling "glob" before the
83 # file is created won't work.
84 if [regexp
"rtl-(.*)" $type dummy rtl_type] {
85 set scan_output
"[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
89 return [list $lines $scan_output
]
92 proc current_target_name
{ } {
94 if [info exists target_info
(target
,name)] {
95 set answer $target_info
(target
,name)
102 # Implement an effective
-target check
for property PROP by invoking
103 # the Tcl command
ARGS and seeing
if it returns true.
105 proc check_cached_effective_target
{ prop
args } {
108 set target
[current_target_name
]
109 if {![info exists et_cache
($prop
,target
)]
110 || $et_cache
($prop
,target
) != $target
} {
111 verbose
"check_cached_effective_target $prop: checking $target" 2
112 set et_cache
($prop
,target
) $target
113 set et_cache
($prop
,value
) [uplevel eval $
args]
115 set value $et_cache
($prop
,value
)
116 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
120 # Like check_compile
, but
delete the output file and
return true
if the
121 # compiler printed no messages.
122 proc check_no_compiler_messages_nocache
{args} {
123 set result
[eval check_compile $
args]
124 set lines
[lindex $result
0]
125 set output
[lindex $result
1]
126 remote_file build
delete $output
127 return [string match
"" $lines]
130 # Like check_no_compiler_messages_nocache
, but
cache the result.
131 # PROP is the
property we
're checking, and doubles as a prefix for
132 # temporary filenames.
133 proc check_no_compiler_messages {prop args} {
134 return [check_cached_effective_target $prop {
135 eval [list check_no_compiler_messages_nocache $prop] $args
139 # Like check_compile, but return true if the compiler printed no
140 # messages and if the contents of the output file satisfy PATTERN.
141 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
142 # don't match regular expression REGEXP
, otherwise they satisfy it
143 #
if they
do match regular expression PATTERN.
(PATTERN can start
144 # with something like
"[!]" if the regular expression needs to match
145 #
"!" as the first character.)
147 #
Delete the output file before returning. The other arguments are
148 # as
for check_compile.
149 proc check_no_messages_and_pattern_nocache
{basename pattern
args} {
152 set result
[eval
[list check_compile $basename
] $
args]
153 set lines
[lindex $result
0]
154 set output
[lindex $result
1]
157 if { [string match
"" $lines] } {
158 set chan
[open
"$output"]
159 set invert
[regexp
{^
!(.
*)} $pattern dummy pattern
]
160 set ok
[expr
{ [regexp $pattern
[read $chan
]] != $invert
}]
164 remote_file build
delete $output
168 # Like check_no_messages_and_pattern_nocache
, but
cache the result.
169 # PROP is the
property we
're checking, and doubles as a prefix for
170 # temporary filenames.
171 proc check_no_messages_and_pattern {prop pattern args} {
172 return [check_cached_effective_target $prop {
173 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
177 # Try to compile and run an executable from code CONTENTS. Return true
178 # if the compiler reports no messages and if execution "passes" in the
179 # usual DejaGNU sense. The arguments are as for check_compile, with
180 # TYPE implicitly being "executable".
181 proc check_runtime_nocache {basename contents args} {
184 set result [eval [list check_compile $basename executable $contents] $args]
185 set lines [lindex $result 0]
186 set output [lindex $result 1]
189 if { [string match "" $lines] } {
190 # No error messages, everything is OK.
191 set result [remote_load target "./$output" "" ""]
192 set status [lindex $result 0]
193 verbose "check_runtime_nocache $basename: status is <$status>" 2
194 if { $status == "pass" } {
198 remote_file build delete $output
202 # Like check_runtime_nocache, but cache the result. PROP is the
203 # property we're checking
, and doubles as a prefix
for temporary
205 proc check_runtime
{prop
args} {
208 return [check_cached_effective_target $prop
{
209 eval
[list check_runtime_nocache $prop
] $
args
213 ###############################
214 # proc check_weak_available
{ }
215 ###############################
217 # weak symbols are only supported in some configs
/object formats
218 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
220 proc check_weak_available
{ } {
223 # All mips targets should support it
225 if { [ string first
"mips" $target_cpu ] >= 0 } {
229 # All AIX targets should support it
231 if { [istarget
*-*-aix
*] } {
235 # All solaris2 targets should support it
237 if { [istarget
*-*-solaris2
*] } {
241 # Windows targets Cygwin and MingW32 support it
243 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
247 # HP
-UX
10.X doesn
't support it
249 if { [istarget hppa*-*-hpux10*] } {
253 # ELF and ECOFF support it. a.out does with gas/gld but may also with
254 # other linkers, so we should try it
256 set objformat [gcc_target_object_format]
264 unknown { return -1 }
269 ###############################
270 # proc check_weak_override_available { }
271 ###############################
273 # Like check_weak_available, but return 0 if weak symbol definitions
274 # cannot be overridden.
276 proc check_weak_override_available { } {
277 if { [istarget *-*-mingw*] } {
280 return [check_weak_available]
283 ###############################
284 # proc check_visibility_available { what_kind }
285 ###############################
287 # The visibility attribute is only support in some object formats
288 # This proc returns 1 if it is supported, 0 if not.
289 # The argument is the kind of visibility, default/protected/hidden/internal.
291 proc check_visibility_available { what_kind } {
292 if [string match "" $what_kind] { set what_kind "hidden" }
294 return [check_no_compiler_messages visibility_available_$what_kind object "
295 void f() __attribute__((visibility(\"$what_kind\")));
300 ###############################
301 # proc check_alias_available { }
302 ###############################
304 # Determine if the target toolchain supports the alias attribute.
306 # Returns 2 if the target supports aliases. Returns 1 if the target
307 # only supports weak aliased. Returns 0 if the target does not
308 # support aliases at all. Returns -1 if support for aliases could not
311 proc check_alias_available { } {
312 global alias_available_saved
315 if [info exists alias_available_saved] {
316 verbose "check_alias_available returning saved $alias_available_saved" 2
320 verbose "check_alias_available compiling testfile $src" 2
321 set f [open $src "w"]
322 # Compile a small test program. The definition of "g" is
323 # necessary to keep the Solaris assembler from complaining
325 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
326 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
328 set lines [${tool}_target_compile $src $obj object ""]
330 remote_file build delete $obj
332 if [string match "" $lines] then {
333 # No error messages, everything is OK.
334 set alias_available_saved 2
336 if [regexp "alias definitions not supported" $lines] {
337 verbose "check_alias_available target does not support aliases" 2
339 set objformat [gcc_target_object_format]
341 if { $objformat == "elf" } {
342 verbose "check_alias_available but target uses ELF format, so it ought to" 2
343 set alias_available_saved -1
345 set alias_available_saved 0
348 if [regexp "only weak aliases are supported" $lines] {
349 verbose "check_alias_available target supports only weak aliases" 2
350 set alias_available_saved 1
352 set alias_available_saved -1
357 verbose "check_alias_available returning $alias_available_saved" 2
360 return $alias_available_saved
363 # Returns 1 if the target toolchain supports strong aliases, 0 otherwise.
365 proc check_effective_target_alias { } {
366 if { [check_alias_available] < 2 } {
373 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
375 proc check_ifunc_available { } {
376 return [check_no_compiler_messages ifunc_available object {
381 void f() __attribute__((ifunc("g")));
385 # Returns true if --gc-sections is supported on the target.
387 proc check_gc_sections_available { } {
388 global gc_sections_available_saved
391 if {![info exists gc_sections_available_saved]} {
392 # Some targets don't support gc
-sections despite whatever
's
393 # advertised by ld's options.
394 if { [istarget alpha
*-*-*]
395 ||
[istarget ia64
-*-*] } {
396 set gc_sections_available_saved
0
400 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
402 if { [board_info target
exists ldflags
]
403 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
404 set gc_sections_available_saved
0
408 # VxWorks kernel modules are relocatable objects linked with
-r
,
409 #
while RTP executables are linked with
-q
(--emit
-relocs
).
410 # Both of these options are incompatible with
--gc
-sections.
411 if { [istarget
*-*-vxworks
*] } {
412 set gc_sections_available_saved
0
416 # Check
if the
ld used by gcc supports
--gc
-sections.
417 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
418 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
419 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
420 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
421 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
422 set gc_sections_available_saved
1
424 set gc_sections_available_saved
0
427 return $gc_sections_available_saved
430 #
Return 1 if according to target_info struct and explicit target list
431 # target is supposed to support trampolines.
433 proc check_effective_target_trampolines
{ } {
434 if [target_info
exists no_trampolines
] {
437 if { [istarget avr
-*-*]
438 ||
[istarget msp430
-*-*]
439 ||
[istarget nvptx
-*-*]
440 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
441 ||
[istarget hppa64
-hp
-hpux11.23
] } {
447 #
Return 1 if according to target_info struct and explicit target list
448 # target is supposed to keep null pointer checks. This could be due to
449 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
451 proc check_effective_target_keeps_null_pointer_checks
{ } {
452 if [target_info
exists keeps_null_pointer_checks
] {
455 if { [istarget avr
-*-*] } {
461 #
Return true
if profiling is supported
on the target.
463 proc check_profiling_available
{ test_what
} {
464 global profiling_available_saved
466 verbose
"Profiling argument is <$test_what>" 1
468 # These conditions depend
on the
argument so examine them before
469 # looking at the
cache variable.
471 # Tree profiling requires TLS runtime support.
472 if { $test_what
== "-fprofile-generate" } {
473 if { ![check_effective_target_tls_runtime
] } {
478 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
479 # vendor compiler. We cannot reliably predict the directory where the
480 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
481 # necessarily find mcrt1.o even if we have it.
482 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
486 # We don't yet support profiling
for MIPS16.
487 if { [istarget mips
*-*-*]
488 && ![check_effective_target_nomips16
]
489 && ($test_what
== "-p" || $test_what == "-pg") } {
493 # MinGW does not support
-p.
494 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
498 # cygwin does not support
-p.
499 if { [istarget
*-*-cygwin
*] && $test_what
== "-p" } {
503 # uClibc does not have gcrt1.o.
504 if { [check_effective_target_uclibc
]
505 && ($test_what
== "-p" || $test_what == "-pg") } {
509 # Now examine the
cache variable.
510 if {![info exists profiling_available_saved
]} {
511 # Some targets don
't have any implementation of __bb_init_func or are
512 # missing other needed machinery.
513 if {[istarget aarch64*-*-elf]
514 || [istarget am3*-*-linux*]
515 || [istarget arm*-*-eabi*]
516 || [istarget arm*-*-elf]
517 || [istarget arm*-*-symbianelf*]
518 || [istarget avr-*-*]
519 || [istarget bfin-*-*]
520 || [istarget cris-*-*]
521 || [istarget crisv32-*-*]
522 || [istarget fido-*-elf]
523 || [istarget h8300-*-*]
524 || [istarget lm32-*-*]
525 || [istarget m32c-*-elf]
526 || [istarget m68k-*-elf]
527 || [istarget m68k-*-uclinux*]
528 || [istarget mep-*-elf]
529 || [istarget mips*-*-elf*]
530 || [istarget mmix-*-*]
531 || [istarget mn10300-*-elf*]
532 || [istarget moxie-*-elf*]
533 || [istarget msp430-*-*]
534 || [istarget nds32*-*-elf]
535 || [istarget nios2-*-elf]
536 || [istarget nvptx-*-*]
537 || [istarget powerpc-*-eabi*]
538 || [istarget powerpc-*-elf]
540 || [istarget tic6x-*-elf]
541 || [istarget visium-*-*]
542 || [istarget xstormy16-*]
543 || [istarget xtensa*-*-elf]
544 || [istarget *-*-rtems*]
545 || [istarget *-*-vxworks*] } {
546 set profiling_available_saved 0
548 set profiling_available_saved 1
552 # -pg link test result can't be cached since it may change between
554 set profiling_working $profiling_available_saved
555 if { $profiling_available_saved
== 1
556 && ![check_no_compiler_messages_nocache profiling executable
{
557 int main
() { return 0; } } "-pg"] } {
558 set profiling_working
0
561 return $profiling_working
564 # Check to see
if a target is
"freestanding". This is as per the definition
565 # in Section
4 of C99 standard. Effectively
, it is a target which supports no
566 # extra headers or libraries other than what is considered essential.
567 proc check_effective_target_freestanding
{ } {
571 #
Return 1 if target has packed layout of structure members by
572 # default
, 0 otherwise. Note that this is slightly different than
573 # whether the target has
"natural alignment": both attributes may be
576 proc check_effective_target_default_packed
{ } {
577 return [check_no_compiler_messages default_packed assembly
{
578 struct x
{ char a
; long b
; } c
;
579 int s
[sizeof
(c
) == sizeof
(char
) + sizeof
(long
) ?
1 : -1];
583 #
Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
584 # documentation
, where the test also comes from.
586 proc check_effective_target_pcc_bitfield_type_matters
{ } {
587 # PCC_BITFIELD_TYPE_MATTERS isn
't just about unnamed or empty
588 # bitfields, but let's stick to the example code from the docs.
589 return [check_no_compiler_messages pcc_bitfield_type_matters assembly
{
590 struct foo1
{ char x
; char
:0; char y
; };
591 struct foo2
{ char x
; int :0; char y
; };
592 int s
[sizeof
(struct foo1
) != sizeof
(struct foo2
) ?
1 : -1];
596 # Add to FLAGS all the target
-specific flags needed to use thread
-local storage.
598 proc add_options_for_tls
{ flags
} {
599 #
On Solaris
9, __tls_get_addr
/___tls_get_addr only lives in
600 # libthread
, so always pass
-pthread
for native TLS. Same
for AIX.
601 # Need to duplicate native TLS check from
602 # check_effective_target_tls_native to avoid recursion.
603 if { ([istarget powerpc
-ibm
-aix
*]) &&
604 [check_no_messages_and_pattern tls_native
"!emutls" assembly {
606 int f
(void
) { return i
; }
607 void g
(int j
) { i
= j
; }
609 return "-pthread [g++_link_flags [get_multilibs "-pthread"] ] $flags "
614 #
Return 1 if indirect jumps are supported
, 0 otherwise.
616 proc check_effective_target_indirect_jumps
{} {
617 if { [istarget nvptx
-*-*] } {
623 #
Return 1 if nonlocal
goto is supported
, 0 otherwise.
625 proc check_effective_target_nonlocal_goto
{} {
626 if { [istarget nvptx
-*-*] } {
632 #
Return 1 if taking label
values is supported
, 0 otherwise.
634 proc check_effective_target_label_values
{} {
635 if { [istarget nvptx
-*-*] } {
638 return [check_no_compiler_messages label_values assembly
{
639 #ifdef NO_LABEL_VALUES
645 #
Return 1 if builtin_return_address and builtin_frame_address are
646 # supported
, 0 otherwise.
648 proc check_effective_target_return_address
{} {
649 if { [istarget nvptx
-*-*] } {
655 #
Return 1 if the assembler does not verify function types against
656 # calls
, 0 otherwise. Such verification will typically
show up problems
657 # with K
&R C function declarations.
659 proc check_effective_target_untyped_assembly
{} {
660 if { [istarget nvptx
-*-*] } {
666 #
Return 1 if alloca is supported
, 0 otherwise.
668 proc check_effective_target_alloca
{} {
669 if { [istarget nvptx
-*-*] } {
675 #
Return 1 if thread local storage
(TLS
) is supported
, 0 otherwise.
677 proc check_effective_target_tls
{} {
678 return [check_no_compiler_messages tls assembly
{
680 int f
(void
) { return i
; }
681 void g
(int j
) { i
= j
; }
685 #
Return 1 if *native
* thread local storage
(TLS
) is supported
, 0 otherwise.
687 proc check_effective_target_tls_native
{} {
688 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
689 # functions
, so we fail to automatically detect it.
690 if { [istarget
*-*-vxworks
*] } {
694 return [check_no_messages_and_pattern tls_native
"!emutls" assembly {
696 int f
(void
) { return i
; }
697 void g
(int j
) { i
= j
; }
701 #
Return 1 if *emulated
* thread local storage
(TLS
) is supported
, 0 otherwise.
703 proc check_effective_target_tls_emulated
{} {
704 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
705 # functions
, so we fail to automatically detect it.
706 if { [istarget
*-*-vxworks
*] } {
710 return [check_no_messages_and_pattern tls_emulated
"emutls" assembly {
712 int f
(void
) { return i
; }
713 void g
(int j
) { i
= j
; }
717 #
Return 1 if TLS executables can run correctly
, 0 otherwise.
719 proc check_effective_target_tls_runtime
{} {
720 # The runtime does not have TLS support
, but just
721 # running the test below is insufficient to
show this.
722 if { [istarget msp430
-*-*] ||
[istarget visium
-*-*] } {
725 return [check_runtime tls_runtime
{
726 __thread
int thr
= 0;
727 int main
(void
) { return thr
; }
728 } [add_options_for_tls
""]]
731 #
Return 1 if atomic compare
-and
-swap is supported
on 'int'
733 proc check_effective_target_cas_char
{} {
734 return [check_no_compiler_messages cas_char assembly
{
735 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
741 proc check_effective_target_cas_int
{} {
742 return [check_no_compiler_messages cas_int assembly
{
743 #
if __INT_MAX__
== 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
745 #elif __INT_MAX__
== 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
753 #
Return 1 if -ffunction
-sections is supported
, 0 otherwise.
755 proc check_effective_target_function_sections
{} {
756 # Darwin has its own scheme and silently accepts
-ffunction
-sections.
757 if { [istarget
*-*-darwin
*] } {
761 return [check_no_compiler_messages functionsections assembly
{
763 } "-ffunction-sections"]
766 #
Return 1 if instruction scheduling is available
, 0 otherwise.
768 proc check_effective_target_scheduling
{} {
769 return [check_no_compiler_messages scheduling object
{
771 } "-fschedule-insns"]
774 #
Return 1 if trapping arithmetic is available
, 0 otherwise.
776 proc check_effective_target_trapping
{} {
777 return [check_no_compiler_messages trapping object
{
778 int add
(int a
, int b
) { return a
+ b
; }
782 #
Return 1 if compilation with
-fgraphite is error
-free
for trivial
785 proc check_effective_target_fgraphite
{} {
786 return [check_no_compiler_messages fgraphite object
{
791 #
Return 1 if compilation with
-fopenacc is error
-free
for trivial
794 proc check_effective_target_fopenacc
{} {
795 return [check_no_compiler_messages fopenacc object
{
800 #
Return 1 if compilation with
-fopenmp is error
-free
for trivial
803 proc check_effective_target_fopenmp
{} {
804 return [check_no_compiler_messages fopenmp object
{
809 #
Return 1 if compilation with
-fgnu
-tm is error
-free
for trivial
812 proc check_effective_target_fgnu_tm
{} {
813 return [check_no_compiler_messages fgnu_tm object
{
818 #
Return 1 if the target supports mmap
, 0 otherwise.
820 proc check_effective_target_mmap
{} {
821 return [check_function_available
"mmap"]
824 #
Return 1 if the target supports dlopen
, 0 otherwise.
825 proc check_effective_target_dlopen
{} {
826 return [check_no_compiler_messages dlopen executable
{
828 int main
(void
) { dlopen
("dummy.so", RTLD_NOW); }
829 } [add_options_for_dlopen
""]]
832 proc add_options_for_dlopen
{ flags
} {
836 #
Return 1 if the target supports clone
, 0 otherwise.
837 proc check_effective_target_clone
{} {
838 return [check_function_available
"clone"]
841 #
Return 1 if the target supports setrlimit
, 0 otherwise.
842 proc check_effective_target_setrlimit
{} {
843 # Darwin has non
-posix compliant RLIMIT_AS
844 if { [istarget
*-*-darwin
*] } {
847 return [check_function_available
"setrlimit"]
850 #
Return 1 if the target supports swapcontext
, 0 otherwise.
851 proc check_effective_target_swapcontext
{} {
852 return [check_no_compiler_messages swapcontext executable
{
853 #
include <ucontext.h
>
856 ucontext_t orig_context
,child_context
;
857 if (swapcontext
(&child_context
, &orig_context
) < 0) { }
862 #
Return 1 if compilation with
-pthread is error
-free
for trivial
865 proc check_effective_target_pthread
{} {
866 return [check_no_compiler_messages pthread object
{
871 #
Return 1 if compilation with
-mpe
-aligned
-commons is error
-free
872 #
for trivial code
, 0 otherwise.
874 proc check_effective_target_pe_aligned_commons
{} {
875 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
876 return [check_no_compiler_messages pe_aligned_commons object
{
878 } "-mpe-aligned-commons"]
883 #
Return 1 if the target supports
-static
884 proc check_effective_target_static
{} {
885 return [check_no_compiler_messages static executable
{
886 int main
(void
) { return 0; }
890 #
Return 1 if the target supports
-fstack
-protector
891 proc check_effective_target_fstack_protector
{} {
892 return [check_runtime fstack_protector
{
893 int main
(void
) { return 0; }
894 } "-fstack-protector"]
897 #
Return 1 if compilation with
-freorder
-blocks
-and
-partition is error
-free
898 #
for trivial code
, 0 otherwise.
900 proc check_effective_target_freorder
{} {
901 return [check_no_compiler_messages freorder object
{
903 } "-freorder-blocks-and-partition"]
906 #
Return 1 if -fpic and
-fPIC are supported
, as in no warnings or errors
907 # emitted
, 0 otherwise. Whether a shared library can actually be built is
908 # out of scope
for this test.
910 proc check_effective_target_fpic
{ } {
911 # Note that M68K has a multilib that supports
-fpic but not
912 #
-fPIC
, so we need to check both. We test with a
program that
913 # requires GOT references.
914 foreach
arg {fpic fPIC
} {
915 if [check_no_compiler_messages $
arg object
{
916 extern
int foo
(void
); extern
int bar
;
917 int baz
(void
) { return foo
() + bar
; }
925 #
Return 1 if -shared is supported
, as in no warnings or errors
926 # emitted
, 0 otherwise.
928 proc check_effective_target_shared
{ } {
929 # Note that M68K has a multilib that supports
-fpic but not
930 #
-fPIC
, so we need to check both. We test with a
program that
931 # requires GOT references.
932 return [check_no_compiler_messages shared executable
{
933 extern
int foo
(void
); extern
int bar
;
934 int baz
(void
) { return foo
() + bar
; }
938 #
Return 1 if -pie
, -fpie and
-fPIE are supported
, 0 otherwise.
940 proc check_effective_target_pie
{ } {
941 if { [istarget
*-*-darwin\
[912\
]*]
942 ||
[istarget
*-*-linux
*]
943 ||
[istarget
*-*-gnu
*] } {
949 #
Return true
if the target supports
-mpaired
-single
(as used
on MIPS
).
951 proc check_effective_target_mpaired_single
{ } {
952 return [check_no_compiler_messages mpaired_single object
{
957 #
Return true
if the target has access to FPU instructions.
959 proc check_effective_target_hard_float
{ } {
960 if { [istarget mips
*-*-*] } {
961 return [check_no_compiler_messages hard_float assembly
{
962 #
if (defined __mips_soft_float || defined __mips16
)
963 #error __mips_soft_float || __mips16
968 # This proc is actually checking the availabilty of FPU
969 # support
for doubles
, so
on the RX we must fail
if the
970 #
64-bit double multilib has been selected.
971 if { [istarget rx
-*-*] } {
973 #
return [check_no_compiler_messages hard_float assembly
{
974 #
if defined __RX_64_BIT_DOUBLES__
975 #error __RX_64_BIT_DOUBLES__
980 # The generic test equates hard_float with
"no call for adding doubles".
981 return [check_no_messages_and_pattern hard_float
"!\\(call" rtl-expand {
982 double a
(double b
, double c
) { return b
+ c
; }
986 #
Return true
if the target is a
64-bit MIPS target.
988 proc check_effective_target_mips64
{ } {
989 return [check_no_compiler_messages mips64 assembly
{
996 #
Return true
if the target is a MIPS target that does not produce
999 proc check_effective_target_nomips16
{ } {
1000 return [check_no_compiler_messages nomips16 object
{
1004 /* A cheap way of testing
for -mflip
-mips16.
*/
1005 void foo
(void
) { asm
("addiu $20,$20,1"); }
1006 void bar
(void
) { asm
("addiu $20,$20,1"); }
1011 # Add the options needed
for MIPS16 function attributes. At the moment
,
1012 # we don
't support MIPS16 PIC.
1014 proc add_options_for_mips16_attribute { flags } {
1015 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
1018 # Return true if we can force a mode that allows MIPS16 code generation.
1019 # We don't support MIPS16 PIC
, and only support MIPS16
-mhard
-float
1022 proc check_effective_target_mips16_attribute
{ } {
1023 return [check_no_compiler_messages mips16_attribute assembly
{
1027 #
if defined __mips_hard_float \
1028 && (!defined _ABIO32 || _MIPS_SIM
!= _ABIO32
) \
1029 && (!defined _ABIO64 || _MIPS_SIM
!= _ABIO64
)
1030 #error __mips_hard_float
&& (!_ABIO32 ||
!_ABIO64
)
1032 } [add_options_for_mips16_attribute
""]]
1035 #
Return 1 if the target supports long double larger than double when
1036 # using the new ABI
, 0 otherwise.
1038 proc check_effective_target_mips_newabi_large_long_double
{ } {
1039 return [check_no_compiler_messages mips_newabi_large_long_double object
{
1040 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1044 #
Return true
if the target is a MIPS target that has access
1045 # to the LL and SC instructions.
1047 proc check_effective_target_mips_llsc
{ } {
1048 if { ![istarget mips
*-*-*] } {
1051 # Assume that these instructions are always implemented
for
1052 # non
-elf
* targets
, via emulation
if necessary.
1053 if { ![istarget
*-*-elf
*] } {
1056 # Otherwise assume LL
/SC support
for everything but MIPS I.
1057 return [check_no_compiler_messages mips_llsc assembly
{
1064 #
Return true
if the target is a MIPS target that uses in
-place relocations.
1066 proc check_effective_target_mips_rel
{ } {
1067 if { ![istarget mips
*-*-*] } {
1070 return [check_no_compiler_messages mips_rel object
{
1071 #
if (defined _ABIN32
&& _MIPS_SIM
== _ABIN32
) \
1072 ||
(defined _ABI64
&& _MIPS_SIM
== _ABI64
)
1073 #error _ABIN32
&& (_ABIN32 || _ABI64
)
1078 #
Return true
if the target is a MIPS target that uses the EABI.
1080 proc check_effective_target_mips_eabi
{ } {
1081 if { ![istarget mips
*-*-*] } {
1084 return [check_no_compiler_messages mips_eabi object
{
1091 #
Return 1 if the current multilib does not generate PIC by default.
1093 proc check_effective_target_nonpic
{ } {
1094 return [check_no_compiler_messages nonpic assembly
{
1101 #
Return 1 if the current multilib generates PIE by default.
1103 proc check_effective_target_pie
{ } {
1104 return [check_no_compiler_messages pie assembly
{
1111 #
Return 1 if the target does not use a
status wrapper.
1113 proc check_effective_target_unwrapped
{ } {
1114 if { [target_info needs_status_wrapper
] != "" \
1115 && [target_info needs_status_wrapper
] != "0" } {
1121 #
Return true
if iconv is supported
on the target. In particular IBM1047.
1123 proc check_iconv_available
{ test_what
} {
1126 #
If the tool configuration file has not
set libiconv
, try
"-liconv"
1127 if { ![info exists libiconv
] } {
1128 set libiconv
"-liconv"
1130 set test_what
[lindex $test_what
1]
1131 return [check_runtime_nocache $test_what
[subst
{
1137 cd
= iconv_open
("$test_what", "UTF-8");
1138 if (cd
== (iconv_t
) -1)
1145 #
Return true
if Cilk Library is supported
on the target.
1146 proc check_libcilkrts_available
{ } {
1147 return [ check_no_compiler_messages_nocache libcilkrts_available executable
{
1151 int __cilkrts_set_param
(const char
*, const char
*);
1153 int x
= __cilkrts_set_param
("nworkers", "0");
1156 } "-fcilkplus -lcilkrts" ]
1159 #
Return true
if the atomic library is supported
on the target.
1160 proc check_effective_target_libatomic_available
{ } {
1161 return [check_no_compiler_messages libatomic_available executable
{
1162 int main
(void
) { return 0; }
1166 #
Return 1 if an ASCII locale is supported
on this host
, 0 otherwise.
1168 proc check_ascii_locale_available
{ } {
1172 #
Return true
if named sections are supported
on this target.
1174 proc check_named_sections_available
{ } {
1175 return [check_no_compiler_messages named_sections assembly
{
1176 int __attribute__
((section
("whatever"))) foo;
1180 #
Return true
if the
"naked" function attribute is supported on this target.
1182 proc check_effective_target_naked_functions
{ } {
1183 return [check_no_compiler_messages naked_functions assembly
{
1184 void f
() __attribute__
((naked
));
1188 #
Return 1 if the target supports Fortran real kinds larger than real
(8),
1191 # When the target
name changes
, replace the cached result.
1193 proc check_effective_target_fortran_large_real
{ } {
1194 return [check_no_compiler_messages fortran_large_real executable
{
1196 integer,parameter
:: k
= selected_real_kind
(precision
(0.0_8
) + 1)
1203 #
Return 1 if the target supports Fortran real kind real
(16),
1204 #
0 otherwise. Contrary to check_effective_target_fortran_large_real
1205 # this checks
for Real
(16) only
; the other returned real
(10) if
1206 # both real
(10) and real
(16) are available.
1208 # When the target
name changes
, replace the cached result.
1210 proc check_effective_target_fortran_real_16
{ } {
1211 return [check_no_compiler_messages fortran_real_16 executable
{
1220 #
Return 1 if the target supports Fortran
's IEEE modules,
1223 # When the target name changes, replace the cached result.
1225 proc check_effective_target_fortran_ieee { flags } {
1226 return [check_no_compiler_messages fortran_ieee executable {
1228 use, intrinsic :: ieee_features
1234 # Return 1 if the target supports SQRT for the largest floating-point
1235 # type. (Some targets lack the libm support for this FP type.)
1236 # On most targets, this check effectively checks either whether sqrtl is
1237 # available or on __float128 systems whether libquadmath is installed,
1238 # which provides sqrtq.
1240 # When the target name changes, replace the cached result.
1242 proc check_effective_target_fortran_largest_fp_has_sqrt { } {
1243 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable {
1245 use iso_fortran_env, only: real_kinds
1246 integer,parameter:: maxFP = real_kinds(ubound(real_kinds,dim=1))
1247 real(kind=maxFP), volatile :: x
1255 # Return 1 if the target supports Fortran integer kinds larger than
1256 # integer(8), 0 otherwise.
1258 # When the target name changes, replace the cached result.
1260 proc check_effective_target_fortran_large_int { } {
1261 return [check_no_compiler_messages fortran_large_int executable {
1263 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
1264 integer(kind=k) :: i
1269 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
1271 # When the target name changes, replace the cached result.
1273 proc check_effective_target_fortran_integer_16 { } {
1274 return [check_no_compiler_messages fortran_integer_16 executable {
1281 # Return 1 if we can statically link libgfortran, 0 otherwise.
1283 # When the target name changes, replace the cached result.
1285 proc check_effective_target_static_libgfortran { } {
1286 return [check_no_compiler_messages static_libgfortran executable {
1293 # Return 1 if cilk-plus is supported by the target, 0 otherwise.
1295 proc check_effective_target_cilkplus { } {
1296 # Skip cilk-plus tests on int16 and size16 targets for now.
1297 # The cilk-plus tests are not generic enough to cover these
1298 # cases and would throw hundreds of FAILs.
1299 if { [check_effective_target_int16]
1300 || ![check_effective_target_size32plus] } {
1304 # Skip AVR, its RAM is too small and too many tests would fail.
1305 if { [istarget avr-*-*] } {
1311 proc check_linker_plugin_available { } {
1312 return [check_no_compiler_messages_nocache linker_plugin executable {
1313 int main() { return 0; }
1314 } "-flto -fuse-linker-plugin"]
1317 # Return 1 if the target supports executing 750CL paired-single instructions, 0
1318 # otherwise. Cache the result.
1320 proc check_750cl_hw_available { } {
1321 return [check_cached_effective_target 750cl_hw_available {
1322 # If this is not the right target then we can skip the test.
1323 if { ![istarget powerpc-*paired*] } {
1326 check_runtime_nocache 750cl_hw_available {
1330 asm volatile ("ps_mul v0,v0,v0");
1332 asm volatile ("ps_mul 0,0,0");
1341 # Return 1 if the target OS supports running SSE executables, 0
1342 # otherwise. Cache the result.
1344 proc check_sse_os_support_available { } {
1345 return [check_cached_effective_target sse_os_support_available {
1346 # If this is not the right target then we can skip the test.
1347 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1349 } elseif { [istarget i?86-*-solaris2*] } {
1350 # The Solaris 2 kernel doesn't save and restore SSE registers
1351 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1352 check_runtime_nocache sse_os_support_available
{
1355 asm volatile
("movaps %xmm0,%xmm0");
1365 #
Return 1 if the target OS supports running AVX executables
, 0
1366 # otherwise.
Cache the result.
1368 proc check_avx_os_support_available
{ } {
1369 return [check_cached_effective_target avx_os_support_available
{
1370 #
If this is not the right target
then we can skip the test.
1371 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1374 # Check that OS has AVX and SSE saving enabled.
1375 check_runtime_nocache avx_os_support_available
{
1378 unsigned
int eax
, edx
;
1380 asm
("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1381 return (eax
& 6) != 6;
1388 #
Return 1 if the target supports executing SSE instructions
, 0
1389 # otherwise.
Cache the result.
1391 proc check_sse_hw_available
{ } {
1392 return [check_cached_effective_target sse_hw_available
{
1393 #
If this is not the right target
then we can skip the test.
1394 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1397 check_runtime_nocache sse_hw_available
{
1401 unsigned
int eax
, ebx
, ecx
, edx
;
1402 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1403 return !(edx
& bit_SSE
);
1411 #
Return 1 if the target supports executing SSE2 instructions
, 0
1412 # otherwise.
Cache the result.
1414 proc check_sse2_hw_available
{ } {
1415 return [check_cached_effective_target sse2_hw_available
{
1416 #
If this is not the right target
then we can skip the test.
1417 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1420 check_runtime_nocache sse2_hw_available
{
1424 unsigned
int eax
, ebx
, ecx
, edx
;
1425 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1426 return !(edx
& bit_SSE2
);
1434 #
Return 1 if the target supports executing AVX instructions
, 0
1435 # otherwise.
Cache the result.
1437 proc check_avx_hw_available
{ } {
1438 return [check_cached_effective_target avx_hw_available
{
1439 #
If this is not the right target
then we can skip the test.
1440 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1443 check_runtime_nocache avx_hw_available
{
1447 unsigned
int eax
, ebx
, ecx
, edx
;
1448 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1449 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1450 != (bit_AVX | bit_OSXSAVE
));
1458 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1460 proc check_effective_target_sse_runtime
{ } {
1461 if { [check_effective_target_sse
]
1462 && [check_sse_hw_available
]
1463 && [check_sse_os_support_available
] } {
1469 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1471 proc check_effective_target_sse2_runtime
{ } {
1472 if { [check_effective_target_sse2
]
1473 && [check_sse2_hw_available
]
1474 && [check_sse_os_support_available
] } {
1480 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1482 proc check_effective_target_avx_runtime
{ } {
1483 if { [check_effective_target_avx
]
1484 && [check_avx_hw_available
]
1485 && [check_avx_os_support_available
] } {
1491 #
Return 1 if the target supports executing power8 vector instructions
, 0
1492 # otherwise.
Cache the result.
1494 proc check_p8vector_hw_available
{ } {
1495 return [check_cached_effective_target p8vector_hw_available
{
1496 # Some simulators are known to not support VSX
/power8 instructions.
1497 #
For now
, disable
on Darwin
1498 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1501 set options
"-mpower8-vector"
1502 check_runtime_nocache p8vector_hw_available
{
1506 asm volatile
("xxlorc vs0,vs0,vs0");
1508 asm volatile
("xxlorc 0,0,0");
1517 #
Return 1 if the target supports executing VSX instructions
, 0
1518 # otherwise.
Cache the result.
1520 proc check_vsx_hw_available
{ } {
1521 return [check_cached_effective_target vsx_hw_available
{
1522 # Some simulators are known to not support VSX instructions.
1523 #
For now
, disable
on Darwin
1524 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1528 check_runtime_nocache vsx_hw_available
{
1532 asm volatile
("xxlor vs0,vs0,vs0");
1534 asm volatile
("xxlor 0,0,0");
1543 #
Return 1 if the target supports executing AltiVec instructions
, 0
1544 # otherwise.
Cache the result.
1546 proc check_vmx_hw_available
{ } {
1547 return [check_cached_effective_target vmx_hw_available
{
1548 # Some simulators are known to not support VMX instructions.
1549 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1552 # Most targets don
't require special flags for this test case, but
1553 # Darwin does. Just to be sure, make sure VSX is not enabled for
1554 # the altivec tests.
1555 if { [istarget *-*-darwin*]
1556 || [istarget *-*-aix*] } {
1557 set options "-maltivec -mno-vsx"
1559 set options "-mno-vsx"
1561 check_runtime_nocache vmx_hw_available {
1565 asm volatile ("vor v0,v0,v0");
1567 asm volatile ("vor 0,0,0");
1576 proc check_ppc_recip_hw_available { } {
1577 return [check_cached_effective_target ppc_recip_hw_available {
1578 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1579 # For now, disable on Darwin
1580 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1583 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1584 check_runtime_nocache ppc_recip_hw_available {
1585 volatile double d_recip, d_rsqrt, d_four = 4.0;
1586 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1589 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1590 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1591 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1592 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1600 # Return 1 if the target supports executing AltiVec and Cell PPU
1601 # instructions, 0 otherwise. Cache the result.
1603 proc check_effective_target_cell_hw { } {
1604 return [check_cached_effective_target cell_hw_available {
1605 # Some simulators are known to not support VMX and PPU instructions.
1606 if { [istarget powerpc-*-eabi*] } {
1609 # Most targets don't require special flags
for this test
1610 # case
, but Darwin and AIX
do.
1611 if { [istarget
*-*-darwin
*]
1612 ||
[istarget
*-*-aix
*] } {
1613 set options
"-maltivec -mcpu=cell"
1615 set options
"-mcpu=cell"
1617 check_runtime_nocache cell_hw_available
{
1621 asm volatile
("vor v0,v0,v0");
1622 asm volatile
("lvlx v0,r0,r0");
1624 asm volatile
("vor 0,0,0");
1625 asm volatile
("lvlx 0,0,0");
1634 #
Return 1 if the target supports executing
64-bit instructions
, 0
1635 # otherwise.
Cache the result.
1637 proc check_effective_target_powerpc64
{ } {
1638 global powerpc64_available_saved
1641 if [info exists powerpc64_available_saved
] {
1642 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1644 set powerpc64_available_saved
0
1646 # Some simulators are known to not support powerpc64 instructions.
1647 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1648 verbose
"check_effective_target_powerpc64 returning 0" 2
1649 return $powerpc64_available_saved
1652 #
Set up
, compile, and
execute a test
program containing a
64-bit
1653 # instruction.
Include the current process ID in the file
1654 # names to prevent conflicts with invocations
for multiple
1659 set f
[open $src
"w"]
1660 puts $f
"int main() {"
1661 puts $f
"#ifdef __MACH__"
1662 puts $f
" asm volatile (\"extsw r0,r0\");"
1664 puts $f
" asm volatile (\"extsw 0,0\");"
1666 puts $f
" return 0; }"
1669 set opts
"additional_flags=-mcpu=G5"
1671 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1672 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1675 if [string match
"" $lines] then {
1676 # No error message
, compilation succeeded.
1677 set result
[$
{tool
}_load
"./$exe" "" ""]
1678 set status [lindex $result
0]
1679 remote_file build
delete $exe
1680 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1682 if { $
status == "pass" } then {
1683 set powerpc64_available_saved
1
1686 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1690 return $powerpc64_available_saved
1693 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1694 # complex float arguments. This affects gfortran tests that
call cabsf
1695 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1696 #
argument passing as the compiler under test
, 0 otherwise.
1698 # When the target
name changes
, replace the cached result.
1700 proc check_effective_target_broken_cplxf_arg
{ } {
1701 return [check_cached_effective_target broken_cplxf_arg
{
1702 # Skip the work
for targets known not to be affected.
1703 if { ![istarget powerpc64
-*-linux
*] } {
1705 } elseif
{ ![is
-effective
-target lp64
] } {
1708 check_runtime_nocache broken_cplxf_arg
{
1709 #
include <complex.h
>
1710 extern void abort
(void
);
1711 float fabsf
(float
);
1712 float cabsf
(_Complex float
);
1719 if (fabsf
(f
- 5.0) > 0.0001)
1728 #
Return 1 is this is a TI C6X target supporting C67X instructions
1729 proc check_effective_target_ti_c67x
{ } {
1730 return [check_no_compiler_messages ti_c67x assembly
{
1731 #
if !defined
(_TMS320C6700
)
1732 #error
!_TMS320C6700
1737 #
Return 1 is this is a TI C6X target supporting C64X
+ instructions
1738 proc check_effective_target_ti_c64xp
{ } {
1739 return [check_no_compiler_messages ti_c64xp assembly
{
1740 #
if !defined
(_TMS320C6400_PLUS
)
1741 #error
!_TMS320C6400_PLUS
1747 proc check_alpha_max_hw_available
{ } {
1748 return [check_runtime alpha_max_hw_available
{
1749 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1753 # Returns true iff the FUNCTION is available
on the target
system.
1754 #
(This is essentially a Tcl implementation of Autoconf
's
1757 proc check_function_available { function } {
1758 return [check_no_compiler_messages ${function}_available \
1764 int main () { $function (); }
1768 # Returns true iff "fork" is available on the target system.
1770 proc check_fork_available {} {
1771 return [check_function_available "fork"]
1774 # Returns true iff "mkfifo" is available on the target system.
1776 proc check_mkfifo_available {} {
1777 if { [istarget *-*-cygwin*] } {
1778 # Cygwin has mkfifo, but support is incomplete.
1782 return [check_function_available "mkfifo"]
1785 # Returns true iff "__cxa_atexit" is used on the target system.
1787 proc check_cxa_atexit_available { } {
1788 return [check_cached_effective_target cxa_atexit_available {
1789 if { [istarget hppa*-*-hpux10*] } {
1790 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1792 } elseif
{ [istarget
*-*-vxworks
] } {
1793 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1796 check_runtime_nocache cxa_atexit_available {
1799 static unsigned int count;
1816 Y() { f(); count = 2; }
1825 int main() { return 0; }
1831 proc check_effective_target_objc2 { } {
1832 return [check_no_compiler_messages objc2 object {
1841 proc check_effective_target_next_runtime { } {
1842 return [check_no_compiler_messages objc2 object {
1843 #ifdef __NEXT_RUNTIME__
1846 #error !__NEXT_RUNTIME__
1851 # Return 1 if we're generating
32-bit code using default options
, 0
1854 proc check_effective_target_ilp32
{ } {
1855 return [check_no_compiler_messages ilp32 object
{
1856 int dummy
[sizeof
(int) == 4
1857 && sizeof
(void
*) == 4
1858 && sizeof
(long
) == 4 ?
1 : -1];
1862 #
Return 1 if we
're generating ia32 code using default options, 0
1865 proc check_effective_target_ia32 { } {
1866 return [check_no_compiler_messages ia32 object {
1867 int dummy[sizeof (int) == 4
1868 && sizeof (void *) == 4
1869 && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
1873 # Return 1 if we're generating x32 code using default options
, 0
1876 proc check_effective_target_x32
{ } {
1877 return [check_no_compiler_messages x32 object
{
1878 int dummy
[sizeof
(int) == 4
1879 && sizeof
(void
*) == 4
1880 && sizeof
(long
) == 4 ?
1 : -1] = { __x86_64__
};
1884 #
Return 1 if we
're generating 32-bit integers using default
1885 # options, 0 otherwise.
1887 proc check_effective_target_int32 { } {
1888 return [check_no_compiler_messages int32 object {
1889 int dummy[sizeof (int) == 4 ? 1 : -1];
1893 # Return 1 if we're generating
32-bit or larger integers using default
1894 # options
, 0 otherwise.
1896 proc check_effective_target_int32plus
{ } {
1897 return [check_no_compiler_messages int32plus object
{
1898 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1902 #
Return 1 if we
're generating 32-bit or larger pointers using default
1903 # options, 0 otherwise.
1905 proc check_effective_target_ptr32plus { } {
1906 # The msp430 has 16-bit or 20-bit pointers. The 20-bit pointer is stored
1907 # in a 32-bit slot when in memory, so sizeof(void *) returns 4, but it
1908 # cannot really hold a 32-bit address, so we always return false here.
1909 if { [istarget msp430-*-*] } {
1913 return [check_no_compiler_messages ptr32plus object {
1914 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1918 # Return 1 if we support 32-bit or larger array and structure sizes
1919 # using default options, 0 otherwise. Avoid false positive on
1920 # targets with 20 or 24 bit address spaces.
1922 proc check_effective_target_size32plus { } {
1923 return [check_no_compiler_messages size32plus object {
1924 char dummy[16777217L];
1928 # Returns 1 if we're generating
16-bit or smaller integers with the
1929 # default options
, 0 otherwise.
1931 proc check_effective_target_int16
{ } {
1932 return [check_no_compiler_messages int16 object
{
1933 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1937 #
Return 1 if we
're generating 64-bit code using default options, 0
1940 proc check_effective_target_lp64 { } {
1941 return [check_no_compiler_messages lp64 object {
1942 int dummy[sizeof (int) == 4
1943 && sizeof (void *) == 8
1944 && sizeof (long) == 8 ? 1 : -1];
1948 # Return 1 if we're generating
64-bit code using default llp64 options
,
1951 proc check_effective_target_llp64
{ } {
1952 return [check_no_compiler_messages llp64 object
{
1953 int dummy
[sizeof
(int) == 4
1954 && sizeof
(void
*) == 8
1955 && sizeof
(long long
) == 8
1956 && sizeof
(long
) == 4 ?
1 : -1];
1960 #
Return 1 if long and
int have different sizes
,
1963 proc check_effective_target_long_neq_int
{ } {
1964 return [check_no_compiler_messages long_ne_int object
{
1965 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1969 #
Return 1 if the target supports long double larger than double
,
1972 proc check_effective_target_large_long_double
{ } {
1973 return [check_no_compiler_messages large_long_double object
{
1974 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1978 #
Return 1 if the target supports double larger than float
,
1981 proc check_effective_target_large_double
{ } {
1982 return [check_no_compiler_messages large_double object
{
1983 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
1987 #
Return 1 if the target supports long double of
128 bits
,
1990 proc check_effective_target_longdouble128
{ } {
1991 return [check_no_compiler_messages longdouble128 object
{
1992 int dummy
[sizeof
(long double
) == 16 ?
1 : -1];
1996 #
Return 1 if the target supports double of
64 bits
,
1999 proc check_effective_target_double64
{ } {
2000 return [check_no_compiler_messages double64 object
{
2001 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
2005 #
Return 1 if the target supports double of at least
64 bits
,
2008 proc check_effective_target_double64plus
{ } {
2009 return [check_no_compiler_messages double64plus object
{
2010 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
2014 #
Return 1 if the target supports
'w' suffix
on floating constant
2017 proc check_effective_target_has_w_floating_suffix
{ } {
2019 if [check_effective_target_c
++] {
2020 append opts
"-std=gnu++03"
2022 return [check_no_compiler_messages w_fp_suffix object
{
2027 #
Return 1 if the target supports
'q' suffix
on floating constant
2030 proc check_effective_target_has_q_floating_suffix
{ } {
2032 if [check_effective_target_c
++] {
2033 append opts
"-std=gnu++03"
2035 return [check_no_compiler_messages q_fp_suffix object
{
2039 #
Return 1 if the target supports compiling fixed
-point
,
2042 proc check_effective_target_fixed_point
{ } {
2043 return [check_no_compiler_messages fixed_point object
{
2044 _Sat _Fract x
; _Sat _Accum y
;
2048 #
Return 1 if the target supports compiling decimal floating point
,
2051 proc check_effective_target_dfp_nocache
{ } {
2052 verbose
"check_effective_target_dfp_nocache: compiling source" 2
2053 set ret
[check_no_compiler_messages_nocache dfp object
{
2054 float x __attribute__
((mode(DD
)));
2056 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
2060 proc check_effective_target_dfprt_nocache
{ } {
2061 return [check_runtime_nocache dfprt
{
2062 typedef float d64 __attribute__
((mode(DD
)));
2063 d64 x
= 1.2df
, y
= 2.3dd
, z
;
2064 int main
() { z
= x
+ y
; return 0; }
2068 #
Return 1 if the target supports compiling Decimal Floating Point
,
2071 # This won
't change for different subtargets so cache the result.
2073 proc check_effective_target_dfp { } {
2074 return [check_cached_effective_target dfp {
2075 check_effective_target_dfp_nocache
2079 # Return 1 if the target supports linking and executing Decimal Floating
2080 # Point, 0 otherwise.
2082 # This won't change
for different subtargets so
cache the result.
2084 proc check_effective_target_dfprt
{ } {
2085 return [check_cached_effective_target dfprt
{
2086 check_effective_target_dfprt_nocache
2090 #
Return 1 if the target supports executing DFP hardware instructions
,
2091 #
0 otherwise.
Cache the result.
2093 proc check_dfp_hw_available
{ } {
2094 return [check_cached_effective_target dfp_hw_available
{
2095 #
For now
, disable
on Darwin
2096 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
2099 check_runtime_nocache dfp_hw_available
{
2100 volatile _Decimal64 r
;
2101 volatile _Decimal64 a
= 4.0DD
;
2102 volatile _Decimal64 b
= 2.0DD
;
2105 asm volatile
("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2106 asm volatile
("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2107 asm volatile
("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2108 asm volatile
("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
2111 } "-mcpu=power6 -mhard-float"
2116 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2118 proc check_effective_target_ucn_nocache
{ } {
2119 #
-std
=c99 is only valid
for C
2120 if [check_effective_target_c
] {
2121 set ucnopts
"-std=c99"
2125 verbose
"check_effective_target_ucn_nocache: compiling source" 2
2126 set ret
[check_no_compiler_messages_nocache ucn object
{
2129 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
2133 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
2135 # This won
't change for different subtargets, so cache the result.
2137 proc check_effective_target_ucn { } {
2138 return [check_cached_effective_target ucn {
2139 check_effective_target_ucn_nocache
2143 # Return 1 if the target needs a command line argument to enable a SIMD
2146 proc check_effective_target_vect_cmdline_needed { } {
2147 global et_vect_cmdline_needed_saved
2148 global et_vect_cmdline_needed_target_name
2150 if { ![info exists et_vect_cmdline_needed_target_name] } {
2151 set et_vect_cmdline_needed_target_name ""
2154 # If the target has changed since we set the cached value, clear it.
2155 set current_target [current_target_name]
2156 if { $current_target != $et_vect_cmdline_needed_target_name } {
2157 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
2158 set et_vect_cmdline_needed_target_name $current_target
2159 if { [info exists et_vect_cmdline_needed_saved] } {
2160 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
2161 unset et_vect_cmdline_needed_saved
2165 if [info exists et_vect_cmdline_needed_saved] {
2166 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
2168 set et_vect_cmdline_needed_saved 1
2169 if { [istarget alpha*-*-*]
2170 || [istarget ia64-*-*]
2171 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
2172 && ([check_effective_target_x32]
2173 || [check_effective_target_lp64]))
2174 || ([istarget powerpc*-*-*]
2175 && ([check_effective_target_powerpc_spe]
2176 || [check_effective_target_powerpc_altivec]))
2177 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
2178 || [istarget spu-*-*]
2179 || ([istarget arm*-*-*] && [check_effective_target_arm_neon])
2180 || [istarget aarch64*-*-*] } {
2181 set et_vect_cmdline_needed_saved 0
2185 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
2186 return $et_vect_cmdline_needed_saved
2189 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
2191 # This won't change
for different subtargets so
cache the result.
2193 proc check_effective_target_vect_int
{ } {
2194 global et_vect_int_saved
2196 if [info exists et_vect_int_saved
] {
2197 verbose
"check_effective_target_vect_int: using cached result" 2
2199 set et_vect_int_saved
0
2200 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
2201 ||
([istarget powerpc
*-*-*]
2202 && ![istarget powerpc
-*-linux
*paired
*])
2203 ||
[istarget spu
-*-*]
2204 ||
[istarget sparc
*-*-*]
2205 ||
[istarget alpha
*-*-*]
2206 ||
[istarget ia64
-*-*]
2207 ||
[istarget aarch64
*-*-*]
2208 ||
[check_effective_target_arm32
]
2209 ||
([istarget mips
*-*-*]
2210 && [check_effective_target_mips_loongson
]) } {
2211 set et_vect_int_saved
1
2215 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
2216 return $et_vect_int_saved
2219 #
Return 1 if the target supports signed
int->float conversion
2222 proc check_effective_target_vect_intfloat_cvt
{ } {
2223 global et_vect_intfloat_cvt_saved
2225 if [info exists et_vect_intfloat_cvt_saved
] {
2226 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
2228 set et_vect_intfloat_cvt_saved
0
2229 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
2230 ||
([istarget powerpc
*-*-*]
2231 && ![istarget powerpc
-*-linux
*paired
*])
2232 ||
([istarget arm
*-*-*]
2233 && [check_effective_target_arm_neon_ok
])} {
2234 set et_vect_intfloat_cvt_saved
1
2238 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
2239 return $et_vect_intfloat_cvt_saved
2242 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
2244 proc check_effective_target_int128 { } {
2245 return [check_no_compiler_messages int128 object {
2247 #ifndef __SIZEOF_INT128__
2256 # Return 1 if the target supports unsigned int->float conversion
2259 proc check_effective_target_vect_uintfloat_cvt { } {
2260 global et_vect_uintfloat_cvt_saved
2262 if [info exists et_vect_uintfloat_cvt_saved] {
2263 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2265 set et_vect_uintfloat_cvt_saved 0
2266 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
2267 || ([istarget powerpc*-*-*]
2268 && ![istarget powerpc-*-linux*paired*])
2269 || [istarget aarch64*-*-*]
2270 || ([istarget arm*-*-*]
2271 && [check_effective_target_arm_neon_ok])} {
2272 set et_vect_uintfloat_cvt_saved 1
2276 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2277 return $et_vect_uintfloat_cvt_saved
2281 # Return 1 if the target supports signed float->int conversion
2284 proc check_effective_target_vect_floatint_cvt { } {
2285 global et_vect_floatint_cvt_saved
2287 if [info exists et_vect_floatint_cvt_saved] {
2288 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2290 set et_vect_floatint_cvt_saved 0
2291 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
2292 || ([istarget powerpc*-*-*]
2293 && ![istarget powerpc-*-linux*paired*])
2294 || ([istarget arm*-*-*]
2295 && [check_effective_target_arm_neon_ok])} {
2296 set et_vect_floatint_cvt_saved 1
2300 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2301 return $et_vect_floatint_cvt_saved
2304 # Return 1 if the target supports unsigned float->int conversion
2307 proc check_effective_target_vect_floatuint_cvt { } {
2308 global et_vect_floatuint_cvt_saved
2310 if [info exists et_vect_floatuint_cvt_saved] {
2311 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2313 set et_vect_floatuint_cvt_saved 0
2314 if { ([istarget powerpc*-*-*]
2315 && ![istarget powerpc-*-linux*paired*])
2316 || ([istarget arm*-*-*]
2317 && [check_effective_target_arm_neon_ok])} {
2318 set et_vect_floatuint_cvt_saved 1
2322 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2323 return $et_vect_floatuint_cvt_saved
2326 # Return 1 if the target supports #pragma omp declare simd, 0 otherwise.
2328 # This won't change
for different subtargets so
cache the result.
2330 proc check_effective_target_vect_simd_clones
{ } {
2331 global et_vect_simd_clones_saved
2333 if [info exists et_vect_simd_clones_saved
] {
2334 verbose
"check_effective_target_vect_simd_clones: using cached result" 2
2336 set et_vect_simd_clones_saved
0
2337 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
2338 #
On i?
86/x86_64 #pragma omp declare simd builds a sse2
, avx and
2339 # avx2 clone. Only the right clone
for the specified arch will be
2340 # chosen
, but still we need to at least be able to assemble
2342 if { [check_effective_target_avx2
] } {
2343 set et_vect_simd_clones_saved
1
2348 verbose
"check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2
2349 return $et_vect_simd_clones_saved
2352 #
Return 1 if this is a AArch64 target supporting big endian
2353 proc check_effective_target_aarch64_big_endian
{ } {
2354 return [check_no_compiler_messages aarch64_big_endian assembly
{
2355 #
if !defined
(__aarch64__
) ||
!defined
(__AARCH64EB__
)
2356 #error
!__aarch64__ ||
!__AARCH64EB__
2361 #
Return 1 if this is a AArch64 target supporting little endian
2362 proc check_effective_target_aarch64_little_endian
{ } {
2363 return [check_no_compiler_messages aarch64_little_endian assembly
{
2364 #
if !defined
(__aarch64__
) || defined
(__AARCH64EB__
)
2370 #
Return 1 if this is an arm target using
32-bit instructions
2371 proc check_effective_target_arm32
{ } {
2372 return [check_no_compiler_messages arm32 assembly
{
2373 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
2374 #error
!__arm || __thumb__
&& !__thumb2__
2379 #
Return 1 if this is an arm target not using Thumb
2380 proc check_effective_target_arm_nothumb
{ } {
2381 return [check_no_compiler_messages arm_nothumb assembly
{
2382 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) || defined
(__thumb2__
))
2383 #error
!__arm__ || __thumb || __thumb2__
2388 #
Return 1 if this is a little
-endian ARM target
2389 proc check_effective_target_arm_little_endian
{ } {
2390 return [check_no_compiler_messages arm_little_endian assembly
{
2391 #
if !defined
(__arm__
) ||
!defined
(__ARMEL__
)
2392 #error
!__arm__ ||
!__ARMEL__
2397 #
Return 1 if this is an ARM target that only supports aligned vector accesses
2398 proc check_effective_target_arm_vect_no_misalign
{ } {
2399 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
2400 #
if !defined
(__arm__
) \
2401 ||
(defined
(__ARM_FEATURE_UNALIGNED
) \
2402 && defined
(__ARMEL__
))
2403 #error
!__arm__ ||
(__ARMEL__
&& __ARM_FEATURE_UNALIGNED
)
2409 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2410 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
2413 proc check_effective_target_arm_vfp_ok
{ } {
2414 if { [check_effective_target_arm32
] } {
2415 return [check_no_compiler_messages arm_vfp_ok object
{
2417 } "-mfpu=vfp -mfloat-abi=softfp"]
2423 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp3
2424 #
-mfloat
-abi
=softfp.
2426 proc check_effective_target_arm_vfp3_ok
{ } {
2427 if { [check_effective_target_arm32
] } {
2428 return [check_no_compiler_messages arm_vfp3_ok object
{
2430 } "-mfpu=vfp3 -mfloat-abi=softfp"]
2436 #
Return 1 if this is an ARM target supporting
-mfpu
=fp
-armv8
2437 #
-mfloat
-abi
=softfp.
2438 proc check_effective_target_arm_v8_vfp_ok
{} {
2439 if { [check_effective_target_arm32
] } {
2440 return [check_no_compiler_messages arm_v8_vfp_ok object
{
2443 __asm__ volatile
("vrinta.f32.f32 s0, s0");
2446 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2452 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
2453 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
2456 proc check_effective_target_arm_hard_vfp_ok
{ } {
2457 if { [check_effective_target_arm32
]
2458 && ! [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2459 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
2460 int main
() { return 0;}
2461 } "-mfpu=vfp -mfloat-abi=hard"]
2467 #
Return 1 if this is an ARM target that supports DSP multiply with
2468 # current multilib flags.
2470 proc check_effective_target_arm_dsp
{ } {
2471 return [check_no_compiler_messages arm_dsp assembly
{
2472 #ifndef __ARM_FEATURE_DSP
2479 #
Return 1 if this is an ARM target that supports unaligned word
/halfword
2480 #
load/store instructions.
2482 proc check_effective_target_arm_unaligned
{ } {
2483 return [check_no_compiler_messages arm_unaligned assembly
{
2484 #ifndef __ARM_FEATURE_UNALIGNED
2485 #error no unaligned support
2491 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2492 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2493 # incompatible with these options. Also
set et_arm_crypto_flags to the
2494 # best options to add.
2496 proc check_effective_target_arm_crypto_ok_nocache
{ } {
2497 global et_arm_crypto_flags
2498 set et_arm_crypto_flags
""
2499 if { [check_effective_target_arm32
] } {
2500 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
2501 if { [check_no_compiler_messages_nocache arm_crypto_ok object
{
2502 #
include "arm_neon.h"
2504 foo
(uint8x16_t a
, uint8x16_t b
)
2506 return vaeseq_u8
(a
, b
);
2509 set et_arm_crypto_flags $flags
2518 #
Return 1 if this is an ARM target supporting
-mfpu
=crypto
-neon
-fp
-armv8
2520 proc check_effective_target_arm_crypto_ok
{ } {
2521 return [check_cached_effective_target arm_crypto_ok \
2522 check_effective_target_arm_crypto_ok_nocache
]
2525 # Add options
for crypto extensions.
2526 proc add_options_for_arm_crypto
{ flags
} {
2527 if { ! [check_effective_target_arm_crypto_ok
] } {
2530 global et_arm_crypto_flags
2531 return "$flags $et_arm_crypto_flags"
2534 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2535 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2536 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2537 # NEON
, do not add
-mfpu
=neon.
2539 proc add_options_for_arm_neon
{ flags
} {
2540 if { ! [check_effective_target_arm_neon_ok
] } {
2543 global et_arm_neon_flags
2544 return "$flags $et_arm_neon_flags"
2547 proc add_options_for_arm_v8_vfp
{ flags
} {
2548 if { ! [check_effective_target_arm_v8_vfp_ok
] } {
2551 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2554 proc add_options_for_arm_v8_neon
{ flags
} {
2555 if { ! [check_effective_target_arm_v8_neon_ok
] } {
2558 global et_arm_v8_neon_flags
2559 return "$flags $et_arm_v8_neon_flags -march=armv8-a"
2562 proc add_options_for_arm_crc
{ flags
} {
2563 if { ! [check_effective_target_arm_crc_ok
] } {
2566 global et_arm_crc_flags
2567 return "$flags $et_arm_crc_flags"
2570 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2571 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2572 # multilib
, use it. Similarly
, if a
-mfpu option already enables
2573 # NEON
, do not add
-mfpu
=neon.
2575 proc add_options_for_arm_neonv2
{ flags
} {
2576 if { ! [check_effective_target_arm_neonv2_ok
] } {
2579 global et_arm_neonv2_flags
2580 return "$flags $et_arm_neonv2_flags"
2583 # Add the options needed
for vfp3.
2584 proc add_options_for_arm_vfp3
{ flags
} {
2585 if { ! [check_effective_target_arm_vfp3_ok
] } {
2588 return "$flags -mfpu=vfp3 -mfloat-abi=softfp"
2591 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
2592 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2593 # incompatible with these options. Also
set et_arm_neon_flags to the
2594 # best options to add.
2596 proc check_effective_target_arm_neon_ok_nocache
{ } {
2597 global et_arm_neon_flags
2598 set et_arm_neon_flags
""
2599 if { [check_effective_target_arm32
] } {
2600 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2601 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
2602 #
include "arm_neon.h"
2604 /* Avoid the case where a test adds
-mfpu
=neon
, but the toolchain is
2605 configured
for -mcpu
=arm926ej
-s
, for example.
*/
2607 #error Architecture too old
for NEON.
2610 set et_arm_neon_flags $flags
2619 proc check_effective_target_arm_neon_ok
{ } {
2620 return [check_cached_effective_target arm_neon_ok \
2621 check_effective_target_arm_neon_ok_nocache
]
2624 proc check_effective_target_arm_crc_ok_nocache
{ } {
2625 global et_arm_crc_flags
2626 set et_arm_crc_flags
"-march=armv8-a+crc"
2627 return [check_no_compiler_messages_nocache arm_crc_ok object
{
2628 #
if !defined
(__ARM_FEATURE_CRC32
)
2631 } "$et_arm_crc_flags"]
2634 proc check_effective_target_arm_crc_ok
{ } {
2635 return [check_cached_effective_target arm_crc_ok \
2636 check_effective_target_arm_crc_ok_nocache
]
2639 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
2640 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2641 # incompatible with these options. Also
set et_arm_neon_flags to the
2642 # best options to add.
2644 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
2645 global et_arm_neon_fp16_flags
2646 set et_arm_neon_fp16_flags
""
2647 if { [check_effective_target_arm32
] } {
2648 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
2649 "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
2650 if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object
{
2651 #
include "arm_neon.h"
2653 foo
(float32x4_t
arg)
2655 return vcvt_f16_f32
(arg);
2658 set et_arm_neon_fp16_flags $flags
2667 proc check_effective_target_arm_neon_fp16_ok
{ } {
2668 return [check_cached_effective_target arm_neon_fp16_ok \
2669 check_effective_target_arm_neon_fp16_ok_nocache
]
2672 proc add_options_for_arm_neon_fp16
{ flags
} {
2673 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
2676 global et_arm_neon_fp16_flags
2677 return "$flags $et_arm_neon_fp16_flags"
2680 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp
-armv8
2681 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2682 # incompatible with these options. Also
set et_arm_v8_neon_flags to the
2683 # best options to add.
2685 proc check_effective_target_arm_v8_neon_ok_nocache
{ } {
2686 global et_arm_v8_neon_flags
2687 set et_arm_v8_neon_flags
""
2688 if { [check_effective_target_arm32
] } {
2689 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
2690 if { [check_no_compiler_messages_nocache arm_v8_neon_ok object
{
2692 #error not armv8 or later
2694 #
include "arm_neon.h"
2698 __asm__ volatile
("vrintn.f32 q0, q0");
2700 } "$flags -march=armv8-a"] } {
2701 set et_arm_v8_neon_flags $flags
2710 proc check_effective_target_arm_v8_neon_ok
{ } {
2711 return [check_cached_effective_target arm_v8_neon_ok \
2712 check_effective_target_arm_v8_neon_ok_nocache
]
2715 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-vfpv4
2716 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
2717 # incompatible with these options. Also
set et_arm_neonv2_flags to the
2718 # best options to add.
2720 proc check_effective_target_arm_neonv2_ok_nocache
{ } {
2721 global et_arm_neonv2_flags
2722 set et_arm_neonv2_flags
""
2723 if { [check_effective_target_arm32
] } {
2724 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2725 if { [check_no_compiler_messages_nocache arm_neonv2_ok object
{
2726 #
include "arm_neon.h"
2728 foo
(float32x2_t a
, float32x2_t b
, float32x2_t c
)
2730 return vfma_f32
(a
, b
, c
);
2733 set et_arm_neonv2_flags $flags
2742 proc check_effective_target_arm_neonv2_ok
{ } {
2743 return [check_cached_effective_target arm_neonv2_ok \
2744 check_effective_target_arm_neonv2_ok_nocache
]
2747 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
2748 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
2751 proc add_options_for_arm_fp16
{ flags
} {
2752 if { ! [check_effective_target_arm_fp16_ok
] } {
2755 global et_arm_fp16_flags
2756 return "$flags $et_arm_fp16_flags"
2759 #
Return 1 if this is an ARM target that can support a VFP fp16 variant.
2760 # Skip multilibs that are incompatible with these options and
set
2761 # et_arm_fp16_flags to the best options to add.
2763 proc check_effective_target_arm_fp16_ok_nocache
{ } {
2764 global et_arm_fp16_flags
2765 set et_arm_fp16_flags
""
2766 if { ! [check_effective_target_arm32
] } {
2769 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2770 # Multilib flags would override
-mfpu.
2773 if [check
-flags
[list
"" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2774 # Must generate floating
-point instructions.
2777 if [check_effective_target_arm_hf_eabi
] {
2778 # Use existing float
-abi and force an fpu which supports fp16
2779 set et_arm_fp16_flags
"-mfpu=vfpv4"
2782 if [check
-flags
[list
"" { *-*-* } { "-mfpu=*" } { "" } ]] {
2783 # The existing
-mfpu value is OK
; use it
, but add softfp.
2784 set et_arm_fp16_flags
"-mfloat-abi=softfp"
2787 # Add
-mfpu
for a VFP fp16 variant since there is no preprocessor
2788 # macro to check
for this support.
2789 set flags
"-mfpu=vfpv4 -mfloat-abi=softfp"
2790 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly
{
2793 set et_arm_fp16_flags
"$flags"
2800 proc check_effective_target_arm_fp16_ok
{ } {
2801 return [check_cached_effective_target arm_fp16_ok \
2802 check_effective_target_arm_fp16_ok_nocache
]
2805 # Creates a series of routines that
return 1 if the given architecture
2806 # can be selected and a routine to give the flags to select that architecture
2807 # Note
: Extra flags may be added to disable options from newer compilers
2808 #
(Thumb in particular
- but others may be added in the future
)
2809 # Usage
: /* { dg
-require
-effective
-target arm_arch_v5_ok
} */
2810 #
/* { dg
-add
-options arm_arch_v5
} */
2811 #
/* { dg
-require
-effective
-target arm_arch_v5_multilib
} */
2812 foreach
{ armfunc armflag armdef
} { v4
"-march=armv4 -marm" __ARM_ARCH_4__
2813 v4t
"-march=armv4t" __ARM_ARCH_4T__
2814 v5
"-march=armv5 -marm" __ARM_ARCH_5__
2815 v5t
"-march=armv5t" __ARM_ARCH_5T__
2816 v5te
"-march=armv5te" __ARM_ARCH_5TE__
2817 v6
"-march=armv6" __ARM_ARCH_6__
2818 v6k
"-march=armv6k" __ARM_ARCH_6K__
2819 v6t2
"-march=armv6t2" __ARM_ARCH_6T2__
2820 v6z
"-march=armv6z" __ARM_ARCH_6Z__
2821 v6m
"-march=armv6-m -mthumb" __ARM_ARCH_6M__
2822 v7a
"-march=armv7-a" __ARM_ARCH_7A__
2823 v7ve
"-march=armv7ve" __ARM_ARCH_7A__
2824 v7r
"-march=armv7-r" __ARM_ARCH_7R__
2825 v7m
"-march=armv7-m -mthumb" __ARM_ARCH_7M__
2826 v7em
"-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2827 v8a
"-march=armv8-a" __ARM_ARCH_8A__ } {
2828 eval
[string map
[list FUNC $armfunc FLAG $armflag DEF $armdef
] {
2829 proc check_effective_target_arm_arch_FUNC_ok
{ } {
2830 if { [ string match
"*-marm*" "FLAG" ] &&
2831 ![check_effective_target_arm_arm_ok
] } {
2834 return [check_no_compiler_messages arm_arch_FUNC_ok assembly
{
2841 proc add_options_for_arm_arch_FUNC
{ flags
} {
2842 return "$flags FLAG"
2845 proc check_effective_target_arm_arch_FUNC_multilib
{ } {
2846 return [check_runtime arm_arch_FUNC_multilib
{
2852 } [add_options_for_arm_arch_FUNC
""]]
2857 #
Return 1 if this is an ARM target where
-marm causes ARM to be
2860 proc check_effective_target_arm_arm_ok
{ } {
2861 return [check_no_compiler_messages arm_arm_ok assembly
{
2862 #
if !defined
(__arm__
) || defined
(__thumb__
) || defined
(__thumb2__
)
2863 #error
!__arm__ || __thumb__ || __thumb2__
2869 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
2872 proc check_effective_target_arm_thumb1_ok
{ } {
2873 return [check_no_compiler_messages arm_thumb1_ok assembly
{
2874 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2875 #error
!__arm__ ||
!__thumb__ || __thumb2__
2877 int foo
(int i
) { return i
; }
2881 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
2884 proc check_effective_target_arm_thumb2_ok
{ } {
2885 return [check_no_compiler_messages arm_thumb2_ok assembly
{
2886 #
if !defined
(__thumb2__
)
2889 int foo
(int i
) { return i
; }
2893 #
Return 1 if this is an ARM target where Thumb
-1 is used without options
2894 # added by the test.
2896 proc check_effective_target_arm_thumb1
{ } {
2897 return [check_no_compiler_messages arm_thumb1 assembly
{
2898 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
2899 #error
!__arm__ ||
!__thumb__ || __thumb2__
2905 #
Return 1 if this is an ARM target where Thumb
-2 is used without options
2906 # added by the test.
2908 proc check_effective_target_arm_thumb2
{ } {
2909 return [check_no_compiler_messages arm_thumb2 assembly
{
2910 #
if !defined
(__thumb2__
)
2917 #
Return 1 if this is an ARM target where conditional execution is available.
2919 proc check_effective_target_arm_cond_exec
{ } {
2920 return [check_no_compiler_messages arm_cond_exec assembly
{
2921 #
if defined
(__arm__
) && defined
(__thumb__
) && !defined
(__thumb2__
)
2928 #
Return 1 if this is an ARM cortex
-M profile cpu
2930 proc check_effective_target_arm_cortex_m
{ } {
2931 if { ![istarget arm
*-*-*] } {
2934 return [check_no_compiler_messages arm_cortex_m assembly
{
2935 #
if !defined
(__ARM_ARCH_7M__
) \
2936 && !defined
(__ARM_ARCH_7EM__
) \
2937 && !defined
(__ARM_ARCH_6M__
)
2938 #error
!__ARM_ARCH_7M__
&& !__ARM_ARCH_7EM__
&& !__ARM_ARCH_6M__
2944 #
Return 1 if the target supports executing NEON instructions
, 0
2945 # otherwise.
Cache the result.
2947 proc check_effective_target_arm_neon_hw
{ } {
2948 return [check_runtime arm_neon_hw_available
{
2952 long long a
= 0, b
= 1;
2953 asm
("vorr %P0, %P1, %P2"
2955 : "0" (a), "w" (b));
2958 } [add_options_for_arm_neon
""]]
2961 proc check_effective_target_arm_neonv2_hw
{ } {
2962 return [check_runtime arm_neon_hwv2_available
{
2963 #
include "arm_neon.h"
2967 float32x2_t a
, b
, c
;
2968 asm
("vfma.f32 %P0, %P1, %P2"
2970 : "w" (b), "w" (c));
2973 } [add_options_for_arm_neonv2
""]]
2976 #
Return 1 if the target supports executing ARMv8 NEON instructions
, 0
2979 proc check_effective_target_arm_v8_neon_hw
{ } {
2980 return [check_runtime arm_v8_neon_hw_available
{
2981 #
include "arm_neon.h"
2986 asm
("vrinta.f32 %P0, %P1"
2991 } [add_options_for_arm_v8_neon
""]]
2994 #
Return 1 if this is a ARM target with NEON enabled.
2996 proc check_effective_target_arm_neon
{ } {
2997 if { [check_effective_target_arm32
] } {
2998 return [check_no_compiler_messages arm_neon object
{
2999 #ifndef __ARM_NEON__
3010 proc check_effective_target_arm_neonv2
{ } {
3011 if { [check_effective_target_arm32
] } {
3012 return [check_no_compiler_messages arm_neon object
{
3013 #ifndef __ARM_NEON__
3016 #ifndef __ARM_FEATURE_FMA
3028 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
3029 # the Loongson vector modes.
3031 proc check_effective_target_mips_loongson
{ } {
3032 return [check_no_compiler_messages loongson assembly
{
3033 #
if !defined
(__mips_loongson_vector_rev
)
3034 #error
!__mips_loongson_vector_rev
3039 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
3042 proc check_effective_target_arm_eabi
{ } {
3043 return [check_no_compiler_messages arm_eabi object
{
3044 #ifndef __ARM_EABI__
3052 #
Return 1 if this is an ARM target that adheres to the hard
-float variant of
3053 # the ABI
for the ARM Architecture
(e.g.
-mfloat
-abi
=hard
).
3055 proc check_effective_target_arm_hf_eabi
{ } {
3056 return [check_no_compiler_messages arm_hf_eabi object
{
3057 #
if !defined
(__ARM_EABI__
) ||
!defined
(__ARM_PCS_VFP
)
3058 #error not hard
-float EABI
3065 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
3066 # Some multilibs may be incompatible with this option.
3068 proc check_effective_target_arm_iwmmxt_ok
{ } {
3069 if { [check_effective_target_arm32
] } {
3070 return [check_no_compiler_messages arm_iwmmxt_ok object
{
3078 #
Return true
if LDRD
/STRD instructions are prefered over LDM
/STM instructions
3079 #
for an ARM target.
3080 proc check_effective_target_arm_prefer_ldrd_strd
{ } {
3081 if { ![check_effective_target_arm32
] } {
3085 return [check_no_messages_and_pattern arm_prefer_ldrd_strd
"strd\tr" assembly {
3086 void foo
(int *p
) { p
[0] = 1; p
[1] = 0;}
3090 #
Return 1 if this is a PowerPC target supporting
-meabi.
3092 proc check_effective_target_powerpc_eabi_ok
{ } {
3093 if { [istarget powerpc
*-*-*] } {
3094 return [check_no_compiler_messages powerpc_eabi_ok object
{
3102 #
Return 1 if this is a PowerPC target with floating
-point registers.
3104 proc check_effective_target_powerpc_fprs
{ } {
3105 if { [istarget powerpc
*-*-*]
3106 ||
[istarget rs6000
-*-*] } {
3107 return [check_no_compiler_messages powerpc_fprs object
{
3119 #
Return 1 if this is a PowerPC target with hardware double
-precision
3122 proc check_effective_target_powerpc_hard_double
{ } {
3123 if { [istarget powerpc
*-*-*]
3124 ||
[istarget rs6000
-*-*] } {
3125 return [check_no_compiler_messages powerpc_hard_double object
{
3137 #
Return 1 if this is a PowerPC target supporting
-maltivec.
3139 proc check_effective_target_powerpc_altivec_ok
{ } {
3140 if { ([istarget powerpc
*-*-*]
3141 && ![istarget powerpc
-*-linux
*paired
*])
3142 ||
[istarget rs6000
-*-*] } {
3143 # AltiVec is not supported
on AIX before
5.3.
3144 if { [istarget powerpc
*-*-aix4
*]
3145 ||
[istarget powerpc
*-*-aix5.1
*]
3146 ||
[istarget powerpc
*-*-aix5.2
*] } {
3149 return [check_no_compiler_messages powerpc_altivec_ok object
{
3157 #
Return 1 if this is a PowerPC target supporting
-mpower8
-vector
3159 proc check_effective_target_powerpc_p8vector_ok
{ } {
3160 if { ([istarget powerpc
*-*-*]
3161 && ![istarget powerpc
-*-linux
*paired
*])
3162 ||
[istarget rs6000
-*-*] } {
3163 # AltiVec is not supported
on AIX before
5.3.
3164 if { [istarget powerpc
*-*-aix4
*]
3165 ||
[istarget powerpc
*-*-aix5.1
*]
3166 ||
[istarget powerpc
*-*-aix5.2
*] } {
3169 return [check_no_compiler_messages powerpc_p8vector_ok object
{
3172 asm volatile
("xxlorc vs0,vs0,vs0");
3174 asm volatile
("xxlorc 0,0,0");
3178 } "-mpower8-vector"]
3184 #
Return 1 if this is a PowerPC target supporting
-mvsx
3186 proc check_effective_target_powerpc_vsx_ok
{ } {
3187 if { ([istarget powerpc
*-*-*]
3188 && ![istarget powerpc
-*-linux
*paired
*])
3189 ||
[istarget rs6000
-*-*] } {
3190 # VSX is not supported
on AIX before
7.1.
3191 if { [istarget powerpc
*-*-aix4
*]
3192 ||
[istarget powerpc
*-*-aix5
*]
3193 ||
[istarget powerpc
*-*-aix6
*] } {
3196 return [check_no_compiler_messages powerpc_vsx_ok object
{
3199 asm volatile
("xxlor vs0,vs0,vs0");
3201 asm volatile
("xxlor 0,0,0");
3211 #
Return 1 if this is a PowerPC target supporting
-mhtm
3213 proc check_effective_target_powerpc_htm_ok
{ } {
3214 if { ([istarget powerpc
*-*-*]
3215 && ![istarget powerpc
-*-linux
*paired
*])
3216 ||
[istarget rs6000
-*-*] } {
3217 # HTM is not supported
on AIX yet.
3218 if { [istarget powerpc
*-*-aix
*] } {
3221 return [check_no_compiler_messages powerpc_htm_ok object
{
3223 asm volatile
("tbegin. 0");
3232 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
3234 proc check_effective_target_powerpc_ppu_ok
{ } {
3235 if [check_effective_target_powerpc_altivec_ok
] {
3236 return [check_no_compiler_messages cell_asm_available object
{
3239 asm volatile
("lvlx v0,v0,v0");
3241 asm volatile
("lvlx 0,0,0");
3251 #
Return 1 if this is a PowerPC target that supports SPU.
3253 proc check_effective_target_powerpc_spu
{ } {
3254 if { [istarget powerpc
*-*-linux
*] } {
3255 return [check_effective_target_powerpc_altivec_ok
]
3261 #
Return 1 if this is a PowerPC SPE target. The check includes options
3262 # specified by dg
-options
for this test
, so don
't cache the result.
3264 proc check_effective_target_powerpc_spe_nocache { } {
3265 if { [istarget powerpc*-*-*] } {
3266 return [check_no_compiler_messages_nocache powerpc_spe object {
3272 } [current_compiler_flags]]
3278 # Return 1 if this is a PowerPC target with SPE enabled.
3280 proc check_effective_target_powerpc_spe { } {
3281 if { [istarget powerpc*-*-*] } {
3282 return [check_no_compiler_messages powerpc_spe object {
3294 # Return 1 if this is a PowerPC target with Altivec enabled.
3296 proc check_effective_target_powerpc_altivec { } {
3297 if { [istarget powerpc*-*-*] } {
3298 return [check_no_compiler_messages powerpc_altivec object {
3310 # Return 1 if this is a PowerPC 405 target. The check includes options
3311 # specified by dg-options for this test, so don't
cache the result.
3313 proc check_effective_target_powerpc_405_nocache
{ } {
3314 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
3315 return [check_no_compiler_messages_nocache powerpc_405 object
{
3321 } [current_compiler_flags
]]
3327 #
Return 1 if this is a PowerPC target using the ELFv2 ABI.
3329 proc check_effective_target_powerpc_elfv2
{ } {
3330 if { [istarget powerpc
*-*-*] } {
3331 return [check_no_compiler_messages powerpc_elfv2 object
{
3333 #error not ELF v2 ABI
3343 #
Return 1 if this is a SPU target with a toolchain that
3344 # supports automatic overlay generation.
3346 proc check_effective_target_spu_auto_overlay
{ } {
3347 if { [istarget spu
*-*-elf
*] } {
3348 return [check_no_compiler_messages spu_auto_overlay executable
{
3350 } "-Wl,--auto-overlay" ]
3356 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
3357 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
3358 # test environment appears to run executables
on such a simulator.
3360 proc check_effective_target_ultrasparc_hw
{ } {
3361 return [check_runtime ultrasparc_hw
{
3362 int main
() { return 0; }
3363 } "-mcpu=ultrasparc"]
3366 #
Return 1 if the test environment supports executing UltraSPARC VIS2
3367 # instructions. We check this by attempting
: "bmask %g0, %g0, %g0"
3369 proc check_effective_target_ultrasparc_vis2_hw
{ } {
3370 return [check_runtime ultrasparc_vis2_hw
{
3371 int main
() { __asm__
(".word 0x81b00320"); return 0; }
3372 } "-mcpu=ultrasparc3"]
3375 #
Return 1 if the test environment supports executing UltraSPARC VIS3
3376 # instructions. We check this by attempting
: "addxc %g0, %g0, %g0"
3378 proc check_effective_target_ultrasparc_vis3_hw
{ } {
3379 return [check_runtime ultrasparc_vis3_hw
{
3380 int main
() { __asm__
(".word 0x81b00220"); return 0; }
3384 #
Return 1 if this is a SPARC
-V9 target.
3386 proc check_effective_target_sparc_v9
{ } {
3387 if { [istarget sparc
*-*-*] } {
3388 return [check_no_compiler_messages sparc_v9 object
{
3390 asm volatile
("return %i7+8");
3399 #
Return 1 if this is a SPARC target with VIS enabled.
3401 proc check_effective_target_sparc_vis
{ } {
3402 if { [istarget sparc
*-*-*] } {
3403 return [check_no_compiler_messages sparc_vis object
{
3415 #
Return 1 if the target supports hardware vector shift operation.
3417 proc check_effective_target_vect_shift
{ } {
3418 global et_vect_shift_saved
3420 if [info exists et_vect_shift_saved
] {
3421 verbose
"check_effective_target_vect_shift: using cached result" 2
3423 set et_vect_shift_saved
0
3424 if { ([istarget powerpc
*-*-*]
3425 && ![istarget powerpc
-*-linux
*paired
*])
3426 ||
[istarget ia64
-*-*]
3427 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3428 ||
[istarget aarch64
*-*-*]
3429 ||
[check_effective_target_arm32
]
3430 ||
([istarget mips
*-*-*]
3431 && [check_effective_target_mips_loongson
]) } {
3432 set et_vect_shift_saved
1
3436 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
3437 return $et_vect_shift_saved
3440 proc check_effective_target_whole_vector_shift
{ } {
3441 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3442 ||
[istarget ia64
-*-*]
3443 ||
[istarget aarch64
*-*-*]
3444 ||
([check_effective_target_arm32
]
3445 && [check_effective_target_arm_little_endian
])
3446 ||
([istarget mips
*-*-*]
3447 && [check_effective_target_mips_loongson
]) } {
3453 verbose
"check_effective_target_vect_long: returning $answer" 2
3457 #
Return 1 if the target supports vector bswap operations.
3459 proc check_effective_target_vect_bswap
{ } {
3460 global et_vect_bswap_saved
3462 if [info exists et_vect_bswap_saved
] {
3463 verbose
"check_effective_target_vect_bswap: using cached result" 2
3465 set et_vect_bswap_saved
0
3466 if { [istarget aarch64
*-*-*]
3467 ||
([istarget arm
*-*-*]
3468 && [check_effective_target_arm_neon
])
3470 set et_vect_bswap_saved
1
3474 verbose
"check_effective_target_vect_bswap: returning $et_vect_bswap_saved" 2
3475 return $et_vect_bswap_saved
3478 #
Return 1 if the target supports hardware vector shift operation
for char.
3480 proc check_effective_target_vect_shift_char
{ } {
3481 global et_vect_shift_char_saved
3483 if [info exists et_vect_shift_char_saved
] {
3484 verbose
"check_effective_target_vect_shift_char: using cached result" 2
3486 set et_vect_shift_char_saved
0
3487 if { ([istarget powerpc
*-*-*]
3488 && ![istarget powerpc
-*-linux
*paired
*])
3489 ||
[check_effective_target_arm32
] } {
3490 set et_vect_shift_char_saved
1
3494 verbose
"check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
3495 return $et_vect_shift_char_saved
3498 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
3500 # This can change
for different subtargets so
do not
cache the result.
3502 proc check_effective_target_vect_long
{ } {
3503 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3504 ||
(([istarget powerpc
*-*-*]
3505 && ![istarget powerpc
-*-linux
*paired
*])
3506 && [check_effective_target_ilp32
])
3507 ||
[check_effective_target_arm32
]
3508 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
3514 verbose
"check_effective_target_vect_long: returning $answer" 2
3518 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
3520 # This won
't change for different subtargets so cache the result.
3522 proc check_effective_target_vect_float { } {
3523 global et_vect_float_saved
3525 if [info exists et_vect_float_saved] {
3526 verbose "check_effective_target_vect_float: using cached result" 2
3528 set et_vect_float_saved 0
3529 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
3530 || [istarget powerpc*-*-*]
3531 || [istarget spu-*-*]
3532 || [istarget mips-sde-elf]
3533 || [istarget mipsisa64*-*-*]
3534 || [istarget ia64-*-*]
3535 || [istarget aarch64*-*-*]
3536 || [check_effective_target_arm32] } {
3537 set et_vect_float_saved 1
3541 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
3542 return $et_vect_float_saved
3545 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
3547 # This won't change
for different subtargets so
cache the result.
3549 proc check_effective_target_vect_double
{ } {
3550 global et_vect_double_saved
3552 if [info exists et_vect_double_saved
] {
3553 verbose
"check_effective_target_vect_double: using cached result" 2
3555 set et_vect_double_saved
0
3556 if { [istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
3557 ||
[istarget aarch64
*-*-*] } {
3558 if { [check_no_compiler_messages vect_double assembly
{
3559 #ifdef __tune_atom__
3560 # error No double vectorizer support.
3563 set et_vect_double_saved
1
3565 set et_vect_double_saved
0
3567 } elseif
{ [istarget spu
-*-*] } {
3568 set et_vect_double_saved
1
3572 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
3573 return $et_vect_double_saved
3576 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
3578 # This won
't change for different subtargets so cache the result.
3580 proc check_effective_target_vect_long_long { } {
3581 global et_vect_long_long_saved
3583 if [info exists et_vect_long_long_saved] {
3584 verbose "check_effective_target_vect_long_long: using cached result" 2
3586 set et_vect_long_long_saved 0
3587 if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
3588 set et_vect_long_long_saved 1
3592 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3593 return $et_vect_long_long_saved
3597 # Return 1 if the target plus current options does not support a vector
3598 # max instruction on "int", 0 otherwise.
3600 # This won't change
for different subtargets so
cache the result.
3602 proc check_effective_target_vect_no_int_max
{ } {
3603 global et_vect_no_int_max_saved
3605 if [info exists et_vect_no_int_max_saved
] {
3606 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
3608 set et_vect_no_int_max_saved
0
3609 if { [istarget sparc
*-*-*]
3610 ||
[istarget spu
-*-*]
3611 ||
[istarget alpha
*-*-*]
3612 ||
([istarget mips
*-*-*]
3613 && [check_effective_target_mips_loongson
]) } {
3614 set et_vect_no_int_max_saved
1
3617 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3618 return $et_vect_no_int_max_saved
3621 #
Return 1 if the target plus current options does not support a vector
3622 # add instruction
on "int", 0 otherwise.
3624 # This won
't change for different subtargets so cache the result.
3626 proc check_effective_target_vect_no_int_add { } {
3627 global et_vect_no_int_add_saved
3629 if [info exists et_vect_no_int_add_saved] {
3630 verbose "check_effective_target_vect_no_int_add: using cached result" 2
3632 set et_vect_no_int_add_saved 0
3633 # Alpha only supports vector add on V8QI and V4HI.
3634 if { [istarget alpha*-*-*] } {
3635 set et_vect_no_int_add_saved 1
3638 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3639 return $et_vect_no_int_add_saved
3642 # Return 1 if the target plus current options does not support vector
3643 # bitwise instructions, 0 otherwise.
3645 # This won't change
for different subtargets so
cache the result.
3647 proc check_effective_target_vect_no_bitwise
{ } {
3648 global et_vect_no_bitwise_saved
3650 if [info exists et_vect_no_bitwise_saved
] {
3651 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
3653 set et_vect_no_bitwise_saved
0
3655 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3656 return $et_vect_no_bitwise_saved
3659 #
Return 1 if the target plus current options supports vector permutation
,
3662 # This won
't change for different subtargets so cache the result.
3664 proc check_effective_target_vect_perm { } {
3667 if [info exists et_vect_perm_saved] {
3668 verbose "check_effective_target_vect_perm: using cached result" 2
3670 set et_vect_perm_saved 0
3671 if { [is-effective-target arm_neon_ok]
3672 || [istarget aarch64*-*-*]
3673 || [istarget powerpc*-*-*]
3674 || [istarget spu-*-*]
3675 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3676 || ([istarget mips*-*-*]
3677 && [check_effective_target_mpaired_single]) } {
3678 set et_vect_perm_saved 1
3681 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3682 return $et_vect_perm_saved
3685 # Return 1 if the target plus current options supports vector permutation
3686 # on byte-sized elements, 0 otherwise.
3688 # This won't change
for different subtargets so
cache the result.
3690 proc check_effective_target_vect_perm_byte
{ } {
3691 global et_vect_perm_byte
3693 if [info exists et_vect_perm_byte_saved
] {
3694 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
3696 set et_vect_perm_byte_saved
0
3697 if { ([is
-effective
-target arm_neon_ok
]
3698 && [is
-effective
-target arm_little_endian
])
3699 ||
([istarget aarch64
*-*-*]
3700 && [is
-effective
-target aarch64_little_endian
])
3701 ||
[istarget powerpc
*-*-*]
3702 ||
[istarget spu
-*-*] } {
3703 set et_vect_perm_byte_saved
1
3706 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3707 return $et_vect_perm_byte_saved
3710 #
Return 1 if the target plus current options supports vector permutation
3711 #
on short
-sized elements
, 0 otherwise.
3713 # This won
't change for different subtargets so cache the result.
3715 proc check_effective_target_vect_perm_short { } {
3716 global et_vect_perm_short
3718 if [info exists et_vect_perm_short_saved] {
3719 verbose "check_effective_target_vect_perm_short: using cached result" 2
3721 set et_vect_perm_short_saved 0
3722 if { ([is-effective-target arm_neon_ok]
3723 && [is-effective-target arm_little_endian])
3724 || ([istarget aarch64*-*-*]
3725 && [is-effective-target aarch64_little_endian])
3726 || [istarget powerpc*-*-*]
3727 || [istarget spu-*-*] } {
3728 set et_vect_perm_short_saved 1
3731 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3732 return $et_vect_perm_short_saved
3735 # Return 1 if the target plus current options supports a vector
3736 # widening summation of *short* args into *int* result, 0 otherwise.
3738 # This won't change
for different subtargets so
cache the result.
3740 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
3741 global et_vect_widen_sum_hi_to_si_pattern
3743 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
3744 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3746 set et_vect_widen_sum_hi_to_si_pattern_saved
0
3747 if { [istarget powerpc
*-*-*]
3748 ||
[istarget ia64
-*-*] } {
3749 set et_vect_widen_sum_hi_to_si_pattern_saved
1
3752 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3753 return $et_vect_widen_sum_hi_to_si_pattern_saved
3756 #
Return 1 if the target plus current options supports a vector
3757 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3758 # A target can also support this widening summation
if it can support
3759 # promotion
(unpacking
) from shorts to ints.
3761 # This won
't change for different subtargets so cache the result.
3763 proc check_effective_target_vect_widen_sum_hi_to_si { } {
3764 global et_vect_widen_sum_hi_to_si
3766 if [info exists et_vect_widen_sum_hi_to_si_saved] {
3767 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3769 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
3770 if { [istarget powerpc*-*-*]
3771 || [istarget ia64-*-*] } {
3772 set et_vect_widen_sum_hi_to_si_saved 1
3775 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3776 return $et_vect_widen_sum_hi_to_si_saved
3779 # Return 1 if the target plus current options supports a vector
3780 # widening summation of *char* args into *short* result, 0 otherwise.
3781 # A target can also support this widening summation if it can support
3782 # promotion (unpacking) from chars to shorts.
3784 # This won't change
for different subtargets so
cache the result.
3786 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
3787 global et_vect_widen_sum_qi_to_hi
3789 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
3790 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3792 set et_vect_widen_sum_qi_to_hi_saved
0
3793 if { [check_effective_target_vect_unpack
]
3794 ||
[check_effective_target_arm_neon_ok
]
3795 ||
[istarget ia64
-*-*] } {
3796 set et_vect_widen_sum_qi_to_hi_saved
1
3799 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3800 return $et_vect_widen_sum_qi_to_hi_saved
3803 #
Return 1 if the target plus current options supports a vector
3804 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
3806 # This won
't change for different subtargets so cache the result.
3808 proc check_effective_target_vect_widen_sum_qi_to_si { } {
3809 global et_vect_widen_sum_qi_to_si
3811 if [info exists et_vect_widen_sum_qi_to_si_saved] {
3812 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3814 set et_vect_widen_sum_qi_to_si_saved 0
3815 if { [istarget powerpc*-*-*] } {
3816 set et_vect_widen_sum_qi_to_si_saved 1
3819 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3820 return $et_vect_widen_sum_qi_to_si_saved
3823 # Return 1 if the target plus current options supports a vector
3824 # widening multiplication of *char* args into *short* result, 0 otherwise.
3825 # A target can also support this widening multplication if it can support
3826 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
3827 # multiplication of shorts).
3829 # This won't change
for different subtargets so
cache the result.
3832 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
3833 global et_vect_widen_mult_qi_to_hi
3835 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
3836 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3838 if { [check_effective_target_vect_unpack
]
3839 && [check_effective_target_vect_short_mult
] } {
3840 set et_vect_widen_mult_qi_to_hi_saved
1
3842 set et_vect_widen_mult_qi_to_hi_saved
0
3844 if { [istarget powerpc
*-*-*]
3845 ||
[istarget aarch64
*-*-*]
3846 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3847 set et_vect_widen_mult_qi_to_hi_saved
1
3850 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3851 return $et_vect_widen_mult_qi_to_hi_saved
3854 #
Return 1 if the target plus current options supports a vector
3855 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3856 # A target can also support this widening multplication
if it can support
3857 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
3858 # multiplication of ints
).
3860 # This won
't change for different subtargets so cache the result.
3863 proc check_effective_target_vect_widen_mult_hi_to_si { } {
3864 global et_vect_widen_mult_hi_to_si
3866 if [info exists et_vect_widen_mult_hi_to_si_saved] {
3867 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3869 if { [check_effective_target_vect_unpack]
3870 && [check_effective_target_vect_int_mult] } {
3871 set et_vect_widen_mult_hi_to_si_saved 1
3873 set et_vect_widen_mult_hi_to_si_saved 0
3875 if { [istarget powerpc*-*-*]
3876 || [istarget spu-*-*]
3877 || [istarget ia64-*-*]
3878 || [istarget aarch64*-*-*]
3879 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3880 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3881 set et_vect_widen_mult_hi_to_si_saved 1
3884 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3885 return $et_vect_widen_mult_hi_to_si_saved
3888 # Return 1 if the target plus current options supports a vector
3889 # widening multiplication of *char* args into *short* result, 0 otherwise.
3891 # This won't change
for different subtargets so
cache the result.
3893 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern
{ } {
3894 global et_vect_widen_mult_qi_to_hi_pattern
3896 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved
] {
3897 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3899 set et_vect_widen_mult_qi_to_hi_pattern_saved
0
3900 if { [istarget powerpc
*-*-*]
3901 ||
([istarget arm
*-*-*]
3902 && [check_effective_target_arm_neon_ok
]
3903 && [check_effective_target_arm_little_endian
]) } {
3904 set et_vect_widen_mult_qi_to_hi_pattern_saved
1
3907 verbose
"check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3908 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3911 #
Return 1 if the target plus current options supports a vector
3912 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
3914 # This won
't change for different subtargets so cache the result.
3916 proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
3917 global et_vect_widen_mult_hi_to_si_pattern
3919 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved] {
3920 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3922 set et_vect_widen_mult_hi_to_si_pattern_saved 0
3923 if { [istarget powerpc*-*-*]
3924 || [istarget spu-*-*]
3925 || [istarget ia64-*-*]
3926 || [istarget i?86-*-*] || [istarget x86_64-*-*]
3927 || ([istarget arm*-*-*]
3928 && [check_effective_target_arm_neon_ok]
3929 && [check_effective_target_arm_little_endian]) } {
3930 set et_vect_widen_mult_hi_to_si_pattern_saved 1
3933 verbose "check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3934 return $et_vect_widen_mult_hi_to_si_pattern_saved
3937 # Return 1 if the target plus current options supports a vector
3938 # widening multiplication of *int* args into *long* result, 0 otherwise.
3940 # This won't change
for different subtargets so
cache the result.
3942 proc check_effective_target_vect_widen_mult_si_to_di_pattern
{ } {
3943 global et_vect_widen_mult_si_to_di_pattern
3945 if [info exists et_vect_widen_mult_si_to_di_pattern_saved
] {
3946 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: using cached result" 2
3948 set et_vect_widen_mult_si_to_di_pattern_saved
0
3949 if {[istarget ia64
-*-*]
3950 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
3951 set et_vect_widen_mult_si_to_di_pattern_saved
1
3954 verbose
"check_effective_target_vect_widen_mult_si_to_di_pattern: returning $et_vect_widen_mult_si_to_di_pattern_saved" 2
3955 return $et_vect_widen_mult_si_to_di_pattern_saved
3958 #
Return 1 if the target plus current options supports a vector
3959 # widening shift
, 0 otherwise.
3961 # This won
't change for different subtargets so cache the result.
3963 proc check_effective_target_vect_widen_shift { } {
3964 global et_vect_widen_shift_saved
3966 if [info exists et_vect_shift_saved] {
3967 verbose "check_effective_target_vect_widen_shift: using cached result" 2
3969 set et_vect_widen_shift_saved 0
3970 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3971 set et_vect_widen_shift_saved 1
3974 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3975 return $et_vect_widen_shift_saved
3978 # Return 1 if the target plus current options supports a vector
3979 # dot-product of signed chars, 0 otherwise.
3981 # This won't change
for different subtargets so
cache the result.
3983 proc check_effective_target_vect_sdot_qi
{ } {
3984 global et_vect_sdot_qi
3986 if [info exists et_vect_sdot_qi_saved
] {
3987 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
3989 set et_vect_sdot_qi_saved
0
3990 if { [istarget ia64
-*-*] } {
3991 set et_vect_udot_qi_saved
1
3994 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3995 return $et_vect_sdot_qi_saved
3998 #
Return 1 if the target plus current options supports a vector
3999 # dot
-product of unsigned chars
, 0 otherwise.
4001 # This won
't change for different subtargets so cache the result.
4003 proc check_effective_target_vect_udot_qi { } {
4004 global et_vect_udot_qi
4006 if [info exists et_vect_udot_qi_saved] {
4007 verbose "check_effective_target_vect_udot_qi: using cached result" 2
4009 set et_vect_udot_qi_saved 0
4010 if { [istarget powerpc*-*-*]
4011 || [istarget ia64-*-*] } {
4012 set et_vect_udot_qi_saved 1
4015 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
4016 return $et_vect_udot_qi_saved
4019 # Return 1 if the target plus current options supports a vector
4020 # dot-product of signed shorts, 0 otherwise.
4022 # This won't change
for different subtargets so
cache the result.
4024 proc check_effective_target_vect_sdot_hi
{ } {
4025 global et_vect_sdot_hi
4027 if [info exists et_vect_sdot_hi_saved
] {
4028 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
4030 set et_vect_sdot_hi_saved
0
4031 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
4032 ||
[istarget ia64
-*-*]
4033 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
4034 set et_vect_sdot_hi_saved
1
4037 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
4038 return $et_vect_sdot_hi_saved
4041 #
Return 1 if the target plus current options supports a vector
4042 # dot
-product of unsigned shorts
, 0 otherwise.
4044 # This won
't change for different subtargets so cache the result.
4046 proc check_effective_target_vect_udot_hi { } {
4047 global et_vect_udot_hi
4049 if [info exists et_vect_udot_hi_saved] {
4050 verbose "check_effective_target_vect_udot_hi: using cached result" 2
4052 set et_vect_udot_hi_saved 0
4053 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
4054 set et_vect_udot_hi_saved 1
4057 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
4058 return $et_vect_udot_hi_saved
4061 # Return 1 if the target plus current options supports a vector
4062 # sad operation of unsigned chars, 0 otherwise.
4064 # This won't change
for different subtargets so
cache the result.
4066 proc check_effective_target_vect_usad_char
{ } {
4067 global et_vect_usad_char
4069 if [info exists et_vect_usad_char_saved
] {
4070 verbose
"check_effective_target_vect_usad_char: using cached result" 2
4072 set et_vect_usad_char_saved
0
4073 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) } {
4074 set et_vect_usad_char_saved
1
4077 verbose
"check_effective_target_vect_usad_char: returning $et_vect_usad_char_saved" 2
4078 return $et_vect_usad_char_saved
4081 #
Return 1 if the target plus current options supports a vector
4082 # demotion
(packing
) of shorts
(to chars
) and ints
(to shorts
)
4083 # using modulo arithmetic
, 0 otherwise.
4085 # This won
't change for different subtargets so cache the result.
4087 proc check_effective_target_vect_pack_trunc { } {
4088 global et_vect_pack_trunc
4090 if [info exists et_vect_pack_trunc_saved] {
4091 verbose "check_effective_target_vect_pack_trunc: using cached result" 2
4093 set et_vect_pack_trunc_saved 0
4094 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4095 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4096 || [istarget aarch64*-*-*]
4097 || [istarget spu-*-*]
4098 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
4099 && [check_effective_target_arm_little_endian]) } {
4100 set et_vect_pack_trunc_saved 1
4103 verbose "check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
4104 return $et_vect_pack_trunc_saved
4107 # Return 1 if the target plus current options supports a vector
4108 # promotion (unpacking) of chars (to shorts) and shorts (to ints), 0 otherwise.
4110 # This won't change
for different subtargets so
cache the result.
4112 proc check_effective_target_vect_unpack
{ } {
4113 global et_vect_unpack
4115 if [info exists et_vect_unpack_saved
] {
4116 verbose
"check_effective_target_vect_unpack: using cached result" 2
4118 set et_vect_unpack_saved
0
4119 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*paired
*])
4120 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
4121 ||
[istarget spu
-*-*]
4122 ||
[istarget ia64
-*-*]
4123 ||
[istarget aarch64
*-*-*]
4124 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
4125 && [check_effective_target_arm_little_endian
]) } {
4126 set et_vect_unpack_saved
1
4129 verbose
"check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
4130 return $et_vect_unpack_saved
4133 #
Return 1 if the target plus current options does not guarantee
4134 # that its STACK_BOUNDARY is
>= the reguired vector alignment.
4136 # This won
't change for different subtargets so cache the result.
4138 proc check_effective_target_unaligned_stack { } {
4139 global et_unaligned_stack_saved
4141 if [info exists et_unaligned_stack_saved] {
4142 verbose "check_effective_target_unaligned_stack: using cached result" 2
4144 set et_unaligned_stack_saved 0
4146 verbose "check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
4147 return $et_unaligned_stack_saved
4150 # Return 1 if the target plus current options does not support a vector
4151 # alignment mechanism, 0 otherwise.
4153 # This won't change
for different subtargets so
cache the result.
4155 proc check_effective_target_vect_no_align
{ } {
4156 global et_vect_no_align_saved
4158 if [info exists et_vect_no_align_saved
] {
4159 verbose
"check_effective_target_vect_no_align: using cached result" 2
4161 set et_vect_no_align_saved
0
4162 if { [istarget mipsisa64
*-*-*]
4163 ||
[istarget mips
-sde
-elf
]
4164 ||
[istarget sparc
*-*-*]
4165 ||
[istarget ia64
-*-*]
4166 ||
[check_effective_target_arm_vect_no_misalign
]
4167 ||
([istarget mips
*-*-*]
4168 && [check_effective_target_mips_loongson
]) } {
4169 set et_vect_no_align_saved
1
4172 verbose
"check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
4173 return $et_vect_no_align_saved
4176 #
Return 1 if the target supports a vector misalign access
, 0 otherwise.
4178 # This won
't change for different subtargets so cache the result.
4180 proc check_effective_target_vect_hw_misalign { } {
4181 global et_vect_hw_misalign_saved
4183 if [info exists et_vect_hw_misalign_saved] {
4184 verbose "check_effective_target_vect_hw_misalign: using cached result" 2
4186 set et_vect_hw_misalign_saved 0
4187 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4188 || [istarget aarch64*-*-*] } {
4189 set et_vect_hw_misalign_saved 1
4192 verbose "check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
4193 return $et_vect_hw_misalign_saved
4197 # Return 1 if arrays are aligned to the vector alignment
4198 # boundary, 0 otherwise.
4200 # This won't change
for different subtargets so
cache the result.
4202 proc check_effective_target_vect_aligned_arrays
{ } {
4203 global et_vect_aligned_arrays
4205 if [info exists et_vect_aligned_arrays_saved
] {
4206 verbose
"check_effective_target_vect_aligned_arrays: using cached result" 2
4208 set et_vect_aligned_arrays_saved
0
4209 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
4210 if { ([is
-effective
-target lp64
]
4211 && ( ![check_avx_available
]
4212 ||
[check_prefer_avx128
])) } {
4213 set et_vect_aligned_arrays_saved
1
4216 if [istarget spu
-*-*] {
4217 set et_vect_aligned_arrays_saved
1
4220 verbose
"check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
4221 return $et_vect_aligned_arrays_saved
4224 #
Return 1 if types of size
32 bit or less are naturally aligned
4225 #
(aligned to their type
-size
), 0 otherwise.
4227 # This won
't change for different subtargets so cache the result.
4229 proc check_effective_target_natural_alignment_32 { } {
4230 global et_natural_alignment_32
4232 if [info exists et_natural_alignment_32_saved] {
4233 verbose "check_effective_target_natural_alignment_32: using cached result" 2
4235 # FIXME: 32bit powerpc: guaranteed only if MASK_ALIGN_NATURAL/POWER.
4236 set et_natural_alignment_32_saved 1
4237 if { ([istarget *-*-darwin*] && [is-effective-target lp64]) } {
4238 set et_natural_alignment_32_saved 0
4241 verbose "check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
4242 return $et_natural_alignment_32_saved
4245 # Return 1 if types of size 64 bit or less are naturally aligned (aligned to their
4246 # type-size), 0 otherwise.
4248 # This won't change
for different subtargets so
cache the result.
4250 proc check_effective_target_natural_alignment_64
{ } {
4251 global et_natural_alignment_64
4253 if [info exists et_natural_alignment_64_saved
] {
4254 verbose
"check_effective_target_natural_alignment_64: using cached result" 2
4256 set et_natural_alignment_64_saved
0
4257 if { ([is
-effective
-target lp64
] && ![istarget
*-*-darwin
*])
4258 ||
[istarget spu
-*-*] } {
4259 set et_natural_alignment_64_saved
1
4262 verbose
"check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
4263 return $et_natural_alignment_64_saved
4266 #
Return 1 if all vector types are naturally aligned
(aligned to their
4267 # type
-size
), 0 otherwise.
4269 # This won
't change for different subtargets so cache the result.
4271 proc check_effective_target_vect_natural_alignment { } {
4272 global et_vect_natural_alignment
4274 if [info exists et_vect_natural_alignment_saved] {
4275 verbose "check_effective_target_vect_natural_alignment: using cached result" 2
4277 set et_vect_natural_alignment_saved 1
4278 if { [check_effective_target_arm_eabi]
4279 || [istarget nvptx-*-*] } {
4280 set et_vect_natural_alignment_saved 0
4283 verbose "check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
4284 return $et_vect_natural_alignment_saved
4287 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
4289 # This won't change
for different subtargets so
cache the result.
4291 proc check_effective_target_vector_alignment_reachable
{ } {
4292 global et_vector_alignment_reachable
4294 if [info exists et_vector_alignment_reachable_saved
] {
4295 verbose
"check_effective_target_vector_alignment_reachable: using cached result" 2
4297 if { [check_effective_target_vect_aligned_arrays
]
4298 ||
[check_effective_target_natural_alignment_32
] } {
4299 set et_vector_alignment_reachable_saved
1
4301 set et_vector_alignment_reachable_saved
0
4304 verbose
"check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
4305 return $et_vector_alignment_reachable_saved
4308 #
Return 1 if vector alignment
for 64 bit is reachable
, 0 otherwise.
4310 # This won
't change for different subtargets so cache the result.
4312 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
4313 global et_vector_alignment_reachable_for_64bit
4315 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
4316 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
4318 if { [check_effective_target_vect_aligned_arrays]
4319 || [check_effective_target_natural_alignment_64] } {
4320 set et_vector_alignment_reachable_for_64bit_saved 1
4322 set et_vector_alignment_reachable_for_64bit_saved 0
4325 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
4326 return $et_vector_alignment_reachable_for_64bit_saved
4329 # Return 1 if the target only requires element alignment for vector accesses
4331 proc check_effective_target_vect_element_align { } {
4332 global et_vect_element_align
4334 if [info exists et_vect_element_align] {
4335 verbose "check_effective_target_vect_element_align: using cached result" 2
4337 set et_vect_element_align 0
4338 if { ([istarget arm*-*-*]
4339 && ![check_effective_target_arm_vect_no_misalign])
4340 || [check_effective_target_vect_hw_misalign] } {
4341 set et_vect_element_align 1
4345 verbose "check_effective_target_vect_element_align: returning $et_vect_element_align" 2
4346 return $et_vect_element_align
4349 # Return 1 if the target supports vector conditional operations, 0 otherwise.
4351 proc check_effective_target_vect_condition { } {
4352 global et_vect_cond_saved
4354 if [info exists et_vect_cond_saved] {
4355 verbose "check_effective_target_vect_cond: using cached result" 2
4357 set et_vect_cond_saved 0
4358 if { [istarget aarch64*-*-*]
4359 || [istarget powerpc*-*-*]
4360 || [istarget ia64-*-*]
4361 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4362 || [istarget spu-*-*]
4363 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
4364 set et_vect_cond_saved 1
4368 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
4369 return $et_vect_cond_saved
4372 # Return 1 if the target supports vector conditional operations where
4373 # the comparison has different type from the lhs, 0 otherwise.
4375 proc check_effective_target_vect_cond_mixed { } {
4376 global et_vect_cond_mixed_saved
4378 if [info exists et_vect_cond_mixed_saved] {
4379 verbose "check_effective_target_vect_cond_mixed: using cached result" 2
4381 set et_vect_cond_mixed_saved 0
4382 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4383 || [istarget powerpc*-*-*] } {
4384 set et_vect_cond_mixed_saved 1
4388 verbose "check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
4389 return $et_vect_cond_mixed_saved
4392 # Return 1 if the target supports vector char multiplication, 0 otherwise.
4394 proc check_effective_target_vect_char_mult { } {
4395 global et_vect_char_mult_saved
4397 if [info exists et_vect_char_mult_saved] {
4398 verbose "check_effective_target_vect_char_mult: using cached result" 2
4400 set et_vect_char_mult_saved 0
4401 if { [istarget aarch64*-*-*]
4402 || [istarget ia64-*-*]
4403 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4404 || [check_effective_target_arm32] } {
4405 set et_vect_char_mult_saved 1
4409 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
4410 return $et_vect_char_mult_saved
4413 # Return 1 if the target supports vector short multiplication, 0 otherwise.
4415 proc check_effective_target_vect_short_mult { } {
4416 global et_vect_short_mult_saved
4418 if [info exists et_vect_short_mult_saved] {
4419 verbose "check_effective_target_vect_short_mult: using cached result" 2
4421 set et_vect_short_mult_saved 0
4422 if { [istarget ia64-*-*]
4423 || [istarget spu-*-*]
4424 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4425 || [istarget powerpc*-*-*]
4426 || [istarget aarch64*-*-*]
4427 || [check_effective_target_arm32]
4428 || ([istarget mips*-*-*]
4429 && [check_effective_target_mips_loongson]) } {
4430 set et_vect_short_mult_saved 1
4434 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
4435 return $et_vect_short_mult_saved
4438 # Return 1 if the target supports vector int multiplication, 0 otherwise.
4440 proc check_effective_target_vect_int_mult { } {
4441 global et_vect_int_mult_saved
4443 if [info exists et_vect_int_mult_saved] {
4444 verbose "check_effective_target_vect_int_mult: using cached result" 2
4446 set et_vect_int_mult_saved 0
4447 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
4448 || [istarget spu-*-*]
4449 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4450 || [istarget ia64-*-*]
4451 || [istarget aarch64*-*-*]
4452 || [check_effective_target_arm32] } {
4453 set et_vect_int_mult_saved 1
4457 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
4458 return $et_vect_int_mult_saved
4461 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
4463 proc check_effective_target_vect_extract_even_odd { } {
4464 global et_vect_extract_even_odd_saved
4466 if [info exists et_vect_extract_even_odd_saved] {
4467 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
4469 set et_vect_extract_even_odd_saved 0
4470 if { [istarget aarch64*-*-*]
4471 || [istarget powerpc*-*-*]
4472 || [is-effective-target arm_neon_ok]
4473 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4474 || [istarget ia64-*-*]
4475 || [istarget spu-*-*]
4476 || ([istarget mips*-*-*]
4477 && [check_effective_target_mpaired_single]) } {
4478 set et_vect_extract_even_odd_saved 1
4482 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
4483 return $et_vect_extract_even_odd_saved
4486 # Return 1 if the target supports vector interleaving, 0 otherwise.
4488 proc check_effective_target_vect_interleave { } {
4489 global et_vect_interleave_saved
4491 if [info exists et_vect_interleave_saved] {
4492 verbose "check_effective_target_vect_interleave: using cached result" 2
4494 set et_vect_interleave_saved 0
4495 if { [istarget aarch64*-*-*]
4496 || [istarget powerpc*-*-*]
4497 || [is-effective-target arm_neon_ok]
4498 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4499 || [istarget ia64-*-*]
4500 || [istarget spu-*-*]
4501 || ([istarget mips*-*-*]
4502 && [check_effective_target_mpaired_single]) } {
4503 set et_vect_interleave_saved 1
4507 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
4508 return $et_vect_interleave_saved
4511 foreach N {2 3 4 8} {
4512 eval [string map [list N $N] {
4513 # Return 1 if the target supports 2-vector interleaving
4514 proc check_effective_target_vect_stridedN { } {
4515 global et_vect_stridedN_saved
4517 if [info exists et_vect_stridedN_saved] {
4518 verbose "check_effective_target_vect_stridedN: using cached result" 2
4520 set et_vect_stridedN_saved 0
4522 && [check_effective_target_vect_interleave]
4523 && [check_effective_target_vect_extract_even_odd] } {
4524 set et_vect_stridedN_saved 1
4526 if { ([istarget arm*-*-*]
4527 || [istarget aarch64*-*-*]) && N >= 2 && N <= 4 } {
4528 set et_vect_stridedN_saved 1
4532 verbose "check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
4533 return $et_vect_stridedN_saved
4538 # Return 1 if the target supports multiple vector sizes
4540 proc check_effective_target_vect_multiple_sizes { } {
4541 global et_vect_multiple_sizes_saved
4543 set et_vect_multiple_sizes_saved 0
4544 if { ([istarget aarch64*-*-*]
4545 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])) } {
4546 set et_vect_multiple_sizes_saved 1
4548 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
4549 if { ([check_avx_available] && ![check_prefer_avx128]) } {
4550 set et_vect_multiple_sizes_saved 1
4554 verbose "check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
4555 return $et_vect_multiple_sizes_saved
4558 # Return 1 if the target supports vectors of 64 bits.
4560 proc check_effective_target_vect64 { } {
4561 global et_vect64_saved
4563 if [info exists et_vect64_saved] {
4564 verbose "check_effective_target_vect64: using cached result" 2
4566 set et_vect64_saved 0
4567 if { ([istarget arm*-*-*]
4568 && [check_effective_target_arm_neon_ok]
4569 && [check_effective_target_arm_little_endian]) } {
4570 set et_vect64_saved 1
4574 verbose "check_effective_target_vect64: returning $et_vect64_saved" 2
4575 return $et_vect64_saved
4578 # Return 1 if the target supports vector copysignf calls.
4580 proc check_effective_target_vect_call_copysignf { } {
4581 global et_vect_call_copysignf_saved
4583 if [info exists et_vect_call_copysignf_saved] {
4584 verbose "check_effective_target_vect_call_copysignf: using cached result" 2
4586 set et_vect_call_copysignf_saved 0
4587 if { [istarget i?86-*-*] || [istarget x86_64-*-*]
4588 || [istarget powerpc*-*-*] } {
4589 set et_vect_call_copysignf_saved 1
4593 verbose "check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
4594 return $et_vect_call_copysignf_saved
4597 # Return 1 if the target supports vector sqrtf calls.
4599 proc check_effective_target_vect_call_sqrtf { } {
4600 global et_vect_call_sqrtf_saved
4602 if [info exists et_vect_call_sqrtf_saved] {
4603 verbose "check_effective_target_vect_call_sqrtf: using cached result" 2
4605 set et_vect_call_sqrtf_saved 0
4606 if { [istarget aarch64*-*-*]
4607 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4608 || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } {
4609 set et_vect_call_sqrtf_saved 1
4613 verbose "check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
4614 return $et_vect_call_sqrtf_saved
4617 # Return 1 if the target supports vector lrint calls.
4619 proc check_effective_target_vect_call_lrint { } {
4620 set et_vect_call_lrint 0
4621 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
4622 && [check_effective_target_ilp32] } {
4623 set et_vect_call_lrint 1
4626 verbose "check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4627 return $et_vect_call_lrint
4630 # Return 1 if the target supports vector btrunc calls.
4632 proc check_effective_target_vect_call_btrunc { } {
4633 global et_vect_call_btrunc_saved
4635 if [info exists et_vect_call_btrunc_saved] {
4636 verbose "check_effective_target_vect_call_btrunc: using cached result" 2
4638 set et_vect_call_btrunc_saved 0
4639 if { [istarget aarch64*-*-*] } {
4640 set et_vect_call_btrunc_saved 1
4644 verbose "check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4645 return $et_vect_call_btrunc_saved
4648 # Return 1 if the target supports vector btruncf calls.
4650 proc check_effective_target_vect_call_btruncf { } {
4651 global et_vect_call_btruncf_saved
4653 if [info exists et_vect_call_btruncf_saved] {
4654 verbose "check_effective_target_vect_call_btruncf: using cached result" 2
4656 set et_vect_call_btruncf_saved 0
4657 if { [istarget aarch64*-*-*] } {
4658 set et_vect_call_btruncf_saved 1
4662 verbose "check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4663 return $et_vect_call_btruncf_saved
4666 # Return 1 if the target supports vector ceil calls.
4668 proc check_effective_target_vect_call_ceil { } {
4669 global et_vect_call_ceil_saved
4671 if [info exists et_vect_call_ceil_saved] {
4672 verbose "check_effective_target_vect_call_ceil: using cached result" 2
4674 set et_vect_call_ceil_saved 0
4675 if { [istarget aarch64*-*-*] } {
4676 set et_vect_call_ceil_saved 1
4680 verbose "check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4681 return $et_vect_call_ceil_saved
4684 # Return 1 if the target supports vector ceilf calls.
4686 proc check_effective_target_vect_call_ceilf { } {
4687 global et_vect_call_ceilf_saved
4689 if [info exists et_vect_call_ceilf_saved] {
4690 verbose "check_effective_target_vect_call_ceilf: using cached result" 2
4692 set et_vect_call_ceilf_saved 0
4693 if { [istarget aarch64*-*-*] } {
4694 set et_vect_call_ceilf_saved 1
4698 verbose "check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4699 return $et_vect_call_ceilf_saved
4702 # Return 1 if the target supports vector floor calls.
4704 proc check_effective_target_vect_call_floor { } {
4705 global et_vect_call_floor_saved
4707 if [info exists et_vect_call_floor_saved] {
4708 verbose "check_effective_target_vect_call_floor: using cached result" 2
4710 set et_vect_call_floor_saved 0
4711 if { [istarget aarch64*-*-*] } {
4712 set et_vect_call_floor_saved 1
4716 verbose "check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4717 return $et_vect_call_floor_saved
4720 # Return 1 if the target supports vector floorf calls.
4722 proc check_effective_target_vect_call_floorf { } {
4723 global et_vect_call_floorf_saved
4725 if [info exists et_vect_call_floorf_saved] {
4726 verbose "check_effective_target_vect_call_floorf: using cached result" 2
4728 set et_vect_call_floorf_saved 0
4729 if { [istarget aarch64*-*-*] } {
4730 set et_vect_call_floorf_saved 1
4734 verbose "check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4735 return $et_vect_call_floorf_saved
4738 # Return 1 if the target supports vector lceil calls.
4740 proc check_effective_target_vect_call_lceil { } {
4741 global et_vect_call_lceil_saved
4743 if [info exists et_vect_call_lceil_saved] {
4744 verbose "check_effective_target_vect_call_lceil: using cached result" 2
4746 set et_vect_call_lceil_saved 0
4747 if { [istarget aarch64*-*-*] } {
4748 set et_vect_call_lceil_saved 1
4752 verbose "check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4753 return $et_vect_call_lceil_saved
4756 # Return 1 if the target supports vector lfloor calls.
4758 proc check_effective_target_vect_call_lfloor { } {
4759 global et_vect_call_lfloor_saved
4761 if [info exists et_vect_call_lfloor_saved] {
4762 verbose "check_effective_target_vect_call_lfloor: using cached result" 2
4764 set et_vect_call_lfloor_saved 0
4765 if { [istarget aarch64*-*-*] } {
4766 set et_vect_call_lfloor_saved 1
4770 verbose "check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4771 return $et_vect_call_lfloor_saved
4774 # Return 1 if the target supports vector nearbyint calls.
4776 proc check_effective_target_vect_call_nearbyint { } {
4777 global et_vect_call_nearbyint_saved
4779 if [info exists et_vect_call_nearbyint_saved] {
4780 verbose "check_effective_target_vect_call_nearbyint: using cached result" 2
4782 set et_vect_call_nearbyint_saved 0
4783 if { [istarget aarch64*-*-*] } {
4784 set et_vect_call_nearbyint_saved 1
4788 verbose "check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4789 return $et_vect_call_nearbyint_saved
4792 # Return 1 if the target supports vector nearbyintf calls.
4794 proc check_effective_target_vect_call_nearbyintf { } {
4795 global et_vect_call_nearbyintf_saved
4797 if [info exists et_vect_call_nearbyintf_saved] {
4798 verbose "check_effective_target_vect_call_nearbyintf: using cached result" 2
4800 set et_vect_call_nearbyintf_saved 0
4801 if { [istarget aarch64*-*-*] } {
4802 set et_vect_call_nearbyintf_saved 1
4806 verbose "check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4807 return $et_vect_call_nearbyintf_saved
4810 # Return 1 if the target supports vector round calls.
4812 proc check_effective_target_vect_call_round { } {
4813 global et_vect_call_round_saved
4815 if [info exists et_vect_call_round_saved] {
4816 verbose "check_effective_target_vect_call_round: using cached result" 2
4818 set et_vect_call_round_saved 0
4819 if { [istarget aarch64*-*-*] } {
4820 set et_vect_call_round_saved 1
4824 verbose "check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4825 return $et_vect_call_round_saved
4828 # Return 1 if the target supports vector roundf calls.
4830 proc check_effective_target_vect_call_roundf { } {
4831 global et_vect_call_roundf_saved
4833 if [info exists et_vect_call_roundf_saved] {
4834 verbose "check_effective_target_vect_call_roundf: using cached result" 2
4836 set et_vect_call_roundf_saved 0
4837 if { [istarget aarch64*-*-*] } {
4838 set et_vect_call_roundf_saved 1
4842 verbose "check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4843 return $et_vect_call_roundf_saved
4846 # Return 1 if the target supports section-anchors
4848 proc check_effective_target_section_anchors { } {
4849 global et_section_anchors_saved
4851 if [info exists et_section_anchors_saved] {
4852 verbose "check_effective_target_section_anchors: using cached result" 2
4854 set et_section_anchors_saved 0
4855 if { [istarget powerpc*-*-*]
4856 || [istarget arm*-*-*] } {
4857 set et_section_anchors_saved 1
4861 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4862 return $et_section_anchors_saved
4865 # Return 1 if the target supports atomic operations on "int_128" values.
4867 proc check_effective_target_sync_int_128 { } {
4868 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
4869 && ![is-effective-target ia32] } {
4876 # Return 1 if the target supports atomic operations on "int_128" values
4877 # and can execute them.
4879 proc check_effective_target_sync_int_128_runtime { } {
4880 if { ([istarget x86_64-*-*] || [istarget i?86-*-*])
4881 && ![is-effective-target ia32] } {
4882 return [check_cached_effective_target sync_int_128_available {
4883 check_runtime_nocache sync_int_128_available {
4887 unsigned int eax, ebx, ecx, edx;
4888 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
4889 return !(ecx & bit_CMPXCHG16B);
4899 # Return 1 if the target supports atomic operations on "long long".
4901 # Note: 32bit x86 targets require -march=pentium in dg-options.
4903 proc check_effective_target_sync_long_long { } {
4904 if { [istarget x86_64-*-*] || [istarget i?86-*-*])
4905 || [istarget aarch64*-*-*]
4906 || [istarget arm*-*-*]
4907 || [istarget alpha*-*-*]
4908 || ([istarget sparc*-*-*] && [check_effective_target_lp64]) } {
4915 # Return 1 if the target supports atomic operations on "long long"
4916 # and can execute them.
4918 # Note: 32bit x86 targets require -march=pentium in dg-options.
4920 proc check_effective_target_sync_long_long_runtime { } {
4921 if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
4922 return [check_cached_effective_target sync_long_long_available {
4923 check_runtime_nocache sync_long_long_available {
4927 unsigned int eax, ebx, ecx, edx;
4928 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
4929 return !(edx & bit_CMPXCHG8B);
4934 } elseif { [istarget aarch64*-*-*] } {
4936 } elseif { [istarget arm*-*-linux-*] } {
4937 return [check_runtime sync_longlong_runtime {
4943 if (sizeof (long long) != 8)
4946 /* Just check for native; checking for kernel fallback is tricky. */
4947 asm volatile ("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4952 } elseif { [istarget alpha*-*-*] } {
4954 } elseif { ([istarget sparc*-*-*]
4955 && [check_effective_target_lp64]
4956 && [check_effective_target_ultrasparc_hw]) } {
4958 } elseif { [istarget powerpc*-*-*] && [check_effective_target_lp64] } {
4965 # Return 1 if the target supports byte swap instructions.
4967 proc check_effective_target_bswap { } {
4968 global et_bswap_saved
4970 if [info exists et_bswap_saved] {
4971 verbose "check_effective_target_bswap: using cached result" 2
4973 set et_bswap_saved 0
4974 if { [istarget aarch64*-*-*]
4975 || [istarget alpha*-*-*]
4976 || [istarget i?86-*-*] || [istarget x86_64-*-*]
4977 || [istarget m68k-*-*]
4978 || [istarget powerpc*-*-*]
4979 || [istarget rs6000-*-*]
4980 || [istarget s390*-*-*] } {
4981 set et_bswap_saved 1
4983 if { [istarget arm*-*-*]
4984 && [check_no_compiler_messages_nocache arm_v6_or_later object {
4986 #error not armv6 or later
4990 set et_bswap_saved 1
4995 verbose "check_effective_target_bswap: returning $et_bswap_saved" 2
4996 return $et_bswap_saved
4999 # Return 1 if the target supports 16-bit byte swap instructions.
5001 proc check_effective_target_bswap16 { } {
5002 global et_bswap16_saved
5004 if [info exists et_bswap16_saved] {
5005 verbose "check_effective_target_bswap16: using cached result" 2
5007 set et_bswap16_saved 0
5008 if { [is-effective-target bswap]
5009 && ![istarget alpha*-*-*]
5010 && !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
5011 set et_bswap16_saved 1
5015 verbose "check_effective_target_bswap16: returning $et_bswap16_saved" 2
5016 return $et_bswap16_saved
5019 # Return 1 if the target supports 32-bit byte swap instructions.
5021 proc check_effective_target_bswap32 { } {
5022 global et_bswap32_saved
5024 if [info exists et_bswap32_saved] {
5025 verbose "check_effective_target_bswap32: using cached result" 2
5027 set et_bswap32_saved 0
5028 if { [is-effective-target bswap] } {
5029 set et_bswap32_saved 1
5033 verbose "check_effective_target_bswap32: returning $et_bswap32_saved" 2
5034 return $et_bswap32_saved
5037 # Return 1 if the target supports 64-bit byte swap instructions.
5039 proc check_effective_target_bswap64 { } {
5040 global et_bswap64_saved
5042 if [info exists et_bswap64_saved] {
5043 verbose "check_effective_target_bswap64: using cached result" 2
5045 set et_bswap64_saved 0
5046 if { [is-effective-target bswap]
5047 && [is-effective-target lp64] } {
5048 set et_bswap64_saved 1
5052 verbose "check_effective_target_bswap64: returning $et_bswap64_saved" 2
5053 return $et_bswap64_saved
5056 # Return 1 if the target supports atomic operations on "int" and "long".
5058 proc check_effective_target_sync_int_long { } {
5059 global et_sync_int_long_saved
5061 if [info exists et_sync_int_long_saved] {
5062 verbose "check_effective_target_sync_int_long: using cached result" 2
5064 set et_sync_int_long_saved 0
5065 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
5066 #
load-reserved/store
-conditional instructions.
5067 if { [istarget ia64
-*-*]
5068 ||
[istarget i?
86-*-*] ||
[istarget x86_64
-*-*]
5069 ||
[istarget aarch64
*-*-*]
5070 ||
[istarget alpha
*-*-*]
5071 ||
[istarget arm
*-*-linux
-*]
5072 ||
[istarget bfin
*-*linux
*]
5073 ||
[istarget hppa
*-*linux
*]
5074 ||
[istarget s390
*-*-*]
5075 ||
[istarget powerpc
*-*-*]
5076 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
5077 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
5078 ||
[check_effective_target_mips_llsc
] } {
5079 set et_sync_int_long_saved
1
5083 verbose
"check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
5084 return $et_sync_int_long_saved
5087 #
Return 1 if the target supports atomic operations
on "char" and "short".
5089 proc check_effective_target_sync_char_short
{ } {
5090 global et_sync_char_short_saved
5092 if [info exists et_sync_char_short_saved
] {
5093 verbose
"check_effective_target_sync_char_short: using cached result" 2
5095 set et_sync_char_short_saved
0
5096 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
5097 # load-reserved/store-conditional instructions.
5098 if { [istarget aarch64*-*-*]
5099 || [istarget ia64-*-*]
5100 || [istarget i?86-*-*] || [istarget x86_64-*-*]
5101 || [istarget alpha*-*-*]
5102 || [istarget arm*-*-linux-*]
5103 || [istarget hppa*-*linux*]
5104 || [istarget s390*-*-*]
5105 || [istarget powerpc*-*-*]
5106 || [istarget crisv32-*-*] || [istarget cris-*-*]
5107 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
5108 || [check_effective_target_mips_llsc] } {
5109 set et_sync_char_short_saved 1
5113 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
5114 return $et_sync_char_short_saved
5117 # Return 1 if the target uses a ColdFire FPU.
5119 proc check_effective_target_coldfire_fpu { } {
5120 return [check_no_compiler_messages coldfire_fpu assembly {
5127 # Return true if this is a uClibc target.
5129 proc check_effective_target_uclibc {} {
5130 return [check_no_compiler_messages uclibc object {
5131 #include <features.h>
5132 #if !defined (__UCLIBC__)
5138 # Return true if this is a uclibc target and if the uclibc feature
5139 # described by __$feature__ is not present.
5141 proc check_missing_uclibc_feature {feature} {
5142 return [check_no_compiler_messages $feature object "
5143 #include <features.h>
5144 #if !defined (__UCLIBC) || defined (__${feature}__)
5150 # Return true if this is a Newlib target.
5152 proc check_effective_target_newlib {} {
5153 return [check_no_compiler_messages newlib object {
5158 # Return true if this is NOT a Bionic target.
5160 proc check_effective_target_non_bionic {} {
5161 return [check_no_compiler_messages non_bionic object {
5163 #if defined (__BIONIC__)
5169 # Return true if this target has error.h header.
5171 proc check_effective_target_error_h {} {
5172 return [check_no_compiler_messages error_h object {
5177 # Return true if this target has tgmath.h header.
5179 proc check_effective_target_tgmath_h {} {
5180 return [check_no_compiler_messages tgmath_h object {
5185 # Return true if target's libc supports complex functions.
5187 proc check_effective_target_libc_has_complex_functions
{} {
5188 return [check_no_compiler_messages libc_has_complex_functions object
{
5189 #
include <complex.h
>
5194 #
(a
) an error of a few ULP is expected in string to floating
-point
5195 # conversion functions
; and
5196 #
(b
) overflow is not always detected correctly by those functions.
5198 proc check_effective_target_lax_strtofp
{} {
5199 # By default
, assume that all uClibc targets suffer from this.
5200 return [check_effective_target_uclibc
]
5203 #
Return 1 if this is a target
for which wcsftime is a dummy
5204 # function that always returns
0.
5206 proc check_effective_target_dummy_wcsftime
{} {
5207 # By default
, assume that all uClibc targets suffer from this.
5208 return [check_effective_target_uclibc
]
5211 #
Return 1 if constructors with initialization priority arguments are
5212 # supposed
on this target.
5214 proc check_effective_target_init_priority
{} {
5215 return [check_no_compiler_messages init_priority assembly
"
5216 void f
() __attribute__
((constructor
(1000)));
5221 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
5222 # This can be used with
any check_
* proc that takes no
argument and
5223 # returns only
1 or
0. It could be used with check_
* procs that take
5224 # arguments with keywords that pass particular arguments.
5226 proc is
-effective
-target
{ arg } {
5228 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5229 set selected
[check_effective_target_$
{arg}]
5232 "vmx_hw" { set selected [check_vmx_hw_available] }
5233 "vsx_hw" { set selected [check_vsx_hw_available] }
5234 "p8vector_hw" { set selected [check_p8vector_hw_available] }
5235 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
5236 "dfp_hw" { set selected [check_dfp_hw_available] }
5237 "named_sections" { set selected [check_named_sections_available] }
5238 "gc_sections" { set selected [check_gc_sections_available] }
5239 "cxa_atexit" { set selected [check_cxa_atexit_available] }
5240 default
{ error
"unknown effective target keyword `$arg'" }
5243 verbose
"is-effective-target: $arg $selected" 2
5247 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
5249 proc is
-effective
-target
-keyword
{ arg } {
5250 if { [info procs check_effective_target_$
{arg}] != [list
] } {
5253 # These have different names
for their check_
* procs.
5255 "vmx_hw" { return 1 }
5256 "vsx_hw" { return 1 }
5257 "p8vector_hw" { return 1 }
5258 "ppc_recip_hw" { return 1 }
5259 "dfp_hw" { return 1 }
5260 "named_sections" { return 1 }
5261 "gc_sections" { return 1 }
5262 "cxa_atexit" { return 1 }
5263 default
{ return 0 }
5268 #
Return 1 if target default to short enums
5270 proc check_effective_target_short_enums
{ } {
5271 return [check_no_compiler_messages short_enums assembly
{
5273 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
5277 #
Return 1 if target supports merging string constants at link time.
5279 proc check_effective_target_string_merging
{ } {
5280 return [check_no_messages_and_pattern string_merging \
5281 "rodata\\.str" assembly {
5282 const char
*var
= "String";
5286 #
Return 1 if target has the basic signed and unsigned types in
5287 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
5288 # working
<stdint.h
> for all targets.
5290 proc check_effective_target_stdint_types
{ } {
5291 return [check_no_compiler_messages stdint_types assembly
{
5293 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
5294 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
5298 #
Return 1 if target has the basic signed and unsigned types in
5299 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
5300 # these types agree with those in the header, as some systems have
5301 # only <inttypes.h>.
5303 proc check_effective_target_inttypes_types { } {
5304 return [check_no_compiler_messages inttypes_types assembly {
5305 #include <inttypes.h>
5306 int8_t a; int16_t b; int32_t c; int64_t d;
5307 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
5311 # Return 1 if programs are intended to be run on a simulator
5312 # (i.e. slowly) rather than hardware (i.e. fast).
5314 proc check_effective_target_simulator { } {
5316 # All "src/sim" simulators set this one.
5317 if [board_info target exists is_simulator] {
5318 return [board_info target is_simulator]
5321 # The "sid" simulators don't
set that one
, but at least they
set
5323 if [board_info target
exists slow_simulator
] {
5324 return [board_info target slow_simulator
]
5330 #
Return 1 if programs are intended to be run
on hardware rather than
5333 proc check_effective_target_hw
{ } {
5335 # All
"src/sim" simulators set this one.
5336 if [board_info target
exists is_simulator
] {
5337 if [board_info target is_simulator
] {
5344 # The
"sid" simulators don't set that one, but at least they set
5346 if [board_info target
exists slow_simulator
] {
5347 if [board_info target slow_simulator
] {
5357 #
Return 1 if the target is a VxWorks kernel.
5359 proc check_effective_target_vxworks_kernel
{ } {
5360 return [check_no_compiler_messages vxworks_kernel assembly
{
5361 #
if !defined __vxworks || defined __RTP__
5367 #
Return 1 if the target is a VxWorks RTP.
5369 proc check_effective_target_vxworks_rtp
{ } {
5370 return [check_no_compiler_messages vxworks_rtp assembly
{
5371 #
if !defined __vxworks ||
!defined __RTP__
5377 #
Return 1 if the target is expected to provide wide character support.
5379 proc check_effective_target_wchar
{ } {
5380 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
5383 return [check_no_compiler_messages wchar assembly
{
5388 #
Return 1 if the target has
<pthread.h
>.
5390 proc check_effective_target_pthread_h
{ } {
5391 return [check_no_compiler_messages pthread_h assembly
{
5392 #
include <pthread.h
>
5396 #
Return 1 if the target can truncate a file from a file
-descriptor
,
5397 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
5398 # chsize. We test
for a trivially functional truncation
; no stubs.
5399 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
5400 # different function to be used.
5402 proc check_effective_target_fd_truncate { } {
5404 #define _FILE_OFFSET_BITS 64
5411 FILE *f = fopen ("tst.tmp", "wb");
5413 const char t[] = "test writing more than ten characters";
5417 write (fd, t, sizeof (t) - 1);
5419 if (ftruncate (fd, 10) != 0)
5428 f = fopen ("tst.tmp", "rb");
5429 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
5437 if { [check_runtime ftruncate $prog] } {
5441 regsub "ftruncate" $prog "chsize" prog
5442 return [check_runtime chsize $prog]
5445 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
5447 proc add_options_for_c99_runtime { flags } {
5448 if { [istarget *-*-solaris2*] } {
5449 return "$flags -std=c99"
5451 if { [istarget powerpc-*-darwin*] } {
5452 return "$flags -mmacosx-version-min=10.3"
5457 # Add to FLAGS all the target-specific flags needed to enable
5458 # full IEEE compliance mode.
5460 proc add_options_for_ieee { flags } {
5461 if { [istarget alpha*-*-*]
5462 || [istarget sh*-*-*] } {
5463 return "$flags -mieee"
5465 if { [istarget rx-*-*] } {
5466 return "$flags -mnofpu"
5471 if {![info exists flags_to_postpone]} {
5472 set flags_to_postpone ""
5475 # Add to FLAGS the flags needed to enable functions to bind locally
5476 # when using pic/PIC passes in the testsuite.
5477 proc add_options_for_bind_pic_locally { flags } {
5478 global flags_to_postpone
5480 # Instead of returning 'flags
' with the -fPIE or -fpie appended, we save it
5481 # in 'flags_to_postpone
' and append it later in gcc_target_compile procedure in
5482 # order to make sure that the multilib_flags doesn't override this.
5484 if {[check_no_compiler_messages using_pic2 assembly
{
5489 set flags_to_postpone
"-fPIE"
5492 if {[check_no_compiler_messages using_pic1 assembly
{
5497 set flags_to_postpone
"-fpie"
5503 # Add to FLAGS the flags needed to enable
64-bit vectors.
5505 proc add_options_for_double_vectors
{ flags
} {
5506 if [is
-effective
-target arm_neon_ok
] {
5507 return "$flags -mvectorize-with-neon-double"
5513 #
Return 1 if the target provides a full C99 runtime.
5515 proc check_effective_target_c99_runtime
{ } {
5516 return [check_cached_effective_target c99_runtime
{
5519 set file
[open
"$srcdir/gcc.dg/builtins-config.h"]
5520 set contents
[read $file
]
5523 #ifndef HAVE_C99_RUNTIME
5524 #error
!HAVE_C99_RUNTIME
5527 check_no_compiler_messages_nocache c99_runtime assembly \
5528 $contents
[add_options_for_c99_runtime
""]
5532 #
Return 1 if target wchar_t is at least
4 bytes.
5534 proc check_effective_target_4byte_wchar_t
{ } {
5535 return [check_no_compiler_messages
4byte_wchar_t object
{
5536 int dummy
[sizeof
(__WCHAR_TYPE__
) >= 4 ?
1 : -1];
5540 #
Return 1 if the target supports automatic stack alignment.
5542 proc check_effective_target_automatic_stack_alignment
{ } {
5543 # Ordinarily x86 supports automatic stack alignment ...
5544 if { [istarget i?
86*-*-*] ||
[istarget x86_64
-*-*] } then {
5545 if { [istarget
*-*-mingw
*] ||
[istarget
*-*-cygwin
*] } {
5546 # ... except Win64 SEH doesn
't. Succeed for Win32 though.
5547 return [check_effective_target_ilp32];
5554 # Return true if we are compiling for AVX target.
5556 proc check_avx_available { } {
5557 if { [check_no_compiler_messages avx_available assembly {
5567 # Return true if 32- and 16-bytes vectors are available.
5569 proc check_effective_target_vect_sizes_32B_16B { } {
5570 if { [check_avx_available] && ![check_prefer_avx128] } {
5577 # Return true if 128-bits vectors are preferred even if 256-bits vectors
5580 proc check_prefer_avx128 { } {
5581 if ![check_avx_available] {
5584 return [check_no_messages_and_pattern avx_explicit "xmm" assembly {
5585 float a[1024],b[1024],c[1024];
5586 void foo (void) { int i; for (i = 0; i < 1024; i++) a[i]=b[i]+c[i];}
5587 } "-O2 -ftree-vectorize"]
5591 # Return 1 if avx512f instructions can be compiled.
5593 proc check_effective_target_avx512f { } {
5594 return [check_no_compiler_messages avx512f object {
5595 typedef double __m512d __attribute__ ((__vector_size__ (64)));
5597 __m512d _mm512_add (__m512d a)
5599 return __builtin_ia32_addpd512_mask (a, a, a, 1, 4);
5604 # Return 1 if avx instructions can be compiled.
5606 proc check_effective_target_avx { } {
5607 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
5610 return [check_no_compiler_messages avx object {
5611 void _mm256_zeroall (void)
5613 __builtin_ia32_vzeroall ();
5618 # Return 1 if avx2 instructions can be compiled.
5619 proc check_effective_target_avx2 { } {
5620 return [check_no_compiler_messages avx2 object {
5621 typedef long long __v4di __attribute__ ((__vector_size__ (32)));
5623 mm256_is32_andnotsi256 (__v4di __X, __v4di __Y)
5625 return __builtin_ia32_andnotsi256 (__X, __Y);
5630 # Return 1 if sse instructions can be compiled.
5631 proc check_effective_target_sse { } {
5632 return [check_no_compiler_messages sse object {
5635 __builtin_ia32_stmxcsr ();
5641 # Return 1 if sse2 instructions can be compiled.
5642 proc check_effective_target_sse2 { } {
5643 return [check_no_compiler_messages sse2 object {
5644 typedef long long __m128i __attribute__ ((__vector_size__ (16)));
5646 __m128i _mm_srli_si128 (__m128i __A, int __N)
5648 return (__m128i)__builtin_ia32_psrldqi128 (__A, 8);
5653 # Return 1 if F16C instructions can be compiled.
5655 proc check_effective_target_f16c { } {
5656 return [check_no_compiler_messages f16c object {
5657 #include "immintrin.h"
5659 foo (unsigned short val)
5661 return _cvtsh_ss (val);
5666 # Return 1 if C wchar_t type is compatible with char16_t.
5668 proc check_effective_target_wchar_t_char16_t_compatible { } {
5669 return [check_no_compiler_messages wchar_t_char16_t object {
5671 __CHAR16_TYPE__ *p16 = &wc;
5672 char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5676 # Return 1 if C wchar_t type is compatible with char32_t.
5678 proc check_effective_target_wchar_t_char32_t_compatible { } {
5679 return [check_no_compiler_messages wchar_t_char32_t object {
5681 __CHAR32_TYPE__ *p32 = &wc;
5682 char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
5686 # Return 1 if pow10 function exists.
5688 proc check_effective_target_pow10 { } {
5689 return [check_runtime pow10 {
5699 # Return 1 if current options generate DFP instructions, 0 otherwise.
5701 proc check_effective_target_hard_dfp {} {
5702 return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
5703 typedef float d64 __attribute__((mode(DD)));
5705 void foo (void) { z = x + y; }
5709 # Return 1 if string.h and wchar.h headers provide C++ requires overloads
5710 # for strchr etc. functions.
5712 proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
5713 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly {
5716 #if !defined(__cplusplus) \
5717 || !defined(__CORRECT_ISO_CPP_STRING_H_PROTO) \
5718 || !defined(__CORRECT_ISO_CPP_WCHAR_H_PROTO)
5719 ISO C++ correct string.h and wchar.h protos not supported.
5726 # Return 1 if GNU as is used.
5728 proc check_effective_target_gas { } {
5729 global use_gas_saved
5732 if {![info exists use_gas_saved]} {
5733 # Check if the as used by gcc is GNU as.
5734 set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0]
5735 # Provide /dev/null as input, otherwise gas times out reading from
5737 set status [remote_exec host "$gcc_as" "-v /dev/null"]
5738 set as_output [lindex $status 1]
5739 if { [ string first "GNU" $as_output ] >= 0 } {
5745 return $use_gas_saved
5748 # Return 1 if GNU ld is used.
5750 proc check_effective_target_gld { } {
5751 global use_gld_saved
5754 if {![info exists use_gld_saved]} {
5755 # Check if the ld used by gcc is GNU ld.
5756 set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0]
5757 set status [remote_exec host "$gcc_ld" "--version"]
5758 set ld_output [lindex $status 1]
5759 if { [ string first "GNU" $ld_output ] >= 0 } {
5765 return $use_gld_saved
5768 # Return 1 if the compiler has been configure with link-time optimization
5771 proc check_effective_target_lto { } {
5772 if { [istarget nvptx-*-*] } {
5775 return [check_no_compiler_messages lto object {
5780 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
5782 proc check_effective_target_maybe_x32 { } {
5783 return [check_no_compiler_messages maybe_x32 object {
5785 } "-mx32 -maddress-mode=short"]
5788 # Return 1 if this target supports the -fsplit-stack option, 0
5791 proc check_effective_target_split_stack {} {
5792 return [check_no_compiler_messages split_stack object {
5797 # Return 1 if this target supports the -masm=intel option, 0
5800 proc check_effective_target_masm_intel {} {
5801 return [check_no_compiler_messages masm_intel object {
5802 extern void abort (void);
5806 # Return 1 if the language for the compiler under test is C.
5808 proc check_effective_target_c { } {
5810 if [string match $tool "gcc"] {
5816 # Return 1 if the language for the compiler under test is C++.
5818 proc check_effective_target_c++ { } {
5820 if [string match $tool "g++"] {
5826 # Check whether the current active language standard supports the features
5827 # of C++11/C++14 by checking for the presence of one of the -std
5828 # flags. This assumes that the default for the compiler is C++98, and that
5829 # there will never be multiple -std= arguments on the command line.
5830 proc check_effective_target_c++11_only { } {
5831 if ![check_effective_target_c++] {
5834 return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
5836 proc check_effective_target_c++11 { } {
5837 if [check_effective_target_c++11_only] {
5840 return [check_effective_target_c++14]
5842 proc check_effective_target_c++11_down { } {
5843 if ![check_effective_target_c++] {
5846 return ![check_effective_target_c++14]
5849 proc check_effective_target_c++14_only { } {
5850 if ![check_effective_target_c++] {
5853 return [check-flags { { } { } { -std=c++14 -std=gnu++14 -std=c++14 -std=gnu++14 } }]
5856 proc check_effective_target_c++14 { } {
5857 if [check_effective_target_c++14_only] {
5860 return [check_effective_target_c++1z]
5862 proc check_effective_target_c++14_down { } {
5863 if ![check_effective_target_c++] {
5866 return ![check_effective_target_c++1z]
5869 proc check_effective_target_c++98_only { } {
5870 if ![check_effective_target_c++] {
5873 return ![check_effective_target_c++11]
5876 proc check_effective_target_c++1z_only { } {
5877 if ![check_effective_target_c++] {
5880 return [check-flags { { } { } { -std=c++1z -std=gnu++1z } }]
5882 proc check_effective_target_c++1z { } {
5883 return [check_effective_target_c++1z_only]
5886 # Return 1 if expensive testcases should be run.
5888 proc check_effective_target_run_expensive_tests { } {
5889 if { [getenv GCC_TEST_RUN_EXPENSIVE] != "" } {
5895 # Returns 1 if "mempcpy" is available on the target system.
5897 proc check_effective_target_mempcpy {} {
5898 return [check_function_available "mempcpy"]
5901 # Returns 1 if "stpcpy" is available on the target system.
5903 proc check_effective_target_stpcpy {} {
5904 return [check_function_available "stpcpy"]
5907 # Check whether the vectorizer tests are supported by the target and
5908 # append additional target-dependent compile flags to DEFAULT_VECTCFLAGS.
5909 # Set dg-do-what-default to either compile or run, depending on target
5910 # capabilities. Return 1 if vectorizer tests are supported by
5911 # target, 0 otherwise.
5913 proc check_vect_support_and_set_flags { } {
5914 global DEFAULT_VECTCFLAGS
5915 global dg-do-what-default
5917 if [istarget powerpc-*paired*] {
5918 lappend DEFAULT_VECTCFLAGS "-mpaired"
5919 if [check_750cl_hw_available] {
5920 set dg-do-what-default run
5922 set dg-do-what-default compile
5924 } elseif [istarget powerpc*-*-*] {
5925 # Skip targets not supporting -maltivec.
5926 if ![is-effective-target powerpc_altivec_ok] {
5930 lappend DEFAULT_VECTCFLAGS "-maltivec"
5931 if [check_p8vector_hw_available] {
5932 lappend DEFAULT_VECTCFLAGS "-mpower8-vector" "-mno-allow-movmisalign"
5933 } elseif [check_vsx_hw_available] {
5934 lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
5937 if [check_vmx_hw_available] {
5938 set dg-do-what-default run
5940 if [is-effective-target ilp32] {
5941 # Specify a cpu that supports VMX for compile-only tests.
5942 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
5944 set dg-do-what-default compile
5946 } elseif { [istarget spu-*-*] } {
5947 set dg-do-what-default run
5948 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
5949 lappend DEFAULT_VECTCFLAGS "-msse2"
5950 if { [check_effective_target_sse2_runtime] } {
5951 set dg-do-what-default run
5953 set dg-do-what-default compile
5955 } elseif { [istarget mips*-*-*]
5956 && ([check_effective_target_mpaired_single]
5957 || [check_effective_target_mips_loongson])
5958 && [check_effective_target_nomips16] } {
5959 if { [check_effective_target_mpaired_single] } {
5960 lappend DEFAULT_VECTCFLAGS "-mpaired-single"
5962 set dg-do-what-default run
5963 } elseif [istarget sparc*-*-*] {
5964 lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
5965 if [check_effective_target_ultrasparc_hw] {
5966 set dg-do-what-default run
5968 set dg-do-what-default compile
5970 } elseif [istarget alpha*-*-*] {
5971 # Alpha's vectorization capabilities are extremely limited.
5972 # It
's more effort than its worth disabling all of the tests
5973 # that it cannot pass. But if you actually want to see what
5974 # does work, command out the return.
5977 lappend DEFAULT_VECTCFLAGS "-mmax"
5978 if [check_alpha_max_hw_available] {
5979 set dg-do-what-default run
5981 set dg-do-what-default compile
5983 } elseif [istarget ia64-*-*] {
5984 set dg-do-what-default run
5985 } elseif [is-effective-target arm_neon_ok] {
5986 eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
5987 # NEON does not support denormals, so is not used for vectorization by
5988 # default to avoid loss of precision. We must pass -ffast-math to test
5989 # vectorization of float operations.
5990 lappend DEFAULT_VECTCFLAGS "-ffast-math"
5991 if [is-effective-target arm_neon_hw] {
5992 set dg-do-what-default run
5994 set dg-do-what-default compile
5996 } elseif [istarget "aarch64*-*-*"] {
5997 set dg-do-what-default run
6005 # Return 1 if the target does *not* require strict alignment.
6007 proc check_effective_target_non_strict_align {} {
6008 return [check_no_compiler_messages non_strict_align assembly {
6010 typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
6012 void foo(void) { z = (c *) y; }
6016 # Return 1 if the target has <ucontext.h>.
6018 proc check_effective_target_ucontext_h { } {
6019 return [check_no_compiler_messages ucontext_h assembly {
6020 #include <ucontext.h>
6024 proc check_effective_target_aarch64_tiny { } {
6025 if { [istarget aarch64*-*-*] } {
6026 return [check_no_compiler_messages aarch64_tiny object {
6027 #ifdef __AARCH64_CMODEL_TINY__
6030 #error target not AArch64 tiny code model
6038 proc check_effective_target_aarch64_small { } {
6039 if { [istarget aarch64*-*-*] } {
6040 return [check_no_compiler_messages aarch64_small object {
6041 #ifdef __AARCH64_CMODEL_SMALL__
6044 #error target not AArch64 small code model
6052 proc check_effective_target_aarch64_large { } {
6053 if { [istarget aarch64*-*-*] } {
6054 return [check_no_compiler_messages aarch64_large object {
6055 #ifdef __AARCH64_CMODEL_LARGE__
6058 #error target not AArch64 large code model
6066 # Return 1 if <fenv.h> is available with all the standard IEEE
6067 # exceptions and floating-point exceptions are raised by arithmetic
6068 # operations. (If the target requires special options for "inexact"
6069 # exceptions, those need to be specified in the testcases.)
6071 proc check_effective_target_fenv_exceptions {} {
6072 return [check_runtime fenv_exceptions {
6075 #ifndef FE_DIVBYZERO
6076 # error Missing FE_DIVBYZERO
6079 # error Missing FE_INEXACT
6082 # error Missing FE_INVALID
6085 # error Missing FE_OVERFLOW
6087 #ifndef FE_UNDERFLOW
6088 # error Missing FE_UNDERFLOW
6090 volatile float a = 0.0f, r;
6095 if (fetestexcept (FE_INVALID))
6100 } [add_options_for_ieee "-std=gnu99"]]
6103 proc check_effective_target_tiny {} {
6104 global et_target_tiny_saved
6106 if [info exists et_target_tine_saved] {
6107 verbose "check_effective_target_tiny: using cached result" 2
6109 set et_target_tiny_saved 0
6110 if { [istarget aarch64*-*-*]
6111 && [check_effective_target_aarch64_tiny] } {
6112 set et_target_tiny_saved 1
6116 return $et_target_tiny_saved
6119 # Return 1 if LOGICAL_OP_NON_SHORT_CIRCUIT is set to 0 for the current target.
6121 proc check_effective_target_logical_op_short_circuit {} {
6122 if { [istarget mips*-*-*]
6123 || [istarget arc*-*-*]
6124 || [istarget avr*-*-*]
6125 || [istarget crisv32-*-*] || [istarget cris-*-*]
6126 || [istarget mmix-*-*]
6127 || [istarget s390*-*-*]
6128 || [istarget powerpc*-*-*]
6129 || [istarget nios2*-*-*]
6130 || [istarget visium-*-*]
6131 || [check_effective_target_arm_cortex_m] } {
6137 # Record that dg-final test TEST requires convential compilation.
6139 proc force_conventional_output_for { test } {
6140 if { [info proc $test] == "" } {
6141 perror "$test does not exist"
6144 proc ${test}_required_options {} {
6145 global gcc_force_conventional_output
6146 return $gcc_force_conventional_output
6150 # Return 1 if the x86-64 target supports PIE with copy reloc, 0
6151 # otherwise. Cache the result.
6153 proc check_effective_target_pie_copyreloc { } {
6154 global pie_copyreloc_available_saved
6156 global GCC_UNDER_TEST
6158 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
6162 # Need auto-host.h to check linker support.
6163 if { ![file exists ../../auto-host.h ] } {
6167 if [info exists pie_copyreloc_available_saved] {
6168 verbose "check_effective_target_pie_copyreloc returning saved $pie_copyreloc_available_saved" 2
6170 # Set up and compile to see if linker supports PIE with copy
6171 # reloc. Include the current process ID in the file names to
6172 # prevent conflicts with invocations for multiple testsuites.
6177 set f [open $src "w"]
6178 puts $f "#include \"../../auto-host.h\""
6179 puts $f "#if HAVE_LD_PIE_COPYRELOC == 0"
6180 puts $f "# error Linker does not support PIE with copy reloc."
6184 verbose "check_effective_target_pie_copyreloc compiling testfile $src" 2
6185 set lines [${tool}_target_compile $src $obj object ""]
6190 if [string match "" $lines] then {
6191 verbose "check_effective_target_pie_copyreloc testfile compilation passed" 2
6192 set pie_copyreloc_available_saved 1
6194 verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2
6195 set pie_copyreloc_available_saved 0
6199 return $pie_copyreloc_available_saved