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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [builtins-8.c] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
 
3
   Verify that built-in math function constant folding of functions
4
   with one constant argument is correctly performed by the compiler.
5
 
6
   Written by Roger Sayle, 30th March 2003.  */
7
 
8
/* { dg-do run } */
9
/* { dg-options "-O2 -ffast-math" } */
10
 
11
extern void abort(void);
12
extern double pow(double, double);
13
extern double sqrt(double);
14
 
15
void test(double x)
16
{
17
  if (pow(x,-1.0) != 1.0/x)
18
    abort ();
19
 
20
  if (pow(x,2.0) != x*x)
21
    abort ();
22
 
23
  if (pow(x,-2.0) != 1.0/(x*x))
24
    abort ();
25
 
26
  if (pow(x,0.5) != sqrt(x))
27
    abort ();
28
}
29
 
30
int main()
31
{
32
  test (1.0);
33
  test (2.0);
34
  return 0;
35
}
36
 

powered by: WebSVN 2.1.0

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