From: Kyrylo Tkachov Date: Thu, 4 Apr 2013 16:17:32 +0000 (+0000) Subject: target-supports.exp (check_effective_target_arm_v8_neon_hw): New procedure. X-Git-Tag: releases/gcc-4.9.0~6664 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=398f9f35d480081ddbd979e431560b2f93b333f3;p=thirdparty%2Fgcc.git target-supports.exp (check_effective_target_arm_v8_neon_hw): New procedure. 2013-04-04 Kyrylo Tkachov * lib/target-supports.exp (check_effective_target_arm_v8_neon_hw): New procedure. (check_effective_target_arm_v8_neon_ok_nocache): Likewise. (check_effective_target_arm_v8_neon_ok): Change to use check_effective_target_arm_v8_neon_ok_nocache. (add_options_for_arm_v8_neon): Use et_arm_v8_neon_flags to set ARMv8 NEON flags. (check_effective_target_vect_call_btruncf): Enable for arm and ARMv8 NEON. (check_effective_target_vect_call_ceilf): Likewise. (check_effective_target_vect_call_floorf): Likewise. (check_effective_target_vect_call_roundf): Likewise. (check_vect_support_and_set_flags): Handle ARMv8 NEON effective target. From-SVN: r197491 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2ca50b4729f..56f1044f8055 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2013-04-04 Kyrylo Tkachov + + * lib/target-supports.exp (check_effective_target_arm_v8_neon_hw): + New procedure. + (check_effective_target_arm_v8_neon_ok_nocache): + Likewise. + (check_effective_target_arm_v8_neon_ok): Change to use + check_effective_target_arm_v8_neon_ok_nocache. + (add_options_for_arm_v8_neon): Use et_arm_v8_neon_flags to set ARMv8 + NEON flags. + (check_effective_target_vect_call_btruncf): + Enable for arm and ARMv8 NEON. + (check_effective_target_vect_call_ceilf): Likewise. + (check_effective_target_vect_call_floorf): Likewise. + (check_effective_target_vect_call_roundf): Likewise. + (check_vect_support_and_set_flags): Handle ARMv8 NEON effective + target. + 2013-04-04 Marek Polacek PR tree-optimization/48186 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a146f1732c9c..268fddb39661 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2147,22 +2147,6 @@ proc check_effective_target_arm_v8_vfp_ok {} { } } -# 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. @@ -2226,7 +2210,8 @@ 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" + global et_arm_v8_neon_flags + return "$flags $et_arm_v8_neon_flags" } # Add the options needed for NEON. We need either -mfloat-abi=softfp @@ -2270,6 +2255,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-fp-armv8 +# -mfloat-abi=softfp or equivalent options. Some multilibs may be +# incompatible with these options. Also set et_arm_v8_neon_flags to the +# best options to add. + +proc check_effective_target_arm_v8_neon_ok_nocache { } { + global et_arm_v8_neon_flags + set et_arm_v8_neon_flags "" + if { [check_effective_target_arm32] } { + foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} { + if { [check_no_compiler_messages_nocache arm_v8_neon_ok object { + #include "arm_neon.h" + void + foo () + { + __asm__ volatile ("vrintn.f32 q0, q0"); + } + } "$flags"] } { + set et_arm_v8_neon_flags $flags + return 1 + } + } + } + + return 0 +} + +proc check_effective_target_arm_v8_neon_ok { } { + return [check_cached_effective_target arm_v8_neon_ok \ + check_effective_target_arm_v8_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 @@ -2509,6 +2526,24 @@ proc check_effective_target_arm_neonv2_hw { } { } [add_options_for_arm_neonv2 ""]] } +# Return 1 if the target supports executing ARMv8 NEON instructions, 0 +# otherwise. + +proc check_effective_target_arm_v8_neon_hw { } { + return [check_runtime arm_v8_neon_hw_available { + #include "arm_neon.h" + int + main (void) + { + float32x2_t a; + asm ("vrinta.f32 %P0, %P1" + : "=w" (a) + : "0" (a)); + return 0; + } + } [add_options_for_arm_v8_neon ""]] +} + # Return 1 if this is a ARM target with NEON enabled. proc check_effective_target_arm_neon { } { @@ -4047,7 +4082,9 @@ proc check_effective_target_vect_call_btruncf { } { verbose "check_effective_target_vect_call_btruncf: using cached result" 2 } else { set et_vect_call_btruncf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_btruncf_saved 1 } } @@ -4083,7 +4120,9 @@ proc check_effective_target_vect_call_ceilf { } { verbose "check_effective_target_vect_call_ceilf: using cached result" 2 } else { set et_vect_call_ceilf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_ceilf_saved 1 } } @@ -4119,7 +4158,9 @@ proc check_effective_target_vect_call_floorf { } { verbose "check_effective_target_vect_call_floorf: using cached result" 2 } else { set et_vect_call_floorf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_floorf_saved 1 } } @@ -4227,7 +4268,9 @@ proc check_effective_target_vect_call_roundf { } { verbose "check_effective_target_vect_call_roundf: using cached result" 2 } else { set et_vect_call_roundf_saved 0 - if { [istarget aarch64*-*-*] } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_v8_neon_ok]) } { set et_vect_call_roundf_saved 1 } } @@ -5129,6 +5172,14 @@ proc check_vect_support_and_set_flags { } { } } elseif [istarget ia64-*-*] { set dg-do-what-default run + } elseif [is-effective-target arm_v8_neon_ok] { + eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_v8_neon ""] + lappend DEFAULT_VECTCFLAGS "-ffast-math" + if [is-effective-target arm_v8_neon_hw] { + set dg-do-what-default run + } else { + set dg-do-what-default compile + } } elseif [is-effective-target arm_neon_ok] { eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""] # NEON does not support denormals, so is not used for vectorization by