From: "Kewen.Lin" <linkw@linux.ibm.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: gcc-patches@gcc.gnu.org,
"'Segher Boessenkool'" <segher@kernel.crashing.org>,
"'David Edelsohn'" <dje.gcc@gmail.com>
Subject: Re: [PATCH/RFC] combine_completed global variable.
Date: Fri, 8 Jul 2022 15:21:34 +0800 [thread overview]
Message-ID: <b08d0c74-267c-15c8-40d0-04a5946b54ba@linux.ibm.com> (raw)
In-Reply-To: <001a01d89239$713109e0$53931da0$@nextmovesoftware.com>
Hi Roger,
on 2022/7/8 03:40, Roger Sayle wrote:
>
> Hi Kewen (and Segher),
> Many thanks for stress testing my patch to improve multiplication
> by integer constants on rs6000 by using the rldmi instruction.
> Although I've not been able to reproduce your ICE (using gcc135
> on the compile farm), I completely agree with Segher's analysis
> that the Achilles heel with my approach/patch is that there's
> currently no way for the backend/recog to know that we're in a
> pass after combine.
>
It's weird that it can't be reproduced on your side, did you try
with -m32 explicitly? Sorry that I didn't say the used options
clearly in the previous reply, they are "-O2 -m32".
> Rather than give up on this optimization (and a similar one for
> I386.md where test;sete can be replaced by xor $1 when combine
> knows that nonzero_bits is 1, but loses that information afterwards),
> I thought I'd post this "strawman" proposal to add a combine_completed
> global variable, matching the reload_completed and regstack_completed
> global variables already used (to track progress) by the middle-end.
>
> I was wondering if I could ask you could test the attached patch
> in combination with my previous rs6000.md patch (with the obvious
> change of reload_completed to combine_completed) to confirm
> that it fixes the problems you were seeing.
I just had a try, it still failed. I checked the unrecognizable
pattern and the original patch, I guessed it needs a tiny adjustment
like below:
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index dde123e87b8..0a089f12510 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -4216,7 +4216,7 @@ (define_insn_and_split "*rotl<mode>3_insert_3b_<code>"
(match_operand:SI 2 "const_int_operand" "n"))
(match_operand:GPR 3 "gpc_reg_operand" "0")))]
"INTVAL (operands[2]) > 0
- && INTVAL (operands[2]) < 64
+ && INTVAL (operands[2]) < GET_MODE_PRECISION (<MODE>mode)
&& ((nonzero_bits (operands[3], <MODE>mode)
< HOST_WIDE_INT_1U << INTVAL (operands[2]))
|| combine_completed)"
the hardcoded value 64 is too big for SImode in the failure, it seems
we should use the mode precision instead? I confirmed the failures are
gone with this proposal and the tiny change.
BR,
Kewen
next prev parent reply other threads:[~2022-07-08 7:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 19:40 Roger Sayle
2022-07-08 6:51 ` Richard Biener
2022-07-08 7:21 ` Kewen.Lin [this message]
2022-07-08 20:23 ` Segher Boessenkool
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=b08d0c74-267c-15c8-40d0-04a5946b54ba@linux.ibm.com \
--to=linkw@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.com \
--cc=segher@kernel.crashing.org \
/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).