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 = "Fixed Multiply";
40 char *instruction_name = "MULR_Q.H";
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 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
50 { 0x0001000100010001ULL, 0x0001000100010001ULL, },
51 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
52 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
53 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
54 { 0x0000000000010000ULL, 0x0000000100000000ULL, },
55 { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, },
56 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
57 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
58 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
59 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
60 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
61 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
62 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
63 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
64 { 0x0001000100010001ULL, 0x0001000100010001ULL, },
65 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
66 { 0x38e438e438e438e4ULL, 0x38e438e438e438e4ULL, },
67 { 0xc71cc71cc71cc71cULL, 0xc71cc71cc71cc71cULL, },
68 { 0x2223222322232223ULL, 0x2223222322232223ULL, },
69 { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, },
70 { 0x12f7da134bdb12f7ULL, 0xda134bdb12f7da13ULL, },
71 { 0xed0a25eeb425ed0aULL, 0x25eeb425ed0a25eeULL, },
72 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, },
73 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
74 { 0xc71cc71cc71cc71cULL, 0xc71cc71cc71cc71cULL, },
75 { 0x38e338e338e338e3ULL, 0x38e338e338e338e3ULL, },
76 { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
77 { 0x2222222222222222ULL, 0x2222222222222222ULL, },
78 { 0xed0925edb426ed09ULL, 0x25edb426ed0925edULL, },
79 { 0x12f6da134bda12f6ULL, 0xda134bda12f6da13ULL, },
80 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
81 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
82 { 0x2223222322232223ULL, 0x2223222322232223ULL, },
83 { 0xddddddddddddddddULL, 0xddddddddddddddddULL, },
84 { 0x147c147c147c147cULL, 0x147c147c147c147cULL, },
85 { 0xeb85eb85eb85eb85ULL, 0xeb85eb85eb85eb85ULL, },
86 { 0x0b61e93e2d840b61ULL, 0xe93e2d840b61e93eULL, },
87 { 0xf49f16c2d27cf49fULL, 0x16c2d27cf49f16c2ULL, },
88 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
89 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
90 { 0xdddedddedddedddeULL, 0xdddedddedddedddeULL, },
91 { 0x2222222222222222ULL, 0x2222222222222222ULL, },
92 { 0xeb85eb85eb85eb85ULL, 0xeb85eb85eb85eb85ULL, },
93 { 0x147b147b147b147bULL, 0x147b147b147b147bULL, },
94 { 0xf49f16c1d27df49fULL, 0x16c1d27df49f16c1ULL, },
95 { 0x0b60e93e2d830b60ULL, 0xe93e2d830b60e93eULL, },
96 { 0x0000000000010000ULL, 0x0000000100000000ULL, },
97 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
98 { 0x12f7da134bdb12f7ULL, 0xda134bdb12f7da13ULL, },
99 { 0xed0925edb426ed09ULL, 0x25edb426ed0925edULL, },
100 { 0x0b61e93e2d840b61ULL, 0xe93e2d840b61e93eULL, },
101 { 0xf49f16c1d27df49fULL, 0x16c1d27df49f16c1ULL, },
102 { 0x0652194865240652ULL, 0x1948652406521948ULL, },
103 { 0xf9aee6b79addf9aeULL, 0xe6b79addf9aee6b7ULL, },
104 { 0x00000000ffff0000ULL, 0x0000ffff00000000ULL, },
105 { 0x0000000000000000ULL, 0x0000000000000000ULL, },
106 { 0xed0a25eeb425ed0aULL, 0x25eeb425ed0a25eeULL, },
107 { 0x12f6da134bda12f6ULL, 0xda134bda12f6da13ULL, },
108 { 0xf49f16c2d27cf49fULL, 0x16c2d27cf49f16c2ULL, },
109 { 0x0b60e93e2d830b60ULL, 0xe93e2d830b60e93eULL, },
110 { 0xf9aee6b79addf9aeULL, 0xe6b79addf9aee6b7ULL, },
111 { 0x0652194965230652ULL, 0x1949652306521949ULL, },
112 { 0x6fba04f60cbe38c7ULL, 0x2c6b0102000531f1ULL, },
113 { 0x03faffed1879da0fULL, 0x0b2cf9e2ffbfcc2aULL, },
114 { 0x4e261004e9dbb269ULL, 0x1779faf00102e8d7ULL, },
115 { 0x9713fb9c1db7ec39ULL, 0xbccff56b01081259ULL, },
116 { 0x03faffed1879da0fULL, 0x0b2cf9e2ffbfcc2aULL, },
117 { 0x002400002f04195bULL, 0x02cf2516038735cdULL, },
118 { 0x02c8ffc1d57633daULL, 0x05e71eaff1eb180aULL, },
119 { 0xfc44001139160d37ULL, 0xef1a4023f19aecf5ULL, },
120 { 0x4e261004e9dbb269ULL, 0x1779faf00102e8d7ULL, },
121 { 0x02c8ffc1d57633daULL, 0x05e71eaff1eb180aULL, },
122 { 0x36aa33af267e6a09ULL, 0x0c67196338390abeULL, },
123 { 0xb69bf1d4cc591b07ULL, 0xdc7f3511397df77eULL, },
124 { 0x9713fb9c1db7ec39ULL, 0xbccff56b01081259ULL, },
125 { 0xfc44001139160d37ULL, 0xef1a4023f19aecf5ULL, },
126 { 0xb69bf1d4cc591b07ULL, 0xdc7f3511397df77eULL, },
127 { 0x628a03e3455006e4ULL, 0x65a36eec3ac806beULL, },
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_MULR_Q_H(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_MULR_Q_H(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