Get the montmulf code to build, in preparation for integration into MPI.

This commit is contained in:
nelsonb%netscape.com 2000-11-17 20:15:29 +00:00
Родитель f2bb52bc53
Коммит ab28a8e66c
3 изменённых файлов: 26 добавлений и 80 удалений

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
*
* Contributor(s):
* Netscape Communications Corporation
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
@ -29,16 +30,16 @@
* may use your version of this file under either the MPL or the
* GPL.
*
* $Id: montmulf.c,v 1.1 2000-10-13 00:27:04 nelsonb%netscape.com Exp $
* $Id: montmulf.c,v 1.2 2000-11-17 20:15:28 nelsonb%netscape.com Exp $
*/
#define RF_INLINE_MACROS
static double TwoTo16=65536.0;
static double TwoToMinus16=1.0/65536.0;
static double Zero=0.0;
static double TwoTo32=65536.0*65536.0;
static double TwoToMinus32=1.0/(65536.0*65536.0);
static const double TwoTo16=65536.0;
static const double TwoToMinus16=1.0/65536.0;
static const double Zero=0.0;
static const double TwoTo32=65536.0*65536.0;
static const double TwoToMinus32=1.0/(65536.0*65536.0);
#ifdef RF_INLINE_MACROS
@ -46,6 +47,14 @@ double upper32(double);
double lower32(double, double);
double mod(double, double, double);
void i16_to_d16_and_d32x4(const double * /*1/(2^16)*/,
const double * /* 2^16*/,
const double * /* 0 */,
double * /*result16*/,
double * /* result32 */,
float * /*source - should be unsigned int*
converted to float* */);
#else
static double upper32(double x)
@ -66,7 +75,7 @@ static double mod(double x, double oneoverm, double m)
#endif
void cleanup(double *dt, int from, int tlen)
static void cleanup(double *dt, int from, int tlen)
{
int i;
double tmp,tmp1,x,x1;
@ -149,30 +158,24 @@ unsigned int a;
}
void i16_to_d16_and_d32x4(double * /*1/(2^16)*/, double * /* 2^16*/,
double * /* 0 */,
double * /*result16*/, double * /* result32 */,
float * /*source - should be unsigned int*
converted to float* */);
void conv_i32_to_d32_and_d16(double *d32, double *d16,
unsigned int *i32, int len)
{
int i;
int i = 0;
unsigned int a;
#pragma pipeloop(0)
for(i=0;i<len-3;i+=4)
#ifdef RF_INLINE_MACROS
for(;i<len-3;i+=4)
{
i16_to_d16_and_d32x4(&TwoToMinus16, &TwoTo16, &Zero,
&(d16[2*i]), &(d32[i]), (float *)(&(i32[i])));
}
#endif
for(;i<len;i++)
{
a=i32[i];
d32[i]=(double)(i32[i]);
d32[i]=(double)(a);
d16[2*i]=(double)(a&0xffff);
d16[2*i+1]=(double)(a>>16);
}
@ -206,7 +209,6 @@ int i;
void cleanup(double *dt, int from, int tlen);
/*
** the lengths of the input arrays should be at least the following:

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
*
* Contributor(s):
* Netscape Communications Corporation
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
@ -29,7 +30,7 @@
* may use your version of this file under either the MPL or the
* GPL.
*
* $Id: montmulf.h,v 1.1 2000-10-13 00:28:08 nelsonb%netscape.com Exp $
* $Id: montmulf.h,v 1.2 2000-11-17 20:15:28 nelsonb%netscape.com Exp $
*/
/* The functions that are to be called from outside of the .s file have the
@ -86,11 +87,12 @@ void mont_mulf_noconv(unsigned int *result,
* Note that m1 and m2 should both be of length nlen, so they should be
* padded with 0's if necessary before the conversion. The result comes in
* this form (int representation, padded with 0's).
* dn0 is the value of the 16 least significant bits of n0'.
* The function does not allocate memory for any of the arrays, so the
* pointers should point to arrays with the following minimal sizes:
* result - nlen+1
* dm1 - nlen
* dm2 - 2*nlen+1 /* the +1 is necessary for technical reasons */
* dm2 - 2*nlen+1 ( the +1 is necessary for technical reasons )
* dt - 4*nlen+2
* dn - nlen
* nint - nlen

Просмотреть файл

@ -29,7 +29,7 @@
! may use your version of this file under either the MPL or the
! GPL.
!
! $Id: montmulf.il,v 1.1 2000-10-13 00:28:48 nelsonb%netscape.com Exp $
! $Id: montmulf.il,v 1.2 2000-11-17 20:15:29 nelsonb%netscape.com Exp $
!
!
@ -76,58 +76,6 @@
.end
!
! void separate16(double * /*1/(2^16)*/, double * /* 2^16*/,
! double * /*result*/
! float * /*source - should be unsigned int*
! converted to float* */);
!
.inline separate16,20
ldd [%o0],%f2 ! 1/(2^16)
ldd [%o1],%f4 ! 2^16
ld [%o3],%f7
fmovs %f5,%f6
ld [%o3+4],%f11
fmovs %f5,%f10
ld [%o3+8],%f15
fmovs %f5,%f14
ld [%o3+12],%f19
fmovs %f5,%f18
fxtod %f6,%f6
fxtod %f10,%f10
fxtod %f14,%f14
fxtod %f18,%f18
fmuld %f2,%f6,%f8
fmuld %f2,%f10,%f12
fmuld %f2,%f14,%f16
fmuld %f2,%f18,%f20
fdtox %f8,%f8
fdtox %f12,%f12
fdtox %f16,%f16
fdtox %f20,%f20
fxtod %f8,%f8
std %f8,[%o2+8]
fxtod %f12,%f12
std %f12,[%o2+24]
fxtod %f16,%f16
std %f16,[%o2+40]
fxtod %f20,%f20
std %f20,[%o2+56]
fmuld %f8,%f4,%f8
fmuld %f12,%f4,%f12
fmuld %f16,%f4,%f16
fmuld %f20,%f4,%f20
fsubd %f6,%f8,%f8
std %f8,[%o2]
fsubd %f10,%f12,%f12
std %f12,[%o2+16]
fsubd %f14,%f16,%f16
std %f16,[%o2+32]
fsubd %f18,%f20,%f20
std %f20,[%o2+48]
.end
!
! void i16_to_d16_and_d32x4(double * /*1/(2^16)*/, double * /* 2^16*/,
! double * /* 0 */,
@ -187,9 +135,3 @@
.end
!
! unsigned long long tick();
!
.inline tick,0
rd %tick,%o0
.end