From: Jeffrey A Law <law@hurl.cygnus.com>
To: john@feith.com (John Wehle)
Cc: egcs@egcs.cygnus.com
Subject: Re: Possible CSE quirk involving SUBREG on the i386
Date: Wed, 31 Mar 1999 23:46:00 -0000 [thread overview]
Message-ID: <24868.920970568@hurl.cygnus.com> (raw)
Message-ID: <19990331234600.GzjIZ-LTSlbMldIxHs1rHSblWDkrIDgseyOtIOZUo38@z> (raw)
In-Reply-To: <199806300534.BAA27602@jwlab.FEITH.COM>
In message <199806300534.BAA27602@jwlab.FEITH.COM>you write:
> Compiling:
>
> unsigned short c;
>
> int
> func(unsigned short a)
> {
> unsigned short b;
>
> b = a;
> c = b;
>
> return b;
> }
>
> for the i386 using egcs current with -O -S yields:
>
> _func:
> pushl %ebp
> movl %esp,%ebp
> movl 8(%ebp),%eax
> movl %eax,%edx
> movw %ax,_c
> movzwl %dx,%eax
> leave
> ret
>
> Which is interesting since I expected:
>
> _func:
> pushl %ebp
> movl %esp,%ebp
> movl 8(%ebp),%eax
> movw %ax,_c
> movzwl %ax,%eax
> leave
> ret
>
> The use of %edx seems wasteful.
Yes. Wasteful. Compiling this with the current sources yields:
func:
pushl %ebp # 32 movsi-2
movl %esp,%ebp # 34 movsi+2/1
movzwl 8(%ebp),%eax # 4 zero_extendhisi2+2/2
movw %ax,c # 16 movhi+1/1
leave # 37 leave
ret # 38 return_internal
Which is even better than what you expected ;-)
jeff
next prev parent reply other threads:[~1999-03-31 23:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-06-29 22:34 John Wehle
1998-06-30 4:50 ` Jeffrey A Law
1998-06-30 15:15 ` Richard Henderson
1998-07-01 0:54 ` David S. Miller
1998-07-01 0:54 ` Richard Henderson
1998-07-01 3:42 ` Jeffrey A Law
1998-07-01 0:54 ` David S. Miller
1998-07-01 0:54 ` Jeffrey A Law
1999-03-09 1:09 ` Jeffrey A Law [this message]
1999-03-31 23:46 ` Jeffrey A Law
1998-06-30 14:46 John Wehle
1998-06-30 14:08 ` Jeffrey A Law
1998-07-01 6:44 ` Richard Henderson
1998-07-01 22:54 ` Jeffrey A Law
1998-07-01 20:15 John Wehle
1998-07-01 20:15 ` Jeffrey A Law
1998-07-01 20:15 ` Richard Henderson
1998-07-02 0:53 John Wehle
1998-07-07 5:29 ` Jeffrey A Law
1998-07-10 20:04 John Wehle
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=24868.920970568@hurl.cygnus.com \
--to=law@hurl.cygnus.com \
--cc=egcs@egcs.cygnus.com \
--cc=john@feith.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).