diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c')
-rw-r--r-- | gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c b/gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c new file mode 100644 index 00000000000..5011315961c --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/attr-fp16-arith-1.c @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_v8_2a_fp16_scalar } */ + +/* Reset fpu to a value compatible with the next pragmas. */ +#pragma GCC target ("fpu=vfp") + +#pragma GCC push_options +#pragma GCC target ("fpu=fp-armv8") + +#ifndef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC +#error __ARM_FEATURE_FP16_SCALAR_ARITHMETIC not defined. +#endif + +#pragma GCC push_options +#pragma GCC target ("fpu=neon-fp-armv8") + +#ifndef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC +#error __ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined. +#endif + +#ifndef __ARM_NEON +#error __ARM_NEON not defined. +#endif + +#if !defined (__ARM_FP) || !(__ARM_FP & 0x2) +#error Invalid value for __ARM_FP +#endif + +#pragma GCC pop_options + +/* Check that the FP version is correctly reset to mfpu=fp-armv8. */ + +#if !defined (__ARM_FP) || !(__ARM_FP & 0x2) +#error __ARM_FP should record FP16 support. +#endif + +#pragma GCC pop_options + +/* Check that the FP version is correctly reset to mfpu=vfp. */ + +#if !defined (__ARM_FP) || (__ARM_FP & 0x2) +#error Unexpected value for __ARM_FP. +#endif |