Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / simd / ext_p16.x
blobb5b381435180d25cf77c04dce2dfd86081fe6b25
1 extern void abort (void);
3 poly16x4_t
4 test_vext_p16_1 (poly16x4_t a, poly16x4_t b)
6   return vext_p16 (a, b, 1);
9 poly16x4_t
10 test_vext_p16_2 (poly16x4_t a, poly16x4_t b)
12   return vext_p16 (a, b, 2);
15 poly16x4_t
16 test_vext_p16_3 (poly16x4_t a, poly16x4_t b)
18   return vext_p16 (a, b, 3);
21 int
22 main (int argc, char **argv)
24   int i, off;
25   poly16_t arr1[] = {0, 1, 2, 3};
26   poly16x4_t in1 = vld1_p16 (arr1);
27   poly16_t arr2[] = {4, 5, 6, 7};
28   poly16x4_t in2 = vld1_p16 (arr2);
29   poly16_t exp[4];
30   poly16x4_t expected;
31   poly16x4_t actual = test_vext_p16_1 (in1, in2);
33   for (i = 0; i < 4; i++)
34     exp[i] = i + 1;
35   expected = vld1_p16 (exp);
36   for (i = 0; i < 4; i++)
37     if (actual[i] != expected[i])
38       abort ();
40   actual = test_vext_p16_2 (in1, in2);
41   for (i = 0; i < 4; i++)
42     exp[i] = i + 2;
43   expected = vld1_p16 (exp);
44   for (i = 0; i < 4; i++)
45     if (actual[i] != expected[i])
46       abort ();
48   actual = test_vext_p16_3 (in1, in2);
49   for (i = 0; i < 4; i++)
50     exp[i] = i + 3;
51   expected = vld1_p16 (exp);
52   for (i = 0; i < 4; i++)
53     if (actual[i] != expected[i])
54       abort ();
56   return 0;