1 /* { dg-do compile } */
2 /* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */
3 /* { dg-options "-O2" } */
4 /* { dg-add-options arm_v8_2a_fp16_scalar } */
6 /* Reset fpu to a value compatible with the next pragmas. */
7 #pragma GCC target ("fpu=vfp")
9 #pragma GCC push_options
10 #pragma GCC target ("fpu=fp-armv8")
12 #ifndef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
13 #error __ARM_FEATURE_FP16_SCALAR_ARITHMETIC not defined.
16 #pragma GCC push_options
17 #pragma GCC target ("fpu=neon-fp-armv8")
19 #ifndef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
20 #error __ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined.
24 #error __ARM_NEON not defined.
27 #if !defined (__ARM_FP) || !(__ARM_FP & 0x2)
28 #error Invalid value for __ARM_FP
36 float16x4_t a
= {2.0, 3.0, 4.0, 5.0};
37 float16x4_t res
= vadd_f16 (a
, b
);
42 /* { dg-final { scan-assembler "vadd\\.f16\td\[0-9\]+, d\[0-9\]+" } } */
44 #pragma GCC pop_options
46 /* Check that the FP version is correctly reset to mfpu=fp-armv8. */
48 #if !defined (__ARM_FP) || !(__ARM_FP & 0x2)
49 #error __ARM_FP should record FP16 support.
52 #pragma GCC pop_options
54 /* Check that the FP version is correctly reset to mfpu=vfp. */
56 #if !defined (__ARM_FP) || (__ARM_FP & 0x2)
57 #error Unexpected value for __ARM_FP.