OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.dwarf2/] [pieces.c] - Blame information for rev 357

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

Line No. Rev Author Line
1 330 jeremybenn
/* Copyright (C) 2010 Free Software Foundation, Inc.
2
 
3
   This file is part of GDB.
4
 
5
   This program is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3 of the License, or
8
   (at your option) any later version.
9
 
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
 
15
   You should have received a copy of the GNU General Public License
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
 
18
/* The original program corresponding to pieces.S.
19
   This came from https://bugzilla.redhat.com/show_bug.cgi?id=589467
20
   Note that it is not ever compiled, pieces.S is used instead.
21
   However, it is used to extract breakpoint line numbers.  */
22
 
23
struct A { int i; int j; };
24
struct B { int i : 12; int j : 12; int : 4; };
25
struct C { int i; int j; int q; };
26
 
27
__attribute__((noinline)) void
28
bar (int x)
29
{
30
  asm volatile ("" : : "r" (x) : "memory");
31
}
32
 
33
__attribute__((noinline)) int
34
f1 (int k)
35
{
36
  struct A a = { 4, k + 6 };
37
  asm ("" : "+r" (a.i));
38
  a.j++;
39
  bar (a.i);            /* { dg-final { gdb-test 20 "a.i" "4" } } */
40
  bar (a.j);            /* { dg-final { gdb-test 20 "a.j" "14" } } */
41
  return a.i + a.j;     /* f1 breakpoint */
42
}
43
 
44
__attribute__((noinline)) int
45
f2 (int k)
46
{
47
  int a[2] = { 4, k + 6 };
48
  asm ("" : "+r" (a[0]));
49
  a[1]++;
50
  bar (a[0]);            /* { dg-final { gdb-test 31 "a\[0\]" "4" } } */
51
  bar (a[1]);           /* { dg-final { gdb-test 31 "a\[1\]" "14" } } */
52
  return a[0] + a[1];    /* f2 breakpoint */
53
}
54
 
55
__attribute__((noinline)) int
56
f3 (int k)
57
{
58
  struct B a = { 4, k + 6 };
59
  asm ("" : "+r" (a.i));
60
  a.j++;
61
  bar (a.i);            /* { dg-final { gdb-test 42 "a.i" "4" } } */
62
  bar (a.j);            /* { dg-final { gdb-test 42 "a.j" "14" } } */
63
  return a.i + a.j;     /* f3 breakpoint */
64
}
65
 
66
__attribute__((noinline)) int
67
f4 (int k)
68
{
69
  int a[2] = { k, k };
70
  asm ("" : "+r" (a[0]));
71
  a[1]++;
72
  bar (a[0]);
73
  bar (a[1]);
74
  return a[0] + a[1];            /* f4 breakpoint */
75
}
76
 
77
__attribute__((noinline)) int
78
f5 (int k)
79
{
80
  struct A a = { k, k };
81
  asm ("" : "+r" (a.i));
82
  a.j++;
83
  bar (a.i);
84
  bar (a.j);
85
  return a.i + a.j;             /* f5 breakpoint */
86
}
87
 
88
__attribute__((noinline)) int
89
f6 (int k)
90
{
91
  int z = 23;
92
  struct C a = { k, k, z };
93
  asm ("" : "+r" (a.i));
94
  a.j++;
95
  bar (a.i);
96
  bar (a.j);
97
  return a.i + a.j;             /* f6 breakpoint */
98
}
99
 
100
int
101
main (void)
102
{
103
  int k;
104
  asm ("" : "=r" (k) : "0" (7));
105
  f1 (k);
106
  f2 (k);
107
  f3 (k);
108
  f4 (k);
109
  f5 (k);
110
  f6 (k);
111
  return 0;
112
}

powered by: WebSVN 2.1.0

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