2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected
,int,8,8) [] = { 0xf6, 0xf7, 0xf8, 0xf9,
7 0xfa, 0xfb, 0xfc, 0xfd };
8 VECT_VAR_DECL(expected
,int,16,4) [] = { 0x16, 0x17, 0x18, 0x19 };
9 VECT_VAR_DECL(expected
,int,32,2) [] = { 0x20, 0x21 };
10 VECT_VAR_DECL(expected
,int,64,1) [] = { 0x3333333333333333 };
11 VECT_VAR_DECL(expected
,uint
,8,8) [] = { 0x53, 0x54, 0x55, 0x56,
12 0x57, 0x58, 0x59, 0x5a };
13 VECT_VAR_DECL(expected
,uint
,16,4) [] = { 0x907, 0x908, 0x909, 0x90a };
14 VECT_VAR_DECL(expected
,uint
,32,2) [] = { 0xffffffe7, 0xffffffe8 };
15 VECT_VAR_DECL(expected
,uint
,64,1) [] = { 0x3333333333333333 };
16 VECT_VAR_DECL(expected
,poly
,8,8) [] = { 0x33, 0x33, 0x33, 0x33,
17 0x33, 0x33, 0x33, 0x33 };
18 VECT_VAR_DECL(expected
,poly
,16,4) [] = { 0x3333, 0x3333, 0x3333, 0x3333 };
19 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0x33333333, 0x33333333 };
20 VECT_VAR_DECL(expected
,int,8,16) [] = { 0x5e, 0x5f, 0x60, 0x61,
21 0x62, 0x63, 0x64, 0x65,
22 0x66, 0x67, 0x68, 0x69,
23 0x6a, 0x6b, 0x6c, 0x6d };
24 VECT_VAR_DECL(expected
,int,16,8) [] = { 0xb9c, 0xb9d, 0xb9e, 0xb9f,
25 0xba0, 0xba1, 0xba2, 0xba3 };
26 VECT_VAR_DECL(expected
,int,32,4) [] = { 0x26e0, 0x26e1, 0x26e2, 0x26e3 };
27 VECT_VAR_DECL(expected
,int,64,2) [] = { 0x3333333333333333,
29 VECT_VAR_DECL(expected
,uint
,8,16) [] = { 0xf8, 0xf9, 0xfa, 0xfb,
30 0xfc, 0xfd, 0xfe, 0xff,
33 VECT_VAR_DECL(expected
,uint
,16,8) [] = { 0xfff9, 0xfffa, 0xfffb, 0xfffc,
34 0xfffd, 0xfffe, 0xffff, 0x0 };
35 VECT_VAR_DECL(expected
,uint
,32,4) [] = { 0xc, 0xd, 0xe, 0xf };
36 VECT_VAR_DECL(expected
,uint
,64,2) [] = { 0x3333333333333333,
38 VECT_VAR_DECL(expected
,poly
,8,16) [] = { 0x33, 0x33, 0x33, 0x33,
39 0x33, 0x33, 0x33, 0x33,
40 0x33, 0x33, 0x33, 0x33,
41 0x33, 0x33, 0x33, 0x33 };
42 VECT_VAR_DECL(expected
,poly
,16,8) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
43 0x3333, 0x3333, 0x3333, 0x3333 };
44 VECT_VAR_DECL(expected
,hfloat
,32,4) [] = { 0x33333333, 0x33333333,
45 0x33333333, 0x33333333 };
47 #define TEST_MSG "VABA/VABAQ"
50 /* Basic test: v4=vaba(v1,v2,v3), then store the result. */
51 #define TEST_VABA(Q, T1, T2, W, N) \
52 VECT_VAR(vector_res, T1, W, N) = \
53 vaba##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \
54 VECT_VAR(vector2, T1, W, N), \
55 VECT_VAR(vector3, T1, W, N)); \
56 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
58 #define DECL_VABA_VAR(VAR) \
59 DECL_VARIABLE(VAR, int, 8, 8); \
60 DECL_VARIABLE(VAR, int, 16, 4); \
61 DECL_VARIABLE(VAR, int, 32, 2); \
62 DECL_VARIABLE(VAR, uint, 8, 8); \
63 DECL_VARIABLE(VAR, uint, 16, 4); \
64 DECL_VARIABLE(VAR, uint, 32, 2); \
65 DECL_VARIABLE(VAR, int, 8, 16); \
66 DECL_VARIABLE(VAR, int, 16, 8); \
67 DECL_VARIABLE(VAR, int, 32, 4); \
68 DECL_VARIABLE(VAR, uint, 8, 16); \
69 DECL_VARIABLE(VAR, uint, 16, 8); \
70 DECL_VARIABLE(VAR, uint, 32, 4)
72 DECL_VABA_VAR(vector1
);
73 DECL_VABA_VAR(vector2
);
74 DECL_VABA_VAR(vector3
);
75 DECL_VABA_VAR(vector_res
);
79 /* Initialize input "vector1" from "buffer". */
80 VLOAD(vector1
, buffer
, , int, s
, 8, 8);
81 VLOAD(vector1
, buffer
, , int, s
, 16, 4);
82 VLOAD(vector1
, buffer
, , int, s
, 32, 2);
83 VLOAD(vector1
, buffer
, , uint
, u
, 8, 8);
84 VLOAD(vector1
, buffer
, , uint
, u
, 16, 4);
85 VLOAD(vector1
, buffer
, , uint
, u
, 32, 2);
86 VLOAD(vector1
, buffer
, q
, int, s
, 8, 16);
87 VLOAD(vector1
, buffer
, q
, int, s
, 16, 8);
88 VLOAD(vector1
, buffer
, q
, int, s
, 32, 4);
89 VLOAD(vector1
, buffer
, q
, uint
, u
, 8, 16);
90 VLOAD(vector1
, buffer
, q
, uint
, u
, 16, 8);
91 VLOAD(vector1
, buffer
, q
, uint
, u
, 32, 4);
93 /* Choose init value arbitrarily. */
94 VDUP(vector2
, , int, s
, 8, 8, 1);
95 VDUP(vector2
, , int, s
, 16, 4, -13);
96 VDUP(vector2
, , int, s
, 32, 2, 8);
97 VDUP(vector2
, , uint
, u
, 8, 8, 1);
98 VDUP(vector2
, , uint
, u
, 16, 4, 13);
99 VDUP(vector2
, , uint
, u
, 32, 2, 8);
100 VDUP(vector2
, q
, int, s
, 8, 16, 10);
101 VDUP(vector2
, q
, int, s
, 16, 8, -12);
102 VDUP(vector2
, q
, int, s
, 32, 4, 32);
103 VDUP(vector2
, q
, uint
, u
, 8, 16, 10);
104 VDUP(vector2
, q
, uint
, u
, 16, 8, 12);
105 VDUP(vector2
, q
, uint
, u
, 32, 4, 32);
107 /* Choose init value arbitrarily. */
108 VDUP(vector3
, , int, s
, 8, 8, -5);
109 VDUP(vector3
, , int, s
, 16, 4, 25);
110 VDUP(vector3
, , int, s
, 32, 2, -40);
111 VDUP(vector3
, , uint
, u
, 8, 8, 100);
112 VDUP(vector3
, , uint
, u
, 16, 4, 2340);
113 VDUP(vector3
, , uint
, u
, 32, 2, 0xffffffff);
114 VDUP(vector3
, q
, int, s
, 8, 16, -100);
115 VDUP(vector3
, q
, int, s
, 16, 8, -3000);
116 VDUP(vector3
, q
, int, s
, 32, 4, 10000);
117 VDUP(vector3
, q
, uint
, u
, 8, 16, 2);
118 VDUP(vector3
, q
, uint
, u
, 16, 8, 3);
119 VDUP(vector3
, q
, uint
, u
, 32, 4, 4);
121 /* Execute the tests. */
122 TEST_VABA(, int, s
, 8, 8);
123 TEST_VABA(, int, s
, 16, 4);
124 TEST_VABA(, int, s
, 32, 2);
125 TEST_VABA(, uint
, u
, 8, 8);
126 TEST_VABA(, uint
, u
, 16, 4);
127 TEST_VABA(, uint
, u
, 32, 2);
128 TEST_VABA(q
, int, s
, 8, 16);
129 TEST_VABA(q
, int, s
, 16, 8);
130 TEST_VABA(q
, int, s
, 32, 4);
131 TEST_VABA(q
, uint
, u
, 8, 16);
132 TEST_VABA(q
, uint
, u
, 16, 8);
133 TEST_VABA(q
, uint
, u
, 32, 4);
135 CHECK_RESULTS (TEST_MSG
, "");