OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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

Line No. Rev Author Line
1 298 jeremybenn
/* Copyright (C) 2003 Free Software Foundation.
2
 
3
   Check that constant folding of built-in math functions doesn't
4
   break anything and produces the expected results.
5
 
6
   Written by Roger Sayle, 29th July 2003.  */
7
 
8
/* { dg-do link } */
9
/* { dg-options "-O2 -ffast-math" } */
10
 
11
extern void link_error(void);
12
 
13
extern double pow(double,double);
14
 
15
void test(double x)
16
{
17
  if (pow(x,2.0) != x*x)
18
    link_error ();
19
 
20
  if (x*pow(x,2.0) != pow(x,3.0))
21
    link_error ();
22
 
23
  if (pow(x,2.0)*x != pow(x,3.0))
24
    link_error ();
25
 
26
  if (pow(x,3.0) != x*x*x)
27
    link_error ();
28
 
29
  if (pow(x,2.0)*x != x*x*x)
30
    link_error ();
31
 
32
  if (x*pow(x,2.0) != x*x*x)
33
    link_error ();
34
 
35
  if (pow(x,3.0)/x != pow(x,2.0))
36
    link_error ();
37
 
38
  if (pow(x,3.0)/x != x*x)
39
    link_error ();
40
}
41
 
42
int main()
43
{
44
  test (2.0);
45
  return 0;
46
}
47
 

powered by: WebSVN 2.1.0

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