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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [builtins-55.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do link } */
2
/* { dg-options "-O2 -ffast-math" } */
3
/* { dg-options "-ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
4
/* { dg-options "-O2 -ffast-math -std=c99" { target *-*-solaris2* } } */
5
 
6
#include "builtins-config.h"
7
 
8
void link_error (void);
9
 
10
extern long lround(double);
11
extern long lrint(double);
12
 
13
extern long long llround(double);
14
extern long long llrint(double);
15
 
16
extern long lroundf(float);
17
extern long lrintf(float);
18
 
19
extern long long llroundf(float);
20
extern long long llrintf(float);
21
 
22
extern long lroundl(long double);
23
extern long lrintl(long double);
24
 
25
extern long long llroundl(long double);
26
extern long long llrintl(long double);
27
 
28
 
29
void test(double x)
30
{
31
#ifdef HAVE_C99_RUNTIME
32
  if (sizeof(long) != sizeof(long long))
33
    return;
34
 
35
  if (__builtin_lceil(x) != __builtin_llceil(x))
36
    link_error();
37
  if (__builtin_lfloor(x) != __builtin_llfloor(x))
38
    link_error();
39
  if (lround(x) != llround(x))
40
    link_error();
41
  if (lrint(x) != llrint(x))
42
    link_error();
43
#endif
44
}
45
 
46
void testf(float x)
47
{
48
#ifdef HAVE_C99_RUNTIME
49
  if (sizeof(long) != sizeof(long long))
50
    return;
51
 
52
  if (__builtin_lceilf(x) != __builtin_llceilf(x))
53
    link_error();
54
  if (__builtin_lfloorf(x) != __builtin_llfloorf(x))
55
    link_error();
56
  if (lroundf(x) != llroundf(x))
57
    link_error();
58
  if (lrintf(x) != llrintf(x))
59
    link_error();
60
#endif
61
}
62
 
63
void testl(long double x)
64
{
65
#ifdef HAVE_C99_RUNTIME
66
  if (sizeof(long) != sizeof(long long))
67
    return;
68
 
69
  if (__builtin_lceill(x) != __builtin_llceill(x))
70
    link_error();
71
  if (__builtin_lfloorl(x) != __builtin_llfloorl(x))
72
    link_error();
73
  if (lroundl(x) != llroundl(x))
74
    link_error();
75
  if (lrintl(x) != llrintl(x))
76
    link_error();
77
#endif
78
}
79
 
80
int main()
81
{
82
  test(0.0);
83
  testf(0.0);
84
  testl(0.0);
85
  return 0;
86
}
87
 

powered by: WebSVN 2.1.0

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