Vdsp(bf561)中的浮点运算(7):float乘法运算[VC/C++编程]
本文“Vdsp(bf561)中的浮点运算(7):float乘法运算[VC/C++编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
1.1 Vdsp对float乘法运算的处理
在vdsp下,可以很简单地用:
float mul (float x, float y)
{
float r = x * y;
return r;
}
来完成浮点乘法运算,编译器自动将里面的乘法操作转换为___float32_mul的函数调用,这个函数的调用实目前libdsp/fpmult.asm中,在这个文件的开首阐明了这个函数的用法:
/***************************************************************************
Copyright (c) 2000-2008 Analog Devices Inc. All rights reserved.
****************************************************************************
File name : fpmult.asm
This function performs 32 bit floating point multiplication. Implemention
is based on the algorithm mentioned in the reference. Some more conditionS
are added in the present algorithm to take care of various testcases.
Registers used:
Operands in R0 & R1
R0 - X operand,
R1 - Y operand
R2 - R7
Special case:
1) If (x AND y) == 0, Return 0,
2) Overflow : If(Exp(x) + Exp(y) > 254,
Return 0X7F80000 or 0xFF80000
depending upon sign of X and y.
3) Underflow : If(Exp(x) + Exp(y) <= -149, RETURN 0.
Reference : Computer Architecture a Quantitative Approach 2nd Ed.
by Jhon l Hennessy and David Patterson
!!NOTE- Uses non-standard clobber set in compiler:
DefaultClobMinusBIMandLoopRegs
Remember to change the #pragma regs_clobbered in fpmult.c in softfloat if you
change this clobber set
**************************************************************/
以上是“Vdsp(bf561)中的浮点运算(7):float乘法运算[VC/C++编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |