tcg: Restrict check_size_impl to multiples of the line size

Normally this is automatic in the size restrictions that are placed
on vector sizes coming from the implementation. However, for the
legitimate size tuple [oprsz=8, maxsz=32], we need to clear the final
24 bytes of the vector register. Without this check, do_dup selects
TCG_TYPE_V128 and clears only 16 bytes.

Backports commit 499748d7683198a765d17b4fdf6901ab9dca920c from qemu
This commit is contained in:
Richard Henderson 2018-07-09 16:41:50 -04:00 committed by Lioncash
parent 0fb2742a4a
commit f1aaf5be62
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -287,8 +287,11 @@ void tcg_gen_gvec_4_ptr(TCGContext *s, uint32_t dofs, uint32_t aofs, uint32_t bo
in units of LNSZ. This limits the expansion of inline code. */ in units of LNSZ. This limits the expansion of inline code. */
static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz) static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz)
{ {
uint32_t lnct = oprsz / lnsz; if (oprsz % lnsz == 0) {
return lnct >= 1 && lnct <= MAX_UNROLL; uint32_t lnct = oprsz / lnsz;
return lnct >= 1 && lnct <= MAX_UNROLL;
}
return false;
} }
static void expand_clr(TCGContext *s, uint32_t dofs, uint32_t maxsz); static void expand_clr(TCGContext *s, uint32_t dofs, uint32_t maxsz);