public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] combine: Check for paradoxical subreg
@ 2021-06-23 11:33 Robin Dapp
  2021-07-05 10:28 ` Robin Dapp
  2021-10-14  8:49 ` Richard Sandiford
  0 siblings, 2 replies; 4+ messages in thread
From: Robin Dapp @ 2021-06-23 11:33 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Hi,

while evaluating another patch that introduces more lvalue paradoxical 
subregs I ran into an ICE in combine at

  	  wide_int o = wi::insert (rtx_mode_t (outer, temp_mode),
				   rtx_mode_t (inner, dest_mode),
				   offset, width);

because width (=GET_MODE_PRECISION (dest_mode)) > GET_MODE_PRECISION 
(temp_mode).

 From the comments and the code it looks like we do not want to handle a 
paradoxical subreg here so I quickly added a check for it which prevents 
the ICE.  The check could also be added to reg_subword_p () I guess.

Is this the right thing to do or am I missing something, i.e. my other 
patch might be doing something it should not?

Bootstrap on s390x was successful and testsuite is looking good so far.

Regards
  Robin

--

gcc/ChangeLog:

         * combine.c (try_combine): Check for paradoxical subreg.

[-- Attachment #2: 0011-combine-paradoxical-subreg-fix.patch --]
[-- Type: text/x-patch, Size: 949 bytes --]

From 2b74c66f8d97c30c45e99336c9871cccd8cf94e1 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp@linux.ibm.com>
Date: Tue, 22 Jun 2021 17:35:37 +0200
Subject: [PATCH 11/11] combine paradoxical subreg fix.

---
 gcc/combine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 6476812a212..de04560db21 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2782,7 +2782,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
       && CONST_SCALAR_INT_P (SET_SRC (temp_expr))
       && GET_CODE (PATTERN (i3)) == SET
       && CONST_SCALAR_INT_P (SET_SRC (PATTERN (i3)))
-      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr)))
+      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr))
+      && !paradoxical_subreg_p (SET_DEST (PATTERN (i3))))
     {
       rtx dest = SET_DEST (PATTERN (i3));
       rtx temp_dest = SET_DEST (temp_expr);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] combine: Check for paradoxical subreg
  2021-06-23 11:33 [PATCH] combine: Check for paradoxical subreg Robin Dapp
@ 2021-07-05 10:28 ` Robin Dapp
  2021-09-24 10:17   ` Robin Dapp
  2021-10-14  8:49 ` Richard Sandiford
  1 sibling, 1 reply; 4+ messages in thread
From: Robin Dapp @ 2021-07-05 10:28 UTC (permalink / raw)
  To: GCC Patches

> gcc/ChangeLog:
> 
>           * combine.c (try_combine): Check for paradoxical subreg.

ping.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] combine: Check for paradoxical subreg
  2021-07-05 10:28 ` Robin Dapp
@ 2021-09-24 10:17   ` Robin Dapp
  0 siblings, 0 replies; 4+ messages in thread
From: Robin Dapp @ 2021-09-24 10:17 UTC (permalink / raw)
  To: GCC Patches

Hi,

pinging this patch:

https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573509.html

It introduces a check for a paradoxical subreg in combine that would ICE 
otherwise.

Regards
  Robin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] combine: Check for paradoxical subreg
  2021-06-23 11:33 [PATCH] combine: Check for paradoxical subreg Robin Dapp
  2021-07-05 10:28 ` Robin Dapp
@ 2021-10-14  8:49 ` Richard Sandiford
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Sandiford @ 2021-10-14  8:49 UTC (permalink / raw)
  To: Robin Dapp via Gcc-patches

Sorry for the slow review.

Robin Dapp via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hi,
>
> while evaluating another patch that introduces more lvalue paradoxical 
> subregs I ran into an ICE in combine at
>
>   	  wide_int o = wi::insert (rtx_mode_t (outer, temp_mode),
> 				   rtx_mode_t (inner, dest_mode),
> 				   offset, width);
>
> because width (=GET_MODE_PRECISION (dest_mode)) > GET_MODE_PRECISION 
> (temp_mode).
>
>  From the comments and the code it looks like we do not want to handle a 
> paradoxical subreg here so I quickly added a check for it which prevents 
> the ICE.  The check could also be added to reg_subword_p () I guess.

Yeah, I think adding it to reg_subword_p would be better, immediately
after the GET_CODE (x) == SUBREG test.

OK with that change, thanks.

Richard

>
> Is this the right thing to do or am I missing something, i.e. my other 
> patch might be doing something it should not?
>
> Bootstrap on s390x was successful and testsuite is looking good so far.
>
> Regards
>   Robin
>
> --
>
> gcc/ChangeLog:
>
>          * combine.c (try_combine): Check for paradoxical subreg.
>
> From 2b74c66f8d97c30c45e99336c9871cccd8cf94e1 Mon Sep 17 00:00:00 2001
> From: Robin Dapp <rdapp@linux.ibm.com>
> Date: Tue, 22 Jun 2021 17:35:37 +0200
> Subject: [PATCH 11/11] combine paradoxical subreg fix.
>
> ---
>  gcc/combine.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/combine.c b/gcc/combine.c
> index 6476812a212..de04560db21 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -2782,7 +2782,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
>        && CONST_SCALAR_INT_P (SET_SRC (temp_expr))
>        && GET_CODE (PATTERN (i3)) == SET
>        && CONST_SCALAR_INT_P (SET_SRC (PATTERN (i3)))
> -      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr)))
> +      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr))
> +      && !paradoxical_subreg_p (SET_DEST (PATTERN (i3))))
>      {
>        rtx dest = SET_DEST (PATTERN (i3));
>        rtx temp_dest = SET_DEST (temp_expr);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-14  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 11:33 [PATCH] combine: Check for paradoxical subreg Robin Dapp
2021-07-05 10:28 ` Robin Dapp
2021-09-24 10:17   ` Robin Dapp
2021-10-14  8:49 ` Richard Sandiford

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).