2015-05-19 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vmull_lane.c
blobd3aa879c2e1a6c238ff91c7c8a573e83f004ae58
1 #include <arm_neon.h>
2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected,int,32,4) [] = { 0x4000, 0x4000, 0x4000, 0x4000 };
7 VECT_VAR_DECL(expected,int,64,2) [] = { 0x2000, 0x2000 };
8 VECT_VAR_DECL(expected,uint,32,4) [] = { 0x4000, 0x4000, 0x4000, 0x4000 };
9 VECT_VAR_DECL(expected,uint,64,2) [] = { 0x2000, 0x2000 };
11 #define TEST_MSG "VMULL_LANE"
12 void exec_vmull_lane (void)
14 /* vector_res = vmull_lane(vector,vector2,lane), then store the result. */
15 #define TEST_VMULL_LANE(T1, T2, W, W2, N, L) \
16 VECT_VAR(vector_res, T1, W2, N) = \
17 vmull##_lane_##T2##W(VECT_VAR(vector, T1, W, N), \
18 VECT_VAR(vector2, T1, W, N), \
19 L); \
20 vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N))
22 DECL_VARIABLE(vector, int, 16, 4);
23 DECL_VARIABLE(vector, int, 32, 2);
24 DECL_VARIABLE(vector, uint, 16, 4);
25 DECL_VARIABLE(vector, uint, 32, 2);
26 DECL_VARIABLE(vector2, int, 16, 4);
27 DECL_VARIABLE(vector2, int, 32, 2);
28 DECL_VARIABLE(vector2, uint, 16, 4);
29 DECL_VARIABLE(vector2, uint, 32, 2);
31 DECL_VARIABLE(vector_res, int, 32, 4);
32 DECL_VARIABLE(vector_res, int, 64, 2);
33 DECL_VARIABLE(vector_res, uint, 32, 4);
34 DECL_VARIABLE(vector_res, uint, 64, 2);
36 clean_results ();
38 /* Initialize vector. */
39 VDUP(vector, , int, s, 16, 4, 0x1000);
40 VDUP(vector, , int, s, 32, 2, 0x1000);
41 VDUP(vector, , uint, u, 16, 4, 0x1000);
42 VDUP(vector, , uint, u, 32, 2, 0x1000);
44 /* Initialize vector2. */
45 VDUP(vector2, , int, s, 16, 4, 0x4);
46 VDUP(vector2, , int, s, 32, 2, 0x2);
47 VDUP(vector2, , uint, u, 16, 4, 0x4);
48 VDUP(vector2, , uint, u, 32, 2, 0x2);
50 /* Choose lane arbitrarily. */
51 TEST_VMULL_LANE(int, s, 16, 32, 4, 2);
52 TEST_VMULL_LANE(int, s, 32, 64, 2, 1);
53 TEST_VMULL_LANE(uint, u, 16, 32, 4, 2);
54 TEST_VMULL_LANE(uint, u, 32, 64, 2, 1);
56 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
57 CHECK(TEST_MSG, int, 64, 2, PRIx32, expected, "");
58 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, "");
59 CHECK(TEST_MSG, uint, 64, 2, PRIx32, expected, "");
62 int main (void)
64 exec_vmull_lane ();
65 return 0;