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 = "MSUBR_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 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
49 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
50 { 0x0000000100000001ULL, 0x0000000100000001ULL, },
51 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
52 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
53 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
54 { 0x0000000000000001ULL, 0x0000000000000000ULL, },
55 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
56 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
57 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
58 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
59 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
60 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
61 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
62 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
63 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
64 { 0x0000000100000001ULL, 0x0000000100000001ULL, },
65 { 0x0000000100000001ULL, 0x0000000100000001ULL, },
66 { 0x38e38e3b38e38e3bULL, 0x38e38e3b38e38e3bULL, },
67 { 0x0000000200000002ULL, 0x0000000200000002ULL, },
68 { 0x2222222522222225ULL, 0x2222222522222225ULL, },
69 { 0x0000000300000003ULL, 0x0000000300000003ULL, },
70 { 0x12f684c14bda12faULL, 0xda12f68812f684c1ULL, },
71 { 0x0000000400000003ULL, 0x0000000400000004ULL, },
72 { 0x0000000300000002ULL, 0x0000000300000003ULL, },
73 { 0x0000000300000002ULL, 0x0000000300000003ULL, },
74 { 0xc71c71cac71c71c9ULL, 0xc71c71cac71c71caULL, },
75 { 0x0000000200000001ULL, 0x0000000200000002ULL, },
76 { 0xdddddddfdddddddeULL, 0xdddddddfdddddddfULL, },
77 { 0x0000000100000000ULL, 0x0000000100000001ULL, },
78 { 0xed097b43b425ed0aULL, 0x25ed097ced097b43ULL, },
79 { 0x0000000000000000ULL, 0x0000000100000000ULL, },
80 { 0x0000000000000000ULL, 0x0000000100000000ULL, },
81 { 0x0000000000000000ULL, 0x0000000100000000ULL, },
82 { 0x2222222322222223ULL, 0x2222222422222223ULL, },
83 { 0x0000000000000000ULL, 0x0000000100000000ULL, },
84 { 0x147ae148147ae148ULL, 0x147ae149147ae148ULL, },
85 { 0x0000000000000000ULL, 0x0000000100000000ULL, },
86 { 0x0b60b60c2d82d82eULL, 0xe93e93ea0b60b60cULL, },
87 { 0x0000000100000000ULL, 0x0000000100000001ULL, },
88 { 0x0000000100000000ULL, 0x0000000100000001ULL, },
89 { 0x0000000100000000ULL, 0x0000000100000001ULL, },
90 { 0xdddddddfdddddddeULL, 0xdddddddfdddddddfULL, },
91 { 0x0000000100000000ULL, 0x0000000100000001ULL, },
92 { 0xeb851eb9eb851eb8ULL, 0xeb851eb9eb851eb9ULL, },
93 { 0x0000000100000000ULL, 0x0000000100000001ULL, },
94 { 0xf49f49f5d27d27d3ULL, 0x16c16c17f49f49f5ULL, },
95 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
96 { 0x0000000000000001ULL, 0x0000000000000000ULL, },
97 { 0x0000000000000001ULL, 0x0000000000000000ULL, },
98 { 0x12f684be4bda12f8ULL, 0xda12f68512f684beULL, },
99 { 0x0000000000000002ULL, 0x0000000000000000ULL, },
100 { 0x0b60b60c2d82d830ULL, 0xe93e93e90b60b60cULL, },
101 { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
102 { 0x06522c3f6522c3f7ULL, 0x1948b0fb06522c3fULL, },
103 { 0x0000000000000004ULL, 0xffffffff00000000ULL, },
104 { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
105 { 0x0000000000000003ULL, 0xffffffff00000000ULL, },
106 { 0xed097b43b425ed0cULL, 0x25ed097bed097b43ULL, },
107 { 0x0000000000000002ULL, 0x0000000000000000ULL, },
108 { 0xf49f49f5d27d27d4ULL, 0x16c16c17f49f49f5ULL, },
109 { 0x0000000000000001ULL, 0x0000000000000000ULL, },
110 { 0xf9add3c19add3c0eULL, 0xe6b74f04f9add3c1ULL, },
111 { 0x0000000000000000ULL, 0x0000000100000000ULL, },
112 { 0x6fb7e8890cbdc0d3ULL, 0x2c6b144700049a05ULL, },
113 { 0x73b239d7253787d5ULL, 0x379780f0ffc424ccULL, },
114 { 0x7fffffff0f127795ULL, 0x4f10998300c57f01ULL, },
115 { 0x1713a7162cca6b3bULL, 0x0be04ded01cca270ULL, },
116 { 0x1b0df8644544323dULL, 0x170cba96018c2d37ULL, },
117 { 0x1b323a657448a84fULL, 0x19dc46aa051313c6ULL, },
118 { 0x1dfa85ed49be7970ULL, 0x1fc3e135f6fe3018ULL, },
119 { 0x1a3e24ca7fffffffULL, 0x0edd19d1e8983ff6ULL, },
120 { 0x6863455169daefbfULL, 0x26563264e9999a2bULL, },
121 { 0x6b2b90d93f50c0e0ULL, 0x2c3dccefdb84b67dULL, },
122 { 0x7fffffff65cdd2a4ULL, 0x38a5555313bd77c9ULL, },
123 { 0x369baa393226e271ULL, 0x1523c34a4d39d0a3ULL, },
124 { 0xcdaf51504fded617ULL, 0xd1f377b44e40f412ULL, },
125 { 0xc9f2f02d7fffffffULL, 0xc10cb0503fdb03f0ULL, },
126 { 0x808e9a674c590fccULL, 0x9d8b1e4779575ccaULL, },
127 { 0xe319324b7fffffffULL, 0x032ce4297fffffffULL, },
128 { 0xfe196fe67fffffffULL, 0x050bc0417e7bb00bULL, },
129 { 0xfe299f487fffffffULL, 0x05cb2b577fffffffULL, },
130 { 0xff5d018339cf8b80ULL, 0x0798e2662b2b2514ULL, },
131 { 0xfecdfe20645a7d9bULL, 0x00d3dcf80dea608eULL, },
132 { 0xffebe0517fffffffULL, 0x0150ab000dc02968ULL, },
133 { 0xffec8baf7fffffffULL, 0x01828ea210087db2ULL, },
134 { 0xfff9423c39cf8b80ULL, 0x01fae4c1056841b9ULL, },
135 { 0xfff35806645a7d9bULL, 0x003737bc01be3862ULL, },
136 { 0xffff2aee7fffffffULL, 0x0057bed801b8eeb0ULL, },
137 { 0xffff32047fffffffULL, 0x0064bf8102021ffcULL, },
138 { 0xffffb89f39cf8b80ULL, 0x00841c7a00ad640aULL, },
139 { 0xffff79fe645a7d9bULL, 0x000e642f0037e4a6ULL, },
140 { 0xfffff7307fffffffULL, 0x0016de7800373b16ULL, },
141 { 0xfffff77b7fffffffULL, 0x001a42040040661aULL, },
142 { 0xfffffd0c39cf8b80ULL, 0x00226e990015b802ULL, },
143 { 0xfffffa75645a7d9bULL, 0x0003c0350007004aULL, },
144 { 0xffffffa37fffffffULL, 0x0005f5d90006eb0dULL, },
145 { 0xfffffffa7fffffffULL, 0x000978b30006d610ULL, },
146 { 0x000000007fffffffULL, 0x000f0d0c0006c153ULL, },
147 { 0x000000007fffffffULL, 0x0017eacf0006acd5ULL, },
148 { 0x000000007fffffffULL, 0x001b761e0007c87dULL, },
149 { 0x000000007fffffffULL, 0x001f87e00009133bULL, },
150 { 0x000000007fffffffULL, 0x00243402000a94e0ULL, },
151 { 0x000000007fffffffULL, 0x00299164000c5689ULL, },
152 { 0x0000000039cf8b80ULL, 0x003682160004293bULL, },
153 { 0x000000001a1c28c4ULL, 0x00477a0900016741ULL, },
154 { 0x000000000bcae026ULL, 0x005dba4500007929ULL, },
155 { 0x00000000055376c2ULL, 0x007ae7c2000028ddULL, },
156 { 0x00000000093ed557ULL, 0x000d637500000d2cULL, },
157 { 0x00000000100c9469ULL, 0x0001755d0000043fULL, },
158 { 0x000000001bdc1297ULL, 0x000028ac0000015eULL, },
159 { 0x00000000305c8bbfULL, 0x0000046e00000071ULL, },
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_MADDR_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_MADDR_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_MADDR_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_MADDR_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