mont_mulf.c revision 8475e04352e630e4bd0f59a283286ee2475a14ce
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* If compiled without -DRF_INLINE_MACROS then needs -lm at link time
* If compiled with -DRF_INLINE_MACROS then needs conv.il at compile time
* (i.e. cc <compiler_flags> -DRF_INLINE_MACROS conv.il mont_mulf.c )
*/
#include <math.h>
static const double TwoTo16 = 65536.0;
static const double Zero = 0.0;
#ifdef RF_INLINE_MACROS
double upper32(double);
double lower32(double, double);
double mod(double, double, double);
#else
static double
upper32(double x)
{
return (floor(x * TwoToMinus32));
}
static double
lower32(double x, double y)
{
}
static double
{
}
#endif
static void
{
int i;
x = dt[i];
}
}
void
{
int i;
a, b, c, d; /* because more efficient code is */
/* generated this way, and there */
/* is no overflow. */
t1 = 0;
for (i = 0; i < ilen - 1; i++) {
t1 += a & 0xffffffff;
t = (a >> 32);
t1 = t;
a = c;
b = d;
}
t1 += a & 0xffffffff;
t = (a >> 32);
}
void
{
int i;
#pragma pipeloop(0)
for (i = 0; i < len; i++)
}
void
{
int i;
uint32_t a;
#pragma pipeloop(0)
for (i = 0; i < len; i++) {
a = i32[i];
}
}
#ifdef RF_INLINE_MACROS
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 void
const double *dummy2, /* 2^16 */
const double *dummy3, /* 0 */
double *result16,
double *result32,
float *src) /* source - should be unsigned int* */
/* converted to float* */
{
uint32_t a, b, c, d;
a = i32[0];
b = i32[1];
c = i32[2];
d = i32[3];
result16[0] = (double)(a & 0xffff);
result32[0] = (double)a;
result32[1] = (double)b;
result32[2] = (double)c;
result32[3] = (double)d;
}
#endif
void
{
int i;
uint32_t a;
#pragma pipeloop(0)
}
for (; i < len; i++) {
a = i32[i];
}
}
static void
{
int i;
i = -1;
else {
for (i = len - 1; i >= 0; i--) {
}
}
acc = 0;
for (i = 0; i < len; i++) {
}
}
}
/*
* the lengths of the input arrays should be at least the following:
* result[nlen+1], dm1[nlen], dm2[2*nlen+1], dt[4*nlen+2], dn[nlen], nint[nlen]
* all of them should be different from one another
*/
{
int i, j, jj;
if (nlen != 16) {
pdtj[1] = b;
#pragma pipeloop(0)
for (i = 1; i < nlen; i++) {
}
if (jj == 30) {
jj = 0;
}
}
} else {
for (j = 0; j < 32; j++, pdtj++) {
pdtj[1] = b;
/* no need for cleanup, cannot overflow */
}
}
}