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 (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 = "Int Divide";
40 char *instruction_name = "DIV_S.B";
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 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
49 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
50 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
51 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
52 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
53 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
54 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
55 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
56 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
57 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
58 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
59 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
60 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
61 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
62 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
63 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
64 { 0x5656565656565656ULL, 0x5656565656565656ULL, },
65 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
66 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
67 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
68 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
69 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
70 { 0x0200ff0200ff0200ULL, 0xff0200ff0200ff02ULL, },
71 { 0xfd0001fd0001fd00ULL, 0x01fd0001fd0001fdULL, },
72 { 0xababababababababULL, 0xababababababababULL, },
73 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
74 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
75 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
76 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
77 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
78 { 0xfe0001fe0001fe00ULL, 0x01fe0001fe0001feULL, },
79 { 0x0300ff0300ff0300ULL, 0xff0300ff0300ff03ULL, },
80 { 0x3434343434343434ULL, 0x3434343434343434ULL, },
81 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
82 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
83 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
84 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
85 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
86 { 0x0100000100000100ULL, 0x0001000001000001ULL, },
87 { 0xff0000ff0000ff00ULL, 0x00ff0000ff0000ffULL, },
88 { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, },
89 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
90 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
91 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
92 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
93 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
94 { 0xff0000ff0000ff00ULL, 0x00ff0000ff0000ffULL, },
95 { 0x0100000100000100ULL, 0x0001000001000001ULL, },
96 { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, },
97 { 0x0101ff0101ff0101ULL, 0xff0101ff0101ff01ULL, },
98 { 0x0001000001000001ULL, 0x0000010000010000ULL, },
99 { 0x00ff0000ff0000ffULL, 0x0000ff0000ff0000ULL, },
100 { 0x0002ff0002ff0002ULL, 0xff0002ff0002ff00ULL, },
101 { 0x00fe0100fe0100feULL, 0x0100fe0100fe0100ULL, },
102 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
103 { 0xffff00ffff00ffffULL, 0x00ffff00ffff00ffULL, },
104 { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, },
105 { 0xffff01ffff01ffffULL, 0x01ffff01ffff01ffULL, },
106 { 0x00ff0000ff0000ffULL, 0x0000ff0000ff0000ULL, },
107 { 0x0001000001000001ULL, 0x0000010000010000ULL, },
108 { 0x00fe0100fe0100feULL, 0x0100fe0100fe0100ULL, },
109 { 0x0002ff0002ff0002ULL, 0xff0002ff0002ff00ULL, },
110 { 0x0000ff0000ff0000ULL, 0xff0000ff0000ff00ULL, },
111 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
112 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
113 { 0x18ff01000000ff08ULL, 0x04f50003000100fdULL, },
114 { 0x0101000000fe0000ULL, 0x01fe00a20002fe00ULL, },
115 { 0xff01ff000002fe00ULL, 0x00fa00fe00010200ULL, },
116 { 0x000000ff01ff0000ULL, 0x0000fa00f600ff00ULL, },
117 { 0x0101ff0101010101ULL, 0x0101010101010101ULL, },
118 { 0x000000ffff020000ULL, 0x000001e600010200ULL, },
119 { 0x0000000100fe0100ULL, 0x000000000000fe00ULL, },
120 { 0x00000301ff00fffeULL, 0x0000fb002a000001ULL, },
121 { 0x10ff0100000002f0ULL, 0x02040000fc0000fbULL, },
122 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
123 { 0x0001fdff00ff03ffULL, 0x000200000000ff00ULL, },
124 { 0x000000ff02000001ULL, 0xff00f6002b0000f8ULL, },
125 { 0xeaffff0001000009ULL, 0xfa0101fffc010018ULL, },
126 { 0xff000000ffff0000ULL, 0xfe000228010100fcULL, },
127 { 0x0101010101010101ULL, 0x0101010101010101ULL, },
128};
129
130 reset_msa_registers();
131
132 gettimeofday(&start, NULL);
133
134 for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) {
135 for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) {
136 do_msa_DIV_S_B(b128_pattern[i], b128_pattern[j],
137 b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]);
138 }
139 }
140
141 for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) {
142 for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) {
143 do_msa_DIV_S_B(b128_random[i], b128_random[j],
144 b128_result[((PATTERN_INPUTS_SHORT_COUNT) *
145 (PATTERN_INPUTS_SHORT_COUNT)) +
146 RANDOM_INPUTS_SHORT_COUNT * i + j]);
147 }
148 }
149
150 gettimeofday(&end, NULL);
151
152 elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0;
153 elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0;
154
155 ret = check_results_128(isa_ase_name, group_name, instruction_name,
156 TEST_COUNT_TOTAL, elapsed_time,
157 &b128_result[0][0], &b128_expect[0][0]);
158
159 return ret;
160}
161