public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Kilian Verhetsel <kilian.verhetsel@uclouvain.be>, alan.hayward@arm.com
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix result for conditional reductions matching at index 0
Date: Tue, 21 Nov 2017 14:06:00 -0000	[thread overview]
Message-ID: <CAFiYyc3VrW4bVB9WXQ4yMhPRn_FpV6T3vAA=6YLVi5CdZopHEg@mail.gmail.com> (raw)
In-Reply-To: <87d14brhj6.fsf@uclouvain.be>

On Tue, Nov 21, 2017 at 12:35 PM, Kilian Verhetsel
<kilian.verhetsel@uclouvain.be> wrote:
>
> Hi,
>
> When translating conditional reductions based on integer induction, the
> compiler uses the value zero to indicate the absence of any matches: if
> the index of the last match is still zero at the end of the loop, the
> default value is returned. The problem with this approach is that this
> default value is returned not only when there were no matches at all,
> but also when the last match occurred at index 0. This causes the test
> gcc.dg/vect/pr65947-14.c to fail.
>
> This patch corrects this by reusing the vector of indices used for
> COND_REDUCTION, which starts at 1. If the 1-based index of the last
> match is non-zero, 1 is subtracted from it, otherwise the initial value
> is returned.
>
> I tested this patch on x86_64-pc-linux-gnu (both with SSE and AVX2,
> causing both paths through the reduc_code != ERROR_MARK branch being
> taken).

This is PR81179 I think, please mention that in the changelog.

This unconditionally pessimizes code even if there is no valid index
zero, right?

The issue with the COND_REDUCITION index vector is overflow IIRC.

Alan, can you please comment on the patch?

Thanks,
Richard.

> 2017-11-21  Kilian Verhetsel <kilian.verhetsel@uclouvain.be>
>
>         * tree-vect-loop.c
>         (vect_create_epilog_for_reduction): Fix the returned value for
>         INTEGER_INDUC_COND_REDUCTION whose last match occurred at
>         index 0.
>         (vectorizable_reduction): For INTEGER_INDUC_COND_REDUCTION,
>         pass the PHI statement that sets the induction variable to the
>         code generating the epilogue.
>

  reply	other threads:[~2017-11-21 13:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21 11:41 Kilian Verhetsel
2017-11-21 14:06 ` Richard Biener [this message]
2017-11-21 16:49   ` Kilian Verhetsel
2017-11-21 17:09     ` Alan Hayward
2017-11-22  9:17     ` Richard Biener
2017-11-22 11:15       ` Alan Hayward
2017-11-22 15:07         ` Richard Biener
2017-11-22 17:23           ` Kilian Verhetsel
2017-11-23 10:30             ` Alan Hayward
2017-11-23 12:39               ` Richard Biener
2017-12-08 18:15             ` Jakub Jelinek
2017-12-11 10:57               ` Kilian Verhetsel
2017-12-11 13:11                 ` Jakub Jelinek
2017-12-11 13:51                   ` Jakub Jelinek
2017-12-11 17:00                     ` Kilian Verhetsel
2017-12-11 17:06                       ` Jakub Jelinek
2017-12-11 21:22                       ` [PATCH] Fix result for conditional reductions matching at index 0 (PR tree-optimization/80631) Jakub Jelinek
2017-12-12  7:57                         ` Richard Biener

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='CAFiYyc3VrW4bVB9WXQ4yMhPRn_FpV6T3vAA=6YLVi5CdZopHEg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=alan.hayward@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kilian.verhetsel@uclouvain.be \
    /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).