This is the mail archive of the
egcs@egcs.cygnus.com
mailing list for the EGCS project. See the EGCS
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Re: another silly optimisation case
- To: weejock@ferret.lmh.ox.ac.uk (Matthew Kirkwood)
- Subject: Re: another silly optimisation case
- From: Joern Rennecke <amylaar@cygnus.co.uk>
- Date: Wed, 10 Mar 1999 18:47:34 +0000 (GMT)
- Cc: egcs@egcs.cygnus.com
- Delivered-To: listarch-egcs@egcs.cygnus.com
- Delivered-To: mailing list egcs@egcs.cygnus.com
- In-Reply-To: <Pine.LNX.3.96.990310182553.21254A-100000@ferret.lmh.ox.ac.uk> from Matthew Kirkwood at "Mar 10, 99 06:39:42 pm"
- Mailing-List: contact egcs-help@egcs.cygnus.com; run by ezmlm
- Sender: owner-egcs@egcs.cygnus.com
> Hi,
>
> egcs RH5.2 (egcs-2.90.27 980315 (egcs-1.0.2 release))
> generates different code for these two functions, the
> first including a jump even with -O6:
>
> int f(int g) { return g ? 34 : 0; }
>
> int g(int f) { return f && 34; }
>
> I don't suppose (x ? y : 0) is a hugely common construction
> but it seems to be another candidate for simple optimisation.
>
> Am I missing something about what the standard says about
> these two operators?
f (1) returns 34.
g (1) returns 1.