2 * Test program for MIPS64R6 instruction SLLV
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_mips64r6.h"
26 #include "../../../../include/test_inputs_64.h"
27 #include "../../../../include/test_utils_64.h"
29 #define TEST_COUNT_TOTAL (PATTERN_INPUTS_64_COUNT + RANDOM_INPUTS_64_COUNT)
34 char *isa_ase_name
= "mips64r6";
35 char *group_name
= "Shift";
36 char *instruction_name
= "SLLV";
39 struct timeval start
, end
;
42 uint64_t b64_result
[TEST_COUNT_TOTAL
];
43 uint64_t b64_expect
[TEST_COUNT_TOTAL
] = {
44 0xffffffff80000000ULL
, /* 0 */
45 0xffffffffffffffffULL
,
46 0xfffffffffffffc00ULL
,
47 0xffffffffffe00000ULL
,
48 0xfffffffffffff000ULL
,
49 0xfffffffffff80000ULL
,
50 0xffffffffffffc000ULL
,
51 0xfffffffffffe0000ULL
,
52 0x0000000000000000ULL
, /* 8 */
53 0x0000000000000000ULL
,
54 0x0000000000000000ULL
,
55 0x0000000000000000ULL
,
56 0x0000000000000000ULL
,
57 0x0000000000000000ULL
,
58 0x0000000000000000ULL
,
59 0x0000000000000000ULL
,
60 0x0000000000000000ULL
, /* 16 */
61 0xffffffffaaaaaaaaULL
,
62 0xffffffffaaaaa800ULL
,
63 0x0000000055400000ULL
,
64 0xffffffffaaaaa000ULL
,
65 0x0000000055500000ULL
,
66 0xffffffffaaaa8000ULL
,
67 0x0000000055540000ULL
,
68 0xffffffff80000000ULL
, /* 24 */
69 0x0000000055555555ULL
,
70 0x0000000055555400ULL
,
71 0xffffffffaaa00000ULL
,
72 0x0000000055555000ULL
,
73 0xffffffffaaa80000ULL
,
74 0x0000000055554000ULL
,
75 0xffffffffaaaa0000ULL
,
76 0x0000000000000000ULL
, /* 32 */
77 0xffffffffccccccccULL
,
78 0x0000000033333000ULL
,
79 0xffffffff99800000ULL
,
80 0xffffffffccccc000ULL
,
81 0x0000000066600000ULL
,
82 0x0000000033330000ULL
,
83 0xffffffff99980000ULL
,
84 0xffffffff80000000ULL
, /* 40 */
85 0x0000000033333333ULL
,
86 0xffffffffcccccc00ULL
,
87 0x0000000066600000ULL
,
88 0x0000000033333000ULL
,
89 0xffffffff99980000ULL
,
90 0xffffffffccccc000ULL
,
91 0x0000000066660000ULL
,
92 0x0000000000000000ULL
, /* 48 */
93 0xffffffff8e38e38eULL
,
94 0xffffffffe38e3800ULL
,
95 0x0000000071c00000ULL
,
96 0xffffffff8e38e000ULL
,
97 0x000000001c700000ULL
,
98 0x0000000038e38000ULL
,
99 0xffffffffc71c0000ULL
,
100 0xffffffff80000000ULL
, /* 56 */
101 0x0000000071c71c71ULL
,
102 0x000000001c71c400ULL
,
103 0xffffffff8e200000ULL
,
104 0x0000000071c71000ULL
,
105 0xffffffffe3880000ULL
,
106 0xffffffffc71c4000ULL
,
107 0x0000000038e20000ULL
,
108 0x0000000028625540ULL
, /* 64 */
109 0x0000000062554000ULL
,
110 0x0000000028625540ULL
,
111 0xffffffff95500000ULL
,
112 0x000000004d93c708ULL
,
113 0xffffffff93c70800ULL
,
114 0x000000004d93c708ULL
,
115 0xfffffffff1c20000ULL
,
116 0xffffffffb9cf8b80ULL
, /* 72 */
117 0xffffffffcf8b8000ULL
,
118 0xffffffffb9cf8b80ULL
,
119 0xffffffffe2e00000ULL
,
120 0x000000005e31e24eULL
,
121 0x0000000031e24e00ULL
,
122 0x000000005e31e24eULL
,
123 0x0000000078938000ULL
,
126 gettimeofday(&start
, NULL
);
128 for (i
= 0; i
< PATTERN_INPUTS_64_SHORT_COUNT
; i
++) {
129 for (j
= 0; j
< PATTERN_INPUTS_64_SHORT_COUNT
; j
++) {
130 do_mips64r6_SLLV(b64_pattern
+ i
, b64_pattern
+ j
,
131 b64_result
+ (PATTERN_INPUTS_64_SHORT_COUNT
* i
+ j
));
135 for (i
= 0; i
< RANDOM_INPUTS_64_SHORT_COUNT
; i
++) {
136 for (j
= 0; j
< RANDOM_INPUTS_64_SHORT_COUNT
; j
++) {
137 do_mips64r6_SLLV(b64_random
+ i
, b64_random
+ j
,
138 b64_result
+ (((PATTERN_INPUTS_64_SHORT_COUNT
) *
139 (PATTERN_INPUTS_64_SHORT_COUNT
)) +
140 RANDOM_INPUTS_64_SHORT_COUNT
* i
+ j
));
144 gettimeofday(&end
, NULL
);
146 elapsed_time
= (end
.tv_sec
- start
.tv_sec
) * 1000.0;
147 elapsed_time
+= (end
.tv_usec
- start
.tv_usec
) / 1000.0;
149 ret
= check_results_64(instruction_name
, TEST_COUNT_TOTAL
, elapsed_time
,
150 b64_result
, b64_expect
);