]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Call simplify_gen_subreg to simplify subreg of vec_merge
authorH.J. Lu <hongjiu.lu@intel.com>
Thu, 18 Oct 2018 12:34:13 +0000 (12:34 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Thu, 18 Oct 2018 12:34:13 +0000 (05:34 -0700)
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
gcc/simplify-rtx.c

index 2cc497ecc8710ffe6f8d1dfb6beebf632def3595..87519ad674ce74d3c6ec48e4f89dbd711278656e 100644 (file)
@@ -1,3 +1,8 @@
+2018-10-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * simplify-rtx.c (simplify_subreg): Call simplify_gen_subreg
+       to simplify subreg of vec_merge.
+
 2018-10-18  Richard Biener  <rguenther@suse.de>
 
        * config/i386/i386.c: Fix costing of vector FMA.
index b0cf3bbb2a91fc866b3011279d3b47324aedf941..ccf92166356597fd43e9c85d333a83f4c4e40688 100644 (file)
@@ -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.  */