public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [x86 PATCH] PR target/106122: Don't update %esp via the stack with -Oz.
Date: Fri, 1 Jul 2022 08:03:26 +0200	[thread overview]
Message-ID: <CAFULd4a1yZn5+pRt_XV0KDo4q7S3F4p0uQd46Rznqg8NOJegLQ@mail.gmail.com> (raw)
In-Reply-To: <008301d88cd5$2936ce90$7ba46bb0$@nextmovesoftware.com>

On Fri, Jul 1, 2022 at 1:00 AM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> When optimizing for size with -Oz, setting a register can be minimized by
> pushing an immediate value to the stack and popping it to the destination.
> Alas the one general register that shouldn't be updated via the stack is
> the stack pointer itself, where "pop %esp" can't be represented in GCC's
> RTL ("use of a register mentioned in pre_inc, pre_dec, post_inc or
> post_dec is not permitted within the same instruction").  This patch
> fixes PR target/106122 by explicitly checking for SP_REG in the
> problematic peephole2.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check, both with and without --target_board=unix{-m32}
> with no new failures.  Ok for mainline?
>
>
> 2022-06-30  Roger Sayle  <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
>         PR target/106122
>         * config/i386/i386.md (peephole2): Avoid generating pop %esp
>         when optimizing for size.
>
> gcc/testsuite/ChangeLog
>         PR target/106122
>         * gcc.target/i386/pr106122.c: New test case.

OK for mainline and backport.

Thanks,
Uros.

>
>
> Thanks in advance,
> Roger
> --
>

      reply	other threads:[~2022-07-01  6:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 23:00 Roger Sayle
2022-07-01  6:03 ` Uros Bizjak [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=CAFULd4a1yZn5+pRt_XV0KDo4q7S3F4p0uQd46Rznqg8NOJegLQ@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=roger@nextmovesoftware.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).