public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jeff Law <law@redhat.com>, Bernd Schmidt <bschmidt@redhat.com>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] On x86 allow if-conversion of more than one insn as long as there is at most one cmov (PR tree-optimization/79390)
Date: Sun, 02 Apr 2017 18:44:00 -0000	[thread overview]
Message-ID: <CAFULd4bKRsG94P9xFCgUJQj5E=BCJkWoi837yBEj51z0fU4OEg@mail.gmail.com> (raw)
In-Reply-To: <20170401122027.GT17461@tucnak>

On Sat, Apr 1, 2017 at 2:20 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As discussed in the PR, in the following testcase we don't if-convert
> with the generic (and many other) tuning, because we default to
> --param max-rtl-if-conversion-insns=1 in most of the tunings.
> The problem we have is with multiple cmov instructions, but in the
> testcase there is just one cmov and the other insn is turned into a SSE
> max insn, which is fine.
>
> This patch stops artificially lowering that param, and for one_if_conv_insn
> tuning it instead rejects the if-conversion if the resulting sequence has
> multiple cmov instructions.  The hook is passed if_info too, so it can
> in the future do better heuristics based on predictability of the edges,
> how far the uses of the cmov result are (I assume cmov major problem is
> latency, right?) etc.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-04-01  Jakub Jelinek  <jakub@redhat.com>
>
>         PR tree-optimization/79390
>         * target.h (struct noce_if_info): Declare.
>         * targhooks.h (default_noce_conversion_profitable_p): Declare.
>         * target.def (noce_conversion_profitable_p): New target hook.
>         * ifcvt.h (struct noce_if_info): New type, moved from ...
>         * ifcvt.c (struct noce_if_info): ... here.
>         (noce_conversion_profitable_p): Renamed to ...
>         (default_noce_conversion_profitable_p): ... this.  No longer
>         static nor inline.
>         (noce_try_store_flag_constants, noce_try_addcc,
>         noce_try_store_flag_mask, noce_try_cmove, noce_try_cmove_arith,
>         noce_convert_multiple_sets): Use targetm.noce_conversion_profitable_p
>         instead of noce_conversion_profitable_p.
>         * config/i386/i386.c: Include ifcvt.h.
>         (ix86_option_override_internal): Don't override
>         PARAM_MAX_RTL_IF_CONVERSION_INSNS default.
>         (ix86_noce_conversion_profitable_p): New function.
>         (TARGET_NOCE_CONVERSION_PROFITABLE_P): Redefine.
>         * config/i386/x86-tune.def (X86_TUNE_ONE_IF_CONV_INSN): Adjust comment.
>         * doc/tm.texi.in (TARGET_NOCE_CONVERSION_PROFITABLE_P): Add.
>         * doc/tm.texi: Regenerated.
>
>         * gcc.target/i386/pr79390.c: New test.
>         * gcc.dg/ifcvt-4.c: Use -mtune-ctrl=^one_if_conv_insn for i?86/x86_64.

x86 part LGTM.

Hopefully, this infrastructure will allow us to fix (or it already
fixes) PR 56309 [1].

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56309

Thanks,
Uros.

  parent reply	other threads:[~2017-04-02 18:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01 12:20 Jakub Jelinek
2017-04-01 18:43 ` Segher Boessenkool
2017-04-01 18:47   ` Jakub Jelinek
2017-04-02 18:44 ` Uros Bizjak [this message]
2017-04-03  7:20   ` Jakub Jelinek
2017-04-04 17:31 ` Jeff Law
2017-04-06 12:50   ` Rainer Orth
2017-04-06 12:55     ` Jakub Jelinek

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='CAFULd4bKRsG94P9xFCgUJQj5E=BCJkWoi837yBEj51z0fU4OEg@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=law@redhat.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).