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/] [g++.dg/] [opt/] [cse3.C] - Blame information for rev 316

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

Line No. Rev Author Line
1 301 jeremybenn
// This testcase resulted in invalid code generation on x86_64 targets
2
// due to a bug in fold_rtx. For a "true" value, fold_rtx represented it
3
// as const_true_rtx in floating-point mode, if the FLOAT_STORE_FLAG_VALUE
4
// macro is not defined.
5
 
6
// { dg-do run }
7
// { dg-options "-O1 -fno-guess-branch-probability -fcse-follow-jumps -fgcse -frerun-cse-after-loop" }
8
 
9
class StatVal {
10
 
11
 public:
12
 
13
  StatVal(double ev, double va)
14
    : m(ev),
15
      v(va) {}
16
 
17
  StatVal(const StatVal& other)
18
    : m(other.m),
19
      v(other.v) {}
20
 
21
  StatVal& operator*=(const StatVal& other) {
22
    double A = m == 0 ? 1.0 : v / (m * m);
23
    double B = other.m == 0 ? 1.0 : other.v / (other.m * other.m);
24
    m = m * other.m;
25
    v = m * m * (A + B);
26
    return *this;
27
  }
28
 
29
  double m;
30
  double v;
31
};
32
 
33
extern "C" void abort (void);
34
 
35
const StatVal two_dot_three(2, 0.3);
36
 
37
int main(int argc, char **argv) {
38
 
39
  StatVal product3(two_dot_three);
40
 
41
  product3 *= two_dot_three;
42
 
43
  if (product3.v > 2.5)
44
  {
45
    abort();
46
  }
47
  return 0;
48
}

powered by: WebSVN 2.1.0

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