1 # Copyright
(C
) 1999-2013 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 solaris2 targets should support it
231 if { [istarget
*-*-solaris2
*] } {
235 # Windows targets Cygwin and MingW32 support it
237 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
241 # HP
-UX
10.X doesn
't support it
243 if { [istarget hppa*-*-hpux10*] } {
247 # ELF and ECOFF support it. a.out does with gas/gld but may also with
248 # other linkers, so we should try it
250 set objformat [gcc_target_object_format]
258 unknown { return -1 }
263 ###############################
264 # proc check_weak_override_available { }
265 ###############################
267 # Like check_weak_available, but return 0 if weak symbol definitions
268 # cannot be overridden.
270 proc check_weak_override_available { } {
271 if { [istarget *-*-mingw*] } {
274 return [check_weak_available]
277 ###############################
278 # proc check_visibility_available { what_kind }
279 ###############################
281 # The visibility attribute is only support in some object formats
282 # This proc returns 1 if it is supported, 0 if not.
283 # The argument is the kind of visibility, default/protected/hidden/internal.
285 proc check_visibility_available { what_kind } {
286 if [string match "" $what_kind] { set what_kind "hidden" }
288 return [check_no_compiler_messages visibility_available_$what_kind object "
289 void f() __attribute__((visibility(\"$what_kind\")));
294 ###############################
295 # proc check_alias_available { }
296 ###############################
298 # Determine if the target toolchain supports the alias attribute.
300 # Returns 2 if the target supports aliases. Returns 1 if the target
301 # only supports weak aliased. Returns 0 if the target does not
302 # support aliases at all. Returns -1 if support for aliases could not
305 proc check_alias_available { } {
306 global alias_available_saved
309 if [info exists alias_available_saved] {
310 verbose "check_alias_available returning saved $alias_available_saved" 2
314 verbose "check_alias_available compiling testfile $src" 2
315 set f [open $src "w"]
316 # Compile a small test program. The definition of "g" is
317 # necessary to keep the Solaris assembler from complaining
319 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
320 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
322 set lines [${tool}_target_compile $src $obj object ""]
324 remote_file build delete $obj
326 if [string match "" $lines] then {
327 # No error messages, everything is OK.
328 set alias_available_saved 2
330 if [regexp "alias definitions not supported" $lines] {
331 verbose "check_alias_available target does not support aliases" 2
333 set objformat [gcc_target_object_format]
335 if { $objformat == "elf" } {
336 verbose "check_alias_available but target uses ELF format, so it ought to" 2
337 set alias_available_saved -1
339 set alias_available_saved 0
342 if [regexp "only weak aliases are supported" $lines] {
343 verbose "check_alias_available target supports only weak aliases" 2
344 set alias_available_saved 1
346 set alias_available_saved -1
351 verbose "check_alias_available returning $alias_available_saved" 2
354 return $alias_available_saved
357 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
359 proc check_ifunc_available { } {
360 return [check_no_compiler_messages ifunc_available object {
365 void f() __attribute__((ifunc("g")));
369 # Returns true if --gc-sections is supported on the target.
371 proc check_gc_sections_available { } {
372 global gc_sections_available_saved
375 if {![info exists gc_sections_available_saved]} {
376 # Some targets don't support gc
-sections despite whatever
's
377 # advertised by ld's options.
378 if { [istarget alpha
*-*-*]
379 ||
[istarget ia64
-*-*] } {
380 set gc_sections_available_saved
0
384 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
386 if { [board_info target
exists ldflags
]
387 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
388 set gc_sections_available_saved
0
392 # VxWorks kernel modules are relocatable objects linked with
-r
,
393 #
while RTP executables are linked with
-q
(--emit
-relocs
).
394 # Both of these options are incompatible with
--gc
-sections.
395 if { [istarget
*-*-vxworks
*] } {
396 set gc_sections_available_saved
0
400 # Check
if the
ld used by gcc supports
--gc
-sections.
401 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
402 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
403 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
404 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
405 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
406 set gc_sections_available_saved
1
408 set gc_sections_available_saved
0
411 return $gc_sections_available_saved
414 #
Return 1 if according to target_info struct and explicit target list
415 # target is supposed to support trampolines.
417 proc check_effective_target_trampolines
{ } {
418 if [target_info
exists no_trampolines
] {
421 if { [istarget avr
-*-*]
422 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
423 ||
[istarget hppa64
-hp
-hpux11.23
] } {
429 #
Return 1 if according to target_info struct and explicit target list
430 # target is supposed to keep null pointer checks. This could be due to
431 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
433 proc check_effective_target_keeps_null_pointer_checks
{ } {
434 if [target_info
exists keeps_null_pointer_checks
] {
437 if { [istarget avr
-*-*] } {
443 #
Return true
if profiling is supported
on the target.
445 proc check_profiling_available
{ test_what
} {
446 global profiling_available_saved
448 verbose
"Profiling argument is <$test_what>" 1
450 # These conditions depend
on the
argument so examine them before
451 # looking at the
cache variable.
453 # Tree profiling requires TLS runtime support.
454 if { $test_what
== "-fprofile-generate" } {
455 if { ![check_effective_target_tls_runtime
] } {
460 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
461 # vendor compiler. We cannot reliably predict the directory where the
462 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
463 # necessarily find mcrt1.o even if we have it.
464 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
468 # We don't yet support profiling
for MIPS16.
469 if { [istarget mips
*-*-*]
470 && ![check_effective_target_nomips16
]
471 && ($test_what
== "-p" || $test_what == "-pg") } {
475 # MinGW does not support
-p.
476 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
480 # We don
't yet support profiling for AArch64.
481 if { [istarget aarch64*-*-*]
482 && ([lindex $test_what 1] == "-p"
483 || [lindex $test_what 1] == "-pg") } {
487 # cygwin does not support -p.
488 if { [istarget *-*-cygwin*] && $test_what == "-p" } {
492 # uClibc does not have gcrt1.o.
493 if { [check_effective_target_uclibc]
494 && ($test_what == "-p" || $test_what == "-pg") } {
498 # Now examine the cache variable.
499 if {![info exists profiling_available_saved]} {
500 # Some targets don't have
any implementation of __bb_init_func or are
501 # missing other needed machinery.
502 if { [istarget aarch64
*-*-elf
]
503 ||
[istarget am3
*-*-linux
*]
504 ||
[istarget arm
*-*-eabi
*]
505 ||
[istarget arm
*-*-elf
]
506 ||
[istarget arm
*-*-symbianelf
*]
507 ||
[istarget avr
-*-*]
508 ||
[istarget bfin
-*-*]
509 ||
[istarget cris
-*-*]
510 ||
[istarget crisv32
-*-*]
511 ||
[istarget fido
-*-elf
]
512 ||
[istarget h8300
-*-*]
513 ||
[istarget lm32
-*-*]
514 ||
[istarget m32c
-*-elf
]
515 ||
[istarget m68k
-*-elf
]
516 ||
[istarget m68k
-*-uclinux
*]
517 ||
[istarget mep
-*-elf
]
518 ||
[istarget mips
*-*-elf
*]
519 ||
[istarget mmix
-*-*]
520 ||
[istarget mn10300
-*-elf
*]
521 ||
[istarget moxie
-*-elf
*]
522 ||
[istarget picochip
-*-*]
523 ||
[istarget powerpc
-*-eabi
*]
524 ||
[istarget powerpc
-*-elf
]
526 ||
[istarget tic6x
-*-elf
]
527 ||
[istarget xstormy16
-*]
528 ||
[istarget xtensa
*-*-elf
]
529 ||
[istarget
*-*-rtems
*]
530 ||
[istarget
*-*-vxworks
*] } {
531 set profiling_available_saved
0
533 set profiling_available_saved
1
537 return $profiling_available_saved
540 # Check to see
if a target is
"freestanding". This is as per the definition
541 # in Section
4 of C99 standard. Effectively
, it is a target which supports no
542 # extra headers or libraries other than what is considered essential.
543 proc check_effective_target_freestanding
{ } {
544 if { [istarget picochip
-*-*] } then {
551 #
Return 1 if target has packed layout of structure members by
552 # default
, 0 otherwise. Note that this is slightly different than
553 # whether the target has
"natural alignment": both attributes may be
556 proc check_effective_target_default_packed
{ } {
557 return [check_no_compiler_messages default_packed assembly
{
558 struct x
{ char a
; long b
; } c
;
559 int s
[sizeof
(c
) == sizeof
(char
) + sizeof
(long
) ?
1 : -1];
563 #
Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
564 # documentation
, where the test also comes from.
566 proc check_effective_target_pcc_bitfield_type_matters
{ } {
567 # PCC_BITFIELD_TYPE_MATTERS isn
't just about unnamed or empty
568 # bitfields, but let's stick to the example code from the docs.
569 return [check_no_compiler_messages pcc_bitfield_type_matters assembly
{
570 struct foo1
{ char x
; char
:0; char y
; };
571 struct foo2
{ char x
; int :0; char y
; };
572 int s
[sizeof
(struct foo1
) != sizeof
(struct foo2
) ?
1 : -1];
576 # Add to FLAGS all the target
-specific flags needed to use thread
-local storage.
578 proc add_options_for_tls
{ flags
} {
579 #
On Solaris
9, __tls_get_addr
/___tls_get_addr only lives in
580 # libthread
, so always pass
-pthread
for native TLS. Same
for AIX.
581 # Need to duplicate native TLS check from
582 # check_effective_target_tls_native to avoid recursion.
583 if { ([istarget
*-*-solaris2.9
*] ||
[istarget powerpc
-ibm
-aix
*]) &&
584 [check_no_messages_and_pattern tls_native
"!emutls" assembly {
586 int f
(void
) { return i
; }
587 void g
(int j
) { i
= j
; }
589 return "$flags -pthread"
594 #
Return 1 if thread local storage
(TLS
) is supported
, 0 otherwise.
596 proc check_effective_target_tls
{} {
597 return [check_no_compiler_messages tls assembly
{
599 int f
(void
) { return i
; }
600 void g
(int j
) { i
= j
; }
604 #
Return 1 if *native
* thread local storage
(TLS
) is supported
, 0 otherwise.
606 proc check_effective_target_tls_native
{} {
607 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
608 # functions
, so we fail to automatically detect it.
609 if { [istarget
*-*-vxworks
*] } {
613 return [check_no_messages_and_pattern tls_native
"!emutls" assembly {
615 int f
(void
) { return i
; }
616 void g
(int j
) { i
= j
; }
620 #
Return 1 if *emulated
* thread local storage
(TLS
) is supported
, 0 otherwise.
622 proc check_effective_target_tls_emulated
{} {
623 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
624 # functions
, so we fail to automatically detect it.
625 if { [istarget
*-*-vxworks
*] } {
629 return [check_no_messages_and_pattern tls_emulated
"emutls" assembly {
631 int f
(void
) { return i
; }
632 void g
(int j
) { i
= j
; }
636 #
Return 1 if TLS executables can run correctly
, 0 otherwise.
638 proc check_effective_target_tls_runtime
{} {
639 return [check_runtime tls_runtime
{
640 __thread
int thr
= 0;
641 int main
(void
) { return thr
; }
642 } [add_options_for_tls
""]]
645 #
Return 1 if atomic compare
-and
-swap is supported
on 'int'
647 proc check_effective_target_cas_char
{} {
648 return [check_no_compiler_messages cas_char assembly
{
649 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
655 proc check_effective_target_cas_int
{} {
656 return [check_no_compiler_messages cas_int assembly
{
657 #
if __INT_MAX__
== 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
659 #elif __INT_MAX__
== 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
667 #
Return 1 if -ffunction
-sections is supported
, 0 otherwise.
669 proc check_effective_target_function_sections
{} {
670 # Darwin has its own scheme and silently accepts
-ffunction
-sections.
671 if { [istarget
*-*-darwin
*] } {
675 return [check_no_compiler_messages functionsections assembly
{
677 } "-ffunction-sections"]
680 #
Return 1 if instruction scheduling is available
, 0 otherwise.
682 proc check_effective_target_scheduling
{} {
683 return [check_no_compiler_messages scheduling object
{
685 } "-fschedule-insns"]
688 #
Return 1 if compilation with
-fgraphite is error
-free
for trivial
691 proc check_effective_target_fgraphite
{} {
692 return [check_no_compiler_messages fgraphite object
{
697 #
Return 1 if compilation with
-fopenmp is error
-free
for trivial
700 proc check_effective_target_fopenmp
{} {
701 return [check_no_compiler_messages fopenmp object
{
706 #
Return 1 if compilation with
-fgnu
-tm is error
-free
for trivial
709 proc check_effective_target_fgnu_tm
{} {
710 return [check_no_compiler_messages fgnu_tm object
{
715 #
Return 1 if the target supports mmap
, 0 otherwise.
717 proc check_effective_target_mmap
{} {
718 return [check_function_available
"mmap"]
721 #
Return 1 if the target supports dlopen
, 0 otherwise.
722 proc check_effective_target_dlopen
{} {
723 return [check_function_available
"dlopen"]
726 #
Return 1 if the target supports clone
, 0 otherwise.
727 proc check_effective_target_clone
{} {
728 return [check_function_available
"clone"]
731 #
Return 1 if the target supports setrlimit
, 0 otherwise.
732 proc check_effective_target_setrlimit
{} {
733 # Darwin has non
-posix compliant RLIMIT_AS
734 if { [istarget
*-*-darwin
*] } {
737 return [check_function_available
"setrlimit"]
740 #
Return 1 if the target supports swapcontext
, 0 otherwise.
741 proc check_effective_target_swapcontext
{} {
742 return [check_no_compiler_messages swapcontext executable
{
743 #
include <ucontext.h
>
746 ucontext_t orig_context
,child_context
;
747 if (swapcontext
(&child_context
, &orig_context
) < 0) { }
752 #
Return 1 if compilation with
-pthread is error
-free
for trivial
755 proc check_effective_target_pthread
{} {
756 return [check_no_compiler_messages pthread object
{
761 #
Return 1 if compilation with
-mpe
-aligned
-commons is error
-free
762 #
for trivial code
, 0 otherwise.
764 proc check_effective_target_pe_aligned_commons
{} {
765 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
766 return [check_no_compiler_messages pe_aligned_commons object
{
768 } "-mpe-aligned-commons"]
773 #
Return 1 if the target supports
-static
774 proc check_effective_target_static
{} {
775 return [check_no_compiler_messages static executable
{
776 int main
(void
) { return 0; }
780 #
Return 1 if the target supports
-fstack
-protector
781 proc check_effective_target_fstack_protector
{} {
782 return [check_runtime fstack_protector
{
783 int main
(void
) { return 0; }
784 } "-fstack-protector"]
787 #
Return 1 if compilation with
-freorder
-blocks
-and
-partition is error
-free
788 #
for trivial code
, 0 otherwise.
790 proc check_effective_target_freorder
{} {
791 return [check_no_compiler_messages freorder object
{
793 } "-freorder-blocks-and-partition"]
796 #
Return 1 if -fpic and
-fPIC are supported
, as in no warnings or errors
797 # emitted
, 0 otherwise. Whether a shared library can actually be built is
798 # out of scope
for this test.
800 proc check_effective_target_fpic
{ } {
801 # Note that M68K has a multilib that supports
-fpic but not
802 #
-fPIC
, so we need to check both. We test with a
program that
803 # requires GOT references.
804 foreach
arg {fpic fPIC
} {
805 if [check_no_compiler_messages $
arg object
{
806 extern
int foo
(void
); extern
int bar
;
807 int baz
(void
) { return foo
() + bar
; }
815 #
Return 1 if -pie
, -fpie and
-fPIE are supported
, 0 otherwise.
817 proc check_effective_target_pie
{ } {
818 if { [istarget
*-*-darwin\
[912\
]*]
819 ||
[istarget
*-*-linux
*] } {
825 #
Return true
if the target supports
-mpaired
-single
(as used
on MIPS
).
827 proc check_effective_target_mpaired_single
{ } {
828 return [check_no_compiler_messages mpaired_single object
{
833 #
Return true
if the target has access to FPU instructions.
835 proc check_effective_target_hard_float
{ } {
836 if { [istarget mips
*-*-*] } {
837 return [check_no_compiler_messages hard_float assembly
{
838 #
if (defined __mips_soft_float || defined __mips16
)
844 # This proc is actually checking the availabilty of FPU
845 # support
for doubles
, so
on the RX we must fail
if the
846 #
64-bit double multilib has been selected.
847 if { [istarget rx
-*-*] } {
849 #
return [check_no_compiler_messages hard_float assembly
{
850 #
if defined __RX_64_BIT_DOUBLES__
856 # The generic test equates hard_float with
"no call for adding doubles".
857 return [check_no_messages_and_pattern hard_float
"!\\(call" rtl-expand {
858 double a
(double b
, double c
) { return b
+ c
; }
862 #
Return true
if the target is a
64-bit MIPS target.
864 proc check_effective_target_mips64
{ } {
865 return [check_no_compiler_messages mips64 assembly
{
872 #
Return true
if the target is a MIPS target that does not produce
875 proc check_effective_target_nomips16
{ } {
876 return [check_no_compiler_messages nomips16 object
{
880 /* A cheap way of testing
for -mflip
-mips16.
*/
881 void foo
(void
) { asm
("addiu $20,$20,1"); }
882 void bar
(void
) { asm
("addiu $20,$20,1"); }
887 # Add the options needed
for MIPS16 function attributes. At the moment
,
888 # we don
't support MIPS16 PIC.
890 proc add_options_for_mips16_attribute { flags } {
891 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
894 # Return true if we can force a mode that allows MIPS16 code generation.
895 # We don't support MIPS16 PIC
, and only support MIPS16
-mhard
-float
898 proc check_effective_target_mips16_attribute
{ } {
899 return [check_no_compiler_messages mips16_attribute assembly
{
903 #
if defined __mips_hard_float \
904 && (!defined _ABIO32 || _MIPS_SIM
!= _ABIO32
) \
905 && (!defined _ABIO64 || _MIPS_SIM
!= _ABIO64
)
908 } [add_options_for_mips16_attribute
""]]
911 #
Return 1 if the target supports long double larger than double when
912 # using the new ABI
, 0 otherwise.
914 proc check_effective_target_mips_newabi_large_long_double
{ } {
915 return [check_no_compiler_messages mips_newabi_large_long_double object
{
916 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
920 #
Return true
if the target is a MIPS target that has access
921 # to the LL and SC instructions.
923 proc check_effective_target_mips_llsc
{ } {
924 if { ![istarget mips
*-*-*] } {
927 # Assume that these instructions are always implemented
for
928 # non
-elf
* targets
, via emulation
if necessary.
929 if { ![istarget
*-*-elf
*] } {
932 # Otherwise assume LL
/SC support
for everything but MIPS I.
933 return [check_no_compiler_messages mips_llsc assembly
{
940 #
Return true
if the target is a MIPS target that uses in
-place relocations.
942 proc check_effective_target_mips_rel
{ } {
943 if { ![istarget mips
*-*-*] } {
946 return [check_no_compiler_messages mips_rel object
{
947 #
if (defined _ABIN32
&& _MIPS_SIM
== _ABIN32
) \
948 ||
(defined _ABI64
&& _MIPS_SIM
== _ABI64
)
954 #
Return true
if the target is a MIPS target that uses the EABI.
956 proc check_effective_target_mips_eabi
{ } {
957 if { ![istarget mips
*-*-*] } {
960 return [check_no_compiler_messages mips_eabi object
{
967 #
Return 1 if the current multilib does not generate PIC by default.
969 proc check_effective_target_nonpic
{ } {
970 return [check_no_compiler_messages nonpic assembly
{
977 #
Return 1 if the target does not use a
status wrapper.
979 proc check_effective_target_unwrapped
{ } {
980 if { [target_info needs_status_wrapper
] != "" \
981 && [target_info needs_status_wrapper
] != "0" } {
987 #
Return true
if iconv is supported
on the target. In particular IBM1047.
989 proc check_iconv_available
{ test_what
} {
992 #
If the tool configuration file has not
set libiconv
, try
"-liconv"
993 if { ![info exists libiconv
] } {
994 set libiconv
"-liconv"
996 set test_what
[lindex $test_what
1]
997 return [check_runtime_nocache $test_what
[subst
{
1003 cd
= iconv_open
("$test_what", "UTF-8");
1004 if (cd
== (iconv_t
) -1)
1011 #
Return 1 if an ASCII locale is supported
on this host
, 0 otherwise.
1013 proc check_ascii_locale_available
{ } {
1017 #
Return true
if named sections are supported
on this target.
1019 proc check_named_sections_available
{ } {
1020 return [check_no_compiler_messages named_sections assembly
{
1021 int __attribute__
((section
("whatever"))) foo;
1025 #
Return true
if the
"naked" function attribute is supported on this target.
1027 proc check_effective_target_naked_functions
{ } {
1028 return [check_no_compiler_messages naked_functions assembly
{
1029 void f
() __attribute__
((naked
));
1033 #
Return 1 if the target supports Fortran real kinds larger than real
(8),
1036 # When the target
name changes
, replace the cached result.
1038 proc check_effective_target_fortran_large_real
{ } {
1039 return [check_no_compiler_messages fortran_large_real executable
{
1041 integer,parameter
:: k
= selected_real_kind
(precision
(0.0_8
) + 1)
1048 #
Return 1 if the target supports Fortran real kind real
(16),
1049 #
0 otherwise. Contrary to check_effective_target_fortran_large_real
1050 # this checks
for Real
(16) only
; the other returned real
(10) if
1051 # both real
(10) and real
(16) are available.
1053 # When the target
name changes
, replace the cached result.
1055 proc check_effective_target_fortran_real_16
{ } {
1056 return [check_no_compiler_messages fortran_real_16 executable
{
1065 #
Return 1 if the target supports
SQRT for the
largest floating
-point
1066 # type.
(Some targets lack the libm support
for this FP type.
)
1067 #
On most targets
, this check effectively checks either whether sqrtl is
1068 # available or
on __float128 systems whether libquadmath is installed
,
1069 # which provides sqrtq.
1071 # When the target
name changes
, replace the cached result.
1073 proc check_effective_target_fortran_largest_fp_has_sqrt
{ } {
1074 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable
{
1076 use iso_fortran_env
, only
: real_kinds
1077 integer,parameter
:: maxFP
= real_kinds
(ubound
(real_kinds
,dim
=1))
1078 real
(kind
=maxFP
), volatile
:: x
1086 #
Return 1 if the target supports Fortran
integer kinds larger than
1087 #
integer(8), 0 otherwise.
1089 # When the target
name changes
, replace the cached result.
1091 proc check_effective_target_fortran_large_int
{ } {
1092 return [check_no_compiler_messages fortran_large_int executable
{
1094 integer,parameter
:: k
= selected_int_kind
(range
(0_8
) + 1)
1095 integer(kind
=k
) :: i
1100 #
Return 1 if the target supports Fortran
integer(16), 0 otherwise.
1102 # When the target
name changes
, replace the cached result.
1104 proc check_effective_target_fortran_integer_16
{ } {
1105 return [check_no_compiler_messages fortran_integer_16 executable
{
1112 #
Return 1 if we can statically link libgfortran
, 0 otherwise.
1114 # When the target
name changes
, replace the cached result.
1116 proc check_effective_target_static_libgfortran
{ } {
1117 return [check_no_compiler_messages static_libgfortran executable
{
1124 proc check_linker_plugin_available
{ } {
1125 return [check_no_compiler_messages_nocache linker_plugin executable
{
1126 int main
() { return 0; }
1127 } "-flto -fuse-linker-plugin"]
1130 #
Return 1 if the target supports executing
750CL paired
-single instructions
, 0
1131 # otherwise.
Cache the result.
1133 proc check_750cl_hw_available
{ } {
1134 return [check_cached_effective_target
750cl_hw_available
{
1135 #
If this is not the right target
then we can skip the test.
1136 if { ![istarget powerpc
-*paired
*] } {
1139 check_runtime_nocache
750cl_hw_available
{
1143 asm volatile
("ps_mul v0,v0,v0");
1145 asm volatile
("ps_mul 0,0,0");
1154 #
Return 1 if the target OS supports running SSE executables
, 0
1155 # otherwise.
Cache the result.
1157 proc check_sse_os_support_available
{ } {
1158 return [check_cached_effective_target sse_os_support_available
{
1159 #
If this is not the right target
then we can skip the test.
1160 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1162 } elseif
{ [istarget i?
86-*-solaris2
*] } {
1163 # The Solaris
2 kernel doesn
't save and restore SSE registers
1164 # before Solaris 9 4/04. Before that, executables die with SIGILL.
1165 check_runtime_nocache sse_os_support_available {
1168 asm volatile ("movaps %xmm0,%xmm0");
1178 # Return 1 if the target OS supports running AVX executables, 0
1179 # otherwise. Cache the result.
1181 proc check_avx_os_support_available { } {
1182 return [check_cached_effective_target avx_os_support_available {
1183 # If this is not the right target then we can skip the test.
1184 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1187 # Check that OS has AVX and SSE saving enabled.
1188 check_runtime_nocache avx_os_support_available {
1191 unsigned int eax, edx;
1193 asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1194 return (eax & 6) != 6;
1201 # Return 1 if the target supports executing SSE instructions, 0
1202 # otherwise. Cache the result.
1204 proc check_sse_hw_available { } {
1205 return [check_cached_effective_target sse_hw_available {
1206 # If this is not the right target then we can skip the test.
1207 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1210 check_runtime_nocache sse_hw_available {
1214 unsigned int eax, ebx, ecx, edx;
1215 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1216 return !(edx & bit_SSE);
1224 # Return 1 if the target supports executing SSE2 instructions, 0
1225 # otherwise. Cache the result.
1227 proc check_sse2_hw_available { } {
1228 return [check_cached_effective_target sse2_hw_available {
1229 # If this is not the right target then we can skip the test.
1230 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1233 check_runtime_nocache sse2_hw_available {
1237 unsigned int eax, ebx, ecx, edx;
1238 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1239 return !(edx & bit_SSE2);
1247 # Return 1 if the target supports executing AVX instructions, 0
1248 # otherwise. Cache the result.
1250 proc check_avx_hw_available { } {
1251 return [check_cached_effective_target avx_hw_available {
1252 # If this is not the right target then we can skip the test.
1253 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1256 check_runtime_nocache avx_hw_available {
1260 unsigned int eax, ebx, ecx, edx;
1261 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1262 return ((ecx & (bit_AVX | bit_OSXSAVE))
1263 != (bit_AVX | bit_OSXSAVE));
1271 # Return 1 if the target supports running SSE executables, 0 otherwise.
1273 proc check_effective_target_sse_runtime { } {
1274 if { [check_effective_target_sse]
1275 && [check_sse_hw_available]
1276 && [check_sse_os_support_available] } {
1282 # Return 1 if the target supports running SSE2 executables, 0 otherwise.
1284 proc check_effective_target_sse2_runtime { } {
1285 if { [check_effective_target_sse2]
1286 && [check_sse2_hw_available]
1287 && [check_sse_os_support_available] } {
1293 # Return 1 if the target supports running AVX executables, 0 otherwise.
1295 proc check_effective_target_avx_runtime { } {
1296 if { [check_effective_target_avx]
1297 && [check_avx_hw_available]
1298 && [check_avx_os_support_available] } {
1304 # Return 1 if the target supports executing VSX instructions, 0
1305 # otherwise. Cache the result.
1307 proc check_vsx_hw_available { } {
1308 return [check_cached_effective_target vsx_hw_available {
1309 # Some simulators are known to not support VSX instructions.
1310 # For now, disable on Darwin
1311 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1315 check_runtime_nocache vsx_hw_available {
1319 asm volatile ("xxlor vs0,vs0,vs0");
1321 asm volatile ("xxlor 0,0,0");
1330 # Return 1 if the target supports executing AltiVec instructions, 0
1331 # otherwise. Cache the result.
1333 proc check_vmx_hw_available { } {
1334 return [check_cached_effective_target vmx_hw_available {
1335 # Some simulators are known to not support VMX instructions.
1336 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
1339 # Most targets don't require special flags
for this test case
, but
1340 # Darwin does. Just to be sure
, make sure VSX is not enabled
for
1341 # the altivec tests.
1342 if { [istarget
*-*-darwin
*]
1343 ||
[istarget
*-*-aix
*] } {
1344 set options
"-maltivec -mno-vsx"
1346 set options
"-mno-vsx"
1348 check_runtime_nocache vmx_hw_available
{
1352 asm volatile
("vor v0,v0,v0");
1354 asm volatile
("vor 0,0,0");
1363 proc check_ppc_recip_hw_available
{ } {
1364 return [check_cached_effective_target ppc_recip_hw_available
{
1365 # Some simulators may not support FRE
/FRES
/FRSQRTE
/FRSQRTES
1366 #
For now
, disable
on Darwin
1367 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1370 set options
"-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1371 check_runtime_nocache ppc_recip_hw_available
{
1372 volatile double d_recip
, d_rsqrt
, d_four
= 4.0;
1373 volatile float f_recip
, f_rsqrt
, f_four
= 4.0f
;
1376 asm volatile
("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1377 asm volatile
("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1378 asm volatile
("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1379 asm volatile
("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1387 #
Return 1 if the target supports executing AltiVec and Cell PPU
1388 # instructions
, 0 otherwise.
Cache the result.
1390 proc check_effective_target_cell_hw
{ } {
1391 return [check_cached_effective_target cell_hw_available
{
1392 # Some simulators are known to not support VMX and PPU instructions.
1393 if { [istarget powerpc
-*-eabi
*] } {
1396 # Most targets don
't require special flags for this test
1397 # case, but Darwin and AIX do.
1398 if { [istarget *-*-darwin*]
1399 || [istarget *-*-aix*] } {
1400 set options "-maltivec -mcpu=cell"
1402 set options "-mcpu=cell"
1404 check_runtime_nocache cell_hw_available {
1408 asm volatile ("vor v0,v0,v0");
1409 asm volatile ("lvlx v0,r0,r0");
1411 asm volatile ("vor 0,0,0");
1412 asm volatile ("lvlx 0,0,0");
1421 # Return 1 if the target supports executing 64-bit instructions, 0
1422 # otherwise. Cache the result.
1424 proc check_effective_target_powerpc64 { } {
1425 global powerpc64_available_saved
1428 if [info exists powerpc64_available_saved] {
1429 verbose "check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1431 set powerpc64_available_saved 0
1433 # Some simulators are known to not support powerpc64 instructions.
1434 if { [istarget powerpc-*-eabi*] || [istarget powerpc-ibm-aix*] } {
1435 verbose "check_effective_target_powerpc64 returning 0" 2
1436 return $powerpc64_available_saved
1439 # Set up, compile, and execute a test program containing a 64-bit
1440 # instruction. Include the current process ID in the file
1441 # names to prevent conflicts with invocations for multiple
1446 set f [open $src "w"]
1447 puts $f "int main() {"
1448 puts $f "#ifdef __MACH__"
1449 puts $f " asm volatile (\"extsw r0,r0\");"
1451 puts $f " asm volatile (\"extsw 0,0\");"
1453 puts $f " return 0; }"
1456 set opts "additional_flags=-mcpu=G5"
1458 verbose "check_effective_target_powerpc64 compiling testfile $src" 2
1459 set lines [${tool}_target_compile $src $exe executable "$opts"]
1462 if [string match "" $lines] then {
1463 # No error message, compilation succeeded.
1464 set result [${tool}_load "./$exe" "" ""]
1465 set status [lindex $result 0]
1466 remote_file build delete $exe
1467 verbose "check_effective_target_powerpc64 testfile status is <$status>" 2
1469 if { $status == "pass" } then {
1470 set powerpc64_available_saved 1
1473 verbose "check_effective_target_powerpc64 testfile compilation failed" 2
1477 return $powerpc64_available_saved
1480 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
1481 # complex float arguments. This affects gfortran tests that call cabsf
1482 # in libm built by an earlier compiler. Return 1 if libm uses the same
1483 # argument passing as the compiler under test, 0 otherwise.
1485 # When the target name changes, replace the cached result.
1487 proc check_effective_target_broken_cplxf_arg { } {
1488 return [check_cached_effective_target broken_cplxf_arg {
1489 # Skip the work for targets known not to be affected.
1490 if { ![istarget powerpc64-*-linux*] } {
1492 } elseif { ![is-effective-target lp64] } {
1495 check_runtime_nocache broken_cplxf_arg {
1496 #include <complex.h>
1497 extern void abort (void);
1498 float fabsf (float);
1499 float cabsf (_Complex float);
1506 if (fabsf (f - 5.0) > 0.0001)
1515 # Return 1 is this is a TI C6X target supporting C67X instructions
1516 proc check_effective_target_ti_c67x { } {
1517 return [check_no_compiler_messages ti_c67x assembly {
1518 #if !defined(_TMS320C6700)
1524 # Return 1 is this is a TI C6X target supporting C64X+ instructions
1525 proc check_effective_target_ti_c64xp { } {
1526 return [check_no_compiler_messages ti_c64xp assembly {
1527 #if !defined(_TMS320C6400_PLUS)
1534 proc check_alpha_max_hw_available { } {
1535 return [check_runtime alpha_max_hw_available {
1536 int main() { return __builtin_alpha_amask(1<<8) != 0; }
1540 # Returns true iff the FUNCTION is available on the target system.
1541 # (This is essentially a Tcl implementation of Autoconf's
1544 proc check_function_available
{ function
} {
1545 return [check_no_compiler_messages $
{function
}_available \
1551 int main
() { $function
(); }
1555 # Returns true iff
"fork" is available on the target system.
1557 proc check_fork_available
{} {
1558 return [check_function_available
"fork"]
1561 # Returns true iff
"mkfifo" is available on the target system.
1563 proc check_mkfifo_available
{} {
1564 if { [istarget
*-*-cygwin
*] } {
1565 # Cygwin has mkfifo
, but support is incomplete.
1569 return [check_function_available
"mkfifo"]
1572 # Returns true iff
"__cxa_atexit" is used on the target system.
1574 proc check_cxa_atexit_available
{ } {
1575 return [check_cached_effective_target cxa_atexit_available
{
1576 if { [istarget hppa
*-*-hpux10
*] } {
1577 # HP
-UX
10 doesn
't have __cxa_atexit but subsequent test passes.
1579 } elseif { [istarget *-*-vxworks] } {
1580 # vxworks doesn't have __cxa_atexit but subsequent test passes.
1583 check_runtime_nocache cxa_atexit_available
{
1586 static unsigned
int count;
1603 Y
() { f
(); count = 2; }
1612 int main
() { return 0; }
1618 proc check_effective_target_objc2
{ } {
1619 return [check_no_compiler_messages objc2 object
{
1628 proc check_effective_target_next_runtime
{ } {
1629 return [check_no_compiler_messages objc2 object
{
1630 #ifdef __NEXT_RUNTIME__
1638 #
Return 1 if we
're generating 32-bit code using default options, 0
1641 proc check_effective_target_ilp32 { } {
1642 return [check_no_compiler_messages ilp32 object {
1643 int dummy[sizeof (int) == 4
1644 && sizeof (void *) == 4
1645 && sizeof (long) == 4 ? 1 : -1];
1649 # Return 1 if we're generating ia32 code using default options
, 0
1652 proc check_effective_target_ia32
{ } {
1653 return [check_no_compiler_messages ia32 object
{
1654 int dummy
[sizeof
(int) == 4
1655 && sizeof
(void
*) == 4
1656 && sizeof
(long
) == 4 ?
1 : -1] = { __i386__
};
1660 #
Return 1 if we
're generating x32 code using default options, 0
1663 proc check_effective_target_x32 { } {
1664 return [check_no_compiler_messages x32 object {
1665 int dummy[sizeof (int) == 4
1666 && sizeof (void *) == 4
1667 && sizeof (long) == 4 ? 1 : -1] = { __x86_64__ };
1671 # Return 1 if we're generating
32-bit or larger integers using default
1672 # options
, 0 otherwise.
1674 proc check_effective_target_int32plus
{ } {
1675 return [check_no_compiler_messages int32plus object
{
1676 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1680 #
Return 1 if we
're generating 32-bit or larger pointers using default
1681 # options, 0 otherwise.
1683 proc check_effective_target_ptr32plus { } {
1684 return [check_no_compiler_messages ptr32plus object {
1685 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1689 # Return 1 if we support 32-bit or larger array and structure sizes
1690 # using default options, 0 otherwise.
1692 proc check_effective_target_size32plus { } {
1693 return [check_no_compiler_messages size32plus object {
1698 # Returns 1 if we're generating
16-bit or smaller integers with the
1699 # default options
, 0 otherwise.
1701 proc check_effective_target_int16
{ } {
1702 return [check_no_compiler_messages int16 object
{
1703 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1707 #
Return 1 if we
're generating 64-bit code using default options, 0
1710 proc check_effective_target_lp64 { } {
1711 return [check_no_compiler_messages lp64 object {
1712 int dummy[sizeof (int) == 4
1713 && sizeof (void *) == 8
1714 && sizeof (long) == 8 ? 1 : -1];
1718 # Return 1 if we're generating
64-bit code using default llp64 options
,
1721 proc check_effective_target_llp64
{ } {
1722 return [check_no_compiler_messages llp64 object
{
1723 int dummy
[sizeof
(int) == 4
1724 && sizeof
(void
*) == 8
1725 && sizeof
(long long
) == 8
1726 && sizeof
(long
) == 4 ?
1 : -1];
1730 #
Return 1 if long and
int have different sizes
,
1733 proc check_effective_target_long_neq_int
{ } {
1734 return [check_no_compiler_messages long_ne_int object
{
1735 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1739 #
Return 1 if the target supports long double larger than double
,
1742 proc check_effective_target_large_long_double
{ } {
1743 return [check_no_compiler_messages large_long_double object
{
1744 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1748 #
Return 1 if the target supports double larger than float
,
1751 proc check_effective_target_large_double
{ } {
1752 return [check_no_compiler_messages large_double object
{
1753 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
1757 #
Return 1 if the target supports double of
64 bits
,
1760 proc check_effective_target_double64
{ } {
1761 return [check_no_compiler_messages double64 object
{
1762 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
1766 #
Return 1 if the target supports double of at least
64 bits
,
1769 proc check_effective_target_double64plus
{ } {
1770 return [check_no_compiler_messages double64plus object
{
1771 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
1775 #
Return 1 if the target supports
'w' suffix
on floating constant
1778 proc check_effective_target_has_w_floating_suffix
{ } {
1780 if [check_effective_target_c
++] {
1781 append opts
"-std=gnu++03"
1783 return [check_no_compiler_messages w_fp_suffix object
{
1788 #
Return 1 if the target supports
'q' suffix
on floating constant
1791 proc check_effective_target_has_q_floating_suffix
{ } {
1793 if [check_effective_target_c
++] {
1794 append opts
"-std=gnu++03"
1796 return [check_no_compiler_messages q_fp_suffix object
{
1800 #
Return 1 if the target supports compiling fixed
-point
,
1803 proc check_effective_target_fixed_point
{ } {
1804 return [check_no_compiler_messages fixed_point object
{
1805 _Sat _Fract x
; _Sat _Accum y
;
1809 #
Return 1 if the target supports compiling decimal floating point
,
1812 proc check_effective_target_dfp_nocache
{ } {
1813 verbose
"check_effective_target_dfp_nocache: compiling source" 2
1814 set ret
[check_no_compiler_messages_nocache dfp object
{
1815 float x __attribute__
((mode(DD
)));
1817 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
1821 proc check_effective_target_dfprt_nocache
{ } {
1822 return [check_runtime_nocache dfprt
{
1823 typedef float d64 __attribute__
((mode(DD
)));
1824 d64 x
= 1.2df
, y
= 2.3dd
, z
;
1825 int main
() { z
= x
+ y
; return 0; }
1829 #
Return 1 if the target supports compiling Decimal Floating Point
,
1832 # This won
't change for different subtargets so cache the result.
1834 proc check_effective_target_dfp { } {
1835 return [check_cached_effective_target dfp {
1836 check_effective_target_dfp_nocache
1840 # Return 1 if the target supports linking and executing Decimal Floating
1841 # Point, 0 otherwise.
1843 # This won't change
for different subtargets so
cache the result.
1845 proc check_effective_target_dfprt
{ } {
1846 return [check_cached_effective_target dfprt
{
1847 check_effective_target_dfprt_nocache
1851 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1853 proc check_effective_target_ucn_nocache
{ } {
1854 #
-std
=c99 is only valid
for C
1855 if [check_effective_target_c
] {
1856 set ucnopts
"-std=c99"
1858 append ucnopts
" -fextended-identifiers"
1859 verbose
"check_effective_target_ucn_nocache: compiling source" 2
1860 set ret
[check_no_compiler_messages_nocache ucn object
{
1863 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
1867 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1869 # This won
't change for different subtargets, so cache the result.
1871 proc check_effective_target_ucn { } {
1872 return [check_cached_effective_target ucn {
1873 check_effective_target_ucn_nocache
1877 # Return 1 if the target needs a command line argument to enable a SIMD
1880 proc check_effective_target_vect_cmdline_needed { } {
1881 global et_vect_cmdline_needed_saved
1882 global et_vect_cmdline_needed_target_name
1884 if { ![info exists et_vect_cmdline_needed_target_name] } {
1885 set et_vect_cmdline_needed_target_name ""
1888 # If the target has changed since we set the cached value, clear it.
1889 set current_target [current_target_name]
1890 if { $current_target != $et_vect_cmdline_needed_target_name } {
1891 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
1892 set et_vect_cmdline_needed_target_name $current_target
1893 if { [info exists et_vect_cmdline_needed_saved] } {
1894 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
1895 unset et_vect_cmdline_needed_saved
1899 if [info exists et_vect_cmdline_needed_saved] {
1900 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
1902 set et_vect_cmdline_needed_saved 1
1903 if { [istarget alpha*-*-*]
1904 || [istarget ia64-*-*]
1905 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
1906 && ([check_effective_target_x32]
1907 || [check_effective_target_lp64]))
1908 || ([istarget powerpc*-*-*]
1909 && ([check_effective_target_powerpc_spe]
1910 || [check_effective_target_powerpc_altivec]))
1911 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
1912 || [istarget spu-*-*]
1913 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
1914 set et_vect_cmdline_needed_saved 0
1918 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1919 return $et_vect_cmdline_needed_saved
1922 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
1924 # This won't change
for different subtargets so
cache the result.
1926 proc check_effective_target_vect_int
{ } {
1927 global et_vect_int_saved
1929 if [info exists et_vect_int_saved
] {
1930 verbose
"check_effective_target_vect_int: using cached result" 2
1932 set et_vect_int_saved
0
1933 if { [istarget i?
86-*-*]
1934 ||
([istarget powerpc
*-*-*]
1935 && ![istarget powerpc
-*-linux
*paired
*])
1936 ||
[istarget spu
-*-*]
1937 ||
[istarget x86_64
-*-*]
1938 ||
[istarget sparc
*-*-*]
1939 ||
[istarget alpha
*-*-*]
1940 ||
[istarget ia64
-*-*]
1941 ||
[istarget aarch64
*-*-*]
1942 ||
[check_effective_target_arm32
]
1943 ||
([istarget mips
*-*-*]
1944 && [check_effective_target_mips_loongson
]) } {
1945 set et_vect_int_saved
1
1949 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
1950 return $et_vect_int_saved
1953 #
Return 1 if the target supports signed
int->float conversion
1956 proc check_effective_target_vect_intfloat_cvt
{ } {
1957 global et_vect_intfloat_cvt_saved
1959 if [info exists et_vect_intfloat_cvt_saved
] {
1960 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
1962 set et_vect_intfloat_cvt_saved
0
1963 if { [istarget i?
86-*-*]
1964 ||
([istarget powerpc
*-*-*]
1965 && ![istarget powerpc
-*-linux
*paired
*])
1966 ||
[istarget x86_64
-*-*]
1967 ||
([istarget arm
*-*-*]
1968 && [check_effective_target_arm_neon_ok
])} {
1969 set et_vect_intfloat_cvt_saved
1
1973 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
1974 return $et_vect_intfloat_cvt_saved
1977 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
1979 proc check_effective_target_int128 { } {
1980 return [check_no_compiler_messages int128 object {
1982 #ifndef __SIZEOF_INT128__
1991 # Return 1 if the target supports unsigned int->float conversion
1994 proc check_effective_target_vect_uintfloat_cvt { } {
1995 global et_vect_uintfloat_cvt_saved
1997 if [info exists et_vect_uintfloat_cvt_saved] {
1998 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2000 set et_vect_uintfloat_cvt_saved 0
2001 if { [istarget i?86-*-*]
2002 || ([istarget powerpc*-*-*]
2003 && ![istarget powerpc-*-linux*paired*])
2004 || [istarget x86_64-*-*]
2005 || ([istarget arm*-*-*]
2006 && [check_effective_target_arm_neon_ok])} {
2007 set et_vect_uintfloat_cvt_saved 1
2011 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2012 return $et_vect_uintfloat_cvt_saved
2016 # Return 1 if the target supports signed float->int conversion
2019 proc check_effective_target_vect_floatint_cvt { } {
2020 global et_vect_floatint_cvt_saved
2022 if [info exists et_vect_floatint_cvt_saved] {
2023 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2025 set et_vect_floatint_cvt_saved 0
2026 if { [istarget i?86-*-*]
2027 || ([istarget powerpc*-*-*]
2028 && ![istarget powerpc-*-linux*paired*])
2029 || [istarget x86_64-*-*]
2030 || ([istarget arm*-*-*]
2031 && [check_effective_target_arm_neon_ok])} {
2032 set et_vect_floatint_cvt_saved 1
2036 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2037 return $et_vect_floatint_cvt_saved
2040 # Return 1 if the target supports unsigned float->int conversion
2043 proc check_effective_target_vect_floatuint_cvt { } {
2044 global et_vect_floatuint_cvt_saved
2046 if [info exists et_vect_floatuint_cvt_saved] {
2047 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2049 set et_vect_floatuint_cvt_saved 0
2050 if { ([istarget powerpc*-*-*]
2051 && ![istarget powerpc-*-linux*paired*])
2052 || ([istarget arm*-*-*]
2053 && [check_effective_target_arm_neon_ok])} {
2054 set et_vect_floatuint_cvt_saved 1
2058 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2059 return $et_vect_floatuint_cvt_saved
2062 # Return 1 if this is a AArch64 target supporting big endian
2063 proc check_effective_target_aarch64_big_endian { } {
2064 return [check_no_compiler_messages aarch64_big_endian assembly {
2065 #if !defined(__aarch64__) || !defined(__AARCH64EB__)
2071 # Return 1 is this is an arm target using 32-bit instructions
2072 proc check_effective_target_arm32 { } {
2073 return [check_no_compiler_messages arm32 assembly {
2074 #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
2080 # Return 1 is this is an arm target not using Thumb
2081 proc check_effective_target_arm_nothumb { } {
2082 return [check_no_compiler_messages arm_nothumb assembly {
2083 #if (defined(__thumb__) || defined(__thumb2__))
2089 # Return 1 if this is a little-endian ARM target
2090 proc check_effective_target_arm_little_endian { } {
2091 return [check_no_compiler_messages arm_little_endian assembly {
2092 #if !defined(__arm__) || !defined(__ARMEL__)
2098 # Return 1 if this is an ARM target that only supports aligned vector accesses
2099 proc check_effective_target_arm_vect_no_misalign { } {
2100 return [check_no_compiler_messages arm_vect_no_misalign assembly {
2101 #if !defined(__arm__) \
2102 || (defined(__ARMEL__) \
2103 && (!defined(__thumb__) || defined(__thumb2__)))
2110 # Return 1 if this is an ARM target supporting -mfpu=vfp
2111 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
2114 proc check_effective_target_arm_vfp_ok { } {
2115 if { [check_effective_target_arm32] } {
2116 return [check_no_compiler_messages arm_vfp_ok object {
2118 } "-mfpu=vfp -mfloat-abi=softfp"]
2124 # Return 1 if this is an ARM target supporting -mfpu=fp-armv8
2125 # -mfloat-abi=softfp.
2126 proc check_effective_target_arm_v8_vfp_ok {} {
2127 if { [check_effective_target_arm32] } {
2128 return [check_no_compiler_messages arm_v8_vfp_ok object {
2131 __asm__ volatile ("vrinta.f32.f32 s0, s0");
2134 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2140 # Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8
2141 # -mfloat-abi=softfp
2142 proc check_effective_target_arm_v8_neon_ok {} {
2143 if { [check_effective_target_arm32] } {
2144 return [check_no_compiler_messages arm_v8_neon_ok object {
2147 __asm__ volatile ("vrintn.f32 q0, q0");
2150 } "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"]
2156 # Return 1 if this is an ARM target supporting -mfpu=vfp
2157 # -mfloat-abi=hard. Some multilibs may be incompatible with these
2160 proc check_effective_target_arm_hard_vfp_ok { } {
2161 if { [check_effective_target_arm32]
2162 && ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2163 return [check_no_compiler_messages arm_hard_vfp_ok executable {
2164 int main() { return 0;}
2165 } "-mfpu=vfp -mfloat-abi=hard"]
2171 # Return 1 if this is an ARM target that supports DSP multiply with
2172 # current multilib flags.
2174 proc check_effective_target_arm_dsp { } {
2175 return [check_no_compiler_messages arm_dsp assembly {
2176 #ifndef __ARM_FEATURE_DSP
2183 # Return 1 if this is an ARM target that supports unaligned word/halfword
2184 # load/store instructions.
2186 proc check_effective_target_arm_unaligned { } {
2187 return [check_no_compiler_messages arm_unaligned assembly {
2188 #ifndef __ARM_FEATURE_UNALIGNED
2189 #error no unaligned support
2195 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2196 # or -mfloat-abi=hard, but if one is already specified by the
2197 # multilib, use it. Similarly, if a -mfpu option already enables
2198 # NEON, do not add -mfpu=neon.
2200 proc add_options_for_arm_neon { flags } {
2201 if { ! [check_effective_target_arm_neon_ok] } {
2204 global et_arm_neon_flags
2205 return "$flags $et_arm_neon_flags"
2208 proc add_options_for_arm_v8_vfp { flags } {
2209 if { ! [check_effective_target_arm_v8_vfp_ok] } {
2212 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2215 proc add_options_for_arm_v8_neon { flags } {
2216 if { ! [check_effective_target_arm_v8_neon_ok] } {
2219 return "$flags -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=softfp"
2222 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2223 # or -mfloat-abi=hard, but if one is already specified by the
2224 # multilib, use it. Similarly, if a -mfpu option already enables
2225 # NEON, do not add -mfpu=neon.
2227 proc add_options_for_arm_neonv2 { flags } {
2228 if { ! [check_effective_target_arm_neonv2_ok] } {
2231 global et_arm_neonv2_flags
2232 return "$flags $et_arm_neonv2_flags"
2235 # Return 1 if this is an ARM target supporting -mfpu=neon
2236 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2237 # incompatible with these options. Also set et_arm_neon_flags to the
2238 # best options to add.
2240 proc check_effective_target_arm_neon_ok_nocache { } {
2241 global et_arm_neon_flags
2242 set et_arm_neon_flags ""
2243 if { [check_effective_target_arm32] } {
2244 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2245 if { [check_no_compiler_messages_nocache arm_neon_ok object {
2246 #include "arm_neon.h"
2249 set et_arm_neon_flags $flags
2258 proc check_effective_target_arm_neon_ok { } {
2259 return [check_cached_effective_target arm_neon_ok \
2260 check_effective_target_arm_neon_ok_nocache]
2263 # Return 1 if this is an ARM target supporting -mfpu=neon-vfpv4
2264 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2265 # incompatible with these options. Also set et_arm_neonv2_flags to the
2266 # best options to add.
2268 proc check_effective_target_arm_neonv2_ok_nocache { } {
2269 global et_arm_neonv2_flags
2270 set et_arm_neonv2_flags ""
2271 if { [check_effective_target_arm32] } {
2272 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2273 if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
2274 #include "arm_neon.h"
2276 foo (float32x2_t a, float32x2_t b, float32x2_t c)
2278 return vfma_f32 (a, b, c);
2281 set et_arm_neonv2_flags $flags
2290 proc check_effective_target_arm_neonv2_ok { } {
2291 return [check_cached_effective_target arm_neonv2_ok \
2292 check_effective_target_arm_neonv2_ok_nocache]
2295 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2296 # or -mfloat-abi=hard, but if one is already specified by the
2299 proc add_options_for_arm_fp16 { flags } {
2300 if { ! [check_effective_target_arm_fp16_ok] } {
2303 global et_arm_fp16_flags
2304 return "$flags $et_arm_fp16_flags"
2307 # Return 1 if this is an ARM target that can support a VFP fp16 variant.
2308 # Skip multilibs that are incompatible with these options and set
2309 # et_arm_fp16_flags to the best options to add.
2311 proc check_effective_target_arm_fp16_ok_nocache { } {
2312 global et_arm_fp16_flags
2313 set et_arm_fp16_flags ""
2314 if { ! [check_effective_target_arm32] } {
2317 if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2318 # Multilib flags would override -mfpu.
2321 if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2322 # Must generate floating-point instructions.
2325 if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
2326 # The existing -mfpu value is OK; use it, but add softfp.
2327 set et_arm_fp16_flags "-mfloat-abi=softfp"
2330 # Add -mfpu for a VFP fp16 variant since there is no preprocessor
2331 # macro to check for this support.
2332 set flags "-mfpu=vfpv4 -mfloat-abi=softfp"
2333 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly {
2336 set et_arm_fp16_flags "$flags"
2343 proc check_effective_target_arm_fp16_ok { } {
2344 return [check_cached_effective_target arm_fp16_ok \
2345 check_effective_target_arm_fp16_ok_nocache]
2348 # Creates a series of routines that return 1 if the given architecture
2349 # can be selected and a routine to give the flags to select that architecture
2350 # Note: Extra flags may be added to disable options from newer compilers
2351 # (Thumb in particular - but others may be added in the future)
2352 # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
2353 # /* { dg-add-options arm_arch_v5 } */
2354 # /* { dg-require-effective-target arm_arch_v5_multilib } */
2355 foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
2356 v4t "-march=armv4t" __ARM_ARCH_4T__
2357 v5 "-march=armv5 -marm" __ARM_ARCH_5__
2358 v5t "-march=armv5t" __ARM_ARCH_5T__
2359 v5te "-march=armv5te" __ARM_ARCH_5TE__
2360 v6 "-march=armv6" __ARM_ARCH_6__
2361 v6k "-march=armv6k" __ARM_ARCH_6K__
2362 v6t2 "-march=armv6t2" __ARM_ARCH_6T2__
2363 v6z "-march=armv6z" __ARM_ARCH_6Z__
2364 v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
2365 v7a "-march=armv7-a" __ARM_ARCH_7A__
2366 v7r "-march=armv7-r" __ARM_ARCH_7R__
2367 v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
2368 v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2369 v8a "-march=armv8-a" __ARM_ARCH_8A__ } {
2370 eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
2371 proc check_effective_target_arm_arch_FUNC_ok { } {
2372 if { [ string match "*-marm*" "FLAG" ] &&
2373 ![check_effective_target_arm_arm_ok] } {
2376 return [check_no_compiler_messages arm_arch_FUNC_ok assembly {
2383 proc add_options_for_arm_arch_FUNC { flags } {
2384 return "$flags FLAG"
2387 proc check_effective_target_arm_arch_FUNC_multilib { } {
2388 return [check_runtime arm_arch_FUNC_multilib {
2394 } [add_options_for_arm_arch_FUNC ""]]
2399 # Return 1 if this is an ARM target where -marm causes ARM to be
2402 proc check_effective_target_arm_arm_ok { } {
2403 return [check_no_compiler_messages arm_arm_ok assembly {
2404 #if !defined (__arm__) || defined (__thumb__) || defined (__thumb2__)
2411 # Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
2414 proc check_effective_target_arm_thumb1_ok { } {
2415 return [check_no_compiler_messages arm_thumb1_ok assembly {
2416 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
2422 # Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be
2425 proc check_effective_target_arm_thumb2_ok { } {
2426 return [check_no_compiler_messages arm_thumb2_ok assembly {
2427 #if !defined(__thumb2__)
2433 # Return 1 if this is an ARM target where Thumb-1 is used without options
2434 # added by the test.
2436 proc check_effective_target_arm_thumb1 { } {
2437 return [check_no_compiler_messages arm_thumb1 assembly {
2438 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
2445 # Return 1 if this is an ARM target where Thumb-2 is used without options
2446 # added by the test.
2448 proc check_effective_target_arm_thumb2 { } {
2449 return [check_no_compiler_messages arm_thumb2 assembly {
2450 #if !defined(__thumb2__)
2457 # Return 1 if this is an ARM cortex-M profile cpu
2459 proc check_effective_target_arm_cortex_m { } {
2460 return [check_no_compiler_messages arm_cortex_m assembly {
2461 #if !defined(__ARM_ARCH_7M__) \
2462 && !defined (__ARM_ARCH_7EM__) \
2463 && !defined (__ARM_ARCH_6M__)
2470 # Return 1 if the target supports executing NEON instructions, 0
2471 # otherwise. Cache the result.
2473 proc check_effective_target_arm_neon_hw { } {
2474 return [check_runtime arm_neon_hw_available {
2478 long long a = 0, b = 1;
2479 asm ("vorr %P0, %P1, %P2"
2481 : "0" (a), "w" (b));
2484 } [add_options_for_arm_neon ""]]
2487 proc check_effective_target_arm_neonv2_hw { } {
2488 return [check_runtime arm_neon_hwv2_available {
2489 #include "arm_neon.h"
2493 float32x2_t a, b, c;
2494 asm ("vfma.f32 %P0, %P1, %P2"
2496 : "w" (b), "w" (c));
2499 } [add_options_for_arm_neonv2 ""]]
2502 # Return 1 if this is a ARM target with NEON enabled.
2504 proc check_effective_target_arm_neon { } {
2505 if { [check_effective_target_arm32] } {
2506 return [check_no_compiler_messages arm_neon object {
2507 #ifndef __ARM_NEON__
2518 proc check_effective_target_arm_neonv2 { } {
2519 if { [check_effective_target_arm32] } {
2520 return [check_no_compiler_messages arm_neon object {
2521 #ifndef __ARM_NEON__
2524 #ifndef __ARM_FEATURE_FMA
2536 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
2537 # the Loongson vector modes.
2539 proc check_effective_target_mips_loongson { } {
2540 return [check_no_compiler_messages loongson assembly {
2541 #if !defined(__mips_loongson_vector_rev)
2547 # Return 1 if this is an ARM target that adheres to the ABI for the ARM
2550 proc check_effective_target_arm_eabi { } {
2551 return [check_no_compiler_messages arm_eabi object {
2552 #ifndef __ARM_EABI__
2560 # Return 1 if this is an ARM target that adheres to the hard-float variant of
2561 # the ABI for the ARM Architecture (e.g. -mfloat-abi=hard).
2563 proc check_effective_target_arm_hf_eabi { } {
2564 return [check_no_compiler_messages arm_hf_eabi object {
2565 #if !defined(__ARM_EABI__) || !defined(__ARM_PCS_VFP)
2566 #error not hard-float EABI
2573 # Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
2574 # Some multilibs may be incompatible with this option.
2576 proc check_effective_target_arm_iwmmxt_ok { } {
2577 if { [check_effective_target_arm32] } {
2578 return [check_no_compiler_messages arm_iwmmxt_ok object {
2586 # Return true if LDRD/STRD instructions are prefered over LDM/STM instructions
2587 # for an ARM target.
2588 proc check_effective_target_arm_prefer_ldrd_strd { } {
2589 if { ![check_effective_target_arm32] } {
2593 return [check_no_messages_and_pattern arm_prefer_ldrd_strd "strd\tr" assembly {
2594 void foo (int *p) { p[0] = 1; p[1] = 0;}
2598 # Return 1 if this is a PowerPC target with floating-point registers.
2600 proc check_effective_target_powerpc_fprs { } {
2601 if { [istarget powerpc*-*-*]
2602 || [istarget rs6000-*-*] } {
2603 return [check_no_compiler_messages powerpc_fprs object {
2615 # Return 1 if this is a PowerPC target with hardware double-precision
2618 proc check_effective_target_powerpc_hard_double { } {
2619 if { [istarget powerpc*-*-*]
2620 || [istarget rs6000-*-*] } {
2621 return [check_no_compiler_messages powerpc_hard_double object {
2633 # Return 1 if this is a PowerPC target supporting -maltivec.
2635 proc check_effective_target_powerpc_altivec_ok { } {
2636 if { ([istarget powerpc*-*-*]
2637 && ![istarget powerpc-*-linux*paired*])
2638 || [istarget rs6000-*-*] } {
2639 # AltiVec is not supported on AIX before 5.3.
2640 if { [istarget powerpc*-*-aix4*]
2641 || [istarget powerpc*-*-aix5.1*]
2642 || [istarget powerpc*-*-aix5.2*] } {
2645 return [check_no_compiler_messages powerpc_altivec_ok object {
2653 # Return 1 if this is a PowerPC target supporting -mvsx
2655 proc check_effective_target_powerpc_vsx_ok { } {
2656 if { ([istarget powerpc*-*-*]
2657 && ![istarget powerpc-*-linux*paired*])
2658 || [istarget rs6000-*-*] } {
2659 # VSX is not supported on AIX before 7.1.
2660 if { [istarget powerpc*-*-aix4*]
2661 || [istarget powerpc*-*-aix5*]
2662 || [istarget powerpc*-*-aix6*] } {
2665 return [check_no_compiler_messages powerpc_vsx_ok object {
2668 asm volatile ("xxlor vs0,vs0,vs0");
2670 asm volatile ("xxlor 0,0,0");
2680 # Return 1 if this is a PowerPC target supporting -mcpu=cell.
2682 proc check_effective_target_powerpc_ppu_ok { } {
2683 if [check_effective_target_powerpc_altivec_ok] {
2684 return [check_no_compiler_messages cell_asm_available object {
2687 asm volatile ("lvlx v0,v0,v0");
2689 asm volatile ("lvlx 0,0,0");
2699 # Return 1 if this is a PowerPC target that supports SPU.
2701 proc check_effective_target_powerpc_spu { } {
2702 if { [istarget powerpc*-*-linux*] } {
2703 return [check_effective_target_powerpc_altivec_ok]
2709 # Return 1 if this is a PowerPC SPE target. The check includes options
2710 # specified by dg-options for this test, so don't
cache the result.
2712 proc check_effective_target_powerpc_spe_nocache
{ } {
2713 if { [istarget powerpc
*-*-*] } {
2714 return [check_no_compiler_messages_nocache powerpc_spe object
{
2720 } [current_compiler_flags
]]
2726 #
Return 1 if this is a PowerPC target with SPE enabled.
2728 proc check_effective_target_powerpc_spe
{ } {
2729 if { [istarget powerpc
*-*-*] } {
2730 return [check_no_compiler_messages powerpc_spe object
{
2742 #
Return 1 if this is a PowerPC target with Altivec enabled.
2744 proc check_effective_target_powerpc_altivec
{ } {
2745 if { [istarget powerpc
*-*-*] } {
2746 return [check_no_compiler_messages powerpc_altivec object
{
2758 #
Return 1 if this is a PowerPC
405 target. The check includes options
2759 # specified by dg
-options
for this test
, so don
't cache the result.
2761 proc check_effective_target_powerpc_405_nocache { } {
2762 if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
2763 return [check_no_compiler_messages_nocache powerpc_405 object {
2769 } [current_compiler_flags]]
2775 # Return 1 if this is a SPU target with a toolchain that
2776 # supports automatic overlay generation.
2778 proc check_effective_target_spu_auto_overlay { } {
2779 if { [istarget spu*-*-elf*] } {
2780 return [check_no_compiler_messages spu_auto_overlay executable {
2782 } "-Wl,--auto-overlay" ]
2788 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
2789 # chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
2790 # test environment appears to run executables on such a simulator.
2792 proc check_effective_target_ultrasparc_hw { } {
2793 return [check_runtime ultrasparc_hw {
2794 int main() { return 0; }
2795 } "-mcpu=ultrasparc"]
2798 # Return 1 if the test environment supports executing UltraSPARC VIS2
2799 # instructions. We check this by attempting: "bmask %g0, %g0, %g0"
2801 proc check_effective_target_ultrasparc_vis2_hw { } {
2802 return [check_runtime ultrasparc_vis2_hw {
2803 int main() { __asm__(".word 0x81b00320"); return 0; }
2804 } "-mcpu=ultrasparc3"]
2807 # Return 1 if the test environment supports executing UltraSPARC VIS3
2808 # instructions. We check this by attempting: "addxc %g0, %g0, %g0"
2810 proc check_effective_target_ultrasparc_vis3_hw { } {
2811 return [check_runtime ultrasparc_vis3_hw {
2812 int main() { __asm__(".word 0x81b00220"); return 0; }
2816 # Return 1 if this is a SPARC-V9 target.
2818 proc check_effective_target_sparc_v9 { } {
2819 if { [istarget sparc*-*-*] } {
2820 return [check_no_compiler_messages sparc_v9 object {
2822 asm volatile ("return %i7+8");
2831 # Return 1 if this is a SPARC target with VIS enabled.
2833 proc check_effective_target_sparc_vis { } {
2834 if { [istarget sparc*-*-*] } {
2835 return [check_no_compiler_messages sparc_vis object {
2847 # Return 1 if the target supports hardware vector shift operation.
2849 proc check_effective_target_vect_shift { } {
2850 global et_vect_shift_saved
2852 if [info exists et_vect_shift_saved] {
2853 verbose "check_effective_target_vect_shift: using cached result" 2
2855 set et_vect_shift_saved 0
2856 if { ([istarget powerpc*-*-*]
2857 && ![istarget powerpc-*-linux*paired*])
2858 || [istarget ia64-*-*]
2859 || [istarget i?86-*-*]
2860 || [istarget x86_64-*-*]
2861 || [istarget aarch64*-*-*]
2862 || [check_effective_target_arm32]
2863 || ([istarget mips*-*-*]
2864 && [check_effective_target_mips_loongson]) } {
2865 set et_vect_shift_saved 1
2869 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
2870 return $et_vect_shift_saved
2873 # Return 1 if the target supports hardware vector shift operation for char.
2875 proc check_effective_target_vect_shift_char { } {
2876 global et_vect_shift_char_saved
2878 if [info exists et_vect_shift_char_saved] {
2879 verbose "check_effective_target_vect_shift_char: using cached result" 2
2881 set et_vect_shift_char_saved 0
2882 if { ([istarget powerpc*-*-*]
2883 && ![istarget powerpc-*-linux*paired*])
2884 || [check_effective_target_arm32] } {
2885 set et_vect_shift_char_saved 1
2889 verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
2890 return $et_vect_shift_char_saved
2893 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
2895 # This can change for different subtargets so do not cache the result.
2897 proc check_effective_target_vect_long { } {
2898 if { [istarget i?86-*-*]
2899 || (([istarget powerpc*-*-*]
2900 && ![istarget powerpc-*-linux*paired*])
2901 && [check_effective_target_ilp32])
2902 || [istarget x86_64-*-*]
2903 || [check_effective_target_arm32]
2904 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
2910 verbose "check_effective_target_vect_long: returning $answer" 2
2914 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
2916 # This won't change
for different subtargets so
cache the result.
2918 proc check_effective_target_vect_float
{ } {
2919 global et_vect_float_saved
2921 if [info exists et_vect_float_saved
] {
2922 verbose
"check_effective_target_vect_float: using cached result" 2
2924 set et_vect_float_saved
0
2925 if { [istarget i?
86-*-*]
2926 ||
[istarget powerpc
*-*-*]
2927 ||
[istarget spu
-*-*]
2928 ||
[istarget mipsisa64
*-*-*]
2929 ||
[istarget x86_64
-*-*]
2930 ||
[istarget ia64
-*-*]
2931 ||
[istarget aarch64
*-*-*]
2932 ||
[check_effective_target_arm32
] } {
2933 set et_vect_float_saved
1
2937 verbose
"check_effective_target_vect_float: returning $et_vect_float_saved" 2
2938 return $et_vect_float_saved
2941 #
Return 1 if the target supports hardware vectors of double
, 0 otherwise.
2943 # This won
't change for different subtargets so cache the result.
2945 proc check_effective_target_vect_double { } {
2946 global et_vect_double_saved
2948 if [info exists et_vect_double_saved] {
2949 verbose "check_effective_target_vect_double: using cached result" 2
2951 set et_vect_double_saved 0
2952 if { [istarget i?86-*-*]
2953 || [istarget aarch64*-*-*]
2954 || [istarget x86_64-*-*] } {
2955 if { [check_no_compiler_messages vect_double assembly {
2956 #ifdef __tune_atom__
2957 # error No double vectorizer support.
2960 set et_vect_double_saved 1
2962 set et_vect_double_saved 0
2964 } elseif { [istarget spu-*-*] } {
2965 set et_vect_double_saved 1
2969 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
2970 return $et_vect_double_saved
2973 # Return 1 if the target supports hardware vectors of long long, 0 otherwise.
2975 # This won't change
for different subtargets so
cache the result.
2977 proc check_effective_target_vect_long_long
{ } {
2978 global et_vect_long_long_saved
2980 if [info exists et_vect_long_long_saved
] {
2981 verbose
"check_effective_target_vect_long_long: using cached result" 2
2983 set et_vect_long_long_saved
0
2984 if { [istarget i?
86-*-*]
2985 ||
[istarget x86_64
-*-*] } {
2986 set et_vect_long_long_saved
1
2990 verbose
"check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
2991 return $et_vect_long_long_saved
2995 #
Return 1 if the target plus current options does not support a vector
2996 #
max instruction
on "int", 0 otherwise.
2998 # This won
't change for different subtargets so cache the result.
3000 proc check_effective_target_vect_no_int_max { } {
3001 global et_vect_no_int_max_saved
3003 if [info exists et_vect_no_int_max_saved] {
3004 verbose "check_effective_target_vect_no_int_max: using cached result" 2
3006 set et_vect_no_int_max_saved 0
3007 if { [istarget sparc*-*-*]
3008 || [istarget spu-*-*]
3009 || [istarget alpha*-*-*]
3010 || ([istarget mips*-*-*]
3011 && [check_effective_target_mips_loongson]) } {
3012 set et_vect_no_int_max_saved 1
3015 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3016 return $et_vect_no_int_max_saved
3019 # Return 1 if the target plus current options does not support a vector
3020 # add instruction on "int", 0 otherwise.
3022 # This won't change
for different subtargets so
cache the result.
3024 proc check_effective_target_vect_no_int_add
{ } {
3025 global et_vect_no_int_add_saved
3027 if [info exists et_vect_no_int_add_saved
] {
3028 verbose
"check_effective_target_vect_no_int_add: using cached result" 2
3030 set et_vect_no_int_add_saved
0
3031 # Alpha only supports vector add
on V8QI and V4HI.
3032 if { [istarget alpha
*-*-*] } {
3033 set et_vect_no_int_add_saved
1
3036 verbose
"check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3037 return $et_vect_no_int_add_saved
3040 #
Return 1 if the target plus current options does not support vector
3041 # bitwise instructions
, 0 otherwise.
3043 # This won
't change for different subtargets so cache the result.
3045 proc check_effective_target_vect_no_bitwise { } {
3046 global et_vect_no_bitwise_saved
3048 if [info exists et_vect_no_bitwise_saved] {
3049 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
3051 set et_vect_no_bitwise_saved 0
3053 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3054 return $et_vect_no_bitwise_saved
3057 # Return 1 if the target plus current options supports vector permutation,
3060 # This won't change
for different subtargets so
cache the result.
3062 proc check_effective_target_vect_perm
{ } {
3065 if [info exists et_vect_perm_saved
] {
3066 verbose
"check_effective_target_vect_perm: using cached result" 2
3068 set et_vect_perm_saved
0
3069 if { [is
-effective
-target arm_neon_ok
]
3070 ||
[istarget aarch64
*-*-*]
3071 ||
[istarget powerpc
*-*-*]
3072 ||
[istarget spu
-*-*]
3073 ||
[istarget i?
86-*-*]
3074 ||
[istarget x86_64
-*-*]
3075 ||
([istarget mips
*-*-*]
3076 && [check_effective_target_mpaired_single
]) } {
3077 set et_vect_perm_saved
1
3080 verbose
"check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3081 return $et_vect_perm_saved
3084 #
Return 1 if the target plus current options supports vector permutation
3085 #
on byte
-sized elements
, 0 otherwise.
3087 # This won
't change for different subtargets so cache the result.
3089 proc check_effective_target_vect_perm_byte { } {
3090 global et_vect_perm_byte
3092 if [info exists et_vect_perm_byte_saved] {
3093 verbose "check_effective_target_vect_perm_byte: using cached result" 2
3095 set et_vect_perm_byte_saved 0
3096 if { ([is-effective-target arm_neon_ok]
3097 && [is-effective-target arm_little_endian])
3098 || [istarget aarch64*-*-*]
3099 || [istarget powerpc*-*-*]
3100 || [istarget spu-*-*] } {
3101 set et_vect_perm_byte_saved 1
3104 verbose "check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3105 return $et_vect_perm_byte_saved
3108 # Return 1 if the target plus current options supports vector permutation
3109 # on short-sized elements, 0 otherwise.
3111 # This won't change
for different subtargets so
cache the result.
3113 proc check_effective_target_vect_perm_short
{ } {
3114 global et_vect_perm_short
3116 if [info exists et_vect_perm_short_saved
] {
3117 verbose
"check_effective_target_vect_perm_short: using cached result" 2
3119 set et_vect_perm_short_saved
0
3120 if { ([is
-effective
-target arm_neon_ok
]
3121 && [is
-effective
-target arm_little_endian
])
3122 ||
[istarget aarch64
*-*-*]
3123 ||
[istarget powerpc
*-*-*]
3124 ||
[istarget spu
-*-*] } {
3125 set et_vect_perm_short_saved
1
3128 verbose
"check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3129 return $et_vect_perm_short_saved
3132 #
Return 1 if the target plus current options supports a vector
3133 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3135 # This won
't change for different subtargets so cache the result.
3137 proc check_effective_target_vect_widen_sum_hi_to_si_pattern { } {
3138 global et_vect_widen_sum_hi_to_si_pattern
3140 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved] {
3141 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3143 set et_vect_widen_sum_hi_to_si_pattern_saved 0
3144 if { [istarget powerpc*-*-*]
3145 || [istarget ia64-*-*] } {
3146 set et_vect_widen_sum_hi_to_si_pattern_saved 1
3149 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3150 return $et_vect_widen_sum_hi_to_si_pattern_saved
3153 # Return 1 if the target plus current options supports a vector
3154 # widening summation of *short* args into *int* result, 0 otherwise.
3155 # A target can also support this widening summation if it can support
3156 # promotion (unpacking) from shorts to ints.
3158 # This won't change
for different subtargets so
cache the result.
3160 proc check_effective_target_vect_widen_sum_hi_to_si
{ } {
3161 global et_vect_widen_sum_hi_to_si
3163 if [info exists et_vect_widen_sum_hi_to_si_saved
] {
3164 verbose
"check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3166 set et_vect_widen_sum_hi_to_si_saved
[check_effective_target_vect_unpack
]
3167 if { [istarget powerpc
*-*-*]
3168 ||
[istarget ia64
-*-*] } {
3169 set et_vect_widen_sum_hi_to_si_saved
1
3172 verbose
"check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3173 return $et_vect_widen_sum_hi_to_si_saved
3176 #
Return 1 if the target plus current options supports a vector
3177 # widening summation of
*char
* args into
*short
* result
, 0 otherwise.
3178 # A target can also support this widening summation
if it can support
3179 # promotion
(unpacking
) from chars to shorts.
3181 # This won
't change for different subtargets so cache the result.
3183 proc check_effective_target_vect_widen_sum_qi_to_hi { } {
3184 global et_vect_widen_sum_qi_to_hi
3186 if [info exists et_vect_widen_sum_qi_to_hi_saved] {
3187 verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3189 set et_vect_widen_sum_qi_to_hi_saved 0
3190 if { [check_effective_target_vect_unpack]
3191 || [check_effective_target_arm_neon_ok]
3192 || [istarget ia64-*-*] } {
3193 set et_vect_widen_sum_qi_to_hi_saved 1
3196 verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3197 return $et_vect_widen_sum_qi_to_hi_saved
3200 # Return 1 if the target plus current options supports a vector
3201 # widening summation of *char* args into *int* result, 0 otherwise.
3203 # This won't change
for different subtargets so
cache the result.
3205 proc check_effective_target_vect_widen_sum_qi_to_si
{ } {
3206 global et_vect_widen_sum_qi_to_si
3208 if [info exists et_vect_widen_sum_qi_to_si_saved
] {
3209 verbose
"check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3211 set et_vect_widen_sum_qi_to_si_saved
0
3212 if { [istarget powerpc
*-*-*] } {
3213 set et_vect_widen_sum_qi_to_si_saved
1
3216 verbose
"check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3217 return $et_vect_widen_sum_qi_to_si_saved
3220 #
Return 1 if the target plus current options supports a vector
3221 # widening multiplication of
*char
* args into
*short
* result
, 0 otherwise.
3222 # A target can also support this widening multplication
if it can support
3223 # promotion
(unpacking
) from chars to shorts
, and vect_short_mult
(non
-widening
3224 # multiplication of shorts
).
3226 # This won
't change for different subtargets so cache the result.
3229 proc check_effective_target_vect_widen_mult_qi_to_hi { } {
3230 global et_vect_widen_mult_qi_to_hi
3232 if [info exists et_vect_widen_mult_qi_to_hi_saved] {
3233 verbose "check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3235 if { [check_effective_target_vect_unpack]
3236 && [check_effective_target_vect_short_mult] } {
3237 set et_vect_widen_mult_qi_to_hi_saved 1
3239 set et_vect_widen_mult_qi_to_hi_saved 0
3241 if { [istarget powerpc*-*-*]
3242 || [istarget aarch64*-*-*]
3243 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3244 set et_vect_widen_mult_qi_to_hi_saved 1
3247 verbose "check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3248 return $et_vect_widen_mult_qi_to_hi_saved
3251 # Return 1 if the target plus current options supports a vector
3252 # widening multiplication of *short* args into *int* result, 0 otherwise.
3253 # A target can also support this widening multplication if it can support
3254 # promotion (unpacking) from shorts to ints, and vect_int_mult (non-widening
3255 # multiplication of ints).
3257 # This won't change
for different subtargets so
cache the result.
3260 proc check_effective_target_vect_widen_mult_hi_to_si
{ } {
3261 global et_vect_widen_mult_hi_to_si
3263 if [info exists et_vect_widen_mult_hi_to_si_saved
] {
3264 verbose
"check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3266 if { [check_effective_target_vect_unpack
]
3267 && [check_effective_target_vect_int_mult
] } {
3268 set et_vect_widen_mult_hi_to_si_saved
1
3270 set et_vect_widen_mult_hi_to_si_saved
0
3272 if { [istarget powerpc
*-*-*]
3273 ||
[istarget spu
-*-*]
3274 ||
[istarget ia64
-*-*]
3275 ||
[istarget aarch64
*-*-*]
3276 ||
[istarget i?
86-*-*]
3277 ||
[istarget x86_64
-*-*]
3278 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3279 set et_vect_widen_mult_hi_to_si_saved
1
3282 verbose
"check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3283 return $et_vect_widen_mult_hi_to_si_saved
3286 #
Return 1 if the target plus current options supports a vector
3287 # widening multiplication of
*char
* args into
*short
* result
, 0 otherwise.
3289 # This won
't change for different subtargets so cache the result.
3291 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern { } {
3292 global et_vect_widen_mult_qi_to_hi_pattern
3294 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved] {
3295 verbose "check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3297 set et_vect_widen_mult_qi_to_hi_pattern_saved 0
3298 if { [istarget powerpc*-*-*]
3299 || ([istarget arm*-*-*]
3300 && [check_effective_target_arm_neon_ok]
3301 && [check_effective_target_arm_little_endian]) } {
3302 set et_vect_widen_mult_qi_to_hi_pattern_saved 1
3305 verbose "check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3306 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3309 # Return 1 if the target plus current options supports a vector
3310 # widening multiplication of *short* args into *int* result, 0 otherwise.
3312 # This won't change
for different subtargets so
cache the result.
3314 proc check_effective_target_vect_widen_mult_hi_to_si_pattern
{ } {
3315 global et_vect_widen_mult_hi_to_si_pattern
3317 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved
] {
3318 verbose
"check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3320 set et_vect_widen_mult_hi_to_si_pattern_saved
0
3321 if { [istarget powerpc
*-*-*]
3322 ||
[istarget spu
-*-*]
3323 ||
[istarget ia64
-*-*]
3324 ||
[istarget i?
86-*-*]
3325 ||
[istarget x86_64
-*-*]
3326 ||
([istarget arm
*-*-*]
3327 && [check_effective_target_arm_neon_ok
]
3328 && [check_effective_target_arm_little_endian
]) } {
3329 set et_vect_widen_mult_hi_to_si_pattern_saved
1
3332 verbose
"check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3333 return $et_vect_widen_mult_hi_to_si_pattern_saved
3336 #
Return 1 if the target plus current options supports a vector
3337 # widening shift
, 0 otherwise.
3339 # This won
't change for different subtargets so cache the result.
3341 proc check_effective_target_vect_widen_shift { } {
3342 global et_vect_widen_shift_saved
3344 if [info exists et_vect_shift_saved] {
3345 verbose "check_effective_target_vect_widen_shift: using cached result" 2
3347 set et_vect_widen_shift_saved 0
3348 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3349 set et_vect_widen_shift_saved 1
3352 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3353 return $et_vect_widen_shift_saved
3356 # Return 1 if the target plus current options supports a vector
3357 # dot-product of signed chars, 0 otherwise.
3359 # This won't change
for different subtargets so
cache the result.
3361 proc check_effective_target_vect_sdot_qi
{ } {
3362 global et_vect_sdot_qi
3364 if [info exists et_vect_sdot_qi_saved
] {
3365 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
3367 set et_vect_sdot_qi_saved
0
3368 if { [istarget ia64
-*-*] } {
3369 set et_vect_udot_qi_saved
1
3372 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3373 return $et_vect_sdot_qi_saved
3376 #
Return 1 if the target plus current options supports a vector
3377 # dot
-product of unsigned chars
, 0 otherwise.
3379 # This won
't change for different subtargets so cache the result.
3381 proc check_effective_target_vect_udot_qi { } {
3382 global et_vect_udot_qi
3384 if [info exists et_vect_udot_qi_saved] {
3385 verbose "check_effective_target_vect_udot_qi: using cached result" 2
3387 set et_vect_udot_qi_saved 0
3388 if { [istarget powerpc*-*-*]
3389 || [istarget ia64-*-*] } {
3390 set et_vect_udot_qi_saved 1
3393 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
3394 return $et_vect_udot_qi_saved
3397 # Return 1 if the target plus current options supports a vector
3398 # dot-product of signed shorts, 0 otherwise.
3400 # This won't change
for different subtargets so
cache the result.
3402 proc check_effective_target_vect_sdot_hi
{ } {
3403 global et_vect_sdot_hi
3405 if [info exists et_vect_sdot_hi_saved
] {
3406 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
3408 set et_vect_sdot_hi_saved
0
3409 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3410 ||
[istarget ia64
-*-*]
3411 ||
[istarget i?
86-*-*]
3412 ||
[istarget x86_64
-*-*] } {
3413 set et_vect_sdot_hi_saved
1
3416 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
3417 return $et_vect_sdot_hi_saved
3420 #
Return 1 if the target plus current options supports a vector
3421 # dot
-product of unsigned shorts
, 0 otherwise.
3423 # This won
't change for different subtargets so cache the result.
3425 proc check_effective_target_vect_udot_hi { } {
3426 global et_vect_udot_hi
3428 if [info exists et_vect_udot_hi_saved] {
3429 verbose "check_effective_target_vect_udot_hi: using cached result" 2
3431 set et_vect_udot_hi_saved 0
3432 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
3433 set et_vect_udot_hi_saved 1
3436 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
3437 return $et_vect_udot_hi_saved
3441 # Return 1 if the target plus current options supports a vector
3442 # demotion (packing) of shorts (to chars) and ints (to shorts)
3443 # using modulo arithmetic, 0 otherwise.
3445 # This won't change
for different subtargets so
cache the result.
3447 proc check_effective_target_vect_pack_trunc
{ } {
3448 global et_vect_pack_trunc
3450 if [info exists et_vect_pack_trunc_saved
] {
3451 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
3453 set et_vect_pack_trunc_saved
0
3454 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3455 ||
[istarget i?
86-*-*]
3456 ||
[istarget x86_64
-*-*]
3457 ||
[istarget aarch64
*-*-*]
3458 ||
[istarget spu
-*-*]
3459 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
3460 && [check_effective_target_arm_little_endian
]) } {
3461 set et_vect_pack_trunc_saved
1
3464 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
3465 return $et_vect_pack_trunc_saved
3468 #
Return 1 if the target plus current options supports a vector
3469 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
3471 # This won
't change for different subtargets so cache the result.
3473 proc check_effective_target_vect_unpack { } {
3474 global et_vect_unpack
3476 if [info exists et_vect_unpack_saved] {
3477 verbose "check_effective_target_vect_unpack: using cached result" 2
3479 set et_vect_unpack_saved 0
3480 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
3481 || [istarget i?86-*-*]
3482 || [istarget x86_64-*-*]
3483 || [istarget spu-*-*]
3484 || [istarget ia64-*-*]
3485 || [istarget aarch64*-*-*]
3486 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
3487 && [check_effective_target_arm_little_endian]) } {
3488 set et_vect_unpack_saved 1
3491 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
3492 return $et_vect_unpack_saved
3495 # Return 1 if the target plus current options does not guarantee
3496 # that its STACK_BOUNDARY is >= the reguired vector alignment.
3498 # This won't change
for different subtargets so
cache the result.
3500 proc check_effective_target_unaligned_stack
{ } {
3501 global et_unaligned_stack_saved
3503 if [info exists et_unaligned_stack_saved
] {
3504 verbose
"check_effective_target_unaligned_stack: using cached result" 2
3506 set et_unaligned_stack_saved
0
3508 verbose
"check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
3509 return $et_unaligned_stack_saved
3512 #
Return 1 if the target plus current options does not support a vector
3513 # alignment mechanism
, 0 otherwise.
3515 # This won
't change for different subtargets so cache the result.
3517 proc check_effective_target_vect_no_align { } {
3518 global et_vect_no_align_saved
3520 if [info exists et_vect_no_align_saved] {
3521 verbose "check_effective_target_vect_no_align: using cached result" 2
3523 set et_vect_no_align_saved 0
3524 if { [istarget mipsisa64*-*-*]
3525 || [istarget sparc*-*-*]
3526 || [istarget ia64-*-*]
3527 || [check_effective_target_arm_vect_no_misalign]
3528 || ([istarget mips*-*-*]
3529 && [check_effective_target_mips_loongson]) } {
3530 set et_vect_no_align_saved 1
3533 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
3534 return $et_vect_no_align_saved
3537 # Return 1 if the target supports a vector misalign access, 0 otherwise.
3539 # This won't change
for different subtargets so
cache the result.
3541 proc check_effective_target_vect_hw_misalign
{ } {
3542 global et_vect_hw_misalign_saved
3544 if [info exists et_vect_hw_misalign_saved
] {
3545 verbose
"check_effective_target_vect_hw_misalign: using cached result" 2
3547 set et_vect_hw_misalign_saved
0
3548 if { ([istarget x86_64
-*-*]
3549 ||
[istarget aarch64
*-*-*]
3550 ||
[istarget i?
86-*-*]) } {
3551 set et_vect_hw_misalign_saved
1
3554 verbose
"check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
3555 return $et_vect_hw_misalign_saved
3559 #
Return 1 if arrays are aligned to the vector alignment
3560 # boundary
, 0 otherwise.
3562 # This won
't change for different subtargets so cache the result.
3564 proc check_effective_target_vect_aligned_arrays { } {
3565 global et_vect_aligned_arrays
3567 if [info exists et_vect_aligned_arrays_saved] {
3568 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
3570 set et_vect_aligned_arrays_saved 0
3571 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
3572 if { ([is-effective-target lp64]
3573 && ( ![check_avx_available]
3574 || [check_prefer_avx128])) } {
3575 set et_vect_aligned_arrays_saved 1
3578 if [istarget spu-*-*] {
3579 set et_vect_aligned_arrays_saved 1
3582 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
3583 return $et_vect_aligned_arrays_saved
3586 # Return 1 if types of size 32 bit or less are naturally aligned
3587 # (aligned to their type-size), 0 otherwise.
3589 # This won't change
for different subtargets so
cache the result.
3591 proc check_effective_target_natural_alignment_32
{ } {
3592 global et_natural_alignment_32
3594 if [info exists et_natural_alignment_32_saved
] {
3595 verbose
"check_effective_target_natural_alignment_32: using cached result" 2
3597 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
3598 set et_natural_alignment_32_saved
1
3599 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
3600 set et_natural_alignment_32_saved
0
3603 verbose
"check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
3604 return $et_natural_alignment_32_saved
3607 #
Return 1 if types of size
64 bit or less are naturally aligned
(aligned to their
3608 # type
-size
), 0 otherwise.
3610 # This won
't change for different subtargets so cache the result.
3612 proc check_effective_target_natural_alignment_64 { } {
3613 global et_natural_alignment_64
3615 if [info exists et_natural_alignment_64_saved] {
3616 verbose "check_effective_target_natural_alignment_64: using cached result" 2
3618 set et_natural_alignment_64_saved 0
3619 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
3620 || [istarget spu-*-*] } {
3621 set et_natural_alignment_64_saved 1
3624 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
3625 return $et_natural_alignment_64_saved
3628 # Return 1 if all vector types are naturally aligned (aligned to their
3629 # type-size), 0 otherwise.
3631 # This won't change
for different subtargets so
cache the result.
3633 proc check_effective_target_vect_natural_alignment
{ } {
3634 global et_vect_natural_alignment
3636 if [info exists et_vect_natural_alignment_saved
] {
3637 verbose
"check_effective_target_vect_natural_alignment: using cached result" 2
3639 set et_vect_natural_alignment_saved
1
3640 if { [check_effective_target_arm_eabi
] } {
3641 set et_vect_natural_alignment_saved
0
3644 verbose
"check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
3645 return $et_vect_natural_alignment_saved
3648 #
Return 1 if vector alignment
(for types of size
32 bit or less
) is reachable
, 0 otherwise.
3650 # This won
't change for different subtargets so cache the result.
3652 proc check_effective_target_vector_alignment_reachable { } {
3653 global et_vector_alignment_reachable
3655 if [info exists et_vector_alignment_reachable_saved] {
3656 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
3658 if { [check_effective_target_vect_aligned_arrays]
3659 || [check_effective_target_natural_alignment_32] } {
3660 set et_vector_alignment_reachable_saved 1
3662 set et_vector_alignment_reachable_saved 0
3665 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
3666 return $et_vector_alignment_reachable_saved
3669 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
3671 # This won't change
for different subtargets so
cache the result.
3673 proc check_effective_target_vector_alignment_reachable_for_64bit
{ } {
3674 global et_vector_alignment_reachable_for_64bit
3676 if [info exists et_vector_alignment_reachable_for_64bit_saved
] {
3677 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
3679 if { [check_effective_target_vect_aligned_arrays
]
3680 ||
[check_effective_target_natural_alignment_64
] } {
3681 set et_vector_alignment_reachable_for_64bit_saved
1
3683 set et_vector_alignment_reachable_for_64bit_saved
0
3686 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
3687 return $et_vector_alignment_reachable_for_64bit_saved
3690 #
Return 1 if the target only requires element alignment
for vector accesses
3692 proc check_effective_target_vect_element_align
{ } {
3693 global et_vect_element_align
3695 if [info exists et_vect_element_align
] {
3696 verbose
"check_effective_target_vect_element_align: using cached result" 2
3698 set et_vect_element_align
0
3699 if { ([istarget arm
*-*-*]
3700 && ![check_effective_target_arm_vect_no_misalign
])
3701 ||
[check_effective_target_vect_hw_misalign
] } {
3702 set et_vect_element_align
1
3706 verbose
"check_effective_target_vect_element_align: returning $et_vect_element_align" 2
3707 return $et_vect_element_align
3710 #
Return 1 if the target supports vector conditional operations
, 0 otherwise.
3712 proc check_effective_target_vect_condition
{ } {
3713 global et_vect_cond_saved
3715 if [info exists et_vect_cond_saved
] {
3716 verbose
"check_effective_target_vect_cond: using cached result" 2
3718 set et_vect_cond_saved
0
3719 if { [istarget aarch64
*-*-*]
3720 ||
[istarget powerpc
*-*-*]
3721 ||
[istarget ia64
-*-*]
3722 ||
[istarget i?
86-*-*]
3723 ||
[istarget spu
-*-*]
3724 ||
[istarget x86_64
-*-*]
3725 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3726 set et_vect_cond_saved
1
3730 verbose
"check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
3731 return $et_vect_cond_saved
3734 #
Return 1 if the target supports vector conditional operations where
3735 # the comparison has different type from the lhs
, 0 otherwise.
3737 proc check_effective_target_vect_cond_mixed
{ } {
3738 global et_vect_cond_mixed_saved
3740 if [info exists et_vect_cond_mixed_saved
] {
3741 verbose
"check_effective_target_vect_cond_mixed: using cached result" 2
3743 set et_vect_cond_mixed_saved
0
3744 if { [istarget i?
86-*-*]
3745 ||
[istarget x86_64
-*-*]
3746 ||
[istarget powerpc
*-*-*] } {
3747 set et_vect_cond_mixed_saved
1
3751 verbose
"check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
3752 return $et_vect_cond_mixed_saved
3755 #
Return 1 if the target supports vector char multiplication
, 0 otherwise.
3757 proc check_effective_target_vect_char_mult
{ } {
3758 global et_vect_char_mult_saved
3760 if [info exists et_vect_char_mult_saved
] {
3761 verbose
"check_effective_target_vect_char_mult: using cached result" 2
3763 set et_vect_char_mult_saved
0
3764 if { [istarget aarch64
*-*-*]
3765 ||
[istarget ia64
-*-*]
3766 ||
[istarget i?
86-*-*]
3767 ||
[istarget x86_64
-*-*]
3768 ||
[check_effective_target_arm32
] } {
3769 set et_vect_char_mult_saved
1
3773 verbose
"check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
3774 return $et_vect_char_mult_saved
3777 #
Return 1 if the target supports vector short multiplication
, 0 otherwise.
3779 proc check_effective_target_vect_short_mult
{ } {
3780 global et_vect_short_mult_saved
3782 if [info exists et_vect_short_mult_saved
] {
3783 verbose
"check_effective_target_vect_short_mult: using cached result" 2
3785 set et_vect_short_mult_saved
0
3786 if { [istarget ia64
-*-*]
3787 ||
[istarget spu
-*-*]
3788 ||
[istarget i?
86-*-*]
3789 ||
[istarget x86_64
-*-*]
3790 ||
[istarget powerpc
*-*-*]
3791 ||
[istarget aarch64
*-*-*]
3792 ||
[check_effective_target_arm32
]
3793 ||
([istarget mips
*-*-*]
3794 && [check_effective_target_mips_loongson
]) } {
3795 set et_vect_short_mult_saved
1
3799 verbose
"check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
3800 return $et_vect_short_mult_saved
3803 #
Return 1 if the target supports vector
int multiplication
, 0 otherwise.
3805 proc check_effective_target_vect_int_mult
{ } {
3806 global et_vect_int_mult_saved
3808 if [info exists et_vect_int_mult_saved
] {
3809 verbose
"check_effective_target_vect_int_mult: using cached result" 2
3811 set et_vect_int_mult_saved
0
3812 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3813 ||
[istarget spu
-*-*]
3814 ||
[istarget i?
86-*-*]
3815 ||
[istarget x86_64
-*-*]
3816 ||
[istarget ia64
-*-*]
3817 ||
[istarget aarch64
*-*-*]
3818 ||
[check_effective_target_arm32
] } {
3819 set et_vect_int_mult_saved
1
3823 verbose
"check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
3824 return $et_vect_int_mult_saved
3827 #
Return 1 if the target supports vector even
/odd elements extraction
, 0 otherwise.
3829 proc check_effective_target_vect_extract_even_odd
{ } {
3830 global et_vect_extract_even_odd_saved
3832 if [info exists et_vect_extract_even_odd_saved
] {
3833 verbose
"check_effective_target_vect_extract_even_odd: using cached result" 2
3835 set et_vect_extract_even_odd_saved
0
3836 if { [istarget aarch64
*-*-*]
3837 ||
[istarget powerpc
*-*-*]
3838 ||
[is
-effective
-target arm_neon_ok
]
3839 ||
[istarget i?
86-*-*]
3840 ||
[istarget x86_64
-*-*]
3841 ||
[istarget ia64
-*-*]
3842 ||
[istarget spu
-*-*]
3843 ||
([istarget mips
*-*-*]
3844 && [check_effective_target_mpaired_single
]) } {
3845 set et_vect_extract_even_odd_saved
1
3849 verbose
"check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
3850 return $et_vect_extract_even_odd_saved
3853 #
Return 1 if the target supports vector interleaving
, 0 otherwise.
3855 proc check_effective_target_vect_interleave
{ } {
3856 global et_vect_interleave_saved
3858 if [info exists et_vect_interleave_saved
] {
3859 verbose
"check_effective_target_vect_interleave: using cached result" 2
3861 set et_vect_interleave_saved
0
3862 if { [istarget aarch64
*-*-*]
3863 ||
[istarget powerpc
*-*-*]
3864 ||
[is
-effective
-target arm_neon_ok
]
3865 ||
[istarget i?
86-*-*]
3866 ||
[istarget x86_64
-*-*]
3867 ||
[istarget ia64
-*-*]
3868 ||
[istarget spu
-*-*]
3869 ||
([istarget mips
*-*-*]
3870 && [check_effective_target_mpaired_single
]) } {
3871 set et_vect_interleave_saved
1
3875 verbose
"check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
3876 return $et_vect_interleave_saved
3879 foreach N
{2 3 4 8} {
3880 eval
[string map
[list N $N
] {
3881 #
Return 1 if the target supports
2-vector interleaving
3882 proc check_effective_target_vect_stridedN
{ } {
3883 global et_vect_stridedN_saved
3885 if [info exists et_vect_stridedN_saved
] {
3886 verbose
"check_effective_target_vect_stridedN: using cached result" 2
3888 set et_vect_stridedN_saved
0
3890 && [check_effective_target_vect_interleave
]
3891 && [check_effective_target_vect_extract_even_odd
] } {
3892 set et_vect_stridedN_saved
1
3894 if { ([istarget arm
*-*-*]
3895 ||
[istarget aarch64
*-*-*]) && N
>= 2 && N
<= 4 } {
3896 set et_vect_stridedN_saved
1
3900 verbose
"check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
3901 return $et_vect_stridedN_saved
3906 #
Return 1 if the target supports multiple vector sizes
3908 proc check_effective_target_vect_multiple_sizes
{ } {
3909 global et_vect_multiple_sizes_saved
3911 set et_vect_multiple_sizes_saved
0
3912 if { ([istarget aarch64
*-*-*]
3913 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
])) } {
3914 set et_vect_multiple_sizes_saved
1
3916 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
3917 if { ([check_avx_available
] && ![check_prefer_avx128
]) } {
3918 set et_vect_multiple_sizes_saved
1
3922 verbose
"check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
3923 return $et_vect_multiple_sizes_saved
3926 #
Return 1 if the target supports vectors of
64 bits.
3928 proc check_effective_target_vect64
{ } {
3929 global et_vect64_saved
3931 if [info exists et_vect64_saved
] {
3932 verbose
"check_effective_target_vect64: using cached result" 2
3934 set et_vect64_saved
0
3935 if { ([istarget arm
*-*-*]
3936 && [check_effective_target_arm_neon_ok
]
3937 && [check_effective_target_arm_little_endian
]) } {
3938 set et_vect64_saved
1
3942 verbose
"check_effective_target_vect64: returning $et_vect64_saved" 2
3943 return $et_vect64_saved
3946 #
Return 1 if the target supports vector copysignf calls.
3948 proc check_effective_target_vect_call_copysignf
{ } {
3949 global et_vect_call_copysignf_saved
3951 if [info exists et_vect_call_copysignf_saved
] {
3952 verbose
"check_effective_target_vect_call_copysignf: using cached result" 2
3954 set et_vect_call_copysignf_saved
0
3955 if { [istarget i?
86-*-*]
3956 ||
[istarget x86_64
-*-*]
3957 ||
[istarget powerpc
*-*-*] } {
3958 set et_vect_call_copysignf_saved
1
3962 verbose
"check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
3963 return $et_vect_call_copysignf_saved
3966 #
Return 1 if the target supports vector sqrtf calls.
3968 proc check_effective_target_vect_call_sqrtf
{ } {
3969 global et_vect_call_sqrtf_saved
3971 if [info exists et_vect_call_sqrtf_saved
] {
3972 verbose
"check_effective_target_vect_call_sqrtf: using cached result" 2
3974 set et_vect_call_sqrtf_saved
0
3975 if { [istarget aarch64
*-*-*]
3976 ||
[istarget i?
86-*-*]
3977 ||
[istarget x86_64
-*-*]
3978 ||
([istarget powerpc
*-*-*] && [check_vsx_hw_available
]) } {
3979 set et_vect_call_sqrtf_saved
1
3983 verbose
"check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
3984 return $et_vect_call_sqrtf_saved
3987 #
Return 1 if the target supports vector lrint calls.
3989 proc check_effective_target_vect_call_lrint
{ } {
3990 set et_vect_call_lrint
0
3991 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) && [check_effective_target_ilp32
] } {
3992 set et_vect_call_lrint
1
3995 verbose
"check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
3996 return $et_vect_call_lrint
3999 #
Return 1 if the target supports vector btrunc calls.
4001 proc check_effective_target_vect_call_btrunc
{ } {
4002 global et_vect_call_btrunc_saved
4004 if [info exists et_vect_call_btrunc_saved
] {
4005 verbose
"check_effective_target_vect_call_btrunc: using cached result" 2
4007 set et_vect_call_btrunc_saved
0
4008 if { [istarget aarch64
*-*-*] } {
4009 set et_vect_call_btrunc_saved
1
4013 verbose
"check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4014 return $et_vect_call_btrunc_saved
4017 #
Return 1 if the target supports vector btruncf calls.
4019 proc check_effective_target_vect_call_btruncf
{ } {
4020 global et_vect_call_btruncf_saved
4022 if [info exists et_vect_call_btruncf_saved
] {
4023 verbose
"check_effective_target_vect_call_btruncf: using cached result" 2
4025 set et_vect_call_btruncf_saved
0
4026 if { [istarget aarch64
*-*-*] } {
4027 set et_vect_call_btruncf_saved
1
4031 verbose
"check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4032 return $et_vect_call_btruncf_saved
4035 #
Return 1 if the target supports vector ceil calls.
4037 proc check_effective_target_vect_call_ceil
{ } {
4038 global et_vect_call_ceil_saved
4040 if [info exists et_vect_call_ceil_saved
] {
4041 verbose
"check_effective_target_vect_call_ceil: using cached result" 2
4043 set et_vect_call_ceil_saved
0
4044 if { [istarget aarch64
*-*-*] } {
4045 set et_vect_call_ceil_saved
1
4049 verbose
"check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4050 return $et_vect_call_ceil_saved
4053 #
Return 1 if the target supports vector ceilf calls.
4055 proc check_effective_target_vect_call_ceilf
{ } {
4056 global et_vect_call_ceilf_saved
4058 if [info exists et_vect_call_ceilf_saved
] {
4059 verbose
"check_effective_target_vect_call_ceilf: using cached result" 2
4061 set et_vect_call_ceilf_saved
0
4062 if { [istarget aarch64
*-*-*] } {
4063 set et_vect_call_ceilf_saved
1
4067 verbose
"check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4068 return $et_vect_call_ceilf_saved
4071 #
Return 1 if the target supports vector floor calls.
4073 proc check_effective_target_vect_call_floor
{ } {
4074 global et_vect_call_floor_saved
4076 if [info exists et_vect_call_floor_saved
] {
4077 verbose
"check_effective_target_vect_call_floor: using cached result" 2
4079 set et_vect_call_floor_saved
0
4080 if { [istarget aarch64
*-*-*] } {
4081 set et_vect_call_floor_saved
1
4085 verbose
"check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4086 return $et_vect_call_floor_saved
4089 #
Return 1 if the target supports vector floorf calls.
4091 proc check_effective_target_vect_call_floorf
{ } {
4092 global et_vect_call_floorf_saved
4094 if [info exists et_vect_call_floorf_saved
] {
4095 verbose
"check_effective_target_vect_call_floorf: using cached result" 2
4097 set et_vect_call_floorf_saved
0
4098 if { [istarget aarch64
*-*-*] } {
4099 set et_vect_call_floorf_saved
1
4103 verbose
"check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4104 return $et_vect_call_floorf_saved
4107 #
Return 1 if the target supports vector lceil calls.
4109 proc check_effective_target_vect_call_lceil
{ } {
4110 global et_vect_call_lceil_saved
4112 if [info exists et_vect_call_lceil_saved
] {
4113 verbose
"check_effective_target_vect_call_lceil: using cached result" 2
4115 set et_vect_call_lceil_saved
0
4116 if { [istarget aarch64
*-*-*] } {
4117 set et_vect_call_lceil_saved
1
4121 verbose
"check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4122 return $et_vect_call_lceil_saved
4125 #
Return 1 if the target supports vector lfloor calls.
4127 proc check_effective_target_vect_call_lfloor
{ } {
4128 global et_vect_call_lfloor_saved
4130 if [info exists et_vect_call_lfloor_saved
] {
4131 verbose
"check_effective_target_vect_call_lfloor: using cached result" 2
4133 set et_vect_call_lfloor_saved
0
4134 if { [istarget aarch64
*-*-*] } {
4135 set et_vect_call_lfloor_saved
1
4139 verbose
"check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4140 return $et_vect_call_lfloor_saved
4143 #
Return 1 if the target supports vector nearbyint calls.
4145 proc check_effective_target_vect_call_nearbyint
{ } {
4146 global et_vect_call_nearbyint_saved
4148 if [info exists et_vect_call_nearbyint_saved
] {
4149 verbose
"check_effective_target_vect_call_nearbyint: using cached result" 2
4151 set et_vect_call_nearbyint_saved
0
4152 if { [istarget aarch64
*-*-*] } {
4153 set et_vect_call_nearbyint_saved
1
4157 verbose
"check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4158 return $et_vect_call_nearbyint_saved
4161 #
Return 1 if the target supports vector nearbyintf calls.
4163 proc check_effective_target_vect_call_nearbyintf
{ } {
4164 global et_vect_call_nearbyintf_saved
4166 if [info exists et_vect_call_nearbyintf_saved
] {
4167 verbose
"check_effective_target_vect_call_nearbyintf: using cached result" 2
4169 set et_vect_call_nearbyintf_saved
0
4170 if { [istarget aarch64
*-*-*] } {
4171 set et_vect_call_nearbyintf_saved
1
4175 verbose
"check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4176 return $et_vect_call_nearbyintf_saved
4179 #
Return 1 if the target supports vector
round calls.
4181 proc check_effective_target_vect_call_round
{ } {
4182 global et_vect_call_round_saved
4184 if [info exists et_vect_call_round_saved
] {
4185 verbose
"check_effective_target_vect_call_round: using cached result" 2
4187 set et_vect_call_round_saved
0
4188 if { [istarget aarch64
*-*-*] } {
4189 set et_vect_call_round_saved
1
4193 verbose
"check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4194 return $et_vect_call_round_saved
4197 #
Return 1 if the target supports vector roundf calls.
4199 proc check_effective_target_vect_call_roundf
{ } {
4200 global et_vect_call_roundf_saved
4202 if [info exists et_vect_call_roundf_saved
] {
4203 verbose
"check_effective_target_vect_call_roundf: using cached result" 2
4205 set et_vect_call_roundf_saved
0
4206 if { [istarget aarch64
*-*-*] } {
4207 set et_vect_call_roundf_saved
1
4211 verbose
"check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4212 return $et_vect_call_roundf_saved
4215 #
Return 1 if the target supports section
-anchors
4217 proc check_effective_target_section_anchors
{ } {
4218 global et_section_anchors_saved
4220 if [info exists et_section_anchors_saved
] {
4221 verbose
"check_effective_target_section_anchors: using cached result" 2
4223 set et_section_anchors_saved
0
4224 if { [istarget powerpc
*-*-*]
4225 ||
[istarget arm
*-*-*] } {
4226 set et_section_anchors_saved
1
4230 verbose
"check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4231 return $et_section_anchors_saved
4234 #
Return 1 if the target supports atomic operations
on "int_128" values.
4236 proc check_effective_target_sync_int_128
{ } {
4237 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4238 && ![is
-effective
-target ia32
] } {
4245 #
Return 1 if the target supports atomic operations
on "int_128" values
4246 # and can
execute them.
4248 proc check_effective_target_sync_int_128_runtime
{ } {
4249 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4250 && ![is
-effective
-target ia32
] } {
4251 return [check_cached_effective_target sync_int_128_available
{
4252 check_runtime_nocache sync_int_128_available
{
4256 unsigned
int eax
, ebx
, ecx
, edx
;
4257 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4258 return !(ecx
& bit_CMPXCHG16B
);
4268 #
Return 1 if the target supports atomic operations
on "long long".
4270 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4272 proc check_effective_target_sync_long_long
{ } {
4273 if { [istarget x86_64
-*-*]
4274 ||
[istarget i?
86-*-*])
4275 ||
[istarget arm
*-*-*]
4276 ||
[istarget alpha
*-*-*]
4277 ||
([istarget sparc
*-*-*] && [check_effective_target_lp64
]) } {
4284 #
Return 1 if the target supports atomic operations
on "long long"
4285 # and can
execute them.
4287 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4289 proc check_effective_target_sync_long_long_runtime
{ } {
4290 if { [istarget x86_64
-*-*]
4291 ||
[istarget i?
86-*-*] } {
4292 return [check_cached_effective_target sync_long_long_available
{
4293 check_runtime_nocache sync_long_long_available
{
4297 unsigned
int eax
, ebx
, ecx
, edx
;
4298 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4299 return !(edx
& bit_CMPXCHG8B
);
4304 } elseif
{ [istarget arm
*-*-linux
-*] } {
4305 return [check_runtime sync_longlong_runtime
{
4311 if (sizeof
(long long
) != 8)
4314 /* Just check
for native
; checking
for kernel fallback is tricky.
*/
4315 asm volatile
("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4320 } elseif
{ [istarget alpha
*-*-*] } {
4322 } elseif
{ ([istarget sparc
*-*-*]
4323 && [check_effective_target_lp64
]
4324 && [check_effective_target_ultrasparc_hw
]) } {
4326 } elseif
{ [istarget powerpc
*-*-*] && [check_effective_target_lp64
] } {
4333 #
Return 1 if the target supports atomic operations
on "int" and "long".
4335 proc check_effective_target_sync_int_long
{ } {
4336 global et_sync_int_long_saved
4338 if [info exists et_sync_int_long_saved
] {
4339 verbose
"check_effective_target_sync_int_long: using cached result" 2
4341 set et_sync_int_long_saved
0
4342 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
4343 # load-reserved/store-conditional instructions.
4344 if { [istarget ia64-*-*]
4345 || [istarget i?86-*-*]
4346 || [istarget x86_64-*-*]
4347 || [istarget aarch64*-*-*]
4348 || [istarget alpha*-*-*]
4349 || [istarget arm*-*-linux-*]
4350 || [istarget bfin*-*linux*]
4351 || [istarget hppa*-*linux*]
4352 || [istarget s390*-*-*]
4353 || [istarget powerpc*-*-*]
4354 || [istarget crisv32-*-*] || [istarget cris-*-*]
4355 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
4356 || [check_effective_target_mips_llsc] } {
4357 set et_sync_int_long_saved 1
4361 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
4362 return $et_sync_int_long_saved
4365 # Return 1 if the target supports atomic operations on "char" and "short".
4367 proc check_effective_target_sync_char_short { } {
4368 global et_sync_char_short_saved
4370 if [info exists et_sync_char_short_saved] {
4371 verbose "check_effective_target_sync_char_short: using cached result" 2
4373 set et_sync_char_short_saved 0
4374 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
4375 #
load-reserved/store
-conditional instructions.
4376 if { [istarget aarch64
*-*-*]
4377 ||
[istarget ia64
-*-*]
4378 ||
[istarget i?
86-*-*]
4379 ||
[istarget x86_64
-*-*]
4380 ||
[istarget alpha
*-*-*]
4381 ||
[istarget arm
*-*-linux
-*]
4382 ||
[istarget hppa
*-*linux
*]
4383 ||
[istarget s390
*-*-*]
4384 ||
[istarget powerpc
*-*-*]
4385 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
4386 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
4387 ||
[check_effective_target_mips_llsc
] } {
4388 set et_sync_char_short_saved
1
4392 verbose
"check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
4393 return $et_sync_char_short_saved
4396 #
Return 1 if the target uses a ColdFire FPU.
4398 proc check_effective_target_coldfire_fpu
{ } {
4399 return [check_no_compiler_messages coldfire_fpu assembly
{
4406 #
Return true
if this is a uClibc target.
4408 proc check_effective_target_uclibc
{} {
4409 return [check_no_compiler_messages uclibc object
{
4410 #
include <features.h
>
4411 #
if !defined
(__UCLIBC__
)
4417 #
Return true
if this is a uclibc target and
if the uclibc feature
4418 # described by __$feature__ is not present.
4420 proc check_missing_uclibc_feature
{feature
} {
4421 return [check_no_compiler_messages $feature object
"
4422 #
include <features.h
>
4423 #
if !defined
(__UCLIBC
) || defined
(__$
{feature
}__
)
4429 #
Return true
if this is a Newlib target.
4431 proc check_effective_target_newlib
{} {
4432 return [check_no_compiler_messages newlib object
{
4438 #
(a
) an error of a few ULP is expected in string to floating
-point
4439 # conversion functions
; and
4440 #
(b
) overflow is not always detected correctly by those functions.
4442 proc check_effective_target_lax_strtofp
{} {
4443 # By default
, assume that all uClibc targets suffer from this.
4444 return [check_effective_target_uclibc
]
4447 #
Return 1 if this is a target
for which wcsftime is a dummy
4448 # function that always returns
0.
4450 proc check_effective_target_dummy_wcsftime
{} {
4451 # By default
, assume that all uClibc targets suffer from this.
4452 return [check_effective_target_uclibc
]
4455 #
Return 1 if constructors with initialization priority arguments are
4456 # supposed
on this target.
4458 proc check_effective_target_init_priority
{} {
4459 return [check_no_compiler_messages init_priority assembly
"
4460 void f
() __attribute__
((constructor
(1000)));
4465 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
4466 # This can be used with
any check_
* proc that takes no
argument and
4467 # returns only
1 or
0. It could be used with check_
* procs that take
4468 # arguments with keywords that pass particular arguments.
4470 proc is
-effective
-target
{ arg } {
4472 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4473 set selected
[check_effective_target_$
{arg}]
4476 "vmx_hw" { set selected [check_vmx_hw_available] }
4477 "vsx_hw" { set selected [check_vsx_hw_available] }
4478 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
4479 "named_sections" { set selected [check_named_sections_available] }
4480 "gc_sections" { set selected [check_gc_sections_available] }
4481 "cxa_atexit" { set selected [check_cxa_atexit_available] }
4482 default
{ error
"unknown effective target keyword `$arg'" }
4485 verbose
"is-effective-target: $arg $selected" 2
4489 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
4491 proc is
-effective
-target
-keyword
{ arg } {
4492 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4495 # These have different names
for their check_
* procs.
4497 "vmx_hw" { return 1 }
4498 "vsx_hw" { return 1 }
4499 "ppc_recip_hw" { return 1 }
4500 "named_sections" { return 1 }
4501 "gc_sections" { return 1 }
4502 "cxa_atexit" { return 1 }
4503 default
{ return 0 }
4508 #
Return 1 if target default to short enums
4510 proc check_effective_target_short_enums
{ } {
4511 return [check_no_compiler_messages short_enums assembly
{
4513 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
4517 #
Return 1 if target supports merging string constants at link time.
4519 proc check_effective_target_string_merging
{ } {
4520 return [check_no_messages_and_pattern string_merging \
4521 "rodata\\.str" assembly {
4522 const char
*var
= "String";
4526 #
Return 1 if target has the basic signed and unsigned types in
4527 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
4528 # working
<stdint.h
> for all targets.
4530 proc check_effective_target_stdint_types
{ } {
4531 return [check_no_compiler_messages stdint_types assembly
{
4533 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
4534 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
4538 #
Return 1 if target has the basic signed and unsigned types in
4539 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
4540 # these types agree with those in the header, as some systems have
4541 # only <inttypes.h>.
4543 proc check_effective_target_inttypes_types { } {
4544 return [check_no_compiler_messages inttypes_types assembly {
4545 #include <inttypes.h>
4546 int8_t a; int16_t b; int32_t c; int64_t d;
4547 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
4551 # Return 1 if programs are intended to be run on a simulator
4552 # (i.e. slowly) rather than hardware (i.e. fast).
4554 proc check_effective_target_simulator { } {
4556 # All "src/sim" simulators set this one.
4557 if [board_info target exists is_simulator] {
4558 return [board_info target is_simulator]
4561 # The "sid" simulators don't
set that one
, but at least they
set
4563 if [board_info target
exists slow_simulator
] {
4564 return [board_info target slow_simulator
]
4570 #
Return 1 if the target is a VxWorks kernel.
4572 proc check_effective_target_vxworks_kernel
{ } {
4573 return [check_no_compiler_messages vxworks_kernel assembly
{
4574 #
if !defined __vxworks || defined __RTP__
4580 #
Return 1 if the target is a VxWorks RTP.
4582 proc check_effective_target_vxworks_rtp
{ } {
4583 return [check_no_compiler_messages vxworks_rtp assembly
{
4584 #
if !defined __vxworks ||
!defined __RTP__
4590 #
Return 1 if the target is expected to provide wide character support.
4592 proc check_effective_target_wchar
{ } {
4593 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
4596 return [check_no_compiler_messages wchar assembly
{
4601 #
Return 1 if the target has
<pthread.h
>.
4603 proc check_effective_target_pthread_h
{ } {
4604 return [check_no_compiler_messages pthread_h assembly
{
4605 #
include <pthread.h
>
4609 #
Return 1 if the target can truncate a file from a file
-descriptor
,
4610 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
4611 # chsize. We test
for a trivially functional truncation
; no stubs.
4612 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
4613 # different function to be used.
4615 proc check_effective_target_fd_truncate { } {
4617 #define _FILE_OFFSET_BITS 64
4623 FILE *f = fopen ("tst.tmp", "wb");
4625 const char t[] = "test writing more than ten characters";
4629 write (fd, t, sizeof (t) - 1);
4631 if (ftruncate (fd, 10) != 0)
4640 f = fopen ("tst.tmp", "rb");
4641 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
4649 if { [check_runtime ftruncate $prog] } {
4653 regsub "ftruncate" $prog "chsize" prog
4654 return [check_runtime chsize $prog]
4657 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
4659 proc add_options_for_c99_runtime { flags } {
4660 if { [istarget *-*-solaris2*] } {
4661 return "$flags -std=c99"
4663 if { [istarget powerpc-*-darwin*] } {
4664 return "$flags -mmacosx-version-min=10.3"
4669 # Add to FLAGS all the target-specific flags needed to enable
4670 # full IEEE compliance mode.
4672 proc add_options_for_ieee { flags } {
4673 if { [istarget alpha*-*-*]
4674 || [istarget sh*-*-*] } {
4675 return "$flags -mieee"
4677 if { [istarget rx-*-*] } {
4678 return "$flags -mnofpu"
4683 # Add to FLAGS the flags needed to enable functions to bind locally
4684 # when using pic/PIC passes in the testsuite.
4686 proc add_options_for_bind_pic_locally { flags } {
4687 if {[check_no_compiler_messages using_pic2 assembly {
4692 return "$flags -fPIE"
4694 if {[check_no_compiler_messages using_pic1 assembly {
4699 return "$flags -fpie"
4705 # Add to FLAGS the flags needed to enable 64-bit vectors.
4707 proc add_options_for_double_vectors { flags } {
4708 if [is-effective-target arm_neon_ok] {
4709 return "$flags -mvectorize-with-neon-double"
4715 # Add to FLAGS the flags needed to disable inlining of
4716 # UPC run-time access routines.
4718 proc add_options_for_upc_library_calls { flags } {
4719 return "$flags -fno-upc-inline-lib"
4722 # Check if UPC struct pts build
4724 proc check_effective_target_upc_struct_pts { } {
4725 return [check_no_compiler_messages upc_struct_pts object {
4727 #ifndef __UPC_PTS_STRUCT_REP__
4728 # error struct PTS is not supported
4733 # Check if UPC packed pts build
4735 proc check_effective_target_upc_packed_pts { } {
4736 return [check_no_compiler_messages upc_packed_pts object {
4738 #ifndef __UPC_PTS_PACKED_REP__
4739 # error packed PTS is not supported
4744 # Return 1 if the target provides a full C99 runtime.
4746 proc check_effective_target_c99_runtime { } {
4747 return [check_cached_effective_target c99_runtime {
4750 set file [open "$srcdir/gcc.dg/builtins-config.h"]
4751 set contents [read $file]
4754 #ifndef HAVE_C99_RUNTIME
4758 check_no_compiler_messages_nocache c99_runtime assembly \
4759 $contents [add_options_for_c99_runtime ""]
4763 # Return 1 if target wchar_t is at least 4 bytes.
4765 proc check_effective_target_4byte_wchar_t { } {
4766 return [check_no_compiler_messages 4byte_wchar_t object {
4767 int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
4771 # Return 1 if the target supports automatic stack alignment.
4773 proc check_effective_target_automatic_stack_alignment { } {
4774 # Ordinarily x86 supports automatic stack alignment ...
4775 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
4776 if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
4777 # ... except Win64 SEH doesn't. Succeed
for Win32 though.
4778 return [check_effective_target_ilp32
];
4785 #
Return true
if we are compiling
for AVX target.
4787 proc check_avx_available
{ } {
4788 if { [check_no_compiler_messages avx_available assembly
{
4798 #
Return true
if 32- and
16-bytes vectors are available.
4800 proc check_effective_target_vect_sizes_32B_16B
{ } {
4801 return [check_avx_available
];
4804 #
Return true
if 128-bits vectors are preferred even
if 256-bits vectors
4807 proc check_prefer_avx128
{ } {
4808 if ![check_avx_available
] {
4811 return [check_no_messages_and_pattern avx_explicit
"xmm" assembly {
4812 float a
[1024],b
[1024],c
[1024];
4813 void foo
(void
) { int i
; for (i
= 0; i
< 1024; i
++) a
[i
]=b
[i
]+c
[i
];}
4814 } "-O2 -ftree-vectorize"]
4818 #
Return 1 if avx instructions can be compiled.
4820 proc check_effective_target_avx
{ } {
4821 return [check_no_compiler_messages avx object
{
4822 void _mm256_zeroall
(void
)
4824 __builtin_ia32_vzeroall
();
4829 #
Return 1 if sse instructions can be compiled.
4830 proc check_effective_target_sse
{ } {
4831 return [check_no_compiler_messages sse object
{
4834 __builtin_ia32_stmxcsr
();
4840 #
Return 1 if sse2 instructions can be compiled.
4841 proc check_effective_target_sse2
{ } {
4842 return [check_no_compiler_messages sse2 object
{
4843 typedef long long __m128i __attribute__
((__vector_size__
(16)));
4845 __m128i _mm_srli_si128
(__m128i __A
, int __N
)
4847 return (__m128i
)__builtin_ia32_psrldqi128
(__A
, 8);
4852 #
Return 1 if F16C instructions can be compiled.
4854 proc check_effective_target_f16c
{ } {
4855 return [check_no_compiler_messages f16c object
{
4856 #
include "immintrin.h"
4858 foo
(unsigned short val
)
4860 return _cvtsh_ss
(val
);
4865 #
Return 1 if C wchar_t type is compatible with char16_t.
4867 proc check_effective_target_wchar_t_char16_t_compatible
{ } {
4868 return [check_no_compiler_messages wchar_t_char16_t object
{
4870 __CHAR16_TYPE__
*p16
= &wc
;
4871 char t
[(((__CHAR16_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
4875 #
Return 1 if C wchar_t type is compatible with char32_t.
4877 proc check_effective_target_wchar_t_char32_t_compatible
{ } {
4878 return [check_no_compiler_messages wchar_t_char32_t object
{
4880 __CHAR32_TYPE__
*p32
= &wc
;
4881 char t
[(((__CHAR32_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
4885 #
Return 1 if pow10 function
exists.
4887 proc check_effective_target_pow10
{ } {
4888 return [check_runtime pow10
{
4898 #
Return 1 if current options generate DFP instructions
, 0 otherwise.
4900 proc check_effective_target_hard_dfp
{} {
4901 return [check_no_messages_and_pattern hard_dfp
"!adddd3" assembly {
4902 typedef float d64 __attribute__
((mode(DD
)));
4904 void foo
(void
) { z
= x
+ y
; }
4908 #
Return 1 if string.h and wchar.h headers provide C
++ requires overloads
4909 #
for strchr etc. functions.
4911 proc check_effective_target_correct_iso_cpp_string_wchar_protos
{ } {
4912 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly
{
4915 #
if !defined
(__cplusplus
) \
4916 ||
!defined
(__CORRECT_ISO_CPP_STRING_H_PROTO
) \
4917 ||
!defined
(__CORRECT_ISO_CPP_WCHAR_H_PROTO
)
4918 ISO C
++ correct string.h and wchar.h protos not supported.
4925 #
Return 1 if GNU as is used.
4927 proc check_effective_target_gas
{ } {
4928 global use_gas_saved
4931 if {![info exists use_gas_saved
]} {
4932 # Check
if the as used by gcc is GNU as.
4933 set gcc_as
[lindex
[$
{tool
}_target_compile
"-print-prog-name=as" "" "none" ""] 0]
4934 # Provide
/dev
/null as input
, otherwise gas times out reading from
4936 set status [remote_exec host
"$gcc_as" "-v /dev/null"]
4937 set as_output
[lindex $
status 1]
4938 if { [ string first
"GNU" $as_output ] >= 0 } {
4944 return $use_gas_saved
4947 #
Return 1 if GNU
ld is used.
4949 proc check_effective_target_gld
{ } {
4950 global use_gld_saved
4953 if {![info exists use_gld_saved
]} {
4954 # Check
if the
ld used by gcc is GNU
ld.
4955 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=ld" "" "none" ""] 0]
4956 set status [remote_exec host
"$gcc_ld" "--version"]
4957 set ld_output
[lindex $
status 1]
4958 if { [ string first
"GNU" $ld_output ] >= 0 } {
4964 return $use_gld_saved
4967 #
Return 1 if the compiler has been configure with link
-time optimization
4970 proc check_effective_target_lto
{ } {
4972 return [info exists ENABLE_LTO
]
4975 #
Return 1 if -mx32
-maddress
-mode=short can
compile, 0 otherwise.
4977 proc check_effective_target_maybe_x32
{ } {
4978 return [check_no_compiler_messages maybe_x32 object
{
4980 } "-mx32 -maddress-mode=short"]
4983 #
Return 1 if this target supports the
-fsplit
-stack option
, 0
4986 proc check_effective_target_split_stack
{} {
4987 return [check_no_compiler_messages split_stack object
{
4992 #
Return 1 if this target supports the
-masm
=intel option
, 0
4995 proc check_effective_target_masm_intel
{} {
4996 return [check_no_compiler_messages masm_intel object
{
4997 extern void abort
(void
);
5001 #
Return 1 if the language
for the compiler under test is C.
5003 proc check_effective_target_c
{ } {
5005 if [string match $tool
"gcc"] {
5011 #
Return 1 if the language
for the compiler under test is C
++.
5013 proc check_effective_target_c
++ { } {
5015 if [string match $tool
"g++"] {
5021 # Check which language standard is active by checking
for the presence of
5022 # one of the C
++11 -std flags. This assumes that the default
for the
5023 # compiler is C
++98, and that there will never be multiple
-std
= arguments
5024 #
on the command line.
5025 proc check_effective_target_c
++11 { } {
5026 if ![check_effective_target_c
++] {
5029 return [check
-flags
{ { } { } { -std
=c
++0x
-std
=gnu
++0x
-std
=c
++11 -std
=gnu
++11 } }]
5032 proc check_effective_target_c
++1y
{ } {
5033 if ![check_effective_target_c
++] {
5036 return [check
-flags
{ { } { } { -std
=c
++1y
-std
=gnu
++1y
} }]
5039 proc check_effective_target_c
++98 { } {
5040 if ![check_effective_target_c
++] {
5043 return [check
-flags
{ { } { } { } { -std
=c
++0x
-std
=gnu
++0x
-std
=c
++11 -std
=gnu
++11 -std
=c
++1y
-std
=gnu
++1y
} }]
5046 #
Return 1 if expensive testcases should be run.
5048 proc check_effective_target_run_expensive_tests
{ } {
5049 if { [getenv GCC_TEST_RUN_EXPENSIVE
] != "" } {
5055 # Returns
1 if "mempcpy" is available on the target system.
5057 proc check_effective_target_mempcpy
{} {
5058 return [check_function_available
"mempcpy"]
5061 # Check whether the vectorizer tests are supported by the target and
5062 # append additional target
-dependent
compile flags to DEFAULT_VECTCFLAGS.
5063 #
Set dg
-do-what
-default to either
compile or run
, depending
on target
5064 # capabilities.
Return 1 if vectorizer tests are supported by
5065 # target
, 0 otherwise.
5067 proc check_vect_support_and_set_flags
{ } {
5068 global DEFAULT_VECTCFLAGS
5069 global dg
-do-what
-default
5071 if [istarget powerpc
-*paired
*] {
5072 lappend DEFAULT_VECTCFLAGS
"-mpaired"
5073 if [check_750cl_hw_available
] {
5074 set dg
-do-what
-default run
5076 set dg
-do-what
-default
compile
5078 } elseif
[istarget powerpc
*-*-*] {
5079 # Skip targets not supporting
-maltivec.
5080 if ![is
-effective
-target powerpc_altivec_ok
] {
5084 lappend DEFAULT_VECTCFLAGS
"-maltivec"
5085 if [check_vsx_hw_available
] {
5086 lappend DEFAULT_VECTCFLAGS
"-mvsx" "-mno-allow-movmisalign"
5089 if [check_vmx_hw_available
] {
5090 set dg
-do-what
-default run
5092 if [is
-effective
-target ilp32
] {
5093 # Specify a cpu that supports VMX
for compile-only tests.
5094 lappend DEFAULT_VECTCFLAGS
"-mcpu=970"
5096 set dg
-do-what
-default
compile
5098 } elseif
{ [istarget spu
-*-*] } {
5099 set dg
-do-what
-default run
5100 } elseif
{ [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
5101 lappend DEFAULT_VECTCFLAGS
"-msse2"
5102 if { [check_effective_target_sse2_runtime
] } {
5103 set dg
-do-what
-default run
5105 set dg
-do-what
-default
compile
5107 } elseif
{ [istarget mips
*-*-*]
5108 && ([check_effective_target_mpaired_single
]
5109 ||
[check_effective_target_mips_loongson
])
5110 && [check_effective_target_nomips16
] } {
5111 if { [check_effective_target_mpaired_single
] } {
5112 lappend DEFAULT_VECTCFLAGS
"-mpaired-single"
5114 set dg
-do-what
-default run
5115 } elseif
[istarget sparc
*-*-*] {
5116 lappend DEFAULT_VECTCFLAGS
"-mcpu=ultrasparc" "-mvis"
5117 if [check_effective_target_ultrasparc_hw
] {
5118 set dg
-do-what
-default run
5120 set dg
-do-what
-default
compile
5122 } elseif
[istarget alpha
*-*-*] {
5123 # Alpha
's vectorization capabilities are extremely limited.
5124 # It's more effort than its worth disabling all of the tests
5125 # that it cannot pass. But
if you actually want to see what
5126 # does work
, command out the
return.
5129 lappend DEFAULT_VECTCFLAGS
"-mmax"
5130 if [check_alpha_max_hw_available
] {
5131 set dg
-do-what
-default run
5133 set dg
-do-what
-default
compile
5135 } elseif
[istarget ia64
-*-*] {
5136 set dg
-do-what
-default run
5137 } elseif
[is
-effective
-target arm_neon_ok
] {
5138 eval lappend DEFAULT_VECTCFLAGS
[add_options_for_arm_neon
""]
5139 # NEON does not support denormals
, so is not used
for vectorization by
5140 # default to avoid loss of precision. We must pass
-ffast
-math to test
5141 # vectorization of float operations.
5142 lappend DEFAULT_VECTCFLAGS
"-ffast-math"
5143 if [is
-effective
-target arm_neon_hw
] {
5144 set dg
-do-what
-default run
5146 set dg
-do-what
-default
compile
5148 } elseif
[istarget
"aarch64*-*-*"] {
5149 set dg
-do-what
-default run
5157 proc check_effective_target_non_strict_align
{} {
5158 return [check_no_compiler_messages non_strict_align assembly
{
5160 typedef char __attribute__
((__aligned__
(__BIGGEST_ALIGNMENT__
))) c
;
5162 void foo
(void
) { z
= (c
*) y
; }
5166 #
Return 1 if the target has
<ucontext.h
>.
5168 proc check_effective_target_ucontext_h
{ } {
5169 return [check_no_compiler_messages ucontext_h assembly
{
5170 #
include <ucontext.h
>
5174 proc check_effective_target_aarch64_tiny
{ } {
5175 if { [istarget aarch64
*-*-*] } {
5176 return [check_no_compiler_messages aarch64_tiny object
{
5177 #ifdef __AARCH64_CMODEL_TINY__
5180 #error target not AArch64 tiny code
model
5188 proc check_effective_target_aarch64_small
{ } {
5189 if { [istarget aarch64
*-*-*] } {
5190 return [check_no_compiler_messages aarch64_small object
{
5191 #ifdef __AARCH64_CMODEL_SMALL__
5194 #error target not AArch64 small code
model
5202 proc check_effective_target_aarch64_large
{ } {
5203 if { [istarget aarch64
*-*-*] } {
5204 return [check_no_compiler_messages aarch64_large object
{
5205 #ifdef __AARCH64_CMODEL_LARGE__
5208 #error target not AArch64 large code
model