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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [builtins-54.c] - Blame information for rev 301

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

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do link } */
2
/* { dg-options "-O2 -ffast-math" } */
3
 
4
double fabs(double);
5
float fabsf(float);
6
long double fabsl(long double);
7
double cabs(__complex__ double);
8
float cabsf(__complex__ float);
9
long double cabsl(__complex__ long double);
10
 
11
void link_error (void);
12
 
13
void test(__complex__ double x, double a, double b)
14
{
15
  if (cabs(x) != cabs(-x))
16
    link_error();
17
 
18
  if (cabs(x) != cabs(~x))
19
    link_error();
20
 
21
  if (fabs(a) * __builtin_sqrt(2) != cabs (a+a*1i))
22
    link_error();
23
 
24
  if (fabs(a) * __builtin_sqrt(2) != cabs (a*1i+a))
25
    link_error();
26
 
27
  if (fabs(a) * __builtin_sqrt(2) != cabs (-a+a*-1i))
28
    link_error();
29
 
30
  if (fabs(a) * __builtin_sqrt(2) != cabs (-a+-a*1i))
31
    link_error();
32
 
33
  if (fabs(a) * __builtin_sqrt(2) != cabs (-a-a*1i))
34
    link_error();
35
 
36
  if (fabs(a) * __builtin_sqrt(2) != cabs (a*-1i-a))
37
    link_error();
38
 
39
  if (fabs(a) * __builtin_sqrt(2) != cabs (-a*1i-a))
40
    link_error();
41
 
42
  if (fabs(a) * __builtin_sqrt(2) != cabs (a*-1i+-a))
43
    link_error();
44
 
45
  if (fabs(a) * __builtin_sqrt(2) != cabs (-a*1i+-a))
46
    link_error();
47
 
48
  if (fabs(a*b) * __builtin_sqrt(2) != cabs (a*b-(-b*a*1i)))
49
    link_error();
50
 
51
  if (fabs(a*b) * __builtin_sqrt(2) != cabs (a*b*1i-a*-b))
52
    link_error();
53
}
54
 
55
void testf(__complex__ float x, float a, float b)
56
{
57
  if (cabsf(x) != cabsf(-x))
58
    link_error();
59
 
60
  if (cabsf(x) != cabsf(~x))
61
    link_error();
62
 
63
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (a+a*1i))
64
    link_error();
65
 
66
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (a*1i+a))
67
    link_error();
68
 
69
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (-a+a*-1i))
70
    link_error();
71
 
72
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (-a+-a*1i))
73
    link_error();
74
 
75
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (-a-a*1i))
76
    link_error();
77
 
78
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (a*-1i-a))
79
    link_error();
80
 
81
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (-a*1i-a))
82
    link_error();
83
 
84
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (a*-1i+-a))
85
    link_error();
86
 
87
  if (fabsf(a) * __builtin_sqrtf(2) != cabsf (-a*1i+-a))
88
    link_error();
89
 
90
  if (fabsf(a*b) * __builtin_sqrtf(2) != cabsf (a*b-(-b*a*1i)))
91
    link_error();
92
 
93
  if (fabsf(a*b) * __builtin_sqrtf(2) != cabsf (a*b*1i-a*-b))
94
    link_error();
95
}
96
 
97
void testl(__complex__ long double x, long double a, long double b)
98
{
99
  if (cabsl(x) != cabsl(-x))
100
    link_error();
101
 
102
  if (cabsl(x) != cabsl(~x))
103
    link_error();
104
 
105
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (a+a*1i))
106
    link_error();
107
 
108
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (a*1i+a))
109
    link_error();
110
 
111
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (-a+a*-1i))
112
    link_error();
113
 
114
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (-a+-a*1i))
115
    link_error();
116
 
117
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (-a-a*1i))
118
    link_error();
119
 
120
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (a*-1i-a))
121
    link_error();
122
 
123
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (-a*1i-a))
124
    link_error();
125
 
126
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (a*-1i+-a))
127
    link_error();
128
 
129
  if (fabsl(a) * __builtin_sqrtl(2) != cabsl (-a*1i+-a))
130
    link_error();
131
 
132
  if (fabsl(a*b) * __builtin_sqrtl(2) != cabsl (a*b-(-b*a*1i)))
133
    link_error();
134
 
135
  if (fabsl(a*b) * __builtin_sqrtl(2) != cabsl (a*b*1i-a*-b))
136
    link_error();
137
}
138
 
139
int main()
140
{
141
  test(0, 0, 0);
142
  testf(0, 0, 0);
143
  testl(0, 0, 0);
144
  return 0;
145
}
146
 

powered by: WebSVN 2.1.0

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