Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/acle/fp8-helpers-neon.c

raw
1 /* Test the fp8 ACLE helper functions including that they are available.
2 unconditionally when including arm_neon.h */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c90 -pedantic-errors -O1 -march=armv8-a" } */
5
6 #include <arm_neon.h>
7
8 void
9 test_prepare_fpmr_sysreg ()
10 {
11
12 #define _S_EQ(expr, expected) \
13 _Static_assert (expr == expected, #expr " == " #expected)
14
15 _S_EQ (__arm_fpm_init (), 0);
16
17 /* Bits [2:0] */
18 _S_EQ (__arm_set_fpm_src1_format (__arm_fpm_init (), __ARM_FPM_E5M2), 0);
19 _S_EQ (__arm_set_fpm_src1_format (__arm_fpm_init (), __ARM_FPM_E4M3), 0x1);
20
21 /* Bits [5:3] */
22 _S_EQ (__arm_set_fpm_src2_format (__arm_fpm_init (), __ARM_FPM_E5M2), 0);
23 _S_EQ (__arm_set_fpm_src2_format (__arm_fpm_init (), __ARM_FPM_E4M3), 0x8);
24
25 /* Bits [8:6] */
26 _S_EQ (__arm_set_fpm_dst_format (__arm_fpm_init (), __ARM_FPM_E5M2), 0);
27 _S_EQ (__arm_set_fpm_dst_format (__arm_fpm_init (), __ARM_FPM_E4M3), 0x40);
28
29 /* Bit 14 */
30 _S_EQ (__arm_set_fpm_overflow_mul (__arm_fpm_init (), __ARM_FPM_INFNAN), 0);
31 _S_EQ (__arm_set_fpm_overflow_mul (__arm_fpm_init (), __ARM_FPM_SATURATE),
32 0x4000);
33
34 /* Bit 15 */
35 _S_EQ (__arm_set_fpm_overflow_cvt (__arm_fpm_init (), __ARM_FPM_INFNAN), 0);
36 _S_EQ (__arm_set_fpm_overflow_cvt (__arm_fpm_init (), __ARM_FPM_SATURATE),
37 0x8000);
38
39 /* Bits [22:16] */
40 _S_EQ (__arm_set_fpm_lscale (__arm_fpm_init (), 0), 0);
41 _S_EQ (__arm_set_fpm_lscale (__arm_fpm_init (), 127), 0x7F0000);
42
43 /* Bits [37:32] */
44 _S_EQ (__arm_set_fpm_lscale2 (__arm_fpm_init (), 0), 0);
45 _S_EQ (__arm_set_fpm_lscale2 (__arm_fpm_init (), 63), 0x3F00000000);
46
47 /* Bits [31:24] */
48 _S_EQ (__arm_set_fpm_nscale (__arm_fpm_init (), 0), 0);
49 _S_EQ (__arm_set_fpm_nscale (__arm_fpm_init (), 127), 0x7F000000);
50 _S_EQ (__arm_set_fpm_nscale (__arm_fpm_init (), -128), 0x80000000);
51
52 #undef _S_EQ
53 }