Vdsp(bf561)中的浮点运算(8):float除法运算[VC/C++编程]
本文“Vdsp(bf561)中的浮点运算(8):float除法运算[VC/C++编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
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
********************************************************************************/
以上是“Vdsp(bf561)中的浮点运算(8):float除法运算[VC/C++编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |