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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [builtin-math-1.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* Copyright (C) 2002, 2003, 2004  Free Software Foundation.
2
 
3
   Verify that built-in math function constant folding of constant
4
   arguments is correctly performed by the compiler.
5
 
6
   Written by Roger Sayle, 16th August 2002.  */
7
 
8
/* { dg-do link } */
9
 
10
extern double atan (double);
11
extern float atanf (float);
12
extern long double atanl (long double);
13
extern double cbrt (double);
14
extern float cbrtf (float);
15
extern long double cbrtl (long double);
16
extern double cos (double);
17
extern float cosf (float);
18
extern long double cosl (long double);
19
extern double exp (double);
20
extern float expf (float);
21
extern long double expl (long double);
22
extern double log (double);
23
extern float logf (float);
24
extern long double logl (long double);
25
extern double pow (double, double);
26
extern float powf (float, float);
27
extern long double powl (long double, long double);
28
extern double sin (double);
29
extern float sinf (float);
30
extern long double sinl (long double);
31
extern double sqrt (double);
32
extern float sqrtf (float);
33
extern long double sqrtl (long double);
34
extern double tan (double);
35
extern float tanf (float);
36
extern long double tanl (long double);
37
 
38
/* All references to link_error should go away at compile-time.  */
39
extern void link_error(void);
40
 
41
void test (float f, double d, long double ld)
42
{
43
  if (sqrt (0.0) != 0.0)
44
    link_error ();
45
 
46
  if (sqrt (1.0) != 1.0)
47
    link_error ();
48
 
49
  if (cbrt (0.0) != 0.0)
50
    link_error ();
51
 
52
  if (cbrt (1.0) != 1.0)
53
    link_error ();
54
 
55
  if (cbrt (-1.0) != -1.0)
56
    link_error ();
57
 
58
  if (exp (0.0) != 1.0)
59
    link_error ();
60
 
61
  if (exp (1.0) <= 2.71 || exp (1.0) >= 2.72)
62
    link_error ();
63
 
64
  if (log (1.0) != 0.0)
65
    link_error ();
66
 
67
  if (sin (0.0) != 0.0)
68
    link_error ();
69
 
70
  if (cos (0.0) != 1.0)
71
    link_error ();
72
 
73
  if (tan (0.0) != 0.0)
74
    link_error ();
75
 
76
  if (atan (0.0) != 0.0)
77
    link_error ();
78
 
79
  if (4.0*atan (1.0) <= 3.14 || 4.0*atan (1.0) >= 3.15)
80
    link_error ();
81
 
82
  if (pow (d, 0.0) != 1.0)
83
    link_error ();
84
 
85
  if (pow (1.0, d) != 1.0)
86
    link_error ();
87
 
88
 
89
  if (sqrtf (0.0F) != 0.0F)
90
    link_error ();
91
 
92
  if (sqrtf (1.0F) != 1.0F)
93
    link_error ();
94
 
95
  if (cbrtf (0.0F) != 0.0F)
96
    link_error ();
97
 
98
  if (cbrtf (1.0F) != 1.0F)
99
    link_error ();
100
 
101
  if (cbrtf (-1.0F) != -1.0F)
102
    link_error ();
103
 
104
  if (expf (0.0F) != 1.0F)
105
    link_error ();
106
 
107
  if (expf (1.0F) <= 2.71F || expf (1.0F) >= 2.72F)
108
    link_error ();
109
 
110
  if (logf (1.0F) != 0.0F)
111
    link_error ();
112
 
113
  if (sinf (0.0F) != 0.0F)
114
    link_error ();
115
 
116
  if (cosf (0.0F) != 1.0F)
117
    link_error ();
118
 
119
  if (tanf (0.0F) != 0.0F)
120
    link_error ();
121
 
122
  if (atanf (0.0F) != 0.0F)
123
    link_error ();
124
 
125
  if (4.0F*atanf (1.0F) <= 3.14F || 4.0F*atanf (1.0F) >= 3.15F)
126
    link_error ();
127
 
128
  if (powf (f, 0.0F) != 1.0F)
129
    link_error ();
130
 
131
  if (powf (1.0F, f) != 1.0F)
132
    link_error ();
133
 
134
 
135
  if (sqrtl (0.0L) != 0.0L)
136
    link_error ();
137
 
138
  if (sqrtl (1.0L) != 1.0L)
139
    link_error ();
140
 
141
  if (cbrtl (0.0L) != 0.0L)
142
    link_error ();
143
 
144
  if (cbrtl (1.0L) != 1.0L)
145
    link_error ();
146
 
147
  if (cbrtl (-1.0L) != -1.0L)
148
    link_error ();
149
 
150
  if (expl (0.0L) != 1.0L)
151
    link_error ();
152
 
153
  if (expl (1.0L) <= 2.71L || expl (1.0L) >= 2.72L)
154
    link_error ();
155
 
156
  if (logl (1.0L) != 0.0L)
157
    link_error ();
158
 
159
  if (sinl (0.0L) != 0.0L)
160
    link_error ();
161
 
162
  if (cosl (0.0L) != 1.0L)
163
    link_error ();
164
 
165
  if (tanl (0.0L) != 0.0L)
166
    link_error ();
167
 
168
  if (atanl (0.0) != 0.0L)
169
    link_error ();
170
 
171
  if (4.0L*atanl (1.0L) <= 3.14L || 4.0L*atanl (1.0L) >= 3.15L)
172
    link_error ();
173
 
174
  if (powl (ld, 0.0L) != 1.0L)
175
    link_error ();
176
 
177
  if (powl (1.0L, ld) != 1.0L)
178
    link_error ();
179
}
180
 
181
int main()
182
{
183
  test (3.0, 3.0F, 3.0L);
184
 
185
  return 0;
186
}

powered by: WebSVN 2.1.0

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