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-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR target/106278: Keep REG_EQUAL notes consistent during TImode STV.
Date: Thu, 14 Jul 2022 21:05:28 +0200	[thread overview]
Message-ID: <CAFULd4Zwsg3w6Y7N6w=+jLdrbuigbQ=C5kGFL159bw4kGnFkDw@mail.gmail.com> (raw)
In-Reply-To: <01b601d897a2$f1e6cac0$d5b46040$@nextmovesoftware.com>

On Thu, Jul 14, 2022 at 6:58 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This patch resolves PR target/106278 a regression on x86_64 caused by my
> recent TImode STV improvements.  Now that TImode STV can handle comparisons
> such as "(set (regs:CC) (compare:CC (reg:TI) ...))" the convert_insn method
> sensibly checks that the mode of the SET_DEST is TImode before setting
> it to V1TImode [to avoid V1TImode appearing on the hard reg CC_FLAGS.
>
> Hence the current code looks like:
>
>       if (GET_MODE (dst) == TImode)
>         {
>           tmp = find_reg_equal_equiv_note (insn);
>           if (tmp && GET_MODE (XEXP (tmp, 0)) == TImode)
>             PUT_MODE (XEXP (tmp, 0), V1TImode);
>           PUT_MODE (dst, V1TImode);
>           fix_debug_reg_uses (dst);
>         }
>       break;
>
> which checks GET_MODE (dst) before calling PUT_MODE, and when a
> change is made updating the REG_EQUAL_NOTE tmp if it exists.
>
> The logical flaw (oversight) is that due to RTL sharing, the destination
> of this set may already have been updated to V1TImode, as this chain is
> being converted, but we still need to update any REG_EQUAL_NOTE that
> still has TImode.  Hence the correct code is actually:
>
>
>       if (GET_MODE (dst) == TImode)
>         {
>           PUT_MODE (dst, V1TImode);
>           fix_debug_reg_uses (dst);
>         }
>       if (GET_MODE (dst) == V1TImode)
>         {
>           tmp = find_reg_equal_equiv_note (insn);
>           if (tmp && GET_MODE (XEXP (tmp, 0)) == TImode)
>             PUT_MODE (XEXP (tmp, 0), V1TImode);
>         }
>       break;
>
> While fixing this behavior, I noticed I had some indentation whitespace
> issues and some vestigial dead code in this function/method that I've
> taken the liberty of cleaning up (as obvious) in this patch.

While it is desired to fix cosmetic issues, those kinds of changes
unnecessarily make review of the patch more difficult.

> 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?

OK, but please do not mix cleanups with the functional changes.
Cleanups should be separated to a follow-up patch.

Thanks,
Uros.

>
>
> 2022-07-14  Roger Sayle  <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
>         PR target/106278
>         * config/i386/i386-features.cc (general_scalar_chain::convert_insn):
>         Fix indentation whitespace.
>         (timode_scalar_chain::fix_debug_reg_uses): Likewise.
>         (timode_scalar_chain::convert_insn): Delete dead code.
>         Update TImode REG_EQUAL_NOTE even if the SET_DEST is already V1TI.
>         Fix indentation whitespace.
>         (convertible_comparison_p): Likewise.
>         (timode_scalar_to_vector_candidate_p): Likewise.
>
> gcc/testsuite/ChangeLog
>         PR target/106278
>         * gcc.dg/pr106278.c: New test case.
>
>
> Thanks in advance,
> Roger
> --
>

      reply	other threads:[~2022-07-14 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 16:58 Roger Sayle
2022-07-14 19:05 ` 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='CAFULd4Zwsg3w6Y7N6w=+jLdrbuigbQ=C5kGFL159bw4kGnFkDw@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).