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/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [vector-1.c] - Blame information for rev 414

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

Line No. Rev Author Line
1 297 jeremybenn
/* Check that vector extraction works correctly. */
2
 
3
#define vector __attribute__((vector_size(16) ))
4
 
5
int f0(vector int t)
6
{
7
  return ((int*)&t)[0];
8
}
9
int f1(vector int t)
10
{
11
  return ((int*)&t)[1];
12
}
13
int f2(vector int t)
14
{
15
  return ((int*)&t)[2];
16
}
17
int f3(vector int t)
18
{
19
  return ((int*)&t)[3];
20
}
21
int main(void)
22
{
23
  vector int a = {0, 1, 2, 3};
24
  /* Make sure that we have the correct size for the vectors. */
25
  if (sizeof(int) != 4)
26
    __builtin_exit (0);
27
  if (f0(a) != 0)
28
    __builtin_abort ();
29
  if (f1(a) != 1)
30
    __builtin_abort ();
31
  if (f2(a) != 2)
32
    __builtin_abort ();
33
  if (f3(a) != 3)
34
    __builtin_abort ();
35
  return 0;
36
}

powered by: WebSVN 2.1.0

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