Debian Codegraph @

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

raw
1 /* { dg-skip-if "" { arm*-*-* } } */
2
3 #include <arm_neon.h>
4 #include "arm-neon-ref.h"
5 #include "compute-ref-data.h"
6
7 /* Expected results. */
8 VECT_VAR_DECL(expected, int, 16, 8) [] = { 0x40, 0x31,0x24, 0x19,
9 0x10, 0x9, 0x4, 0x1 };
10 VECT_VAR_DECL(expected, int, 32, 4) [] = { 0x90, 0x79, 0x64, 0x51 };
11 VECT_VAR_DECL(expected, int, 64, 2) [] = { 0xc4, 0xa9 };
12 VECT_VAR_DECL(expected, uint, 16, 8) [] = { 0xf040, 0xf231, 0xf424, 0xf619,
13 0xf810, 0xfa09, 0xfc04, 0xfe01 };
14 VECT_VAR_DECL(expected, uint, 32, 4) [] = { 0xffe80090, 0xffea0079,
15 0xffec0064, 0xffee0051 };
16 VECT_VAR_DECL(expected, uint, 64, 2) [] = { 0xffffffe4000000c4,
17 0xffffffe6000000a9 };
18 VECT_VAR_DECL(expected, poly, 16, 8) [] = { 0x5540, 0x5541, 0x5544, 0x5545,
19 0x5550, 0x5551, 0x5554, 0x5555 };
20
21 #define TEST_MSG "VMULL_HIGH"
22 void exec_vmull_high (void)
23 {
24 /* Basic test: y = vmull_high(x, x), then store the result. */
25 #define TEST_VMULL_HIGH(T1, T2, W1, W2, N1, N2) \
26 VECT_VAR(vector_res, T1, W2, N1) = \
27 vmull_high_##T2##W1(VECT_VAR(vector, T1, W1, N2), \
28 VECT_VAR(vector, T1, W1, N2)); \
29 vst1q_##T2##W2(VECT_VAR(result, T1, W2, N1), \
30 VECT_VAR(vector_res, T1, W2, N1))
31
32 DECL_VARIABLE(vector, int, 8, 16);
33 DECL_VARIABLE(vector, int, 16, 8);
34 DECL_VARIABLE(vector, int, 32, 4);
35 DECL_VARIABLE(vector, uint, 8, 16);
36 DECL_VARIABLE(vector, uint, 16, 8);
37 DECL_VARIABLE(vector, uint, 32, 4);
38 DECL_VARIABLE(vector, poly, 8, 16);
39 DECL_VARIABLE(vector_res, int, 16, 8);
40 DECL_VARIABLE(vector_res, int, 32, 4);
41 DECL_VARIABLE(vector_res, int, 64, 2);
42 DECL_VARIABLE(vector_res, uint, 16, 8);
43 DECL_VARIABLE(vector_res, uint, 32, 4);
44 DECL_VARIABLE(vector_res, uint, 64, 2);
45 DECL_VARIABLE(vector_res, poly, 16, 8);
46
47 clean_results ();
48
49 VLOAD(vector, buffer, q, int, s, 8, 16);
50 VLOAD(vector, buffer, q, int, s, 16, 8);
51 VLOAD(vector, buffer, q, int, s, 32, 4);
52 VLOAD(vector, buffer, q, uint, u, 8, 16);
53 VLOAD(vector, buffer, q, uint, u, 16, 8);
54 VLOAD(vector, buffer, q, uint, u, 32, 4);
55 VLOAD(vector, buffer, q, poly, p, 8, 16);
56
57 TEST_VMULL_HIGH(int, s, 8, 16, 8, 16);
58 TEST_VMULL_HIGH(int, s, 16, 32, 4, 8);
59 TEST_VMULL_HIGH(int, s, 32, 64, 2, 4);
60 TEST_VMULL_HIGH(uint, u, 8, 16, 8, 16);
61 TEST_VMULL_HIGH(uint, u, 16, 32, 4, 8);
62 TEST_VMULL_HIGH(uint, u, 32, 64, 2, 4);
63 TEST_VMULL_HIGH(poly, p, 8, 16, 8, 16);
64
65 CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, "");
66 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
67 CHECK(TEST_MSG, int, 64, 2, PRIx64, expected, "");
68 CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, "");
69 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, "");
70 CHECK(TEST_MSG, uint, 64, 2, PRIx64, expected, "");
71 CHECK_POLY(TEST_MSG, poly, 16, 8, PRIx16, expected, "");
72 }
73
74 int main (void)
75 {
76 exec_vmull_high ();
77 return 0;
78 }