public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* RE: optimization/10362: Optimization with constant shifts and com pares fails on MIPS
@ 2003-04-09 23:06 Berger David-MGI2063
0 siblings, 0 replies; 4+ messages in thread
From: Berger David-MGI2063 @ 2003-04-09 23:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10362; it has been noted by GNATS.
From: Berger David-MGI2063 <dberger@motorola.com>
To: "'bangerth@dealii.org'" <bangerth@dealii.org>,
"'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>,
"'gcc-prs@gcc.gnu.org'"
<gcc-prs@gcc.gnu.org>,
"'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org>,
"'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Cc:
Subject: RE: optimization/10362: Optimization with constant shifts and com
pares fails on MIPS
Date: Wed, 9 Apr 2003 16:02:37 -0700
Copy code below to junk.c and compile as follows: gcc -o junk.s -O2 -S junk.c
volatile unsigned long i;
void test(void)
{
i = (((i & 0xf0) >> 4) >= 14); /* This one generates incorrect code with -O2 */
i = ((i & 0xf0) >= (14 << 4)); /* This is what the optimizer is trying to do */ }
-----Original Message-----
From: bangerth@dealii.org [mailto:bangerth@dealii.org]
Sent: Wednesday, April 09, 2003 3:45 PM
To: David Berger; gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org
Subject: Re: optimization/10362: Optimization with constant shifts and compares fails on MIPS
Synopsis: Optimization with constant shifts and compares fails on MIPS
State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Wed Apr 9 22:44:59 2003
State-Changed-Why:
The attachment got lost. Can you please re-send it as a
reply to this mail?
Thanks
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10362
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: optimization/10362: Optimization with constant shifts and com pares fails on MIPS
@ 2003-04-09 23:16 Wolfgang Bangerth
0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bangerth @ 2003-04-09 23:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10362; it has been noted by GNATS.
From: Wolfgang Bangerth <bangerth@ices.utexas.edu>
To: Berger David-MGI2063 <dberger@motorola.com>
Cc: "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>,
"'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Subject: RE: optimization/10362: Optimization with constant shifts and com
pares fails on MIPS
Date: Wed, 9 Apr 2003 18:07:54 -0500 (CDT)
> volatile unsigned long i;
>
> void test(void)
> {
> i = (((i & 0xf0) >> 4) >= 14); /* This one generates incorrect code with -O2 */
> i = ((i & 0xf0) >= (14 << 4)); /* This is what the optimizer is trying to do */
> }
I think what the compiler actually does, is to transform it to
i = ((i & 0xf0) > (14<<4-1));
However, since the lowest 4 bits of the left hand side of the comparison
are provably zero, this is equivalent to
i = ((i & 0xf0) > (13<<4));
Do you have a value for "i", where you actually get a wrong comparison?
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: optimization/10362: Optimization with constant shifts and com pares fails on MIPS
@ 2003-04-09 23:16 Falk Hueffner
0 siblings, 0 replies; 4+ messages in thread
From: Falk Hueffner @ 2003-04-09 23:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10362; it has been noted by GNATS.
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: Berger David-MGI2063 <dberger@motorola.com>
Cc: "'bangerth@dealii.org'" <bangerth@dealii.org>,
"'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>,
"'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>,
"'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org>,
"'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Subject: Re: optimization/10362: Optimization with constant shifts and com pares fails on MIPS
Date: 10 Apr 2003 01:07:44 +0200
Berger David-MGI2063 <dberger@motorola.com> writes:
> volatile unsigned long i;
>
> void test(void)
> {
> i = (((i & 0xf0) >> 4) >= 14); /* This one generates incorrect code with -O2 */
> i = ((i & 0xf0) >= (14 << 4)); /* This is what the optimizer is trying to do */
> }
The optimization seems valid to me. Can you give an example where it
fails?
--
Falk
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: optimization/10362: Optimization with constant shifts and com pares fails on MIPS
@ 2003-04-09 23:06 Berger David-MGI2063
0 siblings, 0 replies; 4+ messages in thread
From: Berger David-MGI2063 @ 2003-04-09 23:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10362; it has been noted by GNATS.
From: Berger David-MGI2063 <dberger@motorola.com>
To: "'bangerth@dealii.org'" <bangerth@dealii.org>,
Berger David-MGI2063
<dberger@motorola.com>,
"'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>,
"'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>,
"'nobody@gcc.gnu.org'"
<nobody@gcc.gnu.org>,
"'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>
Cc:
Subject: RE: optimization/10362: Optimization with constant shifts and com
pares fails on MIPS
Date: Wed, 9 Apr 2003 16:01:12 -0700
volatile unsigned long i;
void test(void)
{
i = (((i & 0xf0) >> 4) >= 14); /* This one generates incorrect code with -O2 */
i = ((i & 0xf0) >= (14 << 4)); /* This is what the optimizer is trying to do */
}
-----Original Message-----
From: bangerth@dealii.org [mailto:bangerth@dealii.org]
Sent: Wednesday, April 09, 2003 3:45 PM
To: David Berger; gcc-bugs@gcc.gnu.org; gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org
Subject: Re: optimization/10362: Optimization with constant shifts and compares fails on MIPS
Synopsis: Optimization with constant shifts and compares fails on MIPS
State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Wed Apr 9 22:44:59 2003
State-Changed-Why:
The attachment got lost. Can you please re-send it as a
reply to this mail?
Thanks
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10362
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-09 23:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-09 23:06 optimization/10362: Optimization with constant shifts and com pares fails on MIPS Berger David-MGI2063
2003-04-09 23:06 Berger David-MGI2063
2003-04-09 23:16 Wolfgang Bangerth
2003-04-09 23:16 Falk Hueffner
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).