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