OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libm/] [machine/] [spu/] [headers/] [tgamma.h] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
#include <errno.h>
2
#include "headers/truncd2.h"
3
#include "headers/tgammad2.h"
4
 
5
static __inline double _tgamma(double x)
6
{
7
  double res;
8
  vector double vx;
9
  vector double truncx;
10
  vector double vc = { 0.0, 0.0 };
11
  vector unsigned long long cmpres;
12
  vector signed int verrno, ferrno;
13
  vector signed int fail = { EDOM, EDOM, EDOM, EDOM };
14
 
15
  vx = spu_promote(x, 0);
16
  res = spu_extract(_tgammad2(vx), 0);
17
 
18
#ifndef _IEEE_LIBM
19
  /*
20
   * use vector truncd2 rather than splat x, and splat truncx.
21
   */
22
  truncx = _truncd2(vx);
23
  cmpres = spu_cmpeq(truncx, vx);
24
  verrno = spu_splats(errno);
25
  ferrno = spu_sel(verrno, fail, (vector unsigned int) cmpres);
26
  cmpres = spu_cmpgt(vc, vx);
27
  errno = spu_extract(spu_sel(verrno, ferrno, (vector unsigned int) cmpres), 0);
28
#endif
29
  return res;
30
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.