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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [init/] [vector1.C] - Blame information for rev 841

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

Line No. Rev Author Line
1 149 jeremybenn
// PR c++/19263
2
// { dg-do run }
3
// { dg-options "-O2" }
4
 
5
typedef signed char v8qi __attribute__ ((vector_size (8)));
6
 
7
extern "C" void abort (void);
8
 
9
static unsigned char S[16];
10
 
11
struct A
12
{
13
  int i;
14
  v8qi j, k;
15
  int l;
16
};
17
 
18
void
19
foo (unsigned char v)
20
{
21
  A a = { 1, { v, v, v, v, v, v, v, v },
22
          { v + 1, v + 1, v + 1, v + 1, v + 1, v + 1, v + 1, v + 1 }, 3 };
23
  v8qi *s = (v8qi *) &S[0];
24
  *s = a.j;
25
  s[1] = a.k;
26
}
27
 
28
void
29
bar (unsigned char v)
30
{
31
  v8qi val8 = { v, v, v, v, v, v, v, v };
32
  v8qi *s = (v8qi *) &S[0];
33
  *s = val8;
34
}
35
 
36
int n = 5, cnt;
37
 
38
int
39
num (void)
40
{
41
  ++cnt;
42
  return n;
43
}
44
 
45
void
46
baz (void)
47
{
48
  static A a = { 0, { num (), num (), num (), num (), 6, 6, 6, 6 },
49
                 { 7, 7, 7, 7, 8, 8, 8, 8 }, 0 };
50
  v8qi *s = (v8qi *) &S[0];
51
  *s = a.j;
52
  s[1] = a.k;
53
}
54
 
55
int
56
main ()
57
{
58
  int i;
59
  foo (1);
60
  for (i = 0; i < 8; ++i)
61
    if (S[i] != 1)
62
      abort ();
63
  for (; i < 16; ++i)
64
    if (S[i] != 2)
65
      abort ();
66
  bar (3);
67
  for (i = 0; i < 8; ++i)
68
    if (S[i] != 3)
69
      abort ();
70
  return 0;
71
  baz ();
72
  if (cnt != 4)
73
    abort ();
74
  for (i = 0; i < 16; ++i)
75
    if (S[i] != 5 + (i / 4))
76
      abort ();
77
  return 0;
78
}

powered by: WebSVN 2.1.0

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