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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [ipa/] [pure-const-1.c] - Blame information for rev 753

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O3 -fdump-tree-local-pure-const1 -fdump-ipa-pure-const -fdump-tree-optimized -fno-early-inlining" } */
3
void abort (void);
4
int error_code;
5
static int val;
6
__attribute__ ((noinline, noclone))
7
static int
8
i_am_pure1 (int a)
9
{
10
  if (a > 50)
11
    abort ();
12
  return a;
13
}
14
 
15
__attribute__ ((noinline, noclone))
16
static int
17
i_am_const2 (int a)
18
{
19
  return a+val;
20
}
21
 
22
__attribute__ ((noinline, noclone))
23
int
24
call_me(int a)
25
{
26
  return a;
27
}
28
 
29
inline int
30
call_callback(int (*fn)(int), int a)
31
{
32
  return fn(a);
33
}
34
 
35
__attribute__ ((noinline, noclone))
36
i_am_const3(int a)
37
{
38
  return call_callback (call_me, a);
39
}
40
 
41
__attribute__ ((noinline))
42
explode_badly()
43
{
44
  error_code = 0xbad;
45
  abort ();
46
}
47
 
48
__attribute__ ((noinline, noclone))
49
i_am_pure4(int a)
50
{
51
  if (a > 50)
52
    explode_badly ();
53
  return a;
54
}
55
 
56
test()
57
{
58
  int s;
59
  s = i_am_pure1(5);
60
  s += i_am_pure1(5);
61
  s += i_am_const2(5);
62
  s += i_am_const2(5);
63
  s += i_am_const3(5);
64
  s += i_am_const3(5);
65
  s += i_am_pure4(5);
66
  s += i_am_pure4(5);
67
  return s;
68
}
69
/* { dg-final { scan-tree-dump-times "i_am_pure1 .5" 1 "optimized"} } */
70
/* { dg-final { scan-tree-dump-times "i_am_const2 .5" 1 "optimized"} } */
71
/* { dg-final { scan-tree-dump-times "i_am_const3 .5" 1 "optimized"} } */
72
/* { dg-final { scan-tree-dump-times "i_am_pure4 .5" 1 "optimized"} } */
73
/* { dg-final { scan-tree-dump "found to be looping pure: i_am_pure1" "local-pure-const1"} } */
74
/* { dg-final { scan-tree-dump "found to be looping pure: i_am_pure4" "local-pure-const1"} } */
75
/* { dg-final { scan-ipa-dump "found to be const: i_am_const2" "pure-const"} } */
76
/* { dg-final { scan-ipa-dump "found to be const: i_am_const3" "pure-const"} } */
77
/* { dg-final { cleanup-tree-dump "local-pure-const1" } } */
78
/* { dg-final { cleanup-tree-dump "optimized" } } */
79
/* { dg-final { cleanup-ipa-dump "pure-const" } } */
80
 

powered by: WebSVN 2.1.0

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