]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tcg: Introduce tcg_zero_i128()
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 19 May 2026 18:39:21 +0000 (20:39 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Thu, 21 May 2026 06:20:58 +0000 (08:20 +0200)
Extract tcg_zero_i128() helper for re-use.

Inspired-by: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260520121644.10835-1-philmd@linaro.org>
[rth: Move the function to tcg-op.c]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
include/tcg/tcg-op-common.h
target/arm/tcg/translate-a64.c
tcg/tcg-op.c

index e02f209c093fdb926327f8351ee310869ab6939c..aff99754160ab1c29194858ce2630c7f1a22472c 100644 (file)
@@ -18,6 +18,8 @@ TCGv_vaddr tcg_constant_vaddr(uintptr_t val);
 TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val);
 TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val);
 
+TCGv_i128 tcg_zero_i128(void);
+
 TCGv_i32 tcg_temp_new_i32(void);
 TCGv_i64 tcg_temp_new_i64(void);
 TCGv_ptr tcg_temp_new_ptr(void);
index 9a27c4c6ec7ee6b13237d089d490e8116d62145b..3e3971db3fb9273d75b445124224b2691f53e544 100644 (file)
@@ -4804,13 +4804,10 @@ static bool do_STG(DisasContext *s, arg_ldst_tag *a, bool is_zero, bool is_pair)
 
     if (is_zero) {
         TCGv_i64 clean_addr = clean_data_tbi(s, addr);
-        TCGv_i64 zero64 = tcg_constant_i64(0);
-        TCGv_i128 zero128 = tcg_temp_new_i128();
+        TCGv_i128 zero128 = tcg_zero_i128();
         int mem_index = get_mem_index(s);
         MemOp mop = finalize_memop(s, MO_128 | MO_ALIGN);
 
-        tcg_gen_concat_i64_i128(zero128, zero64, zero64);
-
         /* This is 1 or 2 atomic 16-byte operations. */
         tcg_gen_qemu_st_i128(zero128, clean_addr, mem_index, mop);
         if (is_pair) {
index d8ae57d6047d867d6653cc80c2e71868807fcee2..971ac2fb359fee1fabcb8bf3e1d013243f590fef 100644 (file)
@@ -2475,6 +2475,16 @@ void tcg_gen_concat_i64_i128(TCGv_i128 ret, TCGv_i64 lo, TCGv_i64 hi)
     tcg_gen_mov_i64(TCGV128_HIGH(ret), hi);
 }
 
+TCGv_i128 tcg_zero_i128(void)
+{
+    TCGv_i64 zero64 = tcg_constant_i64(0);
+    TCGv_i128 zero128 = tcg_temp_new_i128();
+
+    tcg_gen_concat_i64_i128(zero128, zero64, zero64);
+
+    return zero128;
+}
+
 void tcg_gen_mov_i128(TCGv_i128 dst, TCGv_i128 src)
 {
     if (dst != src) {