Skip to content

Commit b4c8f3d

Browse files
committed
accel/tcg: Move cpu_atomic decls to exec/cpu_ldst.h
The previous placement in tcg/tcg.h was not logical. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent f83bcec commit b4c8f3d

File tree

6 files changed

+87
-91
lines changed

6 files changed

+87
-91
lines changed

include/exec/cpu_ldst.h

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#define CPU_LDST_H
6464

6565
#include "exec/memopidx.h"
66+
#include "qemu/int128.h"
6667

6768
#if defined(CONFIG_USER_ONLY)
6869
/* sparc32plus has 64bit long but 32bit space address
@@ -233,6 +234,92 @@ void cpu_stl_le_mmu(CPUArchState *env, abi_ptr ptr, uint32_t val,
233234
void cpu_stq_le_mmu(CPUArchState *env, abi_ptr ptr, uint64_t val,
234235
MemOpIdx oi, uintptr_t ra);
235236

237+
uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, target_ulong addr,
238+
uint32_t cmpv, uint32_t newv,
239+
MemOpIdx oi, uintptr_t retaddr);
240+
uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, target_ulong addr,
241+
uint32_t cmpv, uint32_t newv,
242+
MemOpIdx oi, uintptr_t retaddr);
243+
uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, target_ulong addr,
244+
uint32_t cmpv, uint32_t newv,
245+
MemOpIdx oi, uintptr_t retaddr);
246+
uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, target_ulong addr,
247+
uint64_t cmpv, uint64_t newv,
248+
MemOpIdx oi, uintptr_t retaddr);
249+
uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, target_ulong addr,
250+
uint32_t cmpv, uint32_t newv,
251+
MemOpIdx oi, uintptr_t retaddr);
252+
uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, target_ulong addr,
253+
uint32_t cmpv, uint32_t newv,
254+
MemOpIdx oi, uintptr_t retaddr);
255+
uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, target_ulong addr,
256+
uint64_t cmpv, uint64_t newv,
257+
MemOpIdx oi, uintptr_t retaddr);
258+
259+
#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \
260+
TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \
261+
(CPUArchState *env, target_ulong addr, TYPE val, \
262+
MemOpIdx oi, uintptr_t retaddr);
263+
264+
#ifdef CONFIG_ATOMIC64
265+
#define GEN_ATOMIC_HELPER_ALL(NAME) \
266+
GEN_ATOMIC_HELPER(NAME, uint32_t, b) \
267+
GEN_ATOMIC_HELPER(NAME, uint32_t, w_le) \
268+
GEN_ATOMIC_HELPER(NAME, uint32_t, w_be) \
269+
GEN_ATOMIC_HELPER(NAME, uint32_t, l_le) \
270+
GEN_ATOMIC_HELPER(NAME, uint32_t, l_be) \
271+
GEN_ATOMIC_HELPER(NAME, uint64_t, q_le) \
272+
GEN_ATOMIC_HELPER(NAME, uint64_t, q_be)
273+
#else
274+
#define GEN_ATOMIC_HELPER_ALL(NAME) \
275+
GEN_ATOMIC_HELPER(NAME, uint32_t, b) \
276+
GEN_ATOMIC_HELPER(NAME, uint32_t, w_le) \
277+
GEN_ATOMIC_HELPER(NAME, uint32_t, w_be) \
278+
GEN_ATOMIC_HELPER(NAME, uint32_t, l_le) \
279+
GEN_ATOMIC_HELPER(NAME, uint32_t, l_be)
280+
#endif
281+
282+
GEN_ATOMIC_HELPER_ALL(fetch_add)
283+
GEN_ATOMIC_HELPER_ALL(fetch_sub)
284+
GEN_ATOMIC_HELPER_ALL(fetch_and)
285+
GEN_ATOMIC_HELPER_ALL(fetch_or)
286+
GEN_ATOMIC_HELPER_ALL(fetch_xor)
287+
GEN_ATOMIC_HELPER_ALL(fetch_smin)
288+
GEN_ATOMIC_HELPER_ALL(fetch_umin)
289+
GEN_ATOMIC_HELPER_ALL(fetch_smax)
290+
GEN_ATOMIC_HELPER_ALL(fetch_umax)
291+
292+
GEN_ATOMIC_HELPER_ALL(add_fetch)
293+
GEN_ATOMIC_HELPER_ALL(sub_fetch)
294+
GEN_ATOMIC_HELPER_ALL(and_fetch)
295+
GEN_ATOMIC_HELPER_ALL(or_fetch)
296+
GEN_ATOMIC_HELPER_ALL(xor_fetch)
297+
GEN_ATOMIC_HELPER_ALL(smin_fetch)
298+
GEN_ATOMIC_HELPER_ALL(umin_fetch)
299+
GEN_ATOMIC_HELPER_ALL(smax_fetch)
300+
GEN_ATOMIC_HELPER_ALL(umax_fetch)
301+
302+
GEN_ATOMIC_HELPER_ALL(xchg)
303+
304+
#undef GEN_ATOMIC_HELPER_ALL
305+
#undef GEN_ATOMIC_HELPER
306+
307+
Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, target_ulong addr,
308+
Int128 cmpv, Int128 newv,
309+
MemOpIdx oi, uintptr_t retaddr);
310+
Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, target_ulong addr,
311+
Int128 cmpv, Int128 newv,
312+
MemOpIdx oi, uintptr_t retaddr);
313+
314+
Int128 cpu_atomic_ldo_le_mmu(CPUArchState *env, target_ulong addr,
315+
MemOpIdx oi, uintptr_t retaddr);
316+
Int128 cpu_atomic_ldo_be_mmu(CPUArchState *env, target_ulong addr,
317+
MemOpIdx oi, uintptr_t retaddr);
318+
void cpu_atomic_sto_le_mmu(CPUArchState *env, target_ulong addr, Int128 val,
319+
MemOpIdx oi, uintptr_t retaddr);
320+
void cpu_atomic_sto_be_mmu(CPUArchState *env, target_ulong addr, Int128 val,
321+
MemOpIdx oi, uintptr_t retaddr);
322+
236323
#if defined(CONFIG_USER_ONLY)
237324

238325
extern __thread uintptr_t helper_retaddr;

include/tcg/tcg.h

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include "qemu/queue.h"
3434
#include "tcg/tcg-mo.h"
3535
#include "tcg-target.h"
36-
#include "qemu/int128.h"
3736
#include "tcg/tcg-cond.h"
3837

3938
/* XXX: make safe guess about sizes */
@@ -1312,92 +1311,6 @@ void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
13121311
#endif
13131312
#endif /* CONFIG_SOFTMMU */
13141313

1315-
uint32_t cpu_atomic_cmpxchgb_mmu(CPUArchState *env, target_ulong addr,
1316-
uint32_t cmpv, uint32_t newv,
1317-
MemOpIdx oi, uintptr_t retaddr);
1318-
uint32_t cpu_atomic_cmpxchgw_le_mmu(CPUArchState *env, target_ulong addr,
1319-
uint32_t cmpv, uint32_t newv,
1320-
MemOpIdx oi, uintptr_t retaddr);
1321-
uint32_t cpu_atomic_cmpxchgl_le_mmu(CPUArchState *env, target_ulong addr,
1322-
uint32_t cmpv, uint32_t newv,
1323-
MemOpIdx oi, uintptr_t retaddr);
1324-
uint64_t cpu_atomic_cmpxchgq_le_mmu(CPUArchState *env, target_ulong addr,
1325-
uint64_t cmpv, uint64_t newv,
1326-
MemOpIdx oi, uintptr_t retaddr);
1327-
uint32_t cpu_atomic_cmpxchgw_be_mmu(CPUArchState *env, target_ulong addr,
1328-
uint32_t cmpv, uint32_t newv,
1329-
MemOpIdx oi, uintptr_t retaddr);
1330-
uint32_t cpu_atomic_cmpxchgl_be_mmu(CPUArchState *env, target_ulong addr,
1331-
uint32_t cmpv, uint32_t newv,
1332-
MemOpIdx oi, uintptr_t retaddr);
1333-
uint64_t cpu_atomic_cmpxchgq_be_mmu(CPUArchState *env, target_ulong addr,
1334-
uint64_t cmpv, uint64_t newv,
1335-
MemOpIdx oi, uintptr_t retaddr);
1336-
1337-
#define GEN_ATOMIC_HELPER(NAME, TYPE, SUFFIX) \
1338-
TYPE cpu_atomic_ ## NAME ## SUFFIX ## _mmu \
1339-
(CPUArchState *env, target_ulong addr, TYPE val, \
1340-
MemOpIdx oi, uintptr_t retaddr);
1341-
1342-
#ifdef CONFIG_ATOMIC64
1343-
#define GEN_ATOMIC_HELPER_ALL(NAME) \
1344-
GEN_ATOMIC_HELPER(NAME, uint32_t, b) \
1345-
GEN_ATOMIC_HELPER(NAME, uint32_t, w_le) \
1346-
GEN_ATOMIC_HELPER(NAME, uint32_t, w_be) \
1347-
GEN_ATOMIC_HELPER(NAME, uint32_t, l_le) \
1348-
GEN_ATOMIC_HELPER(NAME, uint32_t, l_be) \
1349-
GEN_ATOMIC_HELPER(NAME, uint64_t, q_le) \
1350-
GEN_ATOMIC_HELPER(NAME, uint64_t, q_be)
1351-
#else
1352-
#define GEN_ATOMIC_HELPER_ALL(NAME) \
1353-
GEN_ATOMIC_HELPER(NAME, uint32_t, b) \
1354-
GEN_ATOMIC_HELPER(NAME, uint32_t, w_le) \
1355-
GEN_ATOMIC_HELPER(NAME, uint32_t, w_be) \
1356-
GEN_ATOMIC_HELPER(NAME, uint32_t, l_le) \
1357-
GEN_ATOMIC_HELPER(NAME, uint32_t, l_be)
1358-
#endif
1359-
1360-
GEN_ATOMIC_HELPER_ALL(fetch_add)
1361-
GEN_ATOMIC_HELPER_ALL(fetch_sub)
1362-
GEN_ATOMIC_HELPER_ALL(fetch_and)
1363-
GEN_ATOMIC_HELPER_ALL(fetch_or)
1364-
GEN_ATOMIC_HELPER_ALL(fetch_xor)
1365-
GEN_ATOMIC_HELPER_ALL(fetch_smin)
1366-
GEN_ATOMIC_HELPER_ALL(fetch_umin)
1367-
GEN_ATOMIC_HELPER_ALL(fetch_smax)
1368-
GEN_ATOMIC_HELPER_ALL(fetch_umax)
1369-
1370-
GEN_ATOMIC_HELPER_ALL(add_fetch)
1371-
GEN_ATOMIC_HELPER_ALL(sub_fetch)
1372-
GEN_ATOMIC_HELPER_ALL(and_fetch)
1373-
GEN_ATOMIC_HELPER_ALL(or_fetch)
1374-
GEN_ATOMIC_HELPER_ALL(xor_fetch)
1375-
GEN_ATOMIC_HELPER_ALL(smin_fetch)
1376-
GEN_ATOMIC_HELPER_ALL(umin_fetch)
1377-
GEN_ATOMIC_HELPER_ALL(smax_fetch)
1378-
GEN_ATOMIC_HELPER_ALL(umax_fetch)
1379-
1380-
GEN_ATOMIC_HELPER_ALL(xchg)
1381-
1382-
#undef GEN_ATOMIC_HELPER_ALL
1383-
#undef GEN_ATOMIC_HELPER
1384-
1385-
Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, target_ulong addr,
1386-
Int128 cmpv, Int128 newv,
1387-
MemOpIdx oi, uintptr_t retaddr);
1388-
Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, target_ulong addr,
1389-
Int128 cmpv, Int128 newv,
1390-
MemOpIdx oi, uintptr_t retaddr);
1391-
1392-
Int128 cpu_atomic_ldo_le_mmu(CPUArchState *env, target_ulong addr,
1393-
MemOpIdx oi, uintptr_t retaddr);
1394-
Int128 cpu_atomic_ldo_be_mmu(CPUArchState *env, target_ulong addr,
1395-
MemOpIdx oi, uintptr_t retaddr);
1396-
void cpu_atomic_sto_le_mmu(CPUArchState *env, target_ulong addr, Int128 val,
1397-
MemOpIdx oi, uintptr_t retaddr);
1398-
void cpu_atomic_sto_be_mmu(CPUArchState *env, target_ulong addr, Int128 val,
1399-
MemOpIdx oi, uintptr_t retaddr);
1400-
14011314
#ifdef CONFIG_DEBUG_TCG
14021315
void tcg_assert_listed_vecop(TCGOpcode);
14031316
#else

target/arm/helper-a64.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "exec/cpu_ldst.h"
3333
#include "qemu/int128.h"
3434
#include "qemu/atomic128.h"
35-
#include "tcg/tcg.h"
3635
#include "fpu/softfloat.h"
3736
#include <zlib.h> /* For crc32 */
3837

target/m68k/op_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "exec/exec-all.h"
2323
#include "exec/cpu_ldst.h"
2424
#include "semihosting/semihost.h"
25-
#include "tcg/tcg.h"
2625

2726
#if !defined(CONFIG_USER_ONLY)
2827

target/ppc/mem_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "exec/helper-proto.h"
2626
#include "helper_regs.h"
2727
#include "exec/cpu_ldst.h"
28-
#include "tcg/tcg.h"
2928
#include "internal.h"
3029
#include "qemu/atomic128.h"
3130

target/s390x/tcg/mem_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "exec/cpu_ldst.h"
2828
#include "qemu/int128.h"
2929
#include "qemu/atomic128.h"
30-
#include "tcg/tcg.h"
3130
#include "trace.h"
3231

3332
#if !defined(CONFIG_USER_ONLY)

0 commit comments

Comments
 (0)