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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [init/] [vector1.C] - Blame information for rev 774

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

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

powered by: WebSVN 2.1.0

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