OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libm/] [machine/] [spu/] [headers/] [tgammaf.h] - Blame information for rev 345

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
#include <errno.h>
2
#include "headers/truncf4.h"
3
#include "headers/tgammaf4.h"
4
 
5
static __inline float _tgammaf(float x)
6
{
7
  float res;
8
  vector float vx;
9
  vector float truncx;
10
  vector float vc = { 0.0, 0.0 };
11
  vector unsigned int 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(_tgammaf4(vx), 0);
17
#ifndef _IEEE_LIBM
18
  /*
19
   * use vector truncf4 rather than splat x, and splat truncx.
20
   */
21
  truncx = _truncf4(vx);
22
  cmpres = spu_cmpeq(truncx, vx);
23
  verrno = spu_splats(errno);
24
  ferrno = spu_sel(verrno, fail, (vector unsigned int) cmpres);
25
  cmpres = spu_cmpgt(vc, vx);
26
  errno = spu_extract(spu_sel(verrno, ferrno, (vector unsigned int) cmpres), 0);
27
#endif
28
  return res;
29
}

powered by: WebSVN 2.1.0

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