From: Joe Buck <jbuck@synopsys.com>
To: egcs@cygnus.com
Subject: Re: [EGCS] Re: min/max macros
Date: Thu, 11 Dec 1997 19:51:00 -0000 [thread overview]
Message-ID: <199712120317.TAA08800@atrus.synopsys.com> (raw)
In-Reply-To: <19971212025753.58271@cerebro.laendle>
> > > #define max(a,b) (((a) > (b)) ? (a) : (b))
> > > #define min(a,b) (((a) < (b)) ? (a) : (b))
> >
> > That is a big no-no: Absolutely no performance benefits with any decent
> > compiler but nasty side effects.
>
> so egcs isn't a decent compiler?
>
> for example, the macro-max(2,3) will be evaluated at compile time,
> while the function-max(2,3) won't...
The function max(2,3) will indeed be evaluated at compile time, if it is
inlined.
> this get's even worse on things like:
>
> int mult(int a, int b) { return a*b; };
>
> mult(a,3) will result in an "imul 3" on x86... definitely
> slower than a lea, for example.
Same for mult: if it is inlined, it will be evaluated at compile time if
given constant arguments.
next prev parent reply other threads:[~1997-12-11 19:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-11 9:17 Bill Ahlbrandt
1997-12-11 13:03 ` dave madden
1997-12-11 13:03 ` Michael A. Benzinger
1997-12-11 13:43 ` Gerald Pfeifer
1997-12-11 17:57 ` [EGCS] " Marc Lehmann
1997-12-11 19:51 ` Joe Buck [this message]
1997-12-12 10:18 ` Marc Lehmann
1997-12-11 13:43 ` [EGCS] " Marc Lehmann
1997-12-12 7:51 ` Paul Koning
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=199712120317.TAA08800@atrus.synopsys.com \
--to=jbuck@synopsys.com \
--cc=egcs@cygnus.com \
/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).