From b478ce5052054938d586c585369511ae798d369a Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 1 Mar 2021 18:06:06 -0500 Subject: [PATCH] tcg: Eliminate one store for in-place 128-bit dup_mem Do not store back to the exact memory from which we just loaded. Backports 6a17646176e011ddc463a2870a64c7aaccfe9c50 --- qemu/tcg/tcg-op-gvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/tcg/tcg-op-gvec.c b/qemu/tcg/tcg-op-gvec.c index 1e6ace72..809fef66 100644 --- a/qemu/tcg/tcg-op-gvec.c +++ b/qemu/tcg/tcg-op-gvec.c @@ -1582,7 +1582,7 @@ void tcg_gen_gvec_dup_mem(TCGContext *s, unsigned vece, uint32_t dofs, uint32_t TCGv_vec in = tcg_temp_new_vec(s, TCG_TYPE_V128); tcg_gen_ld_vec(s, in, s->cpu_env, aofs); - for (i = 0; i < oprsz; i += 16) { + for (i = (aofs == dofs) * 16; i < oprsz; i += 16) { tcg_gen_st_vec(s, in, s->cpu_env, dofs + i); } tcg_temp_free_vec(s, in); @@ -1592,7 +1592,7 @@ void tcg_gen_gvec_dup_mem(TCGContext *s, unsigned vece, uint32_t dofs, uint32_t tcg_gen_ld_i64(s, in0, s->cpu_env, aofs); tcg_gen_ld_i64(s, in1, s->cpu_env, aofs + 8); - for (i = 0; i < oprsz; i += 16) { + for (i = (aofs == dofs) * 16; i < oprsz; i += 16) { tcg_gen_st_i64(s, in0, s->cpu_env, dofs + i); tcg_gen_st_i64(s, in1, s->cpu_env, dofs + i + 8); }