public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226]
@ 2022-10-12 17:29 Andre Vieira (lists)
  2022-10-13  8:15 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Vieira (lists) @ 2022-10-12 17:29 UTC (permalink / raw)
  To: gcc-patches; +Cc: Richard Sandiford, Richard Biener

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

Hi,

The original patch supported matching the 
vect_recog_bitfield_ref_pattern for
BITFIELD_REF's where the first operand didn't have a INTEGRAL_TYPE_P type.
That means it would also match vectors, leading to regressions in 
targets that
supported vectorization of those.

Bootstrappend and regression tested on aarch64-none-linux-gnu and 
x86_64-pc-linux-gnu.

gcc/ChangeLog:

         PR tree-optimization/107226
         * tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Reject
         BITFIELD_REF's with non integral typed first operands.

[-- Attachment #2: PR107226.patch --]
[-- Type: text/plain, Size: 1774 bytes --]

diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index 0cc315d312667c05a27df4cdf435f0d0e6fd4a52..6afd57a50c4bcb5aec7ccca6e5dc069caa4a5a30 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -1913,6 +1913,7 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info,
     return NULL;
 
   if (!INTEGRAL_TYPE_P (TREE_TYPE (bf_ref))
+      || !INTEGRAL_TYPE_P (TREE_TYPE (container))
       || TYPE_MODE (TREE_TYPE (container)) == E_BLKmode)
     return NULL;
 
@@ -1921,25 +1922,7 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info,
   tree ret = gimple_assign_lhs (first_stmt);
   tree ret_type = TREE_TYPE (ret);
   bool shift_first = true;
-  tree vectype;
-
-  /* If the first operand of the BIT_FIELD_REF is not an INTEGER type, convert
-     it to one of the same width so we can perform the necessary masking and
-     shifting.  */
-  if (!INTEGRAL_TYPE_P (TREE_TYPE (container)))
-    {
-      unsigned HOST_WIDE_INT container_size =
-	tree_to_uhwi (TYPE_SIZE (TREE_TYPE (container)));
-      tree int_type = build_nonstandard_integer_type (container_size, true);
-      pattern_stmt
-	= gimple_build_assign (vect_recog_temp_ssa_var (int_type),
-			       VIEW_CONVERT_EXPR, container);
-      vectype = get_vectype_for_scalar_type (vinfo, int_type);
-      container = gimple_assign_lhs (pattern_stmt);
-      append_pattern_def_seq (vinfo, stmt_info, pattern_stmt, vectype);
-    }
-  else
-    vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (container));
+  tree vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (container));
 
   /* We move the conversion earlier if the loaded type is smaller than the
      return type to enable the use of widening loads.  */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226]
  2022-10-12 17:29 vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226] Andre Vieira (lists)
@ 2022-10-13  8:15 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-10-13  8:15 UTC (permalink / raw)
  To: Andre Vieira (lists); +Cc: gcc-patches, Richard Sandiford

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

On Wed, 12 Oct 2022, Andre Vieira (lists) wrote:

> Hi,
> 
> The original patch supported matching the vect_recog_bitfield_ref_pattern for
> BITFIELD_REF's where the first operand didn't have a INTEGRAL_TYPE_P type.
> That means it would also match vectors, leading to regressions in targets that
> supported vectorization of those.
> 
> Bootstrappend and regression tested on aarch64-none-linux-gnu and
> x86_64-pc-linux-gnu.

OK.

Richard.

> gcc/ChangeLog:
> 
>         PR tree-optimization/107226
>         * tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Reject
>         BITFIELD_REF's with non integral typed first operands.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-13  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 17:29 vect: Don't pattern match BITFIELD_REF's of non-integrals [PR107226] Andre Vieira (lists)
2022-10-13  8:15 ` Richard Biener

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).