Extract tcg_zero_i128() helper for re-use.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: <[email protected]>
[rth: Move the function to tcg-op.c]
Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 2 ++
target/arm/tcg/translate-a64.c | 5 +----
tcg/tcg-op.c | 10 ++++++++++
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index e02f209c093..aff99754160 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -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);
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 9a27c4c6ec7..3e3971db3fb 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -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) {
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index d8ae57d6047..971ac2fb359 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -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) {
--
2.53.0