public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: richard.sandiford@arm.com
Subject: [PATCH 1/3] Inline vect_get_max_nscalars_per_iter
Date: Wed, 14 Jun 2023 11:47:10 +0000 (UTC)	[thread overview]
Message-ID: <20230614114710.ong9fkiihdrznOlbW1mkA-BxQ4aYBY0DXKtmx1KafcI@z> (raw)

The function is only meaningful for LOOP_VINFO_MASKS processing so
inline it into the single use.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?

	* tree-vect-loop.cc (vect_get_max_nscalars_per_iter): Inline
	into ...
	(vect_verify_full_masking): ... this.
---
 gcc/tree-vect-loop.cc | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index ace9e759f5b..a9695e5b25d 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -1117,20 +1117,6 @@ can_produce_all_loop_masks_p (loop_vec_info loop_vinfo, tree cmp_type)
   return true;
 }
 
-/* Calculate the maximum number of scalars per iteration for every
-   rgroup in LOOP_VINFO.  */
-
-static unsigned int
-vect_get_max_nscalars_per_iter (loop_vec_info loop_vinfo)
-{
-  unsigned int res = 1;
-  unsigned int i;
-  rgroup_controls *rgm;
-  FOR_EACH_VEC_ELT (LOOP_VINFO_MASKS (loop_vinfo), i, rgm)
-    res = MAX (res, rgm->max_nscalars_per_iter);
-  return res;
-}
-
 /* Calculate the minimum precision necessary to represent:
 
       MAX_NITERS * FACTOR
@@ -1210,8 +1196,6 @@ static bool
 vect_verify_full_masking (loop_vec_info loop_vinfo)
 {
   unsigned int min_ni_width;
-  unsigned int max_nscalars_per_iter
-    = vect_get_max_nscalars_per_iter (loop_vinfo);
 
   /* Use a normal loop if there are no statements that need masking.
      This only happens in rare degenerate cases: it means that the loop
@@ -1219,6 +1203,12 @@ vect_verify_full_masking (loop_vec_info loop_vinfo)
   if (LOOP_VINFO_MASKS (loop_vinfo).is_empty ())
     return false;
 
+  /* Calculate the maximum number of scalars per iteration for every rgroup.  */
+  unsigned int max_nscalars_per_iter = 1;
+  for (auto rgm : LOOP_VINFO_MASKS (loop_vinfo))
+    max_nscalars_per_iter
+      = MAX (max_nscalars_per_iter, rgm.max_nscalars_per_iter);
+
   /* Work out how many bits we need to represent the limit.  */
   min_ni_width
     = vect_min_prec_for_max_niters (loop_vinfo, max_nscalars_per_iter);
-- 
2.35.3


             reply	other threads:[~2023-06-14 11:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 11:47 Richard Biener [this message]
     [not found] <20230614114802.BED073858288@sourceware.org>
2023-06-14 13:21 ` Richard Sandiford
2023-06-14 13:46   ` Richard Biener
2023-06-14 19:43     ` Richard Sandiford

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=20230614114710.ong9fkiihdrznOlbW1mkA-BxQ4aYBY0DXKtmx1KafcI@z \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    /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).