summaryrefslogtreecommitdiff
path: root/tests/list_atomic.template
blob: dbdc231cf0d964abb64f743374227d0d97f98361 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 * Copyright (c) 2003 by Hewlett-Packard Company.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/* This generates a compilable program.  But it is really meant to be   */
/* be used only with cc -E, to inspect the expensions generated by      */
/* primitives.                                                          */

/* The result will not link or run.                                     */

#include <stdlib.h> /* for exit() */

void XSIZE_list_atomicXX(void)
{
# if defined(AO_HAVE_XSIZE_loadXX) || defined(AO_HAVE_XSIZE_storeXX) \
     || defined(AO_HAVE_XSIZE_fetch_and_addXX) \
     || defined(AO_HAVE_XSIZE_fetch_and_add1XX) \
     || defined(AO_HAVE_XSIZE_andXX) \
     || defined(AO_HAVE_XSIZE_compare_and_swapXX) \
     || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX)
    static volatile XCTYPE val /* = 0 */;
# endif
# if defined(AO_HAVE_XSIZE_compare_and_swapXX) \
     || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX)
    static XCTYPE oldval /* = 0 */;
# endif
# if defined(AO_HAVE_XSIZE_storeXX) \
     || defined(AO_HAVE_XSIZE_compare_and_swapXX) \
     || defined(AO_HAVE_XSIZE_fetch_compare_and_swapXX)
    static XCTYPE newval /* = 0 */;
# endif
# if defined(AO_HAVE_test_and_setXX)
    AO_TS_t ts = AO_TS_INITIALIZER;
# endif
# if defined(AO_HAVE_XSIZE_fetch_and_addXX) || defined(AO_HAVE_XSIZE_andXX) \
     || defined(AO_HAVE_XSIZE_orXX) || defined(AO_HAVE_XSIZE_xorXX)
    static XCTYPE incr /* = 0 */;
# endif

# if defined(AO_HAVE_nopXX)
    (void)"AO_nopXX(): ";
    AO_nopXX();
# else
    (void)"No AO_nopXX";
# endif

# ifdef AO_HAVE_XSIZE_loadXX
    (void)"AO_XSIZE_loadXX(&val):";
    (void)AO_XSIZE_loadXX(&val);
# else
    (void)"No AO_XSIZE_loadXX";
# endif
# ifdef AO_HAVE_XSIZE_storeXX
    (void)"AO_XSIZE_storeXX(&val, newval):";
    AO_XSIZE_storeXX(&val, newval);
# else
    (void)"No AO_XSIZE_storeXX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_addXX
    (void)"AO_XSIZE_fetch_and_addXX(&val, incr):";
    (void)AO_XSIZE_fetch_and_addXX(&val, incr);
# else
    (void)"No AO_XSIZE_fetch_and_addXX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_add1XX
    (void)"AO_XSIZE_fetch_and_add1XX(&val):";
    (void)AO_XSIZE_fetch_and_add1XX(&val);
# else
    (void)"No AO_XSIZE_fetch_and_add1XX";
# endif
# ifdef AO_HAVE_XSIZE_fetch_and_sub1XX
    (void)"AO_XSIZE_fetch_and_sub1XX(&val):";
    (void)AO_XSIZE_fetch_and_sub1XX(&val);
# else
    (void)"No AO_XSIZE_fetch_and_sub1XX";
# endif
# ifdef AO_HAVE_XSIZE_andXX
    (void)"AO_XSIZE_andXX(&val, incr):";
    AO_XSIZE_andXX(&val, incr);
# else
    (void)"No AO_XSIZE_andXX";
# endif
# ifdef AO_HAVE_XSIZE_orXX
    (void)"AO_XSIZE_orXX(&val, incr):";
    AO_XSIZE_orXX(&val, incr);
# else
    (void)"No AO_XSIZE_orXX";
# endif
# ifdef AO_HAVE_XSIZE_xorXX
    (void)"AO_XSIZE_xorXX(&val, incr):";
    AO_XSIZE_xorXX(&val, incr);
# else
    (void)"No AO_XSIZE_xorXX";
# endif
# ifdef AO_HAVE_XSIZE_compare_and_swapXX
    (void)"AO_XSIZE_compare_and_swapXX(&val, oldval, newval):";
    if (!AO_XSIZE_compare_and_swapXX(&val, oldval, newval))
      exit(1);
# else
    (void)"No AO_XSIZE_compare_and_swapXX";
# endif
  /* TODO: Add AO_compare_double_and_swap_doubleXX */
  /* TODO: Add AO_compare_and_swap_doubleXX */
# ifdef AO_HAVE_XSIZE_fetch_compare_and_swapXX
    (void)"AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval):";
    if (AO_XSIZE_fetch_compare_and_swapXX(&val, oldval, newval) != oldval)
      exit(1);
# else
    (void)"No AO_XSIZE_fetch_compare_and_swapXX";
# endif

# if defined(AO_HAVE_test_and_setXX)
    (void)"AO_test_and_setXX(&ts):";
    (void)AO_test_and_setXX(&ts);
# else
    (void)"No AO_test_and_setXX";
# endif
}