[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 36/66] Hexagon TCG generation helpers - step 4
From: |
Taylor Simpson |
Subject: |
[RFC PATCH 36/66] Hexagon TCG generation helpers - step 4 |
Date: |
Mon, 10 Feb 2020 18:40:14 -0600 |
Helpers referenced in macros.h
Signed-off-by: Taylor Simpson <address@hidden>
---
target/hexagon/genptr_helpers.h | 67 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/target/hexagon/genptr_helpers.h b/target/hexagon/genptr_helpers.h
index 27f965a..85b449a 100644
--- a/target/hexagon/genptr_helpers.h
+++ b/target/hexagon/genptr_helpers.h
@@ -449,4 +449,71 @@ static inline void gen_store8i(TCGv_env cpu_env, TCGv
vaddr, int64_t src,
tcg_temp_free_i64(tmp);
}
+static inline TCGv_i64 gen_carry_from_add64(TCGv_i64 result, TCGv_i64 a,
+ TCGv_i64 b, TCGv_i64 c)
+{
+ TCGv_i64 WORD = tcg_temp_new_i64();
+ TCGv_i64 tmpa = tcg_temp_new_i64();
+ TCGv_i64 tmpb = tcg_temp_new_i64();
+ TCGv_i64 tmpc = tcg_temp_new_i64();
+
+ tcg_gen_mov_i64(tmpa, fGETUWORD(0, a));
+ tcg_gen_mov_i64(tmpb, fGETUWORD(0, b));
+ tcg_gen_add_i64(tmpc, tmpa, tmpb);
+ tcg_gen_add_i64(tmpc, tmpc, c);
+ tcg_gen_mov_i64(tmpa, fGETUWORD(1, a));
+ tcg_gen_mov_i64(tmpb, fGETUWORD(1, b));
+ tcg_gen_add_i64(tmpc, tmpa, tmpb);
+ tcg_gen_add_i64(tmpc, tmpc, fGETUWORD(1, tmpc));
+ tcg_gen_mov_i64(result, fGETUWORD(1, tmpc));
+
+ tcg_temp_free_i64(WORD);
+ tcg_temp_free_i64(tmpa);
+ tcg_temp_free_i64(tmpb);
+ tcg_temp_free_i64(tmpc);
+ return result;
+}
+
+static inline TCGv gen_8bitsof(TCGv result, TCGv value)
+{
+ TCGv zero = tcg_const_tl(0);
+ TCGv ones = tcg_const_tl(0xff);
+ tcg_gen_movcond_tl(TCG_COND_NE, result, value, zero, ones, zero);
+ tcg_temp_free(zero);
+ tcg_temp_free(ones);
+
+ return result;
+}
+
+static inline void gen_write_new_pc(TCGv addr)
+{
+ /* If there are multiple branches in a packet, ignore the second one */
+ TCGv zero = tcg_const_tl(0);
+ tcg_gen_movcond_tl(TCG_COND_NE, hex_next_PC, hex_branch_taken, zero,
+ hex_next_PC, addr);
+ tcg_gen_movi_tl(hex_branch_taken, 1);
+ tcg_temp_free(zero);
+}
+
+static inline void gen_set_usr_field(int field, TCGv val)
+{
+ tcg_gen_deposit_tl(hex_gpr[HEX_REG_USR], hex_gpr[HEX_REG_USR], val,
+ reg_field_info[field].offset,
+ reg_field_info[field].width);
+}
+
+static inline void gen_set_usr_fieldi(int field, int x)
+{
+ TCGv val = tcg_const_tl(x);
+ gen_set_usr_field(field, val);
+ tcg_temp_free(val);
+}
+
+static inline void gen_cond_return(TCGv pred, TCGv addr)
+{
+ TCGv zero = tcg_const_tl(0);
+ tcg_gen_movcond_tl(TCG_COND_NE, hex_next_PC, pred, zero, addr,
hex_next_PC);
+ tcg_temp_free(zero);
+}
+
#endif
--
2.7.4
- [RFC PATCH 11/66] Hexagon instruction attributes, (continued)
- [RFC PATCH 11/66] Hexagon instruction attributes, Taylor Simpson, 2020/02/10
- [RFC PATCH 28/66] Hexagon generater phase 4 - Decode tree, Taylor Simpson, 2020/02/10
- [RFC PATCH 29/66] Hexagon opcode data structures, Taylor Simpson, 2020/02/10
- [RFC PATCH 17/66] Hexagon arch import - instruction encoding, Taylor Simpson, 2020/02/10
- [RFC PATCH 27/66] Hexagon generator phase 3 - C preprocessor for decode tree, Taylor Simpson, 2020/02/10
- [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 <=
- [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, 2020/02/10
- [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