tcg: Add tcg_gen_vec_add{sub}8_i32
Implement tcg_gen_vec_add{sub}8_tl by adding corresponging i32 OP. Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Message-Id: <20210624105023.3852-3-zhiwei_liu@c-sky.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
3d066e5d80
commit
448e7aa28c
@ -402,14 +402,20 @@ void tcg_gen_vec_rotl8i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c);
|
||||
void tcg_gen_vec_rotl16i_i64(TCGv_i64 d, TCGv_i64 a, int64_t c);
|
||||
|
||||
/* 32-bit vector operations. */
|
||||
void tcg_gen_vec_add8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b);
|
||||
void tcg_gen_vec_add16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b);
|
||||
|
||||
void tcg_gen_vec_sub8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b);
|
||||
void tcg_gen_vec_sub16_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b);
|
||||
|
||||
#if TARGET_LONG_BITS == 64
|
||||
#define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i64
|
||||
#define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i64
|
||||
#define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i64
|
||||
#define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i64
|
||||
#else
|
||||
#define tcg_gen_vec_add8_tl tcg_gen_vec_add8_i32
|
||||
#define tcg_gen_vec_sub8_tl tcg_gen_vec_sub8_i32
|
||||
#define tcg_gen_vec_add16_tl tcg_gen_vec_add16_i32
|
||||
#define tcg_gen_vec_sub16_tl tcg_gen_vec_sub16_i32
|
||||
#endif
|
||||
|
@ -1736,6 +1736,25 @@ void tcg_gen_vec_add8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b)
|
||||
gen_addv_mask(d, a, b, m);
|
||||
}
|
||||
|
||||
void tcg_gen_vec_add8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b)
|
||||
{
|
||||
TCGv_i32 m = tcg_constant_i32((int32_t)dup_const(MO_8, 0x80));
|
||||
TCGv_i32 t1 = tcg_temp_new_i32();
|
||||
TCGv_i32 t2 = tcg_temp_new_i32();
|
||||
TCGv_i32 t3 = tcg_temp_new_i32();
|
||||
|
||||
tcg_gen_andc_i32(t1, a, m);
|
||||
tcg_gen_andc_i32(t2, b, m);
|
||||
tcg_gen_xor_i32(t3, a, b);
|
||||
tcg_gen_add_i32(d, t1, t2);
|
||||
tcg_gen_and_i32(t3, t3, m);
|
||||
tcg_gen_xor_i32(d, d, t3);
|
||||
|
||||
tcg_temp_free_i32(t1);
|
||||
tcg_temp_free_i32(t2);
|
||||
tcg_temp_free_i32(t3);
|
||||
}
|
||||
|
||||
void tcg_gen_vec_add16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b)
|
||||
{
|
||||
TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000));
|
||||
@ -1900,6 +1919,25 @@ void tcg_gen_vec_sub8_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b)
|
||||
gen_subv_mask(d, a, b, m);
|
||||
}
|
||||
|
||||
void tcg_gen_vec_sub8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b)
|
||||
{
|
||||
TCGv_i32 m = tcg_constant_i32((int32_t)dup_const(MO_8, 0x80));
|
||||
TCGv_i32 t1 = tcg_temp_new_i32();
|
||||
TCGv_i32 t2 = tcg_temp_new_i32();
|
||||
TCGv_i32 t3 = tcg_temp_new_i32();
|
||||
|
||||
tcg_gen_or_i32(t1, a, m);
|
||||
tcg_gen_andc_i32(t2, b, m);
|
||||
tcg_gen_eqv_i32(t3, a, b);
|
||||
tcg_gen_sub_i32(d, t1, t2);
|
||||
tcg_gen_and_i32(t3, t3, m);
|
||||
tcg_gen_xor_i32(d, d, t3);
|
||||
|
||||
tcg_temp_free_i32(t1);
|
||||
tcg_temp_free_i32(t2);
|
||||
tcg_temp_free_i32(t3);
|
||||
}
|
||||
|
||||
void tcg_gen_vec_sub16_i64(TCGv_i64 d, TCGv_i64 a, TCGv_i64 b)
|
||||
{
|
||||
TCGv_i64 m = tcg_constant_i64(dup_const(MO_16, 0x8000));
|
||||
|
Loading…
Reference in New Issue
Block a user