OSDN Git Service

* lib/target-supports.exp (check_effective_target_unwrapped): New.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / target-supports.exp
index 4c99345..a13ba3e 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006
+#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007
 #   Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -384,7 +384,7 @@ proc check_effective_target_pcc_bitfield_type_matters { } {
     }]
 }
 
-# Return 1 if thread local storage (TLS) is supported, 0 otherwise.
+# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
 #
 # This won't change for different subtargets so cache the result.
 
@@ -406,11 +406,19 @@ proc check_effective_target_tls {} {
        close $f
 
        # Test for thread-local data supported by the platform.
-       set comp_output \
-           [${tool}_target_compile $src $asm assembly ""]
+       set comp_output [${tool}_target_compile $src $asm assembly ""]
        file delete $src
        if { [string match "*not supported*" $comp_output] } {
            set et_tls_saved 0
+       } else {
+           set fd [open $asm r]
+           set text [read $fd]
+           close $fd
+           if { [string match "*emutls*" $text]} {
+               set et_tls_saved 0
+           } else {
+               set et_tls_saved 1
+           }
        }
        remove-build-file $asm
     }
@@ -509,6 +517,16 @@ proc check_effective_target_mpaired_single { } {
     } "-mpaired-single"]
 }
 
+# Return 1 if the target does not use a status wrapper.
+
+proc check_effective_target_unwrapped { } {
+    if { [target_info needs_status_wrapper] != "" \
+            && [target_info needs_status_wrapper] != "0" } {
+       return 0
+    }
+    return 1
+}
+
 # Return true if iconv is supported on the target. In particular IBM1047.
 
 proc check_iconv_available { test_what } {
@@ -1240,7 +1258,10 @@ proc check_effective_target_vect_cmdline_needed { } {
        set et_vect_cmdline_needed_saved 1
        if { [istarget ia64-*-*]
             || (([istarget x86_64-*-*] || [istarget i?86-*-*])
-                && [check_effective_target_lp64])} {
+                && [check_effective_target_lp64])
+            || ([istarget powerpc*-*-*]
+                && ([check_effective_target_powerpc_spe]
+                    || [check_effective_target_powerpc_altivec]))} {
           set et_vect_cmdline_needed_saved 0
        }
     }
@@ -1360,6 +1381,38 @@ proc check_effective_target_powerpc_altivec_ok { } {
     }
 }
 
+# Return 1 if this is a PowerPC target with SPE enabled.
+
+proc check_effective_target_powerpc_spe { } {
+    if { [istarget powerpc*-*-*] } {
+       return [check_no_compiler_messages powerpc_spe object {
+           #ifndef __SPE__
+           #error not SPE
+           #else
+           int dummy;
+           #endif
+       }]
+    } else {
+       return 0
+    }
+}
+
+# Return 1 if this is a PowerPC target with Altivec enabled.
+
+proc check_effective_target_powerpc_altivec { } {
+    if { [istarget powerpc*-*-*] } {
+       return [check_no_compiler_messages powerpc_altivec object {
+           #ifndef __ALTIVEC__
+           #error not Altivec
+           #else
+           int dummy;
+           #endif
+       }]
+    } else {
+       return 0
+    }
+}
+
 # Return 1 if the target supports hardware vector shift operation.
 
 proc check_effective_target_vect_shift { } {
@@ -1641,6 +1694,7 @@ proc check_effective_target_vect_widen_mult_hi_to_si { } {
           set et_vect_widen_mult_hi_to_si_saved 0
         }
         if { [istarget powerpc*-*-*]
+             || [istarget spu-*-*]
              || [istarget i?86-*-*]
              || [istarget x86_64-*-*] } {
             set et_vect_widen_mult_hi_to_si_saved 1
@@ -1988,6 +2042,53 @@ proc check_effective_target_sync_char_short { } {
     return $et_sync_char_short_saved
 }
 
+# Return 1 if the target uses a ColdFire FPU.
+
+proc check_effective_target_coldfire_fpu { } {
+    return [check_no_compiler_messages coldfire_fpu assembly {
+       #ifndef __mcffpu__
+       #error FOO
+       #endif
+    }]
+}
+
+# Return true if this is a uClibc target.
+
+proc check_effective_target_uclibc {} {
+    return [check_no_compiler_messages uclibc object {
+       #include <features.h>
+       #if !defined (__UCLIBC__)
+       #error FOO
+       #endif
+    }]
+}
+
+# Return true if this is a Newlib target.
+
+proc check_effective_target_newlib {} {
+    return [check_no_compiler_messages newlib object {
+       #include <newlib.h>
+    }]
+}
+
+# Return 1 if
+#   (a) an error of a few ULP is expected in string to floating-point
+#       conversion functions; and
+#   (b) overflow is not always detected correctly by those functions.
+
+proc check_effective_target_lax_strtofp {} {
+    # By default, assume that all uClibc targets suffer from this.
+    return [check_effective_target_uclibc]
+}
+
+# Return 1 if this is a target for which wcsftime is a dummy
+# function that always returns 0.
+
+proc check_effective_target_dummy_wcsftime {} {
+    # By default, assume that all uClibc targets suffer from this.
+    return [check_effective_target_uclibc]
+}
+
 # Return 1 if the target matches the effective target 'arg', 0 otherwise.
 # This can be used with any check_* proc that takes no argument and
 # returns only 1 or 0.  It could be used with check_* procs that take
@@ -2055,3 +2156,22 @@ proc check_effective_target_stdint_types { } {
        uint8_t e; uint16_t f; uint32_t g; uint64_t h;
     }]
 }
+
+# Return 1 if programs are intended to be run on a simulator
+# (i.e. slowly) rather than hardware (i.e. fast).
+
+proc check_effective_target_simulator { } {
+
+    # All "src/sim" simulators set this one.
+    if [board_info target exists is_simulator] {
+       return [board_info target is_simulator]
+    }
+
+    # The "sid" simulators don't set that one, but at least they set
+    # this one.
+    if [board_info target exists slow_simulator] {
+       return [board_info target slow_simulator]
+    }
+
+    return 0
+}