Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/acle/rng_1.c

raw
1 /* Test the __rndr ACLE intrinsic. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -march=armv8.5-a+rng" } */
4
5 #include <arm_acle.h>
6
7 #ifdef __ARM_FEATURE_RNG
8 /* Check that instruction is generated when status result is unused. */
9 uint64_t
10 test_rndr_no_stat (void)
11 {
12 uint64_t res;
13 __rndr (&res);
14 return res;
15 }
16
17 /* Check that instruction is generated when random number result
18 is unused. */
19 int
20 test_rndr_error_check (void)
21 {
22 uint64_t res;
23 int fail = __rndr (&res);
24 if (fail)
25 return 0;
26 return -1;
27 }
28
29 /* { dg-final { scan-assembler-times "mrs\tx..?, RNDR\n" 2 } } */
30
31 /* Check that instruction is generated when status result is unused. */
32 uint64_t
33 test_rndrrs_no_stat (void)
34 {
35 uint64_t res;
36 __rndrrs (&res);
37 return res;
38 }
39
40 /* Check that instruction is generated when random number result
41 is unused. */
42 int
43 test_rndrrs_error_check (void)
44 {
45 uint64_t res;
46 int fail = __rndrrs (&res);
47 if (fail)
48 return 0;
49 return -1;
50 }
51
52 /* { dg-final { scan-assembler-times "mrs\tx..?, RNDRRS\n" 2 } } */
53 #endif