Re: programmer optimizations?

cdg@nullstone.com (Christopher Glaeser)
Mon, 23 Jan 1995 01:04:33 GMT

          From comp.compilers

Related articles
[6 earlier articles]
Re: programmer optimizations? conway@munta.cs.mu.OZ.AU (1995-01-05)
Re: programmer optimizations? bill@amber.ssd.csd.harris.com (1995-01-05)
Re: programmer optimizations? kerch@albion.camb.inmet.com (1995-01-12)
Re: programmer optimizations? monnier@di.epfl.ch (Stefan Monnier) (1995-01-21)
Re: programmer optimizations? synaptx!carambole!daveg@uunet.uu.net (Dave Gillespie) (1995-01-11)
Re: programmer optimizations? det@sw.stratus.com (David Toland) (1995-01-11)
Re: programmer optimizations? cdg@nullstone.com (1995-01-23)
Re: programmer optimizations? hbaker@netcom.com (1995-01-27)
Re: programmer optimizations? cdg@nullstone.com (1995-01-31)
Re: programmer optimizations? c1veeru@WATSON.IBM.COM (Virendra K. Mehta) (1995-02-02)
Re: programmer optimizations? hbaker@netcom.com (1995-02-01)
Re: programmer optimizations? bill@amber.ssd.csd.harris.com (1995-02-01)
Re: programmer optimizations? gnb@bby.com.au (1995-02-02)
[1 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: cdg@nullstone.com (Christopher Glaeser)
Keywords: optimize
Organization: Compilers Central
References: 94-12-145
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
following:


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
      integer.


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
      divide.


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 cdg@nullstone.com
Nullstone Corporation
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.