On 2021/6/11 上午3:39, Richard Henderson wrote:
On 6/10/21 12:58 AM, LIU Zhiwei wrote:
include/tcg/tcg-op-gvec.h | 6 ++
tcg/tcg-op-gvec.c | 47 ++++++++++++++++
Likewise, should be split from the larger patch.
+static void gen_addv_mask_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b,
TCGv_i32 m)
+{
+ 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_add8_i32(TCGv_i32 d, TCGv_i32 a, TCGv_i32 b)
+{
+ TCGv_i32 m = tcg_constant_i32((int32_t)dup_const(MO_8, 0x80));
+ gen_addv_mask_i32(d, a, b, m);
+}
There will only ever be one use; we might as well merge them.
OK
The cast is unnecessary.
I meet compiler error report without cast. So I just keep it.
../tcg/tcg-op-gvec.c: In function ‘tcg_gen_vec_sub8_i32’:
/home/roman/git/qemu/include/tcg/tcg.h:1327:5: error: overflow in implicit
constant conversion [-Werror=overflow]
(__builtin_constant_p(VECE) \
^
../tcg/tcg-op-gvec.c:1947:35: note: in expansion of macro ‘dup_const’
TCGv_i32 m = tcg_constant_i32(dup_const(MO_8, 0x80));
^~~~~~~~~
cc1: all warnings being treated as errors
Thanks,
Zhiwei
r~