From: Rask Ingemann Lambertsen <rask@sygehus.dk>
To: Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] lower-subreg: Decompose multiword shifts
Date: Thu, 02 Aug 2007 23:16:00 -0000 [thread overview]
Message-ID: <20070802231609.GL25795@sygehus.dk> (raw)
In-Reply-To: <20070802153434.GA24953@blc4eb430604175.ibm.com>
On Thu, Aug 02, 2007 at 05:34:34PM +0200, Andreas Krebbel wrote:
> Hello,
>
> the attached patch enhances the lower subreg pass to be able to
> decompose multiword shift instructions.
>
> Currently GCC generates quite ugly code (on s390 31bit) for a function
> like the first of the attached testcase:
>
> u64
> foo (u32 high, u32 low)
> {
> return ((u64)high << 32) | low;
> }
On x86_64 with -O2 -march=k6 -m32, I get:
foo:
pushl %ebp # 39 *pushsi2 [length = 1]
movl %esp, %ebp # 40 *movsi_1/1 [length = 2]
movl 8(%ebp), %edx # 37 *movsi_1/1 [length = 3]
movl 12(%ebp), %eax # 10 *movsi_1/1 [length = 3]
leave # 43 leave [length = 1]
movl %edx, %ecx # 46 *movsi_1/1 [length = 2]
movl %ecx, %edx # 11 *movsi_1/1 [length = 2]
ret # 44 return_internal [length = 1]
This appears sort of fine, i.e. no shifts, with just two useless "movl"
instructions. But the shift remains until the split4 pass, leaving the two
"movl" instructions behind. So I tried your patch:
foo:
pushl %ebp # 43 *pushsi2 [length = 1]
movl %esp, %ebp # 44 *movsi_1/1 [length = 2]
pushl %esi # 45 *pushsi2 [length = 1]
pushl %ebx # 46 *pushsi2 [length = 1]
movl 12(%ebp), %eax # 39 *movsi_1/1 [length = 3]
popl %ebx # 49 popsi1 [length = 1]
movl 8(%ebp), %ecx # 41 *movsi_1/1 [length = 3]
popl %esi # 50 popsi1 [length = 1]
leave # 51 leave [length = 1]
movl %ecx, %edx # 36 *movsi_1/1 [length = 2]
ret # 52 return_internal [length = 1]
I don't know if it's your fault, but it's worse!
--
Rask Ingemann Lambertsen
next prev parent reply other threads:[~2007-08-02 23:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-02 15:35 Andreas Krebbel
2007-08-02 16:56 ` Paolo Bonzini
2007-08-03 16:41 ` Andreas Krebbel
2007-08-03 19:02 ` Paolo Bonzini
2007-08-02 18:52 ` Rask Ingemann Lambertsen
2007-08-02 19:21 ` Andreas Krebbel
2007-08-07 1:41 ` Rask Ingemann Lambertsen
2007-08-07 8:29 ` Andreas Krebbel
2007-08-02 23:16 ` Rask Ingemann Lambertsen [this message]
2007-08-03 12:03 ` Michael Matz
2007-08-03 14:34 ` Andreas Krebbel
2007-08-03 15:37 ` Michael Matz
2007-08-07 1:08 ` Ian Lance Taylor
2007-08-07 1:27 ` Ian Lance Taylor
2007-08-07 10:47 ` Andreas Krebbel
2007-08-08 18:40 ` Andreas Tobler
2007-08-09 7:45 ` Andreas Krebbel
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=20070802231609.GL25795@sygehus.dk \
--to=rask@sygehus.dk \
--cc=Andreas.Krebbel@de.ibm.com \
--cc=gcc-patches@gcc.gnu.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).