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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr27959-2.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* PR middle-end/27959 */
2
/* { dg-do run { target { stdint_types } } } */
3
/* { dg-options "-O2" } */
4
/* { dg-options "-O2 -mtune=z990" { target s390*-*-* } } */
5
 
6
#include <stdint.h>
7
extern void abort (void);
8
 
9
struct B
10
{
11
  unsigned int b1, b2, b3;
12
  char b4;
13
};
14
 
15
struct C
16
{
17
  char c1;
18
};
19
 
20
struct D
21
{
22
  char *d1;
23
  struct C **d2;
24
  unsigned int d3;
25
};
26
 
27
void
28
__attribute__((noinline))
29
foo (void *x, struct B *y, unsigned int *z)
30
{
31
  if (x)
32
    abort ();
33
  if (y->b1 != 7 || y->b2 != 5 || y->b3 != 3 || y->b4)
34
    abort ();
35
  if (*z != 2)
36
    abort ();
37
}
38
 
39
int
40
__attribute__((noinline))
41
baz (unsigned int *x, unsigned int y)
42
{
43
  asm volatile ("" : : "r" (&x), "r" (&y) : "memory");
44
  return *x + y;
45
}
46
 
47
inline int bar (unsigned int *x, unsigned int y)
48
{
49
  if (y < *x)
50
    return 0;
51
  return baz (x, y);
52
}
53
 
54
unsigned int *
55
__attribute__((noinline))
56
test (struct D *x, unsigned int *y)
57
{
58
  struct B b;
59
  uint32_t c;
60
 
61
  bar (y, x->d3);
62
  if ((*(x->d2))->c1)
63
    c = ((uint32_t) x->d1[0]
64
         + ((uint32_t) x->d1[1] << 8)
65
         + ((uint32_t) x->d1[2] << 16)
66
         + ((uint32_t) x->d1[3] << 24));
67
  else
68
    {
69
      int32_t d;
70
      ((char *) &d)[0] = x->d1[0];
71
      ((char *) &d)[1] = x->d1[1];
72
      ((char *) &d)[2] = x->d1[2];
73
      ((char *) &d)[3] = x->d1[3];
74
      c = d;
75
    }
76
  b.b4 = 0;
77
  b.b1 = c / 10000L % 10000;
78
  b.b2 = c / 100 % 100;
79
  b.b3 = c % 100;
80
  foo (0, &b, y);
81
  return y;
82
}
83
 
84
int
85
main (void)
86
{
87
  uint32_t x = 900070503;
88
  unsigned int y = 2;
89
  struct C c = { 0 }, *cptr = &c;
90
  struct D d = { (char *) &x, &cptr, 0 };
91
  if (test (&d, &y) != &y)
92
    abort ();
93
  return 0;
94
}

powered by: WebSVN 2.1.0

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