1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <sys/time.h>
25#include <stdint.h>
26
27#include "../../../../include/wrappers_msa.h"
28#include "../../../../include/test_inputs_128.h"
29#include "../../../../include/test_utils_128.h"
30
31#define TEST_COUNT_TOTAL ( \
32 (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
33 3 * (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
34
35
36int32_t main(void)
37{
38 char *isa_ase_name = "MSA";
39 char *group_name = "Fixed Multiply";
40 char *instruction_name = "MSUB_Q.W";
41 int32_t ret;
42 uint32_t i, j;
43 struct timeval start, end;
44 double elapsed_time;
45
46 uint64_t b128_result[TEST_COUNT_TOTAL][2];
47 uint64_t b128_expect[TEST_COUNT_TOTAL][2] = {
48 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
49 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
50 { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, },
51 { 0xfffffffefffffffeULL, 0xfffffffefffffffeULL, },
52 { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
53 { 0xfffffffdfffffffdULL, 0xfffffffdfffffffdULL, },
54 { 0xfffffffcfffffffcULL, 0xfffffffdfffffffcULL, },
55 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
56 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
57 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
58 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
59 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
60 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
61 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
62 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
63 { 0xfffffffcfffffffcULL, 0xfffffffcfffffffcULL, },
64 { 0xfffffffbfffffffbULL, 0xfffffffbfffffffbULL, },
65 { 0xfffffffbfffffffbULL, 0xfffffffbfffffffbULL, },
66 { 0xc71c71c1c71c71c1ULL, 0xc71c71c1c71c71c1ULL, },
67 { 0xfffffffafffffffaULL, 0xfffffffafffffffaULL, },
68 { 0xddddddd7ddddddd7ULL, 0xddddddd7ddddddd7ULL, },
69 { 0xfffffff9fffffff9ULL, 0xfffffff9fffffff9ULL, },
70 { 0xed097b3ab425ed01ULL, 0x25ed0973ed097b3aULL, },
71 { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
72 { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
73 { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
74 { 0x38e38e3038e38e30ULL, 0x38e38e3038e38e30ULL, },
75 { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
76 { 0x2222221922222219ULL, 0x2222221922222219ULL, },
77 { 0xfffffff7fffffff7ULL, 0xfffffff7fffffff7ULL, },
78 { 0x12f684b44bda12edULL, 0xda12f67c12f684b4ULL, },
79 { 0xfffffff6fffffff7ULL, 0xfffffff7fffffff6ULL, },
80 { 0xfffffff5fffffff6ULL, 0xfffffff6fffffff5ULL, },
81 { 0xfffffff5fffffff6ULL, 0xfffffff6fffffff5ULL, },
82 { 0xddddddd2ddddddd3ULL, 0xddddddd3ddddddd2ULL, },
83 { 0xfffffff4fffffff5ULL, 0xfffffff5fffffff4ULL, },
84 { 0xeb851eabeb851eacULL, 0xeb851eaceb851eabULL, },
85 { 0xfffffff2fffffff3ULL, 0xfffffff3fffffff2ULL, },
86 { 0xf49f49e6d27d27c4ULL, 0x16c16c09f49f49e6ULL, },
87 { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
88 { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
89 { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
90 { 0x2222221322222213ULL, 0x2222221322222213ULL, },
91 { 0xfffffff1fffffff1ULL, 0xfffffff1fffffff1ULL, },
92 { 0x147ae138147ae138ULL, 0x147ae138147ae138ULL, },
93 { 0xfffffff0fffffff0ULL, 0xfffffff0fffffff0ULL, },
94 { 0x0b60b5fb2d82d81dULL, 0xe93e93d90b60b5fbULL, },
95 { 0xffffffefffffffefULL, 0xffffffefffffffefULL, },
96 { 0xffffffeeffffffeeULL, 0xffffffefffffffeeULL, },
97 { 0xffffffeeffffffeeULL, 0xffffffefffffffeeULL, },
98 { 0xed097b2fb425ecf6ULL, 0x25ed0969ed097b2fULL, },
99 { 0xffffffecffffffecULL, 0xffffffeeffffffecULL, },
100 { 0xf49f49e0d27d27bdULL, 0x16c16c04f49f49e0ULL, },
101 { 0xffffffebffffffeaULL, 0xffffffedffffffebULL, },
102 { 0xf9add3ab9add3bf6ULL, 0xe6b74ef0f9add3abULL, },
103 { 0xffffffeaffffffe8ULL, 0xffffffecffffffeaULL, },
104 { 0xffffffeaffffffe8ULL, 0xffffffebffffffeaULL, },
105 { 0xffffffeaffffffe8ULL, 0xffffffebffffffeaULL, },
106 { 0x12f684a74bda12deULL, 0xda12f66f12f684a7ULL, },
107 { 0xffffffe9ffffffe8ULL, 0xffffffeaffffffe9ULL, },
108 { 0x0b60b5f42d82d815ULL, 0xe93e93d20b60b5f4ULL, },
109 { 0xffffffe8ffffffe7ULL, 0xffffffe8ffffffe8ULL, },
110 { 0x06522c276522c3d9ULL, 0x1948b0e406522c27ULL, },
111 { 0xffffffe7ffffffe7ULL, 0xffffffe7ffffffe7ULL, },
112 { 0x9048175df3423f14ULL, 0xd394eba0fffb65e2ULL, },
113 { 0x8c4dc60edac87812ULL, 0xc8687ef6003bdb1bULL, },
114 { 0x80000000f0ed8852ULL, 0xb0ef6662ff3a80e6ULL, },
115 { 0xe8ec58e8d33594acULL, 0xf41fb1f8fe335d76ULL, },
116 { 0xe4f20799babbcdaaULL, 0xe8f3454efe73d2afULL, },
117 { 0xe4cdc5978bb75798ULL, 0xe623b939faecec20ULL, },
118 { 0xe2057a0fb6418676ULL, 0xe03c1eae0901cfcdULL, },
119 { 0xe5c1db3280000000ULL, 0xf122e6111767bfefULL, },
120 { 0x979cbaab96251040ULL, 0xd9a9cd7d166665baULL, },
121 { 0x94d46f23c0af3f1eULL, 0xd3c232f2247b4967ULL, },
122 { 0x800000009a322d5aULL, 0xc75aaa8dec42881aULL, },
123 { 0xc96455c6cdd91d8cULL, 0xeadc3c95b2c62f40ULL, },
124 { 0x3250aeaeb02129e6ULL, 0x2e0c882bb1bf0bd0ULL, },
125 { 0x360d0fd180000000ULL, 0x3ef34f8ec024fbf2ULL, },
126 { 0x7f716597b3a6f032ULL, 0x6274e19686a8a318ULL, },
127 { 0x1ce6cdb280000000ULL, 0xfcd31bb480000000ULL, },
128 { 0x37e70b49a8625540ULL, 0xfeb1f7e080000000ULL, },
129 { 0x39c31699dd7c5546ULL, 0xfee37780953f52fcULL, },
130 { 0x5f82316fca8f431eULL, 0xff3c0af780000000ULL, },
131 { 0x0bb5432ff1e2e177ULL, 0xfe8d6e9580000000ULL, },
132 { 0x16a56af3f656d2b3ULL, 0xff67ba1b80000000ULL, },
133 { 0x17664384fc31bf42ULL, 0xff7e4aa4953f52fcULL, },
134 { 0x26b0cbfdfa1b830bULL, 0xffa6ab9180000000ULL, },
135 { 0x04be31a4fe719ab1ULL, 0xff57124580000000ULL, },
136 { 0x092c8a1ffeef4c68ULL, 0xffba958e80000000ULL, },
137 { 0x097aa960ff949347ULL, 0xffc4dede953f52fcULL, },
138 { 0x0fac7158ff59ab27ULL, 0xffd7471a80000000ULL, },
139 { 0x01ebdf01ffd41248ULL, 0xffb2fdd380000000ULL, },
140 { 0x03b76546ffe1ee50ULL, 0xffe05b1780000000ULL, },
141 { 0x03d70afdfff427aaULL, 0xffe50b86953f52fcULL, },
142 { 0x065971c1ffeda8dfULL, 0xffed6fa980000000ULL, },
143 { 0x00c741e8fffb2801ULL, 0xffdce50280000000ULL, },
144 { 0x01816947fffcaf39ULL, 0xfff1931580000000ULL, },
145 { 0x02e97a17fffdbb03ULL, 0xfffa128380000000ULL, },
146 { 0x05a1edf3fffe7250ULL, 0xfffd906f80000000ULL, },
147 { 0x0ae508c5fffeefc8ULL, 0xfffeffc380000000ULL, },
148 { 0x0b41cf1bffff94c3ULL, 0xffff25bb953f52fcULL, },
149 { 0x0ba1ab79ffffd5c1ULL, 0xffff4613a6f7bf69ULL, },
150 { 0x0c04b828ffffef5bULL, 0xffff61a0b5bf25caULL, },
151 { 0x0c6b104efffff971ULL, 0xffff7918c21285a5ULL, },
152 { 0x148886c7fffff5d8ULL, 0xffffa3179907b21bULL, },
153 { 0x21f39335fffff046ULL, 0xffffc00380000000ULL, },
154 { 0x38235e38ffffe7a6ULL, 0xffffd3ee80000000ULL, },
155 { 0x5cd2ce93ffffda4bULL, 0xffffe1a680000000ULL, },
156 { 0x0b60ff8afffff60aULL, 0xffffc69a80000000ULL, },
157 { 0x01651818fffffd5eULL, 0xffff937480000000ULL, },
158 { 0x002bc65fffffff4dULL, 0xffff32bb80000000ULL, },
159 { 0x00055dbfffffffd0ULL, 0xfffe7bd280000000ULL, },
160};
161
162 reset_msa_registers();
163
164 gettimeofday(&start, NULL);
165
166 for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
167 for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
168 do_msa_MSUB_Q_W(b128_pattern[i], b128_pattern[j],
169 b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
170 }
171 }
172
173 for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
174 for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
175 do_msa_MSUB_Q_W(b128_random[i], b128_random[j],
176 b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
177 (PATTERN_INPUTS_SHORT_COUNT)) +
178 RANDOM_INPUTS_SHORT_COUNT * i + j]);
179 }
180 }
181
182 for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
183 for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
184 do_msa_MSUB_Q_W__DDT(b128_random[i], b128_random[j],
185 b128_result[
186 ((PATTERN_INPUTS_SHORT_COUNT) *
187 (PATTERN_INPUTS_SHORT_COUNT)) +
188 ((RANDOM_INPUTS_SHORT_COUNT) *
189 (RANDOM_INPUTS_SHORT_COUNT)) +
190 RANDOM_INPUTS_SHORT_COUNT * i + j]);
191 }
192 }
193
194 for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
195 for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
196 do_msa_MSUB_Q_W__DSD(b128_random[i], b128_random[j],
197 b128_result[
198 ((PATTERN_INPUTS_SHORT_COUNT) *
199 (PATTERN_INPUTS_SHORT_COUNT)) +
200 (2 * (RANDOM_INPUTS_SHORT_COUNT) *
201 (RANDOM_INPUTS_SHORT_COUNT)) +
202 RANDOM_INPUTS_SHORT_COUNT * i + j]);
203 }
204 }
205
206 gettimeofday(&end, NULL);
207
208 elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
209 elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
210
211 ret = check_results_128(isa_ase_name, group_name, instruction_name,
212 TEST_COUNT_TOTAL, elapsed_time,
213 &b128_result[0][0], &b128_expect[0][0]);
214
215 return ret;
216}
217