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,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa,
7 0xaa, 0xaa, 0xf0, 0xaa };
8 VECT_VAR_DECL(expected,int,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0 };
9 VECT_VAR_DECL(expected,int,32,2) [] = { 0xaaaaaaaa, 0xfffffff0 };
10 VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffff0 };
11 VECT_VAR_DECL(expected,uint,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa,
12 0xaa, 0xaa, 0xaa, 0xf0 };
13 VECT_VAR_DECL(expected,uint,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0 };
14 VECT_VAR_DECL(expected,uint,32,2) [] = { 0xaaaaaaaa, 0xfffffff0 };
15 VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 };
16 VECT_VAR_DECL(expected,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa,
17 0xaa, 0xaa, 0xaa, 0xf0 };
18 VECT_VAR_DECL(expected,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0 };
19 VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xcc00, 0xaaaa };
20 VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xaaaaaaaa, 0xc1800000 };
21 VECT_VAR_DECL(expected,int,8,16) [] = { 0xaa, 0xaa, 0xaa, 0xaa,
22 0xaa, 0xaa, 0xaa, 0xaa,
23 0xaa, 0xaa, 0xaa, 0xaa,
24 0xaa, 0xaa, 0xaa, 0xf0 };
25 VECT_VAR_DECL(expected,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa,
26 0xaaaa, 0xfff0, 0xaaaa, 0xaaaa };
27 VECT_VAR_DECL(expected,int,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa,
28 0xfffffff0, 0xaaaaaaaa };
29 VECT_VAR_DECL(expected,int,64,2) [] = { 0xaaaaaaaaaaaaaaaa,
30 0xfffffffffffffff0 };
31 VECT_VAR_DECL(expected,uint,8,16) [] = { 0xaa, 0xaa, 0xaa, 0xaa,
32 0xaa, 0xaa, 0xaa, 0xaa,
33 0xaa, 0xaa, 0xaa, 0xaa,
34 0xf0, 0xaa, 0xaa, 0xaa };
35 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa,
36 0xaaaa, 0xaaaa, 0xfff0, 0xaaaa };
37 VECT_VAR_DECL(expected,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa,
38 0xfffffff0, 0xaaaaaaaa };
39 VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfffffffffffffff0,
40 0xaaaaaaaaaaaaaaaa };
41 VECT_VAR_DECL(expected,poly,8,16) [] = { 0xaa, 0xaa, 0xaa, 0xaa,
42 0xaa, 0xaa, 0xaa, 0xaa,
43 0xaa, 0xaa, 0xaa, 0xaa,
44 0xf0, 0xaa, 0xaa, 0xaa };
45 VECT_VAR_DECL(expected,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa,
46 0xaaaa, 0xaaaa, 0xfff0, 0xaaaa };
47 VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa,
48 0xaaaa, 0xcc00, 0xaaaa, 0xaaaa };
49 VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa,
50 0xc1800000, 0xaaaaaaaa };
51
52 #define TEST_MSG "VLD1_LANE/VLD1_LANEQ"
exec_vld1_lane(void)53 void exec_vld1_lane (void)
54 {
55 /* Fill vector_src with 0xAA, then load 1 lane. */
56 #define TEST_VLD1_LANE(Q, T1, T2, W, N, L) \
57 memset (VECT_VAR(buffer_src, T1, W, N), 0xAA, W/8*N); \
58 VECT_VAR(vector_src, T1, W, N) = \
59 vld1##Q##_##T2##W(VECT_VAR(buffer_src, T1, W, N)); \
60 VECT_VAR(vector, T1, W, N) = \
61 vld1##Q##_lane_##T2##W(VECT_VAR(buffer, T1, W, N), \
62 VECT_VAR(vector_src, T1, W, N), L); \
63 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector, T1, W, N))
64
65 DECL_VARIABLE_ALL_VARIANTS(vector);
66 DECL_VARIABLE_ALL_VARIANTS(vector_src);
67
68 ARRAY(buffer_src, int, 8, 8);
69 ARRAY(buffer_src, int, 16, 4);
70 ARRAY(buffer_src, int, 32, 2);
71 ARRAY(buffer_src, int, 64, 1);
72 ARRAY(buffer_src, uint, 8, 8);
73 ARRAY(buffer_src, uint, 16, 4);
74 ARRAY(buffer_src, uint, 32, 2);
75 ARRAY(buffer_src, uint, 64, 1);
76 ARRAY(buffer_src, poly, 8, 8);
77 ARRAY(buffer_src, poly, 16, 4);
78 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
79 ARRAY(buffer_src, float, 16, 4);
80 #endif
81 ARRAY(buffer_src, float, 32, 2);
82
83 ARRAY(buffer_src, int, 8, 16);
84 ARRAY(buffer_src, int, 16, 8);
85 ARRAY(buffer_src, int, 32, 4);
86 ARRAY(buffer_src, int, 64, 2);
87 ARRAY(buffer_src, uint, 8, 16);
88 ARRAY(buffer_src, uint, 16, 8);
89 ARRAY(buffer_src, uint, 32, 4);
90 ARRAY(buffer_src, uint, 64, 2);
91 ARRAY(buffer_src, poly, 8, 16);
92 ARRAY(buffer_src, poly, 16, 8);
93 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
94 ARRAY(buffer_src, float, 16, 8);
95 #endif
96 ARRAY(buffer_src, float, 32, 4);
97
98 clean_results ();
99
100 /* Choose lane arbitrarily. */
101 TEST_VLD1_LANE(, int, s, 8, 8, 6);
102 TEST_VLD1_LANE(, int, s, 16, 4, 3);
103 TEST_VLD1_LANE(, int, s, 32, 2, 1);
104 TEST_VLD1_LANE(, int, s, 64, 1, 0);
105 TEST_VLD1_LANE(, uint, u, 8, 8, 7);
106 TEST_VLD1_LANE(, uint, u, 16, 4, 3);
107 TEST_VLD1_LANE(, uint, u, 32, 2, 1);
108 TEST_VLD1_LANE(, uint, u, 64, 1, 0);
109 TEST_VLD1_LANE(, poly, p, 8, 8, 7);
110 TEST_VLD1_LANE(, poly, p, 16, 4, 3);
111 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
112 TEST_VLD1_LANE(, float, f, 16, 4, 2);
113 #endif
114 TEST_VLD1_LANE(, float, f, 32, 2, 1);
115
116 TEST_VLD1_LANE(q, int, s, 8, 16, 15);
117 TEST_VLD1_LANE(q, int, s, 16, 8, 5);
118 TEST_VLD1_LANE(q, int, s, 32, 4, 2);
119 TEST_VLD1_LANE(q, int, s, 64, 2, 1);
120 TEST_VLD1_LANE(q, uint, u, 8, 16, 12);
121 TEST_VLD1_LANE(q, uint, u, 16, 8, 6);
122 TEST_VLD1_LANE(q, uint, u, 32, 4, 2);
123 TEST_VLD1_LANE(q, uint, u, 64, 2, 0);
124 TEST_VLD1_LANE(q, poly, p, 8, 16, 12);
125 TEST_VLD1_LANE(q, poly, p, 16, 8, 6);
126 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
127 TEST_VLD1_LANE(q, float, f, 16, 8, 5);
128 #endif
129 TEST_VLD1_LANE(q, float, f, 32, 4, 2);
130
131 CHECK_RESULTS (TEST_MSG, "");
132 }
133
main(void)134 int main (void)
135 {
136 exec_vld1_lane ();
137 return 0;
138 }
139