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) [] = { 0xf7, 0x33, 0x33, 0x33,
7 				       0x33, 0x33, 0x33, 0x33 };
8 VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff3, 0x3333, 0x3333, 0x3333 };
9 VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff1, 0x33333333 };
10 VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffff0 };
11 VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf6, 0x33, 0x33, 0x33,
12 					0x33, 0x33, 0x33, 0x33 };
13 VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff2, 0x3333, 0x3333, 0x3333 };
14 VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfffffff0, 0x33333333 };
15 VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 };
16 VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf6, 0x33, 0x33, 0x33,
17 					0x33, 0x33, 0x33, 0x33 };
18 VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff2, 0x3333, 0x3333, 0x3333 };
19 VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xcb80, 0x3333, 0x3333, 0x3333 };
20 VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1700000, 0x33333333 };
21 VECT_VAR_DECL(expected,int,8,16) [] = { 0xff, 0x33, 0x33, 0x33,
22 					0x33, 0x33, 0x33, 0x33,
23 					0x33, 0x33, 0x33, 0x33,
24 					0x33, 0x33, 0x33, 0x33 };
25 VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff5, 0x3333, 0x3333, 0x3333,
26 					0x3333, 0x3333, 0x3333, 0x3333 };
27 VECT_VAR_DECL(expected,int,32,4) [] = { 0xfffffff1, 0x33333333,
28 					0x33333333, 0x33333333 };
29 VECT_VAR_DECL(expected,int,64,2) [] = { 0xfffffffffffffff1, 0x3333333333333333 };
30 VECT_VAR_DECL(expected,uint,8,16) [] = { 0xfa, 0x33, 0x33, 0x33,
31 					 0x33, 0x33, 0x33, 0x33,
32 					 0x33, 0x33, 0x33, 0x33,
33 					 0x33, 0x33, 0x33, 0x33 };
34 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff4, 0x3333, 0x3333, 0x3333,
35 					 0x3333, 0x3333, 0x3333, 0x3333 };
36 VECT_VAR_DECL(expected,uint,32,4) [] = { 0xfffffff3, 0x33333333,
37 					 0x33333333, 0x33333333 };
38 VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfffffffffffffff0,
39 					 0x3333333333333333 };
40 VECT_VAR_DECL(expected,poly,8,16) [] = { 0xfa, 0x33, 0x33, 0x33,
41 					 0x33, 0x33, 0x33, 0x33,
42 					 0x33, 0x33, 0x33, 0x33,
43 					 0x33, 0x33, 0x33, 0x33 };
44 VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff4, 0x3333, 0x3333, 0x3333,
45 					 0x3333, 0x3333, 0x3333, 0x3333 };
46 VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xc900, 0x3333, 0x3333, 0x3333,
47 					   0x3333, 0x3333, 0x3333, 0x3333 };
48 VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1700000, 0x33333333,
49 					   0x33333333, 0x33333333 };
50 
51 #define TEST_MSG "VST1_LANE/VST1_LANEQ"
exec_vst1_lane(void)52 void exec_vst1_lane (void)
53 {
54 #define TEST_VST1_LANE(Q, T1, T2, W, N, L)		\
55   VECT_VAR(vector, T1, W, N) =				\
56     vld1##Q##_##T2##W(VECT_VAR(buffer, T1, W, N));	\
57   vst1##Q##_lane_##T2##W(VECT_VAR(result, T1, W, N),	\
58 			 VECT_VAR(vector, T1, W, N), L)
59 
60   DECL_VARIABLE_ALL_VARIANTS(vector);
61 
62   clean_results ();
63 
64   /* Choose lane arbitrarily.  */
65   TEST_VST1_LANE(, int, s, 8, 8, 7);
66   TEST_VST1_LANE(, int, s, 16, 4, 3);
67   TEST_VST1_LANE(, int, s, 32, 2, 1);
68   TEST_VST1_LANE(, int, s, 64, 1, 0);
69   TEST_VST1_LANE(, uint, u, 8, 8, 6);
70   TEST_VST1_LANE(, uint, u, 16, 4, 2);
71   TEST_VST1_LANE(, uint, u, 32, 2, 0);
72   TEST_VST1_LANE(, uint, u, 64, 1, 0);
73   TEST_VST1_LANE(, poly, p, 8, 8, 6);
74   TEST_VST1_LANE(, poly, p, 16, 4, 2);
75 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
76   TEST_VST1_LANE(, float, f, 16, 4, 1);
77 #endif
78   TEST_VST1_LANE(, float, f, 32, 2, 1);
79 
80   TEST_VST1_LANE(q, int, s, 8, 16, 15);
81   TEST_VST1_LANE(q, int, s, 16, 8, 5);
82   TEST_VST1_LANE(q, int, s, 32, 4, 1);
83   TEST_VST1_LANE(q, int, s, 64, 2, 1);
84   TEST_VST1_LANE(q, uint, u, 8, 16, 10);
85   TEST_VST1_LANE(q, uint, u, 16, 8, 4);
86   TEST_VST1_LANE(q, uint, u, 32, 4, 3);
87   TEST_VST1_LANE(q, uint, u, 64, 2, 0);
88   TEST_VST1_LANE(q, poly, p, 8, 16, 10);
89   TEST_VST1_LANE(q, poly, p, 16, 8, 4);
90 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
91   TEST_VST1_LANE(q, float, f, 16, 8, 6);
92 #endif
93   TEST_VST1_LANE(q, float, f, 32, 4, 1);
94 
95   CHECK_RESULTS(TEST_MSG, "");
96 }
97 
main(void)98 int main (void)
99 {
100   exec_vst1_lane ();
101   return 0;
102 }
103