This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: PR29335 use MPFR for builtin sincos


On Tue, 7 Nov 2006, Kaveh R. GHAZI wrote:

> A test using the if (x == 1.0) sincos(x, ...) form like above fails in
> certain circumstances to propagate the value for x into the sincos when
> checking long double values.  I'll post details in a followup message.
> However it appears unrelated to my builtins stuff.  So I'd like to simply
> put this update in and treat that separately.

Here's a testcase that shows the problem with the "if" form.  When
compiled with -ON (N>0) I'm getting a reference to sincosl and link_error.

If I pass -DFIRST, which simply moves the sincosl call to the top of the
if block, it works.  Note when sincosl is alone in it's own block, it
always works also.  This was on sparc-sun-solaris2.10 if it matters.

		Thoughts?
		--Kaveh



extern void link_error(int);

extern void foo(float, double, long double);
int main()
{
  foo (1,1,1);
  return 0;
}

void foo(float xf, double x, long double xl)
{
  float sf, cf;
  double s, c;
  long double sl, cl;

  if (x == 1.0 && xf == 1.0F && xl == 1.0L)
  {
#ifdef FIRST
    __builtin_sincosl(xl, &sl, &cl);
    if (sl <= (0.84L) || sl >= (0.85L) || cl <= (0.54L) || cl >= (0.55L)) link_error(__LINE__);
#endif
    __builtin_sincosf(xf, &sf, &cf);
    if (sf <= (0.84F) || sf >= (0.85F) || cf <= (0.54F) || cf >= (0.55F)) link_error(__LINE__);
    __builtin_sincos(x, &s, &c);
    if (s <= (0.84) || s >= (0.85) || c <= (0.54) || c >= (0.55)) link_error(__LINE__);
#ifndef FIRST
    __builtin_sincosl(xl, &sl, &cl);
    if (sl <= (0.84L) || sl >= (0.85L) || cl <= (0.54L) || cl >= (0.55L)) link_error(__LINE__);
#endif
  }

  if (xf == 1.0F)
  {
    __builtin_sincosf(xf, &sf, &cf);
    if (sf <= (0.84F) || sf >= (0.85F) || cf <= (0.54F) || cf >= (0.55F)) link_error(__LINE__);
  }

  if (x == 1.0)
  {
    __builtin_sincos(x, &s, &c);
    if (s <= (0.84) || s >= (0.85) || c <= (0.54) || c >= (0.55)) link_error(__LINE__);
  }

  if (xl == 1.0L)
  {
    __builtin_sincosl(xl, &sl, &cl);
    if (sl <= (0.84L) || sl >= (0.85L) || cl <= (0.54L) || cl >= (0.55L)) link_error(__LINE__);
  }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]