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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libm/] [machine/] [spu/] [headers/] [tgammaf.h] - Rev 207

Compare with Previous | Blame | View Log

#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;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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