Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vmull.c

raw
1 #include <arm_neon.h>
2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
4
5 /* Expected results. */
6 VECT_VAR_DECL(expected,int,16,8) [] = { 0x100, 0xe1, 0xc4, 0xa9,
7 0x90, 0x79, 0x64, 0x51 };
8 VECT_VAR_DECL(expected,int,32,4) [] = { 0x100, 0xe1, 0xc4, 0xa9 };
9 VECT_VAR_DECL(expected,int,64,2) [] = { 0x100, 0xe1 };
10 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xe100, 0xe2e1, 0xe4c4, 0xe6a9,
11 0xe890, 0xea79, 0xec64, 0xee51 };
12 VECT_VAR_DECL(expected,uint,32,4) [] = { 0xffe00100, 0xffe200e1,
13 0xffe400c4, 0xffe600a9 };
14 VECT_VAR_DECL(expected,uint,64,2) [] = { 0xffffffe000000100,
15 0xffffffe2000000e1 };
16 VECT_VAR_DECL(expected,poly,16,8) [] = { 0x5500, 0x5501, 0x5504, 0x5505,
17 0x5510, 0x5511, 0x5514, 0x5515 };
18
19 #define TEST_MSG "VMULL"
20 void exec_vmull (void)
21 {
22 /* Basic test: y=vmull(x,x), then store the result. */
23 #define TEST_VMULL(T1, T2, W, W2, N) \
24 VECT_VAR(vector_res, T1, W2, N) = \
25 vmull_##T2##W(VECT_VAR(vector, T1, W, N), \
26 VECT_VAR(vector, T1, W, N)); \
27 vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N))
28
29 DECL_VARIABLE(vector, int, 8, 8);
30 DECL_VARIABLE(vector, int, 16, 4);
31 DECL_VARIABLE(vector, int, 32, 2);
32 DECL_VARIABLE(vector, uint, 8, 8);
33 DECL_VARIABLE(vector, uint, 16, 4);
34 DECL_VARIABLE(vector, uint, 32, 2);
35 DECL_VARIABLE(vector, poly, 8, 8);
36 DECL_VARIABLE(vector_res, int, 16, 8);
37 DECL_VARIABLE(vector_res, int, 32, 4);
38 DECL_VARIABLE(vector_res, int, 64, 2);
39 DECL_VARIABLE(vector_res, uint, 16, 8);
40 DECL_VARIABLE(vector_res, uint, 32, 4);
41 DECL_VARIABLE(vector_res, uint, 64, 2);
42 DECL_VARIABLE(vector_res, poly, 16, 8);
43
44 clean_results ();
45
46 VLOAD(vector, buffer, , int, s, 8, 8);
47 VLOAD(vector, buffer, , int, s, 16, 4);
48 VLOAD(vector, buffer, , int, s, 32, 2);
49 VLOAD(vector, buffer, , uint, u, 8, 8);
50 VLOAD(vector, buffer, , uint, u, 16, 4);
51 VLOAD(vector, buffer, , uint, u, 32, 2);
52 VLOAD(vector, buffer, , poly, p, 8, 8);
53
54 TEST_VMULL(int, s, 8, 16, 8);
55 TEST_VMULL(int, s, 16, 32, 4);
56 TEST_VMULL(int, s, 32, 64, 2);
57 TEST_VMULL(uint, u, 8, 16, 8);
58 TEST_VMULL(uint, u, 16, 32, 4);
59 TEST_VMULL(uint, u, 32, 64, 2);
60 TEST_VMULL(poly, p, 8, 16, 8);
61
62 CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, "");
63 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
64 CHECK(TEST_MSG, int, 64, 2, PRIx64, expected, "");
65 CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, "");
66 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, "");
67 CHECK(TEST_MSG, uint, 64, 2, PRIx64, expected, "");
68 CHECK_POLY(TEST_MSG, poly, 16, 8, PRIx16, expected, "");
69 }
70
71 int main (void)
72 {
73 exec_vmull ();
74 return 0;
75 }