mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
tcg: Introduce movcond
Implemented with setcond if the target does not provide the optional opcode. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
080df491db
commit
ffc5ea09af
15 changed files with 70 additions and 6 deletions
40
tcg/tcg-op.h
40
tcg/tcg-op.h
|
@ -2118,6 +2118,44 @@ static inline void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1,
|
|||
tcg_temp_free_i64(t1);
|
||||
}
|
||||
|
||||
static inline void tcg_gen_movcond_i32(TCGCond cond, TCGv_i32 ret,
|
||||
TCGv_i32 c1, TCGv_i32 c2,
|
||||
TCGv_i32 v1, TCGv_i32 v2)
|
||||
{
|
||||
if (TCG_TARGET_HAS_movcond_i32) {
|
||||
tcg_gen_op6i_i32(INDEX_op_movcond_i32, ret, c1, c2, v1, v2, cond);
|
||||
} else {
|
||||
TCGv_i32 t0 = tcg_temp_new_i32();
|
||||
TCGv_i32 t1 = tcg_temp_new_i32();
|
||||
tcg_gen_setcond_i32(cond, t0, c1, c2);
|
||||
tcg_gen_neg_i32(t0, t0);
|
||||
tcg_gen_and_i32(t1, v1, t0);
|
||||
tcg_gen_andc_i32(ret, v2, t0);
|
||||
tcg_gen_or_i32(ret, ret, t1);
|
||||
tcg_temp_free_i32(t0);
|
||||
tcg_temp_free_i32(t1);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void tcg_gen_movcond_i64(TCGCond cond, TCGv_i64 ret,
|
||||
TCGv_i64 c1, TCGv_i64 c2,
|
||||
TCGv_i64 v1, TCGv_i64 v2)
|
||||
{
|
||||
if (TCG_TARGET_HAS_movcond_i64) {
|
||||
tcg_gen_op6i_i64(INDEX_op_movcond_i64, ret, c1, c2, v1, v2, cond);
|
||||
} else {
|
||||
TCGv_i64 t0 = tcg_temp_new_i64();
|
||||
TCGv_i64 t1 = tcg_temp_new_i64();
|
||||
tcg_gen_setcond_i64(cond, t0, c1, c2);
|
||||
tcg_gen_neg_i64(t0, t0);
|
||||
tcg_gen_and_i64(t1, v1, t0);
|
||||
tcg_gen_andc_i64(ret, v2, t0);
|
||||
tcg_gen_or_i64(ret, ret, t1);
|
||||
tcg_temp_free_i64(t0);
|
||||
tcg_temp_free_i64(t1);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
/* QEMU specific operations. Their type depend on the QEMU CPU
|
||||
type. */
|
||||
|
@ -2434,6 +2472,7 @@ static inline void tcg_gen_qemu_st64(TCGv_i64 arg, TCGv addr, int mem_index)
|
|||
#define tcg_gen_deposit_tl tcg_gen_deposit_i64
|
||||
#define tcg_const_tl tcg_const_i64
|
||||
#define tcg_const_local_tl tcg_const_local_i64
|
||||
#define tcg_gen_movcond_tl tcg_gen_movcond_i64
|
||||
#else
|
||||
#define tcg_gen_movi_tl tcg_gen_movi_i32
|
||||
#define tcg_gen_mov_tl tcg_gen_mov_i32
|
||||
|
@ -2505,6 +2544,7 @@ static inline void tcg_gen_qemu_st64(TCGv_i64 arg, TCGv addr, int mem_index)
|
|||
#define tcg_gen_deposit_tl tcg_gen_deposit_i32
|
||||
#define tcg_const_tl tcg_const_i32
|
||||
#define tcg_const_local_tl tcg_const_local_i32
|
||||
#define tcg_gen_movcond_tl tcg_gen_movcond_i32
|
||||
#endif
|
||||
|
||||
#if TCG_TARGET_REG_BITS == 32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue