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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [builtin-rounding-1.c] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2004 Free Software Foundation.
2
 
3
   Check that constant folding of the rounding math functions doesn't
4
   break anything and produces the expected results.
5
 
6
   Written by Kaveh Ghazi, 2004-04-29.  */
7
 
8
/* { dg-do link } */
9
 
10
extern int link_error (int);
11
 
12
#define TEST(FN, VALUE, RESULT) \
13
  if (__builtin_##FN (VALUE) != RESULT) link_error (__LINE__); \
14
  if (__builtin_##FN##f (VALUE) != RESULT) link_error (__LINE__); \
15
  if (__builtin_##FN##l (VALUE) != RESULT) link_error (__LINE__); \
16
 
17
int
18
main (void)
19
{
20
  TEST(trunc,   0, 0);
21
  TEST(floor,   0, 0);
22
  TEST(ceil,    0, 0);
23
  TEST(round,   0, 0);
24
  TEST(lround,  0, 0);
25
  TEST(llround, 0, 0);
26
  TEST(lfloor,  0, 0);
27
  TEST(llfloor, 0, 0);
28
  TEST(lceil,  0, 0);
29
  TEST(llceil, 0, 0);
30
 
31
  TEST(trunc,   6, 6);
32
  TEST(floor,   6, 6);
33
  TEST(ceil,    6, 6);
34
  TEST(round,   6, 6);
35
  TEST(lround,  6, 6);
36
  TEST(llround, 6, 6);
37
  TEST(lfloor,  6, 6);
38
  TEST(llfloor, 6, 6);
39
  TEST(lceil,  6, 6);
40
  TEST(llceil, 6, 6);
41
 
42
  TEST(trunc,   -8, -8);
43
  TEST(floor,   -8, -8);
44
  TEST(ceil,    -8, -8);
45
  TEST(round,   -8, -8);
46
  TEST(lround,  -8, -8);
47
  TEST(llround, -8, -8);
48
  TEST(lfloor,  -8, -8);
49
  TEST(llfloor, -8, -8);
50
  TEST(lceil,  -8, -8);
51
  TEST(llceil, -8, -8);
52
 
53
  TEST(trunc,   3.2, 3);
54
  TEST(floor,   3.2, 3);
55
  TEST(ceil,    3.2, 4);
56
  TEST(round,   3.2, 3);
57
  TEST(lround,  3.2, 3);
58
  TEST(llround, 3.2, 3);
59
  TEST(lfloor,  3.2, 3);
60
  TEST(llfloor, 3.2, 3);
61
  TEST(lceil,  3.2, 4);
62
  TEST(llceil, 3.2, 4);
63
 
64
  TEST(trunc,   -2.8, -2);
65
  TEST(floor,   -2.8, -3);
66
  TEST(ceil,    -2.8, -2);
67
  TEST(round,   -2.8, -3);
68
  TEST(lround,  -2.8, -3);
69
  TEST(llround, -2.8, -3);
70
  TEST(lfloor,  -2.8, -3);
71
  TEST(llfloor, -2.8, -3);
72
  TEST(lceil,  -2.8, -2);
73
  TEST(llceil, -2.8, -2);
74
 
75
  TEST(trunc,   0.01, 0);
76
  TEST(floor,   0.01, 0);
77
  TEST(ceil,    0.01, 1);
78
  TEST(round,   0.01, 0);
79
  TEST(lround,  0.01, 0);
80
  TEST(llround, 0.01, 0);
81
  TEST(lfloor,  0.01, 0);
82
  TEST(llfloor, 0.01, 0);
83
  TEST(lceil,  0.01, 1);
84
  TEST(llceil, 0.01, 1);
85
 
86
  TEST(trunc,   -0.7, 0);
87
  TEST(floor,   -0.7, -1);
88
  TEST(ceil,    -0.7, 0);
89
  TEST(round,   -0.7, -1);
90
  TEST(lround,  -0.7, -1);
91
  TEST(llround, -0.7, -1);
92
  TEST(lfloor,  -0.7, -1);
93
  TEST(llfloor, -0.7, -1);
94
  TEST(lceil,  -0.7, 0);
95
  TEST(llceil, -0.7, 0);
96
 
97
  TEST(trunc,   2.5, 2);
98
  TEST(floor,   2.5, 2);
99
  TEST(ceil,    2.5, 3);
100
  TEST(round,   2.5, 3);
101
  TEST(lround,  2.5, 3);
102
  TEST(llround, 2.5, 3);
103
  TEST(lfloor,  2.5, 2);
104
  TEST(llfloor, 2.5, 2);
105
  TEST(lceil,  2.5, 3);
106
  TEST(llceil, 2.5, 3);
107
 
108
  TEST(trunc,   -1.5, -1);
109
  TEST(floor,   -1.5, -2);
110
  TEST(ceil,    -1.5, -1);
111
  TEST(round,   -1.5, -2);
112
  TEST(lround,  -1.5, -2);
113
  TEST(llround, -1.5, -2);
114
  TEST(lfloor,  -1.5, -2);
115
  TEST(llfloor, -1.5, -2);
116
  TEST(lceil,  -1.5, -1);
117
  TEST(llceil, -1.5, -1);
118
 
119
  return 0;
120
}

powered by: WebSVN 2.1.0

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