dup_const replicates a constant by element size. Define it next to tcg_constant_vec in tcg.c and drop the copy in tcg-op-gvec.c.
Signed-off-by: Yonggang Luo <[email protected]> --- tcg/tcg-op-gvec.c | 17 ----------------- tcg/tcg.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 0d649cc13b2..c30b9d5d6fc 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -417,23 +417,6 @@ static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz) static void expand_clr(TCGv_ptr dbase, uint32_t dofs, uint32_t maxsz); -/* Duplicate C as per VECE. */ -uint64_t (dup_const)(unsigned vece, uint64_t c) -{ - switch (vece) { - case MO_8: - return 0x0101010101010101ull * (uint8_t)c; - case MO_16: - return 0x0001000100010001ull * (uint16_t)c; - case MO_32: - return 0x0000000100000001ull * (uint32_t)c; - case MO_64: - return c; - default: - g_assert_not_reached(); - } -} - /* Duplicate IN into OUT as per VECE. */ void tcg_gen_dup_i32(unsigned vece, TCGv_i32 out, TCGv_i32 in) { diff --git a/tcg/tcg.c b/tcg/tcg.c index ba2a1127f92..6362eef36bd 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2287,6 +2287,23 @@ TCGv_ptr tcg_constant_ptr_int(intptr_t val) return temp_tcgv_ptr(tcg_constant_internal(TCG_TYPE_PTR, val)); } +/* Duplicate C as per VECE. */ +uint64_t (dup_const)(unsigned vece, uint64_t c) +{ + switch (vece) { + case MO_8: + return 0x0101010101010101ull * (uint8_t)c; + case MO_16: + return 0x0001000100010001ull * (uint16_t)c; + case MO_32: + return 0x0000000100000001ull * (uint32_t)c; + case MO_64: + return c; + default: + g_assert_not_reached(); + } +} + TCGv_vec tcg_constant_vec(TCGType type, unsigned vece, int64_t val) { val = dup_const(vece, val); -- 2.52.0.windows.1
