/* Check that calling a neon builtin from a function compiled with vfp fails. */
/* { dg-do compile } */
-/* { dg-require-effective-target arm_vfp_ok } */
+/* { dg-require-effective-target arm_neon_h_ok } */
/* { dg-options "-O2" } */
-/* { dg-add-options arm_vfp } */
+/* { dg-add-options arm_neon_h } */
extern __simd64_int8_t a, b;
*p = (__simd128_int16_t)__builtin_neon_vaddlsv8qi (a, b); /* { dg-error "You must enable NEON instructions .*" } */
}
-
proc check_effective_target_arm_libc_fp_abi_ok_nocache { } {
global et_arm_libc_fp_abi_flags
set et_arm_libc_fp_abi_flags ""
- if { [check_effective_target_arm32] } {
+ if { [istarget arm*-*-*] } {
foreach flags {"-mfloat-abi=hard" "-mfloat-abi=softfp"} {
if { [check_no_compiler_messages_nocache arm_libc_fp_abi_ok object {
#include <stdint.h>
return "$flags $et_arm_libc_fp_abi_flags"
}
+# Try to find the minimal set of flags needed to make the header file
+# arm_neon.h compatible with this compilation. This is complicated due
+# to the fact that this header doesn't work properly on m-profile cores
+# and also won't work correctly if the wrong floating-point ABI is used
+# on the platform (since arm_neon.h can include stdint.h, which on Linux
+# will pull in stub headers that aren't installed).
+# Note: This will not necessarily enable Neon instructions, just provide
+# something where the header will not cause errors.
+
+proc check_effective_target_arm_neon_h_ok_nocache { } {
+ # none-arm or thumb1 cannot support neon, so there's no point in
+ # looking further.
+ if { [istarget arm*-*-*] } {
+ global et_arm_neon_h_flags
+ set base_flags [add_options_for_arm_libc_fp_abi ""]
+ foreach flags {"" "-mfpu=auto" "-marm" "-marm -mfpu=auto" \
+ "-mcpu=unset -march=armv7-a+fp -mfpu=auto" } {
+ if { [check_no_compiler_messages_nocache arm_neon_h_ok assembly {
+ #if __ARM_ARCH < 5
+ #error architecture too low for FP
+ #endif
+ #if __ARM_ARCH < 7
+ #if !defined(__arm__) || (defined(__thumb__) && !defined(__thumb2__))
+ #error incompatible arch or mode
+ #endif
+ #endif
+ #if __ARM_ARCH_PROFILE == 'M'
+ #error incompatible profile
+ #endif
+ } "$base_flags $flags" ] } {
+ set et_arm_neon_h_flags "$base_flags $flags"
+ return 1
+ }
+ }
+ }
+ return 0
+}
+
+proc check_effective_target_arm_neon_h_ok { } {
+ return [check_cached_effective_target arm_neon_h_ok \
+ check_effective_target_arm_neon_h_ok_nocache]
+}
+
+proc add_options_for_arm_neon_h { flags } {
+ if { ! [check_effective_target_arm_neon_h_ok] } {
+ return "$flags"
+ }
+ global et_arm_neon_h_flags
+ return "$flags $et_arm_neon_h_flags"
+}
+
# Return 1 if this is an ARM target defining __ARM_FP with
# double-precision support. We may need -mfloat-abi=softfp or
# equivalent options. Some multilibs may be incompatible with these