Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/tbz_2.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-O2 -std=c99 -fno-unwind-tables -fno-asynchronous-unwind-tables" } */
3 /* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */
4
5 #include <stdbool.h>
6
7 void h(void);
8
9 /*
10 ** g1:
11 ** cbnz w0, .L[0-9]+
12 ** ret
13 ** ...
14 */
15 void g1(int x)
16 {
17 if (__builtin_expect (x, 0))
18 h ();
19 }
20
21 /*
22 ** g2:
23 ** tbnz [wx]0, 0, .L[0-9]+
24 ** ret
25 ** ...
26 */
27 void g2(int x)
28 {
29 if (__builtin_expect (x & 1, 0))
30 h ();
31 }
32
33 /*
34 ** g3:
35 ** tbnz [wx]0, 3, .L[0-9]+
36 ** ret
37 ** ...
38 */
39 void g3(int x)
40 {
41 if (__builtin_expect (x & 8, 0))
42 h ();
43 }
44
45 /*
46 ** g4:
47 ** tbnz [wx]0, #31, .L[0-9]+
48 ** ret
49 ** ...
50 */
51 void g4(int x)
52 {
53 if (__builtin_expect (x & (1 << 31), 0))
54 h ();
55 }
56
57 /*
58 ** g5:
59 ** tst [wx]0, 255
60 ** bne .L[0-9]+
61 ** ret
62 ** ...
63 */
64 void g5(char x)
65 {
66 if (__builtin_expect (x, 0))
67 h ();
68 }
69
70 /*
71 ** g6:
72 ** tbnz [wx]0, 0, .L[0-9]+
73 ** ret
74 ** ...
75 */
76 void g6(char x)
77 {
78 if (__builtin_expect (x & 1, 0))
79 h ();
80 }
81
82 /*
83 ** g7:
84 ** tst [wx]0, 3
85 ** bne .L[0-9]+
86 ** ret
87 ** ...
88 */
89 void g7(char x)
90 {
91 if (__builtin_expect (x & 3, 0))
92 h ();
93 }
94
95 /*
96 ** g8:
97 ** tbnz [wx]0, 7, .L[0-9]+
98 ** ret
99 ** ...
100 */
101 void g8(char x)
102 {
103 if (__builtin_expect (x & (1 << 7), 0))
104 h ();
105 }
106
107 /*
108 ** g9:
109 ** tbnz [wx]0, 0, .L[0-9]+
110 ** ret
111 ** ...
112 */
113 void g9(bool x)
114 {
115 if (__builtin_expect (x, 0))
116 h ();
117 }
118
119 /*
120 ** g10:
121 ** tbnz [wx]0, 0, .L[0-9]+
122 ** ret
123 ** ...
124 */
125 void g10(bool x)
126 {
127 if (__builtin_expect (x & 1, 0))
128 h ();
129 }
130