Add execution + assembler tests of AArch64 TRN Intrinsics.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / vect.x
blobc0f79b50b80e8f983bf62c42cb7ced810303f997
1 typedef int *__restrict__ pRINT;
2 typedef unsigned int *__restrict__ pRUINT;
3 typedef long long *__restrict__ pRINT64;
4 typedef unsigned long long *__restrict__ pRUINT64;
6 void test_orn (pRUINT a, pRUINT b, pRUINT c)
8   int i;
9   for (i = 0; i < 16; i++)
10      c[i] = a[i] | (~b[i]);
13 void test_bic (pRUINT a, pRUINT b, pRUINT c)
15   int i;
16   for (i = 0; i < 16; i++)
17      c[i] = a[i] & (~b[i]);
20 void mla (pRINT a, pRINT b, pRINT c)
22   int i;
23   for (i=0;i<16;i++)
24     c[i] += a[i] * b[i]; 
27 void mls (pRINT a, pRINT b, pRINT c)
29   int i;
30   for (i=0;i<16;i++)
31     c[i] -= a[i] * b[i];
34 void smax (pRINT a, pRINT b, pRINT c)
36   int i;
37   for (i=0;i<16;i++)
38     c[i] = (a[i] > b[i] ? a[i] : b[i]);
41 void smin (pRINT a, pRINT b, pRINT c)
43   int i;
44   for (i=0;i<16;i++)
45     c[i] = (a[i] < b[i] ? a[i] : b[i]);
48 void umax (pRUINT a, pRUINT b, pRUINT c)
50   int i;
51   for (i=0;i<16;i++)
52     c[i] = (a[i] > b[i] ? a[i] : b[i]);
55 void umin (pRUINT a, pRUINT b, pRUINT c)
57   int i;
58   for (i=0;i<16;i++)
59     c[i] = (a[i] < b[i] ? a[i] : b[i]);
62 unsigned int reduce_umax (pRUINT a)
64   int i;
65   unsigned int s = a[0];
66   for (i = 1; i < 16; i++)
67     s = (s > a[i] ? s : a[i]);
69   return s;
72 unsigned int reduce_umin (pRUINT a)
74   int i;
75   unsigned int s = a[0];
76   for (i = 1; i < 16; i++)
77     s = (s < a[i] ? s : a[i]);
79   return s;
82 int reduce_smax (pRINT a)
84   int i;
85   int s = a[0];
86   for (i = 1; i < 16; i++)
87     s = (s > a[i] ? s : a[i]);
89   return s;
92 int reduce_smin (pRINT a)
94   int i;
95   int s = a[0];
96   for (i = 1; i < 16; i++)
97     s = (s < a[i] ? s : a[i]);
99   return s;
102 unsigned int reduce_add_u32 (pRINT a)
104   int i;
105   unsigned int s = 0;
106   for (i = 0; i < 16; i++)
107     s += a[i];
109   return s;
112 int reduce_add_s32 (pRINT a)
114   int i;
115   int s = 0;
116   for (i = 0; i < 16; i++)
117     s += a[i];
119   return s;
122 unsigned long long reduce_add_u64 (pRUINT64 a)
124   int i;
125   unsigned long long s = 0;
126   for (i = 0; i < 16; i++)
127     s += a[i];
129   return s;
132 long long reduce_add_s64 (pRINT64 a)
134   int i;
135   long long s = 0;
136   for (i = 0; i < 16; i++)
137     s += a[i];
139   return s;
142 void sabd (pRINT a, pRINT b, pRINT c)
144   int i;
145   for (i = 0; i < 16; i++)
146     c[i] = abs (a[i] - b[i]);
149 void saba (pRINT a, pRINT b, pRINT c)
151   int i;
152   for (i = 0; i < 16; i++)
153     c[i] += abs (a[i] - b[i]);