diff mbox series

[v2,4/4] target/arm: Fix tcg_gen_gvec_dup_imm vs DUP (indexed)

Message ID 20200507172352.15418-5-richard.henderson@linaro.org
State Superseded
Headers show
Series target/arm: Misc cleanups | expand

Commit Message

Richard Henderson May 7, 2020, 5:23 p.m. UTC
DUP (indexed) can duplicate 128-bit elements, so using esz
unconditionally can assert in tcg_gen_gvec_dup_imm.

Fixes: 8711e71f9cbb
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/translate-sve.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

-- 
2.20.1

Comments

Laurent Desnogues May 7, 2020, 6:06 p.m. UTC | #1
On Thu, May 7, 2020 at 7:23 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> DUP (indexed) can duplicate 128-bit elements, so using esz

> unconditionally can assert in tcg_gen_gvec_dup_imm.

>

> Fixes: 8711e71f9cbb

> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>


I had the same fix locally.

Thanks,

Laurent


> ---

>  target/arm/translate-sve.c | 6 +++++-

>  1 file changed, 5 insertions(+), 1 deletion(-)

>

> diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c

> index c8649283be..83614e9e70 100644

> --- a/target/arm/translate-sve.c

> +++ b/target/arm/translate-sve.c

> @@ -2044,7 +2044,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(esz, dofs, nofs, vsz, vsz);

>          } else {

> -            tcg_gen_gvec_dup_imm(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(MO_64, dofs, vsz, vsz, 0);

>          }

>      }

>      return true;

> --

> 2.20.1

>
diff mbox series

Patch

diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index c8649283be..83614e9e70 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -2044,7 +2044,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(esz, dofs, nofs, vsz, vsz);
         } else {
-            tcg_gen_gvec_dup_imm(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(MO_64, dofs, vsz, vsz, 0);
         }
     }
     return true;