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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [vector-2.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Check that vector insertion works correctly. */
2
 
3
#define vector __attribute__((vector_size(16) ))
4
 
5
vector int f0(vector int t, int a)
6
{
7
 ((int*)&t)[0] = a;
8
 return t;
9
}
10
vector int f1(vector int t, int a)
11
{
12
 ((int*)&t)[1] = a;
13
 return t;
14
}
15
vector int f2(vector int t, int a)
16
{
17
 ((int*)&t)[2] = a;
18
 return t;
19
}
20
vector int f3(vector int t, int a)
21
{
22
 ((int*)&t)[3] = a;
23
 return t;
24
}
25
int main(void)
26
{
27
  vector int a = {0, 0, 0, 0};
28
  vector int b = {1, 0, 0, 0};
29
  vector int c = {0, 1, 0, 0};
30
  vector int d = {0, 0, 1, 0};
31
  vector int e = {0, 0, 0, 1};
32
  vector int a0;
33
  a0 = f0(a, 1);
34
  if (memcmp (&a0, &b, sizeof(a0)))
35
    __builtin_abort ();
36
  a0 = f1(a, 1);
37
  if (memcmp (&a0, &c, sizeof(a0)))
38
    __builtin_abort ();
39
  a0 = f2(a, 1);
40
  if (memcmp (&a0, &d, sizeof(a0)))
41
    __builtin_abort ();
42
  a0 = f3(a, 1);
43
  if (memcmp (&a0, &e, sizeof(a0)))
44
    __builtin_abort ();
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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