*/
#include "tcg.h"
+#ifndef CONFIG_NO_DYNGEN_OP
/* legacy dyngen operations */
#include "gen-op.h"
+#endif
int gen_new_label(void);
tcg_gen_op1i(INDEX_op_set_label, n);
}
+static inline void tcg_gen_br(int label)
+{
+ tcg_gen_op1i(INDEX_op_br, label);
+}
+
static inline void tcg_gen_mov_i32(TCGv ret, TCGv arg)
{
- tcg_gen_op2(INDEX_op_mov_i32, ret, arg);
+ if (ret != arg)
+ tcg_gen_op2(INDEX_op_mov_i32, ret, arg);
}
static inline void tcg_gen_movi_i32(TCGv ret, int32_t arg)
0, NULL, 2, args);
}
+static inline void tcg_gen_helper_0_3(void *func,
+ TCGv arg1, TCGv arg2, TCGv arg3)
+{
+ TCGv args[3];
+ args[0] = arg1;
+ args[1] = arg2;
+ args[2] = arg3;
+ tcg_gen_call(&tcg_ctx,
+ tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
+ 0, NULL, 3, args);
+}
+
static inline void tcg_gen_helper_0_4(void *func, TCGv arg1, TCGv arg2,
TCGv arg3, TCGv arg4)
{
1, &ret, 2, args);
}
+static inline void tcg_gen_helper_1_3(void *func, TCGv ret,
+ TCGv arg1, TCGv arg2, TCGv arg3)
+{
+ TCGv args[3];
+ args[0] = arg1;
+ args[1] = arg2;
+ args[2] = arg3;
+ tcg_gen_call(&tcg_ctx,
+ tcg_const_ptr((tcg_target_long)func), TCG_HELPER_CALL_FLAGS,
+ 1, &ret, 3, args);
+}
+
static inline void tcg_gen_helper_1_4(void *func, TCGv ret,
TCGv arg1, TCGv arg2, TCGv arg3,
TCGv arg4)
tcg_gen_op3(INDEX_op_mul_i32, ret, arg1, arg2);
}
+static inline void tcg_gen_muli_i32(TCGv ret, TCGv arg1, int32_t arg2)
+{
+ tcg_gen_mul_i32(ret, arg1, tcg_const_i32(arg2));
+}
+
#ifdef TCG_TARGET_HAS_div_i32
static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
{
static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
{
- tcg_gen_mov_i32(ret, arg);
- tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
+ if (ret != arg) {
+ tcg_gen_mov_i32(ret, arg);
+ tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
+ }
}
static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
tcg_gen_mov_i64(ret, t0);
}
+static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
+{
+ tcg_gen_mul_i64(ret, arg1, tcg_const_i64(arg2));
+}
+
static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
{
tcg_gen_helper_1_2(tcg_helper_div_i64, ret, arg1, arg2);
static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
{
- tcg_gen_op2(INDEX_op_mov_i64, ret, arg);
+ if (ret != arg)
+ tcg_gen_op2(INDEX_op_mov_i64, ret, arg);
}
static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
tcg_gen_op3(INDEX_op_mul_i64, ret, arg1, arg2);
}
+static inline void tcg_gen_muli_i64(TCGv ret, TCGv arg1, int64_t arg2)
+{
+ tcg_gen_mul_i64(ret, arg1, tcg_const_i64(arg2));
+}
+
#ifdef TCG_TARGET_HAS_div_i64
static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
{
}
#define tcg_gen_ld_ptr tcg_gen_ld_i32
+#define tcg_gen_discard_ptr tcg_gen_discard_i32
#else /* TCG_TARGET_REG_BITS == 32 */
}
#define tcg_gen_ld_ptr tcg_gen_ld_i64
+#define tcg_gen_discard_ptr tcg_gen_discard_i64
#endif /* TCG_TARGET_REG_BITS != 32 */
#define tcg_gen_sar_tl tcg_gen_sar_i64
#define tcg_gen_sari_tl tcg_gen_sari_i64
#define tcg_gen_brcond_tl tcg_gen_brcond_i64
+#define tcg_gen_mul_tl tcg_gen_mul_i64
+#define tcg_gen_muli_tl tcg_gen_muli_i64
+#define tcg_gen_discard_tl tcg_gen_discard_i64
+#define tcg_gen_trunc_tl_i32 tcg_gen_trunc_i64_i32
+#define tcg_gen_trunc_i64_tl tcg_gen_mov_i64
+#define tcg_gen_extu_i32_tl tcg_gen_extu_i32_i64
+#define tcg_gen_ext_i32_tl tcg_gen_ext_i32_i64
+#define tcg_gen_extu_tl_i64 tcg_gen_mov_i64
+#define tcg_gen_ext_tl_i64 tcg_gen_mov_i64
#define tcg_const_tl tcg_const_i64
#else
#define TCG_TYPE_TL TCG_TYPE_I32
#define tcg_gen_sar_tl tcg_gen_sar_i32
#define tcg_gen_sari_tl tcg_gen_sari_i32
#define tcg_gen_brcond_tl tcg_gen_brcond_i32
+#define tcg_gen_mul_tl tcg_gen_mul_i32
+#define tcg_gen_muli_tl tcg_gen_muli_i32
+#define tcg_gen_discard_tl tcg_gen_discard_i32
+#define tcg_gen_trunc_tl_i32 tcg_gen_mov_i32
+#define tcg_gen_trunc_i64_tl tcg_gen_trunc_i64_i32
+#define tcg_gen_extu_i32_tl tcg_gen_mov_i32
+#define tcg_gen_ext_i32_tl tcg_gen_mov_i32
+#define tcg_gen_extu_tl_i64 tcg_gen_extu_i32_i64
+#define tcg_gen_ext_tl_i64 tcg_gen_ext_i32_i64
#define tcg_const_tl tcg_const_i32
#endif
+
+#if TCG_TARGET_REG_BITS == 32
+#define tcg_gen_addi_ptr tcg_gen_addi_i32
+#else /* TCG_TARGET_REG_BITS == 32 */
+#define tcg_gen_addi_ptr tcg_gen_addi_i64
+#endif /* TCG_TARGET_REG_BITS != 32 */
+