[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 34/66] Hexagon TCG generation helpers - step 2
From: |
Taylor Simpson |
Subject: |
[RFC PATCH 34/66] Hexagon TCG generation helpers - step 2 |
Date: |
Mon, 10 Feb 2020 18:40:12 -0600 |
Helpers for load-locked/store-conditional
Signed-off-by: Taylor Simpson <address@hidden>
---
target/hexagon/genptr_helpers.h | 52 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/target/hexagon/genptr_helpers.h b/target/hexagon/genptr_helpers.h
index 2b91fdb..b780522 100644
--- a/target/hexagon/genptr_helpers.h
+++ b/target/hexagon/genptr_helpers.h
@@ -320,4 +320,56 @@ static inline TCGv gen_set_bit(int i, TCGv result, TCGv
src)
return result;
}
+static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int mem_index)
+{
+ tcg_gen_qemu_ld32u(dest, vaddr, mem_index);
+ tcg_gen_mov_tl(llsc_addr, vaddr);
+ tcg_gen_mov_tl(llsc_val, dest);
+}
+
+static inline void gen_load_locked8u(TCGv_i64 dest, TCGv vaddr, int mem_index)
+{
+ tcg_gen_qemu_ld64(dest, vaddr, mem_index);
+ tcg_gen_mov_tl(llsc_addr, vaddr);
+ tcg_gen_mov_i64(llsc_val_i64, dest);
+}
+
+static inline void gen_store_conditional4(CPUHexagonState *env,
+ DisasContext *ctx, int prednum,
+ TCGv pred, TCGv vaddr, TCGv src)
+{
+ TCGv tmp = tcg_temp_new();
+ TCGLabel *fail = gen_new_label();
+
+ tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_addr));
+ tcg_gen_brcond_tl(TCG_COND_NE, vaddr, tmp, fail);
+ tcg_gen_movi_tl(tmp, prednum);
+ tcg_gen_st_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_reg));
+ tcg_gen_st_tl(src, cpu_env, offsetof(CPUHexagonState, llsc_newval));
+ gen_exception(HEX_EXCP_SC4);
+
+ gen_set_label(fail);
+ tcg_gen_movi_tl(pred, 0);
+ tcg_temp_free(tmp);
+}
+
+static inline void gen_store_conditional8(CPUHexagonState *env,
+ DisasContext *ctx, int prednum,
+ TCGv pred, TCGv vaddr, TCGv_i64 src)
+{
+ TCGv tmp = tcg_temp_new();
+ TCGLabel *fail = gen_new_label();
+
+ tcg_gen_ld_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_addr));
+ tcg_gen_brcond_tl(TCG_COND_NE, vaddr, tmp, fail);
+ tcg_gen_movi_tl(tmp, prednum);
+ tcg_gen_st_tl(tmp, cpu_env, offsetof(CPUHexagonState, llsc_reg));
+ tcg_gen_st_i64(src, cpu_env, offsetof(CPUHexagonState, llsc_newval_i64));
+ gen_exception(HEX_EXCP_SC8);
+
+ gen_set_label(fail);
+ tcg_gen_movi_tl(pred, 0);
+ tcg_temp_free(tmp);
+}
+
#endif
--
2.7.4
- [RFC PATCH 13/66] Hexagon instruction/packet decode, (continued)
- [RFC PATCH 13/66] Hexagon instruction/packet decode, Taylor Simpson, 2020/02/10
- [RFC PATCH 33/66] Hexagon TCG generation helpers - step 1, Taylor Simpson, 2020/02/10
- [RFC PATCH 16/66] Hexagon arch import - macro definitions, Taylor Simpson, 2020/02/10
- [RFC PATCH 21/66] Hexagon generator phase 2 - qemu_def_generated.h, Taylor Simpson, 2020/02/10
- [RFC PATCH 35/66] Hexagon TCG generation helpers - step 3, Taylor Simpson, 2020/02/10
- [RFC PATCH 36/66] Hexagon TCG generation helpers - step 4, Taylor Simpson, 2020/02/10
- [RFC PATCH 19/66] Hexagon instruction utility functions, Taylor Simpson, 2020/02/10
- [RFC PATCH 30/66] Hexagon macros to interface with the generator, Taylor Simpson, 2020/02/10
- [RFC PATCH 32/66] Hexagon instruction classes, Taylor Simpson, 2020/02/10
- [RFC PATCH 31/66] Hexagon macros referenced in instruction semantics, Taylor Simpson, 2020/02/10
- [RFC PATCH 34/66] Hexagon TCG generation helpers - step 2,
Taylor Simpson <=
- [RFC PATCH 38/66] Hexagon TCG generation - step 01, Taylor Simpson, 2020/02/10
- [RFC PATCH 37/66] Hexagon TCG generation helpers - step 5, Taylor Simpson, 2020/02/10
- [RFC PATCH 39/66] Hexagon TCG generation - step 02, Taylor Simpson, 2020/02/10
- [RFC PATCH 40/66] Hexagon TCG generation - step 03, Taylor Simpson, 2020/02/10
- [RFC PATCH 41/66] Hexagon TCG generation - step 04, Taylor Simpson, 2020/02/10
- [RFC PATCH 46/66] Hexagon TCG generation - step 09, Taylor Simpson, 2020/02/10
- [RFC PATCH 43/66] Hexagon TCG generation - step 06, Taylor Simpson, 2020/02/10
- [RFC PATCH 15/66] Hexagon arch import - instruction semantics definitions, Taylor Simpson, 2020/02/10
- [RFC PATCH 42/66] Hexagon TCG generation - step 05, Taylor Simpson, 2020/02/10
- [RFC PATCH 47/66] Hexagon TCG generation - step 10, Taylor Simpson, 2020/02/10