- Porting of address santizer patch for ARM in gcc-4.8.1 from gcc-4.9 - Taken from...
[platform/upstream/gcc48.git] / gcc / testsuite / lib / target-supports.exp
index 63dc0be..7932c80 100644 (file)
@@ -1,5 +1,4 @@
-#   Copyright (C) 1999, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   Copyright (C) 1999-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -233,12 +232,6 @@ proc check_weak_available { } {
         return 1
     }
 
-    # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
-
-    if { [istarget alpha*-dec-osf*] } {
-       return 1
-    }
-
     # Windows targets Cygwin and MingW32 support it
 
     if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
@@ -361,6 +354,16 @@ proc check_alias_available { } {
     return $alias_available_saved
 }
 
+# Returns 1 if the target toolchain supports strong aliases, 0 otherwise.
+
+proc check_effective_target_alias { } {
+    if { [check_alias_available] < 2 } {
+       return 0
+    } else {
+       return 1
+    }
+}
+
 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
 
 proc check_ifunc_available { } {
@@ -472,15 +475,6 @@ proc check_profiling_available { test_what } {
        return 0
     }
 
-    # Support for -p on irix relies on libprof1.a which doesn't appear to
-    # exist on any irix6 system currently posting testsuite results.
-    # Support for -pg on irix relies on gcrt1.o which doesn't exist yet.
-    # See: http://gcc.gnu.org/ml/gcc/2002-10/msg00169.html
-    if { [istarget mips*-*-irix*]
-         && ($test_what == "-p" || $test_what == "-pg") } {
-       return 0
-    }
-
     # We don't yet support profiling for MIPS16.
     if { [istarget mips*-*-*]
         && ![check_effective_target_nomips16]
@@ -493,6 +487,13 @@ proc check_profiling_available { test_what } {
        return 0
     }
 
+    # We don't yet support profiling for AArch64.
+    if { [istarget aarch64*-*-*]
+        && ([lindex $test_what 1] == "-p"
+            || [lindex $test_what 1] == "-pg") } {
+       return 0
+    }
+
     # cygwin does not support -p.
     if { [istarget *-*-cygwin*] && $test_what == "-p" } {
        return 0
@@ -508,7 +509,8 @@ proc check_profiling_available { test_what } {
     if {![info exists profiling_available_saved]} {
        # Some targets don't have any implementation of __bb_init_func or are
        # missing other needed machinery.
-       if {    [istarget am3*-*-linux*]
+       if {    [istarget aarch64*-*-elf]
+            || [istarget am3*-*-linux*]
             || [istarget arm*-*-eabi*]
             || [istarget arm*-*-elf]
             || [istarget arm*-*-symbianelf*]
@@ -584,16 +586,11 @@ proc check_effective_target_pcc_bitfield_type_matters { } {
 # Add to FLAGS all the target-specific flags needed to use thread-local storage.
 
 proc add_options_for_tls { flags } {
-    # Tru64 UNIX uses emutls, which relies on a couple of pthread functions
-    # which only live in libpthread, so always pass -pthread for TLS.
-    if { [istarget alpha*-dec-osf*] } {
-       return "$flags -pthread"
-    }
-    # On Solaris 8 and 9, __tls_get_addr/___tls_get_addr only lives in
-    # libthread, so always pass -pthread for native TLS.
+    # On Solaris 9, __tls_get_addr/___tls_get_addr only lives in
+    # libthread, so always pass -pthread for native TLS. Same for AIX.
     # Need to duplicate native TLS check from
     # check_effective_target_tls_native to avoid recursion.
-    if { [istarget *-*-solaris2.\[89\]*] &&
+    if { ([istarget *-*-solaris2.9*] || [istarget powerpc-ibm-aix*]) &&
         [check_no_messages_and_pattern tls_native "!emutls" assembly {
             __thread int i;
             int f (void) { return i; }
@@ -731,6 +728,37 @@ proc check_effective_target_mmap {} {
     return [check_function_available "mmap"]
 }
 
+# Return 1 if the target supports dlopen, 0 otherwise.
+proc check_effective_target_dlopen {} {
+    return [check_function_available "dlopen"]
+}
+
+# Return 1 if the target supports clone, 0 otherwise.
+proc check_effective_target_clone {} {
+    return [check_function_available "clone"]
+}
+
+# Return 1 if the target supports setrlimit, 0 otherwise.
+proc check_effective_target_setrlimit {} {
+    # Darwin has non-posix compliant RLIMIT_AS
+    if { [istarget *-*-darwin*] } {
+        return 0
+    }
+    return [check_function_available "setrlimit"]
+}
+
+# Return 1 if the target supports swapcontext, 0 otherwise.
+proc check_effective_target_swapcontext {} {
+    return [check_no_compiler_messages swapcontext executable {
+       #include <ucontext.h>
+       int main (void)
+       {
+         ucontext_t orig_context,child_context;
+         if (swapcontext(&child_context, &orig_context) < 0) { }
+       }
+    }]
+}
+
 # Return 1 if compilation with -pthread is error-free for trivial
 # code, 0 otherwise.
 
@@ -993,12 +1021,7 @@ proc check_iconv_available { test_what } {
 # Return 1 if an ASCII locale is supported on this host, 0 otherwise.
 
 proc check_ascii_locale_available { } {
-    if { ([ishost alpha*-dec-osf*] || [ishost mips-sgi-irix*]) } {
-       # Neither Tru64 UNIX nor IRIX support an ASCII locale.
-       return 0
-    } else {
-       return 1
-    }
+    return 1
 }
 
 # Return true if named sections are supported on this target.
@@ -1009,6 +1032,14 @@ proc check_named_sections_available { } {
     }]
 }
 
+# Return true if the "naked" function attribute is supported on this target.
+
+proc check_effective_target_naked_functions { } {
+    return [check_no_compiler_messages naked_functions assembly {
+       void f() __attribute__((naked));
+    }]
+}
+
 # Return 1 if the target supports Fortran real kinds larger than real(8),
 # 0 otherwise.
 #
@@ -1706,6 +1737,15 @@ proc check_effective_target_llp64 { } {
     }]
 }
 
+# Return 1 if long and int have different sizes,
+# 0 otherwise.
+
+proc check_effective_target_long_neq_int { } {
+    return [check_no_compiler_messages long_ne_int object {
+       int dummy[sizeof (int) != sizeof (long) ? 1 : -1];
+    }]
+}
+
 # Return 1 if the target supports long double larger than double,
 # 0 otherwise.
 
@@ -1742,6 +1782,31 @@ proc check_effective_target_double64plus { } {
     }]
 }
 
+# Return 1 if the target supports 'w' suffix on floating constant
+# 0 otherwise.
+
+proc check_effective_target_has_w_floating_suffix { } {
+    set opts ""
+    if [check_effective_target_c++] {
+        append opts "-std=gnu++03"
+    }
+    return [check_no_compiler_messages w_fp_suffix object {
+       float dummy = 1.0w;
+    } "$opts"]
+}
+
+# Return 1 if the target supports 'q' suffix on floating constant
+# 0 otherwise.
+
+proc check_effective_target_has_q_floating_suffix { } {
+    set opts ""
+    if [check_effective_target_c++] {
+        append opts "-std=gnu++03"
+    }
+    return [check_no_compiler_messages q_fp_suffix object {
+       float dummy = 1.0q;
+    } "$opts"]
+}
 # Return 1 if the target supports compiling fixed-point,
 # 0 otherwise.
 
@@ -1883,6 +1948,7 @@ proc check_effective_target_vect_int { } {
              || [istarget sparc*-*-*]
              || [istarget alpha*-*-*]
              || [istarget ia64-*-*] 
+             || [istarget aarch64*-*-*]
              || [check_effective_target_arm32]
              || ([istarget mips*-*-*]
                  && [check_effective_target_mips_loongson]) } {
@@ -2003,6 +2069,15 @@ proc check_effective_target_vect_floatuint_cvt { } {
     return $et_vect_floatuint_cvt_saved
 }
 
+# Return 1 if this is a AArch64 target supporting big endian
+proc check_effective_target_aarch64_big_endian { } {
+    return [check_no_compiler_messages aarch64_big_endian assembly {
+       #if !defined(__aarch64__) || !defined(__AARCH64EB__)
+       #error FOO
+       #endif
+    }]
+}
+
 # Return 1 is this is an arm target using 32-bit instructions
 proc check_effective_target_arm32 { } {
     return [check_no_compiler_messages arm32 assembly {
@@ -2056,12 +2131,45 @@ proc check_effective_target_arm_vfp_ok { } {
     }
 }
 
+# Return 1 if this is an ARM target supporting -mfpu=fp-armv8
+# -mfloat-abi=softfp.
+proc check_effective_target_arm_v8_vfp_ok {} {
+    if { [check_effective_target_arm32] } {
+       return [check_no_compiler_messages arm_v8_vfp_ok object {
+         int foo (void)
+         {
+            __asm__ volatile ("vrinta.f32.f32 s0, s0");
+            return 0;
+         }
+       } "-mfpu=fp-armv8 -mfloat-abi=softfp"]
+    } else {
+       return 0
+    }
+}
+
+# Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8
+# -mfloat-abi=softfp
+proc check_effective_target_arm_v8_neon_ok {} {
+    if { [check_effective_target_arm32] } {
+       return [check_no_compiler_messages arm_v8_neon_ok object {
+         int foo (void)
+         {
+            __asm__ volatile ("vrintn.f32 q0, q0");
+              return 0;
+         }
+       } "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"]
+    } else {
+       return 0
+    }
+}
+
 # Return 1 if this is an ARM target supporting -mfpu=vfp
 # -mfloat-abi=hard.  Some multilibs may be incompatible with these
 # options.
 
 proc check_effective_target_arm_hard_vfp_ok { } {
-    if { [check_effective_target_arm32] } {
+    if { [check_effective_target_arm32] 
+        && ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
        return [check_no_compiler_messages arm_hard_vfp_ok executable {
            int main() { return 0;}
        } "-mfpu=vfp -mfloat-abi=hard"]
@@ -2107,6 +2215,33 @@ proc add_options_for_arm_neon { flags } {
     return "$flags $et_arm_neon_flags"
 }
 
+proc add_options_for_arm_v8_vfp { flags } {
+    if { ! [check_effective_target_arm_v8_vfp_ok] } {
+        return "$flags"
+    }
+    return "$flags -mfpu=fp-armv8 -mfloat-abi=softfp"
+}
+
+proc add_options_for_arm_v8_neon { flags } {
+    if { ! [check_effective_target_arm_v8_neon_ok] } {
+        return "$flags"
+    }
+    return "$flags -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=softfp"
+}
+
+# Add the options needed for NEON.  We need either -mfloat-abi=softfp
+# or -mfloat-abi=hard, but if one is already specified by the
+# multilib, use it.  Similarly, if a -mfpu option already enables
+# NEON, do not add -mfpu=neon.
+
+proc add_options_for_arm_neonv2 { flags } {
+    if { ! [check_effective_target_arm_neonv2_ok] } {
+       return "$flags"
+    }
+    global et_arm_neonv2_flags
+    return "$flags $et_arm_neonv2_flags"
+}
+
 # Return 1 if this is an ARM target supporting -mfpu=neon
 # -mfloat-abi=softfp or equivalent options.  Some multilibs may be
 # incompatible with these options.  Also set et_arm_neon_flags to the
@@ -2135,6 +2270,38 @@ proc check_effective_target_arm_neon_ok { } {
                check_effective_target_arm_neon_ok_nocache]
 }
 
+# Return 1 if this is an ARM target supporting -mfpu=neon-vfpv4
+# -mfloat-abi=softfp or equivalent options.  Some multilibs may be
+# incompatible with these options.  Also set et_arm_neonv2_flags to the
+# best options to add.
+
+proc check_effective_target_arm_neonv2_ok_nocache { } {
+    global et_arm_neonv2_flags
+    set et_arm_neonv2_flags ""
+    if { [check_effective_target_arm32] } {
+       foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
+           if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
+               #include "arm_neon.h"
+               float32x2_t 
+               foo (float32x2_t a, float32x2_t b, float32x2_t c)
+                {
+                  return vfma_f32 (a, b, c);
+                }
+           } "$flags"] } {
+               set et_arm_neonv2_flags $flags
+               return 1
+           }
+       }
+    }
+
+    return 0
+}
+
+proc check_effective_target_arm_neonv2_ok { } {
+    return [check_cached_effective_target arm_neonv2_ok \
+               check_effective_target_arm_neonv2_ok_nocache]
+}
+
 # Add the options needed for NEON.  We need either -mfloat-abi=softfp
 # or -mfloat-abi=hard, but if one is already specified by the
 # multilib, use it.
@@ -2194,10 +2361,22 @@ proc check_effective_target_arm_fp16_ok { } {
 # (Thumb in particular - but others may be added in the future)
 # Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
 #        /* { dg-add-options arm_arch_v5 } */
-foreach { armfunc armflag armdef } { v5 "-march=armv5 -marm" __ARM_ARCH_5__
+#       /* { dg-require-effective-target arm_arch_v5_multilib } */
+foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
+                                    v4t "-march=armv4t" __ARM_ARCH_4T__
+                                    v5 "-march=armv5 -marm" __ARM_ARCH_5__
+                                    v5t "-march=armv5t" __ARM_ARCH_5T__
+                                    v5te "-march=armv5te" __ARM_ARCH_5TE__
                                     v6 "-march=armv6" __ARM_ARCH_6__
                                     v6k "-march=armv6k" __ARM_ARCH_6K__
-                                    v7a "-march=armv7-a" __ARM_ARCH_7A__ } {
+                                    v6t2 "-march=armv6t2" __ARM_ARCH_6T2__
+                                    v6z "-march=armv6z" __ARM_ARCH_6Z__
+                                    v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
+                                    v7a "-march=armv7-a" __ARM_ARCH_7A__
+                                    v7r "-march=armv7-r" __ARM_ARCH_7R__
+                                    v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
+                                    v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
+                                    v8a "-march=armv8-a" __ARM_ARCH_8A__ } {
     eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
        proc check_effective_target_arm_arch_FUNC_ok { } {
            if { [ string match "*-marm*" "FLAG" ] &&
@@ -2214,6 +2393,16 @@ foreach { armfunc armflag armdef } { v5 "-march=armv5 -marm" __ARM_ARCH_5__
        proc add_options_for_arm_arch_FUNC { flags } {
            return "$flags FLAG"
        }
+
+       proc check_effective_target_arm_arch_FUNC_multilib { } {
+           return [check_runtime arm_arch_FUNC_multilib {
+               int
+               main (void)
+               {
+                   return 0;
+               }
+           } [add_options_for_arm_arch_FUNC ""]]
+        }
     }]
 }
 
@@ -2305,6 +2494,21 @@ proc check_effective_target_arm_neon_hw { } {
     } [add_options_for_arm_neon ""]]
 }
 
+proc check_effective_target_arm_neonv2_hw { } {
+    return [check_runtime arm_neon_hwv2_available {
+       #include "arm_neon.h"
+       int
+       main (void)
+       {
+         float32x2_t a, b, c;
+         asm ("vfma.f32 %P0, %P1, %P2"
+              : "=w" (a)
+              : "w" (b), "w" (c));
+         return 0;
+       }
+    } [add_options_for_arm_neonv2 ""]]
+}
+
 # Return 1 if this is a ARM target with NEON enabled.
 
 proc check_effective_target_arm_neon { } {
@@ -2321,6 +2525,24 @@ proc check_effective_target_arm_neon { } {
     }
 }
 
+proc check_effective_target_arm_neonv2 { } {
+    if { [check_effective_target_arm32] } {
+       return [check_no_compiler_messages arm_neon object {
+           #ifndef __ARM_NEON__
+           #error not NEON
+           #else
+           #ifndef __ARM_FEATURE_FMA
+           #error not NEONv2
+            #else
+           int dummy;
+           #endif
+           #endif
+       }]
+    } else {
+       return 0
+    }
+}
+
 # Return 1 if this a Loongson-2E or -2F target using an ABI that supports
 # the Loongson vector modes.
 
@@ -2345,6 +2567,19 @@ proc check_effective_target_arm_eabi { } {
     }]
 }
 
+# Return 1 if this is an ARM target that adheres to the hard-float variant of
+# the ABI for the ARM Architecture (e.g. -mfloat-abi=hard).
+
+proc check_effective_target_arm_hf_eabi { } {
+    return [check_no_compiler_messages arm_hf_eabi object {
+       #if !defined(__ARM_EABI__) || !defined(__ARM_PCS_VFP)
+       #error not hard-float EABI
+       #else
+       int dummy;
+       #endif
+    }]
+}
+
 # Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
 # Some multilibs may be incompatible with this option.
 
@@ -2358,6 +2593,30 @@ proc check_effective_target_arm_iwmmxt_ok { } {
     }
 }
 
+# Return true if LDRD/STRD instructions are prefered over LDM/STM instructions
+# for an ARM target.
+proc check_effective_target_arm_prefer_ldrd_strd { } {
+    if { ![check_effective_target_arm32] } {
+      return 0;
+    }
+
+    return [check_no_messages_and_pattern arm_prefer_ldrd_strd "strd\tr" assembly {
+        void foo (int *p) { p[0] = 1; p[1] = 0;}
+    }  "-O2 -mthumb" ]
+}
+
+# Return 1 if this is a PowerPC target supporting -meabi.
+
+proc check_effective_target_powerpc_eabi_ok { } {
+    if { [istarget powerpc*-*-*] } {
+       return [check_no_compiler_messages powerpc_eabi_ok object {
+           int dummy;
+       } "-meabi"]
+    } else {
+       return 0
+    }
+}
+
 # Return 1 if this is a PowerPC target with floating-point registers.
 
 proc check_effective_target_powerpc_fprs { } {
@@ -2419,10 +2678,10 @@ proc check_effective_target_powerpc_vsx_ok { } {
     if { ([istarget powerpc*-*-*]
          && ![istarget powerpc-*-linux*paired*])
         || [istarget rs6000-*-*] } {
-       # AltiVec is not supported on AIX before 5.3.
+       # VSX is not supported on AIX before 7.1.
        if { [istarget powerpc*-*-aix4*]
-            || [istarget powerpc*-*-aix5.1*] 
-            || [istarget powerpc*-*-aix5.2*] } {
+            || [istarget powerpc*-*-aix5*]
+            || [istarget powerpc*-*-aix6*] } {
            return 0
        }
        return [check_no_compiler_messages powerpc_vsx_ok object {
@@ -2621,6 +2880,7 @@ proc check_effective_target_vect_shift { } {
             || [istarget ia64-*-*]
             || [istarget i?86-*-*]
             || [istarget x86_64-*-*]
+            || [istarget aarch64*-*-*]
             || [check_effective_target_arm32]
             || ([istarget mips*-*-*]
                 && [check_effective_target_mips_loongson]) } {
@@ -2687,9 +2947,11 @@ proc check_effective_target_vect_float { } {
        if { [istarget i?86-*-*]
              || [istarget powerpc*-*-*]
              || [istarget spu-*-*]
+             || [istarget mips-sde-elf]
              || [istarget mipsisa64*-*-*]
              || [istarget x86_64-*-*]
              || [istarget ia64-*-*]
+             || [istarget aarch64*-*-*]
              || [check_effective_target_arm32] } {
           set et_vect_float_saved 1
        }
@@ -2711,6 +2973,7 @@ proc check_effective_target_vect_double { } {
     } else {
        set et_vect_double_saved 0
        if { [istarget i?86-*-*]
+             || [istarget aarch64*-*-*]
              || [istarget x86_64-*-*] } {
           if { [check_no_compiler_messages vect_double assembly {
                 #ifdef __tune_atom__
@@ -2827,6 +3090,7 @@ proc check_effective_target_vect_perm { } {
     } else {
         set et_vect_perm_saved 0
         if { [is-effective-target arm_neon_ok]
+            || [istarget aarch64*-*-*]
             || [istarget powerpc*-*-*]
              || [istarget spu-*-*]
             || [istarget i?86-*-*]
@@ -2852,7 +3116,9 @@ proc check_effective_target_vect_perm_byte { } {
         verbose "check_effective_target_vect_perm_byte: using cached result" 2
     } else {
         set et_vect_perm_byte_saved 0
-        if { [is-effective-target arm_neon_ok]
+        if { ([is-effective-target arm_neon_ok]
+             && [is-effective-target arm_little_endian])
+            || [istarget aarch64*-*-*]
             || [istarget powerpc*-*-*]
              || [istarget spu-*-*] } {
             set et_vect_perm_byte_saved 1
@@ -2874,7 +3140,9 @@ proc check_effective_target_vect_perm_short { } {
         verbose "check_effective_target_vect_perm_short: using cached result" 2
     } else {
         set et_vect_perm_short_saved 0
-        if { [is-effective-target arm_neon_ok]
+        if { ([is-effective-target arm_neon_ok]
+             && [is-effective-target arm_little_endian])
+            || [istarget aarch64*-*-*]
             || [istarget powerpc*-*-*]
              || [istarget spu-*-*] } {
             set et_vect_perm_short_saved 1
@@ -2943,6 +3211,7 @@ proc check_effective_target_vect_widen_sum_qi_to_hi { } {
     } else {
         set et_vect_widen_sum_qi_to_hi_saved 0
        if { [check_effective_target_vect_unpack] 
+            || [check_effective_target_arm_neon_ok]
             || [istarget ia64-*-*] } {
             set et_vect_widen_sum_qi_to_hi_saved 1
        }
@@ -2993,7 +3262,8 @@ proc check_effective_target_vect_widen_mult_qi_to_hi { } {
            set et_vect_widen_mult_qi_to_hi_saved 0
        }
         if { [istarget powerpc*-*-*]
-              || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
+              || [istarget aarch64*-*-*]
+              || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
             set et_vect_widen_mult_qi_to_hi_saved 1
         }
     }
@@ -3025,9 +3295,10 @@ proc check_effective_target_vect_widen_mult_hi_to_si { } {
         if { [istarget powerpc*-*-*]
              || [istarget spu-*-*]
              || [istarget ia64-*-*]
+             || [istarget aarch64*-*-*]
              || [istarget i?86-*-*]
              || [istarget x86_64-*-*]
-              || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
+              || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
             set et_vect_widen_mult_hi_to_si_saved 1
         }
     }
@@ -3048,7 +3319,9 @@ proc check_effective_target_vect_widen_mult_qi_to_hi_pattern { } {
     } else {
         set et_vect_widen_mult_qi_to_hi_pattern_saved 0
         if { [istarget powerpc*-*-*]
-              || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
+              || ([istarget arm*-*-*]
+                 && [check_effective_target_arm_neon_ok]
+                 && [check_effective_target_arm_little_endian]) } {
             set et_vect_widen_mult_qi_to_hi_pattern_saved 1
         }
     }
@@ -3073,7 +3346,9 @@ proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
               || [istarget ia64-*-*]
               || [istarget i?86-*-*]
               || [istarget x86_64-*-*]
-              || ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
+              || ([istarget arm*-*-*]
+                 && [check_effective_target_arm_neon_ok]
+                 && [check_effective_target_arm_little_endian]) } {
             set et_vect_widen_mult_hi_to_si_pattern_saved 1
         }
     }
@@ -3202,8 +3477,9 @@ proc check_effective_target_vect_pack_trunc { } {
         if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*])
              || [istarget i?86-*-*]
              || [istarget x86_64-*-*]
+             || [istarget aarch64*-*-*]
              || [istarget spu-*-*]
-             || ([istarget arm*-*-*] && [check_effective_target_arm_neon]
+             || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
                 && [check_effective_target_arm_little_endian]) } {
             set et_vect_pack_trunc_saved 1
         }
@@ -3229,7 +3505,8 @@ proc check_effective_target_vect_unpack { } {
              || [istarget x86_64-*-*] 
              || [istarget spu-*-*]
              || [istarget ia64-*-*]
-             || ([istarget arm*-*-*] && [check_effective_target_arm_neon]
+             || [istarget aarch64*-*-*]
+             || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
                 && [check_effective_target_arm_little_endian]) } {
             set et_vect_unpack_saved 1
         }
@@ -3268,6 +3545,7 @@ proc check_effective_target_vect_no_align { } {
     } else {
        set et_vect_no_align_saved 0
        if { [istarget mipsisa64*-*-*]
+            || [istarget mips-sde-elf]
             || [istarget sparc*-*-*]
             || [istarget ia64-*-*]
             || [check_effective_target_arm_vect_no_misalign]
@@ -3292,6 +3570,7 @@ proc check_effective_target_vect_hw_misalign { } {
     } else {
         set et_vect_hw_misalign_saved 0
        if { ([istarget x86_64-*-*] 
+           || [istarget aarch64*-*-*]
             || [istarget i?86-*-*]) } {
           set et_vect_hw_misalign_saved 1
        }
@@ -3461,7 +3740,8 @@ proc check_effective_target_vect_condition { } {
        verbose "check_effective_target_vect_cond: using cached result" 2
     } else {
        set et_vect_cond_saved 0
-       if { [istarget powerpc*-*-*]
+       if { [istarget aarch64*-*-*]
+            || [istarget powerpc*-*-*]
             || [istarget ia64-*-*]
             || [istarget i?86-*-*]
             || [istarget spu-*-*]
@@ -3505,9 +3785,11 @@ proc check_effective_target_vect_char_mult { } {
        verbose "check_effective_target_vect_char_mult: using cached result" 2
     } else {
        set et_vect_char_mult_saved 0
-       if { [istarget ia64-*-*]
+       if { [istarget aarch64*-*-*]
+            || [istarget ia64-*-*]
             || [istarget i?86-*-*]
-            || [istarget x86_64-*-*] } {
+            || [istarget x86_64-*-*]
+            || [check_effective_target_arm32] } {
           set et_vect_char_mult_saved 1
        }
     }
@@ -3530,6 +3812,7 @@ proc check_effective_target_vect_short_mult { } {
             || [istarget i?86-*-*]
             || [istarget x86_64-*-*]
             || [istarget powerpc*-*-*]
+            || [istarget aarch64*-*-*]
             || [check_effective_target_arm32]
             || ([istarget mips*-*-*]
                 && [check_effective_target_mips_loongson]) } {
@@ -3555,6 +3838,7 @@ proc check_effective_target_vect_int_mult { } {
             || [istarget i?86-*-*]
             || [istarget x86_64-*-*]
             || [istarget ia64-*-*]
+            || [istarget aarch64*-*-*]
             || [check_effective_target_arm32] } {
           set et_vect_int_mult_saved 1
        }
@@ -3573,8 +3857,9 @@ proc check_effective_target_vect_extract_even_odd { } {
         verbose "check_effective_target_vect_extract_even_odd: using cached result" 2
     } else {
         set et_vect_extract_even_odd_saved 0 
-        if { [istarget powerpc*-*-*] 
-            || [is-effective-target arm_neon_ok]
+       if { [istarget aarch64*-*-*]
+            || [istarget powerpc*-*-*]
+            || [is-effective-target arm_neon_ok]
              || [istarget i?86-*-*]
              || [istarget x86_64-*-*]
              || [istarget ia64-*-*]
@@ -3598,8 +3883,9 @@ proc check_effective_target_vect_interleave { } {
         verbose "check_effective_target_vect_interleave: using cached result" 2
     } else {
         set et_vect_interleave_saved 0
-        if { [istarget powerpc*-*-*]
-            || [is-effective-target arm_neon_ok]
+       if { [istarget aarch64*-*-*]
+            || [istarget powerpc*-*-*]
+            || [is-effective-target arm_neon_ok]
              || [istarget i?86-*-*]
              || [istarget x86_64-*-*]
              || [istarget ia64-*-*]
@@ -3629,7 +3915,8 @@ foreach N {2 3 4 8} {
                     && [check_effective_target_vect_extract_even_odd] } {
                    set et_vect_stridedN_saved 1
                }
-               if { [istarget arm*-*-*] && N >= 2 && N <= 4 } {
+               if { ([istarget arm*-*-*]
+                     || [istarget aarch64*-*-*]) && N >= 2 && N <= 4 } {
                    set et_vect_stridedN_saved 1
                }
            }
@@ -3646,7 +3933,8 @@ proc check_effective_target_vect_multiple_sizes { } {
     global et_vect_multiple_sizes_saved
 
     set et_vect_multiple_sizes_saved 0
-    if { ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } {
+    if { ([istarget aarch64*-*-*]
+         || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])) } {
        set et_vect_multiple_sizes_saved 1
     }
     if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
@@ -3668,7 +3956,9 @@ proc check_effective_target_vect64 { } {
         verbose "check_effective_target_vect64: using cached result" 2
     } else {
         set et_vect64_saved 0
-        if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } {
+        if { ([istarget arm*-*-*]
+             && [check_effective_target_arm_neon_ok]
+             && [check_effective_target_arm_little_endian]) } {
            set et_vect64_saved 1
         }
     }
@@ -3706,7 +3996,8 @@ proc check_effective_target_vect_call_sqrtf { } {
        verbose "check_effective_target_vect_call_sqrtf: using cached result" 2
     } else {
        set et_vect_call_sqrtf_saved 0
-       if { [istarget i?86-*-*]
+       if { [istarget aarch64*-*-*]
+            || [istarget i?86-*-*]
             || [istarget x86_64-*-*]
             || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } {
            set et_vect_call_sqrtf_saved 1
@@ -3729,6 +4020,222 @@ proc check_effective_target_vect_call_lrint { } {
     return $et_vect_call_lrint
 }
 
+# Return 1 if the target supports vector btrunc calls.
+
+proc check_effective_target_vect_call_btrunc { } {
+    global et_vect_call_btrunc_saved
+
+    if [info exists et_vect_call_btrunc_saved] {
+       verbose "check_effective_target_vect_call_btrunc: using cached result" 2
+    } else {
+       set et_vect_call_btrunc_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_btrunc_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_btrunc: returning $et_vect_call_btrunc_saved" 2
+    return $et_vect_call_btrunc_saved
+}
+
+# Return 1 if the target supports vector btruncf calls.
+
+proc check_effective_target_vect_call_btruncf { } {
+    global et_vect_call_btruncf_saved
+
+    if [info exists et_vect_call_btruncf_saved] {
+       verbose "check_effective_target_vect_call_btruncf: using cached result" 2
+    } else {
+       set et_vect_call_btruncf_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_btruncf_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_btruncf: returning $et_vect_call_btruncf_saved" 2
+    return $et_vect_call_btruncf_saved
+}
+
+# Return 1 if the target supports vector ceil calls.
+
+proc check_effective_target_vect_call_ceil { } {
+    global et_vect_call_ceil_saved
+
+    if [info exists et_vect_call_ceil_saved] {
+       verbose "check_effective_target_vect_call_ceil: using cached result" 2
+    } else {
+       set et_vect_call_ceil_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_ceil_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_ceil: returning $et_vect_call_ceil_saved" 2
+    return $et_vect_call_ceil_saved
+}
+
+# Return 1 if the target supports vector ceilf calls.
+
+proc check_effective_target_vect_call_ceilf { } {
+    global et_vect_call_ceilf_saved
+
+    if [info exists et_vect_call_ceilf_saved] {
+       verbose "check_effective_target_vect_call_ceilf: using cached result" 2
+    } else {
+       set et_vect_call_ceilf_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_ceilf_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_ceilf: returning $et_vect_call_ceilf_saved" 2
+    return $et_vect_call_ceilf_saved
+}
+
+# Return 1 if the target supports vector floor calls.
+
+proc check_effective_target_vect_call_floor { } {
+    global et_vect_call_floor_saved
+
+    if [info exists et_vect_call_floor_saved] {
+       verbose "check_effective_target_vect_call_floor: using cached result" 2
+    } else {
+       set et_vect_call_floor_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_floor_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_floor: returning $et_vect_call_floor_saved" 2
+    return $et_vect_call_floor_saved
+}
+
+# Return 1 if the target supports vector floorf calls.
+
+proc check_effective_target_vect_call_floorf { } {
+    global et_vect_call_floorf_saved
+
+    if [info exists et_vect_call_floorf_saved] {
+       verbose "check_effective_target_vect_call_floorf: using cached result" 2
+    } else {
+       set et_vect_call_floorf_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_floorf_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_floorf: returning $et_vect_call_floorf_saved" 2
+    return $et_vect_call_floorf_saved
+}
+
+# Return 1 if the target supports vector lceil calls.
+
+proc check_effective_target_vect_call_lceil { } {
+    global et_vect_call_lceil_saved
+
+    if [info exists et_vect_call_lceil_saved] {
+       verbose "check_effective_target_vect_call_lceil: using cached result" 2
+    } else {
+       set et_vect_call_lceil_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_lceil_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_lceil: returning $et_vect_call_lceil_saved" 2
+    return $et_vect_call_lceil_saved
+}
+
+# Return 1 if the target supports vector lfloor calls.
+
+proc check_effective_target_vect_call_lfloor { } {
+    global et_vect_call_lfloor_saved
+
+    if [info exists et_vect_call_lfloor_saved] {
+       verbose "check_effective_target_vect_call_lfloor: using cached result" 2
+    } else {
+       set et_vect_call_lfloor_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_lfloor_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_lfloor: returning $et_vect_call_lfloor_saved" 2
+    return $et_vect_call_lfloor_saved
+}
+
+# Return 1 if the target supports vector nearbyint calls.
+
+proc check_effective_target_vect_call_nearbyint { } {
+    global et_vect_call_nearbyint_saved
+
+    if [info exists et_vect_call_nearbyint_saved] {
+       verbose "check_effective_target_vect_call_nearbyint: using cached result" 2
+    } else {
+       set et_vect_call_nearbyint_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_nearbyint_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_nearbyint: returning $et_vect_call_nearbyint_saved" 2
+    return $et_vect_call_nearbyint_saved
+}
+
+# Return 1 if the target supports vector nearbyintf calls.
+
+proc check_effective_target_vect_call_nearbyintf { } {
+    global et_vect_call_nearbyintf_saved
+
+    if [info exists et_vect_call_nearbyintf_saved] {
+       verbose "check_effective_target_vect_call_nearbyintf: using cached result" 2
+    } else {
+       set et_vect_call_nearbyintf_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_nearbyintf_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_nearbyintf: returning $et_vect_call_nearbyintf_saved" 2
+    return $et_vect_call_nearbyintf_saved
+}
+
+# Return 1 if the target supports vector round calls.
+
+proc check_effective_target_vect_call_round { } {
+    global et_vect_call_round_saved
+
+    if [info exists et_vect_call_round_saved] {
+       verbose "check_effective_target_vect_call_round: using cached result" 2
+    } else {
+       set et_vect_call_round_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_round_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_round: returning $et_vect_call_round_saved" 2
+    return $et_vect_call_round_saved
+}
+
+# Return 1 if the target supports vector roundf calls.
+
+proc check_effective_target_vect_call_roundf { } {
+    global et_vect_call_roundf_saved
+
+    if [info exists et_vect_call_roundf_saved] {
+       verbose "check_effective_target_vect_call_roundf: using cached result" 2
+    } else {
+       set et_vect_call_roundf_saved 0
+       if { [istarget aarch64*-*-*] } {
+         set et_vect_call_roundf_saved 1
+       }
+    }
+
+    verbose "check_effective_target_vect_call_roundf: returning $et_vect_call_roundf_saved" 2
+    return $et_vect_call_roundf_saved
+}
+
 # Return 1 if the target supports section-anchors
 
 proc check_effective_target_section_anchors { } {
@@ -3818,7 +4325,7 @@ proc check_effective_target_sync_long_long_runtime { } {
                }
            } ""
        }]
-    } elseif { [istarget arm*-*-linux-gnueabi] } {
+    } elseif { [istarget arm*-*-linux-*] } {
        return [check_runtime sync_longlong_runtime {
            #include <stdlib.h>
            int main ()
@@ -3840,6 +4347,8 @@ proc check_effective_target_sync_long_long_runtime { } {
                 && [check_effective_target_lp64]
                 && [check_effective_target_ultrasparc_hw]) } {
        return 1
+    } elseif { [istarget powerpc*-*-*] && [check_effective_target_lp64] } {
+       return 1
     } else {
        return 0
     }
@@ -3859,12 +4368,14 @@ proc check_effective_target_sync_int_long { } {
         if { [istarget ia64-*-*]
             || [istarget i?86-*-*]
             || [istarget x86_64-*-*]
+            || [istarget aarch64*-*-*]
             || [istarget alpha*-*-*] 
-            || [istarget arm*-*-linux-gnueabi
+            || [istarget arm*-*-linux-*
             || [istarget bfin*-*linux*]
             || [istarget hppa*-*linux*]
             || [istarget s390*-*-*] 
             || [istarget powerpc*-*-*]
+            || [istarget crisv32-*-*] || [istarget cris-*-*]
             || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
             || [check_effective_target_mips_llsc] } {
            set et_sync_int_long_saved 1
@@ -3886,14 +4397,16 @@ proc check_effective_target_sync_char_short { } {
         set et_sync_char_short_saved 0
 # This is intentionally powerpc but not rs6000, rs6000 doesn't have the
 # load-reserved/store-conditional instructions.
-        if { [istarget ia64-*-*]
+        if { [istarget aarch64*-*-*]
+            || [istarget ia64-*-*]
             || [istarget i?86-*-*]
             || [istarget x86_64-*-*]
             || [istarget alpha*-*-*] 
-            || [istarget arm*-*-linux-gnueabi
+            || [istarget arm*-*-linux-*
             || [istarget hppa*-*linux*]
             || [istarget s390*-*-*] 
             || [istarget powerpc*-*-*]
+            || [istarget crisv32-*-*] || [istarget cris-*-*]
             || ([istarget sparc*-*-*] && [check_effective_target_sparc_v9])
             || [check_effective_target_mips_llsc] } {
            set et_sync_char_short_saved 1
@@ -4078,6 +4591,34 @@ proc check_effective_target_simulator { } {
     return 0
 }
 
+# Return 1 if programs are intended to be run on hardware rather than
+# on a simulator
+
+proc check_effective_target_hw { } {
+
+    # All "src/sim" simulators set this one.
+    if [board_info target exists is_simulator] {
+    if [board_info target is_simulator] {
+      return 0
+    } else {
+      return 1
+    }
+    }
+
+    # The "sid" simulators don't set that one, but at least they set
+    # this one.
+    if [board_info target exists slow_simulator] {
+    if [board_info target slow_simulator] {
+      return 0
+    } else {
+      return 1
+    }
+    }
+
+    return 1
+}
+
+
 # Return 1 if the target is a VxWorks kernel.
 
 proc check_effective_target_vxworks_kernel { } {
@@ -4171,9 +4712,6 @@ proc add_options_for_c99_runtime { flags } {
     if { [istarget *-*-solaris2*] } {
        return "$flags -std=c99"
     }
-    if { [istarget mips-sgi-irix6.5*] } {
-       return "$flags -std=c99"
-    }
     if { [istarget powerpc-*-darwin*] } {
        return "$flags -mmacosx-version-min=10.3"
     }
@@ -4457,6 +4995,14 @@ proc check_effective_target_lto { } {
     return [info exists ENABLE_LTO]
 }
 
+# Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
+
+proc check_effective_target_maybe_x32 { } {
+    return [check_no_compiler_messages maybe_x32 object {
+        void foo (void) {}
+    } "-mx32 -maddress-mode=short"]
+}
+
 # Return 1 if this target supports the -fsplit-stack option, 0
 # otherwise.
 
@@ -4466,6 +5012,15 @@ proc check_effective_target_split_stack {} {
     } "-fsplit-stack"]
 }
 
+# Return 1 if this target supports the -masm=intel option, 0
+# otherwise
+
+proc check_effective_target_masm_intel  {} {
+    return [check_no_compiler_messages masm_intel object {
+       extern void abort (void);
+    } "-masm=intel"]
+}
+
 # Return 1 if the language for the compiler under test is C.
 
 proc check_effective_target_c { } {
@@ -4497,11 +5052,18 @@ proc check_effective_target_c++11 { } {
     return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
 }
 
+proc check_effective_target_c++1y { } {
+    if ![check_effective_target_c++] {
+       return 0
+    }
+    return [check-flags { { } { } { -std=c++1y -std=gnu++1y } }]
+}
+
 proc check_effective_target_c++98 { } {
     if ![check_effective_target_c++] {
        return 0
     }
-    return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
+    return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 -std=c++1y -std=gnu++1y } }]
 }
 
 # Return 1 if expensive testcases should be run.
@@ -4606,6 +5168,8 @@ proc check_vect_support_and_set_flags { } {
         } else {
             set dg-do-what-default compile
         }
+    } elseif [istarget "aarch64*-*-*"] {
+        set dg-do-what-default run
     } else {
         return 0
     }
@@ -4629,3 +5193,45 @@ proc check_effective_target_ucontext_h { } {
        #include <ucontext.h>
     }]
 }
+
+proc check_effective_target_aarch64_tiny { } {
+    if { [istarget aarch64*-*-*] } {
+       return [check_no_compiler_messages aarch64_tiny object {
+           #ifdef __AARCH64_CMODEL_TINY__
+           int dummy;
+           #else
+           #error target not AArch64 tiny code model
+           #endif
+       }]
+    } else {
+       return 0
+    }
+}
+
+proc check_effective_target_aarch64_small { } {
+    if { [istarget aarch64*-*-*] } {
+       return [check_no_compiler_messages aarch64_small object {
+           #ifdef __AARCH64_CMODEL_SMALL__
+           int dummy;
+           #else
+           #error target not AArch64 small code model
+           #endif
+       }]
+    } else {
+       return 0
+    }
+}
+
+proc check_effective_target_aarch64_large { } {
+    if { [istarget aarch64*-*-*] } {
+       return [check_no_compiler_messages aarch64_large object {
+           #ifdef __AARCH64_CMODEL_LARGE__
+           int dummy;
+           #else
+           #error target not AArch64 large code model
+           #endif
+       }]
+    } else {
+       return 0
+    }
+}