public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tamar Christina <tnfchris@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-4033] middle-end: Fix addsub patch removing return statements
Date: Mon, 14 Nov 2022 20:10:24 +0000 (GMT)	[thread overview]
Message-ID: <20221114201024.A040C385840C@sourceware.org> (raw)

https://gcc.gnu.org/g:2044cf2d6591f7e80411141cbb81b135fa1eca1b

commit r13-4033-g2044cf2d6591f7e80411141cbb81b135fa1eca1b
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Mon Nov 14 20:09:07 2022 +0000

    middle-end: Fix addsub patch removing return statements
    
    My recent patch had return statements in the match.pd expressions
    which were recently outlawed.. Unfornately I didn't rebase this
    patch before committing so this broke the build.
    
    I've just reflowed the conditions to avoid the returns.
    
    gcc/ChangeLog:
    
            * match.pd: Remove returns.

Diff:
---
 gcc/match.pd | 78 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 421278df007..0476753ee18 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -7931,51 +7931,51 @@ and,
    {
      /* Build a vector of integers from the tree mask.  */
      vec_perm_builder builder;
-     if (!tree_to_vec_perm_builder (&builder, @2))
-       return NULL_TREE;
-
-     /* Create a vec_perm_indices for the integer vector.  */
-     poly_uint64 nelts = TYPE_VECTOR_SUBPARTS (type);
-     vec_perm_indices sel (builder, 2, nelts);
    }
-   (if (sel.series_p (0, 2, 0, 2))
+   (if (tree_to_vec_perm_builder (&builder, @2))
     (with
      {
+       /* Create a vec_perm_indices for the integer vector.  */
+       poly_uint64 nelts = TYPE_VECTOR_SUBPARTS (type);
+       vec_perm_indices sel (builder, 2, nelts);
        machine_mode vec_mode = TYPE_MODE (type);
        machine_mode wide_mode;
-       if (!GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode)
-	   || !VECTOR_MODE_P (wide_mode)
-	   || (GET_MODE_UNIT_BITSIZE (vec_mode) * 2
-		!= GET_MODE_UNIT_BITSIZE (wide_mode)))
-	 return NULL_TREE;
-
-       tree stype = lang_hooks.types.type_for_mode (GET_MODE_INNER (wide_mode),
-						    TYPE_UNSIGNED (type));
-       if (TYPE_MODE (stype) == BLKmode)
-	 return NULL_TREE;
-       tree ntype = build_vector_type_for_mode (stype, wide_mode);
-       if (!VECTOR_TYPE_P (ntype))
-	 return NULL_TREE;
-
-       /* The format has to be a non-extended ieee format.  */
-       const struct real_format *fmt_old = FLOAT_MODE_FORMAT (vec_mode);
-       const struct real_format *fmt_new = FLOAT_MODE_FORMAT (wide_mode);
-       if (fmt_old == NULL || fmt_new == NULL)
-	 return NULL_TREE;
-
-       /* If the target doesn't support v1xx vectors, try using scalar mode xx
-	  instead.  */
-       if (known_eq (GET_MODE_NUNITS (wide_mode), 1)
-	   && !target_supports_op_p (ntype, NEGATE_EXPR, optab_vector))
-	 ntype = stype;
      }
-     (if (fmt_new->signbit_rw
-	     == fmt_old->signbit_rw + GET_MODE_UNIT_BITSIZE (vec_mode)
-	  && fmt_new->signbit_rw == fmt_new->signbit_ro
-	  && targetm.can_change_mode_class (TYPE_MODE (ntype), TYPE_MODE (type), ALL_REGS)
-	  && ((optimize_vectors_before_lowering_p () && VECTOR_TYPE_P (ntype))
-	      || target_supports_op_p (ntype, NEGATE_EXPR, optab_vector)))
-      (plus (view_convert:type (negate (view_convert:ntype @1))) @0)))))))
+     (if (sel.series_p (0, 2, 0, 2)
+          && GET_MODE_WIDER_MODE (vec_mode).exists (&wide_mode)
+	  && VECTOR_MODE_P (wide_mode)
+	  && (GET_MODE_UNIT_BITSIZE (vec_mode) * 2
+	      == GET_MODE_UNIT_BITSIZE (wide_mode)))
+	(with
+	 {
+	   tree stype
+	     = lang_hooks.types.type_for_mode (GET_MODE_INNER (wide_mode),
+					       TYPE_UNSIGNED (type));
+	   tree ntype = build_vector_type_for_mode (stype, wide_mode);
+
+	   /* The format has to be a non-extended ieee format.  */
+	   const struct real_format *fmt_old = FLOAT_MODE_FORMAT (vec_mode);
+	   const struct real_format *fmt_new = FLOAT_MODE_FORMAT (wide_mode);
+	 }
+	 (if (TYPE_MODE (stype) != BLKmode
+	      && VECTOR_TYPE_P (ntype)
+	      && fmt_old != NULL
+	      && fmt_new != NULL)
+	  (with
+	   {
+	     /* If the target doesn't support v1xx vectors, try using
+		scalar mode xx instead.  */
+	    if (known_eq (GET_MODE_NUNITS (wide_mode), 1)
+		&& !target_supports_op_p (ntype, NEGATE_EXPR, optab_vector))
+	      ntype = stype;
+	   }
+	   (if (fmt_new->signbit_rw
+	        == fmt_old->signbit_rw + GET_MODE_UNIT_BITSIZE (vec_mode)
+		&& fmt_new->signbit_rw == fmt_new->signbit_ro
+		&& targetm.can_change_mode_class (TYPE_MODE (ntype), TYPE_MODE (type), ALL_REGS)
+		&& ((optimize_vectors_before_lowering_p () && VECTOR_TYPE_P (ntype))
+		    || target_supports_op_p (ntype, NEGATE_EXPR, optab_vector)))
+	    (plus (view_convert:type (negate (view_convert:ntype @1))) @0)))))))))))
 
 (simplify
  (vec_perm @0 @1 VECTOR_CST@2)

                 reply	other threads:[~2022-11-14 20:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114201024.A040C385840C@sourceware.org \
    --to=tnfchris@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).