summaryrefslogtreecommitdiffstats
path: root/llvm/atomic/atomic-helper.h
blob: 9e3cedf7a584d42376a5b8a853253efa3f6703bb (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
/*
 * Copyright (C) 2010 Parallel Processing Institute (PPI), Fudan Univ.
 *  <http://ppi.fudan.edu.cn/system_research_group>
 *
 * Authors:
 *  Zhaoguo Wang    <zgwang@fudan.edu.cn>
 *  Yufei Chen      <chenyufei@fudan.edu.cn>
 *  Ran Liu         <naruilone@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#include "config-target.h"

#ifdef CONFIG_COREMU

#if defined(TARGET_I386)
#define __GEN_HEADER(type) \
DEF_HELPER_3(atomic_inc##type, void, env, tl, int)                \
DEF_HELPER_4(xchg##type, void, env, tl, int, int)                 \
DEF_HELPER_4(atomic_op##type, void, env, tl, tl, int)             \
DEF_HELPER_4(atomic_xadd##type, void, env, tl, int, int)          \
DEF_HELPER_4(atomic_cmpxchg##type, void, env, tl, int, int)       \
DEF_HELPER_2(atomic_not##type, void, env, tl)                     \
DEF_HELPER_2(atomic_neg##type, void, env, tl)

__GEN_HEADER(b)
__GEN_HEADER(w)
__GEN_HEADER(l)
#ifdef TARGET_X86_64
__GEN_HEADER(q)
#endif

DEF_HELPER_2(atomic_cmpxchg8b, void, env, tl)
DEF_HELPER_2(atomic_cmpxchg16b, void, env, tl)

DEF_HELPER_4(atomic_bts, void, env, tl, tl, int)
DEF_HELPER_4(atomic_btr, void, env, tl, tl, int)
DEF_HELPER_4(atomic_btc, void, env, tl, tl, int)

/* fence */
DEF_HELPER_1(fence, void, env)

#elif defined(TARGET_ARM)
#define __GEN_HEADER(type) \
DEF_HELPER_3(load_exclusive##type, void, env, i32, i32)           \
DEF_HELPER_4(store_exclusive##type, void, env, i32, i32, i32)

__GEN_HEADER(b)
__GEN_HEADER(w)
__GEN_HEADER(l)
__GEN_HEADER(q)

DEF_HELPER_1(clear_exclusive, void, env)

DEF_HELPER_4(swpb, void, env, i32, i32, i32)
DEF_HELPER_4(swp, void, env, i32, i32, i32)
#else
#error "unsupported processor type"
#endif

#endif

OpenPOWER on IntegriCloud