mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
1671fbe1ca
* libm/machine/spu/headers/dom_chkd_less_than.h: New file. * libm/machine/spu/headers/dom_chkd_negone_one.h: Ditto. * libm/machine/spu/headers/dom_chkf_less_than.h: Ditto. * libm/machine/spu/headers/dom_chkf_negone_one.h: Ditto. * libm/machine/spu/headers/acos.h: Add domain check. * libm/machine/spu/headers/acosf.h: Ditto. * libm/machine/spu/headers/acosh.h: Ditto. * libm/machine/spu/headers/acoshf.h: Ditto. * libm/machine/spu/headers/asin.h: Ditto. * libm/machine/spu/headers/asinf.h: Ditto. * libm/machine/spu/headers/atanh.h: Ditto. * libm/machine/spu/headers/atanhf.h: Ditto. * libm/machine/spu/headers/fmod.h: Ditto. * libm/machine/spu/headers/fmodf.h: Ditto. * libm/machine/spu/headers/log.h: Ditto. * libm/machine/spu/headers/log10.h: Ditto. * libm/machine/spu/headers/log1p.h: Ditto. * libm/machine/spu/headers/log1pf.h: Ditto. * libm/machine/spu/headers/log2.h: Ditto. * libm/machine/spu/headers/log2f.h: Ditto. * libm/machine/spu/headers/sqrt.h: Ditto. * libm/machine/spu/headers/sqrtf.h: Ditto. * libm/machine/spu/headers/tgamma.h: Ditto. * libm/machine/spu/headers/tgammaf.h: Ditto.
30 lines
777 B
C
30 lines
777 B
C
#include <errno.h>
|
|
#include "headers/truncf4.h"
|
|
#include "headers/tgammaf4.h"
|
|
|
|
static __inline float _tgammaf(float x)
|
|
{
|
|
float res;
|
|
vector float vx;
|
|
vector float truncx;
|
|
vector float vc = { 0.0, 0.0 };
|
|
vector unsigned int cmpres;
|
|
vector signed int verrno, ferrno;
|
|
vector signed int fail = { EDOM, EDOM, EDOM, EDOM };
|
|
|
|
vx = spu_promote(x, 0);
|
|
res = spu_extract(_tgammaf4(vx), 0);
|
|
#ifndef _IEEE_LIBM
|
|
/*
|
|
* use vector truncf4 rather than splat x, and splat truncx.
|
|
*/
|
|
truncx = _truncf4(vx);
|
|
cmpres = spu_cmpeq(truncx, vx);
|
|
verrno = spu_splats(errno);
|
|
ferrno = spu_sel(verrno, fail, (vector unsigned int) cmpres);
|
|
cmpres = spu_cmpgt(vc, vx);
|
|
errno = spu_extract(spu_sel(verrno, ferrno, (vector unsigned int) cmpres), 0);
|
|
#endif
|
|
return res;
|
|
}
|