[ARM] Fix test armv8_2-fp16-move-1.c
[official-gcc.git] / gcc / testsuite / gcc.target / arm / armv8_2-fp16-conv-1.c
blobc9639a542ae3e5c145ab999a760eff78800358bc
1 /* { dg-do compile } */
2 /* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */
3 /* { dg-options "-O2" } */
4 /* { dg-add-options arm_v8_2a_fp16_scalar } */
6 /* Test ARMv8.2 FP16 conversions. */
7 #include <arm_fp16.h>
9 float
10 f16_to_f32 (__fp16 a)
12 return (float)a;
15 float
16 f16_to_pf32 (__fp16* a)
18 return (float)*a;
21 short
22 f16_to_s16 (__fp16 a)
24 return (short)a;
27 short
28 pf16_to_s16 (__fp16* a)
30 return (short)*a;
33 /* { dg-final { scan-assembler-times {vcvtb\.f32\.f16\ts[0-9]+, s[0-9]+} 4 } } */
35 __fp16
36 f32_to_f16 (float a)
38 return (__fp16)a;
41 void
42 f32_to_pf16 (__fp16* x, float a)
44 *x = (__fp16)a;
47 __fp16
48 s16_to_f16 (short a)
50 return (__fp16)a;
53 void
54 s16_to_pf16 (__fp16* x, short a)
56 *x = (__fp16)a;
59 /* { dg-final { scan-assembler-times {vcvtb\.f16\.f32\ts[0-9]+, s[0-9]+} 4 } } */
61 float
62 s16_to_f32 (short a)
64 return (float)a;
67 /* { dg-final { scan-assembler-times {vcvt\.f32\.s32\ts[0-9]+, s[0-9]+} 3 } } */
69 short
70 f32_to_s16 (float a)
72 return (short)a;
75 /* { dg-final { scan-assembler-times {vcvt\.s32\.f32\ts[0-9]+, s[0-9]+} 3 } } */
77 unsigned short
78 f32_to_u16 (float a)
80 return (unsigned short)a;
83 /* { dg-final { scan-assembler-times {vcvt\.u32\.f32\ts[0-9]+, s[0-9]+} 1 } } */
85 short
86 f64_to_s16 (double a)
88 return (short)a;
91 /* { dg-final { scan-assembler-times {vcvt\.s32\.f64\ts[0-9]+, d[0-9]+} 1 } } */
93 unsigned short
94 f64_to_u16 (double a)
96 return (unsigned short)a;
99 /* { dg-final { scan-assembler-times {vcvt\.s32\.f64\ts[0-9]+, d[0-9]+} 1 } } */