OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [sync-2.c] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Validate that each of the __sync builtins compiles.  This won't
2
   necessarily link, since the target might not support the builtin,
3
   so this may result in external library calls.  */
4
 
5
signed char sc;
6
unsigned char uc;
7
signed short ss;
8
unsigned short us;
9
signed int si;
10
unsigned int ui;
11
signed long sl;
12
unsigned long ul;
13
signed long long sll;
14
unsigned long long ull;
15
 
16
void test_op_ignore (void)
17
{
18
  (void) __sync_fetch_and_add (&sc, -1);
19
  (void) __sync_fetch_and_add (&uc, -1);
20
  (void) __sync_fetch_and_add (&ss, -1);
21
  (void) __sync_fetch_and_add (&us, -1);
22
  (void) __sync_fetch_and_add (&si, -1);
23
  (void) __sync_fetch_and_add (&ui, -1);
24
  (void) __sync_fetch_and_add (&sl, -1);
25
  (void) __sync_fetch_and_add (&ul, -1);
26
  (void) __sync_fetch_and_add (&sll, -1);
27
  (void) __sync_fetch_and_add (&ull, -1);
28
 
29
  (void) __sync_fetch_and_sub (&sc, -1);
30
  (void) __sync_fetch_and_sub (&uc, -1);
31
  (void) __sync_fetch_and_sub (&ss, -1);
32
  (void) __sync_fetch_and_sub (&us, -1);
33
  (void) __sync_fetch_and_sub (&si, -1);
34
  (void) __sync_fetch_and_sub (&ui, -1);
35
  (void) __sync_fetch_and_sub (&sl, -1);
36
  (void) __sync_fetch_and_sub (&ul, -1);
37
  (void) __sync_fetch_and_sub (&sll, -1);
38
  (void) __sync_fetch_and_sub (&ull, -1);
39
 
40
  (void) __sync_fetch_and_or (&sc, -1);
41
  (void) __sync_fetch_and_or (&uc, -1);
42
  (void) __sync_fetch_and_or (&ss, -1);
43
  (void) __sync_fetch_and_or (&us, -1);
44
  (void) __sync_fetch_and_or (&si, -1);
45
  (void) __sync_fetch_and_or (&ui, -1);
46
  (void) __sync_fetch_and_or (&sl, -1);
47
  (void) __sync_fetch_and_or (&ul, -1);
48
  (void) __sync_fetch_and_or (&sll, -1);
49
  (void) __sync_fetch_and_or (&ull, -1);
50
 
51
  (void) __sync_fetch_and_xor (&sc, -1);
52
  (void) __sync_fetch_and_xor (&uc, -1);
53
  (void) __sync_fetch_and_xor (&ss, -1);
54
  (void) __sync_fetch_and_xor (&us, -1);
55
  (void) __sync_fetch_and_xor (&si, -1);
56
  (void) __sync_fetch_and_xor (&ui, -1);
57
  (void) __sync_fetch_and_xor (&sl, -1);
58
  (void) __sync_fetch_and_xor (&ul, -1);
59
  (void) __sync_fetch_and_xor (&sll, -1);
60
  (void) __sync_fetch_and_xor (&ull, -1);
61
 
62
  (void) __sync_fetch_and_and (&sc, -1);
63
  (void) __sync_fetch_and_and (&uc, -1);
64
  (void) __sync_fetch_and_and (&ss, -1);
65
  (void) __sync_fetch_and_and (&us, -1);
66
  (void) __sync_fetch_and_and (&si, -1);
67
  (void) __sync_fetch_and_and (&ui, -1);
68
  (void) __sync_fetch_and_and (&sl, -1);
69
  (void) __sync_fetch_and_and (&ul, -1);
70
  (void) __sync_fetch_and_and (&sll, -1);
71
  (void) __sync_fetch_and_and (&ull, -1);
72
 
73
  (void) __sync_fetch_and_nand (&sc, -1);
74
  (void) __sync_fetch_and_nand (&uc, -1);
75
  (void) __sync_fetch_and_nand (&ss, -1);
76
  (void) __sync_fetch_and_nand (&us, -1);
77
  (void) __sync_fetch_and_nand (&si, -1);
78
  (void) __sync_fetch_and_nand (&ui, -1);
79
  (void) __sync_fetch_and_nand (&sl, -1);
80
  (void) __sync_fetch_and_nand (&ul, -1);
81
  (void) __sync_fetch_and_nand (&sll, -1);
82
  (void) __sync_fetch_and_nand (&ull, -1);
83
}
84
 
85
void test_fetch_and_op (void)
86
{
87
  sc = __sync_fetch_and_add (&sc, -11);
88
  uc = __sync_fetch_and_add (&uc, -11);
89
  ss = __sync_fetch_and_add (&ss, -11);
90
  us = __sync_fetch_and_add (&us, -11);
91
  si = __sync_fetch_and_add (&si, -11);
92
  ui = __sync_fetch_and_add (&ui, -11);
93
  sl = __sync_fetch_and_add (&sl, -11);
94
  ul = __sync_fetch_and_add (&ul, -11);
95
  sll = __sync_fetch_and_add (&sll, -11);
96
  ull = __sync_fetch_and_add (&ull, -11);
97
 
98
  sc = __sync_fetch_and_sub (&sc, -11);
99
  uc = __sync_fetch_and_sub (&uc, -11);
100
  ss = __sync_fetch_and_sub (&ss, -11);
101
  us = __sync_fetch_and_sub (&us, -11);
102
  si = __sync_fetch_and_sub (&si, -11);
103
  ui = __sync_fetch_and_sub (&ui, -11);
104
  sl = __sync_fetch_and_sub (&sl, -11);
105
  ul = __sync_fetch_and_sub (&ul, -11);
106
  sll = __sync_fetch_and_sub (&sll, -11);
107
  ull = __sync_fetch_and_sub (&ull, -11);
108
 
109
  sc = __sync_fetch_and_or (&sc, -11);
110
  uc = __sync_fetch_and_or (&uc, -11);
111
  ss = __sync_fetch_and_or (&ss, -11);
112
  us = __sync_fetch_and_or (&us, -11);
113
  si = __sync_fetch_and_or (&si, -11);
114
  ui = __sync_fetch_and_or (&ui, -11);
115
  sl = __sync_fetch_and_or (&sl, -11);
116
  ul = __sync_fetch_and_or (&ul, -11);
117
  sll = __sync_fetch_and_or (&sll, -11);
118
  ull = __sync_fetch_and_or (&ull, -11);
119
 
120
  sc = __sync_fetch_and_xor (&sc, -11);
121
  uc = __sync_fetch_and_xor (&uc, -11);
122
  ss = __sync_fetch_and_xor (&ss, -11);
123
  us = __sync_fetch_and_xor (&us, -11);
124
  si = __sync_fetch_and_xor (&si, -11);
125
  ui = __sync_fetch_and_xor (&ui, -11);
126
  sl = __sync_fetch_and_xor (&sl, -11);
127
  ul = __sync_fetch_and_xor (&ul, -11);
128
  sll = __sync_fetch_and_xor (&sll, -11);
129
  ull = __sync_fetch_and_xor (&ull, -11);
130
 
131
  sc = __sync_fetch_and_and (&sc, -11);
132
  uc = __sync_fetch_and_and (&uc, -11);
133
  ss = __sync_fetch_and_and (&ss, -11);
134
  us = __sync_fetch_and_and (&us, -11);
135
  si = __sync_fetch_and_and (&si, -11);
136
  ui = __sync_fetch_and_and (&ui, -11);
137
  sl = __sync_fetch_and_and (&sl, -11);
138
  ul = __sync_fetch_and_and (&ul, -11);
139
  sll = __sync_fetch_and_and (&sll, -11);
140
  ull = __sync_fetch_and_and (&ull, -11);
141
 
142
  sc = __sync_fetch_and_nand (&sc, -11);
143
  uc = __sync_fetch_and_nand (&uc, -11);
144
  ss = __sync_fetch_and_nand (&ss, -11);
145
  us = __sync_fetch_and_nand (&us, -11);
146
  si = __sync_fetch_and_nand (&si, -11);
147
  ui = __sync_fetch_and_nand (&ui, -11);
148
  sl = __sync_fetch_and_nand (&sl, -11);
149
  ul = __sync_fetch_and_nand (&ul, -11);
150
  sll = __sync_fetch_and_nand (&sll, -11);
151
  ull = __sync_fetch_and_nand (&ull, -11);
152
}
153
 
154
void test_lock (void)
155
{
156
  sc = __sync_lock_test_and_set (&sc, -1);
157
  uc = __sync_lock_test_and_set (&uc, -1);
158
  ss = __sync_lock_test_and_set (&ss, -1);
159
  us = __sync_lock_test_and_set (&us, -1);
160
  si = __sync_lock_test_and_set (&si, -1);
161
  ui = __sync_lock_test_and_set (&ui, -1);
162
  sl = __sync_lock_test_and_set (&sl, -1);
163
  ul = __sync_lock_test_and_set (&ul, -1);
164
  sll = __sync_lock_test_and_set (&sll, -1);
165
  ull = __sync_lock_test_and_set (&ull, -1);
166
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.