On 2021-07-06 11:00, Anders Magnusson wrote:
Den 2021-07-06 kl. 10:41, skrev Johnny Billquist:Those instructions are quite useless today as well. Since EMUL takes two 32-bit signed integers and produces 64-bit signed output it is a very special case when it even can be used. The same is true with EDIV, it is possible to get a s32 remainder, but the rest needs extra code.On 2021-07-06 10:28, Anders Magnusson wrote:In 64-bit mode nothing should ever span multiple registers.EDIV/EMUL are strange creatures anyway, no reason to have a 64-bit counterpart. DIVQ/UDIVQ/REMQ/UREMQ/MULQ/UMULQ will solve the problem.I would disagree, unless we then say we do not care about anything larger than 64 bits.The reason EMUL and EDIV exists is because you needed a way of doing multiplications and division with larger than 32-bit values. I think it was very obvious they were needed, and not strange at all.
Well, the processor handbook even have the description on how you use EMUL and MUL to do multiplication of two 64-bit values. Without EMUL it becomes a much larger and more tedious process to multiply 64-bit values. But yes, it's only usable for signed multiplications. Which is annoying. (And is the same problem on the PDP-11.)
So I'd say it definitely have value. However, it's a fair point that it might be hard to get compilers to make use of it. As is the case for so much of the stuff in the VAX. It's good for people writing in assembler, but difficult to make use of by compilers...
If you have two 64-bit values which you multiply, there is a fair chance the result will not fit into 64 bits, and a carry won't be enough to handle the overflow. :-) Then what? Just give up. Leave it all to be done in software? Or add some instruction that can assist you?Yes, do it in software. You don't have any modern language that want to deal with the upper part anyway.
Ok. Fair enough. That wasn't a very meaningful example or question. (Well, it's meaningful sometimes to assembler programmers, but hardly for any higher level language.) But for the VAX32, having support allowing for efficient multiplication of 64-bit values is something I see value in. I sortof see the same for a VAX64 to efficiently deal with 128 bit multiplications as well. But as this does not extend to larger values, maybe it's questionable how much value it do have in the end.
Johnny -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt%softjar.se@localhost || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol