tcg: Fix generation of dupi_vec for 32-bit host

The definition of INDEX_op_dupi_vec is that it operates on
units of tcg_target_ulong -- in this case 32 bits. It does
not work to use this for a uint64_t value that happens to be
small enough to fit in tcg_target_ulong.

Backports a5b30d950c42b14bc9da24d1e68add6538d23336
This commit is contained in:
Richard Henderson 2021-03-01 19:45:29 -05:00 committed by Lioncash
parent 578673be68
commit 456fb66617

View file

@ -254,10 +254,10 @@ TCGv_vec tcg_const_ones_vec_matching(TCGContext *s, TCGv_vec m)
void tcg_gen_dup64i_vec(TCGContext *s, TCGv_vec r, uint64_t a)
{
if (TCG_TARGET_REG_BITS == 32 && a == deposit64(a, 32, 32, a)) {
do_dupi_vec(s, r, MO_32, a);
} else if (TCG_TARGET_REG_BITS == 64 || a == (uint64_t)(int32_t)a) {
if (TCG_TARGET_REG_BITS == 64) {
do_dupi_vec(s, r, MO_64, a);
} else if (a == dup_const(MO_32, a)) {
do_dupi_vec(s, r, MO_32, a);
} else {
TCGv_i64 c = tcg_const_i64(s, a);
tcg_gen_dup_i64_vec(s, MO_64, r, c);
@ -282,7 +282,11 @@ void tcg_gen_dup8i_vec(TCGContext *s, TCGv_vec r, uint32_t a)
void tcg_gen_dupi_vec(TCGContext *s, unsigned vece, TCGv_vec r, uint64_t a)
{
do_dupi_vec(s, r, MO_REG, dup_const(vece, a));
if (vece == MO_64) {
tcg_gen_dup64i_vec(s, r, a);
} else {
do_dupi_vec(s, r, MO_REG, dup_const(vece, a));
}
}
void tcg_gen_dup_i64_vec(TCGContext *s, unsigned vece, TCGv_vec r, TCGv_i64 a)