2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected
,int,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
7 0xf4, 0xf5, 0xf6, 0x11 };
8 VECT_VAR_DECL(expected
,int,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0x22 };
9 VECT_VAR_DECL(expected
,int,32,2) [] = { 0xfffffff0, 0x33 };
10 VECT_VAR_DECL(expected
,int,64,1) [] = { 0x44 };
11 VECT_VAR_DECL(expected
,uint
,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
12 0xf4, 0xf5, 0x55, 0xf7 };
13 VECT_VAR_DECL(expected
,uint
,16,4) [] = { 0xfff0, 0xfff1, 0x66, 0xfff3 };
14 VECT_VAR_DECL(expected
,uint
,32,2) [] = { 0xfffffff0, 0x77 };
15 VECT_VAR_DECL(expected
,uint
,64,1) [] = { 0x88 };
16 VECT_VAR_DECL(expected
,poly
,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
17 0xf4, 0xf5, 0x55, 0xf7 };
18 VECT_VAR_DECL(expected
,poly
,16,4) [] = { 0xfff0, 0xfff1, 0x66, 0xfff3 };
19 VECT_VAR_DECL(expected
,hfloat
,16,4) [] = { 0xcc00, 0xcb80, 0x4840, 0xca80 };
20 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0xc1800000, 0x4204cccd };
21 VECT_VAR_DECL(expected
,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
22 0xf4, 0xf5, 0xf6, 0xf7,
23 0xf8, 0xf9, 0xfa, 0xfb,
24 0xfc, 0xfd, 0xfe, 0x99 };
25 VECT_VAR_DECL(expected
,int,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
26 0xfff4, 0xaa, 0xfff6, 0xfff7 };
27 VECT_VAR_DECL(expected
,int,32,4) [] = { 0xfffffff0, 0xfffffff1,
29 VECT_VAR_DECL(expected
,int,64,2) [] = { 0xfffffffffffffff0, 0xcc };
30 VECT_VAR_DECL(expected
,uint
,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
31 0xf4, 0xf5, 0xf6, 0xf7,
32 0xf8, 0xf9, 0xfa, 0xfb,
33 0xfc, 0xfd, 0xdd, 0xff };
34 VECT_VAR_DECL(expected
,uint
,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
35 0xfff4, 0xfff5, 0xee, 0xfff7 };
36 VECT_VAR_DECL(expected
,uint
,32,4) [] = { 0xfffffff0, 0xfffffff1,
38 VECT_VAR_DECL(expected
,uint
,64,2) [] = { 0xfffffffffffffff0, 0x11 };
39 VECT_VAR_DECL(expected
,poly
,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3,
40 0xf4, 0xf5, 0xf6, 0xf7,
41 0xf8, 0xf9, 0xfa, 0xfb,
42 0xfc, 0xfd, 0xdd, 0xff };
43 VECT_VAR_DECL(expected
,poly
,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3,
44 0xfff4, 0xfff5, 0xee, 0xfff7 };
45 VECT_VAR_DECL(expected
,hfloat
,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80,
46 0xca00, 0x4480, 0xc900, 0xc880 };
47 VECT_VAR_DECL(expected
,hfloat
,32,4) [] = { 0xc1800000, 0xc1700000,
48 0xc1600000, 0x41333333 };
50 #define TEST_MSG "VSET_LANE/VSET_LANEQ"
51 void exec_vset_lane (void)
53 /* vec=vset_lane(val, vec, lane), then store the result. */
54 #define TEST_VSET_LANE(Q, T1, T2, W, N, V, L) \
55 VECT_VAR(vector, T1, W, N) = \
56 vset##Q##_lane_##T2##W(V, \
57 VECT_VAR(vector, T1, W, N), \
59 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector, T1, W, N))
61 DECL_VARIABLE_ALL_VARIANTS(vector
);
65 /* Initialize input "vector" from "buffer". */
66 TEST_MACRO_ALL_VARIANTS_2_5(VLOAD
, vector
, buffer
);
67 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
68 VLOAD(vector
, buffer
, , float, f
, 16, 4);
69 VLOAD(vector
, buffer
, q
, float, f
, 16, 8);
71 VLOAD(vector
, buffer
, , float, f
, 32, 2);
72 VLOAD(vector
, buffer
, q
, float, f
, 32, 4);
74 /* Choose value and lane arbitrarily. */
75 TEST_VSET_LANE(, int, s
, 8, 8, 0x11, 7);
76 TEST_VSET_LANE(, int, s
, 16, 4, 0x22, 3);
77 TEST_VSET_LANE(, int, s
, 32, 2, 0x33, 1);
78 TEST_VSET_LANE(, int, s
, 64, 1, 0x44, 0);
79 TEST_VSET_LANE(, uint
, u
, 8, 8, 0x55, 6);
80 TEST_VSET_LANE(, uint
, u
, 16, 4, 0x66, 2);
81 TEST_VSET_LANE(, uint
, u
, 32, 2, 0x77, 1);
82 TEST_VSET_LANE(, uint
, u
, 64, 1, 0x88, 0);
83 TEST_VSET_LANE(, poly
, p
, 8, 8, 0x55, 6);
84 TEST_VSET_LANE(, poly
, p
, 16, 4, 0x66, 2);
85 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
86 TEST_VSET_LANE(, float, f
, 16, 4, 8.5f
, 2);
88 TEST_VSET_LANE(, float, f
, 32, 2, 33.2f
, 1);
90 TEST_VSET_LANE(q
, int, s
, 8, 16, 0x99, 15);
91 TEST_VSET_LANE(q
, int, s
, 16, 8, 0xAA, 5);
92 TEST_VSET_LANE(q
, int, s
, 32, 4, 0xBB, 3);
93 TEST_VSET_LANE(q
, int, s
, 64, 2, 0xCC, 1);
94 TEST_VSET_LANE(q
, uint
, u
, 8, 16, 0xDD, 14);
95 TEST_VSET_LANE(q
, uint
, u
, 16, 8, 0xEE, 6);
96 TEST_VSET_LANE(q
, uint
, u
, 32, 4, 0xFF, 2);
97 TEST_VSET_LANE(q
, uint
, u
, 64, 2, 0x11, 1);
98 TEST_VSET_LANE(q
, poly
, p
, 8, 16, 0xDD, 14);
99 TEST_VSET_LANE(q
, poly
, p
, 16, 8, 0xEE, 6);
100 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
101 TEST_VSET_LANE(q
, float, f
, 16, 8, 4.5f
, 5);
103 TEST_VSET_LANE(q
, float, f
, 32, 4, 11.2f
, 3);
105 CHECK_RESULTS(TEST_MSG
, "");