public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/99409] s252 benchmark of TSVC is vectorized by clang and not by gcc
Date: Mon, 17 Oct 2022 10:36:59 +0000	[thread overview]
Message-ID: <bug-99409-4-ie0HujdQNk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99409-4@http.gcc.gnu.org/bugzilla/>

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

--- 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:46a8e017d048ec3271bbb898942e3b166c4e8ff3

commit r13-3327-g46a8e017d048ec3271bbb898942e3b166c4e8ff3
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Oct 6 13:56:09 2022 +0200

    Vectorization of first-order recurrences

    The following picks up the prototype by Ju-Zhe Zhong for vectorizing
    first order recurrences.  That solves two TSVC missed optimization PRs.

    There's a new scalar cycle def kind, vect_first_order_recurrence
    and it's handling of the backedge value vectorization is complicated
    by the fact that the vectorized value isn't the PHI but instead
    a (series of) permute(s) shifting in the recurring value from the
    previous iteration.  I've implemented this by creating both the
    single vectorized PHI and the series of permutes when vectorizing
    the scalar PHI but leave the backedge values in both unassigned.
    The backedge values are (for the testcases) computed by a load
    which is also the place after which the permutes are inserted.
    That placement also restricts the cases we can handle (without
    resorting to code motion).

    I added both costing and SLP handling though SLP handling is
    restricted to the case where a single vectorized PHI is enough.

    Missing is epilogue handling - while prologue peeling would
    be handled transparently by adjusting iv_phi_p the epilogue
    case doesn't work with just inserting a scalar LC PHI since
    that a) keeps the scalar load live and b) that loads is the
    wrong one, it has to be the last, much like when we'd vectorize
    the LC PHI as live operation.  Unfortunately LIVE
    compute/analysis happens too early before we decide on
    peeling.  When using fully masked loop vectorization the
    vect-recurr-6.c works as expected though.

    I have tested this on x86_64 for now, but since epilogue
    handling is missing there's probably no practical cases.
    My prototype WHILE_ULT AVX512 patch can handle vect-recurr-6.c
    just fine but I didn't feel like running SPEC within SDE nor
    is the WHILE_ULT patch complete enough.

            PR tree-optimization/99409
            PR tree-optimization/99394
            * tree-vectorizer.h (vect_def_type::vect_first_order_recurrence):
Add.
            (stmt_vec_info_type::recurr_info_type): Likewise.
            (vectorizable_recurr): New function.
            * tree-vect-loop.cc (vect_phi_first_order_recurrence_p): New
            function.
            (vect_analyze_scalar_cycles_1): Look for first order
            recurrences.
            (vect_analyze_loop_operations): Handle them.
            (vect_transform_loop): Likewise.
            (vectorizable_recurr): New function.
            (maybe_set_vectorized_backedge_value): Handle the backedge value
            setting in the first order recurrence PHI and the permutes.
            * tree-vect-stmts.cc (vect_analyze_stmt): Handle first order
            recurrences.
            (vect_transform_stmt): Likewise.
            (vect_is_simple_use): Likewise.
            (vect_is_simple_use): Likewise.
            * tree-vect-slp.cc (vect_get_and_check_slp_defs): Likewise.
            (vect_build_slp_tree_2): Likewise.
            (vect_schedule_scc): Handle the backedge value setting in the
            first order recurrence PHI and the permutes.

            * gcc.dg/vect/vect-recurr-1.c: New testcase.
            * gcc.dg/vect/vect-recurr-2.c: Likewise.
            * gcc.dg/vect/vect-recurr-3.c: Likewise.
            * gcc.dg/vect/vect-recurr-4.c: Likewise.
            * gcc.dg/vect/vect-recurr-5.c: Likewise.
            * gcc.dg/vect/vect-recurr-6.c: Likewise.
            * gcc.dg/vect/tsvc/vect-tsvc-s252.c: Un-XFAIL.
            * gcc.dg/vect/tsvc/vect-tsvc-s254.c: Likewise.
            * gcc.dg/vect/tsvc/vect-tsvc-s291.c: Likewise.

    Co-authored-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

  parent reply	other threads:[~2022-10-17 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 14:23 [Bug middle-end/99409] New: " hubicka at gcc dot gnu.org
2021-03-08  8:23 ` [Bug tree-optimization/99409] " rguenth at gcc dot gnu.org
2022-10-17 10:36 ` cvs-commit at gcc dot gnu.org [this message]
2022-10-17 10:40 ` rguenth at gcc dot gnu.org

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=bug-99409-4-ie0HujdQNk@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).