From: Jakub Jelinek <jakub@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Uros Bizjak <ubizjak@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Optimize (x * 8) | 5 and (x << 3) ^ 3 to use lea (PR target/48688)
Date: Sat, 04 Jun 2011 15:40:00 -0000 [thread overview]
Message-ID: <20110604153938.GM17079@tyan-ft48-01.lab.bos.redhat.com> (raw)
In-Reply-To: <BANLkTinhGA=AzSkLuyrBXBDpmU48SSnY2w@mail.gmail.com>
On Sat, Jun 04, 2011 at 08:19:57AM -0700, H.J. Lu wrote:
> I don't think this pattern is correct. See:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49281
Fixed thusly, committed as obvious:
2011-06-04 Jakub Jelinek <jakub@redhat.com>
PR target/49281
* config/i386/i386.md (*lea_general_4): Require INTVAL (operands[3])
to be strictly smaller than 1 << shiftcount.
* gcc.c-torture/execute/pr49281.c: New test.
--- gcc/config/i386/i386.md.jj 2011-06-01 10:20:02.000000000 +0200
+++ gcc/config/i386/i386.md 2011-06-04 17:21:02.000000000 +0200
@@ -6425,7 +6425,7 @@ (define_insn_and_split "*lea_general_4"
|| optimize_function_for_size_p (cfun))
&& ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) - 1 < 3
&& ((unsigned HOST_WIDE_INT) INTVAL (operands[3])
- <= ((unsigned HOST_WIDE_INT) 1 << INTVAL (operands[2])))"
+ < ((unsigned HOST_WIDE_INT) 1 << INTVAL (operands[2])))"
"#"
"&& reload_completed"
[(const_int 0)]
--- gcc/testsuite/gcc.c-torture/execute/pr49281.c.jj 2011-06-04 17:29:39.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr49281.c 2011-06-04 17:32:05.000000000 +0200
@@ -0,0 +1,25 @@
+/* PR target/49281 */
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) int
+foo (int x)
+{
+ return (x << 2) | 4;
+}
+
+__attribute__((noinline, noclone)) int
+bar (int x)
+{
+ return (x << 2) | 3;
+}
+
+int
+main ()
+{
+ if (foo (43) != 172 || foo (1) != 4 || foo (2) != 12)
+ abort ();
+ if (bar (43) != 175 || bar (1) != 7 || bar (2) != 11)
+ abort ();
+ return 0;
+}
Jakub
prev parent reply other threads:[~2011-06-04 15:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-20 16:36 Jakub Jelinek
2011-04-20 17:51 ` Richard Henderson
2011-04-21 13:01 ` Jakub Jelinek
2011-06-04 15:20 ` H.J. Lu
2011-06-04 15:40 ` Jakub Jelinek [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=20110604153938.GM17079@tyan-ft48-01.lab.bos.redhat.com \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=ubizjak@gmail.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).