[Info-vax] Integer Divide, Multiply, Alpha SRM(was: Re: Kednos PL/I)
Johnny Billquist
bqt at softjar.se
Sun Sep 17 10:57:00 EDT 2023
On 2023-09-16 19:25, Stephen Hoffman wrote:
> On 2023-09-15 03:17:31 +0000, gah4 said:
>
>> On Thursday, September 14, 2023 at 7:38:58 AM UTC-7, Johnny Billquist
>> wrote:
>>
>> (snip)
>>
>>> It's UMULH, but I agree. The Alpha was definitely designed for
>>> getting a 128 bit result from 64 bit multiply. But it is done via two
>>> instructions. MULQ;UMULH. If you want a signed MUL, you then need a
>>> couple of more steps to adjust the result. But it's a simple
>>> thing.Okay, I found my "Alpha Architecture Handbook", copyright 1992.
>>
>> I think I got it before machines were available for sale.
>>
>> And what I had forgotten, and might have known 31 years ago:
>> There is no hardware integer divide.
>> For divide by constant, you can usually, or maybe always, use the
>> high half of the double length product.
>> And for variable divide, they suggest, but don't write out, a successive
>> approximation algorithm. Presumably usually as a subroutine call.
>>
>> There is floating point divide, though.
>
> Invert and multiply, quite commonly.
> See A.4.2 in SRM
> http://bitsavers.org/pdf/dec/alpha/system_reference/Alpha_System_Reference_Manual_Version_5_199205.pdf
> The Alpha Architecture Reference Manual (ARM) was a de-tuned version of
> the Alpha System Reference Manual (SRM).
Inverting isn't really an option on integer arithmetic... But yes, for
FP it's definitely a thing.
But that manual also contains other good tricks for division. Which
sortof leads in the same direction as gah4 was suggesting.
Johnny
More information about the Info-vax
mailing list