|[6 earlier articles]|
|Re: programmer optimizations? email@example.com.OZ.AU (1995-01-05)|
|Re: programmer optimizations? firstname.lastname@example.org (1995-01-05)|
|Re: programmer optimizations? email@example.com (1995-01-12)|
|Re: programmer optimizations? firstname.lastname@example.org (Stefan Monnier) (1995-01-21)|
|Re: programmer optimizations? email@example.com (Dave Gillespie) (1995-01-11)|
|Re: programmer optimizations? firstname.lastname@example.org (David Toland) (1995-01-11)|
|Re: programmer optimizations? email@example.com (1995-01-23)|
|Re: programmer optimizations? firstname.lastname@example.org (1995-01-27)|
|Re: programmer optimizations? email@example.com (1995-01-31)|
|Re: programmer optimizations? c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-02-02)|
|Re: programmer optimizations? firstname.lastname@example.org (1995-02-01)|
|Re: programmer optimizations? email@example.com (1995-02-01)|
|Re: programmer optimizations? firstname.lastname@example.org (1995-02-02)|
|[1 later articles]|
|From:||email@example.com (Christopher Glaeser)|
|Date:||Mon, 23 Jan 1995 01:04:33 GMT|
> > replacing (n / 4)
> > by (n >> 2)
> Unfortunately it seems you cannot always trust the compiler writers
> to do the right thing here.
We have evaluated approximately twenty compilers on a variety of
architectures using Nullstone, an automated compiler performance analysis
tool, and have made similar observations. Replacing power of 2 multiply,
divide, and mod with shift or shift/add/sub sequences can improve
performance on many machines, and is a relatively easy optimization,
yet many compilers generate less-than-optimal code for at least some
power of 2 expressions. Observed optimization *defects* include the
1. Some compilers optimize power of 2 multiply, but not divide and/or mod.
2. Some compilers optimize unsigned integer power of 2, but not signed
3. Some compilers optimize int power or 2, but not short int.
4. Some compilers optimize positive powers of 2 (e.g. 2,4,8), but not
negative powers of 2 (e.g. -2,-4,-8).
5. Some compiler core dump on some power of 2 bit patterns.
6. Some compilers generate incorrect code for signed int power of 2
7. Some compilers optimize some powers of 2 (e.g. bit 1 through bit 13),
but not other powers of 2 (e.g. bit 14 through bit 32).
Christopher Glaeser firstname.lastname@example.org
Return to the
Search the comp.compilers archives again.