aboutsummaryrefslogtreecommitdiff
path: root/target-sparc
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2016-09-12 19:11:18 -0700
committerRichard Henderson <rth@twiddle.net>2016-10-31 14:46:48 -0600
commit5a7267b6a9e94c264ca77a7ca5a239e70dac81da (patch)
tree54da16331e0c82248f76300cc951223e196b2904 /target-sparc
parentda1bcae65288bdd51e0a7203d1e6c9cde1be5b3d (diff)
target-sparc: Use tcg_gen_atomic_cmpxchg_tl
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-sparc')
-rw-r--r--target-sparc/translate.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 82f5e67f0f..a13b76ebd9 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -2391,31 +2391,21 @@ static void gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src,
}
}
-static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpr,
+static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv,
int insn, int rd)
{
DisasASI da = get_asi(dc, insn, MO_TEUL);
- TCGv cmpv, oldv, tmpv;
+ TCGv oldv;
switch (da.type) {
case GET_ASI_EXCP:
return;
case GET_ASI_DIRECT:
- cmpv = tcg_temp_new();
oldv = tcg_temp_new();
- tmpv = tcg_temp_new();
- tcg_gen_ext32u_tl(cmpv, cmpr);
-
- /* ??? Should be atomic. */
- tcg_gen_qemu_ld_tl(oldv, addr, da.mem_idx, da.memop);
- tcg_gen_movcond_tl(TCG_COND_EQ, tmpv, oldv, cmpv,
- gen_load_gpr(dc, rd), oldv);
- tcg_gen_qemu_st_tl(tmpv, addr, da.mem_idx, da.memop);
-
+ tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd),
+ da.mem_idx, da.memop);
gen_store_gpr(dc, rd, oldv);
- tcg_temp_free(cmpv);
tcg_temp_free(oldv);
- tcg_temp_free(tmpv);
break;
default:
/* ??? Should be DAE_invalid_asi. */
@@ -2770,24 +2760,17 @@ static void gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv,
int insn, int rd)
{
DisasASI da = get_asi(dc, insn, MO_TEQ);
- TCGv oldv, tmpv;
+ TCGv oldv;
switch (da.type) {
case GET_ASI_EXCP:
return;
case GET_ASI_DIRECT:
oldv = tcg_temp_new();
- tmpv = tcg_temp_new();
-
- /* ??? Should be atomic. */
- tcg_gen_qemu_ld_tl(oldv, addr, da.mem_idx, da.memop);
- tcg_gen_movcond_tl(TCG_COND_EQ, tmpv, oldv, cmpv,
- gen_load_gpr(dc, rd), oldv);
- tcg_gen_qemu_st_tl(tmpv, addr, da.mem_idx, da.memop);
-
+ tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd),
+ da.mem_idx, da.memop);
gen_store_gpr(dc, rd, oldv);
tcg_temp_free(oldv);
- tcg_temp_free(tmpv);
break;
default:
/* ??? Should be DAE_invalid_asi. */