pro64-contrib
[Top] [All Lists]

Re: The fastest way to multiply large integers

To: duraid@xxxxxxxxx
Subject: Re: The fastest way to multiply large integers
From: Richard Shapiro <rshapiro@xxxxxxxx>
Date: Thu, 1 Jun 2000 14:20:19 -0400
Cc: pro64-contrib@xxxxxxxxxxx
In-reply-to: <AFEEIDHGBPFINNGKLJOBKECCCCAA.duraid@fl.net.au>
References: <AFEEIDHGBPFINNGKLJOBKECCCCAA.duraid@fl.net.au>
Sender: owner-pro64-contrib@xxxxxxxxxxx
   From: "Duraid Madina" <duraid@xxxxxxxxx>
   Date:   Thu, 1 Jun 2000 11:49:54 +1000
   X-Priority: 3 (Normal)
   X-MSMail-Priority: Normal
   Importance: Normal
   X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
   X-Orcpt: rfc822;pro64-contrib@xxxxxxxxxxx
   Sender: owner-pro64-contrib@xxxxxxxxxxx
   Precedence: bulk
   Content-Type: text/plain;
           charset="iso-8859-1"
   Content-Length: 862


           What's the best way (for Itanium, at least) to multiply large 
integers? For
   example, 128 bit integers, 1024 bit integers or indeed arbitrarily large
   integers?

           I had a look through the Pro64 source and note that there is decreed 
a
   threshold of '14' below which successive shifts+adds are used, and above
   which you outright multiply. But when is it best to use the xma instruction
   (and the associated cost of converting to/from an FP representation)? When
   is it better to use the integer packed multiply instructions? For 'streaming
   multiplication', as it were, what do you think is the best way to proceed?
   Using the integer/MM units? The FP units? Both at once?

           I am concerned with 'normal' multiplication of ~kilobit numbers, not
   massive numbers where it's better to use transform-based multiplication.


It's a pretty complex question. If you can pipeline things, you want to use
xma. For example, if you are doing extended-precision multiplication, you
can keep things in the FPU, and you will win.

For a single isolated integer multiply, I think that on Itanium you
actually can do a multiply by a 64 bit constant in comparable time using
shift-adds. 

If you are multiplying two numbers, nether of which is a compile-time
constant, you always win with xma.

-- 
Richard Shapiro
Ab Initio Software Corporation
rshapiro@xxxxxxxx
(781) 301-2311

<Prev in Thread] Current Thread [Next in Thread>
  • Re: The fastest way to multiply large integers, Richard Shapiro <=