Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/chkfeat-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mbranch-protection=none" } */
3 /* { dg-final { check-function-bodies "**" "" "" } } */
4
5 /*
6 **foo1:
7 ** mov x16, 1
8 ** hint 40 // chkfeat x16
9 ** mov x0, x16
10 ** ret
11 */
12 unsigned long long
13 foo1 (void)
14 {
15 return __builtin_aarch64_chkfeat (1);
16 }
17
18 /*
19 **foo2:
20 ** mov x16, 1
21 ** movk x16, 0x5678, lsl 32
22 ** movk x16, 0x1234, lsl 48
23 ** hint 40 // chkfeat x16
24 ** mov x0, x16
25 ** ret
26 */
27 unsigned long long
28 foo2 (void)
29 {
30 return __builtin_aarch64_chkfeat (0x1234567800000001);
31 }
32
33 /*
34 **foo3:
35 ** mov x16, x0
36 ** hint 40 // chkfeat x16
37 ** mov x0, x16
38 ** ret
39 */
40 unsigned long long
41 foo3 (unsigned long long x)
42 {
43 return __builtin_aarch64_chkfeat (x);
44 }
45
46 /*
47 **foo4:
48 ** ldr x16, \[x0\]
49 ** hint 40 // chkfeat x16
50 ** str x16, \[x0\]
51 ** ret
52 */
53 void
54 foo4 (unsigned long long *p)
55 {
56 *p = __builtin_aarch64_chkfeat (*p);
57 }
58
59 /*
60 **foo5:
61 ** mov x16, 1
62 ** hint 40 // chkfeat x16
63 ** cmp x16, 0
64 **(
65 ** csel w0, w1, w0, eq
66 **|
67 ** csel w0, w0, w1, ne
68 **)
69 ** ret
70 */
71 int
72 foo5 (int x, int y)
73 {
74 return __builtin_aarch64_chkfeat (1) ? x : y;
75 }