Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!felix!dhw68k!arcturus!evil From: evil@arcturus.UUCP (Wade Guthrie) Newsgroups: comp.lang.c Subject: Re: C optimizer Summary: what kind of optimizers Keywords: C Ultrix Message-ID: <3684@arcturus> Date: 14 Feb 89 21:15:49 GMT References: <515@larry.UUCP> Organization: Rockwell International, Anaheim, CA Lines: 27 In article <515@larry.UUCP>, jwp@larry.UUCP (Jeffrey W Percival) writes: > my real question is, would *most* compilers optimize this . . . While we're talking about optimizers (and, since all the furor about optimizing one's code has died down :->), what do most optimizers on most C compilers do? Where is TFM that I should be 'R'ing (and in which FM should I look?) I would expect the following optimizations: 1) constant expression reduction 2) loop inversion 3) reducing things like intval/2 == intval >> 1 when they are faster. I actually saw a programmer write something LAST YEAR that used intval >> n instead of dividing. Scary. What else should I expect? From what compilers? On what machines? In short, what should I do myself and what should I let the *general* optimizer/compiler do? Wade Guthrie evil@arcturus.UUCP Rockwell International Anaheim, CA (Rockwell doesn't necessarily believe / stand by what I'm saying; how could they when *I* don't even know what I'm talking about???)