2 * Test program for MSA instruction SRL.B
4 * Copyright (C) 2019 Wave Computing, Inc.
5 * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com>
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 #include "../../../../include/wrappers_msa.h"
26 #include "../../../../include/test_inputs_128.h"
27 #include "../../../../include/test_utils_128.h"
29 #define TEST_COUNT_TOTAL ( \
30 (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
31 (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
36 char *isa_ase_name
= "MSA";
37 char *group_name
= "Shift";
38 char *instruction_name
= "SRL.B";
41 struct timeval start
, end
;
44 uint64_t b128_result
[TEST_COUNT_TOTAL
][2];
45 uint64_t b128_expect
[TEST_COUNT_TOTAL
][2] = {
46 { 0x0101010101010101ULL
, 0x0101010101010101ULL
, }, /* 0 */
47 { 0xffffffffffffffffULL
, 0xffffffffffffffffULL
, },
48 { 0x3f3f3f3f3f3f3f3fULL
, 0x3f3f3f3f3f3f3f3fULL
, },
49 { 0x0707070707070707ULL
, 0x0707070707070707ULL
, },
50 { 0x0f0f0f0f0f0f0f0fULL
, 0x0f0f0f0f0f0f0f0fULL
, },
51 { 0x1f1f1f1f1f1f1f1fULL
, 0x1f1f1f1f1f1f1f1fULL
, },
52 { 0x1f03ff1f03ff1f03ULL
, 0xff1f03ff1f03ff1fULL
, },
53 { 0x0f7f010f7f010f7fULL
, 0x010f7f010f7f010fULL
, },
54 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, }, /* 8 */
55 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
56 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
57 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
58 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
59 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
60 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
61 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
62 { 0x0101010101010101ULL
, 0x0101010101010101ULL
, }, /* 16 */
63 { 0xaaaaaaaaaaaaaaaaULL
, 0xaaaaaaaaaaaaaaaaULL
, },
64 { 0x2a2a2a2a2a2a2a2aULL
, 0x2a2a2a2a2a2a2a2aULL
, },
65 { 0x0505050505050505ULL
, 0x0505050505050505ULL
, },
66 { 0x0a0a0a0a0a0a0a0aULL
, 0x0a0a0a0a0a0a0a0aULL
, },
67 { 0x1515151515151515ULL
, 0x1515151515151515ULL
, },
68 { 0x1502aa1502aa1502ULL
, 0xaa1502aa1502aa15ULL
, },
69 { 0x0a55010a55010a55ULL
, 0x010a55010a55010aULL
, },
70 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, }, /* 24 */
71 { 0x5555555555555555ULL
, 0x5555555555555555ULL
, },
72 { 0x1515151515151515ULL
, 0x1515151515151515ULL
, },
73 { 0x0202020202020202ULL
, 0x0202020202020202ULL
, },
74 { 0x0505050505050505ULL
, 0x0505050505050505ULL
, },
75 { 0x0a0a0a0a0a0a0a0aULL
, 0x0a0a0a0a0a0a0a0aULL
, },
76 { 0x0a01550a01550a01ULL
, 0x550a01550a01550aULL
, },
77 { 0x052a00052a00052aULL
, 0x00052a00052a0005ULL
, },
78 { 0x0101010101010101ULL
, 0x0101010101010101ULL
, }, /* 32 */
79 { 0xccccccccccccccccULL
, 0xccccccccccccccccULL
, },
80 { 0x3333333333333333ULL
, 0x3333333333333333ULL
, },
81 { 0x0606060606060606ULL
, 0x0606060606060606ULL
, },
82 { 0x0c0c0c0c0c0c0c0cULL
, 0x0c0c0c0c0c0c0c0cULL
, },
83 { 0x1919191919191919ULL
, 0x1919191919191919ULL
, },
84 { 0x1903cc1903cc1903ULL
, 0xcc1903cc1903cc19ULL
, },
85 { 0x0c66010c66010c66ULL
, 0x010c66010c66010cULL
, },
86 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, }, /* 40 */
87 { 0x3333333333333333ULL
, 0x3333333333333333ULL
, },
88 { 0x0c0c0c0c0c0c0c0cULL
, 0x0c0c0c0c0c0c0c0cULL
, },
89 { 0x0101010101010101ULL
, 0x0101010101010101ULL
, },
90 { 0x0303030303030303ULL
, 0x0303030303030303ULL
, },
91 { 0x0606060606060606ULL
, 0x0606060606060606ULL
, },
92 { 0x0600330600330600ULL
, 0x3306003306003306ULL
, },
93 { 0x0319000319000319ULL
, 0x0003190003190003ULL
, },
94 { 0x0101000101000101ULL
, 0x0001010001010001ULL
, }, /* 48 */
95 { 0xe38e38e38e38e38eULL
, 0x38e38e38e38e38e3ULL
, },
96 { 0x38230e38230e3823ULL
, 0x0e38230e38230e38ULL
, },
97 { 0x0704010704010704ULL
, 0x0107040107040107ULL
, },
98 { 0x0e08030e08030e08ULL
, 0x030e08030e08030eULL
, },
99 { 0x1c11071c11071c11ULL
, 0x071c11071c11071cULL
, },
100 { 0x1c02381c02381c02ULL
, 0x381c02381c02381cULL
, },
101 { 0x0e47000e47000e47ULL
, 0x000e47000e47000eULL
, },
102 { 0x0000010000010000ULL
, 0x0100000100000100ULL
, }, /* 56 */
103 { 0x1c71c71c71c71c71ULL
, 0xc71c71c71c71c71cULL
, },
104 { 0x071c31071c31071cULL
, 0x31071c31071c3107ULL
, },
105 { 0x0003060003060003ULL
, 0x0600030600030600ULL
, },
106 { 0x01070c01070c0107ULL
, 0x0c01070c01070c01ULL
, },
107 { 0x030e18030e18030eULL
, 0x18030e18030e1803ULL
, },
108 { 0x0301c70301c70301ULL
, 0xc70301c70301c703ULL
, },
109 { 0x0138010138010138ULL
, 0x0101380101380101ULL
, },
110 { 0x881a030c28180240ULL
, 0x09000101030fb000ULL
, }, /* 64 */
111 { 0x1101e619010c0040ULL
, 0x1200011707002c00ULL
, },
112 { 0x081a033314000a40ULL
, 0x006700001f0f0500ULL
, },
113 { 0x8800030600311501ULL
, 0x02330b5e7f1e2c0cULL
, },
114 { 0xfb2f00064d240608ULL
, 0x020117000007520fULL
, },
115 { 0x1f02000c02120108ULL
, 0x040117060000140fULL
, },
116 { 0x0f2f001826011808ULL
, 0x00f702000207020fULL
, },
117 { 0xfb01000301493100ULL
, 0x007bbb1a0a0f14fcULL
, },
118 { 0xac16020ab9330480ULL
, 0x0401180302052501ULL
, }, /* 72 */
119 { 0x1501ae1505190180ULL
, 0x0901183f05000901ULL
, },
120 { 0x0a16022a5c011180ULL
, 0x00d8030115050101ULL
, },
121 { 0xac00020502672202ULL
, 0x016cc6ff550a0914ULL
, },
122 { 0x701300045e0c074eULL
, 0x110111030208e20aULL
, },
123 { 0x0e0116090206014eULL
, 0x230111360500380aULL
, },
124 { 0x071300132f001c4eULL
, 0x01f102011508070aULL
, },
125 { 0x7000000201183801ULL
, 0x047888d8541038a0ULL
, },
128 reset_msa_registers();
130 gettimeofday(&start
, NULL
);
132 for (i
= 0; i
< PATTERN_INPUTS_SHORT_COUNT
; i
++) {
133 for (j
= 0; j
< PATTERN_INPUTS_SHORT_COUNT
; j
++) {
134 do_msa_SRL_B(b128_pattern
[i
], b128_pattern
[j
],
135 b128_result
[PATTERN_INPUTS_SHORT_COUNT
* i
+ j
]);
139 for (i
= 0; i
< RANDOM_INPUTS_SHORT_COUNT
; i
++) {
140 for (j
= 0; j
< RANDOM_INPUTS_SHORT_COUNT
; j
++) {
141 do_msa_SRL_B(b128_random
[i
], b128_random
[j
],
142 b128_result
[((PATTERN_INPUTS_SHORT_COUNT
) *
143 (PATTERN_INPUTS_SHORT_COUNT
)) +
144 RANDOM_INPUTS_SHORT_COUNT
* i
+ j
]);
148 gettimeofday(&end
, NULL
);
150 elapsed_time
= (end
.tv_sec
- start
.tv_sec
) * 1000.0;
151 elapsed_time
+= (end
.tv_usec
- start
.tv_usec
) / 1000.0;
153 ret
= check_results_128(isa_ase_name
, group_name
, instruction_name
,
154 TEST_COUNT_TOTAL
, elapsed_time
,
155 &b128_result
[0][0], &b128_expect
[0][0]);