[comp.lang.ada] 64 bit intermediate results on the VAX...

stluka@software.ORG (Fred Stluka) (03/10/88)

In response to:  actnyc!djs@uunet.uu.net  (Dave Seward)

>I agree that the multiply and divide have to be broken up into constituent
>operations, but I would expect to use 64 bit intermediate results that EMUL
>and EDIV provide. Am I missing something?

The problem is not in generating 64-bit intermediate results; it is in
manipulating those results to produce a final result.  

For example, the next thing I tried after generating a bunch of 
intermediate results was to shift them into position to add them together.  
To do this, I tried using ASHQ (Arithmetic Shift Quadword) since there is 
no logical shift instruction.  Since ASHQ considers it an integer overflow 
if the sign bit ever changes, I had to do the shift in 2 parts:  first 
shift by one bit less than desired with the overflow trap enabled in case 
there really was an overflow; next shift the final bit position with the 
trap disabled to avoid spurious overflows.

Admittedly. many of my problems had to do with the combination of
my 3 goals:
     1)  64 bit manipulations 
     2)  Unsigned manipulations
     3)  Automatic propagation of overflows back to the calling 
         routine as Ada exceptions.
It may be much simpler (perhaps as simple as the 11 instruction example 
I referred to earlier on Page 201 of the 1981 VAX Architecture Handbook) 
if you tackle the extended precision problem alone.

--Fred Stluka

P.S.  As a new user of this bulletin board, I don't know whether it
      is appropriate to continue this discussion, which has come to 
      have relatively little to do with Ada, under the auspices of 
      INFO-ADA.  Please feel free to send messages directly to me
      unless you think they are still relevant to the entire 
      community.