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-7.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
 
3
   Verify that built-in math function constant folding of constant
4
   arguments is correctly performed by the by the compiler.
5
 
6
   Written by Roger Sayle, 30th March 2003.  */
7
 
8
/* { dg-do link } */
9
/* { dg-options "-O2 -ffast-math" } */
10
 
11
extern double pow (double, double);
12
extern float powf (float, float);
13
extern long double powl (long double, long double);
14
extern double tan (double);
15
extern float tanf (float);
16
extern long double tanl (long double);
17
extern double atan (double);
18
extern float atanf (float);
19
extern long double atanl (long double);
20
 
21
extern void link_error(void);
22
 
23
void test(double x)
24
{
25
  if (pow (x, 1.0) != x)
26
    link_error ();
27
  if (tan (atan (x)) != x)
28
    link_error ();
29
}
30
 
31
void testf(float x)
32
{
33
  if (powf (x, 1.0f) != x)
34
    link_error ();
35
  if (tanf (atanf (x)) != x)
36
    link_error ();
37
}
38
 
39
void testl(long double x)
40
{
41
  if (powl (x, 1.0l) != x)
42
    link_error ();
43
  if (tanl (atanl (x)) != x)
44
    link_error ();
45
}
46
 
47
int main()
48
{
49
  test (2.0);
50
  testf (2.0f);
51
  testl (2.0l);
52
 
53
  return 0;
54
}
55
 

powered by: WebSVN 2.1.0

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