首页 / 软件开发 / C++ / Vdsp(bf561)中的浮点运算(7):float乘法运算
Vdsp(bf561)中的浮点运算(7):float乘法运算2010-02-01 csdn博客 快乐虾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
**************************************************************/