2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
6 /* Expected results. */
7 VECT_VAR_DECL(expected
,int,8,8) [] = { 0x11, 0x10, 0xf, 0xe,
9 VECT_VAR_DECL(expected
,int,16,4) [] = { 0x3, 0x2, 0x1, 0x0 };
10 VECT_VAR_DECL(expected
,int,32,2) [] = { 0x18, 0x17 };
11 VECT_VAR_DECL(expected
,int,64,1) [] = { 0x3333333333333333 };
12 VECT_VAR_DECL(expected
,uint
,8,8) [] = { 0xef, 0xf0, 0xf1, 0xf2,
13 0xf3, 0xf4, 0xf5, 0xf6 };
14 VECT_VAR_DECL(expected
,uint
,16,4) [] = { 0xffe3, 0xffe4, 0xffe5, 0xffe6 };
15 VECT_VAR_DECL(expected
,uint
,32,2) [] = { 0xffffffe8, 0xffffffe9 };
16 VECT_VAR_DECL(expected
,uint
,64,1) [] = { 0x3333333333333333 };
17 VECT_VAR_DECL(expected
,poly
,8,8) [] = { 0x33, 0x33, 0x33, 0x33,
18 0x33, 0x33, 0x33, 0x33 };
19 VECT_VAR_DECL(expected
,poly
,16,4) [] = { 0x3333, 0x3333, 0x3333, 0x3333 };
20 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0x41c26666, 0x41ba6666 };
21 VECT_VAR_DECL(expected
,int,8,16) [] = { 0x1a, 0x19, 0x18, 0x17,
22 0x16, 0x15, 0x14, 0x13,
23 0x12, 0x11, 0x10, 0xf,
25 VECT_VAR_DECL(expected
,int,16,8) [] = { 0x4, 0x3, 0x2, 0x1,
27 VECT_VAR_DECL(expected
,int,32,4) [] = { 0x30, 0x2f, 0x2e, 0x2d };
28 VECT_VAR_DECL(expected
,int,64,2) [] = { 0x3333333333333333,
30 VECT_VAR_DECL(expected
,uint
,8,16) [] = { 0xe6, 0xe7, 0xe8, 0xe9,
31 0xea, 0xeb, 0xec, 0xed,
32 0xee, 0xef, 0xf0, 0xf1,
33 0xf2, 0xf3, 0xf4, 0xf5 };
34 VECT_VAR_DECL(expected
,uint
,16,8) [] = { 0xffe4, 0xffe5, 0xffe6, 0xffe7,
35 0xffe8, 0xffe9, 0xffea, 0xffeb };
36 VECT_VAR_DECL(expected
,uint
,32,4) [] = { 0xffffffd0, 0xffffffd1,
37 0xffffffd2, 0xffffffd3 };
38 VECT_VAR_DECL(expected
,uint
,64,2) [] = { 0x3333333333333333,
40 VECT_VAR_DECL(expected
,poly
,8,16) [] = { 0x33, 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) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
45 0x3333, 0x3333, 0x3333, 0x3333 };
46 VECT_VAR_DECL(expected
,hfloat
,32,4) [] = { 0x42407ae1, 0x423c7ae1,
47 0x42387ae1, 0x42347ae1 };
49 /* Additional expected results for float32 variants with specially
50 chosen input values. */
51 VECT_VAR_DECL(expected_float32
,hfloat
,32,4) [] = { 0x0, 0x0, 0x0, 0x0 };
53 #define TEST_MSG "VABD/VABDQ"
56 /* Basic test: v4=vabd(v1,v2), then store the result. */
57 #define TEST_VABD(Q, T1, T2, W, N) \
58 VECT_VAR(vector_res, T1, W, N) = \
59 vabd##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \
60 VECT_VAR(vector2, T1, W, N)); \
61 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
63 #define DECL_VABD_VAR(VAR) \
64 DECL_VARIABLE(VAR, int, 8, 8); \
65 DECL_VARIABLE(VAR, int, 16, 4); \
66 DECL_VARIABLE(VAR, int, 32, 2); \
67 DECL_VARIABLE(VAR, uint, 8, 8); \
68 DECL_VARIABLE(VAR, uint, 16, 4); \
69 DECL_VARIABLE(VAR, uint, 32, 2); \
70 DECL_VARIABLE(VAR, float, 32, 2); \
71 DECL_VARIABLE(VAR, int, 8, 16); \
72 DECL_VARIABLE(VAR, int, 16, 8); \
73 DECL_VARIABLE(VAR, int, 32, 4); \
74 DECL_VARIABLE(VAR, uint, 8, 16); \
75 DECL_VARIABLE(VAR, uint, 16, 8); \
76 DECL_VARIABLE(VAR, uint, 32, 4); \
77 DECL_VARIABLE(VAR, float, 32, 4)
79 DECL_VABD_VAR(vector1
);
80 DECL_VABD_VAR(vector2
);
81 DECL_VABD_VAR(vector_res
);
85 /* Initialize input "vector1" from "buffer". */
86 VLOAD(vector1
, buffer
, , int, s
, 8, 8);
87 VLOAD(vector1
, buffer
, , int, s
, 16, 4);
88 VLOAD(vector1
, buffer
, , int, s
, 32, 2);
89 VLOAD(vector1
, buffer
, , uint
, u
, 8, 8);
90 VLOAD(vector1
, buffer
, , uint
, u
, 16, 4);
91 VLOAD(vector1
, buffer
, , uint
, u
, 32, 2);
92 VLOAD(vector1
, buffer
, , float, f
, 32, 2);
93 VLOAD(vector1
, buffer
, q
, int, s
, 8, 16);
94 VLOAD(vector1
, buffer
, q
, int, s
, 16, 8);
95 VLOAD(vector1
, buffer
, q
, int, s
, 32, 4);
96 VLOAD(vector1
, buffer
, q
, uint
, u
, 8, 16);
97 VLOAD(vector1
, buffer
, q
, uint
, u
, 16, 8);
98 VLOAD(vector1
, buffer
, q
, uint
, u
, 32, 4);
99 VLOAD(vector1
, buffer
, q
, float, f
, 32, 4);
101 /* Choose init value arbitrarily. */
102 VDUP(vector2
, , int, s
, 8, 8, 1);
103 VDUP(vector2
, , int, s
, 16, 4, -13);
104 VDUP(vector2
, , int, s
, 32, 2, 8);
105 VDUP(vector2
, , uint
, u
, 8, 8, 1);
106 VDUP(vector2
, , uint
, u
, 16, 4, 13);
107 VDUP(vector2
, , uint
, u
, 32, 2, 8);
108 VDUP(vector2
, , float, f
, 32, 2, 8.3f
);
109 VDUP(vector2
, q
, int, s
, 8, 16, 10);
110 VDUP(vector2
, q
, int, s
, 16, 8, -12);
111 VDUP(vector2
, q
, int, s
, 32, 4, 32);
112 VDUP(vector2
, q
, uint
, u
, 8, 16, 10);
113 VDUP(vector2
, q
, uint
, u
, 16, 8, 12);
114 VDUP(vector2
, q
, uint
, u
, 32, 4, 32);
115 VDUP(vector2
, q
, float, f
, 32, 4, 32.12f
);
117 /* Execute the tests. */
118 TEST_VABD(, int, s
, 8, 8);
119 TEST_VABD(, int, s
, 16, 4);
120 TEST_VABD(, int, s
, 32, 2);
121 TEST_VABD(, uint
, u
, 8, 8);
122 TEST_VABD(, uint
, u
, 16, 4);
123 TEST_VABD(, uint
, u
, 32, 2);
124 TEST_VABD(, float, f
, 32, 2);
125 TEST_VABD(q
, int, s
, 8, 16);
126 TEST_VABD(q
, int, s
, 16, 8);
127 TEST_VABD(q
, int, s
, 32, 4);
128 TEST_VABD(q
, uint
, u
, 8, 16);
129 TEST_VABD(q
, uint
, u
, 16, 8);
130 TEST_VABD(q
, uint
, u
, 32, 4);
131 TEST_VABD(q
, float, f
, 32, 4);
133 CHECK_RESULTS (TEST_MSG
, "");
136 /* Extra FP tests with special values (-0.0, ....) */
137 VDUP(vector1
, q
, float, f
, 32, 4, -0.0f
);
138 VDUP(vector2
, q
, float, f
, 32, 4, 0.0);
139 TEST_VABD(q
, float, f
, 32, 4);
140 CHECK_FP(TEST_MSG
, float, 32, 4, PRIx32
, expected_float32
, " FP special (-0.0)");
142 /* Extra FP tests with special values (-0.0, ....) */
143 VDUP(vector1
, q
, float, f
, 32, 4, 0.0f
);
144 VDUP(vector2
, q
, float, f
, 32, 4, -0.0);
145 TEST_VABD(q
, float, f
, 32, 4);
146 CHECK_FP(TEST_MSG
, float, 32, 4, PRIx32
, expected_float32
, " FP special (-0.0)");