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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [builtins-55.c] - Blame information for rev 826

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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