From: Uros Bizjak <ubizjak@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [x86_64 PATCH] PR target/106481: Handle CONST_WIDE_INT in REG_EQUAL during STV.
Date: Mon, 1 Aug 2022 16:31:59 +0200 [thread overview]
Message-ID: <CAFULd4a34A2mimegub5VT8Cj650Wr9s0QaT7id-5hJPcXyiCeg@mail.gmail.com> (raw)
In-Reply-To: <01fd01d8a5ac$bfe5dc60$3fb19520$@nextmovesoftware.com>
[-- Attachment #1: Type: text/plain, Size: 1865 bytes --]
On Mon, Aug 1, 2022 at 3:43 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This patch resolves PR target/106481, and is an oversight in my recent
> battles with REG_EQUAL notes during TImode STV (see PR target/106278
> https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598416.html).
>
> The patch above's/current behaviour is that we check that the mode of
> the REG_EQUAL note is TImode before using PUT_MODE to set it to V1TImode.
> However, the new test case reveals that this doesn't consider REG_EQUAL
> notes that are CONST_INT or CONST_WIDE_INT, i.e. that are VOIDmode,
> and so STV produces:
>
> (insn 85 84 86 2 (set (reg:V1TI 113)
> (reg:V1TI 84)) "pr106481.c":13:3 1766 {movv1ti_internal}
> (expr_list:REG_EQUAL (const_wide_int 0x0ffffffff00000004)
> (nil)))
>
> which causes problems as the const_wide_int isn't a valid immediate
> constant for V1TImode. With this patch, we now generate the correct:
>
> (insn 85 84 86 2 (set (reg:V1TI 113)
> (reg:V1TI 84)) "pr106481.c":13:3 1766 {movv1ti_internal}
> (expr_list:REG_EQUAL (const_vector:V1TI [
> (const_wide_int 0x0ffffffff00000004)
> ])
> (nil)))
>
>
> 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-08-01 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> PR target/106481
> * config/i386/i386-features.cc (timode_scalar_chain::convert_insn):
> Convert a CONST_SCALAR_INT_P in a REG_EQUAL note into a V1TImode
> CONST_VECTOR.
>
> gcc/testsuite/ChangeLog
> PR target/106481
> * gcc.target/i386/pr106481.c: New test case.
OK, but how about we restructure the conditions a bit, like in the
attached patch?
Uros.
[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 748 bytes --]
diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc
index e4cc4a30590..e3ecc22580a 100644
--- a/gcc/config/i386/i386-features.cc
+++ b/gcc/config/i386/i386-features.cc
@@ -1353,8 +1353,15 @@ timode_scalar_chain::convert_insn (rtx_insn *insn)
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);
+ if (tmp)
+ {
+ if (GET_MODE (XEXP (tmp, 0)) == TImode)
+ PUT_MODE (XEXP (tmp, 0), V1TImode);
+ else if (CONST_SCALAR_INT_P (XEXP (tmp, 0)))
+ XEXP (tmp, 0)
+ = gen_rtx_CONST_VECTOR (V1TImode,
+ gen_rtvec (1, XEXP (tmp, 0)));
+ }
}
break;
case MEM:
prev parent reply other threads:[~2022-08-01 14:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 13:43 Roger Sayle
2022-08-01 14:31 ` 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=CAFULd4a34A2mimegub5VT8Cj650Wr9s0QaT7id-5hJPcXyiCeg@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).