OSDN Git Service

2009-01-09 Joel Sherrill <joel.sherrill@oarcorp.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / target-supports.exp
index 69c8ea4..bee879e 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007
+#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008
 #    Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -251,6 +251,20 @@ proc check_weak_available { } {
 }
 
 ###############################
+# proc check_weak_override_available { }
+###############################
+
+# Like check_weak_available, but return 0 if weak symbol definitions
+# cannot be overridden.
+
+proc check_weak_override_available { } {
+    if { [istarget "*-*-mingw*"] } {
+       return 0
+    }
+    return [check_weak_available]
+}
+
+###############################
 # proc check_visibility_available { what_kind }
 ###############################
 
@@ -452,11 +466,6 @@ proc check_profiling_available { test_what } {
        return 0
     }
 
-    # At present, there is no profiling support on NetWare.
-    if { [istarget *-*-netware*] } {
-       return 0
-    }
-
     # uClibc does not have gcrt1.o.
     if { [check_effective_target_uclibc]
         && ([lindex $test_what 1] == "-p"
@@ -470,6 +479,8 @@ proc check_profiling_available { test_what } {
        # missing other needed machinery.
        if { [istarget mmix-*-*]
             || [istarget arm*-*-eabi*]
+            || [istarget picochip-*-*]
+            || [istarget *-*-netware*]
             || [istarget arm*-*-elf]
             || [istarget arm*-*-symbianelf*]
             || [istarget avr-*-*]
@@ -485,6 +496,7 @@ proc check_profiling_available { test_what } {
             || [istarget mips*-*-elf*]
             || [istarget xstormy16-*]
             || [istarget xtensa*-*-elf]
+            || [istarget *-*-rtems*]
             || [istarget *-*-vxworks*] } {
            set profiling_available_saved 0
        } else {
@@ -495,6 +507,17 @@ proc check_profiling_available { test_what } {
     return $profiling_available_saved
 }
 
+# Check to see if a target is "freestanding". This is as per the definition
+# in Section 4 of C99 standard. Effectively, it is a target which supports no
+# extra headers or libraries other than what is considered essential.
+proc check_effective_target_freestanding { } {
+    if { [istarget picochip-*-*] } then {
+        return 1
+    } else {
+        return 0
+    }
+}
+
 # Return 1 if target has packed layout of structure members by
 # default, 0 otherwise.  Note that this is slightly different than
 # whether the target has "natural alignment": both attributes may be
@@ -562,6 +585,15 @@ proc check_effective_target_tls_runtime {} {
     }]
 }
 
+# Return 1 if compilation with -fgraphite is error-free for trivial 
+# code, 0 otherwise.
+
+proc check_effective_target_fgraphite {} {
+    return [check_no_compiler_messages fgraphite object {
+       void foo (void) { }
+    } "-O1 -fgraphite"]
+}
+
 # Return 1 if compilation with -fopenmp is error-free for trivial
 # code, 0 otherwise.
 
@@ -1048,6 +1080,18 @@ proc check_effective_target_lp64 { } {
     }]
 }
 
+# Return 1 if we're generating 64-bit code using default llp64 options,
+# 0 otherwise.
+
+proc check_effective_target_llp64 { } {
+    return [check_no_compiler_messages llp64 object {
+       int dummy[sizeof (int) == 4
+                 && sizeof (void *) == 8
+                 && sizeof (long long) == 8
+                 && sizeof (long) == 4 ? 1 : -1];
+    }]
+}
+
 # Return 1 if the target supports long double larger than double,
 # 0 otherwise.
 
@@ -1369,6 +1413,25 @@ proc check_effective_target_powerpc_altivec_ok { } {
     }
 }
 
+# Return 1 if this is a PowerPC target supporting -mcpu=cell.
+
+proc check_effective_target_powerpc_ppu_ok { } {
+    if [check_effective_target_powerpc_altivec_ok] {
+       return [check_no_compiler_messages cell_asm_available object {
+           int main (void) {
+#ifdef __MACH__
+               asm volatile ("lvlx v0,v0,v0");
+#else
+               asm volatile ("lvlx 0,0,0");
+#endif
+               return 0;
+           }
+       }]
+    } else {
+       return 0
+    }
+}
+
 # Return 1 if this is a PowerPC target that supports SPU.
 
 proc check_effective_target_powerpc_spu { } {
@@ -1411,6 +1474,23 @@ proc check_effective_target_powerpc_altivec { } {
     }
 }
 
+# Return 1 if this is a PowerPC 405 target.  The check includes options
+# specified by dg-options for this test, so don't cache the result.
+
+proc check_effective_target_powerpc_405_nocache { } {
+    if { [istarget powerpc*-*-*] || [istarget rs6000-*-*] } {
+       return [check_no_compiler_messages_nocache powerpc_405 object {
+           #ifdef __PPC405__
+           int dummy;
+           #else
+           #error not a PPC405
+           #endif
+       } [current_compiler_flags]]
+    } else {
+       return 0
+    }
+}
+
 # Return 1 if this is a SPU target with a toolchain that
 # supports automatic overlay generation.
 
@@ -1608,6 +1688,28 @@ proc check_effective_target_vect_no_bitwise { } {
     return $et_vect_no_bitwise_saved
 }
 
+# Return 1 if the target plus current options supports vector permutation,
+# 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_vect_perm { } {
+    global et_vect_perm
+
+    if [info exists et_vect_perm_saved] {
+        verbose "check_effective_target_vect_perm: using cached result" 2
+    } else {
+        set et_vect_perm_saved 0
+        if { [istarget powerpc*-*-*]
+             || [istarget spu-*-*] } {
+            set et_vect_perm_saved 1
+        }
+    }
+    verbose "check_effective_target_vect_perm: returning $et_vect_perm_saved" 2
+    return $et_vect_perm_saved
+}
+
+
 # Return 1 if the target plus current options supports a vector
 # widening summation of *short* args into *int* result, 0 otherwise.
 # A target can also support this widening summation if it can support
@@ -2062,7 +2164,8 @@ proc check_effective_target_vect_short_mult { } {
        if { [istarget ia64-*-*]
             || [istarget spu-*-*]
             || [istarget i?86-*-*]
-            || [istarget x86_64-*-*] } {
+            || [istarget x86_64-*-*] 
+             || [istarget powerpc*-*-*] } {
           set et_vect_short_mult_saved 1
        }
     }
@@ -2549,3 +2652,56 @@ proc check_effective_target_automatic_stack_alignment  { } {
        return 0
     }
 }
+
+# Return 1 if avx instructions can be compiled.
+
+proc check_effective_target_avx { } {
+    return [check_no_compiler_messages avx object {
+       void _mm256_zeroall (void)
+       {
+          __builtin_ia32_vzeroall ();
+       }
+    } "-O2 -mavx" ]
+}
+
+# Return 1 if C wchar_t type is compatible with char16_t.
+
+proc check_effective_target_wchar_t_char16_t_compatible { } {
+    return [check_no_compiler_messages wchar_t_char16_t object {
+        __WCHAR_TYPE__ wc;
+        __CHAR16_TYPE__ *p16 = &wc;
+        char t[(((__CHAR16_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
+    }]
+}
+
+# Return 1 if C wchar_t type is compatible with char32_t.
+
+proc check_effective_target_wchar_t_char32_t_compatible { } {
+    return [check_no_compiler_messages wchar_t_char32_t object {
+        __WCHAR_TYPE__ wc;
+        __CHAR32_TYPE__ *p32 = &wc;
+        char t[(((__CHAR32_TYPE__) -1) < 0 == ((__WCHAR_TYPE__) -1) < 0) ? 1 : -1];
+    }]
+}
+
+# Return 1 if pow10 function exists.
+
+proc check_effective_target_pow10 { } {
+    return [check_runtime pow10 {
+       #include <math.h>
+       int main () {
+       double x;
+       x = pow10 (1);
+       return 0;
+       }
+    } "-lm" ]
+}
+
+# Return 1 if current options generate DFP instructions, 0 otherwise.
+
+proc check_effective_target_hard_dfp {} {
+    return [check_no_messages_and_pattern hard_dfp "!adddd3" assembly {
+       _Decimal64 x, y, z;
+       void foo (void) { z = x + y; }
+    }]
+}