📄 target-supports.exp
字号:
proc check_alpha_max_hw_available { } { return [check_runtime alpha_max_hw_available { int main() { return __builtin_alpha_amask(1<<8) != 0; } }]}# Returns true iff the FUNCTION is available on the target system.# (This is essentially a Tcl implementation of Autoconf's# AC_CHECK_FUNC.)proc check_function_available { function } { return [check_no_compiler_messages ${function}_available \ executable [subst { #ifdef __cplusplus extern "C" #endif char $function (); int main () { $function (); } }]]}# Returns true iff "fork" is available on the target system.proc check_fork_available {} { return [check_function_available "fork"]}# Returns true iff "mkfifo" is available on the target system.proc check_mkfifo_available {} { if {[istarget *-*-cygwin*]} { # Cygwin has mkfifo, but support is incomplete. return 0 } return [check_function_available "mkfifo"]}# Returns true iff "__cxa_atexit" is used on the target system.proc check_cxa_atexit_available { } { return [check_cached_effective_target cxa_atexit_available { if { [istarget "hppa*-*-hpux10*"] } { # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes. expr 0 } else { check_runtime_nocache cxa_atexit_available { // C++ #include <stdlib.h> static unsigned int count; struct X { X() { count = 1; } ~X() { if (count != 3) exit(1); count = 4; } }; void f() { static X x; } struct Y { Y() { f(); count = 2; } ~Y() { if (count != 2) exit(1); count = 3; } }; Y y; int main() { return 0; } } } }]}# Return 1 if we're generating 32-bit code using default options, 0# otherwise.proc check_effective_target_ilp32 { } { return [check_no_compiler_messages ilp32 object { int dummy[sizeof (int) == 4 && sizeof (void *) == 4 && sizeof (long) == 4 ? 1 : -1]; }]}# Return 1 if we're generating 32-bit or larger integers using default# options, 0 otherwise.proc check_effective_target_int32plus { } { return [check_no_compiler_messages int32plus object { int dummy[sizeof (int) >= 4 ? 1 : -1]; }]}# Return 1 if we're generating 32-bit or larger pointers using default# options, 0 otherwise.proc check_effective_target_ptr32plus { } { return [check_no_compiler_messages ptr32plus object { int dummy[sizeof (void *) >= 4 ? 1 : -1]; }]}# Return 1 if we support 32-bit or larger array and structure sizes# using default options, 0 otherwise.proc check_effective_target_size32plus { } { return [check_no_compiler_messages size32plus object { char dummy[65537]; }]}# Returns 1 if we're generating 16-bit or smaller integers with the# default options, 0 otherwise.proc check_effective_target_int16 { } { return [check_no_compiler_messages int16 object { int dummy[sizeof (int) < 4 ? 1 : -1]; }]}# Return 1 if we're generating 64-bit code using default options, 0# otherwise.proc check_effective_target_lp64 { } { return [check_no_compiler_messages lp64 object { int dummy[sizeof (int) == 4 && sizeof (void *) == 8 && sizeof (long) == 8 ? 1 : -1]; }]}# Return 1 if the target supports long double larger than double,# 0 otherwise.proc check_effective_target_large_long_double { } { return [check_no_compiler_messages large_long_double object { int dummy[sizeof(long double) > sizeof(double) ? 1 : -1]; }]}# Return 1 if the target supports compiling fixed-point,# 0 otherwise.proc check_effective_target_fixed_point { } { return [check_no_compiler_messages fixed_point object { _Sat _Fract x; _Sat _Accum y; }]}# Return 1 if the target supports compiling decimal floating point,# 0 otherwise.proc check_effective_target_dfp_nocache { } { verbose "check_effective_target_dfp_nocache: compiling source" 2 set ret [check_no_compiler_messages_nocache dfp object { _Decimal32 x; _Decimal64 y; _Decimal128 z; }] verbose "check_effective_target_dfp_nocache: returning $ret" 2 return $ret}proc check_effective_target_dfprt_nocache { } { return [check_runtime_nocache dfprt { _Decimal32 x = 1.2df; _Decimal64 y = 2.3dd; _Decimal128 z; int main () { z = x + y; return 0; } }]}# Return 1 if the target supports compiling Decimal Floating Point,# 0 otherwise.## This won't change for different subtargets so cache the result.proc check_effective_target_dfp { } { return [check_cached_effective_target dfp { check_effective_target_dfp_nocache }]}# Return 1 if the target supports linking and executing Decimal Floating# Point, # 0 otherwise.## This won't change for different subtargets so cache the result.proc check_effective_target_dfprt { } { return [check_cached_effective_target dfprt { check_effective_target_dfprt_nocache }]}# Return 1 if the target needs a command line argument to enable a SIMD# instruction set.proc check_effective_target_vect_cmdline_needed { } { global et_vect_cmdline_needed_saved global et_vect_cmdline_needed_target_name if { ![info exists et_vect_cmdline_needed_target_name] } { set et_vect_cmdline_needed_target_name "" } # If the target has changed since we set the cached value, clear it. set current_target [current_target_name] if { $current_target != $et_vect_cmdline_needed_target_name } { verbose "check_effective_target_vect_cmdline_needed: `$et_vect_cmdline_needed_target_name' `$current_target'" 2 set et_vect_cmdline_needed_target_name $current_target if { [info exists et_vect_cmdline_needed_saved] } { verbose "check_effective_target_vect_cmdline_needed: removing cached result" 2 unset et_vect_cmdline_needed_saved } } if [info exists et_vect_cmdline_needed_saved] { verbose "check_effective_target_vect_cmdline_needed: using cached result" 2 } else { set et_vect_cmdline_needed_saved 1 if { [istarget ia64-*-*] || (([istarget x86_64-*-*] || [istarget i?86-*-*]) && [check_effective_target_lp64]) || ([istarget powerpc*-*-*] && ([check_effective_target_powerpc_spe] || [check_effective_target_powerpc_altivec])) || [istarget spu-*-*] } { set et_vect_cmdline_needed_saved 0 } } verbose "check_effective_target_vect_cmdline_needed: returning $et_vect_cmdline_needed_saved" 2 return $et_vect_cmdline_needed_saved}# Return 1 if the target supports hardware vectors of int, 0 otherwise.## This won't change for different subtargets so cache the result.proc check_effective_target_vect_int { } { global et_vect_int_saved if [info exists et_vect_int_saved] { verbose "check_effective_target_vect_int: using cached result" 2 } else { set et_vect_int_saved 0 if { [istarget i?86-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) || [istarget spu-*-*] || [istarget x86_64-*-*] || [istarget sparc*-*-*] || [istarget alpha*-*-*] || [istarget ia64-*-*] } { set et_vect_int_saved 1 } } verbose "check_effective_target_vect_int: returning $et_vect_int_saved" 2 return $et_vect_int_saved}# Return 1 if the target supports int->float conversion #proc check_effective_target_vect_intfloat_cvt { } { global et_vect_intfloat_cvt_saved if [info exists et_vect_intfloat_cvt_saved] { verbose "check_effective_target_vect_intfloat_cvt: using cached result" 2 } else { set et_vect_intfloat_cvt_saved 0 if { [istarget i?86-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) || [istarget x86_64-*-*] } { set et_vect_intfloat_cvt_saved 1 } } verbose "check_effective_target_vect_intfloat_cvt: returning $et_vect_intfloat_cvt_saved" 2 return $et_vect_intfloat_cvt_saved}# Return 1 if the target supports float->int conversion#proc check_effective_target_vect_floatint_cvt { } { global et_vect_floatint_cvt_saved if [info exists et_vect_floatint_cvt_saved] { verbose "check_effective_target_vect_floatint_cvt: using cached result" 2 } else { set et_vect_floatint_cvt_saved 0 if { [istarget i?86-*-*] || [istarget x86_64-*-*] } { set et_vect_floatint_cvt_saved 1 } } verbose "check_effective_target_vect_floatint_cvt: returning $et_vect_floatint_cvt_saved" 2 return $et_vect_floatint_cvt_saved}# Return 1 is this is an arm target using 32-bit instructionsproc check_effective_target_arm32 { } { return [check_no_compiler_messages arm32 assembly { #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__)) #error FOO #endif }]}# Return 1 if this is an ARM target supporting -mfpu=vfp# -mfloat-abi=softfp. Some multilibs may be incompatible with these# options.proc check_effective_target_arm_vfp_ok { } { if { [check_effective_target_arm32] } { return [check_no_compiler_messages arm_vfp_ok object { int dummy; } "-mfpu=vfp -mfloat-abi=softfp"] } else { return 0 }}# Return 1 if this is an ARM target supporting -mfpu=neon# -mfloat-abi=softfp. Some multilibs may be incompatible with these# options.proc check_effective_target_arm_neon_ok { } { if { [check_effective_target_arm32] } { return [check_no_compiler_messages arm_neon_ok object { int dummy; } "-mfpu=neon -mfloat-abi=softfp"] } else { return 0 }}# Return 1 is this is an ARM target where -mthumb causes Thumb-1 to be# used.proc check_effective_target_arm_thumb1_ok { } { return [check_no_compiler_messages arm_thumb1_ok assembly { #if !defined(__arm__) || !defined(__thumb__) || defined(__thumb2__) #error FOO #endif } "-mthumb"]}# Return 1 if the target supports executing NEON instructions, 0# otherwise. Cache the result.proc check_effective_target_arm_neon_hw { } { return [check_runtime arm_neon_hw_available { int main (void) { long long a = 0, b = 1; asm ("vorr %P0, %P1, %P2" : "=w" (a) : "0" (a), "w" (b)); return (a != 1); } } "-mfpu=neon -mfloat-abi=softfp"]}# Return 1 if this is a PowerPC target with floating-point registers.proc check_effective_target_powerpc_fprs { } { if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } { return [check_no_compiler_messages powerpc_fprs object { #ifdef __NO_FPRS__ #error no FPRs #else int dummy; #endif }] } else { return 0 }}# Return 1 if this is a PowerPC target with hardware double-precision# floating point.proc check_effective_target_powerpc_hard_double { } { if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } { return [check_no_compiler_messages powerpc_hard_double object { #ifdef _SOFT_DOUBLE #error soft double #else int dummy; #endif }] } else { return 0 }}# Return 1 if this is a PowerPC target supporting -maltivec.proc check_effective_target_powerpc_altivec_ok { } { if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) || [istarget rs6000-*-*] } { # AltiVec is not supported on AIX before 5.3. if { [istarget powerpc*-*-aix4*] || [istarget powerpc*-*-aix5.1*] || [istarget powerpc*-*-aix5.2*] } { return 0 } return [check_no_compiler_messages powerpc_altivec_ok object { int dummy; } "-maltivec"] } else { return 0 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -