public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Robin Dapp <rdapp@linux.ibm.com>,
	gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH v3 4/7] ifcvt/optabs: Allow using a CC comparison for emit_conditional_move.
Date: Wed, 8 Dec 2021 17:11:40 -0700	[thread overview]
Message-ID: <f95decd8-cd9a-66bd-b698-629dd2d430b2@gmail.com> (raw)
In-Reply-To: <20211206184352.42264-5-rdapp@linux.ibm.com>



On 12/6/2021 11:43 AM, Robin Dapp via Gcc-patches wrote:
> Currently we only ever call emit_conditional_move with the comparison
> (as well as its comparands) we got from the jump.  Thus, backends are
> going to emit a CC comparison for every conditional move that is being
> generated instead of re-using the existing CC.
> This, combined with emitting temporaries for each conditional move,
> causes sky-high costs for conditional moves.
>
> This patch allows to re-use a CC so the costing situation is improved a
> bit.
> ---
>   gcc/expmed.c |   8 +--
>   gcc/expr.c   |  10 ++--
>   gcc/ifcvt.c  |  45 ++++++++++-------
>   gcc/optabs.c | 135 ++++++++++++++++++++++++++++++++++++++-------------
>   gcc/optabs.h |   4 +-
>   gcc/rtl.h    |  11 ++++-
>   6 files changed, 150 insertions(+), 63 deletions(-)
>
>

> @@ -4948,17 +4947,85 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
>
> +/* Helper for emitting a conditional move.  */
> +
> +static rtx
> +emit_conditional_move_1 (rtx target, rtx comparison,
> +			 rtx op2, rtx op3, machine_mode mode)
> +{
> +  enum insn_code icode;
> +
> +  if (comparison == NULL_RTX || !COMPARISON_P (comparison))
> +    return NULL_RTX;
> +
> +  /* If the two source operands are identical, that's just a move.  */
> +  if (rtx_equal_p (op2, op3))
> +    {
> +      if (!target)
> +	target = gen_reg_rtx (mode);
> +
> +      emit_move_insn (target, op3);
> +      return target;
> +    }
What if the condition has a side effect?  Doesn't this drop the side 
effect by converting the conditional move into a simple move?

That's my only technical concern.  Obviously the patch needs a ChangeLog.

Jeff

  reply	other threads:[~2021-12-09  0:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 18:43 [PATCH v3 0/7] ifcvt: Convert multiple Robin Dapp
2021-12-06 18:43 ` [PATCH v3 1/7] ifcvt: Check if cmovs are needed Robin Dapp
2021-12-09  1:26   ` Jeff Law
2022-01-10 11:17     ` Robin Dapp
2021-12-06 18:43 ` [PATCH v3 2/7] ifcvt: Allow constants for noce_convert_multiple Robin Dapp
2021-12-08 23:51   ` Jeff Law
2022-01-10 11:17     ` Robin Dapp
2021-12-06 18:43 ` [PATCH v3 3/7] ifcvt: Improve costs handling " Robin Dapp
2021-12-08 23:54   ` Jeff Law
2022-01-10 11:17     ` Robin Dapp
2021-12-06 18:43 ` [PATCH v3 4/7] ifcvt/optabs: Allow using a CC comparison for emit_conditional_move Robin Dapp
2021-12-09  0:11   ` Jeff Law [this message]
2021-12-09 17:20     ` Robin Dapp
2021-12-09 17:34       ` Jeff Law
2022-01-10 11:18     ` Robin Dapp
2021-12-06 18:43 ` [PATCH v3 5/7] ifcvt: Try re-using CC for conditional moves Robin Dapp
2021-12-09  1:18   ` Jeff Law
2022-01-10 11:18     ` Robin Dapp
2021-12-06 18:43 ` [PATCH v3 6/7] testsuite/s390: Add tests for noce_convert_multiple Robin Dapp
2021-12-08 23:48   ` Jeff Law
2022-01-10 11:18     ` Robin Dapp
2021-12-06 18:43 ` [PATCH v3 7/7] ifcvt: Run second pass if it is possible to omit a temporary Robin Dapp
2021-12-09  1:24   ` Jeff Law
2021-12-10 15:06     ` Robin Dapp
2021-12-15 20:24       ` Jeff Law
2022-01-10 11:18     ` Robin Dapp

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=f95decd8-cd9a-66bd-b698-629dd2d430b2@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rdapp@linux.ibm.com \
    --cc=richard.sandiford@arm.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).