public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "wilson at tuliptree dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/35885] unsigned long long and while loop evaluation regression? Date: Sat, 12 Apr 2008 00:46:00 -0000 [thread overview] Message-ID: <20080412004536.16961.qmail@sourceware.org> (raw) In-Reply-To: <bug-35885-16037@http.gcc.gnu.org/bugzilla/> ------- Comment #3 from wilson at tuliptree dot org 2008-04-12 00:45 ------- Subject: Re: New: unsinged long long and while loop evaluation regression? I can reproduce this on a 32-bit x86-linux machine (i.e. a 32-bit HWI). The unsigned long long 0xffffffff becomes a (const_double -1 0), and then in expand_mult in expmed.c we have /* If we are multiplying in DImode, it may still be a win to try to work with shifts and adds. */ if (CONST_DOUBLE_HIGH (op1) == 0) coeff = CONST_DOUBLE_LOW (op1); After this line, expand_mult thinks we are multiplying by -1 and we get the wrong result. I think there is a false assumption here that we can get CONST_DOUBLEs which can be simplified to a single word. Maybe in the olden days we always created a CONST_DOUBLE for DImode constants? This stuff has changed so many times it is hard to remember. I don't think we do it that way anymore. Anyways, if this assumption is not false, then the code needs to look more like the code in immed_double_const in emit-rtl.c, which does /* If this integer fits in one word, return a CONST_INT. */ if ((i1 == 0 && i0 >= 0) || (i1 == ~0 && i0 < 0)) return GEN_INT (i0); where i1 is CONST_DOUBLE_HIGH and i0 is CONST_DOUBLE_LOW, and only in the case that this tests succeeds can we set coeff to CONST_DOUBLE_LOW. The same bug is in mainline, and probably goes a long ways back. Jim -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35885
next prev parent reply other threads:[~2008-04-12 0:46 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-04-09 10:33 [Bug c/35885] New: unsinged " wilbert at jdg dot info 2008-04-09 13:06 ` [Bug c/35885] unsigned " rguenth at gcc dot gnu dot org 2008-04-09 15:37 ` wilbert at jdg dot info 2008-04-12 0:46 ` wilson at tuliptree dot org [this message] 2008-04-12 3:11 ` [Bug middle-end/35885] " pinskia at gcc dot gnu dot org 2008-04-15 0:26 ` wilson at gcc dot gnu dot org 2009-03-31 16:07 ` [Bug middle-end/35885] [4.3/4.4/4.5 Regression] " jsm28 at gcc dot gnu dot org 2009-04-01 8:19 ` jakub 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=20080412004536.16961.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: linkBe 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).