From: Jeffrey A Law <law@cygnus.com>
To: john@feith.com (John Wehle)
Cc: egcs@cygnus.com
Subject: Re: Possible CSE quirk involving SUBREG on the i386
Date: Tue, 30 Jun 1998 04:50:00 -0000 [thread overview]
Message-ID: <15831.899190753@hurl.cygnus.com> (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
I'm not sure this is really a CSE issue. Though it might be a combine
issue.
;; Start of basic block 0, registers live: 6 [bp] 16 []
(insn 4 2 6 (set (reg:SI 22)
(mem:SI (reg:SI 16 %argp))) 54 {movsi+2} (nil)
(expr_list:REG_EQUIV (mem:SI (reg:SI 16 %argp))
(nil)))
(insn 6 4 7 (set (reg/v:HI 21)
(subreg:HI (reg:SI 22) 0)) 58 {movhi+1} (insn_list 4 (nil))
(nil))
(note 7 6 8 "" NOTE_INSN_FUNCTION_BEG)
(note 8 7 10 "" NOTE_INSN_DELETED)
(note 10 8 16 0 NOTE_INSN_BLOCK_BEG)
(insn 16 10 18 (set (mem:HI (symbol_ref:SI ("c")))
(subreg:HI (reg:SI 22) 0)) 58 {movhi+1} (nil)
(expr_list:REG_DEAD (reg:SI 22)
(nil)))
(insn 18 16 20 (set (reg:SI 24)
(zero_extend:SI (reg/v:HI 21))) 86 {zero_extendhisi2} (insn_list 6 (nil))
(expr_list:REG_DEAD (reg/v:HI 21)
(nil)))
If we were to combine insns 6 & 18 I think we'd get the code you want.
I don't know why combine isn't doing this.
jeff
next prev parent reply other threads:[~1998-06-30 4:50 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 [this message]
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
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 ` Richard Henderson
1998-07-01 20:15 ` Jeffrey A Law
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=15831.899190753@hurl.cygnus.com \
--to=law@cygnus.com \
--cc=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).