test_msa_bneg_b.c (7529B)
1/* 2 * Test program for MSA instruction BNEG.B 3 * 4 * Copyright (C) 2019 Wave Computing, Inc. 5 * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> 6 * 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. 11 * 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. 16 * 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/>. 19 * 20 */ 21 22#include <sys/time.h> 23#include <stdint.h> 24 25#include "../../../../include/wrappers_msa.h" 26#include "../../../../include/test_inputs_128.h" 27#include "../../../../include/test_utils_128.h" 28 29#define TEST_COUNT_TOTAL ( \ 30 (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ 31 (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) 32 33 34int32_t main(void) 35{ 36 char *isa_ase_name = "MSA"; 37 char *group_name = "Bit Set"; 38 char *instruction_name = "BNEG.B"; 39 int32_t ret; 40 uint32_t i, j; 41 struct timeval start, end; 42 double elapsed_time; 43 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 { 0x8080808080808080ULL, 0x8080808080808080ULL, }, /* 8 */ 55 { 0x0101010101010101ULL, 0x0101010101010101ULL, }, 56 { 0x0404040404040404ULL, 0x0404040404040404ULL, }, 57 { 0x2020202020202020ULL, 0x2020202020202020ULL, }, 58 { 0x1010101010101010ULL, 0x1010101010101010ULL, }, 59 { 0x0808080808080808ULL, 0x0808080808080808ULL, }, 60 { 0x0840010840010840ULL, 0x0108400108400108ULL, }, 61 { 0x1002801002801002ULL, 0x8010028010028010ULL, }, 62 { 0x2a2a2a2a2a2a2a2aULL, 0x2a2a2a2a2a2a2a2aULL, }, /* 16 */ 63 { 0xababababababababULL, 0xababababababababULL, }, 64 { 0xaeaeaeaeaeaeaeaeULL, 0xaeaeaeaeaeaeaeaeULL, }, 65 { 0x8a8a8a8a8a8a8a8aULL, 0x8a8a8a8a8a8a8a8aULL, }, 66 { 0xbabababababababaULL, 0xbabababababababaULL, }, 67 { 0xa2a2a2a2a2a2a2a2ULL, 0xa2a2a2a2a2a2a2a2ULL, }, 68 { 0xa2eaaba2eaaba2eaULL, 0xaba2eaaba2eaaba2ULL, }, 69 { 0xbaa82abaa82abaa8ULL, 0x2abaa82abaa82abaULL, }, 70 { 0xd5d5d5d5d5d5d5d5ULL, 0xd5d5d5d5d5d5d5d5ULL, }, /* 24 */ 71 { 0x5454545454545454ULL, 0x5454545454545454ULL, }, 72 { 0x5151515151515151ULL, 0x5151515151515151ULL, }, 73 { 0x7575757575757575ULL, 0x7575757575757575ULL, }, 74 { 0x4545454545454545ULL, 0x4545454545454545ULL, }, 75 { 0x5d5d5d5d5d5d5d5dULL, 0x5d5d5d5d5d5d5d5dULL, }, 76 { 0x5d15545d15545d15ULL, 0x545d15545d15545dULL, }, 77 { 0x4557d54557d54557ULL, 0xd54557d54557d545ULL, }, 78 { 0x4c4c4c4c4c4c4c4cULL, 0x4c4c4c4c4c4c4c4cULL, }, /* 32 */ 79 { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, 80 { 0xc8c8c8c8c8c8c8c8ULL, 0xc8c8c8c8c8c8c8c8ULL, }, 81 { 0xececececececececULL, 0xececececececececULL, }, 82 { 0xdcdcdcdcdcdcdcdcULL, 0xdcdcdcdcdcdcdcdcULL, }, 83 { 0xc4c4c4c4c4c4c4c4ULL, 0xc4c4c4c4c4c4c4c4ULL, }, 84 { 0xc48ccdc48ccdc48cULL, 0xcdc48ccdc48ccdc4ULL, }, 85 { 0xdcce4cdcce4cdcceULL, 0x4cdcce4cdcce4cdcULL, }, 86 { 0xb3b3b3b3b3b3b3b3ULL, 0xb3b3b3b3b3b3b3b3ULL, }, /* 40 */ 87 { 0x3232323232323232ULL, 0x3232323232323232ULL, }, 88 { 0x3737373737373737ULL, 0x3737373737373737ULL, }, 89 { 0x1313131313131313ULL, 0x1313131313131313ULL, }, 90 { 0x2323232323232323ULL, 0x2323232323232323ULL, }, 91 { 0x3b3b3b3b3b3b3b3bULL, 0x3b3b3b3b3b3b3b3bULL, }, 92 { 0x3b73323b73323b73ULL, 0x323b73323b73323bULL, }, 93 { 0x2331b32331b32331ULL, 0xb32331b32331b323ULL, }, 94 { 0x630eb8630eb8630eULL, 0xb8630eb8630eb863ULL, }, /* 48 */ 95 { 0xe28f39e28f39e28fULL, 0x39e28f39e28f39e2ULL, }, 96 { 0xe78a3ce78a3ce78aULL, 0x3ce78a3ce78a3ce7ULL, }, 97 { 0xc3ae18c3ae18c3aeULL, 0x18c3ae18c3ae18c3ULL, }, 98 { 0xf39e28f39e28f39eULL, 0x28f39e28f39e28f3ULL, }, 99 { 0xeb8630eb8630eb86ULL, 0x30eb8630eb8630ebULL, }, 100 { 0xebce39ebce39ebceULL, 0x39ebce39ebce39ebULL, }, 101 { 0xf38cb8f38cb8f38cULL, 0xb8f38cb8f38cb8f3ULL, }, 102 { 0x9cf1479cf1479cf1ULL, 0x479cf1479cf1479cULL, }, /* 56 */ 103 { 0x1d70c61d70c61d70ULL, 0xc61d70c61d70c61dULL, }, 104 { 0x1875c31875c31875ULL, 0xc31875c31875c318ULL, }, 105 { 0x3c51e73c51e73c51ULL, 0xe73c51e73c51e73cULL, }, 106 { 0x0c61d70c61d70c61ULL, 0xd70c61d70c61d70cULL, }, 107 { 0x1479cf1479cf1479ULL, 0xcf1479cf1479cf14ULL, }, 108 { 0x1431c61431c61431ULL, 0xc61431c61431c614ULL, }, 109 { 0x0c73470c73470c73ULL, 0x470c73470c73470cULL, }, 110 { 0x896ea6dc29667541ULL, 0x43e7031ebe73b11cULL, }, /* 64 */ 111 { 0x802ae7c4086ad541ULL, 0x4fe7035adefbb41cULL, }, 112 { 0x986ea6c82ae25d41ULL, 0xcb664bdef673901cULL, }, 113 { 0x89eaa6ec68605100ULL, 0x6b650a5ffc7fb40dULL, }, 114 { 0xfaba40734c97e709ULL, 0x1a77b35a553753ecULL, }, 115 { 0xf3fe016b6d9b4709ULL, 0x1677b31e35bf56ecULL, }, 116 { 0xebba40674f13cf09ULL, 0x92f6fb9a1d3772ecULL, }, 117 { 0xfa3e40430d91c348ULL, 0x32f5ba1b173b56fdULL, }, 118 { 0xad5eeebab8cbab81ULL, 0x2f58cebfeb232404ULL, }, /* 72 */ 119 { 0xa41aafa299c70b81ULL, 0x2358cefb8bab2104ULL, }, 120 { 0xbc5eeeaebb4f8381ULL, 0xa7d9867fa3230504ULL, }, 121 { 0xaddaee8af9cd8fc0ULL, 0x07dac7fea92f2115ULL, }, 122 { 0x714b565d5f35c24fULL, 0x85718098e94ae3b0ULL, }, 123 { 0x780f17457e39624fULL, 0x897180dc89c2e6b0ULL, }, 124 { 0x604b56495cb1ea4fULL, 0x0df0c858a14ac2b0ULL, }, 125 { 0x71cf566d1e33e60eULL, 0xadf389d9ab46e6a1ULL, }, 126 }; 127 128 reset_msa_registers(); 129 130 gettimeofday(&start, NULL); 131 132 for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { 133 for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { 134 do_msa_BNEG_B(b128_pattern[i], b128_pattern[j], 135 b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); 136 } 137 } 138 139 for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { 140 for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { 141 do_msa_BNEG_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]); 145 } 146 } 147 148 gettimeofday(&end, NULL); 149 150 elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; 151 elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; 152 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]); 156 157 return ret; 158}