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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [tree-ssa/] [pr33604.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O -fdump-tree-forwprop1" } */
3
 
4
struct Value
5
{
6
  double value;
7
  Value(double value_) : value (value_) {}
8
  operator double() const { return value; }
9
  Value& operator=(double other) { value = other; }
10
};
11
 
12
struct Ref
13
{
14
  const Value& m;
15
  Ref(const Value& m_) : m(m_) {}
16
  operator double() const { return m; }
17
};
18
 
19
struct Diff
20
{
21
  const Ref lhs, rhs;
22
  Diff(const Value& lhs_, const Value& rhs_) : lhs(lhs_), rhs(rhs_) {}
23
  operator double() const { return lhs - rhs; }
24
};
25
 
26
extern "C" void abort (void);
27
int main(int argc, char *argv[])
28
{
29
  Value I(1), m(4);
30
  for(int a = 0; a < 1000; a++)
31
    m = Diff (I, m);
32
 
33
  if (!(m / 4 == I))
34
    abort ();
35
  return 0;
36
}
37
 
38
/* Check that we forward propagated
39
     D.2182_13 = (struct Ref *) &D.2137.lhs;
40
   to
41
     D.2182_13->lhs.m ={v} &I;
42
   yielding
43
     D.2137.lhs.m ={v} &I;  */
44
 
45
/* { dg-final { scan-tree-dump-times "D\\\.....\\\..hs\\\.m =" 2 "forwprop1" } } */
46
/* { dg-final { cleanup-tree-dump "forwprop1" } } */

powered by: WebSVN 2.1.0

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