Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
[qemu.git] / tcg / tcg-runtime.h
1 DEF_HELPER_FLAGS_2(div_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32)
2 DEF_HELPER_FLAGS_2(rem_i32, TCG_CALL_NO_RWG_SE, s32, s32, s32)
3 DEF_HELPER_FLAGS_2(divu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
4 DEF_HELPER_FLAGS_2(remu_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
5
6 DEF_HELPER_FLAGS_2(div_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
7 DEF_HELPER_FLAGS_2(rem_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
8 DEF_HELPER_FLAGS_2(divu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
9 DEF_HELPER_FLAGS_2(remu_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
10
11 DEF_HELPER_FLAGS_2(shl_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
12 DEF_HELPER_FLAGS_2(shr_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
13 DEF_HELPER_FLAGS_2(sar_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
14
15 DEF_HELPER_FLAGS_2(mulsh_i64, TCG_CALL_NO_RWG_SE, s64, s64, s64)
16 DEF_HELPER_FLAGS_2(muluh_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
17
18 DEF_HELPER_FLAGS_2(clz_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
19 DEF_HELPER_FLAGS_2(ctz_i32, TCG_CALL_NO_RWG_SE, i32, i32, i32)
20 DEF_HELPER_FLAGS_2(clz_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
21 DEF_HELPER_FLAGS_2(ctz_i64, TCG_CALL_NO_RWG_SE, i64, i64, i64)
22 DEF_HELPER_FLAGS_1(clrsb_i32, TCG_CALL_NO_RWG_SE, i32, i32)
23 DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i64)
24 DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32)
25 DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64)
26
27 DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env)
28
29 #ifdef CONFIG_SOFTMMU
30
31 DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG,
32 i32, env, tl, i32, i32, i32)
33 DEF_HELPER_FLAGS_5(atomic_cmpxchgw_be, TCG_CALL_NO_WG,
34 i32, env, tl, i32, i32, i32)
35 DEF_HELPER_FLAGS_5(atomic_cmpxchgw_le, TCG_CALL_NO_WG,
36 i32, env, tl, i32, i32, i32)
37 DEF_HELPER_FLAGS_5(atomic_cmpxchgl_be, TCG_CALL_NO_WG,
38 i32, env, tl, i32, i32, i32)
39 DEF_HELPER_FLAGS_5(atomic_cmpxchgl_le, TCG_CALL_NO_WG,
40 i32, env, tl, i32, i32, i32)
41 #ifdef CONFIG_ATOMIC64
42 DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG,
43 i64, env, tl, i64, i64, i32)
44 DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG,
45 i64, env, tl, i64, i64, i32)
46 #endif
47
48 #ifdef CONFIG_ATOMIC64
49 #define GEN_ATOMIC_HELPERS(NAME) \
50 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), b), \
51 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
52 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_le), \
53 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
54 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_be), \
55 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
56 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_le), \
57 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
58 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_be), \
59 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
60 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), q_le), \
61 TCG_CALL_NO_WG, i64, env, tl, i64, i32) \
62 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), q_be), \
63 TCG_CALL_NO_WG, i64, env, tl, i64, i32)
64 #else
65 #define GEN_ATOMIC_HELPERS(NAME) \
66 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), b), \
67 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
68 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_le), \
69 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
70 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), w_be), \
71 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
72 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_le), \
73 TCG_CALL_NO_WG, i32, env, tl, i32, i32) \
74 DEF_HELPER_FLAGS_4(glue(glue(atomic_, NAME), l_be), \
75 TCG_CALL_NO_WG, i32, env, tl, i32, i32)
76 #endif /* CONFIG_ATOMIC64 */
77
78 #else
79
80 DEF_HELPER_FLAGS_4(atomic_cmpxchgb, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
81 DEF_HELPER_FLAGS_4(atomic_cmpxchgw_be, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
82 DEF_HELPER_FLAGS_4(atomic_cmpxchgw_le, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
83 DEF_HELPER_FLAGS_4(atomic_cmpxchgl_be, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
84 DEF_HELPER_FLAGS_4(atomic_cmpxchgl_le, TCG_CALL_NO_WG, i32, env, tl, i32, i32)
85 #ifdef CONFIG_ATOMIC64
86 DEF_HELPER_FLAGS_4(atomic_cmpxchgq_be, TCG_CALL_NO_WG, i64, env, tl, i64, i64)
87 DEF_HELPER_FLAGS_4(atomic_cmpxchgq_le, TCG_CALL_NO_WG, i64, env, tl, i64, i64)
88 #endif
89
90 #ifdef CONFIG_ATOMIC64
91 #define GEN_ATOMIC_HELPERS(NAME) \
92 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), b), \
93 TCG_CALL_NO_WG, i32, env, tl, i32) \
94 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_le), \
95 TCG_CALL_NO_WG, i32, env, tl, i32) \
96 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_be), \
97 TCG_CALL_NO_WG, i32, env, tl, i32) \
98 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_le), \
99 TCG_CALL_NO_WG, i32, env, tl, i32) \
100 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_be), \
101 TCG_CALL_NO_WG, i32, env, tl, i32) \
102 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), q_le), \
103 TCG_CALL_NO_WG, i64, env, tl, i64) \
104 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), q_be), \
105 TCG_CALL_NO_WG, i64, env, tl, i64)
106 #else
107 #define GEN_ATOMIC_HELPERS(NAME) \
108 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), b), \
109 TCG_CALL_NO_WG, i32, env, tl, i32) \
110 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_le), \
111 TCG_CALL_NO_WG, i32, env, tl, i32) \
112 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), w_be), \
113 TCG_CALL_NO_WG, i32, env, tl, i32) \
114 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_le), \
115 TCG_CALL_NO_WG, i32, env, tl, i32) \
116 DEF_HELPER_FLAGS_3(glue(glue(atomic_, NAME), l_be), \
117 TCG_CALL_NO_WG, i32, env, tl, i32)
118 #endif /* CONFIG_ATOMIC64 */
119
120 #endif /* CONFIG_SOFTMMU */
121
122 GEN_ATOMIC_HELPERS(fetch_add)
123 GEN_ATOMIC_HELPERS(fetch_and)
124 GEN_ATOMIC_HELPERS(fetch_or)
125 GEN_ATOMIC_HELPERS(fetch_xor)
126
127 GEN_ATOMIC_HELPERS(add_fetch)
128 GEN_ATOMIC_HELPERS(and_fetch)
129 GEN_ATOMIC_HELPERS(or_fetch)
130 GEN_ATOMIC_HELPERS(xor_fetch)
131
132 GEN_ATOMIC_HELPERS(xchg)
133
134 #undef GEN_ATOMIC_HELPERS