public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111115] New: Failure to vectorize conditional grouped store
@ 2023-08-23  9:50 rguenth at gcc dot gnu.org
  2023-08-23 12:35 ` [Bug tree-optimization/111115] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-23  9:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111115

            Bug ID: 111115
           Summary: Failure to vectorize conditional grouped store
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

void foo (float * __restrict x, int *flag)
{
  for (int i = 0; i < 512; ++i)
    {
      if (flag[i])
        {
          float a = x[2*i+0] + 3.f;
          float b = x[2*i+1] + 177.f;
          x[2*i+0] = a;
          x[2*i+1] = b;
        }
    }
}

fails to vectorize on x86_64 with -march=znver4 (it needs masked stores
enabled by tuning).  This is because we do not support VMAT_CONTIGUOUS_PERMUTE
for either .MASK_LOAD nor .MASK_STORE.  Simply enabling that shows we fail
to properly handle the mask part.

The proper solution is to handle them in SLP which they are not either.

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

* [Bug tree-optimization/111115] Failure to vectorize conditional grouped store
  2023-08-23  9:50 [Bug tree-optimization/111115] New: Failure to vectorize conditional grouped store rguenth at gcc dot gnu.org
@ 2023-08-23 12:35 ` rguenth at gcc dot gnu.org
  2023-08-24  9:40 ` cvs-commit at gcc dot gnu.org
  2023-08-24  9:40 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-23 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111115

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2023-08-23

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I have a patch.

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

* [Bug tree-optimization/111115] Failure to vectorize conditional grouped store
  2023-08-23  9:50 [Bug tree-optimization/111115] New: Failure to vectorize conditional grouped store rguenth at gcc dot gnu.org
  2023-08-23 12:35 ` [Bug tree-optimization/111115] " rguenth at gcc dot gnu.org
@ 2023-08-24  9:40 ` cvs-commit at gcc dot gnu.org
  2023-08-24  9:40 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-24  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111115

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:a1558e9ad856938f165f838733955b331ebbec09

commit r14-3441-ga1558e9ad856938f165f838733955b331ebbec09
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Aug 23 14:28:26 2023 +0200

    tree-optimization/111115 - SLP of masked stores

    The following adds the capability to do SLP on .MASK_STORE, I do not
    plan to add interleaving support.

            PR tree-optimization/111115
    gcc/
            * tree-vectorizer.h (vect_slp_child_index_for_operand): New.
            * tree-vect-data-refs.cc (can_group_stmts_p): Also group
            .MASK_STORE.
            * tree-vect-slp.cc (arg3_arg2_map): New.
            (vect_get_operand_map): Handle IFN_MASK_STORE.
            (vect_slp_child_index_for_operand): New function.
            (vect_build_slp_tree_1): Handle statements with no LHS,
            masked store ifns.
            (vect_remove_slp_scalar_calls): Likewise.
            * tree-vect-stmts.cc (vect_check_store_rhs): Lookup the
            SLP child corresponding to the ifn value index.
            (vectorizable_store): Likewise for the mask index.  Support
            masked stores.
            (vectorizable_load): Lookup the SLP child corresponding to the
            ifn mask index.

    gcc/testsuite/
            * lib/target-supports.exp
(check_effective_target_vect_masked_store):
            Supported with check_avx_available.
            * gcc.dg/vect/slp-mask-store-1.c: New testcase.

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

* [Bug tree-optimization/111115] Failure to vectorize conditional grouped store
  2023-08-23  9:50 [Bug tree-optimization/111115] New: Failure to vectorize conditional grouped store rguenth at gcc dot gnu.org
  2023-08-23 12:35 ` [Bug tree-optimization/111115] " rguenth at gcc dot gnu.org
  2023-08-24  9:40 ` cvs-commit at gcc dot gnu.org
@ 2023-08-24  9:40 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-08-24  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111115

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for GCC 14.

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

end of thread, other threads:[~2023-08-24  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23  9:50 [Bug tree-optimization/111115] New: Failure to vectorize conditional grouped store rguenth at gcc dot gnu.org
2023-08-23 12:35 ` [Bug tree-optimization/111115] " rguenth at gcc dot gnu.org
2023-08-24  9:40 ` cvs-commit at gcc dot gnu.org
2023-08-24  9:40 ` rguenth at gcc dot gnu.org

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