修訂 | 5a7267b6a9e94c264ca77a7ca5a239e70dac81da (tree) |
---|---|
時間 | 2016-11-01 05:46:48 |
作者 | Richard Henderson <rth@twid...> |
Commiter | Richard Henderson |
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>
@@ -2391,31 +2391,21 @@ static void gen_swap_asi(DisasContext *dc, TCGv dst, TCGv src, | ||
2391 | 2391 | } |
2392 | 2392 | } |
2393 | 2393 | |
2394 | -static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpr, | |
2394 | +static void gen_cas_asi(DisasContext *dc, TCGv addr, TCGv cmpv, | |
2395 | 2395 | int insn, int rd) |
2396 | 2396 | { |
2397 | 2397 | DisasASI da = get_asi(dc, insn, MO_TEUL); |
2398 | - TCGv cmpv, oldv, tmpv; | |
2398 | + TCGv oldv; | |
2399 | 2399 | |
2400 | 2400 | switch (da.type) { |
2401 | 2401 | case GET_ASI_EXCP: |
2402 | 2402 | return; |
2403 | 2403 | case GET_ASI_DIRECT: |
2404 | - cmpv = tcg_temp_new(); | |
2405 | 2404 | oldv = tcg_temp_new(); |
2406 | - tmpv = tcg_temp_new(); | |
2407 | - tcg_gen_ext32u_tl(cmpv, cmpr); | |
2408 | - | |
2409 | - /* ??? Should be atomic. */ | |
2410 | - tcg_gen_qemu_ld_tl(oldv, addr, da.mem_idx, da.memop); | |
2411 | - tcg_gen_movcond_tl(TCG_COND_EQ, tmpv, oldv, cmpv, | |
2412 | - gen_load_gpr(dc, rd), oldv); | |
2413 | - tcg_gen_qemu_st_tl(tmpv, addr, da.mem_idx, da.memop); | |
2414 | - | |
2405 | + tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd), | |
2406 | + da.mem_idx, da.memop); | |
2415 | 2407 | gen_store_gpr(dc, rd, oldv); |
2416 | - tcg_temp_free(cmpv); | |
2417 | 2408 | tcg_temp_free(oldv); |
2418 | - tcg_temp_free(tmpv); | |
2419 | 2409 | break; |
2420 | 2410 | default: |
2421 | 2411 | /* ??? Should be DAE_invalid_asi. */ |
@@ -2770,24 +2760,17 @@ static void gen_casx_asi(DisasContext *dc, TCGv addr, TCGv cmpv, | ||
2770 | 2760 | int insn, int rd) |
2771 | 2761 | { |
2772 | 2762 | DisasASI da = get_asi(dc, insn, MO_TEQ); |
2773 | - TCGv oldv, tmpv; | |
2763 | + TCGv oldv; | |
2774 | 2764 | |
2775 | 2765 | switch (da.type) { |
2776 | 2766 | case GET_ASI_EXCP: |
2777 | 2767 | return; |
2778 | 2768 | case GET_ASI_DIRECT: |
2779 | 2769 | oldv = tcg_temp_new(); |
2780 | - tmpv = tcg_temp_new(); | |
2781 | - | |
2782 | - /* ??? Should be atomic. */ | |
2783 | - tcg_gen_qemu_ld_tl(oldv, addr, da.mem_idx, da.memop); | |
2784 | - tcg_gen_movcond_tl(TCG_COND_EQ, tmpv, oldv, cmpv, | |
2785 | - gen_load_gpr(dc, rd), oldv); | |
2786 | - tcg_gen_qemu_st_tl(tmpv, addr, da.mem_idx, da.memop); | |
2787 | - | |
2770 | + tcg_gen_atomic_cmpxchg_tl(oldv, addr, cmpv, gen_load_gpr(dc, rd), | |
2771 | + da.mem_idx, da.memop); | |
2788 | 2772 | gen_store_gpr(dc, rd, oldv); |
2789 | 2773 | tcg_temp_free(oldv); |
2790 | - tcg_temp_free(tmpv); | |
2791 | 2774 | break; |
2792 | 2775 | default: |
2793 | 2776 | /* ??? Should be DAE_invalid_asi. */ |