Article View: comp.arch
Article #13560Re: Optimization vs. the programmer
From: der Mouse
Date: Sun, 26 Apr 1987 19:03
Date: Sun, 26 Apr 1987 19:03
19 lines
1568 bytes
1568 bytes
In article <919@aw.sei.cmu.edu.sei.cmu.edu>, firth@sei.cmu.edu (Robert Firth) writes: > In article <3300003@uiucdcsm> grunwald@uiucdcsm.cs.uiuc.edu writes: >> Strength reduction is replacement of operations such as "i = j * 8" >> by "i = j << 3", or "i = j % 8" by "i = j & 0x3" (if j is unsigned). > [second example should read 7, not 3]. And in the first, the > replacement is invalid if the expression overflows. Why? j*8 will overflow if and only if j<<3 overflows....the only way I can see a problem is if overflow checking is turned on and either (a) multiply overflows trigger it but shift overflows don't or (b) shift overflows trigger it but multiply overflows don't. How many machines are there that trigger overflow exceptions on the one sort of overflow but not on the other? (Yes, a VAX does too trap on a shift overflow, or at least the Architecture Reference Manual says it's supposed to). der Mouse (mouse@mcgill-vision.uucp)
Technical Details
Message-ID:
<745@mcgill-vision.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-lcc!styx!ames!necntc!linus!philabs!micomvax!musocs!mcgill-vision!mouseReferences:
<479@danews.ATT.COM> <3300003@uiucdcsm> <919@aw.sei.cmu.edu.sei.cmu.edu>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-lcc!styx!ames!necntc!linus!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.arch Subject: Re: Optimization vs. the programmer Message-ID: <745@mcgill-vision.UUCP> Date: Sun, 26-Apr-87 15:03:09 EDT Article-I.D.: mcgill-v.745 Posted: Sun Apr 26 15:03:09 1987 Date-Received: Sun, 3-May-87 18:39:57 EDT References: <479@danews.ATT.COM> <3300003@uiucdcsm> <919@aw.sei.cmu.edu.sei.cmu.edu> Organization: McGill University, Montreal Lines: 19