Skip to content

Commit 3818503

Browse files
committed
CI(full),CI(release): More PPC64 atomic fixes
1 parent 0a02746 commit 3818503

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

qemu/target/ppc/mem_helper.c

+4
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ target_ulong helper_lscbx(CPUPPCState *env, target_ulong addr, uint32_t reg,
374374
}
375375

376376
#ifdef TARGET_PPC64
377+
#ifdef HAVE_ATOMIC128
377378
uint64_t helper_lq_le_parallel(CPUPPCState *env, target_ulong addr,
378379
uint32_t opidx)
379380
{
@@ -419,7 +420,9 @@ void helper_stq_be_parallel(CPUPPCState *env, target_ulong addr,
419420
val = int128_make128(lo, hi);
420421
helper_atomic_sto_be_mmu(env, addr, val, opidx, GETPC());
421422
}
423+
#endif
422424

425+
#ifdef HAVE_CMPXCHG128
423426
uint32_t helper_stqcx_le_parallel(CPUPPCState *env, target_ulong addr,
424427
uint64_t new_lo, uint64_t new_hi,
425428
uint32_t opidx)
@@ -464,6 +467,7 @@ uint32_t helper_stqcx_be_parallel(CPUPPCState *env, target_ulong addr,
464467
return env->so + success * CRF_EQ_BIT;
465468
}
466469
#endif
470+
#endif
467471

468472
/*****************************************************************************/
469473
/* Altivec extension helpers */

qemu/target/ppc/translate.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ static void gen_lq(DisasContext *ctx)
27802780
hi = cpu_gpr[rd];
27812781

27822782
if (tb_cflags(ctx->base.tb) & CF_PARALLEL) {
2783-
if (HAVE_ATOMIC128) {
2783+
#ifdef HAVE_ATOMIC128
27842784
TCGv_i32 oi = tcg_temp_new_i32(tcg_ctx);
27852785
if (ctx->le_mode) {
27862786
tcg_gen_movi_i32(tcg_ctx, oi, make_memop_idx(MO_LEQ, ctx->mem_idx));
@@ -2791,11 +2791,11 @@ static void gen_lq(DisasContext *ctx)
27912791
}
27922792
tcg_temp_free_i32(tcg_ctx, oi);
27932793
tcg_gen_ld_i64(tcg_ctx, hi, tcg_ctx->cpu_env, offsetof(CPUPPCState, retxh));
2794-
} else {
2794+
#else
27952795
/* Restart with exclusive lock. */
27962796
gen_helper_exit_atomic(tcg_ctx, tcg_ctx->cpu_env);
27972797
ctx->base.is_jmp = DISAS_NORETURN;
2798-
}
2798+
#endif
27992799
} else if (ctx->le_mode) {
28002800
tcg_gen_qemu_ld_i64(tcg_ctx, lo, EA, ctx->mem_idx, MO_LEQ);
28012801
gen_addr_add(ctx, EA, EA, 8);
@@ -2958,7 +2958,7 @@ static void gen_std(DisasContext *ctx)
29582958
hi = cpu_gpr[rs];
29592959

29602960
if (tb_cflags(ctx->base.tb) & CF_PARALLEL) {
2961-
if (HAVE_ATOMIC128) {
2961+
#ifdef HAVE_ATOMIC128
29622962
TCGv_i32 oi = tcg_temp_new_i32(tcg_ctx);
29632963
if (ctx->le_mode) {
29642964
tcg_gen_movi_i32(tcg_ctx, oi, make_memop_idx(MO_LEQ, ctx->mem_idx));
@@ -2968,11 +2968,11 @@ static void gen_std(DisasContext *ctx)
29682968
gen_helper_stq_be_parallel(tcg_ctx, tcg_ctx->cpu_env, EA, lo, hi, oi);
29692969
}
29702970
tcg_temp_free_i32(tcg_ctx, oi);
2971-
} else {
2971+
#else
29722972
/* Restart with exclusive lock. */
29732973
gen_helper_exit_atomic(tcg_ctx, tcg_ctx->cpu_env);
29742974
ctx->base.is_jmp = DISAS_NORETURN;
2975-
}
2975+
#endif
29762976
} else if (ctx->le_mode) {
29772977
tcg_gen_qemu_st_i64(tcg_ctx, lo, EA, ctx->mem_idx, MO_LEQ);
29782978
gen_addr_add(ctx, EA, EA, 8);
@@ -3574,7 +3574,7 @@ static void gen_lqarx(DisasContext *ctx)
35743574
hi = cpu_gpr[rd];
35753575

35763576
if (tb_cflags(ctx->base.tb) & CF_PARALLEL) {
3577-
if (HAVE_ATOMIC128) {
3577+
#ifdef HAVE_ATOMIC128
35783578
TCGv_i32 oi = tcg_temp_new_i32(tcg_ctx);
35793579
if (ctx->le_mode) {
35803580
tcg_gen_movi_i32(tcg_ctx, oi, make_memop_idx(MO_LEQ | MO_ALIGN_16,
@@ -3587,13 +3587,13 @@ static void gen_lqarx(DisasContext *ctx)
35873587
}
35883588
tcg_temp_free_i32(tcg_ctx, oi);
35893589
tcg_gen_ld_i64(tcg_ctx, hi, tcg_ctx->cpu_env, offsetof(CPUPPCState, retxh));
3590-
} else {
3590+
#else
35913591
/* Restart with exclusive lock. */
35923592
gen_helper_exit_atomic(tcg_ctx, tcg_ctx->cpu_env);
35933593
ctx->base.is_jmp = DISAS_NORETURN;
35943594
tcg_temp_free(tcg_ctx, EA);
35953595
return;
3596-
}
3596+
#endif
35973597
} else if (ctx->le_mode) {
35983598
tcg_gen_qemu_ld_i64(tcg_ctx, lo, EA, ctx->mem_idx, MO_LEQ | MO_ALIGN_16);
35993599
tcg_gen_mov_tl(tcg_ctx, cpu_reserve, EA);
@@ -3632,7 +3632,7 @@ static void gen_stqcx_(DisasContext *ctx)
36323632
hi = cpu_gpr[rs];
36333633

36343634
if (tb_cflags(ctx->base.tb) & CF_PARALLEL) {
3635-
if (HAVE_CMPXCHG128) {
3635+
#ifdef HAVE_CMPXCHG128
36363636
TCGv_i32 oi = tcg_const_i32(tcg_ctx, DEF_MEMOP(MO_Q) | MO_ALIGN_16);
36373637
if (ctx->le_mode) {
36383638
gen_helper_stqcx_le_parallel(tcg_ctx, cpu_crf[0], tcg_ctx->cpu_env,
@@ -3642,11 +3642,11 @@ static void gen_stqcx_(DisasContext *ctx)
36423642
EA, lo, hi, oi);
36433643
}
36443644
tcg_temp_free_i32(tcg_ctx, oi);
3645-
} else {
3645+
#else
36463646
/* Restart with exclusive lock. */
36473647
gen_helper_exit_atomic(tcg_ctx, tcg_ctx->cpu_env);
36483648
ctx->base.is_jmp = DISAS_NORETURN;
3649-
}
3649+
#endif
36503650
tcg_temp_free(tcg_ctx, EA);
36513651
} else {
36523652
TCGLabel *lab_fail = gen_new_label(tcg_ctx);

0 commit comments

Comments
 (0)