From 4be4ca57b138b03c7f549d8418aa0d16f4c9f7b1 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 11 May 2020 17:22:45 -0400 Subject: [PATCH] target/arm: Fix tcg_gen_gvec_dup_imm vs DUP (indexed) DUP (indexed) can duplicate 128-bit elements, so using esz unconditionally can assert in tcg_gen_gvec_dup_imm. Fixes: 8711e71f9cbb Backports commit 7e17d50ebd359ee5fa3d65d7fdc0fe0336d60694 from qemu --- qemu/target/arm/translate-sve.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qemu/target/arm/translate-sve.c b/qemu/target/arm/translate-sve.c index 58f1a995..4d30fd1f 100644 --- a/qemu/target/arm/translate-sve.c +++ b/qemu/target/arm/translate-sve.c @@ -2159,7 +2159,11 @@ static bool trans_DUP_x(DisasContext *s, arg_DUP_x *a) unsigned nofs = vec_reg_offset(s, a->rn, index, esz); tcg_gen_gvec_dup_mem(tcg_ctx, esz, dofs, nofs, vsz, vsz); } else { - tcg_gen_gvec_dup_imm(tcg_ctx, esz, dofs, vsz, vsz, 0); + /* + * While dup_mem handles 128-bit elements, dup_imm does not. + * Thankfully element size doesn't matter for splatting zero. + */ + tcg_gen_gvec_dup_imm(tcg_ctx, MO_64, dofs, vsz, vsz, 0); } } return true;