Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr98737-3.c

raw
1 /* PR target/98737 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -masm=att" } */
4 /* { dg-additional-options "-march=i686" { target ia32 } } */
5 /* { dg-final { scan-assembler "lock\[^\n\r]\*addq\t" { target lp64 } } } */
6 /* { dg-final { scan-assembler "lock\[^\n\r]\*addl\t" } } */
7 /* { dg-final { scan-assembler "lock\[^\n\r]\*addw\t" } } */
8 /* { dg-final { scan-assembler "lock\[^\n\r]\*addb\t" } } */
9 /* { dg-final { scan-assembler-not "lock\[^\n\r]\*xadd" } } */
10 /* { dg-final { scan-assembler-not "lock\[^\n\r]\*cmpxchg" } } */
11
12 long a;
13 int b;
14 short c;
15 char d;
16
17 int
18 f1 (long x)
19 {
20 return __atomic_add_fetch (&a, x, __ATOMIC_RELEASE) == 0;
21 }
22
23 int
24 f2 (int x)
25 {
26 return __atomic_add_fetch (&b, x, __ATOMIC_RELEASE) == 0;
27 }
28
29 int
30 f3 (short x)
31 {
32 return __atomic_add_fetch (&c, x, __ATOMIC_RELEASE) == 0;
33 }
34
35 int
36 f4 (char x)
37 {
38 return __atomic_add_fetch (&d, x, __ATOMIC_RELEASE) == 0;
39 }
40
41 int
42 f5 (long x)
43 {
44 return __atomic_add_fetch (&a, x, __ATOMIC_RELEASE) != 0;
45 }
46
47 int
48 f6 (int x)
49 {
50 return __atomic_add_fetch (&b, x, __ATOMIC_RELEASE) != 0;
51 }
52
53 int
54 f7 (short x)
55 {
56 return __atomic_add_fetch (&c, x, __ATOMIC_RELEASE) != 0;
57 }
58
59 int
60 f8 (char x)
61 {
62 return __atomic_add_fetch (&d, x, __ATOMIC_RELEASE) != 0;
63 }
64
65 int
66 f9 (long x)
67 {
68 return __atomic_add_fetch (&a, x, __ATOMIC_RELEASE) < 0;
69 }
70
71 int
72 f10 (int x)
73 {
74 return __atomic_add_fetch (&b, x, __ATOMIC_RELEASE) < 0;
75 }
76
77 int
78 f11 (short x)
79 {
80 return __atomic_add_fetch (&c, x, __ATOMIC_RELEASE) < 0;
81 }
82
83 int
84 f12 (char x)
85 {
86 return __atomic_add_fetch (&d, x, __ATOMIC_RELEASE) < 0;
87 }
88
89 int
90 f13 (long x)
91 {
92 return __atomic_add_fetch (&a, x, __ATOMIC_RELEASE) >= 0;
93 }
94
95 int
96 f14 (int x)
97 {
98 return __atomic_add_fetch (&b, x, __ATOMIC_RELEASE) >= 0;
99 }
100
101 int
102 f15 (short x)
103 {
104 return __atomic_add_fetch (&c, x, __ATOMIC_RELEASE) >= 0;
105 }
106
107 int
108 f16 (char x)
109 {
110 return __atomic_add_fetch (&d, x, __ATOMIC_RELEASE) >= 0;
111 }
112
113 int
114 f17 (long x)
115 {
116 return __sync_add_and_fetch (&a, x) == 0;
117 }
118
119 int
120 f18 (int x)
121 {
122 return __sync_add_and_fetch (&b, x) == 0;
123 }
124
125 int
126 f19 (short x)
127 {
128 return __sync_add_and_fetch (&c, x) == 0;
129 }
130
131 int
132 f20 (char x)
133 {
134 return __sync_add_and_fetch (&d, x) == 0;
135 }
136
137 int
138 f21 (long x)
139 {
140 return __sync_add_and_fetch (&a, x) != 0;
141 }
142
143 int
144 f22 (int x)
145 {
146 return __sync_add_and_fetch (&b, x) != 0;
147 }
148
149 int
150 f23 (short x)
151 {
152 return __sync_add_and_fetch (&c, x) != 0;
153 }
154
155 int
156 f24 (char x)
157 {
158 return __sync_add_and_fetch (&d, x) != 0;
159 }
160
161 int
162 f25 (long x)
163 {
164 return __sync_add_and_fetch (&a, x) < 0;
165 }
166
167 int
168 f26 (int x)
169 {
170 return __sync_add_and_fetch (&b, x) < 0;
171 }
172
173 int
174 f27 (short x)
175 {
176 return __sync_add_and_fetch (&c, x) < 0;
177 }
178
179 int
180 f28 (char x)
181 {
182 return __sync_add_and_fetch (&d, x) < 0;
183 }
184
185 int
186 f29 (long x)
187 {
188 return __sync_add_and_fetch (&a, x) >= 0;
189 }
190
191 int
192 f30 (int x)
193 {
194 return __sync_add_and_fetch (&b, x) >= 0;
195 }
196
197 int
198 f31 (short x)
199 {
200 return __sync_add_and_fetch (&c, x) >= 0;
201 }
202
203 int
204 f32 (char x)
205 {
206 return __sync_add_and_fetch (&d, x) >= 0;
207 }