Here is what I use presently for C-code 32x32 multiplies on the C55,
but you may want to run a few values considering a carry as mention by
Santhosh as this was not taken into account when testing this code.
/********************************************************************/
/* INT32 x INT32 (fractional) that produces a INT64 result */
/********************************************************************/
static inline void D_mult_ll_p(
INT32 * v1,
INT32 * v2,
INT32 * HI,
UINT32 * LO
)
{
INT16 a, c;
UINT16 b, d;
INT32 temp_HI;
UINT32 temp_LO;
register UINT32 temp_A1;
register INT32 temp_A2;
register INT32 temp_A3;
a = extract_h(*v1);
b = extract_l(*v1);
c = extract_h(*v2);
d = extract_l(*v2);
--- In c..., santhosh kumar wrote: >
> Hai Ashish,
> 64 bit result directly is not possible on c55x as the max data type available on c55x platform is 40bit(long long). But you can capture
it in two 32bit variables with some kind of work around. If you are
truncating/rounding 64bit to 32bit at some point in your code then
this method will work. >
> Usually in algorithms at some point these 64bit variable are truncated/rounded to 32bit. You have to do 32x32 in terms 16x16 and
should take care of carry during additions. >
> It may take at least 12cycles to do mac of kind 64bit + = 32bit x 32bit. >
> -Santhosh
>
>
>
>
>
> --- On Fri, 11/7/08, Ashish Gupta wrote:
> From: Ashish Gupta
> Subject: Re: [c55x] Re: 32 bit * 32 bit mutliplication in C
> To: c...
> Date: Friday, November 7, 2008, 9:59 PM
>
>
>
>
>
>
>
>
>
>
>
> Hi Aaron ,
> This is a fractional multiply and 64 bit result is required.
> Ashish
>
>
> On Thu, Nov 6, 2008 at 10:58 PM, wrote:
>
>
>
>
>
>
> We performing 32x32 or 32x16 multiplication two questions should be answered: >
> 1. Is this a fractional multiply or an integer multiply?
> 2. Is the 64 bit result required for the intended application?
>
> -Aaron
>
>
> Hi,
> >I am trying to do 32 bit * 32 bit multiplication on C55 x processor in C . I > >am unable to get the appropriate instruction or
intrinsic for that. Can u > >help in this regard. Or we have to do this operation
in assembly only. >
> >
> >Ashish
>
Reply by santhosh kumar●November 10, 20082008-11-10
Hai Ashish,
64 bit result directly is not possible on c55x as the max data type available
on c55x platform is 40bit(long long). But you can capture it in two 32bit
variables with some kind of work around. If you are truncating/rounding 64bit to
32bit at some point in your code then this method will work.
Usually in algorithms at some point these 64bit variable are truncated/rounded
to 32bit. You have to do 32x32 in terms 16x16 and should take care of carry
during additions.
It may take at least 12cycles to do mac of kind 64bit + = 32bit x 32bit.
-Santhosh
--- On Fri, 11/7/08, Ashish Gupta wrote:
From: Ashish Gupta
Subject: Re: [c55x] Re: 32 bit * 32 bit mutliplication in C
To: c...
Date: Friday, November 7, 2008, 9:59 PM
Hi Aaron ,
This is a fractional multiply and 64 bit result is required.
Ashish
On Thu, Nov 6, 2008 at 10:58 PM, wrote:
We performing 32x32 or 32x16 multiplication two questions should be answered:
1. Is this a fractional multiply or an integer multiply?
2. Is the 64 bit result required for the intended application?
-Aaron
Hi, >I am trying to do 32 bit * 32 bit multiplication on
C55 x processor in C . I
>am unable to get the appropriate instruction or intrinsic for that. Can u
>help in this regard. Or we have to do this operation in assembly only.
>
>Ashish
Reply by Ashish Gupta●November 10, 20082008-11-10
Hi Aaron ,
This is a fractional multiply and 64 bit result is required.
Ashish
On Thu, Nov 6, 2008 at 10:58 PM, wrote:
> We performing 32x32 or 32x16 multiplication two
questions should be
> answered:
>
> 1. Is this a fractional multiply or an integer multiply?
> 2. Is the 64 bit result required for the intended application?
>
> -Aaron
>
> Hi,
> >I am trying to do 32 bit * 32 bit multiplication on C55 x processor in C .
> I
> >am unable to get the appropriate instruction or intrinsic for that. Can u
> >help in this regard. Or we have to do this operation in assembly only.
> >
> >Ashish
>
Reply by asma...@yahoo.com●November 7, 20082008-11-07
We performing 32x32 or 32x16 multiplication two questions should be answered:
1. Is this a fractional multiply or an integer multiply?
2. Is the 64 bit result required for the intended application?
-Aaron
Hi, >I am trying to do 32 bit * 32 bit multiplication on
C55 x processor in C . I
>am unable to get the appropriate instruction or intrinsic for that. Can u
>help in this regard. Or we have to do this operation in assembly only.
>
>Ashish
On Tue, Nov 4, 2008 at 9:39 AM, Ashish Gupta wrote:
> Hi,
> I am trying to do 32 bit * 32 bit multiplication on C55 x processor in C .
> I
> am unable to get the appropriate instruction or intrinsic for that. Can u
> help in this regard. Or we have to do this operation in assembly only.
>
> Ashish
>
Reply by Karthik Balaguru●November 4, 20082008-11-04
Hi,
Like any other compiler, I think the normal ' * ' operator in c55x
will
implicitly do it for you.
Karthik Balaguru
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
"Ashish Gupta"
Sent by: c...
11/04/2008 09:39 AM
Please respond to
c...
To
c...
cc
Subject
[c55x] 32 bit * 32 bit mutliplication in C
Hi,
I am trying to do 32 bit * 32 bit multiplication on C55 x processor in C .
I
am unable to get the appropriate instruction or intrinsic for that. Can u
help in this regard. Or we have to do this operation in assembly only.
Hi,
I am trying to do 32 bit * 32 bit multiplication on C55 x processor in C . I
am unable to get the appropriate instruction or intrinsic for that. Can u
help in this regard. Or we have to do this operation in assembly only.