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 strong aliases, 0 otherwise.
359 proc check_effective_target_alias { } {
360 if { [check_alias_available] < 2 } {
367 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
369 proc check_ifunc_available { } {
370 return [check_no_compiler_messages ifunc_available object {
375 void f() __attribute__((ifunc("g")));
379 # Returns true if --gc-sections is supported on the target.
381 proc check_gc_sections_available { } {
382 global gc_sections_available_saved
385 if {![info exists gc_sections_available_saved]} {
386 # Some targets don't support gc
-sections despite whatever
's
387 # advertised by ld's options.
388 if { [istarget alpha
*-*-*]
389 ||
[istarget ia64
-*-*] } {
390 set gc_sections_available_saved
0
394 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
396 if { [board_info target
exists ldflags
]
397 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
398 set gc_sections_available_saved
0
402 # VxWorks kernel modules are relocatable objects linked with
-r
,
403 #
while RTP executables are linked with
-q
(--emit
-relocs
).
404 # Both of these options are incompatible with
--gc
-sections.
405 if { [istarget
*-*-vxworks
*] } {
406 set gc_sections_available_saved
0
410 # Check
if the
ld used by gcc supports
--gc
-sections.
411 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
412 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
413 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
414 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
415 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
416 set gc_sections_available_saved
1
418 set gc_sections_available_saved
0
421 return $gc_sections_available_saved
424 #
Return 1 if according to target_info struct and explicit target list
425 # target is supposed to support trampolines.
427 proc check_effective_target_trampolines
{ } {
428 if [target_info
exists no_trampolines
] {
431 if { [istarget avr
-*-*]
432 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
433 ||
[istarget hppa64
-hp
-hpux11.23
] } {
439 #
Return 1 if according to target_info struct and explicit target list
440 # target is supposed to keep null pointer checks. This could be due to
441 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
443 proc check_effective_target_keeps_null_pointer_checks
{ } {
444 if [target_info
exists keeps_null_pointer_checks
] {
447 if { [istarget avr
-*-*] } {
453 #
Return true
if profiling is supported
on the target.
455 proc check_profiling_available
{ test_what
} {
456 global profiling_available_saved
458 verbose
"Profiling argument is <$test_what>" 1
460 # These conditions depend
on the
argument so examine them before
461 # looking at the
cache variable.
463 # Tree profiling requires TLS runtime support.
464 if { $test_what
== "-fprofile-generate" } {
465 if { ![check_effective_target_tls_runtime
] } {
470 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
471 # vendor compiler. We cannot reliably predict the directory where the
472 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
473 # necessarily find mcrt1.o even if we have it.
474 if { [istarget *-*-solaris2*] && $test_what == "-p" } {
478 # We don't yet support profiling
for MIPS16.
479 if { [istarget mips
*-*-*]
480 && ![check_effective_target_nomips16
]
481 && ($test_what
== "-p" || $test_what == "-pg") } {
485 # MinGW does not support
-p.
486 if { [istarget
*-*-mingw
*] && $test_what
== "-p" } {
490 # We don
't yet support profiling for AArch64.
491 if { [istarget aarch64*-*-*]
492 && ([lindex $test_what 1] == "-p"
493 || [lindex $test_what 1] == "-pg") } {
497 # cygwin does not support -p.
498 if { [istarget *-*-cygwin*] && $test_what == "-p" } {
502 # uClibc does not have gcrt1.o.
503 if { [check_effective_target_uclibc]
504 && ($test_what == "-p" || $test_what == "-pg") } {
508 # Now examine the cache variable.
509 if {![info exists profiling_available_saved]} {
510 # Some targets don't have
any implementation of __bb_init_func or are
511 # missing other needed machinery.
512 if { [istarget aarch64
*-*-elf
]
513 ||
[istarget am3
*-*-linux
*]
514 ||
[istarget arm
*-*-eabi
*]
515 ||
[istarget arm
*-*-elf
]
516 ||
[istarget arm
*-*-symbianelf
*]
517 ||
[istarget avr
-*-*]
518 ||
[istarget bfin
-*-*]
519 ||
[istarget cris
-*-*]
520 ||
[istarget crisv32
-*-*]
521 ||
[istarget fido
-*-elf
]
522 ||
[istarget h8300
-*-*]
523 ||
[istarget lm32
-*-*]
524 ||
[istarget m32c
-*-elf
]
525 ||
[istarget m68k
-*-elf
]
526 ||
[istarget m68k
-*-uclinux
*]
527 ||
[istarget mep
-*-elf
]
528 ||
[istarget mips
*-*-elf
*]
529 ||
[istarget mmix
-*-*]
530 ||
[istarget mn10300
-*-elf
*]
531 ||
[istarget moxie
-*-elf
*]
532 ||
[istarget picochip
-*-*]
533 ||
[istarget powerpc
-*-eabi
*]
534 ||
[istarget powerpc
-*-elf
]
536 ||
[istarget tic6x
-*-elf
]
537 ||
[istarget xstormy16
-*]
538 ||
[istarget xtensa
*-*-elf
]
539 ||
[istarget
*-*-rtems
*]
540 ||
[istarget
*-*-vxworks
*] } {
541 set profiling_available_saved
0
543 set profiling_available_saved
1
547 return $profiling_available_saved
550 # Check to see
if a target is
"freestanding". This is as per the definition
551 # in Section
4 of C99 standard. Effectively
, it is a target which supports no
552 # extra headers or libraries other than what is considered essential.
553 proc check_effective_target_freestanding
{ } {
554 if { [istarget picochip
-*-*] } then {
561 #
Return 1 if target has packed layout of structure members by
562 # default
, 0 otherwise. Note that this is slightly different than
563 # whether the target has
"natural alignment": both attributes may be
566 proc check_effective_target_default_packed
{ } {
567 return [check_no_compiler_messages default_packed assembly
{
568 struct x
{ char a
; long b
; } c
;
569 int s
[sizeof
(c
) == sizeof
(char
) + sizeof
(long
) ?
1 : -1];
573 #
Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
574 # documentation
, where the test also comes from.
576 proc check_effective_target_pcc_bitfield_type_matters
{ } {
577 # PCC_BITFIELD_TYPE_MATTERS isn
't just about unnamed or empty
578 # bitfields, but let's stick to the example code from the docs.
579 return [check_no_compiler_messages pcc_bitfield_type_matters assembly
{
580 struct foo1
{ char x
; char
:0; char y
; };
581 struct foo2
{ char x
; int :0; char y
; };
582 int s
[sizeof
(struct foo1
) != sizeof
(struct foo2
) ?
1 : -1];
586 # Add to FLAGS all the target
-specific flags needed to use thread
-local storage.
588 proc add_options_for_tls
{ flags
} {
589 #
On Solaris
9, __tls_get_addr
/___tls_get_addr only lives in
590 # libthread
, so always pass
-pthread
for native TLS. Same
for AIX.
591 # Need to duplicate native TLS check from
592 # check_effective_target_tls_native to avoid recursion.
593 if { ([istarget
*-*-solaris2.9
*] ||
[istarget powerpc
-ibm
-aix
*]) &&
594 [check_no_messages_and_pattern tls_native
"!emutls" assembly {
596 int f
(void
) { return i
; }
597 void g
(int j
) { i
= j
; }
599 return "$flags -pthread"
604 #
Return 1 if thread local storage
(TLS
) is supported
, 0 otherwise.
606 proc check_effective_target_tls
{} {
607 return [check_no_compiler_messages tls assembly
{
609 int f
(void
) { return i
; }
610 void g
(int j
) { i
= j
; }
614 #
Return 1 if *native
* thread local storage
(TLS
) is supported
, 0 otherwise.
616 proc check_effective_target_tls_native
{} {
617 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
618 # functions
, so we fail to automatically detect it.
619 if { [istarget
*-*-vxworks
*] } {
623 return [check_no_messages_and_pattern tls_native
"!emutls" assembly {
625 int f
(void
) { return i
; }
626 void g
(int j
) { i
= j
; }
630 #
Return 1 if *emulated
* thread local storage
(TLS
) is supported
, 0 otherwise.
632 proc check_effective_target_tls_emulated
{} {
633 # VxWorks uses emulated TLS machinery
, but with non
-standard helper
634 # functions
, so we fail to automatically detect it.
635 if { [istarget
*-*-vxworks
*] } {
639 return [check_no_messages_and_pattern tls_emulated
"emutls" assembly {
641 int f
(void
) { return i
; }
642 void g
(int j
) { i
= j
; }
646 #
Return 1 if TLS executables can run correctly
, 0 otherwise.
648 proc check_effective_target_tls_runtime
{} {
649 return [check_runtime tls_runtime
{
650 __thread
int thr
= 0;
651 int main
(void
) { return thr
; }
652 } [add_options_for_tls
""]]
655 #
Return 1 if atomic compare
-and
-swap is supported
on 'int'
657 proc check_effective_target_cas_char
{} {
658 return [check_no_compiler_messages cas_char assembly
{
659 #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
665 proc check_effective_target_cas_int
{} {
666 return [check_no_compiler_messages cas_int assembly
{
667 #
if __INT_MAX__
== 0x7fff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
669 #elif __INT_MAX__
== 0x7fffffff && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
677 #
Return 1 if -ffunction
-sections is supported
, 0 otherwise.
679 proc check_effective_target_function_sections
{} {
680 # Darwin has its own scheme and silently accepts
-ffunction
-sections.
681 if { [istarget
*-*-darwin
*] } {
685 return [check_no_compiler_messages functionsections assembly
{
687 } "-ffunction-sections"]
690 #
Return 1 if instruction scheduling is available
, 0 otherwise.
692 proc check_effective_target_scheduling
{} {
693 return [check_no_compiler_messages scheduling object
{
695 } "-fschedule-insns"]
698 #
Return 1 if compilation with
-fgraphite is error
-free
for trivial
701 proc check_effective_target_fgraphite
{} {
702 return [check_no_compiler_messages fgraphite object
{
707 #
Return 1 if compilation with
-fopenmp is error
-free
for trivial
710 proc check_effective_target_fopenmp
{} {
711 return [check_no_compiler_messages fopenmp object
{
716 #
Return 1 if compilation with
-fgnu
-tm is error
-free
for trivial
719 proc check_effective_target_fgnu_tm
{} {
720 return [check_no_compiler_messages fgnu_tm object
{
725 #
Return 1 if the target supports mmap
, 0 otherwise.
727 proc check_effective_target_mmap
{} {
728 return [check_function_available
"mmap"]
731 #
Return 1 if the target supports dlopen
, 0 otherwise.
732 proc check_effective_target_dlopen
{} {
733 return [check_function_available
"dlopen"]
736 #
Return 1 if the target supports clone
, 0 otherwise.
737 proc check_effective_target_clone
{} {
738 return [check_function_available
"clone"]
741 #
Return 1 if the target supports setrlimit
, 0 otherwise.
742 proc check_effective_target_setrlimit
{} {
743 # Darwin has non
-posix compliant RLIMIT_AS
744 if { [istarget
*-*-darwin
*] } {
747 return [check_function_available
"setrlimit"]
750 #
Return 1 if the target supports swapcontext
, 0 otherwise.
751 proc check_effective_target_swapcontext
{} {
752 return [check_no_compiler_messages swapcontext executable
{
753 #
include <ucontext.h
>
756 ucontext_t orig_context
,child_context
;
757 if (swapcontext
(&child_context
, &orig_context
) < 0) { }
762 #
Return 1 if compilation with
-pthread is error
-free
for trivial
765 proc check_effective_target_pthread
{} {
766 return [check_no_compiler_messages pthread object
{
771 #
Return 1 if compilation with
-mpe
-aligned
-commons is error
-free
772 #
for trivial code
, 0 otherwise.
774 proc check_effective_target_pe_aligned_commons
{} {
775 if { [istarget
*-*-cygwin
*] ||
[istarget
*-*-mingw
*] } {
776 return [check_no_compiler_messages pe_aligned_commons object
{
778 } "-mpe-aligned-commons"]
783 #
Return 1 if the target supports
-static
784 proc check_effective_target_static
{} {
785 return [check_no_compiler_messages static executable
{
786 int main
(void
) { return 0; }
790 #
Return 1 if the target supports
-fstack
-protector
791 proc check_effective_target_fstack_protector
{} {
792 return [check_runtime fstack_protector
{
793 int main
(void
) { return 0; }
794 } "-fstack-protector"]
797 #
Return 1 if compilation with
-freorder
-blocks
-and
-partition is error
-free
798 #
for trivial code
, 0 otherwise.
800 proc check_effective_target_freorder
{} {
801 return [check_no_compiler_messages freorder object
{
803 } "-freorder-blocks-and-partition"]
806 #
Return 1 if -fpic and
-fPIC are supported
, as in no warnings or errors
807 # emitted
, 0 otherwise. Whether a shared library can actually be built is
808 # out of scope
for this test.
810 proc check_effective_target_fpic
{ } {
811 # Note that M68K has a multilib that supports
-fpic but not
812 #
-fPIC
, so we need to check both. We test with a
program that
813 # requires GOT references.
814 foreach
arg {fpic fPIC
} {
815 if [check_no_compiler_messages $
arg object
{
816 extern
int foo
(void
); extern
int bar
;
817 int baz
(void
) { return foo
() + bar
; }
825 #
Return 1 if -pie
, -fpie and
-fPIE are supported
, 0 otherwise.
827 proc check_effective_target_pie
{ } {
828 if { [istarget
*-*-darwin\
[912\
]*]
829 ||
[istarget
*-*-linux
*] } {
835 #
Return true
if the target supports
-mpaired
-single
(as used
on MIPS
).
837 proc check_effective_target_mpaired_single
{ } {
838 return [check_no_compiler_messages mpaired_single object
{
843 #
Return true
if the target has access to FPU instructions.
845 proc check_effective_target_hard_float
{ } {
846 if { [istarget mips
*-*-*] } {
847 return [check_no_compiler_messages hard_float assembly
{
848 #
if (defined __mips_soft_float || defined __mips16
)
854 # This proc is actually checking the availabilty of FPU
855 # support
for doubles
, so
on the RX we must fail
if the
856 #
64-bit double multilib has been selected.
857 if { [istarget rx
-*-*] } {
859 #
return [check_no_compiler_messages hard_float assembly
{
860 #
if defined __RX_64_BIT_DOUBLES__
866 # The generic test equates hard_float with
"no call for adding doubles".
867 return [check_no_messages_and_pattern hard_float
"!\\(call" rtl-expand {
868 double a
(double b
, double c
) { return b
+ c
; }
872 #
Return true
if the target is a
64-bit MIPS target.
874 proc check_effective_target_mips64
{ } {
875 return [check_no_compiler_messages mips64 assembly
{
882 #
Return true
if the target is a MIPS target that does not produce
885 proc check_effective_target_nomips16
{ } {
886 return [check_no_compiler_messages nomips16 object
{
890 /* A cheap way of testing
for -mflip
-mips16.
*/
891 void foo
(void
) { asm
("addiu $20,$20,1"); }
892 void bar
(void
) { asm
("addiu $20,$20,1"); }
897 # Add the options needed
for MIPS16 function attributes. At the moment
,
898 # we don
't support MIPS16 PIC.
900 proc add_options_for_mips16_attribute { flags } {
901 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
904 # Return true if we can force a mode that allows MIPS16 code generation.
905 # We don't support MIPS16 PIC
, and only support MIPS16
-mhard
-float
908 proc check_effective_target_mips16_attribute
{ } {
909 return [check_no_compiler_messages mips16_attribute assembly
{
913 #
if defined __mips_hard_float \
914 && (!defined _ABIO32 || _MIPS_SIM
!= _ABIO32
) \
915 && (!defined _ABIO64 || _MIPS_SIM
!= _ABIO64
)
918 } [add_options_for_mips16_attribute
""]]
921 #
Return 1 if the target supports long double larger than double when
922 # using the new ABI
, 0 otherwise.
924 proc check_effective_target_mips_newabi_large_long_double
{ } {
925 return [check_no_compiler_messages mips_newabi_large_long_double object
{
926 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
930 #
Return true
if the target is a MIPS target that has access
931 # to the LL and SC instructions.
933 proc check_effective_target_mips_llsc
{ } {
934 if { ![istarget mips
*-*-*] } {
937 # Assume that these instructions are always implemented
for
938 # non
-elf
* targets
, via emulation
if necessary.
939 if { ![istarget
*-*-elf
*] } {
942 # Otherwise assume LL
/SC support
for everything but MIPS I.
943 return [check_no_compiler_messages mips_llsc assembly
{
950 #
Return true
if the target is a MIPS target that uses in
-place relocations.
952 proc check_effective_target_mips_rel
{ } {
953 if { ![istarget mips
*-*-*] } {
956 return [check_no_compiler_messages mips_rel object
{
957 #
if (defined _ABIN32
&& _MIPS_SIM
== _ABIN32
) \
958 ||
(defined _ABI64
&& _MIPS_SIM
== _ABI64
)
964 #
Return true
if the target is a MIPS target that uses the EABI.
966 proc check_effective_target_mips_eabi
{ } {
967 if { ![istarget mips
*-*-*] } {
970 return [check_no_compiler_messages mips_eabi object
{
977 #
Return 1 if the current multilib does not generate PIC by default.
979 proc check_effective_target_nonpic
{ } {
980 return [check_no_compiler_messages nonpic assembly
{
987 #
Return 1 if the target does not use a
status wrapper.
989 proc check_effective_target_unwrapped
{ } {
990 if { [target_info needs_status_wrapper
] != "" \
991 && [target_info needs_status_wrapper
] != "0" } {
997 #
Return true
if iconv is supported
on the target. In particular IBM1047.
999 proc check_iconv_available
{ test_what
} {
1002 #
If the tool configuration file has not
set libiconv
, try
"-liconv"
1003 if { ![info exists libiconv
] } {
1004 set libiconv
"-liconv"
1006 set test_what
[lindex $test_what
1]
1007 return [check_runtime_nocache $test_what
[subst
{
1013 cd
= iconv_open
("$test_what", "UTF-8");
1014 if (cd
== (iconv_t
) -1)
1021 #
Return 1 if an ASCII locale is supported
on this host
, 0 otherwise.
1023 proc check_ascii_locale_available
{ } {
1027 #
Return true
if named sections are supported
on this target.
1029 proc check_named_sections_available
{ } {
1030 return [check_no_compiler_messages named_sections assembly
{
1031 int __attribute__
((section
("whatever"))) foo;
1035 #
Return true
if the
"naked" function attribute is supported on this target.
1037 proc check_effective_target_naked_functions
{ } {
1038 return [check_no_compiler_messages naked_functions assembly
{
1039 void f
() __attribute__
((naked
));
1043 #
Return 1 if the target supports Fortran real kinds larger than real
(8),
1046 # When the target
name changes
, replace the cached result.
1048 proc check_effective_target_fortran_large_real
{ } {
1049 return [check_no_compiler_messages fortran_large_real executable
{
1051 integer,parameter
:: k
= selected_real_kind
(precision
(0.0_8
) + 1)
1058 #
Return 1 if the target supports Fortran real kind real
(16),
1059 #
0 otherwise. Contrary to check_effective_target_fortran_large_real
1060 # this checks
for Real
(16) only
; the other returned real
(10) if
1061 # both real
(10) and real
(16) are available.
1063 # When the target
name changes
, replace the cached result.
1065 proc check_effective_target_fortran_real_16
{ } {
1066 return [check_no_compiler_messages fortran_real_16 executable
{
1075 #
Return 1 if the target supports
SQRT for the
largest floating
-point
1076 # type.
(Some targets lack the libm support
for this FP type.
)
1077 #
On most targets
, this check effectively checks either whether sqrtl is
1078 # available or
on __float128 systems whether libquadmath is installed
,
1079 # which provides sqrtq.
1081 # When the target
name changes
, replace the cached result.
1083 proc check_effective_target_fortran_largest_fp_has_sqrt
{ } {
1084 return [check_no_compiler_messages fortran_largest_fp_has_sqrt executable
{
1086 use iso_fortran_env
, only
: real_kinds
1087 integer,parameter
:: maxFP
= real_kinds
(ubound
(real_kinds
,dim
=1))
1088 real
(kind
=maxFP
), volatile
:: x
1096 #
Return 1 if the target supports Fortran
integer kinds larger than
1097 #
integer(8), 0 otherwise.
1099 # When the target
name changes
, replace the cached result.
1101 proc check_effective_target_fortran_large_int
{ } {
1102 return [check_no_compiler_messages fortran_large_int executable
{
1104 integer,parameter
:: k
= selected_int_kind
(range
(0_8
) + 1)
1105 integer(kind
=k
) :: i
1110 #
Return 1 if the target supports Fortran
integer(16), 0 otherwise.
1112 # When the target
name changes
, replace the cached result.
1114 proc check_effective_target_fortran_integer_16
{ } {
1115 return [check_no_compiler_messages fortran_integer_16 executable
{
1122 #
Return 1 if we can statically link libgfortran
, 0 otherwise.
1124 # When the target
name changes
, replace the cached result.
1126 proc check_effective_target_static_libgfortran
{ } {
1127 return [check_no_compiler_messages static_libgfortran executable
{
1134 proc check_linker_plugin_available
{ } {
1135 return [check_no_compiler_messages_nocache linker_plugin executable
{
1136 int main
() { return 0; }
1137 } "-flto -fuse-linker-plugin"]
1140 #
Return 1 if the target supports executing
750CL paired
-single instructions
, 0
1141 # otherwise.
Cache the result.
1143 proc check_750cl_hw_available
{ } {
1144 return [check_cached_effective_target
750cl_hw_available
{
1145 #
If this is not the right target
then we can skip the test.
1146 if { ![istarget powerpc
-*paired
*] } {
1149 check_runtime_nocache
750cl_hw_available
{
1153 asm volatile
("ps_mul v0,v0,v0");
1155 asm volatile
("ps_mul 0,0,0");
1164 #
Return 1 if the target OS supports running SSE executables
, 0
1165 # otherwise.
Cache the result.
1167 proc check_sse_os_support_available
{ } {
1168 return [check_cached_effective_target sse_os_support_available
{
1169 #
If this is not the right target
then we can skip the test.
1170 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1172 } elseif
{ [istarget i?
86-*-solaris2
*] } {
1173 # The Solaris
2 kernel doesn
't save and restore SSE registers
1174 # before Solaris 9 4/04. Before that, executables die with SIGILL.
1175 check_runtime_nocache sse_os_support_available {
1178 asm volatile ("movaps %xmm0,%xmm0");
1188 # Return 1 if the target OS supports running AVX executables, 0
1189 # otherwise. Cache the result.
1191 proc check_avx_os_support_available { } {
1192 return [check_cached_effective_target avx_os_support_available {
1193 # If this is not the right target then we can skip the test.
1194 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1197 # Check that OS has AVX and SSE saving enabled.
1198 check_runtime_nocache avx_os_support_available {
1201 unsigned int eax, edx;
1203 asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
1204 return (eax & 6) != 6;
1211 # Return 1 if the target supports executing SSE instructions, 0
1212 # otherwise. Cache the result.
1214 proc check_sse_hw_available { } {
1215 return [check_cached_effective_target sse_hw_available {
1216 # If this is not the right target then we can skip the test.
1217 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1220 check_runtime_nocache sse_hw_available {
1224 unsigned int eax, ebx, ecx, edx;
1225 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1226 return !(edx & bit_SSE);
1234 # Return 1 if the target supports executing SSE2 instructions, 0
1235 # otherwise. Cache the result.
1237 proc check_sse2_hw_available { } {
1238 return [check_cached_effective_target sse2_hw_available {
1239 # If this is not the right target then we can skip the test.
1240 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1243 check_runtime_nocache sse2_hw_available {
1247 unsigned int eax, ebx, ecx, edx;
1248 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1249 return !(edx & bit_SSE2);
1257 # Return 1 if the target supports executing AVX instructions, 0
1258 # otherwise. Cache the result.
1260 proc check_avx_hw_available { } {
1261 return [check_cached_effective_target avx_hw_available {
1262 # If this is not the right target then we can skip the test.
1263 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1266 check_runtime_nocache avx_hw_available {
1270 unsigned int eax, ebx, ecx, edx;
1271 if (__get_cpuid (1, &eax, &ebx, &ecx, &edx))
1272 return ((ecx & (bit_AVX | bit_OSXSAVE))
1273 != (bit_AVX | bit_OSXSAVE));
1281 # Return 1 if the target supports running SSE executables, 0 otherwise.
1283 proc check_effective_target_sse_runtime { } {
1284 if { [check_effective_target_sse]
1285 && [check_sse_hw_available]
1286 && [check_sse_os_support_available] } {
1292 # Return 1 if the target supports running SSE2 executables, 0 otherwise.
1294 proc check_effective_target_sse2_runtime { } {
1295 if { [check_effective_target_sse2]
1296 && [check_sse2_hw_available]
1297 && [check_sse_os_support_available] } {
1303 # Return 1 if the target supports running AVX executables, 0 otherwise.
1305 proc check_effective_target_avx_runtime { } {
1306 if { [check_effective_target_avx]
1307 && [check_avx_hw_available]
1308 && [check_avx_os_support_available] } {
1314 # Return 1 if the target supports executing VSX instructions, 0
1315 # otherwise. Cache the result.
1317 proc check_vsx_hw_available { } {
1318 return [check_cached_effective_target vsx_hw_available {
1319 # Some simulators are known to not support VSX instructions.
1320 # For now, disable on Darwin
1321 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1325 check_runtime_nocache vsx_hw_available {
1329 asm volatile ("xxlor vs0,vs0,vs0");
1331 asm volatile ("xxlor 0,0,0");
1340 # Return 1 if the target supports executing AltiVec instructions, 0
1341 # otherwise. Cache the result.
1343 proc check_vmx_hw_available { } {
1344 return [check_cached_effective_target vmx_hw_available {
1345 # Some simulators are known to not support VMX instructions.
1346 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] } {
1349 # Most targets don't require special flags
for this test case
, but
1350 # Darwin does. Just to be sure
, make sure VSX is not enabled
for
1351 # the altivec tests.
1352 if { [istarget
*-*-darwin
*]
1353 ||
[istarget
*-*-aix
*] } {
1354 set options
"-maltivec -mno-vsx"
1356 set options
"-mno-vsx"
1358 check_runtime_nocache vmx_hw_available
{
1362 asm volatile
("vor v0,v0,v0");
1364 asm volatile
("vor 0,0,0");
1373 proc check_ppc_recip_hw_available
{ } {
1374 return [check_cached_effective_target ppc_recip_hw_available
{
1375 # Some simulators may not support FRE
/FRES
/FRSQRTE
/FRSQRTES
1376 #
For now
, disable
on Darwin
1377 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1380 set options
"-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1381 check_runtime_nocache ppc_recip_hw_available
{
1382 volatile double d_recip
, d_rsqrt
, d_four
= 4.0;
1383 volatile float f_recip
, f_rsqrt
, f_four
= 4.0f
;
1386 asm volatile
("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1387 asm volatile
("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1388 asm volatile
("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1389 asm volatile
("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1397 #
Return 1 if the target supports executing AltiVec and Cell PPU
1398 # instructions
, 0 otherwise.
Cache the result.
1400 proc check_effective_target_cell_hw
{ } {
1401 return [check_cached_effective_target cell_hw_available
{
1402 # Some simulators are known to not support VMX and PPU instructions.
1403 if { [istarget powerpc
-*-eabi
*] } {
1406 # Most targets don
't require special flags for this test
1407 # case, but Darwin and AIX do.
1408 if { [istarget *-*-darwin*]
1409 || [istarget *-*-aix*] } {
1410 set options "-maltivec -mcpu=cell"
1412 set options "-mcpu=cell"
1414 check_runtime_nocache cell_hw_available {
1418 asm volatile ("vor v0,v0,v0");
1419 asm volatile ("lvlx v0,r0,r0");
1421 asm volatile ("vor 0,0,0");
1422 asm volatile ("lvlx 0,0,0");
1431 # Return 1 if the target supports executing 64-bit instructions, 0
1432 # otherwise. Cache the result.
1434 proc check_effective_target_powerpc64 { } {
1435 global powerpc64_available_saved
1438 if [info exists powerpc64_available_saved] {
1439 verbose "check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1441 set powerpc64_available_saved 0
1443 # Some simulators are known to not support powerpc64 instructions.
1444 if { [istarget powerpc-*-eabi*] || [istarget powerpc-ibm-aix*] } {
1445 verbose "check_effective_target_powerpc64 returning 0" 2
1446 return $powerpc64_available_saved
1449 # Set up, compile, and execute a test program containing a 64-bit
1450 # instruction. Include the current process ID in the file
1451 # names to prevent conflicts with invocations for multiple
1456 set f [open $src "w"]
1457 puts $f "int main() {"
1458 puts $f "#ifdef __MACH__"
1459 puts $f " asm volatile (\"extsw r0,r0\");"
1461 puts $f " asm volatile (\"extsw 0,0\");"
1463 puts $f " return 0; }"
1466 set opts "additional_flags=-mcpu=G5"
1468 verbose "check_effective_target_powerpc64 compiling testfile $src" 2
1469 set lines [${tool}_target_compile $src $exe executable "$opts"]
1472 if [string match "" $lines] then {
1473 # No error message, compilation succeeded.
1474 set result [${tool}_load "./$exe" "" ""]
1475 set status [lindex $result 0]
1476 remote_file build delete $exe
1477 verbose "check_effective_target_powerpc64 testfile status is <$status>" 2
1479 if { $status == "pass" } then {
1480 set powerpc64_available_saved 1
1483 verbose "check_effective_target_powerpc64 testfile compilation failed" 2
1487 return $powerpc64_available_saved
1490 # GCC 3.4.0 for powerpc64-*-linux* included an ABI fix for passing
1491 # complex float arguments. This affects gfortran tests that call cabsf
1492 # in libm built by an earlier compiler. Return 1 if libm uses the same
1493 # argument passing as the compiler under test, 0 otherwise.
1495 # When the target name changes, replace the cached result.
1497 proc check_effective_target_broken_cplxf_arg { } {
1498 return [check_cached_effective_target broken_cplxf_arg {
1499 # Skip the work for targets known not to be affected.
1500 if { ![istarget powerpc64-*-linux*] } {
1502 } elseif { ![is-effective-target lp64] } {
1505 check_runtime_nocache broken_cplxf_arg {
1506 #include <complex.h>
1507 extern void abort (void);
1508 float fabsf (float);
1509 float cabsf (_Complex float);
1516 if (fabsf (f - 5.0) > 0.0001)
1525 # Return 1 is this is a TI C6X target supporting C67X instructions
1526 proc check_effective_target_ti_c67x { } {
1527 return [check_no_compiler_messages ti_c67x assembly {
1528 #if !defined(_TMS320C6700)
1534 # Return 1 is this is a TI C6X target supporting C64X+ instructions
1535 proc check_effective_target_ti_c64xp { } {
1536 return [check_no_compiler_messages ti_c64xp assembly {
1537 #if !defined(_TMS320C6400_PLUS)
1544 proc check_alpha_max_hw_available { } {
1545 return [check_runtime alpha_max_hw_available {
1546 int main() { return __builtin_alpha_amask(1<<8) != 0; }
1550 # Returns true iff the FUNCTION is available on the target system.
1551 # (This is essentially a Tcl implementation of Autoconf's
1554 proc check_function_available
{ function
} {
1555 return [check_no_compiler_messages $
{function
}_available \
1561 int main
() { $function
(); }
1565 # Returns true iff
"fork" is available on the target system.
1567 proc check_fork_available
{} {
1568 return [check_function_available
"fork"]
1571 # Returns true iff
"mkfifo" is available on the target system.
1573 proc check_mkfifo_available
{} {
1574 if { [istarget
*-*-cygwin
*] } {
1575 # Cygwin has mkfifo
, but support is incomplete.
1579 return [check_function_available
"mkfifo"]
1582 # Returns true iff
"__cxa_atexit" is used on the target system.
1584 proc check_cxa_atexit_available
{ } {
1585 return [check_cached_effective_target cxa_atexit_available
{
1586 if { [istarget hppa
*-*-hpux10
*] } {
1587 # HP
-UX
10 doesn
't have __cxa_atexit but subsequent test passes.
1589 } elseif { [istarget *-*-vxworks] } {
1590 # vxworks doesn't have __cxa_atexit but subsequent test passes.
1593 check_runtime_nocache cxa_atexit_available
{
1596 static unsigned
int count;
1613 Y
() { f
(); count = 2; }
1622 int main
() { return 0; }
1628 proc check_effective_target_objc2
{ } {
1629 return [check_no_compiler_messages objc2 object
{
1638 proc check_effective_target_next_runtime
{ } {
1639 return [check_no_compiler_messages objc2 object
{
1640 #ifdef __NEXT_RUNTIME__
1648 #
Return 1 if we
're generating 32-bit code using default options, 0
1651 proc check_effective_target_ilp32 { } {
1652 return [check_no_compiler_messages ilp32 object {
1653 int dummy[sizeof (int) == 4
1654 && sizeof (void *) == 4
1655 && sizeof (long) == 4 ? 1 : -1];
1659 # Return 1 if we're generating ia32 code using default options
, 0
1662 proc check_effective_target_ia32
{ } {
1663 return [check_no_compiler_messages ia32 object
{
1664 int dummy
[sizeof
(int) == 4
1665 && sizeof
(void
*) == 4
1666 && sizeof
(long
) == 4 ?
1 : -1] = { __i386__
};
1670 #
Return 1 if we
're generating x32 code using default options, 0
1673 proc check_effective_target_x32 { } {
1674 return [check_no_compiler_messages x32 object {
1675 int dummy[sizeof (int) == 4
1676 && sizeof (void *) == 4
1677 && sizeof (long) == 4 ? 1 : -1] = { __x86_64__ };
1681 # Return 1 if we're generating
32-bit or larger integers using default
1682 # options
, 0 otherwise.
1684 proc check_effective_target_int32plus
{ } {
1685 return [check_no_compiler_messages int32plus object
{
1686 int dummy
[sizeof
(int) >= 4 ?
1 : -1];
1690 #
Return 1 if we
're generating 32-bit or larger pointers using default
1691 # options, 0 otherwise.
1693 proc check_effective_target_ptr32plus { } {
1694 return [check_no_compiler_messages ptr32plus object {
1695 int dummy[sizeof (void *) >= 4 ? 1 : -1];
1699 # Return 1 if we support 32-bit or larger array and structure sizes
1700 # using default options, 0 otherwise.
1702 proc check_effective_target_size32plus { } {
1703 return [check_no_compiler_messages size32plus object {
1708 # Returns 1 if we're generating
16-bit or smaller integers with the
1709 # default options
, 0 otherwise.
1711 proc check_effective_target_int16
{ } {
1712 return [check_no_compiler_messages int16 object
{
1713 int dummy
[sizeof
(int) < 4 ?
1 : -1];
1717 #
Return 1 if we
're generating 64-bit code using default options, 0
1720 proc check_effective_target_lp64 { } {
1721 return [check_no_compiler_messages lp64 object {
1722 int dummy[sizeof (int) == 4
1723 && sizeof (void *) == 8
1724 && sizeof (long) == 8 ? 1 : -1];
1728 # Return 1 if we're generating
64-bit code using default llp64 options
,
1731 proc check_effective_target_llp64
{ } {
1732 return [check_no_compiler_messages llp64 object
{
1733 int dummy
[sizeof
(int) == 4
1734 && sizeof
(void
*) == 8
1735 && sizeof
(long long
) == 8
1736 && sizeof
(long
) == 4 ?
1 : -1];
1740 #
Return 1 if long and
int have different sizes
,
1743 proc check_effective_target_long_neq_int
{ } {
1744 return [check_no_compiler_messages long_ne_int object
{
1745 int dummy
[sizeof
(int) != sizeof
(long
) ?
1 : -1];
1749 #
Return 1 if the target supports long double larger than double
,
1752 proc check_effective_target_large_long_double
{ } {
1753 return [check_no_compiler_messages large_long_double object
{
1754 int dummy
[sizeof
(long double
) > sizeof
(double
) ?
1 : -1];
1758 #
Return 1 if the target supports double larger than float
,
1761 proc check_effective_target_large_double
{ } {
1762 return [check_no_compiler_messages large_double object
{
1763 int dummy
[sizeof
(double
) > sizeof
(float
) ?
1 : -1];
1767 #
Return 1 if the target supports double of
64 bits
,
1770 proc check_effective_target_double64
{ } {
1771 return [check_no_compiler_messages double64 object
{
1772 int dummy
[sizeof
(double
) == 8 ?
1 : -1];
1776 #
Return 1 if the target supports double of at least
64 bits
,
1779 proc check_effective_target_double64plus
{ } {
1780 return [check_no_compiler_messages double64plus object
{
1781 int dummy
[sizeof
(double
) >= 8 ?
1 : -1];
1785 #
Return 1 if the target supports
'w' suffix
on floating constant
1788 proc check_effective_target_has_w_floating_suffix
{ } {
1790 if [check_effective_target_c
++] {
1791 append opts
"-std=gnu++03"
1793 return [check_no_compiler_messages w_fp_suffix object
{
1798 #
Return 1 if the target supports
'q' suffix
on floating constant
1801 proc check_effective_target_has_q_floating_suffix
{ } {
1803 if [check_effective_target_c
++] {
1804 append opts
"-std=gnu++03"
1806 return [check_no_compiler_messages q_fp_suffix object
{
1810 #
Return 1 if the target supports compiling fixed
-point
,
1813 proc check_effective_target_fixed_point
{ } {
1814 return [check_no_compiler_messages fixed_point object
{
1815 _Sat _Fract x
; _Sat _Accum y
;
1819 #
Return 1 if the target supports compiling decimal floating point
,
1822 proc check_effective_target_dfp_nocache
{ } {
1823 verbose
"check_effective_target_dfp_nocache: compiling source" 2
1824 set ret
[check_no_compiler_messages_nocache dfp object
{
1825 float x __attribute__
((mode(DD
)));
1827 verbose
"check_effective_target_dfp_nocache: returning $ret" 2
1831 proc check_effective_target_dfprt_nocache
{ } {
1832 return [check_runtime_nocache dfprt
{
1833 typedef float d64 __attribute__
((mode(DD
)));
1834 d64 x
= 1.2df
, y
= 2.3dd
, z
;
1835 int main
() { z
= x
+ y
; return 0; }
1839 #
Return 1 if the target supports compiling Decimal Floating Point
,
1842 # This won
't change for different subtargets so cache the result.
1844 proc check_effective_target_dfp { } {
1845 return [check_cached_effective_target dfp {
1846 check_effective_target_dfp_nocache
1850 # Return 1 if the target supports linking and executing Decimal Floating
1851 # Point, 0 otherwise.
1853 # This won't change
for different subtargets so
cache the result.
1855 proc check_effective_target_dfprt
{ } {
1856 return [check_cached_effective_target dfprt
{
1857 check_effective_target_dfprt_nocache
1861 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1863 proc check_effective_target_ucn_nocache
{ } {
1864 #
-std
=c99 is only valid
for C
1865 if [check_effective_target_c
] {
1866 set ucnopts
"-std=c99"
1868 append ucnopts
" -fextended-identifiers"
1869 verbose
"check_effective_target_ucn_nocache: compiling source" 2
1870 set ret
[check_no_compiler_messages_nocache ucn object
{
1873 verbose
"check_effective_target_ucn_nocache: returning $ret" 2
1877 #
Return 1 if the target supports compiling and assembling UCN
, 0 otherwise.
1879 # This won
't change for different subtargets, so cache the result.
1881 proc check_effective_target_ucn { } {
1882 return [check_cached_effective_target ucn {
1883 check_effective_target_ucn_nocache
1887 # Return 1 if the target needs a command line argument to enable a SIMD
1890 proc check_effective_target_vect_cmdline_needed { } {
1891 global et_vect_cmdline_needed_saved
1892 global et_vect_cmdline_needed_target_name
1894 if { ![info exists et_vect_cmdline_needed_target_name] } {
1895 set et_vect_cmdline_needed_target_name ""
1898 # If the target has changed since we set the cached value, clear it.
1899 set current_target [current_target_name]
1900 if { $current_target != $et_vect_cmdline_needed_target_name } {
1901 verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target
'" 2
1902 set et_vect_cmdline_needed_target_name $current_target
1903 if { [info exists et_vect_cmdline_needed_saved] } {
1904 verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2
1905 unset et_vect_cmdline_needed_saved
1909 if [info exists et_vect_cmdline_needed_saved] {
1910 verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
1912 set et_vect_cmdline_needed_saved 1
1913 if { [istarget alpha*-*-*]
1914 || [istarget ia64-*-*]
1915 || (([istarget x86_64-*-*] || [istarget i?86-*-*])
1916 && ([check_effective_target_x32]
1917 || [check_effective_target_lp64]))
1918 || ([istarget powerpc*-*-*]
1919 && ([check_effective_target_powerpc_spe]
1920 || [check_effective_target_powerpc_altivec]))
1921 || ([istarget sparc*-*-*] && [check_effective_target_sparc_vis])
1922 || [istarget spu-*-*]
1923 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
1924 set et_vect_cmdline_needed_saved 0
1928 verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1929 return $et_vect_cmdline_needed_saved
1932 # Return 1 if the target supports hardware vectors of int, 0 otherwise.
1934 # This won't change
for different subtargets so
cache the result.
1936 proc check_effective_target_vect_int
{ } {
1937 global et_vect_int_saved
1939 if [info exists et_vect_int_saved
] {
1940 verbose
"check_effective_target_vect_int: using cached result" 2
1942 set et_vect_int_saved
0
1943 if { [istarget i?
86-*-*]
1944 ||
([istarget powerpc
*-*-*]
1945 && ![istarget powerpc
-*-linux
*paired
*])
1946 ||
[istarget spu
-*-*]
1947 ||
[istarget x86_64
-*-*]
1948 ||
[istarget sparc
*-*-*]
1949 ||
[istarget alpha
*-*-*]
1950 ||
[istarget ia64
-*-*]
1951 ||
[istarget aarch64
*-*-*]
1952 ||
[check_effective_target_arm32
]
1953 ||
([istarget mips
*-*-*]
1954 && [check_effective_target_mips_loongson
]) } {
1955 set et_vect_int_saved
1
1959 verbose
"check_effective_target_vect_int: returning $et_vect_int_saved" 2
1960 return $et_vect_int_saved
1963 #
Return 1 if the target supports signed
int->float conversion
1966 proc check_effective_target_vect_intfloat_cvt
{ } {
1967 global et_vect_intfloat_cvt_saved
1969 if [info exists et_vect_intfloat_cvt_saved
] {
1970 verbose
"check_effective_target_vect_intfloat_cvt: using cached result" 2
1972 set et_vect_intfloat_cvt_saved
0
1973 if { [istarget i?
86-*-*]
1974 ||
([istarget powerpc
*-*-*]
1975 && ![istarget powerpc
-*-linux
*paired
*])
1976 ||
[istarget x86_64
-*-*]
1977 ||
([istarget arm
*-*-*]
1978 && [check_effective_target_arm_neon_ok
])} {
1979 set et_vect_intfloat_cvt_saved
1
1983 verbose
"check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
1984 return $et_vect_intfloat_cvt_saved
1987 #
Return 1 if we
're supporting __int128 for target, 0 otherwise.
1989 proc check_effective_target_int128 { } {
1990 return [check_no_compiler_messages int128 object {
1992 #ifndef __SIZEOF_INT128__
2001 # Return 1 if the target supports unsigned int->float conversion
2004 proc check_effective_target_vect_uintfloat_cvt { } {
2005 global et_vect_uintfloat_cvt_saved
2007 if [info exists et_vect_uintfloat_cvt_saved] {
2008 verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
2010 set et_vect_uintfloat_cvt_saved 0
2011 if { [istarget i?86-*-*]
2012 || ([istarget powerpc*-*-*]
2013 && ![istarget powerpc-*-linux*paired*])
2014 || [istarget x86_64-*-*]
2015 || ([istarget arm*-*-*]
2016 && [check_effective_target_arm_neon_ok])} {
2017 set et_vect_uintfloat_cvt_saved 1
2021 verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
2022 return $et_vect_uintfloat_cvt_saved
2026 # Return 1 if the target supports signed float->int conversion
2029 proc check_effective_target_vect_floatint_cvt { } {
2030 global et_vect_floatint_cvt_saved
2032 if [info exists et_vect_floatint_cvt_saved] {
2033 verbose "check_effective_target_vect_floatint_cvt: using cached result" 2
2035 set et_vect_floatint_cvt_saved 0
2036 if { [istarget i?86-*-*]
2037 || ([istarget powerpc*-*-*]
2038 && ![istarget powerpc-*-linux*paired*])
2039 || [istarget x86_64-*-*]
2040 || ([istarget arm*-*-*]
2041 && [check_effective_target_arm_neon_ok])} {
2042 set et_vect_floatint_cvt_saved 1
2046 verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
2047 return $et_vect_floatint_cvt_saved
2050 # Return 1 if the target supports unsigned float->int conversion
2053 proc check_effective_target_vect_floatuint_cvt { } {
2054 global et_vect_floatuint_cvt_saved
2056 if [info exists et_vect_floatuint_cvt_saved] {
2057 verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
2059 set et_vect_floatuint_cvt_saved 0
2060 if { ([istarget powerpc*-*-*]
2061 && ![istarget powerpc-*-linux*paired*])
2062 || ([istarget arm*-*-*]
2063 && [check_effective_target_arm_neon_ok])} {
2064 set et_vect_floatuint_cvt_saved 1
2068 verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
2069 return $et_vect_floatuint_cvt_saved
2072 # Return 1 if this is a AArch64 target supporting big endian
2073 proc check_effective_target_aarch64_big_endian { } {
2074 return [check_no_compiler_messages aarch64_big_endian assembly {
2075 #if !defined(__aarch64__) || !defined(__AARCH64EB__)
2081 # Return 1 is this is an arm target using 32-bit instructions
2082 proc check_effective_target_arm32 { } {
2083 return [check_no_compiler_messages arm32 assembly {
2084 #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
2090 # Return 1 is this is an arm target not using Thumb
2091 proc check_effective_target_arm_nothumb { } {
2092 return [check_no_compiler_messages arm_nothumb assembly {
2093 #if (defined(__thumb__) || defined(__thumb2__))
2099 # Return 1 if this is a little-endian ARM target
2100 proc check_effective_target_arm_little_endian { } {
2101 return [check_no_compiler_messages arm_little_endian assembly {
2102 #if !defined(__arm__) || !defined(__ARMEL__)
2108 # Return 1 if this is an ARM target that only supports aligned vector accesses
2109 proc check_effective_target_arm_vect_no_misalign { } {
2110 return [check_no_compiler_messages arm_vect_no_misalign assembly {
2111 #if !defined(__arm__) \
2112 || (defined(__ARMEL__) \
2113 && (!defined(__thumb__) || defined(__thumb2__)))
2120 # Return 1 if this is an ARM target supporting -mfpu=vfp
2121 # -mfloat-abi=softfp. Some multilibs may be incompatible with these
2124 proc check_effective_target_arm_vfp_ok { } {
2125 if { [check_effective_target_arm32] } {
2126 return [check_no_compiler_messages arm_vfp_ok object {
2128 } "-mfpu=vfp -mfloat-abi=softfp"]
2134 # Return 1 if this is an ARM target supporting -mfpu=fp-armv8
2135 # -mfloat-abi=softfp.
2136 proc check_effective_target_arm_v8_vfp_ok {} {
2137 if { [check_effective_target_arm32] } {
2138 return [check_no_compiler_messages arm_v8_vfp_ok object {
2141 __asm__ volatile ("vrinta.f32.f32 s0, s0");
2144 } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
2150 # Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8
2151 # -mfloat-abi=softfp
2152 proc check_effective_target_arm_v8_neon_ok {} {
2153 if { [check_effective_target_arm32] } {
2154 return [check_no_compiler_messages arm_v8_neon_ok object {
2157 __asm__ volatile ("vrintn.f32 q0, q0");
2160 } "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"]
2166 # Return 1 if this is an ARM target supporting -mfpu=vfp
2167 # -mfloat-abi=hard. Some multilibs may be incompatible with these
2170 proc check_effective_target_arm_hard_vfp_ok { } {
2171 if { [check_effective_target_arm32]
2172 && ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
2173 return [check_no_compiler_messages arm_hard_vfp_ok executable {
2174 int main() { return 0;}
2175 } "-mfpu=vfp -mfloat-abi=hard"]
2181 # Return 1 if this is an ARM target that supports DSP multiply with
2182 # current multilib flags.
2184 proc check_effective_target_arm_dsp { } {
2185 return [check_no_compiler_messages arm_dsp assembly {
2186 #ifndef __ARM_FEATURE_DSP
2193 # Return 1 if this is an ARM target that supports unaligned word/halfword
2194 # load/store instructions.
2196 proc check_effective_target_arm_unaligned { } {
2197 return [check_no_compiler_messages arm_unaligned assembly {
2198 #ifndef __ARM_FEATURE_UNALIGNED
2199 #error no unaligned support
2205 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2206 # or -mfloat-abi=hard, but if one is already specified by the
2207 # multilib, use it. Similarly, if a -mfpu option already enables
2208 # NEON, do not add -mfpu=neon.
2210 proc add_options_for_arm_neon { flags } {
2211 if { ! [check_effective_target_arm_neon_ok] } {
2214 global et_arm_neon_flags
2215 return "$flags $et_arm_neon_flags"
2218 proc add_options_for_arm_v8_vfp { flags } {
2219 if { ! [check_effective_target_arm_v8_vfp_ok] } {
2222 return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
2225 proc add_options_for_arm_v8_neon { flags } {
2226 if { ! [check_effective_target_arm_v8_neon_ok] } {
2229 return "$flags -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=softfp"
2232 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2233 # or -mfloat-abi=hard, but if one is already specified by the
2234 # multilib, use it. Similarly, if a -mfpu option already enables
2235 # NEON, do not add -mfpu=neon.
2237 proc add_options_for_arm_neonv2 { flags } {
2238 if { ! [check_effective_target_arm_neonv2_ok] } {
2241 global et_arm_neonv2_flags
2242 return "$flags $et_arm_neonv2_flags"
2245 # Return 1 if this is an ARM target supporting -mfpu=neon
2246 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2247 # incompatible with these options. Also set et_arm_neon_flags to the
2248 # best options to add.
2250 proc check_effective_target_arm_neon_ok_nocache { } {
2251 global et_arm_neon_flags
2252 set et_arm_neon_flags ""
2253 if { [check_effective_target_arm32] } {
2254 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
2255 if { [check_no_compiler_messages_nocache arm_neon_ok object {
2256 #include "arm_neon.h"
2259 set et_arm_neon_flags $flags
2268 proc check_effective_target_arm_neon_ok { } {
2269 return [check_cached_effective_target arm_neon_ok \
2270 check_effective_target_arm_neon_ok_nocache]
2273 # Return 1 if this is an ARM target supporting -mfpu=neon-vfpv4
2274 # -mfloat-abi=softfp or equivalent options. Some multilibs may be
2275 # incompatible with these options. Also set et_arm_neonv2_flags to the
2276 # best options to add.
2278 proc check_effective_target_arm_neonv2_ok_nocache { } {
2279 global et_arm_neonv2_flags
2280 set et_arm_neonv2_flags ""
2281 if { [check_effective_target_arm32] } {
2282 foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
2283 if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
2284 #include "arm_neon.h"
2286 foo (float32x2_t a, float32x2_t b, float32x2_t c)
2288 return vfma_f32 (a, b, c);
2291 set et_arm_neonv2_flags $flags
2300 proc check_effective_target_arm_neonv2_ok { } {
2301 return [check_cached_effective_target arm_neonv2_ok \
2302 check_effective_target_arm_neonv2_ok_nocache]
2305 # Add the options needed for NEON. We need either -mfloat-abi=softfp
2306 # or -mfloat-abi=hard, but if one is already specified by the
2309 proc add_options_for_arm_fp16 { flags } {
2310 if { ! [check_effective_target_arm_fp16_ok] } {
2313 global et_arm_fp16_flags
2314 return "$flags $et_arm_fp16_flags"
2317 # Return 1 if this is an ARM target that can support a VFP fp16 variant.
2318 # Skip multilibs that are incompatible with these options and set
2319 # et_arm_fp16_flags to the best options to add.
2321 proc check_effective_target_arm_fp16_ok_nocache { } {
2322 global et_arm_fp16_flags
2323 set et_arm_fp16_flags ""
2324 if { ! [check_effective_target_arm32] } {
2327 if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" "-mfpu=*fpv[1-9][0-9]*" } ]] {
2328 # Multilib flags would override -mfpu.
2331 if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
2332 # Must generate floating-point instructions.
2335 if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
2336 # The existing -mfpu value is OK; use it, but add softfp.
2337 set et_arm_fp16_flags "-mfloat-abi=softfp"
2340 # Add -mfpu for a VFP fp16 variant since there is no preprocessor
2341 # macro to check for this support.
2342 set flags "-mfpu=vfpv4 -mfloat-abi=softfp"
2343 if { [check_no_compiler_messages_nocache arm_fp16_ok assembly {
2346 set et_arm_fp16_flags "$flags"
2353 proc check_effective_target_arm_fp16_ok { } {
2354 return [check_cached_effective_target arm_fp16_ok \
2355 check_effective_target_arm_fp16_ok_nocache]
2358 # Creates a series of routines that return 1 if the given architecture
2359 # can be selected and a routine to give the flags to select that architecture
2360 # Note: Extra flags may be added to disable options from newer compilers
2361 # (Thumb in particular - but others may be added in the future)
2362 # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
2363 # /* { dg-add-options arm_arch_v5 } */
2364 # /* { dg-require-effective-target arm_arch_v5_multilib } */
2365 foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
2366 v4t "-march=armv4t" __ARM_ARCH_4T__
2367 v5 "-march=armv5 -marm" __ARM_ARCH_5__
2368 v5t "-march=armv5t" __ARM_ARCH_5T__
2369 v5te "-march=armv5te" __ARM_ARCH_5TE__
2370 v6 "-march=armv6" __ARM_ARCH_6__
2371 v6k "-march=armv6k" __ARM_ARCH_6K__
2372 v6t2 "-march=armv6t2" __ARM_ARCH_6T2__
2373 v6z "-march=armv6z" __ARM_ARCH_6Z__
2374 v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
2375 v7a "-march=armv7-a" __ARM_ARCH_7A__
2376 v7r "-march=armv7-r" __ARM_ARCH_7R__
2377 v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
2378 v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
2379 v8a "-march=armv8-a" __ARM_ARCH_8A__ } {
2380 eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
2381 proc check_effective_target_arm_arch_FUNC_ok { } {
2382 if { [ string match "*-marm*" "FLAG" ] &&
2383 ![check_effective_target_arm_arm_ok] } {
2386 return [check_no_compiler_messages arm_arch_FUNC_ok assembly {
2393 proc add_options_for_arm_arch_FUNC { flags } {
2394 return "$flags FLAG"
2397 proc check_effective_target_arm_arch_FUNC_multilib { } {
2398 return [check_runtime arm_arch_FUNC_multilib {
2404 } [add_options_for_arm_arch_FUNC ""]]
2409 # Return 1 if this is an ARM target where -marm causes ARM to be
2412 proc check_effective_target_arm_arm_ok { } {
2413 return [check_no_compiler_messages arm_arm_ok assembly {
2414 #if !defined (__arm__) || defined (__thumb__) || defined (__thumb2__)
2421 # Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be
2424 proc check_effective_target_arm_thumb1_ok { } {
2425 return [check_no_compiler_messages arm_thumb1_ok assembly {
2426 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
2432 # Return 1 is this is an ARM target where -mthumb causes Thumb-2 to be
2435 proc check_effective_target_arm_thumb2_ok { } {
2436 return [check_no_compiler_messages arm_thumb2_ok assembly {
2437 #if !defined(__thumb2__)
2443 # Return 1 if this is an ARM target where Thumb-1 is used without options
2444 # added by the test.
2446 proc check_effective_target_arm_thumb1 { } {
2447 return [check_no_compiler_messages arm_thumb1 assembly {
2448 #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__)
2455 # Return 1 if this is an ARM target where Thumb-2 is used without options
2456 # added by the test.
2458 proc check_effective_target_arm_thumb2 { } {
2459 return [check_no_compiler_messages arm_thumb2 assembly {
2460 #if !defined(__thumb2__)
2467 # Return 1 if this is an ARM cortex-M profile cpu
2469 proc check_effective_target_arm_cortex_m { } {
2470 return [check_no_compiler_messages arm_cortex_m assembly {
2471 #if !defined(__ARM_ARCH_7M__) \
2472 && !defined (__ARM_ARCH_7EM__) \
2473 && !defined (__ARM_ARCH_6M__)
2480 # Return 1 if the target supports executing NEON instructions, 0
2481 # otherwise. Cache the result.
2483 proc check_effective_target_arm_neon_hw { } {
2484 return [check_runtime arm_neon_hw_available {
2488 long long a = 0, b = 1;
2489 asm ("vorr %P0, %P1, %P2"
2491 : "0" (a), "w" (b));
2494 } [add_options_for_arm_neon ""]]
2497 proc check_effective_target_arm_neonv2_hw { } {
2498 return [check_runtime arm_neon_hwv2_available {
2499 #include "arm_neon.h"
2503 float32x2_t a, b, c;
2504 asm ("vfma.f32 %P0, %P1, %P2"
2506 : "w" (b), "w" (c));
2509 } [add_options_for_arm_neonv2 ""]]
2512 # Return 1 if this is a ARM target with NEON enabled.
2514 proc check_effective_target_arm_neon { } {
2515 if { [check_effective_target_arm32] } {
2516 return [check_no_compiler_messages arm_neon object {
2517 #ifndef __ARM_NEON__
2528 proc check_effective_target_arm_neonv2 { } {
2529 if { [check_effective_target_arm32] } {
2530 return [check_no_compiler_messages arm_neon object {
2531 #ifndef __ARM_NEON__
2534 #ifndef __ARM_FEATURE_FMA
2546 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
2547 # the Loongson vector modes.
2549 proc check_effective_target_mips_loongson { } {
2550 return [check_no_compiler_messages loongson assembly {
2551 #if !defined(__mips_loongson_vector_rev)
2557 # Return 1 if this is an ARM target that adheres to the ABI for the ARM
2560 proc check_effective_target_arm_eabi { } {
2561 return [check_no_compiler_messages arm_eabi object {
2562 #ifndef __ARM_EABI__
2570 # Return 1 if this is an ARM target that adheres to the hard-float variant of
2571 # the ABI for the ARM Architecture (e.g. -mfloat-abi=hard).
2573 proc check_effective_target_arm_hf_eabi { } {
2574 return [check_no_compiler_messages arm_hf_eabi object {
2575 #if !defined(__ARM_EABI__) || !defined(__ARM_PCS_VFP)
2576 #error not hard-float EABI
2583 # Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
2584 # Some multilibs may be incompatible with this option.
2586 proc check_effective_target_arm_iwmmxt_ok { } {
2587 if { [check_effective_target_arm32] } {
2588 return [check_no_compiler_messages arm_iwmmxt_ok object {
2596 # Return true if LDRD/STRD instructions are prefered over LDM/STM instructions
2597 # for an ARM target.
2598 proc check_effective_target_arm_prefer_ldrd_strd { } {
2599 if { ![check_effective_target_arm32] } {
2603 return [check_no_messages_and_pattern arm_prefer_ldrd_strd "strd\tr" assembly {
2604 void foo (int *p) { p[0] = 1; p[1] = 0;}
2608 # Return 1 if this is a PowerPC target with floating-point registers.
2610 proc check_effective_target_powerpc_fprs { } {
2611 if { [istarget powerpc*-*-*]
2612 || [istarget rs6000-*-*] } {
2613 return [check_no_compiler_messages powerpc_fprs object {
2625 # Return 1 if this is a PowerPC target with hardware double-precision
2628 proc check_effective_target_powerpc_hard_double { } {
2629 if { [istarget powerpc*-*-*]
2630 || [istarget rs6000-*-*] } {
2631 return [check_no_compiler_messages powerpc_hard_double object {
2643 # Return 1 if this is a PowerPC target supporting -maltivec.
2645 proc check_effective_target_powerpc_altivec_ok { } {
2646 if { ([istarget powerpc*-*-*]
2647 && ![istarget powerpc-*-linux*paired*])
2648 || [istarget rs6000-*-*] } {
2649 # AltiVec is not supported on AIX before 5.3.
2650 if { [istarget powerpc*-*-aix4*]
2651 || [istarget powerpc*-*-aix5.1*]
2652 || [istarget powerpc*-*-aix5.2*] } {
2655 return [check_no_compiler_messages powerpc_altivec_ok object {
2663 # Return 1 if this is a PowerPC target supporting -mvsx
2665 proc check_effective_target_powerpc_vsx_ok { } {
2666 if { ([istarget powerpc*-*-*]
2667 && ![istarget powerpc-*-linux*paired*])
2668 || [istarget rs6000-*-*] } {
2669 # VSX is not supported on AIX before 7.1.
2670 if { [istarget powerpc*-*-aix4*]
2671 || [istarget powerpc*-*-aix5*]
2672 || [istarget powerpc*-*-aix6*] } {
2675 return [check_no_compiler_messages powerpc_vsx_ok object {
2678 asm volatile ("xxlor vs0,vs0,vs0");
2680 asm volatile ("xxlor 0,0,0");
2690 # Return 1 if this is a PowerPC target supporting -mcpu=cell.
2692 proc check_effective_target_powerpc_ppu_ok { } {
2693 if [check_effective_target_powerpc_altivec_ok] {
2694 return [check_no_compiler_messages cell_asm_available object {
2697 asm volatile ("lvlx v0,v0,v0");
2699 asm volatile ("lvlx 0,0,0");
2709 # Return 1 if this is a PowerPC target that supports SPU.
2711 proc check_effective_target_powerpc_spu { } {
2712 if { [istarget powerpc*-*-linux*] } {
2713 return [check_effective_target_powerpc_altivec_ok]
2719 # Return 1 if this is a PowerPC SPE target. The check includes options
2720 # specified by dg-options for this test, so don't
cache the result.
2722 proc check_effective_target_powerpc_spe_nocache
{ } {
2723 if { [istarget powerpc
*-*-*] } {
2724 return [check_no_compiler_messages_nocache powerpc_spe object
{
2730 } [current_compiler_flags
]]
2736 #
Return 1 if this is a PowerPC target with SPE enabled.
2738 proc check_effective_target_powerpc_spe
{ } {
2739 if { [istarget powerpc
*-*-*] } {
2740 return [check_no_compiler_messages powerpc_spe object
{
2752 #
Return 1 if this is a PowerPC target with Altivec enabled.
2754 proc check_effective_target_powerpc_altivec
{ } {
2755 if { [istarget powerpc
*-*-*] } {
2756 return [check_no_compiler_messages powerpc_altivec object
{
2768 #
Return 1 if this is a PowerPC
405 target. The check includes options
2769 # specified by dg
-options
for this test
, so don
't cache the result.
2771 proc check_effective_target_powerpc_405_nocache { } {
2772 if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
2773 return [check_no_compiler_messages_nocache powerpc_405 object {
2779 } [current_compiler_flags]]
2785 # Return 1 if this is a SPU target with a toolchain that
2786 # supports automatic overlay generation.
2788 proc check_effective_target_spu_auto_overlay { } {
2789 if { [istarget spu*-*-elf*] } {
2790 return [check_no_compiler_messages spu_auto_overlay executable {
2792 } "-Wl,--auto-overlay" ]
2798 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
2799 # chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
2800 # test environment appears to run executables on such a simulator.
2802 proc check_effective_target_ultrasparc_hw { } {
2803 return [check_runtime ultrasparc_hw {
2804 int main() { return 0; }
2805 } "-mcpu=ultrasparc"]
2808 # Return 1 if the test environment supports executing UltraSPARC VIS2
2809 # instructions. We check this by attempting: "bmask %g0, %g0, %g0"
2811 proc check_effective_target_ultrasparc_vis2_hw { } {
2812 return [check_runtime ultrasparc_vis2_hw {
2813 int main() { __asm__(".word 0x81b00320"); return 0; }
2814 } "-mcpu=ultrasparc3"]
2817 # Return 1 if the test environment supports executing UltraSPARC VIS3
2818 # instructions. We check this by attempting: "addxc %g0, %g0, %g0"
2820 proc check_effective_target_ultrasparc_vis3_hw { } {
2821 return [check_runtime ultrasparc_vis3_hw {
2822 int main() { __asm__(".word 0x81b00220"); return 0; }
2826 # Return 1 if this is a SPARC-V9 target.
2828 proc check_effective_target_sparc_v9 { } {
2829 if { [istarget sparc*-*-*] } {
2830 return [check_no_compiler_messages sparc_v9 object {
2832 asm volatile ("return %i7+8");
2841 # Return 1 if this is a SPARC target with VIS enabled.
2843 proc check_effective_target_sparc_vis { } {
2844 if { [istarget sparc*-*-*] } {
2845 return [check_no_compiler_messages sparc_vis object {
2857 # Return 1 if the target supports hardware vector shift operation.
2859 proc check_effective_target_vect_shift { } {
2860 global et_vect_shift_saved
2862 if [info exists et_vect_shift_saved] {
2863 verbose "check_effective_target_vect_shift: using cached result" 2
2865 set et_vect_shift_saved 0
2866 if { ([istarget powerpc*-*-*]
2867 && ![istarget powerpc-*-linux*paired*])
2868 || [istarget ia64-*-*]
2869 || [istarget i?86-*-*]
2870 || [istarget x86_64-*-*]
2871 || [istarget aarch64*-*-*]
2872 || [check_effective_target_arm32]
2873 || ([istarget mips*-*-*]
2874 && [check_effective_target_mips_loongson]) } {
2875 set et_vect_shift_saved 1
2879 verbose "check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
2880 return $et_vect_shift_saved
2883 # Return 1 if the target supports hardware vector shift operation for char.
2885 proc check_effective_target_vect_shift_char { } {
2886 global et_vect_shift_char_saved
2888 if [info exists et_vect_shift_char_saved] {
2889 verbose "check_effective_target_vect_shift_char: using cached result" 2
2891 set et_vect_shift_char_saved 0
2892 if { ([istarget powerpc*-*-*]
2893 && ![istarget powerpc-*-linux*paired*])
2894 || [check_effective_target_arm32] } {
2895 set et_vect_shift_char_saved 1
2899 verbose "check_effective_target_vect_shift_char: returning $et_vect_shift_char_saved" 2
2900 return $et_vect_shift_char_saved
2903 # Return 1 if the target supports hardware vectors of long, 0 otherwise.
2905 # This can change for different subtargets so do not cache the result.
2907 proc check_effective_target_vect_long { } {
2908 if { [istarget i?86-*-*]
2909 || (([istarget powerpc*-*-*]
2910 && ![istarget powerpc-*-linux*paired*])
2911 && [check_effective_target_ilp32])
2912 || [istarget x86_64-*-*]
2913 || [check_effective_target_arm32]
2914 || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) } {
2920 verbose "check_effective_target_vect_long: returning $answer" 2
2924 # Return 1 if the target supports hardware vectors of float, 0 otherwise.
2926 # This won't change
for different subtargets so
cache the result.
2928 proc check_effective_target_vect_float
{ } {
2929 global et_vect_float_saved
2931 if [info exists et_vect_float_saved
] {
2932 verbose
"check_effective_target_vect_float: using cached result" 2
2934 set et_vect_float_saved
0
2935 if { [istarget i?
86-*-*]
2936 ||
[istarget powerpc
*-*-*]
2937 ||
[istarget spu
-*-*]
2938 ||
[istarget mipsisa64
*-*-*]
2939 ||
[istarget x86_64
-*-*]
2940 ||
[istarget ia64
-*-*]
2941 ||
[istarget aarch64
*-*-*]
2942 ||
[check_effective_target_arm32
] } {
2943 set et_vect_float_saved
1
2947 verbose
"check_effective_target_vect_float: returning $et_vect_float_saved" 2
2948 return $et_vect_float_saved
2951 #
Return 1 if the target supports hardware vectors of double
, 0 otherwise.
2953 # This won
't change for different subtargets so cache the result.
2955 proc check_effective_target_vect_double { } {
2956 global et_vect_double_saved
2958 if [info exists et_vect_double_saved] {
2959 verbose "check_effective_target_vect_double: using cached result" 2
2961 set et_vect_double_saved 0
2962 if { [istarget i?86-*-*]
2963 || [istarget aarch64*-*-*]
2964 || [istarget x86_64-*-*] } {
2965 if { [check_no_compiler_messages vect_double assembly {
2966 #ifdef __tune_atom__
2967 # error No double vectorizer support.
2970 set et_vect_double_saved 1
2972 set et_vect_double_saved 0
2974 } elseif { [istarget spu-*-*] } {
2975 set et_vect_double_saved 1
2979 verbose "check_effective_target_vect_double: returning $et_vect_double_saved" 2
2980 return $et_vect_double_saved
2983 # Return 1 if the target supports hardware vectors of long long, 0 otherwise.
2985 # This won't change
for different subtargets so
cache the result.
2987 proc check_effective_target_vect_long_long
{ } {
2988 global et_vect_long_long_saved
2990 if [info exists et_vect_long_long_saved
] {
2991 verbose
"check_effective_target_vect_long_long: using cached result" 2
2993 set et_vect_long_long_saved
0
2994 if { [istarget i?
86-*-*]
2995 ||
[istarget x86_64
-*-*] } {
2996 set et_vect_long_long_saved
1
3000 verbose
"check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
3001 return $et_vect_long_long_saved
3005 #
Return 1 if the target plus current options does not support a vector
3006 #
max instruction
on "int", 0 otherwise.
3008 # This won
't change for different subtargets so cache the result.
3010 proc check_effective_target_vect_no_int_max { } {
3011 global et_vect_no_int_max_saved
3013 if [info exists et_vect_no_int_max_saved] {
3014 verbose "check_effective_target_vect_no_int_max: using cached result" 2
3016 set et_vect_no_int_max_saved 0
3017 if { [istarget sparc*-*-*]
3018 || [istarget spu-*-*]
3019 || [istarget alpha*-*-*]
3020 || ([istarget mips*-*-*]
3021 && [check_effective_target_mips_loongson]) } {
3022 set et_vect_no_int_max_saved 1
3025 verbose "check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
3026 return $et_vect_no_int_max_saved
3029 # Return 1 if the target plus current options does not support a vector
3030 # add instruction on "int", 0 otherwise.
3032 # This won't change
for different subtargets so
cache the result.
3034 proc check_effective_target_vect_no_int_add
{ } {
3035 global et_vect_no_int_add_saved
3037 if [info exists et_vect_no_int_add_saved
] {
3038 verbose
"check_effective_target_vect_no_int_add: using cached result" 2
3040 set et_vect_no_int_add_saved
0
3041 # Alpha only supports vector add
on V8QI and V4HI.
3042 if { [istarget alpha
*-*-*] } {
3043 set et_vect_no_int_add_saved
1
3046 verbose
"check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
3047 return $et_vect_no_int_add_saved
3050 #
Return 1 if the target plus current options does not support vector
3051 # bitwise instructions
, 0 otherwise.
3053 # This won
't change for different subtargets so cache the result.
3055 proc check_effective_target_vect_no_bitwise { } {
3056 global et_vect_no_bitwise_saved
3058 if [info exists et_vect_no_bitwise_saved] {
3059 verbose "check_effective_target_vect_no_bitwise: using cached result" 2
3061 set et_vect_no_bitwise_saved 0
3063 verbose "check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
3064 return $et_vect_no_bitwise_saved
3067 # Return 1 if the target plus current options supports vector permutation,
3070 # This won't change
for different subtargets so
cache the result.
3072 proc check_effective_target_vect_perm
{ } {
3075 if [info exists et_vect_perm_saved
] {
3076 verbose
"check_effective_target_vect_perm: using cached result" 2
3078 set et_vect_perm_saved
0
3079 if { [is
-effective
-target arm_neon_ok
]
3080 ||
[istarget aarch64
*-*-*]
3081 ||
[istarget powerpc
*-*-*]
3082 ||
[istarget spu
-*-*]
3083 ||
[istarget i?
86-*-*]
3084 ||
[istarget x86_64
-*-*]
3085 ||
([istarget mips
*-*-*]
3086 && [check_effective_target_mpaired_single
]) } {
3087 set et_vect_perm_saved
1
3090 verbose
"check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
3091 return $et_vect_perm_saved
3094 #
Return 1 if the target plus current options supports vector permutation
3095 #
on byte
-sized elements
, 0 otherwise.
3097 # This won
't change for different subtargets so cache the result.
3099 proc check_effective_target_vect_perm_byte { } {
3100 global et_vect_perm_byte
3102 if [info exists et_vect_perm_byte_saved] {
3103 verbose "check_effective_target_vect_perm_byte: using cached result" 2
3105 set et_vect_perm_byte_saved 0
3106 if { ([is-effective-target arm_neon_ok]
3107 && [is-effective-target arm_little_endian])
3108 || [istarget aarch64*-*-*]
3109 || [istarget powerpc*-*-*]
3110 || [istarget spu-*-*] } {
3111 set et_vect_perm_byte_saved 1
3114 verbose "check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
3115 return $et_vect_perm_byte_saved
3118 # Return 1 if the target plus current options supports vector permutation
3119 # on short-sized elements, 0 otherwise.
3121 # This won't change
for different subtargets so
cache the result.
3123 proc check_effective_target_vect_perm_short
{ } {
3124 global et_vect_perm_short
3126 if [info exists et_vect_perm_short_saved
] {
3127 verbose
"check_effective_target_vect_perm_short: using cached result" 2
3129 set et_vect_perm_short_saved
0
3130 if { ([is
-effective
-target arm_neon_ok
]
3131 && [is
-effective
-target arm_little_endian
])
3132 ||
[istarget aarch64
*-*-*]
3133 ||
[istarget powerpc
*-*-*]
3134 ||
[istarget spu
-*-*] } {
3135 set et_vect_perm_short_saved
1
3138 verbose
"check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
3139 return $et_vect_perm_short_saved
3142 #
Return 1 if the target plus current options supports a vector
3143 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
3145 # This won
't change for different subtargets so cache the result.
3147 proc check_effective_target_vect_widen_sum_hi_to_si_pattern { } {
3148 global et_vect_widen_sum_hi_to_si_pattern
3150 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved] {
3151 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
3153 set et_vect_widen_sum_hi_to_si_pattern_saved 0
3154 if { [istarget powerpc*-*-*]
3155 || [istarget ia64-*-*] } {
3156 set et_vect_widen_sum_hi_to_si_pattern_saved 1
3159 verbose "check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
3160 return $et_vect_widen_sum_hi_to_si_pattern_saved
3163 # Return 1 if the target plus current options supports a vector
3164 # widening summation of *short* args into *int* result, 0 otherwise.
3165 # A target can also support this widening summation if it can support
3166 # promotion (unpacking) from shorts to ints.
3168 # This won't change
for different subtargets so
cache the result.
3170 proc check_effective_target_vect_widen_sum_hi_to_si
{ } {
3171 global et_vect_widen_sum_hi_to_si
3173 if [info exists et_vect_widen_sum_hi_to_si_saved
] {
3174 verbose
"check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
3176 set et_vect_widen_sum_hi_to_si_saved
[check_effective_target_vect_unpack
]
3177 if { [istarget powerpc
*-*-*]
3178 ||
[istarget ia64
-*-*] } {
3179 set et_vect_widen_sum_hi_to_si_saved
1
3182 verbose
"check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
3183 return $et_vect_widen_sum_hi_to_si_saved
3186 #
Return 1 if the target plus current options supports a vector
3187 # widening summation of
*char
* args into
*short
* result
, 0 otherwise.
3188 # A target can also support this widening summation
if it can support
3189 # promotion
(unpacking
) from chars to shorts.
3191 # This won
't change for different subtargets so cache the result.
3193 proc check_effective_target_vect_widen_sum_qi_to_hi { } {
3194 global et_vect_widen_sum_qi_to_hi
3196 if [info exists et_vect_widen_sum_qi_to_hi_saved] {
3197 verbose "check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
3199 set et_vect_widen_sum_qi_to_hi_saved 0
3200 if { [check_effective_target_vect_unpack]
3201 || [check_effective_target_arm_neon_ok]
3202 || [istarget ia64-*-*] } {
3203 set et_vect_widen_sum_qi_to_hi_saved 1
3206 verbose "check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
3207 return $et_vect_widen_sum_qi_to_hi_saved
3210 # Return 1 if the target plus current options supports a vector
3211 # widening summation of *char* args into *int* result, 0 otherwise.
3213 # This won't change
for different subtargets so
cache the result.
3215 proc check_effective_target_vect_widen_sum_qi_to_si
{ } {
3216 global et_vect_widen_sum_qi_to_si
3218 if [info exists et_vect_widen_sum_qi_to_si_saved
] {
3219 verbose
"check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
3221 set et_vect_widen_sum_qi_to_si_saved
0
3222 if { [istarget powerpc
*-*-*] } {
3223 set et_vect_widen_sum_qi_to_si_saved
1
3226 verbose
"check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
3227 return $et_vect_widen_sum_qi_to_si_saved
3230 #
Return 1 if the target plus current options supports a vector
3231 # widening multiplication of
*char
* args into
*short
* result
, 0 otherwise.
3232 # A target can also support this widening multplication
if it can support
3233 # promotion
(unpacking
) from chars to shorts
, and vect_short_mult
(non
-widening
3234 # multiplication of shorts
).
3236 # This won
't change for different subtargets so cache the result.
3239 proc check_effective_target_vect_widen_mult_qi_to_hi { } {
3240 global et_vect_widen_mult_qi_to_hi
3242 if [info exists et_vect_widen_mult_qi_to_hi_saved] {
3243 verbose "check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
3245 if { [check_effective_target_vect_unpack]
3246 && [check_effective_target_vect_short_mult] } {
3247 set et_vect_widen_mult_qi_to_hi_saved 1
3249 set et_vect_widen_mult_qi_to_hi_saved 0
3251 if { [istarget powerpc*-*-*]
3252 || [istarget aarch64*-*-*]
3253 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3254 set et_vect_widen_mult_qi_to_hi_saved 1
3257 verbose "check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
3258 return $et_vect_widen_mult_qi_to_hi_saved
3261 # Return 1 if the target plus current options supports a vector
3262 # widening multiplication of *short* args into *int* result, 0 otherwise.
3263 # A target can also support this widening multplication if it can support
3264 # promotion (unpacking) from shorts to ints, and vect_int_mult (non-widening
3265 # multiplication of ints).
3267 # This won't change
for different subtargets so
cache the result.
3270 proc check_effective_target_vect_widen_mult_hi_to_si
{ } {
3271 global et_vect_widen_mult_hi_to_si
3273 if [info exists et_vect_widen_mult_hi_to_si_saved
] {
3274 verbose
"check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
3276 if { [check_effective_target_vect_unpack
]
3277 && [check_effective_target_vect_int_mult
] } {
3278 set et_vect_widen_mult_hi_to_si_saved
1
3280 set et_vect_widen_mult_hi_to_si_saved
0
3282 if { [istarget powerpc
*-*-*]
3283 ||
[istarget spu
-*-*]
3284 ||
[istarget ia64
-*-*]
3285 ||
[istarget aarch64
*-*-*]
3286 ||
[istarget i?
86-*-*]
3287 ||
[istarget x86_64
-*-*]
3288 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3289 set et_vect_widen_mult_hi_to_si_saved
1
3292 verbose
"check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
3293 return $et_vect_widen_mult_hi_to_si_saved
3296 #
Return 1 if the target plus current options supports a vector
3297 # widening multiplication of
*char
* args into
*short
* result
, 0 otherwise.
3299 # This won
't change for different subtargets so cache the result.
3301 proc check_effective_target_vect_widen_mult_qi_to_hi_pattern { } {
3302 global et_vect_widen_mult_qi_to_hi_pattern
3304 if [info exists et_vect_widen_mult_qi_to_hi_pattern_saved] {
3305 verbose "check_effective_target_vect_widen_mult_qi_to_hi_pattern: using cached result" 2
3307 set et_vect_widen_mult_qi_to_hi_pattern_saved 0
3308 if { [istarget powerpc*-*-*]
3309 || ([istarget arm*-*-*]
3310 && [check_effective_target_arm_neon_ok]
3311 && [check_effective_target_arm_little_endian]) } {
3312 set et_vect_widen_mult_qi_to_hi_pattern_saved 1
3315 verbose "check_effective_target_vect_widen_mult_qi_to_hi_pattern: returning $et_vect_widen_mult_qi_to_hi_pattern_saved" 2
3316 return $et_vect_widen_mult_qi_to_hi_pattern_saved
3319 # Return 1 if the target plus current options supports a vector
3320 # widening multiplication of *short* args into *int* result, 0 otherwise.
3322 # This won't change
for different subtargets so
cache the result.
3324 proc check_effective_target_vect_widen_mult_hi_to_si_pattern
{ } {
3325 global et_vect_widen_mult_hi_to_si_pattern
3327 if [info exists et_vect_widen_mult_hi_to_si_pattern_saved
] {
3328 verbose
"check_effective_target_vect_widen_mult_hi_to_si_pattern: using cached result" 2
3330 set et_vect_widen_mult_hi_to_si_pattern_saved
0
3331 if { [istarget powerpc
*-*-*]
3332 ||
[istarget spu
-*-*]
3333 ||
[istarget ia64
-*-*]
3334 ||
[istarget i?
86-*-*]
3335 ||
[istarget x86_64
-*-*]
3336 ||
([istarget arm
*-*-*]
3337 && [check_effective_target_arm_neon_ok
]
3338 && [check_effective_target_arm_little_endian
]) } {
3339 set et_vect_widen_mult_hi_to_si_pattern_saved
1
3342 verbose
"check_effective_target_vect_widen_mult_hi_to_si_pattern: returning $et_vect_widen_mult_hi_to_si_pattern_saved" 2
3343 return $et_vect_widen_mult_hi_to_si_pattern_saved
3346 #
Return 1 if the target plus current options supports a vector
3347 # widening shift
, 0 otherwise.
3349 # This won
't change for different subtargets so cache the result.
3351 proc check_effective_target_vect_widen_shift { } {
3352 global et_vect_widen_shift_saved
3354 if [info exists et_vect_shift_saved] {
3355 verbose "check_effective_target_vect_widen_shift: using cached result" 2
3357 set et_vect_widen_shift_saved 0
3358 if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
3359 set et_vect_widen_shift_saved 1
3362 verbose "check_effective_target_vect_widen_shift: returning $et_vect_widen_shift_saved" 2
3363 return $et_vect_widen_shift_saved
3366 # Return 1 if the target plus current options supports a vector
3367 # dot-product of signed chars, 0 otherwise.
3369 # This won't change
for different subtargets so
cache the result.
3371 proc check_effective_target_vect_sdot_qi
{ } {
3372 global et_vect_sdot_qi
3374 if [info exists et_vect_sdot_qi_saved
] {
3375 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
3377 set et_vect_sdot_qi_saved
0
3378 if { [istarget ia64
-*-*] } {
3379 set et_vect_udot_qi_saved
1
3382 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
3383 return $et_vect_sdot_qi_saved
3386 #
Return 1 if the target plus current options supports a vector
3387 # dot
-product of unsigned chars
, 0 otherwise.
3389 # This won
't change for different subtargets so cache the result.
3391 proc check_effective_target_vect_udot_qi { } {
3392 global et_vect_udot_qi
3394 if [info exists et_vect_udot_qi_saved] {
3395 verbose "check_effective_target_vect_udot_qi: using cached result" 2
3397 set et_vect_udot_qi_saved 0
3398 if { [istarget powerpc*-*-*]
3399 || [istarget ia64-*-*] } {
3400 set et_vect_udot_qi_saved 1
3403 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
3404 return $et_vect_udot_qi_saved
3407 # Return 1 if the target plus current options supports a vector
3408 # dot-product of signed shorts, 0 otherwise.
3410 # This won't change
for different subtargets so
cache the result.
3412 proc check_effective_target_vect_sdot_hi
{ } {
3413 global et_vect_sdot_hi
3415 if [info exists et_vect_sdot_hi_saved
] {
3416 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
3418 set et_vect_sdot_hi_saved
0
3419 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3420 ||
[istarget ia64
-*-*]
3421 ||
[istarget i?
86-*-*]
3422 ||
[istarget x86_64
-*-*] } {
3423 set et_vect_sdot_hi_saved
1
3426 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
3427 return $et_vect_sdot_hi_saved
3430 #
Return 1 if the target plus current options supports a vector
3431 # dot
-product of unsigned shorts
, 0 otherwise.
3433 # This won
't change for different subtargets so cache the result.
3435 proc check_effective_target_vect_udot_hi { } {
3436 global et_vect_udot_hi
3438 if [info exists et_vect_udot_hi_saved] {
3439 verbose "check_effective_target_vect_udot_hi: using cached result" 2
3441 set et_vect_udot_hi_saved 0
3442 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
3443 set et_vect_udot_hi_saved 1
3446 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
3447 return $et_vect_udot_hi_saved
3451 # Return 1 if the target plus current options supports a vector
3452 # demotion (packing) of shorts (to chars) and ints (to shorts)
3453 # using modulo arithmetic, 0 otherwise.
3455 # This won't change
for different subtargets so
cache the result.
3457 proc check_effective_target_vect_pack_trunc
{ } {
3458 global et_vect_pack_trunc
3460 if [info exists et_vect_pack_trunc_saved
] {
3461 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
3463 set et_vect_pack_trunc_saved
0
3464 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3465 ||
[istarget i?
86-*-*]
3466 ||
[istarget x86_64
-*-*]
3467 ||
[istarget aarch64
*-*-*]
3468 ||
[istarget spu
-*-*]
3469 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]
3470 && [check_effective_target_arm_little_endian
]) } {
3471 set et_vect_pack_trunc_saved
1
3474 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
3475 return $et_vect_pack_trunc_saved
3478 #
Return 1 if the target plus current options supports a vector
3479 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
3481 # This won
't change for different subtargets so cache the result.
3483 proc check_effective_target_vect_unpack { } {
3484 global et_vect_unpack
3486 if [info exists et_vect_unpack_saved] {
3487 verbose "check_effective_target_vect_unpack: using cached result" 2
3489 set et_vect_unpack_saved 0
3490 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
3491 || [istarget i?86-*-*]
3492 || [istarget x86_64-*-*]
3493 || [istarget spu-*-*]
3494 || [istarget ia64-*-*]
3495 || [istarget aarch64*-*-*]
3496 || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
3497 && [check_effective_target_arm_little_endian]) } {
3498 set et_vect_unpack_saved 1
3501 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
3502 return $et_vect_unpack_saved
3505 # Return 1 if the target plus current options does not guarantee
3506 # that its STACK_BOUNDARY is >= the reguired vector alignment.
3508 # This won't change
for different subtargets so
cache the result.
3510 proc check_effective_target_unaligned_stack
{ } {
3511 global et_unaligned_stack_saved
3513 if [info exists et_unaligned_stack_saved
] {
3514 verbose
"check_effective_target_unaligned_stack: using cached result" 2
3516 set et_unaligned_stack_saved
0
3518 verbose
"check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
3519 return $et_unaligned_stack_saved
3522 #
Return 1 if the target plus current options does not support a vector
3523 # alignment mechanism
, 0 otherwise.
3525 # This won
't change for different subtargets so cache the result.
3527 proc check_effective_target_vect_no_align { } {
3528 global et_vect_no_align_saved
3530 if [info exists et_vect_no_align_saved] {
3531 verbose "check_effective_target_vect_no_align: using cached result" 2
3533 set et_vect_no_align_saved 0
3534 if { [istarget mipsisa64*-*-*]
3535 || [istarget sparc*-*-*]
3536 || [istarget ia64-*-*]
3537 || [check_effective_target_arm_vect_no_misalign]
3538 || ([istarget mips*-*-*]
3539 && [check_effective_target_mips_loongson]) } {
3540 set et_vect_no_align_saved 1
3543 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
3544 return $et_vect_no_align_saved
3547 # Return 1 if the target supports a vector misalign access, 0 otherwise.
3549 # This won't change
for different subtargets so
cache the result.
3551 proc check_effective_target_vect_hw_misalign
{ } {
3552 global et_vect_hw_misalign_saved
3554 if [info exists et_vect_hw_misalign_saved
] {
3555 verbose
"check_effective_target_vect_hw_misalign: using cached result" 2
3557 set et_vect_hw_misalign_saved
0
3558 if { ([istarget x86_64
-*-*]
3559 ||
[istarget aarch64
*-*-*]
3560 ||
[istarget i?
86-*-*]) } {
3561 set et_vect_hw_misalign_saved
1
3564 verbose
"check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
3565 return $et_vect_hw_misalign_saved
3569 #
Return 1 if arrays are aligned to the vector alignment
3570 # boundary
, 0 otherwise.
3572 # This won
't change for different subtargets so cache the result.
3574 proc check_effective_target_vect_aligned_arrays { } {
3575 global et_vect_aligned_arrays
3577 if [info exists et_vect_aligned_arrays_saved] {
3578 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
3580 set et_vect_aligned_arrays_saved 0
3581 if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
3582 if { ([is-effective-target lp64]
3583 && ( ![check_avx_available]
3584 || [check_prefer_avx128])) } {
3585 set et_vect_aligned_arrays_saved 1
3588 if [istarget spu-*-*] {
3589 set et_vect_aligned_arrays_saved 1
3592 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
3593 return $et_vect_aligned_arrays_saved
3596 # Return 1 if types of size 32 bit or less are naturally aligned
3597 # (aligned to their type-size), 0 otherwise.
3599 # This won't change
for different subtargets so
cache the result.
3601 proc check_effective_target_natural_alignment_32
{ } {
3602 global et_natural_alignment_32
3604 if [info exists et_natural_alignment_32_saved
] {
3605 verbose
"check_effective_target_natural_alignment_32: using cached result" 2
3607 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
3608 set et_natural_alignment_32_saved
1
3609 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
3610 set et_natural_alignment_32_saved
0
3613 verbose
"check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
3614 return $et_natural_alignment_32_saved
3617 #
Return 1 if types of size
64 bit or less are naturally aligned
(aligned to their
3618 # type
-size
), 0 otherwise.
3620 # This won
't change for different subtargets so cache the result.
3622 proc check_effective_target_natural_alignment_64 { } {
3623 global et_natural_alignment_64
3625 if [info exists et_natural_alignment_64_saved] {
3626 verbose "check_effective_target_natural_alignment_64: using cached result" 2
3628 set et_natural_alignment_64_saved 0
3629 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
3630 || [istarget spu-*-*] } {
3631 set et_natural_alignment_64_saved 1
3634 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
3635 return $et_natural_alignment_64_saved
3638 # Return 1 if all vector types are naturally aligned (aligned to their
3639 # type-size), 0 otherwise.
3641 # This won't change
for different subtargets so
cache the result.
3643 proc check_effective_target_vect_natural_alignment
{ } {
3644 global et_vect_natural_alignment
3646 if [info exists et_vect_natural_alignment_saved
] {
3647 verbose
"check_effective_target_vect_natural_alignment: using cached result" 2
3649 set et_vect_natural_alignment_saved
1
3650 if { [check_effective_target_arm_eabi
] } {
3651 set et_vect_natural_alignment_saved
0
3654 verbose
"check_effective_target_vect_natural_alignment: returning $et_vect_natural_alignment_saved" 2
3655 return $et_vect_natural_alignment_saved
3658 #
Return 1 if vector alignment
(for types of size
32 bit or less
) is reachable
, 0 otherwise.
3660 # This won
't change for different subtargets so cache the result.
3662 proc check_effective_target_vector_alignment_reachable { } {
3663 global et_vector_alignment_reachable
3665 if [info exists et_vector_alignment_reachable_saved] {
3666 verbose "check_effective_target_vector_alignment_reachable: using cached result" 2
3668 if { [check_effective_target_vect_aligned_arrays]
3669 || [check_effective_target_natural_alignment_32] } {
3670 set et_vector_alignment_reachable_saved 1
3672 set et_vector_alignment_reachable_saved 0
3675 verbose "check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
3676 return $et_vector_alignment_reachable_saved
3679 # Return 1 if vector alignment for 64 bit is reachable, 0 otherwise.
3681 # This won't change
for different subtargets so
cache the result.
3683 proc check_effective_target_vector_alignment_reachable_for_64bit
{ } {
3684 global et_vector_alignment_reachable_for_64bit
3686 if [info exists et_vector_alignment_reachable_for_64bit_saved
] {
3687 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
3689 if { [check_effective_target_vect_aligned_arrays
]
3690 ||
[check_effective_target_natural_alignment_64
] } {
3691 set et_vector_alignment_reachable_for_64bit_saved
1
3693 set et_vector_alignment_reachable_for_64bit_saved
0
3696 verbose
"check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
3697 return $et_vector_alignment_reachable_for_64bit_saved
3700 #
Return 1 if the target only requires element alignment
for vector accesses
3702 proc check_effective_target_vect_element_align
{ } {
3703 global et_vect_element_align
3705 if [info exists et_vect_element_align
] {
3706 verbose
"check_effective_target_vect_element_align: using cached result" 2
3708 set et_vect_element_align
0
3709 if { ([istarget arm
*-*-*]
3710 && ![check_effective_target_arm_vect_no_misalign
])
3711 ||
[check_effective_target_vect_hw_misalign
] } {
3712 set et_vect_element_align
1
3716 verbose
"check_effective_target_vect_element_align: returning $et_vect_element_align" 2
3717 return $et_vect_element_align
3720 #
Return 1 if the target supports vector conditional operations
, 0 otherwise.
3722 proc check_effective_target_vect_condition
{ } {
3723 global et_vect_cond_saved
3725 if [info exists et_vect_cond_saved
] {
3726 verbose
"check_effective_target_vect_cond: using cached result" 2
3728 set et_vect_cond_saved
0
3729 if { [istarget aarch64
*-*-*]
3730 ||
[istarget powerpc
*-*-*]
3731 ||
[istarget ia64
-*-*]
3732 ||
[istarget i?
86-*-*]
3733 ||
[istarget spu
-*-*]
3734 ||
[istarget x86_64
-*-*]
3735 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
]) } {
3736 set et_vect_cond_saved
1
3740 verbose
"check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
3741 return $et_vect_cond_saved
3744 #
Return 1 if the target supports vector conditional operations where
3745 # the comparison has different type from the lhs
, 0 otherwise.
3747 proc check_effective_target_vect_cond_mixed
{ } {
3748 global et_vect_cond_mixed_saved
3750 if [info exists et_vect_cond_mixed_saved
] {
3751 verbose
"check_effective_target_vect_cond_mixed: using cached result" 2
3753 set et_vect_cond_mixed_saved
0
3754 if { [istarget i?
86-*-*]
3755 ||
[istarget x86_64
-*-*]
3756 ||
[istarget powerpc
*-*-*] } {
3757 set et_vect_cond_mixed_saved
1
3761 verbose
"check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2
3762 return $et_vect_cond_mixed_saved
3765 #
Return 1 if the target supports vector char multiplication
, 0 otherwise.
3767 proc check_effective_target_vect_char_mult
{ } {
3768 global et_vect_char_mult_saved
3770 if [info exists et_vect_char_mult_saved
] {
3771 verbose
"check_effective_target_vect_char_mult: using cached result" 2
3773 set et_vect_char_mult_saved
0
3774 if { [istarget aarch64
*-*-*]
3775 ||
[istarget ia64
-*-*]
3776 ||
[istarget i?
86-*-*]
3777 ||
[istarget x86_64
-*-*]
3778 ||
[check_effective_target_arm32
] } {
3779 set et_vect_char_mult_saved
1
3783 verbose
"check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
3784 return $et_vect_char_mult_saved
3787 #
Return 1 if the target supports vector short multiplication
, 0 otherwise.
3789 proc check_effective_target_vect_short_mult
{ } {
3790 global et_vect_short_mult_saved
3792 if [info exists et_vect_short_mult_saved
] {
3793 verbose
"check_effective_target_vect_short_mult: using cached result" 2
3795 set et_vect_short_mult_saved
0
3796 if { [istarget ia64
-*-*]
3797 ||
[istarget spu
-*-*]
3798 ||
[istarget i?
86-*-*]
3799 ||
[istarget x86_64
-*-*]
3800 ||
[istarget powerpc
*-*-*]
3801 ||
[istarget aarch64
*-*-*]
3802 ||
[check_effective_target_arm32
]
3803 ||
([istarget mips
*-*-*]
3804 && [check_effective_target_mips_loongson
]) } {
3805 set et_vect_short_mult_saved
1
3809 verbose
"check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
3810 return $et_vect_short_mult_saved
3813 #
Return 1 if the target supports vector
int multiplication
, 0 otherwise.
3815 proc check_effective_target_vect_int_mult
{ } {
3816 global et_vect_int_mult_saved
3818 if [info exists et_vect_int_mult_saved
] {
3819 verbose
"check_effective_target_vect_int_mult: using cached result" 2
3821 set et_vect_int_mult_saved
0
3822 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
3823 ||
[istarget spu
-*-*]
3824 ||
[istarget i?
86-*-*]
3825 ||
[istarget x86_64
-*-*]
3826 ||
[istarget ia64
-*-*]
3827 ||
[istarget aarch64
*-*-*]
3828 ||
[check_effective_target_arm32
] } {
3829 set et_vect_int_mult_saved
1
3833 verbose
"check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
3834 return $et_vect_int_mult_saved
3837 #
Return 1 if the target supports vector even
/odd elements extraction
, 0 otherwise.
3839 proc check_effective_target_vect_extract_even_odd
{ } {
3840 global et_vect_extract_even_odd_saved
3842 if [info exists et_vect_extract_even_odd_saved
] {
3843 verbose
"check_effective_target_vect_extract_even_odd: using cached result" 2
3845 set et_vect_extract_even_odd_saved
0
3846 if { [istarget aarch64
*-*-*]
3847 ||
[istarget powerpc
*-*-*]
3848 ||
[is
-effective
-target arm_neon_ok
]
3849 ||
[istarget i?
86-*-*]
3850 ||
[istarget x86_64
-*-*]
3851 ||
[istarget ia64
-*-*]
3852 ||
[istarget spu
-*-*]
3853 ||
([istarget mips
*-*-*]
3854 && [check_effective_target_mpaired_single
]) } {
3855 set et_vect_extract_even_odd_saved
1
3859 verbose
"check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
3860 return $et_vect_extract_even_odd_saved
3863 #
Return 1 if the target supports vector interleaving
, 0 otherwise.
3865 proc check_effective_target_vect_interleave
{ } {
3866 global et_vect_interleave_saved
3868 if [info exists et_vect_interleave_saved
] {
3869 verbose
"check_effective_target_vect_interleave: using cached result" 2
3871 set et_vect_interleave_saved
0
3872 if { [istarget aarch64
*-*-*]
3873 ||
[istarget powerpc
*-*-*]
3874 ||
[is
-effective
-target arm_neon_ok
]
3875 ||
[istarget i?
86-*-*]
3876 ||
[istarget x86_64
-*-*]
3877 ||
[istarget ia64
-*-*]
3878 ||
[istarget spu
-*-*]
3879 ||
([istarget mips
*-*-*]
3880 && [check_effective_target_mpaired_single
]) } {
3881 set et_vect_interleave_saved
1
3885 verbose
"check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
3886 return $et_vect_interleave_saved
3889 foreach N
{2 3 4 8} {
3890 eval
[string map
[list N $N
] {
3891 #
Return 1 if the target supports
2-vector interleaving
3892 proc check_effective_target_vect_stridedN
{ } {
3893 global et_vect_stridedN_saved
3895 if [info exists et_vect_stridedN_saved
] {
3896 verbose
"check_effective_target_vect_stridedN: using cached result" 2
3898 set et_vect_stridedN_saved
0
3900 && [check_effective_target_vect_interleave
]
3901 && [check_effective_target_vect_extract_even_odd
] } {
3902 set et_vect_stridedN_saved
1
3904 if { ([istarget arm
*-*-*]
3905 ||
[istarget aarch64
*-*-*]) && N
>= 2 && N
<= 4 } {
3906 set et_vect_stridedN_saved
1
3910 verbose
"check_effective_target_vect_stridedN: returning $et_vect_stridedN_saved" 2
3911 return $et_vect_stridedN_saved
3916 #
Return 1 if the target supports multiple vector sizes
3918 proc check_effective_target_vect_multiple_sizes
{ } {
3919 global et_vect_multiple_sizes_saved
3921 set et_vect_multiple_sizes_saved
0
3922 if { ([istarget aarch64
*-*-*]
3923 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon_ok
])) } {
3924 set et_vect_multiple_sizes_saved
1
3926 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
3927 if { ([check_avx_available
] && ![check_prefer_avx128
]) } {
3928 set et_vect_multiple_sizes_saved
1
3932 verbose
"check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2
3933 return $et_vect_multiple_sizes_saved
3936 #
Return 1 if the target supports vectors of
64 bits.
3938 proc check_effective_target_vect64
{ } {
3939 global et_vect64_saved
3941 if [info exists et_vect64_saved
] {
3942 verbose
"check_effective_target_vect64: using cached result" 2
3944 set et_vect64_saved
0
3945 if { ([istarget arm
*-*-*]
3946 && [check_effective_target_arm_neon_ok
]
3947 && [check_effective_target_arm_little_endian
]) } {
3948 set et_vect64_saved
1
3952 verbose
"check_effective_target_vect64: returning $et_vect64_saved" 2
3953 return $et_vect64_saved
3956 #
Return 1 if the target supports vector copysignf calls.
3958 proc check_effective_target_vect_call_copysignf
{ } {
3959 global et_vect_call_copysignf_saved
3961 if [info exists et_vect_call_copysignf_saved
] {
3962 verbose
"check_effective_target_vect_call_copysignf: using cached result" 2
3964 set et_vect_call_copysignf_saved
0
3965 if { [istarget i?
86-*-*]
3966 ||
[istarget x86_64
-*-*]
3967 ||
[istarget powerpc
*-*-*] } {
3968 set et_vect_call_copysignf_saved
1
3972 verbose
"check_effective_target_vect_call_copysignf: returning $et_vect_call_copysignf_saved" 2
3973 return $et_vect_call_copysignf_saved
3976 #
Return 1 if the target supports vector sqrtf calls.
3978 proc check_effective_target_vect_call_sqrtf
{ } {
3979 global et_vect_call_sqrtf_saved
3981 if [info exists et_vect_call_sqrtf_saved
] {
3982 verbose
"check_effective_target_vect_call_sqrtf: using cached result" 2
3984 set et_vect_call_sqrtf_saved
0
3985 if { [istarget aarch64
*-*-*]
3986 ||
[istarget i?
86-*-*]
3987 ||
[istarget x86_64
-*-*]
3988 ||
([istarget powerpc
*-*-*] && [check_vsx_hw_available
]) } {
3989 set et_vect_call_sqrtf_saved
1
3993 verbose
"check_effective_target_vect_call_sqrtf: returning $et_vect_call_sqrtf_saved" 2
3994 return $et_vect_call_sqrtf_saved
3997 #
Return 1 if the target supports vector lrint calls.
3999 proc check_effective_target_vect_call_lrint
{ } {
4000 set et_vect_call_lrint
0
4001 if { ([istarget i?
86-*-*] ||
[istarget x86_64
-*-*]) && [check_effective_target_ilp32
] } {
4002 set et_vect_call_lrint
1
4005 verbose
"check_effective_target_vect_call_lrint: returning $et_vect_call_lrint" 2
4006 return $et_vect_call_lrint
4009 #
Return 1 if the target supports vector btrunc calls.
4011 proc check_effective_target_vect_call_btrunc
{ } {
4012 global et_vect_call_btrunc_saved
4014 if [info exists et_vect_call_btrunc_saved
] {
4015 verbose
"check_effective_target_vect_call_btrunc: using cached result" 2
4017 set et_vect_call_btrunc_saved
0
4018 if { [istarget aarch64
*-*-*] } {
4019 set et_vect_call_btrunc_saved
1
4023 verbose
"check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
4024 return $et_vect_call_btrunc_saved
4027 #
Return 1 if the target supports vector btruncf calls.
4029 proc check_effective_target_vect_call_btruncf
{ } {
4030 global et_vect_call_btruncf_saved
4032 if [info exists et_vect_call_btruncf_saved
] {
4033 verbose
"check_effective_target_vect_call_btruncf: using cached result" 2
4035 set et_vect_call_btruncf_saved
0
4036 if { [istarget aarch64
*-*-*] } {
4037 set et_vect_call_btruncf_saved
1
4041 verbose
"check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
4042 return $et_vect_call_btruncf_saved
4045 #
Return 1 if the target supports vector ceil calls.
4047 proc check_effective_target_vect_call_ceil
{ } {
4048 global et_vect_call_ceil_saved
4050 if [info exists et_vect_call_ceil_saved
] {
4051 verbose
"check_effective_target_vect_call_ceil: using cached result" 2
4053 set et_vect_call_ceil_saved
0
4054 if { [istarget aarch64
*-*-*] } {
4055 set et_vect_call_ceil_saved
1
4059 verbose
"check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
4060 return $et_vect_call_ceil_saved
4063 #
Return 1 if the target supports vector ceilf calls.
4065 proc check_effective_target_vect_call_ceilf
{ } {
4066 global et_vect_call_ceilf_saved
4068 if [info exists et_vect_call_ceilf_saved
] {
4069 verbose
"check_effective_target_vect_call_ceilf: using cached result" 2
4071 set et_vect_call_ceilf_saved
0
4072 if { [istarget aarch64
*-*-*] } {
4073 set et_vect_call_ceilf_saved
1
4077 verbose
"check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
4078 return $et_vect_call_ceilf_saved
4081 #
Return 1 if the target supports vector floor calls.
4083 proc check_effective_target_vect_call_floor
{ } {
4084 global et_vect_call_floor_saved
4086 if [info exists et_vect_call_floor_saved
] {
4087 verbose
"check_effective_target_vect_call_floor: using cached result" 2
4089 set et_vect_call_floor_saved
0
4090 if { [istarget aarch64
*-*-*] } {
4091 set et_vect_call_floor_saved
1
4095 verbose
"check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
4096 return $et_vect_call_floor_saved
4099 #
Return 1 if the target supports vector floorf calls.
4101 proc check_effective_target_vect_call_floorf
{ } {
4102 global et_vect_call_floorf_saved
4104 if [info exists et_vect_call_floorf_saved
] {
4105 verbose
"check_effective_target_vect_call_floorf: using cached result" 2
4107 set et_vect_call_floorf_saved
0
4108 if { [istarget aarch64
*-*-*] } {
4109 set et_vect_call_floorf_saved
1
4113 verbose
"check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
4114 return $et_vect_call_floorf_saved
4117 #
Return 1 if the target supports vector lceil calls.
4119 proc check_effective_target_vect_call_lceil
{ } {
4120 global et_vect_call_lceil_saved
4122 if [info exists et_vect_call_lceil_saved
] {
4123 verbose
"check_effective_target_vect_call_lceil: using cached result" 2
4125 set et_vect_call_lceil_saved
0
4126 if { [istarget aarch64
*-*-*] } {
4127 set et_vect_call_lceil_saved
1
4131 verbose
"check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
4132 return $et_vect_call_lceil_saved
4135 #
Return 1 if the target supports vector lfloor calls.
4137 proc check_effective_target_vect_call_lfloor
{ } {
4138 global et_vect_call_lfloor_saved
4140 if [info exists et_vect_call_lfloor_saved
] {
4141 verbose
"check_effective_target_vect_call_lfloor: using cached result" 2
4143 set et_vect_call_lfloor_saved
0
4144 if { [istarget aarch64
*-*-*] } {
4145 set et_vect_call_lfloor_saved
1
4149 verbose
"check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
4150 return $et_vect_call_lfloor_saved
4153 #
Return 1 if the target supports vector nearbyint calls.
4155 proc check_effective_target_vect_call_nearbyint
{ } {
4156 global et_vect_call_nearbyint_saved
4158 if [info exists et_vect_call_nearbyint_saved
] {
4159 verbose
"check_effective_target_vect_call_nearbyint: using cached result" 2
4161 set et_vect_call_nearbyint_saved
0
4162 if { [istarget aarch64
*-*-*] } {
4163 set et_vect_call_nearbyint_saved
1
4167 verbose
"check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
4168 return $et_vect_call_nearbyint_saved
4171 #
Return 1 if the target supports vector nearbyintf calls.
4173 proc check_effective_target_vect_call_nearbyintf
{ } {
4174 global et_vect_call_nearbyintf_saved
4176 if [info exists et_vect_call_nearbyintf_saved
] {
4177 verbose
"check_effective_target_vect_call_nearbyintf: using cached result" 2
4179 set et_vect_call_nearbyintf_saved
0
4180 if { [istarget aarch64
*-*-*] } {
4181 set et_vect_call_nearbyintf_saved
1
4185 verbose
"check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
4186 return $et_vect_call_nearbyintf_saved
4189 #
Return 1 if the target supports vector
round calls.
4191 proc check_effective_target_vect_call_round
{ } {
4192 global et_vect_call_round_saved
4194 if [info exists et_vect_call_round_saved
] {
4195 verbose
"check_effective_target_vect_call_round: using cached result" 2
4197 set et_vect_call_round_saved
0
4198 if { [istarget aarch64
*-*-*] } {
4199 set et_vect_call_round_saved
1
4203 verbose
"check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
4204 return $et_vect_call_round_saved
4207 #
Return 1 if the target supports vector roundf calls.
4209 proc check_effective_target_vect_call_roundf
{ } {
4210 global et_vect_call_roundf_saved
4212 if [info exists et_vect_call_roundf_saved
] {
4213 verbose
"check_effective_target_vect_call_roundf: using cached result" 2
4215 set et_vect_call_roundf_saved
0
4216 if { [istarget aarch64
*-*-*] } {
4217 set et_vect_call_roundf_saved
1
4221 verbose
"check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
4222 return $et_vect_call_roundf_saved
4225 #
Return 1 if the target supports section
-anchors
4227 proc check_effective_target_section_anchors
{ } {
4228 global et_section_anchors_saved
4230 if [info exists et_section_anchors_saved
] {
4231 verbose
"check_effective_target_section_anchors: using cached result" 2
4233 set et_section_anchors_saved
0
4234 if { [istarget powerpc
*-*-*]
4235 ||
[istarget arm
*-*-*] } {
4236 set et_section_anchors_saved
1
4240 verbose
"check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
4241 return $et_section_anchors_saved
4244 #
Return 1 if the target supports atomic operations
on "int_128" values.
4246 proc check_effective_target_sync_int_128
{ } {
4247 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4248 && ![is
-effective
-target ia32
] } {
4255 #
Return 1 if the target supports atomic operations
on "int_128" values
4256 # and can
execute them.
4258 proc check_effective_target_sync_int_128_runtime
{ } {
4259 if { ([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
4260 && ![is
-effective
-target ia32
] } {
4261 return [check_cached_effective_target sync_int_128_available
{
4262 check_runtime_nocache sync_int_128_available
{
4266 unsigned
int eax
, ebx
, ecx
, edx
;
4267 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4268 return !(ecx
& bit_CMPXCHG16B
);
4278 #
Return 1 if the target supports atomic operations
on "long long".
4280 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4282 proc check_effective_target_sync_long_long
{ } {
4283 if { [istarget x86_64
-*-*]
4284 ||
[istarget i?
86-*-*])
4285 ||
[istarget arm
*-*-*]
4286 ||
[istarget alpha
*-*-*]
4287 ||
([istarget sparc
*-*-*] && [check_effective_target_lp64
]) } {
4294 #
Return 1 if the target supports atomic operations
on "long long"
4295 # and can
execute them.
4297 # Note
: 32bit x86 targets require
-march
=pentium in dg
-options.
4299 proc check_effective_target_sync_long_long_runtime
{ } {
4300 if { [istarget x86_64
-*-*]
4301 ||
[istarget i?
86-*-*] } {
4302 return [check_cached_effective_target sync_long_long_available
{
4303 check_runtime_nocache sync_long_long_available
{
4307 unsigned
int eax
, ebx
, ecx
, edx
;
4308 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
4309 return !(edx
& bit_CMPXCHG8B
);
4314 } elseif
{ [istarget arm
*-*-linux
-*] } {
4315 return [check_runtime sync_longlong_runtime
{
4321 if (sizeof
(long long
) != 8)
4324 /* Just check
for native
; checking
for kernel fallback is tricky.
*/
4325 asm volatile
("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1");
4330 } elseif
{ [istarget alpha
*-*-*] } {
4332 } elseif
{ ([istarget sparc
*-*-*]
4333 && [check_effective_target_lp64
]
4334 && [check_effective_target_ultrasparc_hw
]) } {
4336 } elseif
{ [istarget powerpc
*-*-*] && [check_effective_target_lp64
] } {
4343 #
Return 1 if the target supports atomic operations
on "int" and "long".
4345 proc check_effective_target_sync_int_long
{ } {
4346 global et_sync_int_long_saved
4348 if [info exists et_sync_int_long_saved
] {
4349 verbose
"check_effective_target_sync_int_long: using cached result" 2
4351 set et_sync_int_long_saved
0
4352 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
4353 # load-reserved/store-conditional instructions.
4354 if { [istarget ia64-*-*]
4355 || [istarget i?86-*-*]
4356 || [istarget x86_64-*-*]
4357 || [istarget aarch64*-*-*]
4358 || [istarget alpha*-*-*]
4359 || [istarget arm*-*-linux-*]
4360 || [istarget bfin*-*linux*]
4361 || [istarget hppa*-*linux*]
4362 || [istarget s390*-*-*]
4363 || [istarget powerpc*-*-*]
4364 || [istarget crisv32-*-*] || [istarget cris-*-*]
4365 || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
4366 || [check_effective_target_mips_llsc] } {
4367 set et_sync_int_long_saved 1
4371 verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
4372 return $et_sync_int_long_saved
4375 # Return 1 if the target supports atomic operations on "char" and "short".
4377 proc check_effective_target_sync_char_short { } {
4378 global et_sync_char_short_saved
4380 if [info exists et_sync_char_short_saved] {
4381 verbose "check_effective_target_sync_char_short: using cached result" 2
4383 set et_sync_char_short_saved 0
4384 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
4385 #
load-reserved/store
-conditional instructions.
4386 if { [istarget aarch64
*-*-*]
4387 ||
[istarget ia64
-*-*]
4388 ||
[istarget i?
86-*-*]
4389 ||
[istarget x86_64
-*-*]
4390 ||
[istarget alpha
*-*-*]
4391 ||
[istarget arm
*-*-linux
-*]
4392 ||
[istarget hppa
*-*linux
*]
4393 ||
[istarget s390
*-*-*]
4394 ||
[istarget powerpc
*-*-*]
4395 ||
[istarget crisv32
-*-*] ||
[istarget cris
-*-*]
4396 ||
([istarget sparc
*-*-*] && [check_effective_target_sparc_v9
])
4397 ||
[check_effective_target_mips_llsc
] } {
4398 set et_sync_char_short_saved
1
4402 verbose
"check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
4403 return $et_sync_char_short_saved
4406 #
Return 1 if the target uses a ColdFire FPU.
4408 proc check_effective_target_coldfire_fpu
{ } {
4409 return [check_no_compiler_messages coldfire_fpu assembly
{
4416 #
Return true
if this is a uClibc target.
4418 proc check_effective_target_uclibc
{} {
4419 return [check_no_compiler_messages uclibc object
{
4420 #
include <features.h
>
4421 #
if !defined
(__UCLIBC__
)
4427 #
Return true
if this is a uclibc target and
if the uclibc feature
4428 # described by __$feature__ is not present.
4430 proc check_missing_uclibc_feature
{feature
} {
4431 return [check_no_compiler_messages $feature object
"
4432 #
include <features.h
>
4433 #
if !defined
(__UCLIBC
) || defined
(__$
{feature
}__
)
4439 #
Return true
if this is a Newlib target.
4441 proc check_effective_target_newlib
{} {
4442 return [check_no_compiler_messages newlib object
{
4448 #
(a
) an error of a few ULP is expected in string to floating
-point
4449 # conversion functions
; and
4450 #
(b
) overflow is not always detected correctly by those functions.
4452 proc check_effective_target_lax_strtofp
{} {
4453 # By default
, assume that all uClibc targets suffer from this.
4454 return [check_effective_target_uclibc
]
4457 #
Return 1 if this is a target
for which wcsftime is a dummy
4458 # function that always returns
0.
4460 proc check_effective_target_dummy_wcsftime
{} {
4461 # By default
, assume that all uClibc targets suffer from this.
4462 return [check_effective_target_uclibc
]
4465 #
Return 1 if constructors with initialization priority arguments are
4466 # supposed
on this target.
4468 proc check_effective_target_init_priority
{} {
4469 return [check_no_compiler_messages init_priority assembly
"
4470 void f
() __attribute__
((constructor
(1000)));
4475 #
Return 1 if the target matches the effective target
'arg', 0 otherwise.
4476 # This can be used with
any check_
* proc that takes no
argument and
4477 # returns only
1 or
0. It could be used with check_
* procs that take
4478 # arguments with keywords that pass particular arguments.
4480 proc is
-effective
-target
{ arg } {
4482 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4483 set selected
[check_effective_target_$
{arg}]
4486 "vmx_hw" { set selected [check_vmx_hw_available] }
4487 "vsx_hw" { set selected [check_vsx_hw_available] }
4488 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
4489 "named_sections" { set selected [check_named_sections_available] }
4490 "gc_sections" { set selected [check_gc_sections_available] }
4491 "cxa_atexit" { set selected [check_cxa_atexit_available] }
4492 default
{ error
"unknown effective target keyword `$arg'" }
4495 verbose
"is-effective-target: $arg $selected" 2
4499 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
4501 proc is
-effective
-target
-keyword
{ arg } {
4502 if { [info procs check_effective_target_$
{arg}] != [list
] } {
4505 # These have different names
for their check_
* procs.
4507 "vmx_hw" { return 1 }
4508 "vsx_hw" { return 1 }
4509 "ppc_recip_hw" { return 1 }
4510 "named_sections" { return 1 }
4511 "gc_sections" { return 1 }
4512 "cxa_atexit" { return 1 }
4513 default
{ return 0 }
4518 #
Return 1 if target default to short enums
4520 proc check_effective_target_short_enums
{ } {
4521 return [check_no_compiler_messages short_enums assembly
{
4523 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
4527 #
Return 1 if target supports merging string constants at link time.
4529 proc check_effective_target_string_merging
{ } {
4530 return [check_no_messages_and_pattern string_merging \
4531 "rodata\\.str" assembly {
4532 const char
*var
= "String";
4536 #
Return 1 if target has the basic signed and unsigned types in
4537 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
4538 # working
<stdint.h
> for all targets.
4540 proc check_effective_target_stdint_types
{ } {
4541 return [check_no_compiler_messages stdint_types assembly
{
4543 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
4544 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
4548 #
Return 1 if target has the basic signed and unsigned types in
4549 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
4550 # these types agree with those in the header, as some systems have
4551 # only <inttypes.h>.
4553 proc check_effective_target_inttypes_types { } {
4554 return [check_no_compiler_messages inttypes_types assembly {
4555 #include <inttypes.h>
4556 int8_t a; int16_t b; int32_t c; int64_t d;
4557 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
4561 # Return 1 if programs are intended to be run on a simulator
4562 # (i.e. slowly) rather than hardware (i.e. fast).
4564 proc check_effective_target_simulator { } {
4566 # All "src/sim" simulators set this one.
4567 if [board_info target exists is_simulator] {
4568 return [board_info target is_simulator]
4571 # The "sid" simulators don't
set that one
, but at least they
set
4573 if [board_info target
exists slow_simulator
] {
4574 return [board_info target slow_simulator
]
4580 #
Return 1 if the target is a VxWorks kernel.
4582 proc check_effective_target_vxworks_kernel
{ } {
4583 return [check_no_compiler_messages vxworks_kernel assembly
{
4584 #
if !defined __vxworks || defined __RTP__
4590 #
Return 1 if the target is a VxWorks RTP.
4592 proc check_effective_target_vxworks_rtp
{ } {
4593 return [check_no_compiler_messages vxworks_rtp assembly
{
4594 #
if !defined __vxworks ||
!defined __RTP__
4600 #
Return 1 if the target is expected to provide wide character support.
4602 proc check_effective_target_wchar
{ } {
4603 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
4606 return [check_no_compiler_messages wchar assembly
{
4611 #
Return 1 if the target has
<pthread.h
>.
4613 proc check_effective_target_pthread_h
{ } {
4614 return [check_no_compiler_messages pthread_h assembly
{
4615 #
include <pthread.h
>
4619 #
Return 1 if the target can truncate a file from a file
-descriptor
,
4620 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
4621 # chsize. We test
for a trivially functional truncation
; no stubs.
4622 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
4623 # different function to be used.
4625 proc check_effective_target_fd_truncate { } {
4627 #define _FILE_OFFSET_BITS 64
4633 FILE *f = fopen ("tst.tmp", "wb");
4635 const char t[] = "test writing more than ten characters";
4639 write (fd, t, sizeof (t) - 1);
4641 if (ftruncate (fd, 10) != 0)
4650 f = fopen ("tst.tmp", "rb");
4651 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
4659 if { [check_runtime ftruncate $prog] } {
4663 regsub "ftruncate" $prog "chsize" prog
4664 return [check_runtime chsize $prog]
4667 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
4669 proc add_options_for_c99_runtime { flags } {
4670 if { [istarget *-*-solaris2*] } {
4671 return "$flags -std=c99"
4673 if { [istarget powerpc-*-darwin*] } {
4674 return "$flags -mmacosx-version-min=10.3"
4679 # Add to FLAGS all the target-specific flags needed to enable
4680 # full IEEE compliance mode.
4682 proc add_options_for_ieee { flags } {
4683 if { [istarget alpha*-*-*]
4684 || [istarget sh*-*-*] } {
4685 return "$flags -mieee"
4687 if { [istarget rx-*-*] } {
4688 return "$flags -mnofpu"
4693 # Add to FLAGS the flags needed to enable functions to bind locally
4694 # when using pic/PIC passes in the testsuite.
4696 proc add_options_for_bind_pic_locally { flags } {
4697 if {[check_no_compiler_messages using_pic2 assembly {
4702 return "$flags -fPIE"
4704 if {[check_no_compiler_messages using_pic1 assembly {
4709 return "$flags -fpie"
4715 # Add to FLAGS the flags needed to enable 64-bit vectors.
4717 proc add_options_for_double_vectors { flags } {
4718 if [is-effective-target arm_neon_ok] {
4719 return "$flags -mvectorize-with-neon-double"
4725 # Return 1 if the target provides a full C99 runtime.
4727 proc check_effective_target_c99_runtime { } {
4728 return [check_cached_effective_target c99_runtime {
4731 set file [open "$srcdir/gcc.dg/builtins-config.h"]
4732 set contents [read $file]
4735 #ifndef HAVE_C99_RUNTIME
4739 check_no_compiler_messages_nocache c99_runtime assembly \
4740 $contents [add_options_for_c99_runtime ""]
4744 # Return 1 if target wchar_t is at least 4 bytes.
4746 proc check_effective_target_4byte_wchar_t { } {
4747 return [check_no_compiler_messages 4byte_wchar_t object {
4748 int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
4752 # Return 1 if the target supports automatic stack alignment.
4754 proc check_effective_target_automatic_stack_alignment { } {
4755 # Ordinarily x86 supports automatic stack alignment ...
4756 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
4757 if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
4758 # ... except Win64 SEH doesn't. Succeed
for Win32 though.
4759 return [check_effective_target_ilp32
];
4766 #
Return true
if we are compiling
for AVX target.
4768 proc check_avx_available
{ } {
4769 if { [check_no_compiler_messages avx_available assembly
{
4779 #
Return true
if 32- and
16-bytes vectors are available.
4781 proc check_effective_target_vect_sizes_32B_16B
{ } {
4782 return [check_avx_available
];
4785 #
Return true
if 128-bits vectors are preferred even
if 256-bits vectors
4788 proc check_prefer_avx128
{ } {
4789 if ![check_avx_available
] {
4792 return [check_no_messages_and_pattern avx_explicit
"xmm" assembly {
4793 float a
[1024],b
[1024],c
[1024];
4794 void foo
(void
) { int i
; for (i
= 0; i
< 1024; i
++) a
[i
]=b
[i
]+c
[i
];}
4795 } "-O2 -ftree-vectorize"]
4799 #
Return 1 if avx instructions can be compiled.
4801 proc check_effective_target_avx
{ } {
4802 return [check_no_compiler_messages avx object
{
4803 void _mm256_zeroall
(void
)
4805 __builtin_ia32_vzeroall
();
4810 #
Return 1 if sse instructions can be compiled.
4811 proc check_effective_target_sse
{ } {
4812 return [check_no_compiler_messages sse object
{
4815 __builtin_ia32_stmxcsr
();
4821 #
Return 1 if sse2 instructions can be compiled.
4822 proc check_effective_target_sse2
{ } {
4823 return [check_no_compiler_messages sse2 object
{
4824 typedef long long __m128i __attribute__
((__vector_size__
(16)));
4826 __m128i _mm_srli_si128
(__m128i __A
, int __N
)
4828 return (__m128i
)__builtin_ia32_psrldqi128
(__A
, 8);
4833 #
Return 1 if F16C instructions can be compiled.
4835 proc check_effective_target_f16c
{ } {
4836 return [check_no_compiler_messages f16c object
{
4837 #
include "immintrin.h"
4839 foo
(unsigned short val
)
4841 return _cvtsh_ss
(val
);
4846 #
Return 1 if C wchar_t type is compatible with char16_t.
4848 proc check_effective_target_wchar_t_char16_t_compatible
{ } {
4849 return [check_no_compiler_messages wchar_t_char16_t object
{
4851 __CHAR16_TYPE__
*p16
= &wc
;
4852 char t
[(((__CHAR16_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
4856 #
Return 1 if C wchar_t type is compatible with char32_t.
4858 proc check_effective_target_wchar_t_char32_t_compatible
{ } {
4859 return [check_no_compiler_messages wchar_t_char32_t object
{
4861 __CHAR32_TYPE__
*p32
= &wc
;
4862 char t
[(((__CHAR32_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
4866 #
Return 1 if pow10 function
exists.
4868 proc check_effective_target_pow10
{ } {
4869 return [check_runtime pow10
{
4879 #
Return 1 if current options generate DFP instructions
, 0 otherwise.
4881 proc check_effective_target_hard_dfp
{} {
4882 return [check_no_messages_and_pattern hard_dfp
"!adddd3" assembly {
4883 typedef float d64 __attribute__
((mode(DD
)));
4885 void foo
(void
) { z
= x
+ y
; }
4889 #
Return 1 if string.h and wchar.h headers provide C
++ requires overloads
4890 #
for strchr etc. functions.
4892 proc check_effective_target_correct_iso_cpp_string_wchar_protos
{ } {
4893 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly
{
4896 #
if !defined
(__cplusplus
) \
4897 ||
!defined
(__CORRECT_ISO_CPP_STRING_H_PROTO
) \
4898 ||
!defined
(__CORRECT_ISO_CPP_WCHAR_H_PROTO
)
4899 ISO C
++ correct string.h and wchar.h protos not supported.
4906 #
Return 1 if GNU as is used.
4908 proc check_effective_target_gas
{ } {
4909 global use_gas_saved
4912 if {![info exists use_gas_saved
]} {
4913 # Check
if the as used by gcc is GNU as.
4914 set gcc_as
[lindex
[$
{tool
}_target_compile
"-print-prog-name=as" "" "none" ""] 0]
4915 # Provide
/dev
/null as input
, otherwise gas times out reading from
4917 set status [remote_exec host
"$gcc_as" "-v /dev/null"]
4918 set as_output
[lindex $
status 1]
4919 if { [ string first
"GNU" $as_output ] >= 0 } {
4925 return $use_gas_saved
4928 #
Return 1 if GNU
ld is used.
4930 proc check_effective_target_gld
{ } {
4931 global use_gld_saved
4934 if {![info exists use_gld_saved
]} {
4935 # Check
if the
ld used by gcc is GNU
ld.
4936 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=ld" "" "none" ""] 0]
4937 set status [remote_exec host
"$gcc_ld" "--version"]
4938 set ld_output
[lindex $
status 1]
4939 if { [ string first
"GNU" $ld_output ] >= 0 } {
4945 return $use_gld_saved
4948 #
Return 1 if the compiler has been configure with link
-time optimization
4951 proc check_effective_target_lto
{ } {
4953 return [info exists ENABLE_LTO
]
4956 #
Return 1 if -mx32
-maddress
-mode=short can
compile, 0 otherwise.
4958 proc check_effective_target_maybe_x32
{ } {
4959 return [check_no_compiler_messages maybe_x32 object
{
4961 } "-mx32 -maddress-mode=short"]
4964 #
Return 1 if this target supports the
-fsplit
-stack option
, 0
4967 proc check_effective_target_split_stack
{} {
4968 return [check_no_compiler_messages split_stack object
{
4973 #
Return 1 if this target supports the
-masm
=intel option
, 0
4976 proc check_effective_target_masm_intel
{} {
4977 return [check_no_compiler_messages masm_intel object
{
4978 extern void abort
(void
);
4982 #
Return 1 if the language
for the compiler under test is C.
4984 proc check_effective_target_c
{ } {
4986 if [string match $tool
"gcc"] {
4992 #
Return 1 if the language
for the compiler under test is C
++.
4994 proc check_effective_target_c
++ { } {
4996 if [string match $tool
"g++"] {
5002 # Check which language standard is active by checking
for the presence of
5003 # one of the C
++11 -std flags. This assumes that the default
for the
5004 # compiler is C
++98, and that there will never be multiple
-std
= arguments
5005 #
on the command line.
5006 proc check_effective_target_c
++11 { } {
5007 if ![check_effective_target_c
++] {
5010 return [check
-flags
{ { } { } { -std
=c
++0x
-std
=gnu
++0x
-std
=c
++11 -std
=gnu
++11 } }]
5013 proc check_effective_target_c
++1y
{ } {
5014 if ![check_effective_target_c
++] {
5017 return [check
-flags
{ { } { } { -std
=c
++1y
-std
=gnu
++1y
} }]
5020 proc check_effective_target_c
++98 { } {
5021 if ![check_effective_target_c
++] {
5024 return [check
-flags
{ { } { } { } { -std
=c
++0x
-std
=gnu
++0x
-std
=c
++11 -std
=gnu
++11 -std
=c
++1y
-std
=gnu
++1y
} }]
5027 #
Return 1 if expensive testcases should be run.
5029 proc check_effective_target_run_expensive_tests
{ } {
5030 if { [getenv GCC_TEST_RUN_EXPENSIVE
] != "" } {
5036 # Returns
1 if "mempcpy" is available on the target system.
5038 proc check_effective_target_mempcpy
{} {
5039 return [check_function_available
"mempcpy"]
5042 # Check whether the vectorizer tests are supported by the target and
5043 # append additional target
-dependent
compile flags to DEFAULT_VECTCFLAGS.
5044 #
Set dg
-do-what
-default to either
compile or run
, depending
on target
5045 # capabilities.
Return 1 if vectorizer tests are supported by
5046 # target
, 0 otherwise.
5048 proc check_vect_support_and_set_flags
{ } {
5049 global DEFAULT_VECTCFLAGS
5050 global dg
-do-what
-default
5052 if [istarget powerpc
-*paired
*] {
5053 lappend DEFAULT_VECTCFLAGS
"-mpaired"
5054 if [check_750cl_hw_available
] {
5055 set dg
-do-what
-default run
5057 set dg
-do-what
-default
compile
5059 } elseif
[istarget powerpc
*-*-*] {
5060 # Skip targets not supporting
-maltivec.
5061 if ![is
-effective
-target powerpc_altivec_ok
] {
5065 lappend DEFAULT_VECTCFLAGS
"-maltivec"
5066 if [check_vsx_hw_available
] {
5067 lappend DEFAULT_VECTCFLAGS
"-mvsx" "-mno-allow-movmisalign"
5070 if [check_vmx_hw_available
] {
5071 set dg
-do-what
-default run
5073 if [is
-effective
-target ilp32
] {
5074 # Specify a cpu that supports VMX
for compile-only tests.
5075 lappend DEFAULT_VECTCFLAGS
"-mcpu=970"
5077 set dg
-do-what
-default
compile
5079 } elseif
{ [istarget spu
-*-*] } {
5080 set dg
-do-what
-default run
5081 } elseif
{ [istarget i?
86-*-*] ||
[istarget x86_64
-*-*] } {
5082 lappend DEFAULT_VECTCFLAGS
"-msse2"
5083 if { [check_effective_target_sse2_runtime
] } {
5084 set dg
-do-what
-default run
5086 set dg
-do-what
-default
compile
5088 } elseif
{ [istarget mips
*-*-*]
5089 && ([check_effective_target_mpaired_single
]
5090 ||
[check_effective_target_mips_loongson
])
5091 && [check_effective_target_nomips16
] } {
5092 if { [check_effective_target_mpaired_single
] } {
5093 lappend DEFAULT_VECTCFLAGS
"-mpaired-single"
5095 set dg
-do-what
-default run
5096 } elseif
[istarget sparc
*-*-*] {
5097 lappend DEFAULT_VECTCFLAGS
"-mcpu=ultrasparc" "-mvis"
5098 if [check_effective_target_ultrasparc_hw
] {
5099 set dg
-do-what
-default run
5101 set dg
-do-what
-default
compile
5103 } elseif
[istarget alpha
*-*-*] {
5104 # Alpha
's vectorization capabilities are extremely limited.
5105 # It's more effort than its worth disabling all of the tests
5106 # that it cannot pass. But
if you actually want to see what
5107 # does work
, command out the
return.
5110 lappend DEFAULT_VECTCFLAGS
"-mmax"
5111 if [check_alpha_max_hw_available
] {
5112 set dg
-do-what
-default run
5114 set dg
-do-what
-default
compile
5116 } elseif
[istarget ia64
-*-*] {
5117 set dg
-do-what
-default run
5118 } elseif
[is
-effective
-target arm_neon_ok
] {
5119 eval lappend DEFAULT_VECTCFLAGS
[add_options_for_arm_neon
""]
5120 # NEON does not support denormals
, so is not used
for vectorization by
5121 # default to avoid loss of precision. We must pass
-ffast
-math to test
5122 # vectorization of float operations.
5123 lappend DEFAULT_VECTCFLAGS
"-ffast-math"
5124 if [is
-effective
-target arm_neon_hw
] {
5125 set dg
-do-what
-default run
5127 set dg
-do-what
-default
compile
5129 } elseif
[istarget
"aarch64*-*-*"] {
5130 set dg
-do-what
-default run
5138 proc check_effective_target_non_strict_align
{} {
5139 return [check_no_compiler_messages non_strict_align assembly
{
5141 typedef char __attribute__
((__aligned__
(__BIGGEST_ALIGNMENT__
))) c
;
5143 void foo
(void
) { z
= (c
*) y
; }
5147 #
Return 1 if the target has
<ucontext.h
>.
5149 proc check_effective_target_ucontext_h
{ } {
5150 return [check_no_compiler_messages ucontext_h assembly
{
5151 #
include <ucontext.h
>
5155 proc check_effective_target_aarch64_tiny
{ } {
5156 if { [istarget aarch64
*-*-*] } {
5157 return [check_no_compiler_messages aarch64_tiny object
{
5158 #ifdef __AARCH64_CMODEL_TINY__
5161 #error target not AArch64 tiny code
model
5169 proc check_effective_target_aarch64_small
{ } {
5170 if { [istarget aarch64
*-*-*] } {
5171 return [check_no_compiler_messages aarch64_small object
{
5172 #ifdef __AARCH64_CMODEL_SMALL__
5175 #error target not AArch64 small code
model
5183 proc check_effective_target_aarch64_large
{ } {
5184 if { [istarget aarch64
*-*-*] } {
5185 return [check_no_compiler_messages aarch64_large object
{
5186 #ifdef __AARCH64_CMODEL_LARGE__
5189 #error target not AArch64 large code
model