1 # Copyright
(C
) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
2 # Free Software Foundation
, Inc.
4 # This
program is free software
; you can redistribute it and
/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation
; either version
3 of the License
, or
7 #
(at your option
) any later version.
9 # This
program is distributed in the hope that it will be useful
,
10 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License
for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC
; see the file COPYING3.
If not see
16 #
<http
://www.gnu.org
/licenses
/>.
18 # Please email
any bugs
, comments
, and
/or additions to this file to
:
19 # gcc
-patches@gcc.gnu.org
21 # This file defines procs
for determining features supported by the target.
23 # Try to
compile the code given by CONTENTS into an output file of
24 # type TYPE
, where TYPE is as
for target_compile.
Return a list
25 # whose first element contains the compiler messages and whose
26 # second element is the
name of the output file.
28 # BASENAME is a prefix to use
for source and output files.
29 #
If ARGS is not empty
, its first element is a string that
30 # should be added to the command line.
32 # Assume by default that CONTENTS is C code.
33 # Otherwise
, code should contain
:
35 #
"! Fortran" for Fortran code,
37 #
"// ObjC++" for ObjC++
39 #
If the tool is ObjC
/ObjC
++ then we overide the extension to .m
/.mm to
40 # allow
for ObjC
/ObjC
++ specific flags.
41 proc check_compile
{basename type contents
args} {
43 verbose
"check_compile tool: $tool for $basename"
45 if { [llength $
args] > 0 } {
46 set options
[list
"additional_flags=[lindex $args 0]"]
50 switch -glob
-- $contents
{
51 "*! Fortran*" { set src ${basename}[pid].f90 }
52 "*// C++*" { set src ${basename}[pid].cc }
53 "*// ObjC++*" { set src ${basename}[pid].mm }
54 "*/* ObjC*" { set src ${basename}[pid].m }
55 "*// Go*" { set src ${basename}[pid].go }
58 "objc" { set src ${basename}[pid].m }
59 "obj-c++" { set src ${basename}[pid].mm }
60 default
{ set src $
{basename
}[pid
].c
}
65 set compile_type $type
67 assembly
{ set output $
{basename
}[pid
].s
}
68 object
{ set output $
{basename
}[pid
].o
}
69 executable
{ set output $
{basename
}[pid
].exe
}
71 set output $
{basename
}[pid
].s
72 lappend options
"additional_flags=-fdump-$type"
73 set compile_type assembly
79 set lines
[$
{tool
}_target_compile $src $output $compile_type
"$options"]
82 set scan_output $output
83 # Don
't try folding this into the switch above; calling "glob" before the
84 # file is created won't work.
85 if [regexp
"rtl-(.*)" $type dummy rtl_type] {
86 set scan_output
"[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
90 return [list $lines $scan_output
]
93 proc current_target_name
{ } {
95 if [info exists target_info
(target
,name)] {
96 set answer $target_info
(target
,name)
103 # Implement an effective
-target check
for property PROP by invoking
104 # the Tcl command
ARGS and seeing
if it returns true.
106 proc check_cached_effective_target
{ prop
args } {
109 set target
[current_target_name
]
110 if {![info exists et_cache
($prop
,target
)]
111 || $et_cache
($prop
,target
) != $target
} {
112 verbose
"check_cached_effective_target $prop: checking $target" 2
113 set et_cache
($prop
,target
) $target
114 set et_cache
($prop
,value
) [uplevel eval $
args]
116 set value $et_cache
($prop
,value
)
117 verbose
"check_cached_effective_target $prop: returning $value for $target" 2
121 # Like check_compile
, but
delete the output file and
return true
if the
122 # compiler printed no messages.
123 proc check_no_compiler_messages_nocache
{args} {
124 set result
[eval check_compile $
args]
125 set lines
[lindex $result
0]
126 set output
[lindex $result
1]
127 remote_file build
delete $output
128 return [string match
"" $lines]
131 # Like check_no_compiler_messages_nocache
, but
cache the result.
132 # PROP is the
property we
're checking, and doubles as a prefix for
133 # temporary filenames.
134 proc check_no_compiler_messages {prop args} {
135 return [check_cached_effective_target $prop {
136 eval [list check_no_compiler_messages_nocache $prop] $args
140 # Like check_compile, but return true if the compiler printed no
141 # messages and if the contents of the output file satisfy PATTERN.
142 # If PATTERN has the form "!REGEXP", the contents satisfy it if they
143 # don't match regular expression REGEXP
, otherwise they satisfy it
144 #
if they
do match regular expression PATTERN.
(PATTERN can start
145 # with something like
"[!]" if the regular expression needs to match
146 #
"!" as the first character.)
148 #
Delete the output file before returning. The other arguments are
149 # as
for check_compile.
150 proc check_no_messages_and_pattern_nocache
{basename pattern
args} {
153 set result
[eval
[list check_compile $basename
] $
args]
154 set lines
[lindex $result
0]
155 set output
[lindex $result
1]
158 if { [string match
"" $lines] } {
159 set chan
[open
"$output"]
160 set invert
[regexp
{^
!(.
*)} $pattern dummy pattern
]
161 set ok
[expr
{ [regexp $pattern
[read $chan
]] != $invert
}]
165 remote_file build
delete $output
169 # Like check_no_messages_and_pattern_nocache
, but
cache the result.
170 # PROP is the
property we
're checking, and doubles as a prefix for
171 # temporary filenames.
172 proc check_no_messages_and_pattern {prop pattern args} {
173 return [check_cached_effective_target $prop {
174 eval [list check_no_messages_and_pattern_nocache $prop $pattern] $args
178 # Try to compile and run an executable from code CONTENTS. Return true
179 # if the compiler reports no messages and if execution "passes" in the
180 # usual DejaGNU sense. The arguments are as for check_compile, with
181 # TYPE implicitly being "executable".
182 proc check_runtime_nocache {basename contents args} {
185 set result [eval [list check_compile $basename executable $contents] $args]
186 set lines [lindex $result 0]
187 set output [lindex $result 1]
190 if { [string match "" $lines] } {
191 # No error messages, everything is OK.
192 set result [remote_load target "./$output" "" ""]
193 set status [lindex $result 0]
194 verbose "check_runtime_nocache $basename: status is <$status>" 2
195 if { $status == "pass" } {
199 remote_file build delete $output
203 # Like check_runtime_nocache, but cache the result. PROP is the
204 # property we're checking
, and doubles as a prefix
for temporary
206 proc check_runtime
{prop
args} {
209 return [check_cached_effective_target $prop
{
210 eval
[list check_runtime_nocache $prop
] $
args
214 ###############################
215 # proc check_weak_available
{ }
216 ###############################
218 # weak symbols are only supported in some configs
/object formats
219 # this proc returns
1 if they
're supported, 0 if they're not
, or
-1 if unsure
221 proc check_weak_available
{ } {
222 global target_triplet
225 # All mips targets should support it
227 if { [ string first
"mips" $target_cpu ] >= 0 } {
231 # All solaris2 targets should support it
233 if { [regexp
".*-solaris2.*" $target_triplet] } {
237 # DEC OSF
/1/Digital UNIX
/Tru64 UNIX supports it
239 if { [regexp
"alpha.*osf.*" $target_triplet] } {
243 # Windows targets Cygwin and MingW32 support it
245 if { [regexp
".*mingw32|.*cygwin" $target_triplet] } {
249 # HP
-UX
10.X doesn
't support it
251 if { [istarget "hppa*-*-hpux10*"] } {
255 # ELF and ECOFF support it. a.out does with gas/gld but may also with
256 # other linkers, so we should try it
258 set objformat [gcc_target_object_format]
266 unknown { return -1 }
271 ###############################
272 # proc check_weak_override_available { }
273 ###############################
275 # Like check_weak_available, but return 0 if weak symbol definitions
276 # cannot be overridden.
278 proc check_weak_override_available { } {
279 if { [istarget "*-*-mingw*"] } {
282 return [check_weak_available]
285 ###############################
286 # proc check_visibility_available { what_kind }
287 ###############################
289 # The visibility attribute is only support in some object formats
290 # This proc returns 1 if it is supported, 0 if not.
291 # The argument is the kind of visibility, default/protected/hidden/internal.
293 proc check_visibility_available { what_kind } {
295 global target_triplet
297 # On NetWare, support makes no sense.
298 if { [istarget *-*-netware*] } {
302 if [string match "" $what_kind] { set what_kind "hidden" }
304 return [check_no_compiler_messages visibility_available_$what_kind object "
305 void f() __attribute__((visibility(\"$what_kind\")));
310 ###############################
311 # proc check_alias_available { }
312 ###############################
314 # Determine if the target toolchain supports the alias attribute.
316 # Returns 2 if the target supports aliases. Returns 1 if the target
317 # only supports weak aliased. Returns 0 if the target does not
318 # support aliases at all. Returns -1 if support for aliases could not
321 proc check_alias_available { } {
322 global alias_available_saved
325 if [info exists alias_available_saved] {
326 verbose "check_alias_available returning saved $alias_available_saved" 2
330 verbose "check_alias_available compiling testfile $src" 2
331 set f [open $src "w"]
332 # Compile a small test program. The definition of "g" is
333 # necessary to keep the Solaris assembler from complaining
335 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n"
336 puts $f "void g() {} void f() __attribute__((alias(\"g\")));"
338 set lines [${tool}_target_compile $src $obj object ""]
340 remote_file build delete $obj
342 if [string match "" $lines] then {
343 # No error messages, everything is OK.
344 set alias_available_saved 2
346 if [regexp "alias definitions not supported" $lines] {
347 verbose "check_alias_available target does not support aliases" 2
349 set objformat [gcc_target_object_format]
351 if { $objformat == "elf" } {
352 verbose "check_alias_available but target uses ELF format, so it ought to" 2
353 set alias_available_saved -1
355 set alias_available_saved 0
358 if [regexp "only weak aliases are supported" $lines] {
359 verbose "check_alias_available target supports only weak aliases" 2
360 set alias_available_saved 1
362 set alias_available_saved -1
367 verbose "check_alias_available returning $alias_available_saved" 2
370 return $alias_available_saved
373 ###############################
374 # proc check_ifunc_available { }
375 ###############################
377 # Determine if the target toolchain supports the ifunc attribute.
379 # Returns 1 if the target supports ifunc. Returns 0 if the target
380 # does not support ifunc.
382 proc check_ifunc_available { } {
383 global ifunc_available_saved
386 if [info exists ifunc_available_saved] {
387 verbose "check_ifunc_available returning saved $ifunc_available_saved" 2
391 verbose "check_ifunc_available compiling testfile $src" 2
392 set f [open $src "w"]
394 puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif"
395 puts $f "void g() {}"
396 puts $f "void f() __attribute__((ifunc(\"g\")));"
398 set lines [${tool}_target_compile $src $obj object ""]
400 remote_file build delete $obj
402 if [string match "" $lines] then {
403 set ifunc_available_saved 1
405 set ifunc_available_saved 0
408 verbose "check_ifunc_available returning $ifunc_available_saved" 2
411 return $ifunc_available_saved
414 # Returns true if --gc-sections is supported on the target.
416 proc check_gc_sections_available { } {
417 global gc_sections_available_saved
420 if {![info exists gc_sections_available_saved]} {
421 # Some targets don't support gc
-sections despite whatever
's
422 # advertised by ld's options.
423 if { [istarget alpha
*-*-*]
424 ||
[istarget ia64
-*-*] } {
425 set gc_sections_available_saved
0
429 # elf2flt uses
-q
(--emit
-relocs
), which is incompatible with
431 if { [board_info target
exists ldflags
]
432 && [regexp
" -elf2flt\[ =\]" " [board_info target ldflags] "] } {
433 set gc_sections_available_saved
0
437 # VxWorks kernel modules are relocatable objects linked with
-r
,
438 #
while RTP executables are linked with
-q
(--emit
-relocs
).
439 # Both of these options are incompatible with
--gc
-sections.
440 if { [istarget
*-*-vxworks
*] } {
441 set gc_sections_available_saved
0
445 # Check
if the
ld used by gcc supports
--gc
-sections.
446 set gcc_spec
[$
{tool
}_target_compile
"-dumpspecs" "" "none" ""]
447 regsub
".*\n\\*linker:\[ \t\]*\n(\[^ \t\n\]*).*" "$gcc_spec" {\1} linker
448 set gcc_ld
[lindex
[$
{tool
}_target_compile
"-print-prog-name=$linker" "" "none" ""] 0]
449 set ld_output
[remote_exec host
"$gcc_ld" "--help"]
450 if { [ string first
"--gc-sections" $ld_output ] >= 0 } {
451 set gc_sections_available_saved
1
453 set gc_sections_available_saved
0
456 return $gc_sections_available_saved
459 #
Return 1 if according to target_info struct and explicit target list
460 # target is supposed to support trampolines.
462 proc check_effective_target_trampolines
{ } {
463 if [target_info
exists no_trampolines
] {
466 if { [istarget avr
-*-*]
467 ||
[istarget hppa2.0w
-hp
-hpux11.23
]
468 ||
[istarget hppa64
-hp
-hpux11.23
] } {
474 #
Return 1 if according to target_info struct and explicit target list
475 # target is supposed to keep null pointer checks. This could be due to
476 # use of option fno
-delete-null
-pointer
-checks or hardwired in target.
478 proc check_effective_target_keeps_null_pointer_checks
{ } {
479 if [target_info
exists keeps_null_pointer_checks
] {
482 if { [istarget avr
-*-*] } {
488 #
Return true
if profiling is supported
on the target.
490 proc check_profiling_available
{ test_what
} {
491 global profiling_available_saved
493 verbose
"Profiling argument is <$test_what>" 1
495 # These conditions depend
on the
argument so examine them before
496 # looking at the
cache variable.
498 # Support
for -p
on solaris2 relies
on mcrt1.o which comes with the
499 # vendor compiler. We cannot reliably predict the directory where the
500 # vendor compiler
(and thus mcrt1.o
) is installed so we can
't
501 # necessarily find mcrt1.o even if we have it.
502 if { [istarget *-*-solaris2*] && [lindex $test_what 1] == "-p" } {
506 # Support for -p on irix relies on libprof1.a which doesn't appear to
507 # exist
on any irix6
system currently posting testsuite results.
508 # Support
for -pg
on irix relies
on gcrt1.o which doesn
't exist yet.
509 # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
510 if { [istarget mips*-*-irix*]
511 && ([lindex $test_what 1] == "-p" || [lindex $test_what 1] == "-pg") } {
515 # We don't yet support profiling
for MIPS16.
516 if { [istarget mips
*-*-*]
517 && ![check_effective_target_nomips16
]
518 && ([lindex $test_what
1] == "-p"
519 ||
[lindex $test_what
1] == "-pg") } {
523 # MinGW does not support
-p.
524 if { [istarget
*-*-mingw
*] && [lindex $test_what
1] == "-p" } {
528 # cygwin does not support
-p.
529 if { [istarget
*-*-cygwin
*] && [lindex $test_what
1] == "-p" } {
533 # uClibc does not have gcrt1.o.
534 if { [check_effective_target_uclibc
]
535 && ([lindex $test_what
1] == "-p"
536 ||
[lindex $test_what
1] == "-pg") } {
540 # Now examine the
cache variable.
541 if {![info exists profiling_available_saved
]} {
542 # Some targets don
't have any implementation of __bb_init_func or are
543 # missing other needed machinery.
544 if { [istarget mmix-*-*]
545 || [istarget arm*-*-eabi*]
546 || [istarget picochip-*-*]
547 || [istarget *-*-netware*]
548 || [istarget arm*-*-elf]
549 || [istarget arm*-*-symbianelf*]
550 || [istarget avr-*-*]
551 || [istarget bfin-*-*]
552 || [istarget powerpc-*-eabi*]
553 || [istarget powerpc-*-elf]
554 || [istarget cris-*-*]
555 || [istarget crisv32-*-*]
556 || [istarget fido-*-elf]
557 || [istarget h8300-*-*]
558 || [istarget lm32-*-*]
559 || [istarget m32c-*-elf]
560 || [istarget m68k-*-elf]
561 || [istarget m68k-*-uclinux*]
562 || [istarget mep-*-elf]
563 || [istarget mips*-*-elf*]
564 || [istarget moxie-*-elf*]
566 || [istarget xstormy16-*]
567 || [istarget xtensa*-*-elf]
568 || [istarget *-*-rtems*]
569 || [istarget *-*-vxworks*] } {
570 set profiling_available_saved 0
572 set profiling_available_saved 1
576 return $profiling_available_saved
579 # Check to see if a target is "freestanding". This is as per the definition
580 # in Section 4 of C99 standard. Effectively, it is a target which supports no
581 # extra headers or libraries other than what is considered essential.
582 proc check_effective_target_freestanding { } {
583 if { [istarget picochip-*-*] } then {
590 # Return 1 if target has packed layout of structure members by
591 # default, 0 otherwise. Note that this is slightly different than
592 # whether the target has "natural alignment": both attributes may be
595 proc check_effective_target_default_packed { } {
596 return [check_no_compiler_messages default_packed assembly {
597 struct x { char a; long b; } c;
598 int s[sizeof (c) == sizeof (char) + sizeof (long) ? 1 : -1];
602 # Return 1 if target has PCC_BITFIELD_TYPE_MATTERS defined. See
603 # documentation, where the test also comes from.
605 proc check_effective_target_pcc_bitfield_type_matters { } {
606 # PCC_BITFIELD_TYPE_MATTERS isn't just about unnamed or empty
607 # bitfields
, but let
's stick to the example code from the docs.
608 return [check_no_compiler_messages pcc_bitfield_type_matters assembly {
609 struct foo1 { char x; char :0; char y; };
610 struct foo2 { char x; int :0; char y; };
611 int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
615 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
617 proc add_options_for_tls { flags } {
618 # Tru64 UNIX uses emutls, which relies on a couple of pthread functions
619 # which only live in libpthread, so always pass -pthread for TLS.
620 if { [istarget *-*-osf*] } {
621 return "$flags -pthread"
623 # On Solaris 8 and 9, __tls_get_addr/___tls_get_addr only lives in
624 # libthread, so always pass -pthread for native TLS.
625 # Need to duplicate native TLS check from
626 # check_effective_target_tls_native to avoid recursion.
627 if { [istarget *-*-solaris2.\[89\]*] &&
628 [check_no_messages_and_pattern tls_native "!emutls" assembly {
630 int f (void) { return i; }
631 void g (int j) { i = j; }
633 return "$flags -pthread"
638 # Return 1 if thread local storage (TLS) is supported, 0 otherwise.
640 proc check_effective_target_tls {} {
641 return [check_no_compiler_messages tls assembly {
643 int f (void) { return i; }
644 void g (int j) { i = j; }
648 # Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
650 proc check_effective_target_tls_native {} {
651 # VxWorks uses emulated TLS machinery, but with non-standard helper
652 # functions, so we fail to automatically detect it.
653 global target_triplet
654 if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
658 return [check_no_messages_and_pattern tls_native "!emutls" assembly {
660 int f (void) { return i; }
661 void g (int j) { i = j; }
665 # Return 1 if *emulated* thread local storage (TLS) is supported, 0 otherwise.
667 proc check_effective_target_tls_emulated {} {
668 # VxWorks uses emulated TLS machinery, but with non-standard helper
669 # functions, so we fail to automatically detect it.
670 global target_triplet
671 if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
675 return [check_no_messages_and_pattern tls_emulated "emutls" assembly {
677 int f (void) { return i; }
678 void g (int j) { i = j; }
682 # Return 1 if TLS executables can run correctly, 0 otherwise.
684 proc check_effective_target_tls_runtime {} {
685 return [check_runtime tls_runtime {
686 __thread int thr = 0;
687 int main (void) { return thr; }
691 # Return 1 if -ffunction-sections is supported, 0 otherwise.
693 proc check_effective_target_function_sections {} {
694 # Darwin has its own scheme and silently accepts -ffunction-sections.
695 global target_triplet
696 if { [regexp ".*-.*-darwin.*" $target_triplet] } {
700 return [check_no_compiler_messages functionsections assembly {
702 } "-ffunction-sections"]
705 # Return 1 if compilation with -fgraphite is error-free for trivial
708 proc check_effective_target_fgraphite {} {
709 return [check_no_compiler_messages fgraphite object {
714 # Return 1 if compilation with -fopenmp is error-free for trivial
717 proc check_effective_target_fopenmp {} {
718 return [check_no_compiler_messages fopenmp object {
723 # Return 1 if compilation with -pthread is error-free for trivial
726 proc check_effective_target_pthread {} {
727 return [check_no_compiler_messages pthread object {
732 # Return 1 if compilation with -mpe-aligned-commons is error-free
733 # for trivial code, 0 otherwise.
735 proc check_effective_target_pe_aligned_commons {} {
736 if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
737 return [check_no_compiler_messages pe_aligned_commons object {
739 } "-mpe-aligned-commons"]
744 # Return 1 if the target supports -static
745 proc check_effective_target_static {} {
746 return [check_no_compiler_messages static executable {
747 int main (void) { return 0; }
751 # Return 1 if the target supports -fstack-protector
752 proc check_effective_target_fstack_protector {} {
753 return [check_runtime fstack_protector {
754 int main (void) { return 0; }
755 } "-fstack-protector"]
758 # Return 1 if compilation with -freorder-blocks-and-partition is error-free
759 # for trivial code, 0 otherwise.
761 proc check_effective_target_freorder {} {
762 return [check_no_compiler_messages freorder object {
764 } "-freorder-blocks-and-partition"]
767 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
768 # emitted, 0 otherwise. Whether a shared library can actually be built is
769 # out of scope for this test.
771 proc check_effective_target_fpic { } {
772 # Note that M68K has a multilib that supports -fpic but not
773 # -fPIC, so we need to check both. We test with a program that
774 # requires GOT references.
775 foreach arg {fpic fPIC} {
776 if [check_no_compiler_messages $arg object {
777 extern int foo (void); extern int bar;
778 int baz (void) { return foo () + bar; }
786 # Return true if the target supports -mpaired-single (as used on MIPS).
788 proc check_effective_target_mpaired_single { } {
789 return [check_no_compiler_messages mpaired_single object {
794 # Return true if the target has access to FPU instructions.
796 proc check_effective_target_hard_float { } {
797 if { [istarget mips*-*-*] } {
798 return [check_no_compiler_messages hard_float assembly {
799 #if (defined __mips_soft_float || defined __mips16)
805 # This proc is actually checking the availabilty of FPU
806 # support for doubles, so on the RX we must fail if the
807 # 64-bit double multilib has been selected.
808 if { [istarget rx-*-*] } {
810 # return [check_no_compiler_messages hard_float assembly {
811 #if defined __RX_64_BIT_DOUBLES__
817 # The generic test equates hard_float with "no call for adding doubles".
818 return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
819 double a (double b, double c) { return b + c; }
823 # Return true if the target is a 64-bit MIPS target.
825 proc check_effective_target_mips64 { } {
826 return [check_no_compiler_messages mips64 assembly {
833 # Return true if the target is a MIPS target that does not produce
836 proc check_effective_target_nomips16 { } {
837 return [check_no_compiler_messages nomips16 object {
841 /* A cheap way of testing for -mflip-mips16. */
842 void foo (void) { asm ("addiu $20,$20,1"); }
843 void bar (void) { asm ("addiu $20,$20,1"); }
848 # Add the options needed for MIPS16 function attributes. At the moment,
849 # we don't support MIPS16 PIC.
851 proc add_options_for_mips16_attribute
{ flags
} {
852 return "$flags -mno-abicalls -fno-pic -DMIPS16=__attribute__((mips16))"
855 #
Return true
if we can force a
mode that allows MIPS16 code generation.
856 # We don
't support MIPS16 PIC, and only support MIPS16 -mhard-float
859 proc check_effective_target_mips16_attribute { } {
860 return [check_no_compiler_messages mips16_attribute assembly {
864 #if defined __mips_hard_float \
865 && (!defined _ABIO32 || _MIPS_SIM != _ABIO32) \
866 && (!defined _ABIO64 || _MIPS_SIM != _ABIO64)
869 } [add_options_for_mips16_attribute ""]]
872 # Return 1 if the target supports long double larger than double when
873 # using the new ABI, 0 otherwise.
875 proc check_effective_target_mips_newabi_large_long_double { } {
876 return [check_no_compiler_messages mips_newabi_large_long_double object {
877 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
881 # Return 1 if the current multilib does not generate PIC by default.
883 proc check_effective_target_nonpic { } {
884 return [check_no_compiler_messages nonpic assembly {
891 # Return 1 if the target does not use a status wrapper.
893 proc check_effective_target_unwrapped { } {
894 if { [target_info needs_status_wrapper] != "" \
895 && [target_info needs_status_wrapper] != "0" } {
901 # Return true if iconv is supported on the target. In particular IBM1047.
903 proc check_iconv_available { test_what } {
906 # If the tool configuration file has not set libiconv, try "-liconv"
907 if { ![info exists libiconv] } {
908 set libiconv "-liconv"
910 set test_what [lindex $test_what 1]
911 return [check_runtime_nocache $test_what [subst {
917 cd = iconv_open ("$test_what", "UTF-8");
918 if (cd == (iconv_t) -1)
925 # Return true if named sections are supported on this target.
927 proc check_named_sections_available { } {
928 return [check_no_compiler_messages named_sections assembly {
929 int __attribute__ ((section("whatever"))) foo;
933 # Return 1 if the target supports Fortran real kinds larger than real(8),
936 # When the target name changes, replace the cached result.
938 proc check_effective_target_fortran_large_real { } {
939 return [check_no_compiler_messages fortran_large_real executable {
941 integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
948 # Return 1 if the target supports Fortran integer kinds larger than
949 # integer(8), 0 otherwise.
951 # When the target name changes, replace the cached result.
953 proc check_effective_target_fortran_large_int { } {
954 return [check_no_compiler_messages fortran_large_int executable {
956 integer,parameter :: k = selected_int_kind (range (0_8) + 1)
962 # Return 1 if the target supports Fortran integer(16), 0 otherwise.
964 # When the target name changes, replace the cached result.
966 proc check_effective_target_fortran_integer_16 { } {
967 return [check_no_compiler_messages fortran_integer_16 executable {
974 # Return 1 if we can statically link libgfortran, 0 otherwise.
976 # When the target name changes, replace the cached result.
978 proc check_effective_target_static_libgfortran { } {
979 return [check_no_compiler_messages static_libgfortran executable {
986 proc check_linker_plugin_available { } {
987 return [check_no_compiler_messages_nocache linker_plugin executable {
988 int main() { return 0; }
989 } "-flto -fuse-linker-plugin"]
992 # Return 1 if the target supports executing 750CL paired-single instructions, 0
993 # otherwise. Cache the result.
995 proc check_750cl_hw_available { } {
996 return [check_cached_effective_target 750cl_hw_available {
997 # If this is not the right target then we can skip the test.
998 if { ![istarget powerpc-*paired*] } {
1001 check_runtime_nocache 750cl_hw_available {
1005 asm volatile ("ps_mul v0,v0,v0");
1007 asm volatile ("ps_mul 0,0,0");
1016 # Return 1 if the target OS supports running SSE executables, 0
1017 # otherwise. Cache the result.
1019 proc check_sse_os_support_available { } {
1020 return [check_cached_effective_target sse_os_support_available {
1021 # If this is not the right target then we can skip the test.
1022 if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
1024 } elseif { [istarget i?86-*-solaris2*] } {
1025 # The Solaris 2 kernel doesn't save and restore SSE registers
1026 # before Solaris
9 4/04. Before that
, executables die with SIGILL.
1027 check_runtime_nocache sse_os_support_available
{
1030 __asm__ volatile
("movss %xmm2,%xmm1");
1040 #
Return 1 if the target supports executing SSE instructions
, 0
1041 # otherwise.
Cache the result.
1043 proc check_sse_hw_available
{ } {
1044 return [check_cached_effective_target sse_hw_available
{
1045 #
If this is not the right target
then we can skip the test.
1046 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1049 check_runtime_nocache sse_hw_available
{
1053 unsigned
int eax
, ebx
, ecx
, edx
;
1054 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1055 return !(edx
& bit_SSE
);
1063 #
Return 1 if the target supports executing SSE2 instructions
, 0
1064 # otherwise.
Cache the result.
1066 proc check_sse2_hw_available
{ } {
1067 return [check_cached_effective_target sse2_hw_available
{
1068 #
If this is not the right target
then we can skip the test.
1069 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1072 check_runtime_nocache sse2_hw_available
{
1076 unsigned
int eax
, ebx
, ecx
, edx
;
1077 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1078 return !(edx
& bit_SSE2
);
1086 #
Return 1 if the target supports executing AVX instructions
, 0
1087 # otherwise.
Cache the result.
1089 proc check_avx_hw_available
{ } {
1090 return [check_cached_effective_target avx_hw_available
{
1091 #
If this is not the right target
then we can skip the test.
1092 if { !([istarget x86_64
-*-*] ||
[istarget i?
86-*-*]) } {
1095 check_runtime_nocache avx_hw_available
{
1099 unsigned
int eax
, ebx
, ecx
, edx
;
1100 if (__get_cpuid
(1, &eax
, &ebx
, &ecx
, &edx
))
1101 return ((ecx
& (bit_AVX | bit_OSXSAVE
))
1102 != (bit_AVX | bit_OSXSAVE
));
1110 #
Return 1 if the target supports running SSE executables
, 0 otherwise.
1112 proc check_effective_target_sse_runtime
{ } {
1113 if { [check_effective_target_sse
]
1114 && [check_sse_hw_available
]
1115 && [check_sse_os_support_available
] } {
1121 #
Return 1 if the target supports running SSE2 executables
, 0 otherwise.
1123 proc check_effective_target_sse2_runtime
{ } {
1124 if { [check_effective_target_sse2
]
1125 && [check_sse2_hw_available
]
1126 && [check_sse_os_support_available
] } {
1132 #
Return 1 if the target supports running AVX executables
, 0 otherwise.
1134 proc check_effective_target_avx_runtime
{ } {
1135 if { [check_effective_target_avx
]
1136 && [check_avx_hw_available
] } {
1142 #
Return 1 if the target supports executing VSX instructions
, 0
1143 # otherwise.
Cache the result.
1145 proc check_vsx_hw_available
{ } {
1146 return [check_cached_effective_target vsx_hw_available
{
1147 # Some simulators are known to not support VSX instructions.
1148 #
For now
, disable
on Darwin
1149 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] ||
[istarget
*-*-darwin
*]} {
1153 check_runtime_nocache vsx_hw_available
{
1157 asm volatile
("xxlor vs0,vs0,vs0");
1159 asm volatile
("xxlor 0,0,0");
1168 #
Return 1 if the target supports executing AltiVec instructions
, 0
1169 # otherwise.
Cache the result.
1171 proc check_vmx_hw_available
{ } {
1172 return [check_cached_effective_target vmx_hw_available
{
1173 # Some simulators are known to not support VMX instructions.
1174 if { [istarget powerpc
-*-eabi
] ||
[istarget powerpc
*-*-eabispe
] } {
1177 # Most targets don
't require special flags for this test case, but
1178 # Darwin does. Just to be sure, make sure VSX is not enabled for
1179 # the altivec tests.
1180 if { [istarget *-*-darwin*]
1181 || [istarget *-*-aix*] } {
1182 set options "-maltivec -mno-vsx"
1184 set options "-mno-vsx"
1186 check_runtime_nocache vmx_hw_available {
1190 asm volatile ("vor v0,v0,v0");
1192 asm volatile ("vor 0,0,0");
1201 proc check_ppc_recip_hw_available { } {
1202 return [check_cached_effective_target ppc_recip_hw_available {
1203 # Some simulators may not support FRE/FRES/FRSQRTE/FRSQRTES
1204 # For now, disable on Darwin
1205 if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
1208 set options "-mpowerpc-gfxopt -mpowerpc-gpopt -mpopcntb"
1209 check_runtime_nocache ppc_recip_hw_available {
1210 volatile double d_recip, d_rsqrt, d_four = 4.0;
1211 volatile float f_recip, f_rsqrt, f_four = 4.0f;
1214 asm volatile ("fres %0,%1" : "=f" (f_recip) : "f" (f_four));
1215 asm volatile ("fre %0,%1" : "=d" (d_recip) : "d" (d_four));
1216 asm volatile ("frsqrtes %0,%1" : "=f" (f_rsqrt) : "f" (f_four));
1217 asm volatile ("frsqrte %0,%1" : "=f" (d_rsqrt) : "d" (d_four));
1225 # Return 1 if the target supports executing AltiVec and Cell PPU
1226 # instructions, 0 otherwise. Cache the result.
1228 proc check_effective_target_cell_hw { } {
1229 return [check_cached_effective_target cell_hw_available {
1230 # Some simulators are known to not support VMX and PPU instructions.
1231 if { [istarget powerpc-*-eabi*] } {
1234 # Most targets don't require special flags
for this test
1235 # case
, but Darwin and AIX
do.
1236 if { [istarget
*-*-darwin
*]
1237 ||
[istarget
*-*-aix
*] } {
1238 set options
"-maltivec -mcpu=cell"
1240 set options
"-mcpu=cell"
1242 check_runtime_nocache cell_hw_available
{
1246 asm volatile
("vor v0,v0,v0");
1247 asm volatile
("lvlx v0,r0,r0");
1249 asm volatile
("vor 0,0,0");
1250 asm volatile
("lvlx 0,0,0");
1259 #
Return 1 if the target supports executing
64-bit instructions
, 0
1260 # otherwise.
Cache the result.
1262 proc check_effective_target_powerpc64
{ } {
1263 global powerpc64_available_saved
1266 if [info exists powerpc64_available_saved
] {
1267 verbose
"check_effective_target_powerpc64 returning saved $powerpc64_available_saved" 2
1269 set powerpc64_available_saved
0
1271 # Some simulators are known to not support powerpc64 instructions.
1272 if { [istarget powerpc
-*-eabi
*] ||
[istarget powerpc
-ibm
-aix
*] } {
1273 verbose
"check_effective_target_powerpc64 returning 0" 2
1274 return $powerpc64_available_saved
1277 #
Set up
, compile, and
execute a test
program containing a
64-bit
1278 # instruction.
Include the current process ID in the file
1279 # names to prevent conflicts with invocations
for multiple
1284 set f
[open $src
"w"]
1285 puts $f
"int main() {"
1286 puts $f
"#ifdef __MACH__"
1287 puts $f
" asm volatile (\"extsw r0,r0\");"
1289 puts $f
" asm volatile (\"extsw 0,0\");"
1291 puts $f
" return 0; }"
1294 set opts
"additional_flags=-mcpu=G5"
1296 verbose
"check_effective_target_powerpc64 compiling testfile $src" 2
1297 set lines
[$
{tool
}_target_compile $src $exe executable
"$opts"]
1300 if [string match
"" $lines] then {
1301 # No error message
, compilation succeeded.
1302 set result
[$
{tool
}_load
"./$exe" "" ""]
1303 set status [lindex $result
0]
1304 remote_file build
delete $exe
1305 verbose
"check_effective_target_powerpc64 testfile status is <$status>" 2
1307 if { $
status == "pass" } then {
1308 set powerpc64_available_saved
1
1311 verbose
"check_effective_target_powerpc64 testfile compilation failed" 2
1315 return $powerpc64_available_saved
1318 # GCC
3.4.0 for powerpc64
-*-linux
* included an ABI fix
for passing
1319 # complex float arguments. This affects gfortran tests that
call cabsf
1320 # in libm built by an earlier compiler.
Return 1 if libm uses the same
1321 #
argument passing as the compiler under test
, 0 otherwise.
1323 # When the target
name changes
, replace the cached result.
1325 proc check_effective_target_broken_cplxf_arg
{ } {
1326 return [check_cached_effective_target broken_cplxf_arg
{
1327 # Skip the work
for targets known not to be affected.
1328 if { ![istarget powerpc64
-*-linux
*] } {
1330 } elseif
{ ![is
-effective
-target lp64
] } {
1333 check_runtime_nocache broken_cplxf_arg
{
1334 #
include <complex.h
>
1335 extern void abort
(void
);
1336 float fabsf
(float
);
1337 float cabsf
(_Complex float
);
1344 if (fabsf
(f
- 5.0) > 0.0001)
1353 proc check_alpha_max_hw_available
{ } {
1354 return [check_runtime alpha_max_hw_available
{
1355 int main
() { return __builtin_alpha_amask
(1<<8) != 0; }
1359 # Returns true iff the FUNCTION is available
on the target
system.
1360 #
(This is essentially a Tcl implementation of Autoconf
's
1363 proc check_function_available { function } {
1364 return [check_no_compiler_messages ${function}_available \
1370 int main () { $function (); }
1374 # Returns true iff "fork" is available on the target system.
1376 proc check_fork_available {} {
1377 return [check_function_available "fork"]
1380 # Returns true iff "mkfifo" is available on the target system.
1382 proc check_mkfifo_available {} {
1383 if {[istarget *-*-cygwin*]} {
1384 # Cygwin has mkfifo, but support is incomplete.
1388 return [check_function_available "mkfifo"]
1391 # Returns true iff "__cxa_atexit" is used on the target system.
1393 proc check_cxa_atexit_available { } {
1394 return [check_cached_effective_target cxa_atexit_available {
1395 if { [istarget "hppa*-*-hpux10*"] } {
1396 # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
1398 } elseif
{ [istarget
"*-*-vxworks"] } {
1399 # vxworks doesn
't have __cxa_atexit but subsequent test passes.
1402 check_runtime_nocache cxa_atexit_available {
1405 static unsigned int count;
1422 Y() { f(); count = 2; }
1431 int main() { return 0; }
1437 proc check_effective_target_objc2 { } {
1438 return [check_no_compiler_messages objc2 object {
1447 proc check_effective_target_next_runtime { } {
1448 return [check_no_compiler_messages objc2 object {
1449 #ifdef __NEXT_RUNTIME__
1457 # Return 1 if we're generating
32-bit code using default options
, 0
1460 proc check_effective_target_ilp32
{ } {
1461 return [check_no_compiler_messages ilp32 object
{
1462 int dummy
[sizeof
(int) == 4
1463 && sizeof
(void
*) == 4
1464 && sizeof
(long
) == 4 ?
1 : -1];
1468 #
Return 1 if we
're generating 32-bit or larger integers using default
1469 # options, 0 otherwise.
1471 proc check_effective_target_int32plus { } {
1472 return [check_no_compiler_messages int32plus object {
1473 int dummy[sizeof (int) >= 4 ? 1 : -1];
1477 # Return 1 if we're generating
32-bit or larger pointers using default
1478 # options
, 0 otherwise.
1480 proc check_effective_target_ptr32plus
{ } {
1481 return [check_no_compiler_messages ptr32plus object
{
1482 int dummy
[sizeof
(void
*) >= 4 ?
1 : -1];
1486 #
Return 1 if we support
32-bit or larger array and structure sizes
1487 # using default options
, 0 otherwise.
1489 proc check_effective_target_size32plus
{ } {
1490 return [check_no_compiler_messages size32plus object
{
1495 # Returns
1 if we
're generating 16-bit or smaller integers with the
1496 # default options, 0 otherwise.
1498 proc check_effective_target_int16 { } {
1499 return [check_no_compiler_messages int16 object {
1500 int dummy[sizeof (int) < 4 ? 1 : -1];
1504 # Return 1 if we're generating
64-bit code using default options
, 0
1507 proc check_effective_target_lp64
{ } {
1508 return [check_no_compiler_messages lp64 object
{
1509 int dummy
[sizeof
(int) == 4
1510 && sizeof
(void
*) == 8
1511 && sizeof
(long
) == 8 ?
1 : -1];
1515 #
Return 1 if we
're generating 64-bit code using default llp64 options,
1518 proc check_effective_target_llp64 { } {
1519 return [check_no_compiler_messages llp64 object {
1520 int dummy[sizeof (int) == 4
1521 && sizeof (void *) == 8
1522 && sizeof (long long) == 8
1523 && sizeof (long) == 4 ? 1 : -1];
1527 # Return 1 if the target supports long double larger than double,
1530 proc check_effective_target_large_long_double { } {
1531 return [check_no_compiler_messages large_long_double object {
1532 int dummy[sizeof(long double) > sizeof(double) ? 1 : -1];
1536 # Return 1 if the target supports double larger than float,
1539 proc check_effective_target_large_double { } {
1540 return [check_no_compiler_messages large_double object {
1541 int dummy[sizeof(double) > sizeof(float) ? 1 : -1];
1545 # Return 1 if the target supports double of 64 bits,
1548 proc check_effective_target_double64 { } {
1549 return [check_no_compiler_messages double64 object {
1550 int dummy[sizeof(double) == 8 ? 1 : -1];
1554 # Return 1 if the target supports double of at least 64 bits,
1557 proc check_effective_target_double64plus { } {
1558 return [check_no_compiler_messages double64plus object {
1559 int dummy[sizeof(double) >= 8 ? 1 : -1];
1563 # Return 1 if the target supports compiling fixed-point,
1566 proc check_effective_target_fixed_point { } {
1567 return [check_no_compiler_messages fixed_point object {
1568 _Sat _Fract x; _Sat _Accum y;
1572 # Return 1 if the target supports compiling decimal floating point,
1575 proc check_effective_target_dfp_nocache { } {
1576 verbose "check_effective_target_dfp_nocache: compiling source" 2
1577 set ret [check_no_compiler_messages_nocache dfp object {
1578 float x __attribute__((mode(DD)));
1580 verbose "check_effective_target_dfp_nocache: returning $ret" 2
1584 proc check_effective_target_dfprt_nocache { } {
1585 return [check_runtime_nocache dfprt {
1586 typedef float d64 __attribute__((mode(DD)));
1587 d64 x = 1.2df, y = 2.3dd, z;
1588 int main () { z = x + y; return 0; }
1592 # Return 1 if the target supports compiling Decimal Floating Point,
1595 # This won't change
for different subtargets so
cache the result.
1597 proc check_effective_target_dfp
{ } {
1598 return [check_cached_effective_target dfp
{
1599 check_effective_target_dfp_nocache
1603 #
Return 1 if the target supports linking and executing Decimal Floating
1604 # Point
, 0 otherwise.
1606 # This won
't change for different subtargets so cache the result.
1608 proc check_effective_target_dfprt { } {
1609 return [check_cached_effective_target dfprt {
1610 check_effective_target_dfprt_nocache
1614 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
1616 proc check_effective_target_ucn_nocache { } {
1617 # -std=c99 is only valid for C
1618 if [check_effective_target_c] {
1619 set ucnopts "-std=c99"
1621 append ucnopts " -fextended-identifiers"
1622 verbose "check_effective_target_ucn_nocache: compiling source" 2
1623 set ret [check_no_compiler_messages_nocache ucn object {
1626 verbose "check_effective_target_ucn_nocache: returning $ret" 2
1630 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
1632 # This won't change
for different subtargets
, so
cache the result.
1634 proc check_effective_target_ucn
{ } {
1635 return [check_cached_effective_target ucn
{
1636 check_effective_target_ucn_nocache
1640 #
Return 1 if the target needs a command line
argument to enable a SIMD
1643 proc check_effective_target_vect_cmdline_needed
{ } {
1644 global et_vect_cmdline_needed_saved
1645 global et_vect_cmdline_needed_target_name
1647 if { ![info exists et_vect_cmdline_needed_target_name
] } {
1648 set et_vect_cmdline_needed_target_name
""
1651 #
If the target has changed since we
set the cached value
, clear it.
1652 set current_target
[current_target_name
]
1653 if { $current_target
!= $et_vect_cmdline_needed_target_name
} {
1654 verbose
"check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2
1655 set et_vect_cmdline_needed_target_name $current_target
1656 if { [info exists et_vect_cmdline_needed_saved
] } {
1657 verbose
"check_effective_target_vect_cmdline_needed: removing cached result" 2
1658 unset et_vect_cmdline_needed_saved
1662 if [info exists et_vect_cmdline_needed_saved
] {
1663 verbose
"check_effective_target_vect_cmdline_needed: using cached result" 2
1665 set et_vect_cmdline_needed_saved
1
1666 if { [istarget alpha
*-*-*]
1667 ||
[istarget ia64
-*-*]
1668 ||
(([istarget x86_64
-*-*] ||
[istarget i?
86-*-*])
1669 && [check_effective_target_lp64
])
1670 ||
([istarget powerpc
*-*-*]
1671 && ([check_effective_target_powerpc_spe
]
1672 ||
[check_effective_target_powerpc_altivec
]))
1673 ||
[istarget spu
-*-*]
1674 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon
]) } {
1675 set et_vect_cmdline_needed_saved
0
1679 verbose
"check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2
1680 return $et_vect_cmdline_needed_saved
1683 #
Return 1 if the target supports hardware vectors of
int, 0 otherwise.
1685 # This won
't change for different subtargets so cache the result.
1687 proc check_effective_target_vect_int { } {
1688 global et_vect_int_saved
1690 if [info exists et_vect_int_saved] {
1691 verbose "check_effective_target_vect_int: using cached result" 2
1693 set et_vect_int_saved 0
1694 if { [istarget i?86-*-*]
1695 || ([istarget powerpc*-*-*]
1696 && ![istarget powerpc-*-linux*paired*])
1697 || [istarget spu-*-*]
1698 || [istarget x86_64-*-*]
1699 || [istarget sparc*-*-*]
1700 || [istarget alpha*-*-*]
1701 || [istarget ia64-*-*]
1702 || [check_effective_target_arm32]
1703 || ([istarget mips*-*-*]
1704 && [check_effective_target_mips_loongson]) } {
1705 set et_vect_int_saved 1
1709 verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2
1710 return $et_vect_int_saved
1713 # Return 1 if the target supports signed int->float conversion
1716 proc check_effective_target_vect_intfloat_cvt { } {
1717 global et_vect_intfloat_cvt_saved
1719 if [info exists et_vect_intfloat_cvt_saved] {
1720 verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2
1722 set et_vect_intfloat_cvt_saved 0
1723 if { [istarget i?86-*-*]
1724 || ([istarget powerpc*-*-*]
1725 && ![istarget powerpc-*-linux*paired*])
1726 || [istarget x86_64-*-*] } {
1727 set et_vect_intfloat_cvt_saved 1
1731 verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2
1732 return $et_vect_intfloat_cvt_saved
1735 #Return 1 if we're supporting __int128
for target
, 0 otherwise.
1737 proc check_effective_target_int128
{ } {
1738 return [check_no_compiler_messages int128 object
{
1740 #ifndef __SIZEOF_INT128__
1749 #
Return 1 if the target supports unsigned
int->float conversion
1752 proc check_effective_target_vect_uintfloat_cvt
{ } {
1753 global et_vect_uintfloat_cvt_saved
1755 if [info exists et_vect_uintfloat_cvt_saved
] {
1756 verbose
"check_effective_target_vect_uintfloat_cvt: using cached result" 2
1758 set et_vect_uintfloat_cvt_saved
0
1759 if { [istarget i?
86-*-*]
1760 ||
([istarget powerpc
*-*-*]
1761 && ![istarget powerpc
-*-linux
*paired
*])
1762 ||
[istarget x86_64
-*-*] } {
1763 set et_vect_uintfloat_cvt_saved
1
1767 verbose
"check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
1768 return $et_vect_uintfloat_cvt_saved
1772 #
Return 1 if the target supports signed float
->int conversion
1775 proc check_effective_target_vect_floatint_cvt
{ } {
1776 global et_vect_floatint_cvt_saved
1778 if [info exists et_vect_floatint_cvt_saved
] {
1779 verbose
"check_effective_target_vect_floatint_cvt: using cached result" 2
1781 set et_vect_floatint_cvt_saved
0
1782 if { [istarget i?
86-*-*]
1783 ||
([istarget powerpc
*-*-*]
1784 && ![istarget powerpc
-*-linux
*paired
*])
1785 ||
[istarget x86_64
-*-*] } {
1786 set et_vect_floatint_cvt_saved
1
1790 verbose
"check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2
1791 return $et_vect_floatint_cvt_saved
1794 #
Return 1 if the target supports unsigned float
->int conversion
1797 proc check_effective_target_vect_floatuint_cvt
{ } {
1798 global et_vect_floatuint_cvt_saved
1800 if [info exists et_vect_floatuint_cvt_saved
] {
1801 verbose
"check_effective_target_vect_floatuint_cvt: using cached result" 2
1803 set et_vect_floatuint_cvt_saved
0
1804 if { ([istarget powerpc
*-*-*]
1805 && ![istarget powerpc
-*-linux
*paired
*]) } {
1806 set et_vect_floatuint_cvt_saved
1
1810 verbose
"check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
1811 return $et_vect_floatuint_cvt_saved
1814 #
Return 1 is this is an arm target using
32-bit instructions
1815 proc check_effective_target_arm32
{ } {
1816 return [check_no_compiler_messages arm32 assembly
{
1817 #
if !defined
(__arm__
) ||
(defined
(__thumb__
) && !defined
(__thumb2__
))
1823 #
Return 1 if this is an ARM target that only supports aligned vector accesses
1824 proc check_effective_target_arm_vect_no_misalign
{ } {
1825 return [check_no_compiler_messages arm_vect_no_misalign assembly
{
1826 #
if !defined
(__arm__
) \
1827 ||
(defined
(__ARMEL__
) \
1828 && (!defined
(__thumb__
) || defined
(__thumb2__
)))
1835 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
1836 #
-mfloat
-abi
=softfp. Some multilibs may be incompatible with these
1839 proc check_effective_target_arm_vfp_ok
{ } {
1840 if { [check_effective_target_arm32
] } {
1841 return [check_no_compiler_messages arm_vfp_ok object
{
1843 } "-mfpu=vfp -mfloat-abi=softfp"]
1849 #
Return 1 if this is an ARM target supporting
-mfpu
=vfp
1850 #
-mfloat
-abi
=hard. Some multilibs may be incompatible with these
1853 proc check_effective_target_arm_hard_vfp_ok
{ } {
1854 if { [check_effective_target_arm32
] } {
1855 return [check_no_compiler_messages arm_hard_vfp_ok executable
{
1856 int main
() { return 0;}
1857 } "-mfpu=vfp -mfloat-abi=hard"]
1863 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
1864 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
1865 # multilib
, use it. Similarly
, if a
-mfpu option already enables
1866 # NEON
, do not add
-mfpu
=neon.
1868 proc add_options_for_arm_neon
{ flags
} {
1869 if { ! [check_effective_target_arm_neon_ok
] } {
1872 global et_arm_neon_flags
1873 return "$flags $et_arm_neon_flags"
1876 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
1877 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
1878 # incompatible with these options. Also
set et_arm_neon_flags to the
1879 # best options to add.
1881 proc check_effective_target_arm_neon_ok_nocache
{ } {
1882 global et_arm_neon_flags
1883 set et_arm_neon_flags
""
1884 if { [check_effective_target_arm32
] } {
1885 foreach flags
{"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp"} {
1886 if { [check_no_compiler_messages_nocache arm_neon_ok object
{
1887 #
include "arm_neon.h"
1890 set et_arm_neon_flags $flags
1899 proc check_effective_target_arm_neon_ok
{ } {
1900 return [check_cached_effective_target arm_neon_ok \
1901 check_effective_target_arm_neon_ok_nocache
]
1904 # Add the options needed
for NEON. We need either
-mfloat
-abi
=softfp
1905 # or
-mfloat
-abi
=hard
, but
if one is already specified by the
1908 proc add_options_for_arm_neon_fp16
{ flags
} {
1909 if { ! [check_effective_target_arm_neon_fp16_ok
] } {
1912 global et_arm_neon_fp16_flags
1913 return "$flags $et_arm_neon_fp16_flags"
1916 #
Return 1 if this is an ARM target supporting
-mfpu
=neon
-fp16
1917 #
-mfloat
-abi
=softfp or equivalent options. Some multilibs may be
1918 # incompatible with these options. Also
set et_arm_neon_flags to the
1919 # best options to add.
1921 proc check_effective_target_arm_neon_fp16_ok_nocache
{ } {
1922 global et_arm_neon_fp16_flags
1923 set et_arm_neon_fp16_flags
""
1924 if { [check_effective_target_arm32
] } {
1925 # Always add
-mfpu
=neon
-fp16
, since there is no preprocessor
1926 # macro
for FP16 support.
1927 foreach flags
{"-mfpu=neon-fp16" "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
1928 if { [check_no_compiler_messages_nocache arm_neon_fp16_ok object
{
1929 #
include "arm_neon.h"
1932 set et_arm_neon_fp16_flags $flags
1941 proc check_effective_target_arm_neon_fp16_ok
{ } {
1942 return [check_cached_effective_target arm_neon_fp16_ok \
1943 check_effective_target_arm_neon_fp16_ok_nocache
]
1946 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-1 to be
1949 proc check_effective_target_arm_thumb1_ok
{ } {
1950 return [check_no_compiler_messages arm_thumb1_ok assembly
{
1951 #
if !defined
(__arm__
) ||
!defined
(__thumb__
) || defined
(__thumb2__
)
1957 #
Return 1 is this is an ARM target where
-mthumb causes Thumb
-2 to be
1960 proc check_effective_target_arm_thumb2_ok
{ } {
1961 return [check_no_compiler_messages arm_thumb2_ok assembly
{
1962 #
if !defined
(__thumb2__
)
1968 #
Return 1 if the target supports executing NEON instructions
, 0
1969 # otherwise.
Cache the result.
1971 proc check_effective_target_arm_neon_hw
{ } {
1972 return [check_runtime arm_neon_hw_available
{
1976 long long a
= 0, b
= 1;
1977 asm
("vorr %P0, %P1, %P2"
1979 : "0" (a), "w" (b));
1982 } [add_options_for_arm_neon
""]]
1985 #
Return 1 if this is a ARM target with NEON enabled.
1987 proc check_effective_target_arm_neon
{ } {
1988 if { [check_effective_target_arm32
] } {
1989 return [check_no_compiler_messages arm_neon object
{
1990 #ifndef __ARM_NEON__
2001 #
Return 1 if this a Loongson
-2E or
-2F target using an ABI that supports
2002 # the Loongson vector modes.
2004 proc check_effective_target_mips_loongson
{ } {
2005 return [check_no_compiler_messages loongson assembly
{
2006 #
if !defined
(__mips_loongson_vector_rev
)
2012 #
Return 1 if this is an ARM target that adheres to the ABI
for the ARM
2015 proc check_effective_target_arm_eabi
{ } {
2016 return [check_no_compiler_messages arm_eabi object
{
2017 #ifndef __ARM_EABI__
2025 #
Return 1 if this is an ARM target supporting
-mcpu
=iwmmxt.
2026 # Some multilibs may be incompatible with this option.
2028 proc check_effective_target_arm_iwmmxt_ok
{ } {
2029 if { [check_effective_target_arm32
] } {
2030 return [check_no_compiler_messages arm_iwmmxt_ok object
{
2038 #
Return 1 if this is a PowerPC target with floating
-point registers.
2040 proc check_effective_target_powerpc_fprs
{ } {
2041 if { [istarget powerpc
*-*-*]
2042 ||
[istarget rs6000
-*-*] } {
2043 return [check_no_compiler_messages powerpc_fprs object
{
2055 #
Return 1 if this is a PowerPC target with hardware double
-precision
2058 proc check_effective_target_powerpc_hard_double
{ } {
2059 if { [istarget powerpc
*-*-*]
2060 ||
[istarget rs6000
-*-*] } {
2061 return [check_no_compiler_messages powerpc_hard_double object
{
2073 #
Return 1 if this is a PowerPC target supporting
-maltivec.
2075 proc check_effective_target_powerpc_altivec_ok
{ } {
2076 if { ([istarget powerpc
*-*-*]
2077 && ![istarget powerpc
-*-linux
*paired
*])
2078 ||
[istarget rs6000
-*-*] } {
2079 # AltiVec is not supported
on AIX before
5.3.
2080 if { [istarget powerpc
*-*-aix4
*]
2081 ||
[istarget powerpc
*-*-aix5.1
*]
2082 ||
[istarget powerpc
*-*-aix5.2
*] } {
2085 return [check_no_compiler_messages powerpc_altivec_ok object
{
2093 #
Return 1 if this is a PowerPC target supporting
-mvsx
2095 proc check_effective_target_powerpc_vsx_ok
{ } {
2096 if { ([istarget powerpc
*-*-*]
2097 && ![istarget powerpc
-*-linux
*paired
*])
2098 ||
[istarget rs6000
-*-*] } {
2099 # AltiVec is not supported
on AIX before
5.3.
2100 if { [istarget powerpc
*-*-aix4
*]
2101 ||
[istarget powerpc
*-*-aix5.1
*]
2102 ||
[istarget powerpc
*-*-aix5.2
*] } {
2105 return [check_no_compiler_messages powerpc_vsx_ok object
{
2108 asm volatile
("xxlor vs0,vs0,vs0");
2110 asm volatile
("xxlor 0,0,0");
2120 #
Return 1 if this is a PowerPC target supporting
-mcpu
=cell.
2122 proc check_effective_target_powerpc_ppu_ok
{ } {
2123 if [check_effective_target_powerpc_altivec_ok
] {
2124 return [check_no_compiler_messages cell_asm_available object
{
2127 asm volatile
("lvlx v0,v0,v0");
2129 asm volatile
("lvlx 0,0,0");
2139 #
Return 1 if this is a PowerPC target that supports SPU.
2141 proc check_effective_target_powerpc_spu
{ } {
2142 if [istarget powerpc
*-*-linux
*] {
2143 return [check_effective_target_powerpc_altivec_ok
]
2149 #
Return 1 if this is a PowerPC SPE target. The check includes options
2150 # specified by dg
-options
for this test
, so don
't cache the result.
2152 proc check_effective_target_powerpc_spe_nocache { } {
2153 if { [istarget powerpc*-*-*] } {
2154 return [check_no_compiler_messages_nocache powerpc_spe object {
2160 } [current_compiler_flags]]
2166 # Return 1 if this is a PowerPC target with SPE enabled.
2168 proc check_effective_target_powerpc_spe { } {
2169 if { [istarget powerpc*-*-*] } {
2170 return [check_no_compiler_messages powerpc_spe object {
2182 # Return 1 if this is a PowerPC target with Altivec enabled.
2184 proc check_effective_target_powerpc_altivec { } {
2185 if { [istarget powerpc*-*-*] } {
2186 return [check_no_compiler_messages powerpc_altivec object {
2198 # Return 1 if this is a PowerPC 405 target. The check includes options
2199 # specified by dg-options for this test, so don't
cache the result.
2201 proc check_effective_target_powerpc_405_nocache
{ } {
2202 if { [istarget powerpc
*-*-*] ||
[istarget rs6000
-*-*] } {
2203 return [check_no_compiler_messages_nocache powerpc_405 object
{
2209 } [current_compiler_flags
]]
2215 #
Return 1 if this is a SPU target with a toolchain that
2216 # supports automatic overlay generation.
2218 proc check_effective_target_spu_auto_overlay
{ } {
2219 if { [istarget spu
*-*-elf
*] } {
2220 return [check_no_compiler_messages spu_auto_overlay executable
{
2222 } "-Wl,--auto-overlay" ]
2228 # The VxWorks SPARC simulator accepts only EM_SPARC executables and
2229 # chokes
on EM_SPARC32PLUS or EM_SPARCV9 executables.
Return 1 if the
2230 # test environment appears to run executables
on such a simulator.
2232 proc check_effective_target_ultrasparc_hw
{ } {
2233 return [check_runtime ultrasparc_hw
{
2234 int main
() { return 0; }
2235 } "-mcpu=ultrasparc"]
2238 #
Return 1 if the target supports hardware vector shift operation.
2240 proc check_effective_target_vect_shift
{ } {
2241 global et_vect_shift_saved
2243 if [info exists et_vect_shift_saved
] {
2244 verbose
"check_effective_target_vect_shift: using cached result" 2
2246 set et_vect_shift_saved
0
2247 if { ([istarget powerpc
*-*-*]
2248 && ![istarget powerpc
-*-linux
*paired
*])
2249 ||
[istarget ia64
-*-*]
2250 ||
[istarget i?
86-*-*]
2251 ||
[istarget x86_64
-*-*]
2252 ||
[check_effective_target_arm32
]
2253 ||
([istarget mips
*-*-*]
2254 && [check_effective_target_mips_loongson
]) } {
2255 set et_vect_shift_saved
1
2259 verbose
"check_effective_target_vect_shift: returning $et_vect_shift_saved" 2
2260 return $et_vect_shift_saved
2263 #
Return 1 if the target supports hardware vector shift operation with
2264 # scalar shift
argument.
2266 proc check_effective_target_vect_shift_scalar
{ } {
2267 global et_vect_shift_scalar_saved
2269 if [info exists et_vect_shift_scalar_saved
] {
2270 verbose
"check_effective_target_vect_shift_scalar: using cached result" 2
2272 set et_vect_shift_scalar_saved
0
2273 if { [istarget x86_64
-*-*]
2274 ||
[istarget i?
86-*-*] } {
2275 set et_vect_shift_scalar_saved
1
2279 verbose
"check_effective_target_vect_shift_scalar: returning $et_vect_shift_scalar_saved" 2
2280 return $et_vect_shift_scalar_saved
2284 #
Return 1 if the target supports hardware vectors of long
, 0 otherwise.
2286 # This can change
for different subtargets so
do not
cache the result.
2288 proc check_effective_target_vect_long
{ } {
2289 if { [istarget i?
86-*-*]
2290 ||
(([istarget powerpc
*-*-*]
2291 && ![istarget powerpc
-*-linux
*paired
*])
2292 && [check_effective_target_ilp32
])
2293 ||
[istarget x86_64
-*-*]
2294 ||
[check_effective_target_arm32
]
2295 ||
([istarget sparc
*-*-*] && [check_effective_target_ilp32
]) } {
2301 verbose
"check_effective_target_vect_long: returning $answer" 2
2305 #
Return 1 if the target supports hardware vectors of float
, 0 otherwise.
2307 # This won
't change for different subtargets so cache the result.
2309 proc check_effective_target_vect_float { } {
2310 global et_vect_float_saved
2312 if [info exists et_vect_float_saved] {
2313 verbose "check_effective_target_vect_float: using cached result" 2
2315 set et_vect_float_saved 0
2316 if { [istarget i?86-*-*]
2317 || [istarget powerpc*-*-*]
2318 || [istarget spu-*-*]
2319 || [istarget mipsisa64*-*-*]
2320 || [istarget x86_64-*-*]
2321 || [istarget ia64-*-*]
2322 || [check_effective_target_arm32] } {
2323 set et_vect_float_saved 1
2327 verbose "check_effective_target_vect_float: returning $et_vect_float_saved" 2
2328 return $et_vect_float_saved
2331 # Return 1 if the target supports hardware vectors of double, 0 otherwise.
2333 # This won't change
for different subtargets so
cache the result.
2335 proc check_effective_target_vect_double
{ } {
2336 global et_vect_double_saved
2338 if [info exists et_vect_double_saved
] {
2339 verbose
"check_effective_target_vect_double: using cached result" 2
2341 set et_vect_double_saved
0
2342 if { [istarget i?
86-*-*]
2343 ||
[istarget x86_64
-*-*] } {
2344 if { [check_no_compiler_messages vect_double assembly
{
2345 #ifdef __tune_atom__
2346 # error No double vectorizer support.
2349 set et_vect_double_saved
1
2351 set et_vect_double_saved
0
2353 } elseif
{ [istarget spu
-*-*] } {
2354 set et_vect_double_saved
1
2358 verbose
"check_effective_target_vect_double: returning $et_vect_double_saved" 2
2359 return $et_vect_double_saved
2362 #
Return 1 if the target supports hardware vectors of long long
, 0 otherwise.
2364 # This won
't change for different subtargets so cache the result.
2366 proc check_effective_target_vect_long_long { } {
2367 global et_vect_long_long_saved
2369 if [info exists et_vect_long_long_saved] {
2370 verbose "check_effective_target_vect_long_long: using cached result" 2
2372 set et_vect_long_long_saved 0
2373 if { [istarget i?86-*-*]
2374 || [istarget x86_64-*-*] } {
2375 set et_vect_long_long_saved 1
2379 verbose "check_effective_target_vect_long_long: returning $et_vect_long_long_saved" 2
2380 return $et_vect_long_long_saved
2384 # Return 1 if the target plus current options does not support a vector
2385 # max instruction on "int", 0 otherwise.
2387 # This won't change
for different subtargets so
cache the result.
2389 proc check_effective_target_vect_no_int_max
{ } {
2390 global et_vect_no_int_max_saved
2392 if [info exists et_vect_no_int_max_saved
] {
2393 verbose
"check_effective_target_vect_no_int_max: using cached result" 2
2395 set et_vect_no_int_max_saved
0
2396 if { [istarget sparc
*-*-*]
2397 ||
[istarget spu
-*-*]
2398 ||
[istarget alpha
*-*-*]
2399 ||
([istarget mips
*-*-*]
2400 && [check_effective_target_mips_loongson
]) } {
2401 set et_vect_no_int_max_saved
1
2404 verbose
"check_effective_target_vect_no_int_max: returning $et_vect_no_int_max_saved" 2
2405 return $et_vect_no_int_max_saved
2408 #
Return 1 if the target plus current options does not support a vector
2409 # add instruction
on "int", 0 otherwise.
2411 # This won
't change for different subtargets so cache the result.
2413 proc check_effective_target_vect_no_int_add { } {
2414 global et_vect_no_int_add_saved
2416 if [info exists et_vect_no_int_add_saved] {
2417 verbose "check_effective_target_vect_no_int_add: using cached result" 2
2419 set et_vect_no_int_add_saved 0
2420 # Alpha only supports vector add on V8QI and V4HI.
2421 if { [istarget alpha*-*-*] } {
2422 set et_vect_no_int_add_saved 1
2425 verbose "check_effective_target_vect_no_int_add: returning $et_vect_no_int_add_saved" 2
2426 return $et_vect_no_int_add_saved
2429 # Return 1 if the target plus current options does not support vector
2430 # bitwise instructions, 0 otherwise.
2432 # This won't change
for different subtargets so
cache the result.
2434 proc check_effective_target_vect_no_bitwise
{ } {
2435 global et_vect_no_bitwise_saved
2437 if [info exists et_vect_no_bitwise_saved
] {
2438 verbose
"check_effective_target_vect_no_bitwise: using cached result" 2
2440 set et_vect_no_bitwise_saved
0
2442 verbose
"check_effective_target_vect_no_bitwise: returning $et_vect_no_bitwise_saved" 2
2443 return $et_vect_no_bitwise_saved
2446 #
Return 1 if the target plus current options supports vector permutation
,
2449 # This won
't change for different subtargets so cache the result.
2451 proc check_effective_target_vect_perm { } {
2454 if [info exists et_vect_perm_saved] {
2455 verbose "check_effective_target_vect_perm: using cached result" 2
2457 set et_vect_perm_saved 0
2458 if { [istarget powerpc*-*-*]
2459 || [istarget spu-*-*]
2460 || [istarget i?86-*-*]
2461 || [istarget x86_64-*-*] } {
2462 set et_vect_perm_saved 1
2465 verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
2466 return $et_vect_perm_saved
2469 # Return 1 if the target plus current options supports vector permutation
2470 # on byte-sized elements, 0 otherwise.
2472 # This won't change
for different subtargets so
cache the result.
2474 proc check_effective_target_vect_perm_byte
{ } {
2475 global et_vect_perm_byte
2477 if [info exists et_vect_perm_byte_saved
] {
2478 verbose
"check_effective_target_vect_perm_byte: using cached result" 2
2480 set et_vect_perm_byte_saved
0
2481 if { [istarget powerpc
*-*-*]
2482 ||
[istarget spu
-*-*] } {
2483 set et_vect_perm_byte_saved
1
2486 verbose
"check_effective_target_vect_perm_byte: returning $et_vect_perm_byte_saved" 2
2487 return $et_vect_perm_byte_saved
2490 #
Return 1 if the target plus current options supports vector permutation
2491 #
on short
-sized elements
, 0 otherwise.
2493 # This won
't change for different subtargets so cache the result.
2495 proc check_effective_target_vect_perm_short { } {
2496 global et_vect_perm_short
2498 if [info exists et_vect_perm_short_saved] {
2499 verbose "check_effective_target_vect_perm_short: using cached result" 2
2501 set et_vect_perm_short_saved 0
2502 if { [istarget powerpc*-*-*]
2503 || [istarget spu-*-*] } {
2504 set et_vect_perm_short_saved 1
2507 verbose "check_effective_target_vect_perm_short: returning $et_vect_perm_short_saved" 2
2508 return $et_vect_perm_short_saved
2511 # Return 1 if the target plus current options supports a vector
2512 # widening summation of *short* args into *int* result, 0 otherwise.
2514 # This won't change
for different subtargets so
cache the result.
2516 proc check_effective_target_vect_widen_sum_hi_to_si_pattern
{ } {
2517 global et_vect_widen_sum_hi_to_si_pattern
2519 if [info exists et_vect_widen_sum_hi_to_si_pattern_saved
] {
2520 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: using cached result" 2
2522 set et_vect_widen_sum_hi_to_si_pattern_saved
0
2523 if { [istarget powerpc
*-*-*]
2524 ||
[istarget ia64
-*-*] } {
2525 set et_vect_widen_sum_hi_to_si_pattern_saved
1
2528 verbose
"check_effective_target_vect_widen_sum_hi_to_si_pattern: returning $et_vect_widen_sum_hi_to_si_pattern_saved" 2
2529 return $et_vect_widen_sum_hi_to_si_pattern_saved
2532 #
Return 1 if the target plus current options supports a vector
2533 # widening summation of
*short
* args into
*int* result
, 0 otherwise.
2534 # A target can also support this widening summation
if it can support
2535 # promotion
(unpacking
) from shorts to ints.
2537 # This won
't change for different subtargets so cache the result.
2539 proc check_effective_target_vect_widen_sum_hi_to_si { } {
2540 global et_vect_widen_sum_hi_to_si
2542 if [info exists et_vect_widen_sum_hi_to_si_saved] {
2543 verbose "check_effective_target_vect_widen_sum_hi_to_si: using cached result" 2
2545 set et_vect_widen_sum_hi_to_si_saved [check_effective_target_vect_unpack]
2546 if { [istarget powerpc*-*-*]
2547 || [istarget ia64-*-*] } {
2548 set et_vect_widen_sum_hi_to_si_saved 1
2551 verbose "check_effective_target_vect_widen_sum_hi_to_si: returning $et_vect_widen_sum_hi_to_si_saved" 2
2552 return $et_vect_widen_sum_hi_to_si_saved
2555 # Return 1 if the target plus current options supports a vector
2556 # widening summation of *char* args into *short* result, 0 otherwise.
2557 # A target can also support this widening summation if it can support
2558 # promotion (unpacking) from chars to shorts.
2560 # This won't change
for different subtargets so
cache the result.
2562 proc check_effective_target_vect_widen_sum_qi_to_hi
{ } {
2563 global et_vect_widen_sum_qi_to_hi
2565 if [info exists et_vect_widen_sum_qi_to_hi_saved
] {
2566 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: using cached result" 2
2568 set et_vect_widen_sum_qi_to_hi_saved
0
2569 if { [check_effective_target_vect_unpack
]
2570 ||
[istarget ia64
-*-*] } {
2571 set et_vect_widen_sum_qi_to_hi_saved
1
2574 verbose
"check_effective_target_vect_widen_sum_qi_to_hi: returning $et_vect_widen_sum_qi_to_hi_saved" 2
2575 return $et_vect_widen_sum_qi_to_hi_saved
2578 #
Return 1 if the target plus current options supports a vector
2579 # widening summation of
*char
* args into
*int* result
, 0 otherwise.
2581 # This won
't change for different subtargets so cache the result.
2583 proc check_effective_target_vect_widen_sum_qi_to_si { } {
2584 global et_vect_widen_sum_qi_to_si
2586 if [info exists et_vect_widen_sum_qi_to_si_saved] {
2587 verbose "check_effective_target_vect_widen_sum_qi_to_si: using cached result" 2
2589 set et_vect_widen_sum_qi_to_si_saved 0
2590 if { [istarget powerpc*-*-*] } {
2591 set et_vect_widen_sum_qi_to_si_saved 1
2594 verbose "check_effective_target_vect_widen_sum_qi_to_si: returning $et_vect_widen_sum_qi_to_si_saved" 2
2595 return $et_vect_widen_sum_qi_to_si_saved
2598 # Return 1 if the target plus current options supports a vector
2599 # widening multiplication of *char* args into *short* result, 0 otherwise.
2600 # A target can also support this widening multplication if it can support
2601 # promotion (unpacking) from chars to shorts, and vect_short_mult (non-widening
2602 # multiplication of shorts).
2604 # This won't change
for different subtargets so
cache the result.
2607 proc check_effective_target_vect_widen_mult_qi_to_hi
{ } {
2608 global et_vect_widen_mult_qi_to_hi
2610 if [info exists et_vect_widen_mult_qi_to_hi_saved
] {
2611 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: using cached result" 2
2613 if { [check_effective_target_vect_unpack
]
2614 && [check_effective_target_vect_short_mult
] } {
2615 set et_vect_widen_mult_qi_to_hi_saved
1
2617 set et_vect_widen_mult_qi_to_hi_saved
0
2619 if { [istarget powerpc
*-*-*] } {
2620 set et_vect_widen_mult_qi_to_hi_saved
1
2623 verbose
"check_effective_target_vect_widen_mult_qi_to_hi: returning $et_vect_widen_mult_qi_to_hi_saved" 2
2624 return $et_vect_widen_mult_qi_to_hi_saved
2627 #
Return 1 if the target plus current options supports a vector
2628 # widening multiplication of
*short
* args into
*int* result
, 0 otherwise.
2629 # A target can also support this widening multplication
if it can support
2630 # promotion
(unpacking
) from shorts to ints
, and vect_int_mult
(non
-widening
2631 # multiplication of ints
).
2633 # This won
't change for different subtargets so cache the result.
2636 proc check_effective_target_vect_widen_mult_hi_to_si { } {
2637 global et_vect_widen_mult_hi_to_si
2639 if [info exists et_vect_widen_mult_hi_to_si_saved] {
2640 verbose "check_effective_target_vect_widen_mult_hi_to_si: using cached result" 2
2642 if { [check_effective_target_vect_unpack]
2643 && [check_effective_target_vect_int_mult] } {
2644 set et_vect_widen_mult_hi_to_si_saved 1
2646 set et_vect_widen_mult_hi_to_si_saved 0
2648 if { [istarget powerpc*-*-*]
2649 || [istarget spu-*-*]
2650 || [istarget ia64-*-*]
2651 || [istarget i?86-*-*]
2652 || [istarget x86_64-*-*] } {
2653 set et_vect_widen_mult_hi_to_si_saved 1
2656 verbose "check_effective_target_vect_widen_mult_hi_to_si: returning $et_vect_widen_mult_hi_to_si_saved" 2
2657 return $et_vect_widen_mult_hi_to_si_saved
2660 # Return 1 if the target plus current options supports a vector
2661 # dot-product of signed chars, 0 otherwise.
2663 # This won't change
for different subtargets so
cache the result.
2665 proc check_effective_target_vect_sdot_qi
{ } {
2666 global et_vect_sdot_qi
2668 if [info exists et_vect_sdot_qi_saved
] {
2669 verbose
"check_effective_target_vect_sdot_qi: using cached result" 2
2671 set et_vect_sdot_qi_saved
0
2672 if { [istarget ia64
-*-*] } {
2673 set et_vect_udot_qi_saved
1
2676 verbose
"check_effective_target_vect_sdot_qi: returning $et_vect_sdot_qi_saved" 2
2677 return $et_vect_sdot_qi_saved
2680 #
Return 1 if the target plus current options supports a vector
2681 # dot
-product of unsigned chars
, 0 otherwise.
2683 # This won
't change for different subtargets so cache the result.
2685 proc check_effective_target_vect_udot_qi { } {
2686 global et_vect_udot_qi
2688 if [info exists et_vect_udot_qi_saved] {
2689 verbose "check_effective_target_vect_udot_qi: using cached result" 2
2691 set et_vect_udot_qi_saved 0
2692 if { [istarget powerpc*-*-*]
2693 || [istarget ia64-*-*] } {
2694 set et_vect_udot_qi_saved 1
2697 verbose "check_effective_target_vect_udot_qi: returning $et_vect_udot_qi_saved" 2
2698 return $et_vect_udot_qi_saved
2701 # Return 1 if the target plus current options supports a vector
2702 # dot-product of signed shorts, 0 otherwise.
2704 # This won't change
for different subtargets so
cache the result.
2706 proc check_effective_target_vect_sdot_hi
{ } {
2707 global et_vect_sdot_hi
2709 if [info exists et_vect_sdot_hi_saved
] {
2710 verbose
"check_effective_target_vect_sdot_hi: using cached result" 2
2712 set et_vect_sdot_hi_saved
0
2713 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
2714 ||
[istarget ia64
-*-*]
2715 ||
[istarget i?
86-*-*]
2716 ||
[istarget x86_64
-*-*] } {
2717 set et_vect_sdot_hi_saved
1
2720 verbose
"check_effective_target_vect_sdot_hi: returning $et_vect_sdot_hi_saved" 2
2721 return $et_vect_sdot_hi_saved
2724 #
Return 1 if the target plus current options supports a vector
2725 # dot
-product of unsigned shorts
, 0 otherwise.
2727 # This won
't change for different subtargets so cache the result.
2729 proc check_effective_target_vect_udot_hi { } {
2730 global et_vect_udot_hi
2732 if [info exists et_vect_udot_hi_saved] {
2733 verbose "check_effective_target_vect_udot_hi: using cached result" 2
2735 set et_vect_udot_hi_saved 0
2736 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) } {
2737 set et_vect_udot_hi_saved 1
2740 verbose "check_effective_target_vect_udot_hi: returning $et_vect_udot_hi_saved" 2
2741 return $et_vect_udot_hi_saved
2745 # Return 1 if the target plus current options supports a vector
2746 # demotion (packing) of shorts (to chars) and ints (to shorts)
2747 # using modulo arithmetic, 0 otherwise.
2749 # This won't change
for different subtargets so
cache the result.
2751 proc check_effective_target_vect_pack_trunc
{ } {
2752 global et_vect_pack_trunc
2754 if [info exists et_vect_pack_trunc_saved
] {
2755 verbose
"check_effective_target_vect_pack_trunc: using cached result" 2
2757 set et_vect_pack_trunc_saved
0
2758 if { ([istarget powerpc
*-*-*] && ![istarget powerpc
-*-linux
*paired
*])
2759 ||
[istarget i?
86-*-*]
2760 ||
[istarget x86_64
-*-*]
2761 ||
[istarget spu
-*-*]
2762 ||
([istarget arm
*-*-*] && [check_effective_target_arm_neon
]) } {
2763 set et_vect_pack_trunc_saved
1
2766 verbose
"check_effective_target_vect_pack_trunc: returning $et_vect_pack_trunc_saved" 2
2767 return $et_vect_pack_trunc_saved
2770 #
Return 1 if the target plus current options supports a vector
2771 # promotion
(unpacking
) of chars
(to shorts
) and shorts
(to ints
), 0 otherwise.
2773 # This won
't change for different subtargets so cache the result.
2775 proc check_effective_target_vect_unpack { } {
2776 global et_vect_unpack
2778 if [info exists et_vect_unpack_saved] {
2779 verbose "check_effective_target_vect_unpack: using cached result" 2
2781 set et_vect_unpack_saved 0
2782 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*paired*])
2783 || [istarget i?86-*-*]
2784 || [istarget x86_64-*-*]
2785 || [istarget spu-*-*]
2786 || [istarget ia64-*-*]
2787 || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
2788 set et_vect_unpack_saved 1
2791 verbose "check_effective_target_vect_unpack: returning $et_vect_unpack_saved" 2
2792 return $et_vect_unpack_saved
2795 # Return 1 if the target plus current options does not guarantee
2796 # that its STACK_BOUNDARY is >= the reguired vector alignment.
2798 # This won't change
for different subtargets so
cache the result.
2800 proc check_effective_target_unaligned_stack
{ } {
2801 global et_unaligned_stack_saved
2803 if [info exists et_unaligned_stack_saved
] {
2804 verbose
"check_effective_target_unaligned_stack: using cached result" 2
2806 set et_unaligned_stack_saved
0
2808 verbose
"check_effective_target_unaligned_stack: returning $et_unaligned_stack_saved" 2
2809 return $et_unaligned_stack_saved
2812 #
Return 1 if the target plus current options does not support a vector
2813 # alignment mechanism
, 0 otherwise.
2815 # This won
't change for different subtargets so cache the result.
2817 proc check_effective_target_vect_no_align { } {
2818 global et_vect_no_align_saved
2820 if [info exists et_vect_no_align_saved] {
2821 verbose "check_effective_target_vect_no_align: using cached result" 2
2823 set et_vect_no_align_saved 0
2824 if { [istarget mipsisa64*-*-*]
2825 || [istarget sparc*-*-*]
2826 || [istarget ia64-*-*]
2827 || [check_effective_target_arm_vect_no_misalign]
2828 || ([istarget mips*-*-*]
2829 && [check_effective_target_mips_loongson]) } {
2830 set et_vect_no_align_saved 1
2833 verbose "check_effective_target_vect_no_align: returning $et_vect_no_align_saved" 2
2834 return $et_vect_no_align_saved
2837 # Return 1 if the target supports a vector misalign access, 0 otherwise.
2839 # This won't change
for different subtargets so
cache the result.
2841 proc check_effective_target_vect_hw_misalign
{ } {
2842 global et_vect_hw_misalign_saved
2844 if [info exists et_vect_hw_misalign_saved
] {
2845 verbose
"check_effective_target_vect_hw_misalign: using cached result" 2
2847 set et_vect_hw_misalign_saved
0
2848 if { ([istarget x86_64
-*-*]
2849 ||
[istarget i?
86-*-*]) } {
2850 set et_vect_hw_misalign_saved
1
2853 verbose
"check_effective_target_vect_hw_misalign: returning $et_vect_hw_misalign_saved" 2
2854 return $et_vect_hw_misalign_saved
2858 #
Return 1 if arrays are aligned to the vector alignment
2859 # boundary
, 0 otherwise.
2861 # This won
't change for different subtargets so cache the result.
2863 proc check_effective_target_vect_aligned_arrays { } {
2864 global et_vect_aligned_arrays
2866 if [info exists et_vect_aligned_arrays_saved] {
2867 verbose "check_effective_target_vect_aligned_arrays: using cached result" 2
2869 set et_vect_aligned_arrays_saved 0
2870 if { (([istarget x86_64-*-*]
2871 || [istarget i?86-*-*]) && [is-effective-target lp64])
2872 || [istarget spu-*-*] } {
2873 set et_vect_aligned_arrays_saved 1
2876 verbose "check_effective_target_vect_aligned_arrays: returning $et_vect_aligned_arrays_saved" 2
2877 return $et_vect_aligned_arrays_saved
2880 # Return 1 if types of size 32 bit or less are naturally aligned
2881 # (aligned to their type-size), 0 otherwise.
2883 # This won't change
for different subtargets so
cache the result.
2885 proc check_effective_target_natural_alignment_32
{ } {
2886 global et_natural_alignment_32
2888 if [info exists et_natural_alignment_32_saved
] {
2889 verbose
"check_effective_target_natural_alignment_32: using cached result" 2
2891 # FIXME
: 32bit powerpc
: guaranteed only
if MASK_ALIGN_NATURAL
/POWER.
2892 set et_natural_alignment_32_saved
1
2893 if { ([istarget
*-*-darwin
*] && [is
-effective
-target lp64
]) } {
2894 set et_natural_alignment_32_saved
0
2897 verbose
"check_effective_target_natural_alignment_32: returning $et_natural_alignment_32_saved" 2
2898 return $et_natural_alignment_32_saved
2901 #
Return 1 if types of size
64 bit or less are naturally aligned
(aligned to their
2902 # type
-size
), 0 otherwise.
2904 # This won
't change for different subtargets so cache the result.
2906 proc check_effective_target_natural_alignment_64 { } {
2907 global et_natural_alignment_64
2909 if [info exists et_natural_alignment_64_saved] {
2910 verbose "check_effective_target_natural_alignment_64: using cached result" 2
2912 set et_natural_alignment_64_saved 0
2913 if { ([is-effective-target lp64] && ![istarget *-*-darwin*])
2914 || [istarget spu-*-*] } {
2915 set et_natural_alignment_64_saved 1
2918 verbose "check_effective_target_natural_alignment_64: returning $et_natural_alignment_64_saved" 2
2919 return $et_natural_alignment_64_saved
2922 # Return 1 if vector alignment (for types of size 32 bit or less) is reachable, 0 otherwise.
2924 # This won't change
for different subtargets so
cache the result.
2926 proc check_effective_target_vector_alignment_reachable
{ } {
2927 global et_vector_alignment_reachable
2929 if [info exists et_vector_alignment_reachable_saved
] {
2930 verbose
"check_effective_target_vector_alignment_reachable: using cached result" 2
2932 if { [check_effective_target_vect_aligned_arrays
]
2933 ||
[check_effective_target_natural_alignment_32
] } {
2934 set et_vector_alignment_reachable_saved
1
2936 set et_vector_alignment_reachable_saved
0
2939 verbose
"check_effective_target_vector_alignment_reachable: returning $et_vector_alignment_reachable_saved" 2
2940 return $et_vector_alignment_reachable_saved
2943 #
Return 1 if vector alignment
for 64 bit is reachable
, 0 otherwise.
2945 # This won
't change for different subtargets so cache the result.
2947 proc check_effective_target_vector_alignment_reachable_for_64bit { } {
2948 global et_vector_alignment_reachable_for_64bit
2950 if [info exists et_vector_alignment_reachable_for_64bit_saved] {
2951 verbose "check_effective_target_vector_alignment_reachable_for_64bit: using cached result" 2
2953 if { [check_effective_target_vect_aligned_arrays]
2954 || [check_effective_target_natural_alignment_64] } {
2955 set et_vector_alignment_reachable_for_64bit_saved 1
2957 set et_vector_alignment_reachable_for_64bit_saved 0
2960 verbose "check_effective_target_vector_alignment_reachable_for_64bit: returning $et_vector_alignment_reachable_for_64bit_saved" 2
2961 return $et_vector_alignment_reachable_for_64bit_saved
2964 # Return 1 if the target only requires element alignment for vector accesses
2966 proc check_effective_target_vect_element_align { } {
2967 global et_vect_element_align
2969 if [info exists et_vect_element_align] {
2970 verbose "check_effective_target_vect_element_align: using cached result" 2
2972 set et_vect_element_align 0
2973 if { [istarget arm*-*-*]
2974 || [check_effective_target_vect_hw_misalign] } {
2975 set et_vect_element_align 1
2979 verbose "check_effective_target_vect_element_align: returning $et_vect_element_align" 2
2980 return $et_vect_element_align
2983 # Return 1 if the target supports vector conditional operations, 0 otherwise.
2985 proc check_effective_target_vect_condition { } {
2986 global et_vect_cond_saved
2988 if [info exists et_vect_cond_saved] {
2989 verbose "check_effective_target_vect_cond: using cached result" 2
2991 set et_vect_cond_saved 0
2992 if { [istarget powerpc*-*-*]
2993 || [istarget ia64-*-*]
2994 || [istarget i?86-*-*]
2995 || [istarget spu-*-*]
2996 || [istarget x86_64-*-*] } {
2997 set et_vect_cond_saved 1
3001 verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
3002 return $et_vect_cond_saved
3005 # Return 1 if the target supports vector char multiplication, 0 otherwise.
3007 proc check_effective_target_vect_char_mult { } {
3008 global et_vect_char_mult_saved
3010 if [info exists et_vect_char_mult_saved] {
3011 verbose "check_effective_target_vect_char_mult: using cached result" 2
3013 set et_vect_char_mult_saved 0
3014 if { [istarget ia64-*-*]
3015 || [istarget i?86-*-*]
3016 || [istarget x86_64-*-*] } {
3017 set et_vect_char_mult_saved 1
3021 verbose "check_effective_target_vect_char_mult: returning $et_vect_char_mult_saved" 2
3022 return $et_vect_char_mult_saved
3025 # Return 1 if the target supports vector short multiplication, 0 otherwise.
3027 proc check_effective_target_vect_short_mult { } {
3028 global et_vect_short_mult_saved
3030 if [info exists et_vect_short_mult_saved] {
3031 verbose "check_effective_target_vect_short_mult: using cached result" 2
3033 set et_vect_short_mult_saved 0
3034 if { [istarget ia64-*-*]
3035 || [istarget spu-*-*]
3036 || [istarget i?86-*-*]
3037 || [istarget x86_64-*-*]
3038 || [istarget powerpc*-*-*]
3039 || [check_effective_target_arm32]
3040 || ([istarget mips*-*-*]
3041 && [check_effective_target_mips_loongson]) } {
3042 set et_vect_short_mult_saved 1
3046 verbose "check_effective_target_vect_short_mult: returning $et_vect_short_mult_saved" 2
3047 return $et_vect_short_mult_saved
3050 # Return 1 if the target supports vector int multiplication, 0 otherwise.
3052 proc check_effective_target_vect_int_mult { } {
3053 global et_vect_int_mult_saved
3055 if [info exists et_vect_int_mult_saved] {
3056 verbose "check_effective_target_vect_int_mult: using cached result" 2
3058 set et_vect_int_mult_saved 0
3059 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
3060 || [istarget spu-*-*]
3061 || [istarget i?86-*-*]
3062 || [istarget x86_64-*-*]
3063 || [istarget ia64-*-*]
3064 || [check_effective_target_arm32] } {
3065 set et_vect_int_mult_saved 1
3069 verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
3070 return $et_vect_int_mult_saved
3073 # Return 1 if the target supports vector even/odd elements extraction, 0 otherwise.
3075 proc check_effective_target_vect_extract_even_odd { } {
3076 global et_vect_extract_even_odd_saved
3078 if [info exists et_vect_extract_even_odd_saved] {
3079 verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
3081 set et_vect_extract_even_odd_saved 0
3082 if { [istarget powerpc*-*-*]
3083 || [istarget i?86-*-*]
3084 || [istarget x86_64-*-*]
3085 || [istarget ia64-*-*]
3086 || [istarget spu-*-*] } {
3087 set et_vect_extract_even_odd_saved 1
3091 verbose "check_effective_target_vect_extract_even_odd: returning $et_vect_extract_even_odd_saved" 2
3092 return $et_vect_extract_even_odd_saved
3095 # Return 1 if the target supports vector even/odd elements extraction of
3096 # vectors with SImode elements or larger, 0 otherwise.
3098 proc check_effective_target_vect_extract_even_odd_wide { } {
3099 global et_vect_extract_even_odd_wide_saved
3101 if [info exists et_vect_extract_even_odd_wide_saved] {
3102 verbose "check_effective_target_vect_extract_even_odd_wide: using cached result" 2
3104 set et_vect_extract_even_odd_wide_saved 0
3105 if { [istarget powerpc*-*-*]
3106 || [istarget i?86-*-*]
3107 || [istarget x86_64-*-*]
3108 || [istarget ia64-*-*]
3109 || [istarget spu-*-*] } {
3110 set et_vect_extract_even_odd_wide_saved 1
3114 verbose "check_effective_target_vect_extract_even_wide_odd: returning $et_vect_extract_even_odd_wide_saved" 2
3115 return $et_vect_extract_even_odd_wide_saved
3118 # Return 1 if the target supports vector interleaving, 0 otherwise.
3120 proc check_effective_target_vect_interleave { } {
3121 global et_vect_interleave_saved
3123 if [info exists et_vect_interleave_saved] {
3124 verbose "check_effective_target_vect_interleave: using cached result" 2
3126 set et_vect_interleave_saved 0
3127 if { [istarget powerpc*-*-*]
3128 || [istarget i?86-*-*]
3129 || [istarget x86_64-*-*]
3130 || [istarget ia64-*-*]
3131 || [istarget spu-*-*] } {
3132 set et_vect_interleave_saved 1
3136 verbose "check_effective_target_vect_interleave: returning $et_vect_interleave_saved" 2
3137 return $et_vect_interleave_saved
3140 # Return 1 if the target supports vector interleaving and extract even/odd, 0 otherwise.
3141 proc check_effective_target_vect_strided { } {
3142 global et_vect_strided_saved
3144 if [info exists et_vect_strided_saved] {
3145 verbose "check_effective_target_vect_strided: using cached result" 2
3147 set et_vect_strided_saved 0
3148 if { [check_effective_target_vect_interleave]
3149 && [check_effective_target_vect_extract_even_odd] } {
3150 set et_vect_strided_saved 1
3154 verbose "check_effective_target_vect_strided: returning $et_vect_strided_saved" 2
3155 return $et_vect_strided_saved
3158 # Return 1 if the target supports vector interleaving and extract even/odd
3159 # for wide element types, 0 otherwise.
3160 proc check_effective_target_vect_strided_wide { } {
3161 global et_vect_strided_wide_saved
3163 if [info exists et_vect_strided_wide_saved] {
3164 verbose "check_effective_target_vect_strided_wide: using cached result" 2
3166 set et_vect_strided_wide_saved 0
3167 if { [check_effective_target_vect_interleave]
3168 && [check_effective_target_vect_extract_even_odd_wide] } {
3169 set et_vect_strided_wide_saved 1
3173 verbose "check_effective_target_vect_strided_wide: returning $et_vect_strided_wide_saved" 2
3174 return $et_vect_strided_wide_saved
3177 # Return 1 if the target supports section-anchors
3179 proc check_effective_target_section_anchors { } {
3180 global et_section_anchors_saved
3182 if [info exists et_section_anchors_saved] {
3183 verbose "check_effective_target_section_anchors: using cached result" 2
3185 set et_section_anchors_saved 0
3186 if { [istarget powerpc*-*-*]
3187 || [istarget arm*-*-*] } {
3188 set et_section_anchors_saved 1
3192 verbose "check_effective_target_section_anchors: returning $et_section_anchors_saved" 2
3193 return $et_section_anchors_saved
3196 # Return 1 if the target supports atomic operations on "int" and "long".
3198 proc check_effective_target_sync_int_long { } {
3199 global et_sync_int_long_saved
3201 if [info exists et_sync_int_long_saved] {
3202 verbose "check_effective_target_sync_int_long: using cached result" 2
3204 set et_sync_int_long_saved 0
3205 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
3206 #
load-reserved/store
-conditional instructions.
3207 if { [istarget ia64
-*-*]
3208 ||
[istarget i?
86-*-*]
3209 ||
[istarget x86_64
-*-*]
3210 ||
[istarget alpha
*-*-*]
3211 ||
[istarget arm
*-*-linux
-gnueabi
]
3212 ||
[istarget bfin
*-*linux
*]
3213 ||
[istarget hppa
*-*linux
*]
3214 ||
[istarget s390
*-*-*]
3215 ||
[istarget powerpc
*-*-*]
3216 ||
[istarget sparc64
-*-*]
3217 ||
[istarget sparcv9
-*-*]
3218 ||
[istarget mips
*-*-*] } {
3219 set et_sync_int_long_saved
1
3223 verbose
"check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
3224 return $et_sync_int_long_saved
3227 #
Return 1 if the target supports atomic operations
on "char" and "short".
3229 proc check_effective_target_sync_char_short
{ } {
3230 global et_sync_char_short_saved
3232 if [info exists et_sync_char_short_saved
] {
3233 verbose
"check_effective_target_sync_char_short: using cached result" 2
3235 set et_sync_char_short_saved
0
3236 # This is intentionally powerpc but not rs6000
, rs6000 doesn
't have the
3237 # load-reserved/store-conditional instructions.
3238 if { [istarget ia64-*-*]
3239 || [istarget i?86-*-*]
3240 || [istarget x86_64-*-*]
3241 || [istarget alpha*-*-*]
3242 || [istarget arm*-*-linux-gnueabi]
3243 || [istarget hppa*-*linux*]
3244 || [istarget s390*-*-*]
3245 || [istarget powerpc*-*-*]
3246 || [istarget sparc64-*-*]
3247 || [istarget sparcv9-*-*]
3248 || [istarget mips*-*-*] } {
3249 set et_sync_char_short_saved 1
3253 verbose "check_effective_target_sync_char_short: returning $et_sync_char_short_saved" 2
3254 return $et_sync_char_short_saved
3257 # Return 1 if the target uses a ColdFire FPU.
3259 proc check_effective_target_coldfire_fpu { } {
3260 return [check_no_compiler_messages coldfire_fpu assembly {
3267 # Return true if this is a uClibc target.
3269 proc check_effective_target_uclibc {} {
3270 return [check_no_compiler_messages uclibc object {
3271 #include <features.h>
3272 #if !defined (__UCLIBC__)
3278 # Return true if this is a uclibc target and if the uclibc feature
3279 # described by __$feature__ is not present.
3281 proc check_missing_uclibc_feature {feature} {
3282 return [check_no_compiler_messages $feature object "
3283 #include <features.h>
3284 #if !defined (__UCLIBC) || defined (__${feature}__)
3290 # Return true if this is a Newlib target.
3292 proc check_effective_target_newlib {} {
3293 return [check_no_compiler_messages newlib object {
3299 # (a) an error of a few ULP is expected in string to floating-point
3300 # conversion functions; and
3301 # (b) overflow is not always detected correctly by those functions.
3303 proc check_effective_target_lax_strtofp {} {
3304 # By default, assume that all uClibc targets suffer from this.
3305 return [check_effective_target_uclibc]
3308 # Return 1 if this is a target for which wcsftime is a dummy
3309 # function that always returns 0.
3311 proc check_effective_target_dummy_wcsftime {} {
3312 # By default, assume that all uClibc targets suffer from this.
3313 return [check_effective_target_uclibc]
3316 # Return 1 if constructors with initialization priority arguments are
3317 # supposed on this target.
3319 proc check_effective_target_init_priority {} {
3320 return [check_no_compiler_messages init_priority assembly "
3321 void f() __attribute__((constructor (1000)));
3326 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
3327 # This can be used with any check_* proc that takes no argument and
3328 # returns only 1 or 0. It could be used with check_* procs that take
3329 # arguments with keywords that pass particular arguments.
3331 proc is-effective-target { arg } {
3333 if { [info procs check_effective_target_${arg}] != [list] } {
3334 set selected [check_effective_target_${arg}]
3337 "vmx_hw" { set selected [check_vmx_hw_available] }
3338 "vsx_hw" { set selected [check_vsx_hw_available] }
3339 "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
3340 "named_sections" { set selected [check_named_sections_available] }
3341 "gc_sections" { set selected [check_gc_sections_available] }
3342 "cxa_atexit" { set selected [check_cxa_atexit_available] }
3343 default { error "unknown effective target keyword `$arg'" }
3346 verbose
"is-effective-target: $arg $selected" 2
3350 #
Return 1 if the
argument is an effective
-target keyword
, 0 otherwise.
3352 proc is
-effective
-target
-keyword
{ arg } {
3353 if { [info procs check_effective_target_$
{arg}] != [list
] } {
3356 # These have different names
for their check_
* procs.
3358 "vmx_hw" { return 1 }
3359 "vsx_hw" { return 1 }
3360 "ppc_recip_hw" { return 1 }
3361 "named_sections" { return 1 }
3362 "gc_sections" { return 1 }
3363 "cxa_atexit" { return 1 }
3364 default
{ return 0 }
3369 #
Return 1 if target default to short enums
3371 proc check_effective_target_short_enums
{ } {
3372 return [check_no_compiler_messages short_enums assembly
{
3374 int s
[sizeof
(enum foo
) == 1 ?
1 : -1];
3378 #
Return 1 if target supports merging string constants at link time.
3380 proc check_effective_target_string_merging
{ } {
3381 return [check_no_messages_and_pattern string_merging \
3382 "rodata\\.str" assembly {
3383 const char
*var
= "String";
3387 #
Return 1 if target has the basic signed and unsigned types in
3388 #
<stdint.h
>, 0 otherwise. This will be obsolete when GCC ensures a
3389 # working
<stdint.h
> for all targets.
3391 proc check_effective_target_stdint_types
{ } {
3392 return [check_no_compiler_messages stdint_types assembly
{
3394 int8_t a
; int16_t b
; int32_t c
; int64_t d
;
3395 uint8_t e
; uint16_t f
; uint32_t g
; uint64_t h
;
3399 #
Return 1 if target has the basic signed and unsigned types in
3400 #
<inttypes.h
>, 0 otherwise. This is
for tests that GCC
's notions of
3401 # these types agree with those in the header, as some systems have
3402 # only <inttypes.h>.
3404 proc check_effective_target_inttypes_types { } {
3405 return [check_no_compiler_messages inttypes_types assembly {
3406 #include <inttypes.h>
3407 int8_t a; int16_t b; int32_t c; int64_t d;
3408 uint8_t e; uint16_t f; uint32_t g; uint64_t h;
3412 # Return 1 if programs are intended to be run on a simulator
3413 # (i.e. slowly) rather than hardware (i.e. fast).
3415 proc check_effective_target_simulator { } {
3417 # All "src/sim" simulators set this one.
3418 if [board_info target exists is_simulator] {
3419 return [board_info target is_simulator]
3422 # The "sid" simulators don't
set that one
, but at least they
set
3424 if [board_info target
exists slow_simulator
] {
3425 return [board_info target slow_simulator
]
3431 #
Return 1 if the target is a VxWorks kernel.
3433 proc check_effective_target_vxworks_kernel
{ } {
3434 return [check_no_compiler_messages vxworks_kernel assembly
{
3435 #
if !defined __vxworks || defined __RTP__
3441 #
Return 1 if the target is a VxWorks RTP.
3443 proc check_effective_target_vxworks_rtp
{ } {
3444 return [check_no_compiler_messages vxworks_rtp assembly
{
3445 #
if !defined __vxworks ||
!defined __RTP__
3451 #
Return 1 if the target is expected to provide wide character support.
3453 proc check_effective_target_wchar
{ } {
3454 if {[check_missing_uclibc_feature UCLIBC_HAS_WCHAR
]} {
3457 return [check_no_compiler_messages wchar assembly
{
3462 #
Return 1 if the target has
<pthread.h
>.
3464 proc check_effective_target_pthread_h
{ } {
3465 return [check_no_compiler_messages pthread_h assembly
{
3466 #
include <pthread.h
>
3470 #
Return 1 if the target can truncate a file from a file
-descriptor
,
3471 # as used by libgfortran
/io
/unix.c
:fd_truncate
; i.e. ftruncate or
3472 # chsize. We test
for a trivially functional truncation
; no stubs.
3473 # As libgfortran uses _FILE_OFFSET_BITS
64, we
do too
; it
'll cause a
3474 # different function to be used.
3476 proc check_effective_target_fd_truncate { } {
3478 #define _FILE_OFFSET_BITS 64
3484 FILE *f = fopen ("tst.tmp", "wb");
3486 const char t[] = "test writing more than ten characters";
3489 write (fd, t, sizeof (t) - 1);
3491 if (ftruncate (fd, 10) != 0)
3494 f = fopen ("tst.tmp", "rb");
3495 if (fread (s, 1, sizeof (s), f) != 10 || strncmp (s, t, 10) != 0)
3501 if { [check_runtime ftruncate $prog] } {
3505 regsub "ftruncate" $prog "chsize" prog
3506 return [check_runtime chsize $prog]
3509 # Add to FLAGS all the target-specific flags needed to access the c99 runtime.
3511 proc add_options_for_c99_runtime { flags } {
3512 if { [istarget *-*-solaris2*] } {
3513 return "$flags -std=c99"
3515 if { [istarget powerpc-*-darwin*] } {
3516 return "$flags -mmacosx-version-min=10.3"
3521 # Add to FLAGS all the target-specific flags needed to enable
3522 # full IEEE compliance mode.
3524 proc add_options_for_ieee { flags } {
3525 if { [istarget "alpha*-*-*"]
3526 || [istarget "sh*-*-*"] } {
3527 return "$flags -mieee"
3532 # Add to FLAGS the flags needed to enable functions to bind locally
3533 # when using pic/PIC passes in the testsuite.
3535 proc add_options_for_bind_pic_locally { flags } {
3536 if {[check_no_compiler_messages using_pic2 assembly {
3541 return "$flags -fPIE"
3543 if {[check_no_compiler_messages using_pic1 assembly {
3548 return "$flags -fpie"
3554 # Add to FLAGS the flags needed to enable 128-bit vectors.
3556 proc add_options_for_quad_vectors { flags } {
3557 if [is-effective-target arm_neon_ok] {
3558 return "$flags -mvectorize-with-neon-quad"
3564 # Return 1 if the target provides a full C99 runtime.
3566 proc check_effective_target_c99_runtime { } {
3567 return [check_cached_effective_target c99_runtime {
3570 set file [open "$srcdir/gcc.dg/builtins-config.h"]
3571 set contents [read $file]
3574 #ifndef HAVE_C99_RUNTIME
3578 check_no_compiler_messages_nocache c99_runtime assembly \
3579 $contents [add_options_for_c99_runtime ""]
3583 # Return 1 if target wchar_t is at least 4 bytes.
3585 proc check_effective_target_4byte_wchar_t { } {
3586 return [check_no_compiler_messages 4byte_wchar_t object {
3587 int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];
3591 # Return 1 if the target supports automatic stack alignment.
3593 proc check_effective_target_automatic_stack_alignment { } {
3594 # Ordinarily x86 supports automatic stack alignment ...
3595 if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
3596 if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
3597 # ... except Win64 SEH doesn't. Succeed
for Win32 though.
3598 return [check_effective_target_ilp32
];
3605 #
Return 1 if avx instructions can be compiled.
3607 proc check_effective_target_avx
{ } {
3608 return [check_no_compiler_messages avx object
{
3609 void _mm256_zeroall
(void
)
3611 __builtin_ia32_vzeroall
();
3616 #
Return 1 if sse instructions can be compiled.
3617 proc check_effective_target_sse
{ } {
3618 return [check_no_compiler_messages sse object
{
3621 __builtin_ia32_stmxcsr
();
3627 #
Return 1 if sse2 instructions can be compiled.
3628 proc check_effective_target_sse2
{ } {
3629 return [check_no_compiler_messages sse2 object
{
3630 typedef long long __m128i __attribute__
((__vector_size__
(16)));
3632 __m128i _mm_srli_si128
(__m128i __A
, int __N
)
3634 return (__m128i
)__builtin_ia32_psrldqi128
(__A
, 8);
3639 #
Return 1 if F16C instructions can be compiled.
3641 proc check_effective_target_f16c
{ } {
3642 return [check_no_compiler_messages f16c object
{
3643 #
include "immintrin.h"
3645 foo
(unsigned short val
)
3647 return _cvtsh_ss
(val
);
3652 #
Return 1 if C wchar_t type is compatible with char16_t.
3654 proc check_effective_target_wchar_t_char16_t_compatible
{ } {
3655 return [check_no_compiler_messages wchar_t_char16_t object
{
3657 __CHAR16_TYPE__
*p16
= &wc
;
3658 char t
[(((__CHAR16_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
3662 #
Return 1 if C wchar_t type is compatible with char32_t.
3664 proc check_effective_target_wchar_t_char32_t_compatible
{ } {
3665 return [check_no_compiler_messages wchar_t_char32_t object
{
3667 __CHAR32_TYPE__
*p32
= &wc
;
3668 char t
[(((__CHAR32_TYPE__
) -1) < 0 == ((__WCHAR_TYPE__
) -1) < 0) ?
1 : -1];
3672 #
Return 1 if pow10 function
exists.
3674 proc check_effective_target_pow10
{ } {
3675 return [check_runtime pow10
{
3685 #
Return 1 if current options generate DFP instructions
, 0 otherwise.
3687 proc check_effective_target_hard_dfp
{} {
3688 return [check_no_messages_and_pattern hard_dfp
"!adddd3" assembly {
3689 typedef float d64 __attribute__
((mode(DD
)));
3691 void foo
(void
) { z
= x
+ y
; }
3695 #
Return 1 if string.h and wchar.h headers provide C
++ requires overloads
3696 #
for strchr etc. functions.
3698 proc check_effective_target_correct_iso_cpp_string_wchar_protos
{ } {
3699 return [check_no_compiler_messages correct_iso_cpp_string_wchar_protos assembly
{
3702 #
if !defined
(__cplusplus
) \
3703 ||
!defined
(__CORRECT_ISO_CPP_STRING_H_PROTO
) \
3704 ||
!defined
(__CORRECT_ISO_CPP_WCHAR_H_PROTO
)
3705 ISO C
++ correct string.h and wchar.h protos not supported.
3712 #
Return 1 if GNU as is used.
3714 proc check_effective_target_gas
{ } {
3715 global use_gas_saved
3718 if {![info exists use_gas_saved
]} {
3719 # Check
if the as used by gcc is GNU as.
3720 set gcc_as
[lindex
[$
{tool
}_target_compile
"-print-prog-name=as" "" "none" ""] 0]
3721 # Provide
/dev
/null as input
, otherwise gas times out reading from
3723 set status [remote_exec host
"$gcc_as" "-v /dev/null"]
3724 set as_output
[lindex $
status 1]
3725 if { [ string first
"GNU" $as_output ] >= 0 } {
3731 return $use_gas_saved
3734 #
Return 1 if the compiler has been configure with link
-time optimization
3737 proc check_effective_target_lto
{ } {
3739 return [info exists ENABLE_LTO
]
3742 #
Return 1 if this target supports the
-fsplit
-stack option
, 0
3745 proc check_effective_target_split_stack
{} {
3746 return [check_no_compiler_messages split_stack object
{
3751 #
Return 1 if the language
for the compiler under test is C.
3753 proc check_effective_target_c
{ } {
3755 if [string match $tool
"gcc"] {
3761 #
Return 1 if the language
for the compiler under test is C
++.
3763 proc check_effective_target_c
++ { } {
3765 if [string match $tool
"g++"] {
3771 #
Return 1 if expensive testcases should be run.
3773 proc check_effective_target_run_expensive_tests
{ } {
3774 if { [getenv GCC_TEST_RUN_EXPENSIVE
] != "" } {
3780 # Returns
1 if "mempcpy" is available on the target system.
3782 proc check_effective_target_mempcpy
{} {
3783 return [check_function_available
"mempcpy"]
3786 # Check whether the vectorizer tests are supported by the target and
3787 # append additional target
-dependent
compile flags to DEFAULT_VECTCFLAGS.
3788 #
Set dg
-do-what
-default to either
compile or run
, depending
on target
3789 # capabilities.
Return 1 if vectorizer tests are supported by
3790 # target
, 0 otherwise.
3792 proc check_vect_support_and_set_flags
{ } {
3793 global DEFAULT_VECTCFLAGS
3794 global dg
-do-what
-default
3796 if [istarget
"powerpc-*paired*"] {
3797 lappend DEFAULT_VECTCFLAGS
"-mpaired"
3798 if [check_750cl_hw_available
] {
3799 set dg
-do-what
-default run
3801 set dg
-do-what
-default
compile
3803 } elseif
[istarget
"powerpc*-*-*"] {
3804 # Skip targets not supporting
-maltivec.
3805 if ![is
-effective
-target powerpc_altivec_ok
] {
3809 lappend DEFAULT_VECTCFLAGS
"-maltivec"
3810 if [check_vsx_hw_available
] {
3811 lappend DEFAULT_VECTCFLAGS
"-mvsx" "-mno-allow-movmisalign"
3814 if [check_vmx_hw_available
] {
3815 set dg
-do-what
-default run
3817 if [is
-effective
-target ilp32
] {
3818 # Specify a cpu that supports VMX
for compile-only tests.
3819 lappend DEFAULT_VECTCFLAGS
"-mcpu=970"
3821 set dg
-do-what
-default
compile
3823 } elseif
{ [istarget
"spu-*-*"] } {
3824 set dg
-do-what
-default run
3825 } elseif
{ [istarget
"i?86-*-*"] || [istarget "x86_64-*-*"] } {
3826 lappend DEFAULT_VECTCFLAGS
"-msse2"
3827 if { [check_effective_target_sse2_runtime
] } {
3828 set dg
-do-what
-default run
3830 set dg
-do-what
-default
compile
3832 } elseif
{ [istarget
"mips*-*-*"]
3833 && ([check_effective_target_mpaired_single
]
3834 ||
[check_effective_target_mips_loongson
])
3835 && [check_effective_target_nomips16
] } {
3836 if { [check_effective_target_mpaired_single
] } {
3837 lappend DEFAULT_VECTCFLAGS
"-mpaired-single"
3839 set dg
-do-what
-default run
3840 } elseif
[istarget
"sparc*-*-*"] {
3841 lappend DEFAULT_VECTCFLAGS
"-mcpu=ultrasparc" "-mvis"
3842 if [check_effective_target_ultrasparc_hw
] {
3843 set dg
-do-what
-default run
3845 set dg
-do-what
-default
compile
3847 } elseif
[istarget
"alpha*-*-*"] {
3848 # Alpha
's vectorization capabilities are extremely limited.
3849 # It's more effort than its worth disabling all of the tests
3850 # that it cannot pass. But
if you actually want to see what
3851 # does work
, command out the
return.
3854 lappend DEFAULT_VECTCFLAGS
"-mmax"
3855 if [check_alpha_max_hw_available
] {
3856 set dg
-do-what
-default run
3858 set dg
-do-what
-default
compile
3860 } elseif
[istarget
"ia64-*-*"] {
3861 set dg
-do-what
-default run
3862 } elseif
[is
-effective
-target arm_neon_ok
] {
3863 eval lappend DEFAULT_VECTCFLAGS
[add_options_for_arm_neon
""]
3864 # NEON does not support denormals
, so is not used
for vectorization by
3865 # default to avoid loss of precision. We must pass
-ffast
-math to test
3866 # vectorization of float operations.
3867 lappend DEFAULT_VECTCFLAGS
"-ffast-math"
3868 if [is
-effective
-target arm_neon_hw
] {
3869 set dg
-do-what
-default run
3871 set dg
-do-what
-default
compile