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-u8-i8.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 32 
7
 
8
typedef struct {
9
   unsigned char a;
10
   unsigned char b;
11
   unsigned char c;
12
   unsigned char d;
13
   unsigned char e;
14
   unsigned char f;
15
   unsigned char g;
16
   unsigned char h;
17
} s;
18
 
19
__attribute__ ((noinline)) int
20
main1 (s *arr)
21
{
22
  int i;
23
  s *ptr = arr;
24
  s res[N];
25
  unsigned char u, t, s, x, y, z, w;
26
 
27
  for (i = 0; i < N; i++)
28
    {
29
      u = ptr->b - ptr->a;
30
      t = ptr->d - ptr->c;
31
      res[i].c = u + t;
32
      s =  ptr->a + ptr->g;
33
      x = ptr->b + ptr->d;
34
      res[i].a = s + x;
35
      res[i].d = u + t;
36
      s = ptr->h - ptr->a;
37
      x = ptr->d - ptr->c;
38
      res[i].b = s + x;
39
      res[i].f = ptr->f + ptr->h;
40
      res[i].e = ptr->b + ptr->e;
41
      res[i].h = ptr->d - ptr->g;
42
      res[i].g = u + t;
43
      ptr++;
44
    }
45
 
46
  /* check results:  */
47
  for (i = 0; i < N; i++)
48
    {
49
      if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
50
          || res[i].a != arr[i].a + arr[i].g + arr[i].b + arr[i].d
51
          || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
52
          || res[i].b != arr[i].h - arr[i].a + arr[i].d - arr[i].c
53
          || res[i].f != arr[i].f + arr[i].h
54
          || res[i].e != arr[i].b + arr[i].e
55
          || res[i].h != arr[i].d - arr[i].g
56
          || res[i].g != arr[i].b - arr[i].a + arr[i].d - arr[i].c
57
       )
58
          abort();
59
   }
60
}
61
 
62
int main (void)
63
{
64
  int i;
65
  s arr[N];
66
 
67
  check_vect ();
68
 
69
  for (i = 0; i < N; i++)
70
    {
71
      arr[i].a = i;
72
      arr[i].b = i * 2;
73
      arr[i].c = 17;
74
      arr[i].d = i+34;
75
      arr[i].e = i;
76
      arr[i].f = i + 5;
77
      arr[i].g = i + 3;
78
      arr[i].h = 67;
79
      if (arr[i].a == 178)
80
         abort();
81
    }
82
 
83
  main1 (arr);
84
 
85
  return 0;
86
}
87
 
88
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
89
/* { dg-final { cleanup-tree-dump "vect" } } */
90
 

powered by: WebSVN 2.1.0

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