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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [20030826-1.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2003 Free Software Foundation.
2
 
3
   Check that constant folding of mathematical expressions doesn't
4
   break anything.
5
 
6
   Written by Roger Sayle, 24th August 2003.  */
7
 
8
/* { dg-do run } */
9
/* { dg-options "-O2 -ffast-math" } */
10
 
11
void abort(void);
12
 
13
double foo(double x)
14
{
15
  return 12.0/(x*3.0);
16
}
17
 
18
double bar(double x)
19
{
20
  return (3.0/x)*4.0;
21
}
22
 
23
int main()
24
{
25
  if (foo(2.0) != 2.0)
26
    abort ();
27
 
28
  if (bar(2.0) != 6.0)
29
    abort ();
30
 
31
  return 0;
32
}
33
 

powered by: WebSVN 2.1.0

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