2 * Test program for MSA instruction BCLR.B
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_msa.h"
26 #include "../../../../include/test_inputs_128.h"
27 #include "../../../../include/test_utils_128.h"
29 #define TEST_COUNT_TOTAL ( \
30 (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \
31 (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT))
36 char *isa_ase_name
= "MSA";
37 char *group_name
= "Bit Set";
38 char *instruction_name
= "BCLR.B";
41 struct timeval start
, end
;
44 uint64_t b128_result
[TEST_COUNT_TOTAL
][2];
45 uint64_t b128_expect
[TEST_COUNT_TOTAL
][2] = {
46 { 0x7f7f7f7f7f7f7f7fULL
, 0x7f7f7f7f7f7f7f7fULL
, }, /* 0 */
47 { 0xfefefefefefefefeULL
, 0xfefefefefefefefeULL
, },
48 { 0xfbfbfbfbfbfbfbfbULL
, 0xfbfbfbfbfbfbfbfbULL
, },
49 { 0xdfdfdfdfdfdfdfdfULL
, 0xdfdfdfdfdfdfdfdfULL
, },
50 { 0xefefefefefefefefULL
, 0xefefefefefefefefULL
, },
51 { 0xf7f7f7f7f7f7f7f7ULL
, 0xf7f7f7f7f7f7f7f7ULL
, },
52 { 0xf7bffef7bffef7bfULL
, 0xfef7bffef7bffef7ULL
, },
53 { 0xeffd7feffd7feffdULL
, 0x7feffd7feffd7fefULL
, },
54 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, }, /* 8 */
55 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
56 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
57 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
58 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
59 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
60 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
61 { 0x0000000000000000ULL
, 0x0000000000000000ULL
, },
62 { 0x2a2a2a2a2a2a2a2aULL
, 0x2a2a2a2a2a2a2a2aULL
, }, /* 16 */
63 { 0xaaaaaaaaaaaaaaaaULL
, 0xaaaaaaaaaaaaaaaaULL
, },
64 { 0xaaaaaaaaaaaaaaaaULL
, 0xaaaaaaaaaaaaaaaaULL
, },
65 { 0x8a8a8a8a8a8a8a8aULL
, 0x8a8a8a8a8a8a8a8aULL
, },
66 { 0xaaaaaaaaaaaaaaaaULL
, 0xaaaaaaaaaaaaaaaaULL
, },
67 { 0xa2a2a2a2a2a2a2a2ULL
, 0xa2a2a2a2a2a2a2a2ULL
, },
68 { 0xa2aaaaa2aaaaa2aaULL
, 0xaaa2aaaaa2aaaaa2ULL
, },
69 { 0xaaa82aaaa82aaaa8ULL
, 0x2aaaa82aaaa82aaaULL
, },
70 { 0x5555555555555555ULL
, 0x5555555555555555ULL
, }, /* 24 */
71 { 0x5454545454545454ULL
, 0x5454545454545454ULL
, },
72 { 0x5151515151515151ULL
, 0x5151515151515151ULL
, },
73 { 0x5555555555555555ULL
, 0x5555555555555555ULL
, },
74 { 0x4545454545454545ULL
, 0x4545454545454545ULL
, },
75 { 0x5555555555555555ULL
, 0x5555555555555555ULL
, },
76 { 0x5515545515545515ULL
, 0x5455155455155455ULL
, },
77 { 0x4555554555554555ULL
, 0x5545555545555545ULL
, },
78 { 0x4c4c4c4c4c4c4c4cULL
, 0x4c4c4c4c4c4c4c4cULL
, }, /* 32 */
79 { 0xccccccccccccccccULL
, 0xccccccccccccccccULL
, },
80 { 0xc8c8c8c8c8c8c8c8ULL
, 0xc8c8c8c8c8c8c8c8ULL
, },
81 { 0xccccccccccccccccULL
, 0xccccccccccccccccULL
, },
82 { 0xccccccccccccccccULL
, 0xccccccccccccccccULL
, },
83 { 0xc4c4c4c4c4c4c4c4ULL
, 0xc4c4c4c4c4c4c4c4ULL
, },
84 { 0xc48cccc48cccc48cULL
, 0xccc48cccc48cccc4ULL
, },
85 { 0xcccc4ccccc4cccccULL
, 0x4ccccc4ccccc4cccULL
, },
86 { 0x3333333333333333ULL
, 0x3333333333333333ULL
, }, /* 40 */
87 { 0x3232323232323232ULL
, 0x3232323232323232ULL
, },
88 { 0x3333333333333333ULL
, 0x3333333333333333ULL
, },
89 { 0x1313131313131313ULL
, 0x1313131313131313ULL
, },
90 { 0x2323232323232323ULL
, 0x2323232323232323ULL
, },
91 { 0x3333333333333333ULL
, 0x3333333333333333ULL
, },
92 { 0x3333323333323333ULL
, 0x3233333233333233ULL
, },
93 { 0x2331332331332331ULL
, 0x3323313323313323ULL
, },
94 { 0x630e38630e38630eULL
, 0x38630e38630e3863ULL
, }, /* 48 */
95 { 0xe28e38e28e38e28eULL
, 0x38e28e38e28e38e2ULL
, },
96 { 0xe38a38e38a38e38aULL
, 0x38e38a38e38a38e3ULL
, },
97 { 0xc38e18c38e18c38eULL
, 0x18c38e18c38e18c3ULL
, },
98 { 0xe38e28e38e28e38eULL
, 0x28e38e28e38e28e3ULL
, },
99 { 0xe38630e38630e386ULL
, 0x30e38630e38630e3ULL
, },
100 { 0xe38e38e38e38e38eULL
, 0x38e38e38e38e38e3ULL
, },
101 { 0xe38c38e38c38e38cULL
, 0x38e38c38e38c38e3ULL
, },
102 { 0x1c71471c71471c71ULL
, 0x471c71471c71471cULL
, }, /* 56 */
103 { 0x1c70c61c70c61c70ULL
, 0xc61c70c61c70c61cULL
, },
104 { 0x1871c31871c31871ULL
, 0xc31871c31871c318ULL
, },
105 { 0x1c51c71c51c71c51ULL
, 0xc71c51c71c51c71cULL
, },
106 { 0x0c61c70c61c70c61ULL
, 0xc70c61c70c61c70cULL
, },
107 { 0x1471c71471c71471ULL
, 0xc71471c71471c714ULL
, },
108 { 0x1431c61431c61431ULL
, 0xc61431c61431c614ULL
, },
109 { 0x0c71470c71470c71ULL
, 0x470c71470c71470cULL
, },
110 { 0x886aa6cc28625540ULL
, 0x4367031ebe73b00cULL
, }, /* 64 */
111 { 0x802ae6c408625540ULL
, 0x4b67035ade7bb00cULL
, },
112 { 0x886aa6c828625540ULL
, 0x4b660b5ef673900cULL
, },
113 { 0x886aa6cc28605100ULL
, 0x4b650a5efc7bb00cULL
, },
114 { 0xfaba00634c93c708ULL
, 0x1277b31a153752ecULL
, },
115 { 0xf3be00634d934708ULL
, 0x1277b31a153f52ecULL
, },
116 { 0xebba00634d13c708ULL
, 0x12f6bb1a153752ecULL
, },
117 { 0xfa3e00430d91c308ULL
, 0x12f5ba1a153b52fcULL
, },
118 { 0xac5aaeaab8cb8b80ULL
, 0x2758c6bfab232404ULL
, }, /* 72 */
119 { 0xa41aaea299c70b80ULL
, 0x2358c6fb8b2b2104ULL
, },
120 { 0xac5aaeaab94f8380ULL
, 0x27d8867fa3230504ULL
, },
121 { 0xac5aae8ab9cd8b80ULL
, 0x07d8c6fea92b2114ULL
, },
122 { 0x704b164d5e31c24eULL
, 0x85718098a942e2a0ULL
, },
123 { 0x700f16455e31624eULL
, 0x897180d88942e2a0ULL
, },
124 { 0x604b16495c31e24eULL
, 0x0df08858a142c2a0ULL
, },
125 { 0x704f164d1e31e20eULL
, 0x8df188d8a942e2a0ULL
, },
128 reset_msa_registers();
130 gettimeofday(&start
, NULL
);
132 for (i
= 0; i
< PATTERN_INPUTS_SHORT_COUNT
; i
++) {
133 for (j
= 0; j
< PATTERN_INPUTS_SHORT_COUNT
; j
++) {
134 do_msa_BCLR_B(b128_pattern
[i
], b128_pattern
[j
],
135 b128_result
[PATTERN_INPUTS_SHORT_COUNT
* i
+ j
]);
139 for (i
= 0; i
< RANDOM_INPUTS_SHORT_COUNT
; i
++) {
140 for (j
= 0; j
< RANDOM_INPUTS_SHORT_COUNT
; j
++) {
141 do_msa_BCLR_B(b128_random
[i
], b128_random
[j
],
142 b128_result
[((PATTERN_INPUTS_SHORT_COUNT
) *
143 (PATTERN_INPUTS_SHORT_COUNT
)) +
144 RANDOM_INPUTS_SHORT_COUNT
* i
+ j
]);
148 gettimeofday(&end
, NULL
);
150 elapsed_time
= (end
.tv_sec
- start
.tv_sec
) * 1000.0;
151 elapsed_time
+= (end
.tv_usec
- start
.tv_usec
) / 1000.0;
153 ret
= check_results_128(isa_ase_name
, group_name
, instruction_name
,
154 TEST_COUNT_TOTAL
, elapsed_time
,
155 &b128_result
[0][0], &b128_expect
[0][0]);