Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!sri-spam!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.arch Subject: Re: Sticky overflow (was Shift and Subtract is NOT Multiply) Message-ID: <724@cresswell.quintus.UUCP> Date: 3 Mar 88 09:35:56 GMT References: <7649@pur-ee.UUCP> <7276@sol.ARPA> <718@cresswell.quintus.UUCP> <7310@sol.ARPA> Organization: Quintus Computer Systems, Mountain View, CA Lines: 33 In article <7310@sol.ARPA>, crowl@cs.rochester.edu (Lawrence Crowl) writes: > In article <718@cresswell.quintus.UUCP> ok@quintus.UUCP > (Richard A. O'Keefe) writes: > )Suppose there were two flavours of load/move instruction (one to clear the > )overflow bit, one to leave it alone), and that integer arithmetic > )instructions were to set the overflow bit, but not clear it. Then this > )argument against shift-and-subtract would go away. > > You have missed the point. I'm afraid Lawrence Crowl missed my point entirely. I couldn't care less about multiplication by 7 or any other specific operation. I just used that (which was already being discussed) as a lead-in. Suppose I have a Pascal or ADA program which does K := (some hairy great complicated integer expression); There seem to be three approaches in current use: (1) have an integer overflow interrupt, which is enabled for Pascal and ADA, but disabled for C. (2) have a non-sticky overflow bit, which has to be tested after each instruction which the compiler is unable to prove will not overflow. Again, Pascal and ADA would keep testing this flag, C would never test it. (3) Ignore the problem and hope it will go away. Very popular for Pascal, normally illegal for ADA. With a sticky-overflow bit, (1) you don't have to switch modes when calling C from ADA or vice versa (2) you only have to test just before stores and compares (3) one 'trapv' per assignment or comparison is a sufficiently low cost that going to sea without a life jacket might seem less attractive. In the Good Old Days I used to use a B6700, and since that I have never been able to regard quiet overflow as a good idea. Sticky overflow seems like such an obvious idea (I stole it from IEEE floating point). Why is it not used, or is it?