This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ifcvt.c and STORE_FLAG_VALUE
- To: John dot Vickers at pace dot co dot uk (John Vickers)
- Subject: Re: ifcvt.c and STORE_FLAG_VALUE
- From: "Philippe De Muyter" <phdm at macqel dot be>
- Date: Thu, 4 May 2000 19:27:33 +0200 (CEST)
- Cc: gcc-patches at gcc dot gnu dot org, meissner at cygnus dot com
John Vickers wrote :
> Philippe De Muyter wrote:
> >
> > Bootstrapping on m68k-motorola-sysv yields also the following failure:
> >
> > cc -c -DIN_GCC -g -DHAVE_CONFIG_H -I. -I/gcc -I/gcc/config -I/gcc/../include /gcc/ifcvt.c
> > "/gcc/ifcvt.c", line 519: illegal lhs of assignment operator
> > "/gcc/ifcvt.c", line 557: illegal lhs of assignment operator
> > "/gcc/ifcvt.c", line 640: illegal lhs of assignment operator
> >
> > That happens with -STORE_FLAG_VALUE when STORE_FLAG_VALUE is defined as -1
>
> > I thought to define it as (-1), but as it it tested in preprocessor
> > expressions for equality with -1, I did not dare to do that.
>
> Sorry if I'm being dense, but the brackets in the macro definition
> don't look like a courageous step to me.
>
> Presumably you agree that normally we should have the brackets
> in the definition, rather than hacking the point of use, but you
> perhaps know of a preprocessor where this would break ?
The preprocessor I tested on afterwards does not break, but all the
documentation says STORE_FLAG_VALUE has a value of 1 or -1, not (-1).
And I have found other places where protecting STORE_FLAG_VALUE from - was
done that way, or with a space between - and STORE_FLAG_VALUE.
./gcc/combine.c: && INTVAL (true) == - STORE_FLAG_VALUE
./gcc/combine.c: && INTVAL (false) == - STORE_FLAG_VALUE
./gcc/expmed.c: else if (- normalizep == STORE_FLAG_VALUE)
So, for the moment I feel inclined to only add a space between - and
STORE_FLAG_VALUE, instead of my proposed fix, but I will fix every definition
of STORE_FLAG_VALUE and the documentation if that's what the majority wants.
>
> Regards,
>
> John.
>
> > My proposed fix
> > is below. OK to commit ?
> >
> > Philippe De Muyter <phdm@macqel.be>
> >
> > * ifcvt.c (noce_try_store_flag_constants): Do not negate
> > STORE_FLAG_VALUE.
> [...]
> > - if (diff == STORE_FLAG_VALUE || diff == -STORE_FLAG_VALUE)
> > + if (diff == STORE_FLAG_VALUE || -diff == STORE_FLAG_VALUE)
>
> Michael Meissner wrote:
> >
> > Yes it is ok to commit, providing you put in a comment of why this is being
> > done, or possibly change the line to:
> >
> > if (diff == STORE_FLAG_VALUE || diff == -(STORE_FLAG_VALUE))
>