Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vqmovun.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,uint,8,8) [] = { 0x34, 0x34, 0x34, 0x34,
7 0x34, 0x34, 0x34, 0x34 };
8 VECT_VAR_DECL(expected,uint,16,4) [] = { 0x5678, 0x5678, 0x5678, 0x5678 };
9 VECT_VAR_DECL(expected,uint,32,2) [] = { 0x12345678, 0x12345678 };
10
11 /* Expected results with negative input. */
12 VECT_VAR_DECL(expected_neg,uint,8,8) [] = { 0x0, 0x0, 0x0, 0x0,
13 0x0, 0x0, 0x0, 0x0 };
14 VECT_VAR_DECL(expected_neg,uint,16,4) [] = { 0x0, 0x0, 0x0, 0x0 };
15 VECT_VAR_DECL(expected_neg,uint,32,2) [] = { 0x0, 0x0 };
16
17 #define INSN_NAME vqmovun
18 #define TEST_MSG "VQMOVUN"
19
20 #define FNNAME1(NAME) void exec_ ## NAME (void)
21 #define FNNAME(NAME) FNNAME1(NAME)
22
23 FNNAME (INSN_NAME)
24 {
25 /* Basic test: y=OP(x), then store the result. */
26 #define TEST_UNARY_OP1(INSN, T1, T2, W, W2, N, CMT) \
27 Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \
28 VECT_VAR(vector_res, T1, W, N) = \
29 INSN##_s##W2(VECT_VAR(vector, int, W2, N)); \
30 vst1##_##T2##W(VECT_VAR(result, T1, W, N), \
31 VECT_VAR(vector_res, T1, W, N))
32
33 #define TEST_UNARY_OP(INSN, T1, T2, W, W2, N, CMT) \
34 TEST_UNARY_OP1(INSN, T1, T2, W, W2, N, CMT)
35
36 DECL_VARIABLE(vector, int, 16, 8);
37 DECL_VARIABLE(vector, int, 32, 4);
38 DECL_VARIABLE(vector, int, 64, 2);
39
40 DECL_VARIABLE(vector_res, uint, 8, 8);
41 DECL_VARIABLE(vector_res, uint, 16, 4);
42 DECL_VARIABLE(vector_res, uint, 32, 2);
43
44 clean_results ();
45
46 /* Fill input vector with arbitrary values. */
47 VDUP(vector, q, int, s, 16, 8, 0x34);
48 VDUP(vector, q, int, s, 32, 4, 0x5678);
49 VDUP(vector, q, int, s, 64, 2, 0x12345678);
50
51 /* Apply a unary operator named INSN_NAME. */
52 #define CMT ""
53 TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8, CMT);
54 TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4, CMT);
55 TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2, CMT);
56
57 CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, CMT);
58 CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, CMT);
59 CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, CMT);
60
61 /* Fill input vector with negative values. */
62 VDUP(vector, q, int, s, 16, 8, 0x8234);
63 VDUP(vector, q, int, s, 32, 4, 0x87654321);
64 VDUP(vector, q, int, s, 64, 2, 0x8765432187654321LL);
65
66 /* Apply a unary operator named INSN_NAME. */
67 #undef CMT
68 #define CMT " (negative input)"
69 TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8, CMT);
70 TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4, CMT);
71 TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2, CMT);
72
73 CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected_neg, CMT);
74 CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected_neg, CMT);
75 CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected_neg, CMT);
76 }
77
78 int main (void)
79 {
80 exec_vqmovun ();
81 return 0;
82 }