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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [vector-2.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 jeremybenn
/* Check that vector insertion works correctly. */
2
 
3
/* { dg-do run } */
4
/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
5
/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
6
/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */
7
/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */
8
 
9
#define vector __attribute__((vector_size(16) ))
10
 
11
vector int f0(vector int t, int a)
12
{
13
 ((int*)&t)[0] = a;
14
 return t;
15
}
16
vector int f1(vector int t, int a)
17
{
18
 ((int*)&t)[1] = a;
19
 return t;
20
}
21
vector int f2(vector int t, int a)
22
{
23
 ((int*)&t)[2] = a;
24
 return t;
25
}
26
vector int f3(vector int t, int a)
27
{
28
 ((int*)&t)[3] = a;
29
 return t;
30
}
31
int main(void)
32
{
33
  vector int a = {0, 0, 0, 0};
34
  vector int b = {1, 0, 0, 0};
35
  vector int c = {0, 1, 0, 0};
36
  vector int d = {0, 0, 1, 0};
37
  vector int e = {0, 0, 0, 1};
38
  vector int a0;
39
  a0 = f0(a, 1);
40
  if (memcmp (&a0, &b, sizeof(a0)))
41
    __builtin_abort ();
42
  a0 = f1(a, 1);
43
  if (memcmp (&a0, &c, sizeof(a0)))
44
    __builtin_abort ();
45
  a0 = f2(a, 1);
46
  if (memcmp (&a0, &d, sizeof(a0)))
47
    __builtin_abort ();
48
  a0 = f3(a, 1);
49
  if (memcmp (&a0, &e, sizeof(a0)))
50
    __builtin_abort ();
51
  return 0;
52
}

powered by: WebSVN 2.1.0

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