Message ID | 20210614151007.4545-22-peter.maydell@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | target/arm: First slice of MVE implementation | expand |
On 6/14/21 8:09 AM, Peter Maydell wrote: > The Arm MVE VDUP implementation would like to be able to emit code to > duplicate a byte or halfword value into an i32. We have code to do > this already in tcg-op-gvec.c, so all we need to do is change the > function from static to global. > > For consistency, expose both the _i32 and _i64 forms. > > Suggested-by: Richard Henderson <richard.henderson@linaro.org> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org> > --- > I picked tcg.h just because that's where dup_const (defined > next to gen_dup_i32() and gen_dup_i64()) has its prototype. > Happy to move the prototypes elsewhere. I would definitely rename them to tcg_gen_*. I would put the declarations in either tcg-op.h, with the other scalar tcg_gen_* functions, or at the end of tcg-op-gvec.h, with the other vector-related but still scalar functions. Otherwise, Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 064dab383bc..018f8965f81 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1331,6 +1331,9 @@ uint64_t dup_const(unsigned vece, uint64_t c); : (qemu_build_not_reached_always(), 0)) \ : dup_const(VECE, C)) +/* Replicate a value of size @vece from @in to all the lanes in @out */ +void gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in); +void gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in); /* * Memory helpers that will be used by TCG generated code. diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 498a959839f..abe9e07116d 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -386,7 +386,7 @@ uint64_t (dup_const)(unsigned vece, uint64_t c) } /* Duplicate IN into OUT as per VECE. */ -static void gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in) +void gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in) { switch (vece) { case MO_8: @@ -404,7 +404,7 @@ static void gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in) } } -static void gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in) +void gen_dup_i64(unsigned vece, TCGv_i64 out, TCGv_i64 in) { switch (vece) { case MO_8:
The Arm MVE VDUP implementation would like to be able to emit code to duplicate a byte or halfword value into an i32. We have code to do this already in tcg-op-gvec.c, so all we need to do is change the function from static to global. For consistency, expose both the _i32 and _i64 forms. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- I picked tcg.h just because that's where dup_const (defined next to gen_dup_i32() and gen_dup_i64()) has its prototype. Happy to move the prototypes elsewhere. --- include/tcg/tcg.h | 3 +++ tcg/tcg-op-gvec.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)