1.1 Vdsp对float除法运算的处理
在vdsp下,可以很简单地用:
float fdiv(float x, float y)
{
float r = x / y;
return r;
}
来完成浮点除法运算,编译器自动将里面的乘法操作转换为___float32_div的函数调用,这个函数的调用实现在libdsp/fpdiv.asm中,在这个文件的开头说明了这个函数的用法:
/******************************************************************************
Copyright(c) 2000-2008 Analog Devices Inc. IPDC BANGALORE, India.
All rights reserved
******************************************************************************
File Name : fpdiv32.asm
Module Name : floating point division
Label name : __float32_div
Description : This function computes single precision signed floating point
division. 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- Numerator(X),R1- Denominator(Y)
R2 - R7 and P1
******************************************************************************
Special cases :
1) If(X == 0) Return 0.0 or -0.0 depending on sign of X,Y
2) If(Y == 0) Return INF or -INF depending on sign of X,Y
3) If(X == Y) Return 1.0 or -1.0 depending on sign of X,Y
4) If(Y == 1) Return X or -X depending on sign of X,Y
5) Underflow : If(EXP(X) - EXP(Y) < -149),return 0,
6) Overflow : If((EXP(X) - EXP(Y) + 126) > 254), return NAN or -NAN
depending on sign of X,Y
Reference : Computer Architecture a Quantitative Approach
second edition
by John l Hennessy and David Patterson
!!NOTE- Uses non-standard clobber set in compiler:
DefaultClobMinusPABIMandLoop1Regs
Remember to change the #pragma regs_clobbered in fpdiv.c in softfloat if you
change this clobber set
********************************************************************************/