xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/atomic-expr.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -verify -fsyntax-only
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc _Atomic(unsigned int) data1;
5*f4a2713aSLionel Sambuc int _Atomic data2;
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc // Shift operations
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc int func_01 (int x) {
10*f4a2713aSLionel Sambuc   return data1 << x;
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc int func_02 (int x) {
14*f4a2713aSLionel Sambuc   return x << data1;
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc int func_03 (int x) {
18*f4a2713aSLionel Sambuc   return data2 << x;
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc int func_04 (int x) {
22*f4a2713aSLionel Sambuc   return x << data2;
23*f4a2713aSLionel Sambuc }
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc int func_05 () {
26*f4a2713aSLionel Sambuc   return data2 << data1;
27*f4a2713aSLionel Sambuc }
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc int func_06 () {
30*f4a2713aSLionel Sambuc   return data1 << data2;
31*f4a2713aSLionel Sambuc }
32*f4a2713aSLionel Sambuc 
33*f4a2713aSLionel Sambuc void func_07 (int x) {
34*f4a2713aSLionel Sambuc   data1 <<= x;
35*f4a2713aSLionel Sambuc }
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc void func_08 (int x) {
38*f4a2713aSLionel Sambuc   data2 <<= x;
39*f4a2713aSLionel Sambuc }
40*f4a2713aSLionel Sambuc 
41*f4a2713aSLionel Sambuc void func_09 (int* xp) {
42*f4a2713aSLionel Sambuc   *xp <<= data1;
43*f4a2713aSLionel Sambuc }
44*f4a2713aSLionel Sambuc 
45*f4a2713aSLionel Sambuc void func_10 (int* xp) {
46*f4a2713aSLionel Sambuc   *xp <<= data2;
47*f4a2713aSLionel Sambuc }
48*f4a2713aSLionel Sambuc 
49*f4a2713aSLionel Sambuc int func_11 (int x) {
50*f4a2713aSLionel Sambuc   return data1 == x;
51*f4a2713aSLionel Sambuc }
52*f4a2713aSLionel Sambuc 
53*f4a2713aSLionel Sambuc int func_12 () {
54*f4a2713aSLionel Sambuc   return data1 < data2;
55*f4a2713aSLionel Sambuc }
56*f4a2713aSLionel Sambuc 
57*f4a2713aSLionel Sambuc int func_13 (int x, unsigned y) {
58*f4a2713aSLionel Sambuc   return x ? data1 : y;
59*f4a2713aSLionel Sambuc }
60*f4a2713aSLionel Sambuc 
61