Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / simd / extq_p16.x
blob9b7cf4e437506ea964afcba487325f0314102ff1
1 extern void abort (void);
3 poly16x8_t
4 test_vextq_p16_1 (poly16x8_t a, poly16x8_t b)
6   return vextq_p16 (a, b, 1);
9 poly16x8_t
10 test_vextq_p16_2 (poly16x8_t a, poly16x8_t b)
12   return vextq_p16 (a, b, 2);
15 poly16x8_t
16 test_vextq_p16_3 (poly16x8_t a, poly16x8_t b)
18   return vextq_p16 (a, b, 3);
21 poly16x8_t
22 test_vextq_p16_4 (poly16x8_t a, poly16x8_t b)
24   return vextq_p16 (a, b, 4);
27 poly16x8_t
28 test_vextq_p16_5 (poly16x8_t a, poly16x8_t b)
30   return vextq_p16 (a, b, 5);
33 poly16x8_t
34 test_vextq_p16_6 (poly16x8_t a, poly16x8_t b)
36   return vextq_p16 (a, b, 6);
39 poly16x8_t
40 test_vextq_p16_7 (poly16x8_t a, poly16x8_t b)
42   return vextq_p16 (a, b, 7);
45 int
46 main (int argc, char **argv)
48   int i, off;
49   poly16_t arr1[] = {0, 1, 2, 3, 4, 5, 6, 7};
50   poly16x8_t in1 = vld1q_p16 (arr1);
51   poly16_t arr2[] = {8, 9, 10, 11, 12, 13, 14, 15};
52   poly16x8_t in2 = vld1q_p16 (arr2);
53   poly16_t exp[8];
54   poly16x8_t expected;
55   poly16x8_t actual = test_vextq_p16_1 (in1, in2);
57   for (i = 0; i < 8; i++)
58     exp[i] = i + 1;
59   expected = vld1q_p16 (exp);
60   for (i = 0; i < 8; i++)
61     if (actual[i] != expected[i])
62       abort ();
64   actual = test_vextq_p16_2 (in1, in2);
65   for (i = 0; i < 8; i++)
66     exp[i] = i + 2;
67   expected = vld1q_p16 (exp);
68   for (i = 0; i < 8; i++)
69     if (actual[i] != expected[i])
70       abort ();
72   actual = test_vextq_p16_3 (in1, in2);
73   for (i = 0; i < 8; i++)
74     exp[i] = i + 3;
75   expected = vld1q_p16 (exp);
76   for (i = 0; i < 8; i++)
77     if (actual[i] != expected[i])
78       abort ();
80   actual = test_vextq_p16_4 (in1, in2);
81   for (i = 0; i < 8; i++)
82     exp[i] = i + 4;
83   expected = vld1q_p16 (exp);
84   for (i = 0; i < 8; i++)
85     if (actual[i] != expected[i])
86       abort ();
88   actual = test_vextq_p16_5 (in1, in2);
89   for (i = 0; i < 8; i++)
90     exp[i] = i + 5;
91   expected = vld1q_p16 (exp);
92   for (i = 0; i < 8; i++)
93     if (actual[i] != expected[i])
94       abort ();
96   actual = test_vextq_p16_6 (in1, in2);
97   for (i = 0; i < 8; i++)
98     exp[i] = i + 6;
99   expected = vld1q_p16 (exp);
100   for (i = 0; i < 8; i++)
101     if (actual[i] != expected[i])
102       abort ();
104   actual = test_vextq_p16_7 (in1, in2);
105   for (i = 0; i < 8; i++)
106     exp[i] = i + 7;
107   expected = vld1q_p16 (exp);
108   for (i = 0; i < 8; i++)
109     if (actual[i] != expected[i])
110       abort ();
112   return 0;