diff mbox

[AArch64] Error out of arm_neon.h if nofp/nosimd

Message ID 54B64816.9030705@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Jan. 14, 2015, 10:42 a.m. UTC
Hi all,

In the arm version of arm_neon.h we error out early if the user tries to 
use that header without NEON.
In aarch64 AdvancedSIMD is available by default unless the user 
explicitly disables it.
Still it would be more helpful if we could just error out gracefully 
instead of dumping a long stream of type errors and other black magic in 
case the user disables AdvancedSIMD explicitly.
So, similar to arm_neon.h in the arm port we error out in aarch64 as well.

Checked that all arm_neon.h-related tests work as before.

Ok for trunk?

Thanks,
Kyrill

2015-01-14  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/aarch64/arm_neon.h: Error out if NEON is not available.

2015-01-14  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/aarch64/arm_neon-nosimd-error.c: New test.

Comments

Richard Earnshaw Jan. 14, 2015, 11:18 a.m. UTC | #1
On 14/01/15 10:42, Kyrill Tkachov wrote:
> Hi all,
> 
> In the arm version of arm_neon.h we error out early if the user tries to 
> use that header without NEON.
> In aarch64 AdvancedSIMD is available by default unless the user 
> explicitly disables it.
> Still it would be more helpful if we could just error out gracefully 
> instead of dumping a long stream of type errors and other black magic in 
> case the user disables AdvancedSIMD explicitly.
> So, similar to arm_neon.h in the arm port we error out in aarch64 as well.
> 
> Checked that all arm_neon.h-related tests work as before.
> 
> Ok for trunk?
> 
> Thanks,
> Kyrill
> 
> 2015-01-14  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>      * config/aarch64/arm_neon.h: Error out if NEON is not available.
> 
> 2015-01-14  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>      * gcc.target/aarch64/arm_neon-nosimd-error.c: New test.
> 

OK>

R.

> 
> aarch64-neon-error.patch
> 
> 
> commit 3c3d56e01ec55f8387bf447e57cdc7f94b0e119b
> Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
> Date:   Thu Dec 11 15:09:56 2014 +0000
> 
>     [AArch64] Error out of arm_neon.h if nofp/nosimd
> 
> diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
> index 319cd8c..22dfb0b 100644
> --- a/gcc/config/aarch64/arm_neon.h
> +++ b/gcc/config/aarch64/arm_neon.h
> @@ -27,6 +27,10 @@
>  #ifndef _AARCH64_NEON_H_
>  #define _AARCH64_NEON_H_
>  
> +#ifndef __ARM_NEON
> +#error You must enable AdvancedSIMD instructions to use arm_neon.h
> +#else
> +
>  #include <stdint.h>
>  
>  #define __AARCH64_UINT64_C(__C) ((uint64_t) __C)
> @@ -25209,3 +25213,5 @@ __INTERLEAVE_LIST (zip)
>  #undef __aarch64_vdupq_laneq_u64
>  
>  #endif
> +
> +#endif
> diff --git a/gcc/testsuite/gcc.target/aarch64/arm_neon-nosimd-error.c b/gcc/testsuite/gcc.target/aarch64/arm_neon-nosimd-error.c
> new file mode 100644
> index 0000000..6c508ec
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/arm_neon-nosimd-error.c
> @@ -0,0 +1,11 @@
> +/* { dg-do compile } */
> +/* { dg-options "-mgeneral-regs-only" } */
> +/* { dg-excess-errors "You must enable" } */
> +
> +#include "arm_neon.h"
> +
> +int
> +foo ()
> +{
> +  return 0;
> +}
>
diff mbox

Patch

commit 3c3d56e01ec55f8387bf447e57cdc7f94b0e119b
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Thu Dec 11 15:09:56 2014 +0000

    [AArch64] Error out of arm_neon.h if nofp/nosimd

diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 319cd8c..22dfb0b 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -27,6 +27,10 @@ 
 #ifndef _AARCH64_NEON_H_
 #define _AARCH64_NEON_H_
 
+#ifndef __ARM_NEON
+#error You must enable AdvancedSIMD instructions to use arm_neon.h
+#else
+
 #include <stdint.h>
 
 #define __AARCH64_UINT64_C(__C) ((uint64_t) __C)
@@ -25209,3 +25213,5 @@  __INTERLEAVE_LIST (zip)
 #undef __aarch64_vdupq_laneq_u64
 
 #endif
+
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/arm_neon-nosimd-error.c b/gcc/testsuite/gcc.target/aarch64/arm_neon-nosimd-error.c
new file mode 100644
index 0000000..6c508ec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/arm_neon-nosimd-error.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mgeneral-regs-only" } */
+/* { dg-excess-errors "You must enable" } */
+
+#include "arm_neon.h"
+
+int
+foo ()
+{
+  return 0;
+}