Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!sdd.hp.com!hp-pcd!hpfcso!hplabs!cello!renglish From: renglish@cello.hpl.hp.com (Bob English) Newsgroups: comp.sys.hp Subject: Re: HP9000-7XX overflow : Technical question Message-ID: <1991Apr05.165011.27962@cello.hpl.hp.com> Date: 5 Apr 91 16:50:11 GMT References: <9934@discus.technion.ac.il> Organization: Hewlett Packard Labs Lines: 28 devil@techunix.BITNET (Gil Tene) writes: > How do I do integer overflow detection on a 9000-7xx ? > (using machine code is OK) > Is it possible? Is it "cheap"? can it be done? can it be done without > using a whole signal call mechanism every time an overflow occurs? I don't know what high-level language support exists for this, but since you don't seem to care, I'll tell you about the machine level stuff. Instead of using condition codes, PA-RISC uses nullification to modify instruction streams. On many instructions, you can specify a condition which, if met, will cause the following instruction to be skipped or nullified. If, for example, you wanted to add the contents of register r1 to r2, and set the third bit of register r3 on overflow, you could use the following two instruction sequence: add,nuv r1,r2,r2 ; nullify if no unsigned overflow depi 1,3,1,r3 ; set bit three in r3 The instruction set has many such primitives (there are nullification codes for all varieties of overflow and non-overflow, for example), as well as instructions that combine branches with conditions. The best way to see the whole set is to get a copy of the PA-RISC Architecture and Instruction Set Reference Manual. I don't know how to order them, however; they just show up on my desk every once in a while :-). --bob-- renglish@hplabs.hp.com