2 * Test program for MIPS64R6 instruction MUH
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
= "Int Multiply";
36 char *instruction_name
= "MUH";
39 struct timeval start
, end
;
42 uint64_t b64_result
[TEST_COUNT_TOTAL
];
43 uint64_t b64_expect
[TEST_COUNT_TOTAL
] = {
44 0x0000000000000000ULL
, /* 0 */
45 0x0000000000000000ULL
,
46 0x0000000000000000ULL
,
47 0xffffffffffffffffULL
,
48 0x0000000000000000ULL
,
49 0xffffffffffffffffULL
,
50 0x0000000000000000ULL
,
51 0xffffffffffffffffULL
,
52 0x0000000000000000ULL
, /* 8 */
53 0x0000000000000000ULL
,
54 0x0000000000000000ULL
,
55 0x0000000000000000ULL
,
56 0x0000000000000000ULL
,
57 0x0000000000000000ULL
,
58 0x0000000000000000ULL
,
59 0x0000000000000000ULL
,
60 0x0000000000000000ULL
, /* 16 */
61 0x0000000000000000ULL
,
62 0x000000001c71c71cULL
,
63 0xffffffffe38e38e3ULL
,
64 0x0000000011111111ULL
,
65 0xffffffffeeeeeeeeULL
,
66 0x00000000097b425fULL
,
67 0xfffffffff684bda1ULL
,
68 0xffffffffffffffffULL
, /* 24 */
69 0x0000000000000000ULL
,
70 0xffffffffe38e38e3ULL
,
71 0x000000001c71c71cULL
,
72 0xffffffffeeeeeeeeULL
,
73 0x0000000011111110ULL
,
74 0xfffffffff684bda1ULL
,
75 0x00000000097b425eULL
,
76 0x0000000000000000ULL
, /* 32 */
77 0x0000000000000000ULL
,
78 0x0000000011111111ULL
,
79 0xffffffffeeeeeeeeULL
,
80 0x000000000a3d70a4ULL
,
81 0xfffffffff5c28f5cULL
,
82 0x0000000005b05b05ULL
,
83 0xfffffffffa4fa4faULL
,
84 0xffffffffffffffffULL
, /* 40 */
85 0x0000000000000000ULL
,
86 0xffffffffeeeeeeeeULL
,
87 0x0000000011111110ULL
,
88 0xfffffffff5c28f5cULL
,
89 0x000000000a3d70a3ULL
,
90 0xfffffffffa4fa4faULL
,
91 0x0000000005b05b05ULL
,
92 0x0000000000000000ULL
, /* 48 */
93 0x0000000000000000ULL
,
94 0x00000000097b425fULL
,
95 0xfffffffff684bda1ULL
,
96 0x0000000005b05b05ULL
,
97 0xfffffffffa4fa4faULL
,
98 0x000000000329161fULL
,
99 0xfffffffffcd6e9e0ULL
,
100 0xffffffffffffffffULL
, /* 56 */
101 0x0000000000000000ULL
,
102 0xfffffffff684bda1ULL
,
103 0x00000000097b425eULL
,
104 0xfffffffffa4fa4faULL
,
105 0x0000000005b05b05ULL
,
106 0xfffffffffcd6e9e0ULL
,
107 0x000000000329161fULL
,
108 0x0000000037dbf444ULL
, /* 64 */
109 0x0000000001fd28a7ULL
,
110 0x0000000027129043ULL
,
111 0xffffffffcb89d38bULL
,
112 0x0000000001fd28a7ULL
,
113 0x0000000000122100ULL
,
114 0x00000000016425c3ULL
,
115 0xfffffffffe21cf6eULL
,
116 0x0000000027129043ULL
, /* 72 */
117 0x00000000016425c3ULL
,
118 0x000000001b549d7fULL
,
119 0xffffffffdb4dd51cULL
,
120 0xffffffffcb89d38bULL
,
121 0xfffffffffe21cf6eULL
,
122 0xffffffffdb4dd51cULL
,
123 0x0000000031454bf2ULL
,
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_MUH(b64_pattern_se
+ i
, b64_pattern_se
+ 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_MUH(b64_random_se
+ i
, b64_random_se
+ 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
);