Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/_Float16_3.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -march=armv8.2-a+nofp16 -std=c11 -ffp-contract=fast" } */
3 /* { dg-skip-if "" { *-*-* } { "-mcpu=*" } { "" } } */
4
5 #pragma GCC target ("arch=armv8.2-a+nofp16")
6
7 _Float16
8 foo_v8 (_Float16 x, _Float16 y, unsigned int *eval)
9 {
10 *eval = __FLT_EVAL_METHOD__;
11 return x * x + y;
12 }
13
14 __fp16
15 bar_v8 (__fp16 x, __fp16 y, unsigned int *eval)
16 {
17 *eval = __FLT_EVAL_METHOD__;
18 return x * x + y;
19 }
20
21 #pragma GCC target ("arch=armv8.2-a+fp16")
22
23 _Float16
24 foo_v82 (_Float16 x, _Float16 y, unsigned int *eval)
25 {
26 *eval = __FLT_EVAL_METHOD__;
27 return x * x + y;
28 }
29
30 __fp16
31 bar_v82 (__fp16 x, __fp16 y, unsigned int *eval)
32 {
33 *eval = __FLT_EVAL_METHOD__;
34 return x * x + y;
35 }
36
37 /* Test that we merge to FMA operations. This indicates that we are not
38 making extraneous conversions between modes. */
39
40 /* Three FMA operations in 32-bit precision, from foo_v8, bar_v8, bar_v82. */
41 /* { dg-final { scan-assembler-times "fmadd\ts\[0-9\]\+" 3 } } */
42
43 /* One FMA operation in 16-bit precision, from foo_v82. */
44 /* { dg-final { scan-assembler-times "fmadd\th\[0-9\]\+" 1 } } */
45
46 /* Test that in C11 mode, we don't reset __FLT_EVAL_METHOD__. */
47 /* { dg-final { scan-assembler-times "str\twzr" 4 } } */