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 Subtract";
40 char *instruction_name = "HSUB_S.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 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
50 { 0x0000555500005555ULL, 0x0000555500005555ULL, },
51 { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
52 { 0x0000333300003333ULL, 0x0000333300003333ULL, },
53 { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
54 { 0xffffc71c00001c71ULL, 0x000071c7ffffc71cULL, },
55 { 0x000038e3ffffe38eULL, 0xffff8e38000038e3ULL, },
56 { 0x0000000100000001ULL, 0x0000000100000001ULL, },
57 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
58 { 0x0000555600005556ULL, 0x0000555600005556ULL, },
59 { 0xffffaaabffffaaabULL, 0xffffaaabffffaaabULL, },
60 { 0x0000333400003334ULL, 0x0000333400003334ULL, },
61 { 0xffffcccdffffcccdULL, 0xffffcccdffffcccdULL, },
62 { 0xffffc71d00001c72ULL, 0x000071c8ffffc71dULL, },
63 { 0x000038e4ffffe38fULL, 0xffff8e39000038e4ULL, },
64 { 0xffffaaabffffaaabULL, 0xffffaaabffffaaabULL, },
65 { 0xffffaaaaffffaaaaULL, 0xffffaaaaffffaaaaULL, },
66 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
67 { 0xffff5555ffff5555ULL, 0xffff5555ffff5555ULL, },
68 { 0xffffdddeffffdddeULL, 0xffffdddeffffdddeULL, },
69 { 0xffff7777ffff7777ULL, 0xffff7777ffff7777ULL, },
70 { 0xffff71c7ffffc71cULL, 0x00001c72ffff71c7ULL, },
71 { 0xffffe38effff8e39ULL, 0xffff38e3ffffe38eULL, },
72 { 0x0000555600005556ULL, 0x0000555600005556ULL, },
73 { 0x0000555500005555ULL, 0x0000555500005555ULL, },
74 { 0x0000aaab0000aaabULL, 0x0000aaab0000aaabULL, },
75 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
76 { 0x0000888900008889ULL, 0x0000888900008889ULL, },
77 { 0x0000222200002222ULL, 0x0000222200002222ULL, },
78 { 0x00001c72000071c7ULL, 0x0000c71d00001c72ULL, },
79 { 0x00008e39000038e4ULL, 0xffffe38e00008e39ULL, },
80 { 0xffffcccdffffcccdULL, 0xffffcccdffffcccdULL, },
81 { 0xffffccccffffccccULL, 0xffffccccffffccccULL, },
82 { 0x0000222200002222ULL, 0x0000222200002222ULL, },
83 { 0xffff7777ffff7777ULL, 0xffff7777ffff7777ULL, },
84 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
85 { 0xffff9999ffff9999ULL, 0xffff9999ffff9999ULL, },
86 { 0xffff93e9ffffe93eULL, 0x00003e94ffff93e9ULL, },
87 { 0x000005b0ffffb05bULL, 0xffff5b05000005b0ULL, },
88 { 0x0000333400003334ULL, 0x0000333400003334ULL, },
89 { 0x0000333300003333ULL, 0x0000333300003333ULL, },
90 { 0x0000888900008889ULL, 0x0000888900008889ULL, },
91 { 0xffffdddeffffdddeULL, 0xffffdddeffffdddeULL, },
92 { 0x0000666700006667ULL, 0x0000666700006667ULL, },
93 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
94 { 0xfffffa5000004fa5ULL, 0x0000a4fbfffffa50ULL, },
95 { 0x00006c17000016c2ULL, 0xffffc16c00006c17ULL, },
96 { 0xffffe38fffff8e39ULL, 0x000038e4ffffe38fULL, },
97 { 0xffffe38effff8e38ULL, 0x000038e3ffffe38eULL, },
98 { 0x000038e4ffffe38eULL, 0x00008e39000038e4ULL, },
99 { 0xffff8e39ffff38e3ULL, 0xffffe38effff8e39ULL, },
100 { 0x000016c2ffffc16cULL, 0x00006c17000016c2ULL, },
101 { 0xffffb05bffff5b05ULL, 0x000005b0ffffb05bULL, },
102 { 0xffffaaabffffaaaaULL, 0x0000aaabffffaaabULL, },
103 { 0x00001c72ffff71c7ULL, 0xffffc71c00001c72ULL, },
104 { 0x00001c72000071c8ULL, 0xffffc71d00001c72ULL, },
105 { 0x00001c71000071c7ULL, 0xffffc71c00001c71ULL, },
106 { 0x000071c70000c71dULL, 0x00001c72000071c7ULL, },
107 { 0xffffc71c00001c72ULL, 0xffff71c7ffffc71cULL, },
108 { 0x00004fa50000a4fbULL, 0xfffffa5000004fa5ULL, },
109 { 0xffffe93e00003e94ULL, 0xffff93e9ffffe93eULL, },
110 { 0xffffe38e00008e39ULL, 0x000038e4ffffe38eULL, },
111 { 0x0000555500005556ULL, 0xffff555500005555ULL, },
112 { 0xffffa19effffd322ULL, 0x0000400900004e6fULL, },
113 { 0xffff88070000615aULL, 0x0000904dffffab7fULL, },
114 { 0xffffd9c000009ce2ULL, 0x00008468ffffd967ULL, },
115 { 0xffff721d00004614ULL, 0x0000c28f00001bdbULL, },
116 { 0x000014f2fffff853ULL, 0x0000079900006533ULL, },
117 { 0xfffffb5b0000868bULL, 0x000057ddffffc243ULL, },
118 { 0x00004d140000c213ULL, 0x00004bf8fffff02bULL, },
119 { 0xffffe57100006b45ULL, 0x00008a1f0000329fULL, },
120 { 0xffffc58effff648fULL, 0x00001c7afffffb1fULL, },
121 { 0xffffabf7fffff2c7ULL, 0x00006cbeffff582fULL, },
122 { 0xfffffdb000002e4fULL, 0x000060d9ffff8617ULL, },
123 { 0xffff960dffffd781ULL, 0x00009f00ffffc88bULL, },
124 { 0x00008983000008f1ULL, 0xffff8293fffff936ULL, },
125 { 0x00006fec00009729ULL, 0xffffd2d7ffff5646ULL, },
126 { 0x0000c1a50000d2b1ULL, 0xffffc6f2ffff842eULL, },
127 { 0x00005a0200007be3ULL, 0x00000519ffffc6a2ULL, },
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_HSUB_S_W(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_HSUB_S_W(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