+2015-12-08  Christophe Lyon  <christophe.lyon@linaro.org>
+
+       * lib/target-supports.exp
+       (check_effective_target_arm_vfp_ok_nocache): New.
+       (check_effective_target_arm_vfp_ok): Call the new
+       check_effective_target_arm_vfp_ok_nocache function.
+       (check_effective_target_arm_fp_ok_nocache): New.
+       (check_effective_target_arm_fp_ok): New.
+       (add_options_for_arm_fp): New.
+       (check_effective_target_arm_crypto_ok_nocache): Require
+       target_arm_v8_neon_ok instead of arm32.
+       (check_effective_target_arm_crypto_pragma_ok_nocache): New.
+       (check_effective_target_arm_crypto_pragma_ok): New.
+       (add_options_for_arm_vfp): New.
+       * gcc.target/arm/attr-crypto.c: Use arm_crypto_pragma_ok effective
+       target. Do not force -mfloat-abi=softfp, use arm_vfp effective
+       target instead.
+       * gcc.target/arm/attr-neon-builtin-fail.c: Do not force
+       -mfloat-abi=softfp, use arm_fp effective target instead.
+       * gcc.target/arm/attr-neon-fp16.c: Likewise. Remove arm_neon_ok
+       dependency.
+       * gcc.target/arm/attr-neon2.c: Do not force -mfloat-abi=softfp,
+       use arm_vfp effective target instead.
+       * gcc.target/arm/attr-neon3.c: Likewise.
+
 2015-12-08  Kirill Yukhin  <kirill.yukhin@intel.com>
 
        * gfortran.dg/pr68627.f: Limit target to x86.
 
 
 
 # Return 1 if this is an ARM target supporting -mfpu=vfp
-# -mfloat-abi=softfp.  Some multilibs may be incompatible with these
-# options.
+# -mfloat-abi=softfp or equivalent options.  Some multilibs may be
+# incompatible with these options.  Also set et_arm_vfp_flags to the
+# best options to add.
 
-proc check_effective_target_arm_vfp_ok { } {
+proc check_effective_target_arm_vfp_ok_nocache { } {
+    global et_arm_vfp_flags
+    set et_arm_vfp_flags ""
     if { [check_effective_target_arm32] } {
-       return [check_no_compiler_messages arm_vfp_ok object {
-           int dummy;
-       } "-mfpu=vfp -mfloat-abi=softfp"]
-    } else {
-       return 0
+       foreach flags {"-mfpu=vfp" "-mfpu=vfp -mfloat-abi=softfp" "-mfpu=vfp -mfloat-abi=hard"} {
+           if { [check_no_compiler_messages_nocache arm_vfp_ok object {
+               #ifndef __ARM_FP
+               #error __ARM_FP not defined
+               #endif
+               #ifdef __ARM_NEON_FP
+               #error __ARM_NEON_FP defined
+               #endif
+           } "$flags" ] } {
+               set et_arm_vfp_flags $flags
+               return 1
+           }
+       }
     }
+    return 0
+}
+
+proc check_effective_target_arm_vfp_ok { } {
+    return [check_cached_effective_target arm_vfp_ok \
+               check_effective_target_arm_vfp_ok_nocache]
 }
 
 # Return 1 if this is an ARM target supporting -mfpu=vfp3
     }
 }
 
+# Return 1 if this is an ARM target defining __ARM_FP. We may need
+# -mfloat-abi=softfp or equivalent options.  Some multilibs may be
+# incompatible with these options.  Also set et_arm_fp_flags to the
+# best options to add.
+
+proc check_effective_target_arm_fp_ok_nocache { } {
+    global et_arm_fp_flags
+    set et_arm_fp_flags ""
+    if { [check_effective_target_arm32] } {
+       foreach flags {"" "-mfloat-abi=softfp" "-mfloat-abi=hard"} {
+           if { [check_no_compiler_messages_nocache arm_fp_ok object {
+               #ifndef __ARM_FP
+               #error __ARM_FP not defined
+               #endif
+           } "$flags"] } {
+               set et_arm_fp_flags $flags
+               return 1
+           }
+       }
+    }
+
+    return 0
+}
+
+proc check_effective_target_arm_fp_ok { } {
+    return [check_cached_effective_target arm_fp_ok \
+               check_effective_target_arm_fp_ok_nocache]
+}
+
+# Add the options needed to define __ARM_FP.  We need either
+# -mfloat-abi=softfp or -mfloat-abi=hard, but if one is already
+# specified by the multilib, use it.
+
+proc add_options_for_arm_fp { flags } {
+    if { ! [check_effective_target_arm_fp_ok] } {
+       return "$flags"
+    }
+    global et_arm_fp_flags
+    return "$flags $et_arm_fp_flags"
+}
+
 # Return 1 if this is an ARM target that supports DSP multiply with
 # current multilib flags.
 
 proc check_effective_target_arm_crypto_ok_nocache { } {
     global et_arm_crypto_flags
     set et_arm_crypto_flags ""
-    if { [check_effective_target_arm32] } {
+    if { [check_effective_target_arm_v8_neon_ok] } {
        foreach flags {"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
            if { [check_no_compiler_messages_nocache arm_crypto_ok object {
                #include "arm_neon.h"
                check_effective_target_arm_crypto_ok_nocache]
 }
 
+# Return 1 if this is an ARM target supporting pragma target
+# -mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp or equivalent options.
+# Some multilibs may be incompatible with these options.  Also set
+# et_arm_crypto_pragma_flags to the best options to add.
+
+proc check_effective_target_arm_crypto_pragma_ok_nocache { } {
+    global et_arm_crypto_pragma_flags
+    set et_arm_crypto_pragma_flags ""
+    if { [check_effective_target_arm_v8_neon_ok] } {
+       foreach flags {"" "-mfloat-abi=softfp" "-mfpu=crypto-neon-fp-armv8" "-mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp"} {
+           if { [check_no_compiler_messages_nocache arm_crypto_pragmaok object {
+               #pragma GCC target ("fpu=crypto-neon-fp-armv8")
+               #include "arm_neon.h"
+               uint8x16_t
+               foo (uint8x16_t a, uint8x16_t b)
+               {
+                 return vaeseq_u8 (a, b);
+               }
+           } "[add_options_for_arm_v8_neon ""] $flags"] } {
+               set et_arm_crypto_pragma_flags "[add_options_for_arm_v8_neon ""] $flags"
+               return 1
+           }
+       }
+    }
+
+    return 0
+}
+
+# Return 1 if this is an ARM target supporting pragma target
+# -mfpu=crypto-neon-fp-armv8.
+
+proc check_effective_target_arm_crypto_pragma_ok { } {
+    return [check_cached_effective_target arm_crypto_pragma_ok \
+               check_effective_target_arm_crypto_pragma_ok_nocache]
+}
+
+# Add the options needed for VFP.  We need either -mfloat-abi=softfp
+# or -mfloat-abi=hard, but if one is already specified by the
+# multilib, use it.
+
+proc add_options_for_arm_vfp { flags } {
+    if { ! [check_effective_target_arm_vfp_ok] } {
+       return "$flags"
+    }
+    global et_arm_vfp_flags
+    return "$flags $et_arm_vfp_flags"
+}
+
 # Add options for crypto extensions.
 proc add_options_for_arm_crypto { flags } {
     if { ! [check_effective_target_arm_crypto_ok] } {
 
 # Return 1 if this is an ARM target supporting -mfpu=neon-fp16
 # -mfloat-abi=softfp or equivalent options.  Some multilibs may be
-# incompatible with these options.  Also set et_arm_neon_flags to the
-# best options to add.
+# incompatible with these options.  Also set et_arm_neon_fp16_flags to
+# the best options to add.
 
 proc check_effective_target_arm_neon_fp16_ok_nocache { } {
     global et_arm_neon_fp16_flags