From aff3ce41c4abecead6d05a0422d912468d2c893c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 18 Oct 2018 12:34:13 +0000 Subject: [PATCH] Call simplify_gen_subreg to simplify subreg of vec_merge Simplify (subreg (vec_merge (X) (vector) (const_int ((1 << N) | M))) (N * sizeof (outermode))) to (subreg (X) (N * sizeof (outermode))) * simplify-rtx.c (simplify_subreg): Call simplify_gen_subreg to simplify subreg of vec_merge. From-SVN: r265267 --- gcc/ChangeLog | 5 +++++ gcc/simplify-rtx.c | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2cc497ecc87..87519ad674c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-10-18 H.J. Lu + + * simplify-rtx.c (simplify_subreg): Call simplify_gen_subreg + to simplify subreg of vec_merge. + 2018-10-18 Richard Biener * config/i386/i386.c: Fix costing of vector FMA. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index b0cf3bbb2a9..ccf92166356 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -6601,20 +6601,21 @@ simplify_subreg (machine_mode outermode, rtx op, return NULL_RTX; } - /* Return X for - (subreg (vec_merge (vec_duplicate X) + /* Simplify + (subreg (vec_merge (X) (vector) (const_int ((1 << N) | M))) - (N * sizeof (X))) + (N * sizeof (outermode))) + to + (subreg (X) (N * sizeof (outermode))) */ unsigned int idx; if (constant_multiple_p (byte, GET_MODE_SIZE (outermode), &idx) && GET_CODE (op) == VEC_MERGE - && GET_CODE (XEXP (op, 0)) == VEC_DUPLICATE - && GET_MODE (XEXP (XEXP (op, 0), 0)) == outermode + && GET_MODE_INNER (innermode) == outermode && CONST_INT_P (XEXP (op, 2)) && (UINTVAL (XEXP (op, 2)) & (HOST_WIDE_INT_1U << idx)) != 0) - return XEXP (XEXP (op, 0), 0); + return simplify_gen_subreg (outermode, XEXP (op, 0), innermode, byte); /* A SUBREG resulting from a zero extension may fold to zero if it extracts higher bits that the ZERO_EXTEND's source bits. */ -- 2.30.2