public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/19296] [3.3/3.4/4.0 regression] Range check on short miscompiled at -O
Date: Thu, 06 Jan 2005 22:25:00 -0000	[thread overview]
Message-ID: <20050106222459.658.qmail@sourceware.org> (raw)
In-Reply-To: <20050106191811.19296.falk@debian.org>


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-01-06 22:24 -------
 > The RTL is wrong right away:
> (insn 13 11 14 (set (reg:HI 60)
>         (subreg/u:HI (reg/v:SI 58 [ ad ]) 0)) -1 (nil)
>     (nil))
> 
> (insn 14 13 15 (parallel [
>             (set (reg:SI 61)
>                 (plus:SI (subreg:SI (reg:HI 60) 0)
>                     (const_int -16384 [0xffffc000])))
>             (clobber (reg:CC 17 flags))
>         ]) -1 (nil)
>     (nil))
> 
> (insn 15 14 16 (set (reg:CCGOC 17 flags)
>         (compare:CCGOC (subreg:HI (reg:SI 61) 0)
>             (const_int 0 [0x0]))) -1 (nil)
>     (nil))
> 
> (jump_insn 16 15 0 (set (pc)
>         (if_then_else (lt (reg:CCGOC 17 flags)
>                 (const_int 0 [0x0]))
>             (label_ref 0)
>             (pc))) -1 (nil)
>     (expr_list:REG_BR_PROB (const_int 9900 [0x26ac])
>         (nil)))

I don't think the initial RTL is wrong: note that, while we perform the addition
in SImode, we still compare in HImode.  The problem appears to come from the
combiner, which gets rid of the HImode in the comparison.

> on PPC we get:
> (insn 11 9 12 (set (reg:HI 119)
>         (subreg/u:HI (reg/v:SI 118 [ ad ]) 2)) -1 (nil)
>     (nil))
> 
> (insn 12 11 13 (set (reg:SI 120)
>         (plus:SI (subreg:SI (reg:HI 119) 0)
>             (const_int -16384 [0xffffffffffffc000]))) -1 (nil)
>     (nil))
> 
> (insn 13 12 14 (set (reg:SI 121)
>         (sign_extend:SI (subreg:HI (reg:SI 120) 2))) -1 (nil)
>     (nil))
> 
> (insn 14 13 15 (set (reg:CC 122)
>         (compare:CC (reg:SI 121)
>             (const_int 0 [0x0]))) -1 (nil)
>     (nil))
> 
> (jump_insn 15 14 0 (set (pc)
>         (if_then_else (lt (reg:CC 122)
>                 (const_int 0 [0x0]))
>             (label_ref 0)
>             (pc))) -1 (nil)
>     (expr_list:REG_BR_PROB (const_int 9900 [0x26ac])
>         (nil)))
> 
> 
> Notice the sign_extend in the PPC but not in the x86 case.

This RTL is indeed more elegant and probably less error-prone.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19296


  parent reply	other threads:[~2005-01-06 22:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-06 19:18 [Bug rtl-optimization/19296] New: [3.3 " falk at debian dot org
2005-01-06 19:40 ` [Bug middle-end/19296] [3.3/3.4/4.0 " pinskia at gcc dot gnu dot org
2005-01-06 20:37 ` ebotcazou at gcc dot gnu dot org
2005-01-06 20:56 ` ebotcazou at gcc dot gnu dot org
2005-01-06 22:25 ` ebotcazou at gcc dot gnu dot org [this message]
2005-01-07  0:46 ` [Bug rtl-optimization/19296] " ebotcazou at gcc dot gnu dot org
2005-01-08 16:07 ` debian-gcc at lists dot debian dot org
2005-01-09  2:12 ` pinskia at gcc dot gnu dot org
2005-01-18  8:26 ` cvs-commit at gcc dot gnu dot org
2005-01-18  8:33 ` cvs-commit at gcc dot gnu dot org
2005-01-18  8:40 ` cvs-commit at gcc dot gnu dot org
2005-01-18  8:41 ` ebotcazou at gcc dot gnu dot org

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=20050106222459.658.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).