public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Jivan Hakobyan <jivanhakobyan9@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: RISC-V: Eliminate redundant zero extension of minu/maxu operands
Date: Fri, 28 Apr 2023 09:14:57 -0600	[thread overview]
Message-ID: <1acc5fc8-4041-8dfa-46b0-533230831017@gmail.com> (raw)
In-Reply-To: <CAHso6sOFDQ6mAF9hM=ZdMFqNDvSJ5J9-HaQ861jzLMnMH3m3Qw@mail.gmail.com>



On 4/28/23 06:29, Jivan Hakobyan via Gcc-patches wrote:
> RV64 the following code:
> 
>    unsigned Min(unsigned a, unsigned b) {
>        return a < b ? a : b;
>    }
> 
> Compiles to:
>    Min:
>         zext.w  a1,a1
>         zext.w  a0,a0
>         minu    a0,a1,a0
>         sext.w  a0,a0
>         ret
> 
> This patch removes unnecessary zero extensions of minu/maxu operands.
> 
> gcc/ChangeLog:
> 
>       * config/riscv/bitmanip.md: Added expanders for minu/maxu instructions
> 
> gcc/testsuite/ChangeLog:
> 
>     * gcc.target/riscv/zbb-min-max-02.c: Updated scanning check.
>     * gcc.target/riscv/zbb-min-max-03.c: New tests.
Thanks.  We had almost the exact same patch internally, the differences 
were just in naming rather than anything functional.  I went ahead and 
installed your variant and I'll drop Raphael's from my queue.

I realize this may make some planned work WRT eliminating unnecessary 
extensions in gimple somewhat harder.  If that work progresses to the 
point where this patch is a problem, then we'll re-evaluate.  But it's 
crazy to hold this up -- it's a measurable win on x264 in particular.

Thanks again,
jeff

      reply	other threads:[~2023-04-28 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 12:29 Jivan Hakobyan
2023-04-28 15:14 ` Jeff Law [this message]

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=1acc5fc8-4041-8dfa-46b0-533230831017@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jivanhakobyan9@gmail.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).