From: H.J. Lu Date: Thu, 18 Oct 2018 21:29:55 +0000 (+0000) Subject: Limit mask of vec_merge to HOST_BITS_PER_WIDE_INT X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28dd75a330e7cc929a6be489ea3c252dd4a8bd8a;p=gcc.git Limit mask of vec_merge to HOST_BITS_PER_WIDE_INT Since mask of vec_merge is in HOST_WIDE_INT, HOST_BITS_PER_WIDE_INT is the maximum number of vector elements. * simplify-rtx.c (simplify_subreg): Limit mask of vec_merge to HOST_BITS_PER_WIDE_INT. (test_vector_ops_duplicate): Likewise. From-SVN: r265290 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e36ecd20e66..7c5f9dd4814 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-18 H.J. Lu + + * simplify-rtx.c (simplify_subreg): Limit mask of vec_merge to + HOST_BITS_PER_WIDE_INT. + (test_vector_ops_duplicate): Likewise. + 2018-10-18 H.J. Lu PR target/72782 diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index ccf92166356..2ff68ceb4e3 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -6611,6 +6611,7 @@ simplify_subreg (machine_mode outermode, rtx op, */ unsigned int idx; if (constant_multiple_p (byte, GET_MODE_SIZE (outermode), &idx) + && idx < HOST_BITS_PER_WIDE_INT && GET_CODE (op) == VEC_MERGE && GET_MODE_INNER (innermode) == outermode && CONST_INT_P (XEXP (op, 2)) @@ -6861,6 +6862,8 @@ test_vector_ops_duplicate (machine_mode mode, rtx scalar_reg) rtx vector_reg = make_test_reg (mode); for (unsigned HOST_WIDE_INT i = 0; i < const_nunits; i++) { + if (i >= HOST_BITS_PER_WIDE_INT) + break; rtx mask = GEN_INT ((HOST_WIDE_INT_1U << i) | (i + 1)); rtx vm = gen_rtx_VEC_MERGE (mode, duplicate, vector_reg, mask); poly_uint64 offset = i * GET_MODE_SIZE (inner_mode);