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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-strided-a-u16-i4.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 128 
7
 
8
typedef struct {
9
   unsigned short a;
10
   unsigned short b;
11
   unsigned short c;
12
   unsigned short d;
13
} s;
14
 
15
__attribute__ ((noinline)) int
16
main1 ()
17
{
18
  s arr[N];
19
  s *ptr = arr;
20
  s res[N];
21
  int i;
22
  unsigned short x, y, z, w;
23
 
24
  for (i = 0; i < N; i++)
25
    {
26
      arr[i].a = i;
27
      arr[i].b = i * 2;
28
      arr[i].c = 17;
29
      arr[i].d = i+34;
30
      if (arr[i].a == 178)
31
         abort();
32
    }
33
 
34
  for (i = 0; i < N; i++)
35
    {
36
      x = ptr->b - ptr->a;
37
      y = ptr->d - ptr->c;
38
      res[i].c = x + y;
39
      z =  ptr->a + ptr->c;
40
      w = ptr->b + ptr->d;
41
      res[i].a = z + w;
42
      res[i].d = x + y;
43
      res[i].b = x + y;
44
      ptr++;
45
    }
46
 
47
  /* check results:  */
48
  for (i = 0; i < N; i++)
49
    {
50
      if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
51
          || res[i].a != arr[i].a + arr[i].c + arr[i].b + arr[i].d
52
          || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
53
          || res[i].b != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
54
        abort ();
55
    }
56
 
57
  return 0;
58
}
59
 
60
int main (void)
61
{
62
  int i;
63
 
64
  check_vect ();
65
 
66
  main1 ();
67
 
68
  return 0;
69
}
70
 
71
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_strided4 } } } */
72
/* { dg-final { cleanup-tree-dump "vect" } } */
73
 

powered by: WebSVN 2.1.0

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