1520e210cSAleksandar Markovic /* 2520e210cSAleksandar Markovic * Test program for MSA instruction CLE_U.W 3520e210cSAleksandar Markovic * 4dd8d6a2dSAleksandar Markovic * Copyright (C) 2019 Wave Computing, Inc. 5dd8d6a2dSAleksandar Markovic * Copyright (C) 2019 Aleksandar Markovic <amarkovic@wavecomp.com> 6750541c4SAleksandar Markovic * Copyright (C) 2019 RT-RK Computer Based Systems LLC 7750541c4SAleksandar Markovic * Copyright (C) 2019 Mateja Marjanovic <mateja.marjanovic@rt-rk.com> 8520e210cSAleksandar Markovic * 9520e210cSAleksandar Markovic * This program is free software: you can redistribute it and/or modify 10520e210cSAleksandar Markovic * it under the terms of the GNU General Public License as published by 11520e210cSAleksandar Markovic * the Free Software Foundation, either version 2 of the License, or 12520e210cSAleksandar Markovic * (at your option) any later version. 13520e210cSAleksandar Markovic * 14520e210cSAleksandar Markovic * This program is distributed in the hope that it will be useful, 15520e210cSAleksandar Markovic * but WITHOUT ANY WARRANTY; without even the implied warranty of 16520e210cSAleksandar Markovic * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17520e210cSAleksandar Markovic * GNU General Public License for more details. 18520e210cSAleksandar Markovic * 19520e210cSAleksandar Markovic * You should have received a copy of the GNU General Public License 20520e210cSAleksandar Markovic * along with this program. If not, see <https://www.gnu.org/licenses/>. 21520e210cSAleksandar Markovic * 22520e210cSAleksandar Markovic */ 23520e210cSAleksandar Markovic 24520e210cSAleksandar Markovic #include <sys/time.h> 25520e210cSAleksandar Markovic #include <stdint.h> 26520e210cSAleksandar Markovic 27520e210cSAleksandar Markovic #include "../../../../include/wrappers_msa.h" 2881526dffSAleksandar Markovic #include "../../../../include/test_inputs_128.h" 2981526dffSAleksandar Markovic #include "../../../../include/test_utils_128.h" 30520e210cSAleksandar Markovic 31520e210cSAleksandar Markovic #define TEST_COUNT_TOTAL ( \ 32520e210cSAleksandar Markovic (PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT) + \ 33520e210cSAleksandar Markovic (RANDOM_INPUTS_SHORT_COUNT) * (RANDOM_INPUTS_SHORT_COUNT)) 34520e210cSAleksandar Markovic 35520e210cSAleksandar Markovic 36520e210cSAleksandar Markovic int32_t main(void) 37520e210cSAleksandar Markovic { 38*8e6fe6b8SAleksandar Markovic char *isa_ase_name = "MSA"; 39*8e6fe6b8SAleksandar Markovic char *group_name = "Int Compare"; 40520e210cSAleksandar Markovic char *instruction_name = "CLE_U.W"; 41520e210cSAleksandar Markovic int32_t ret; 42520e210cSAleksandar Markovic uint32_t i, j; 43520e210cSAleksandar Markovic struct timeval start, end; 44520e210cSAleksandar Markovic double elapsed_time; 45520e210cSAleksandar Markovic 46520e210cSAleksandar Markovic uint64_t b128_result[TEST_COUNT_TOTAL][2]; 47520e210cSAleksandar Markovic uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { 48520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ 49520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 50520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 51520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 52520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 53520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 54520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 55520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 56520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */ 57520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 58520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 59520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 60520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 61520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 62520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 63520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 64520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */ 65520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 66520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 67520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 68520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 69520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 70520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, 71520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, 72520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */ 73520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 74520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 75520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 76520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 77520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 78520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, 79520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffff00000000ULL, }, 80520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */ 81520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 82520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 83520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 84520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 85520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 86520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, 87520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 88520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */ 89520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 90520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 91520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 92520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 93520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 94520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 95520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffff00000000ULL, }, 96520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */ 97520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 98520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffff00000000ULL, }, 99520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, 100520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffff00000000ULL, }, 101520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 102520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 103520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, 104520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */ 105520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 106520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, 107520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, 108520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 109520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, 110520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, 111520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 112520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 64 */ 113520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, 114520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0x0000000000000000ULL, }, 115520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffff00000000ULL, }, 116520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, 117520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 118520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffffffffffffULL, }, 119520e210cSAleksandar Markovic { 0x00000000ffffffffULL, 0xffffffffffffffffULL, }, 120520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0xffffffffffffffffULL, }, /* 72 */ 121520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x0000000000000000ULL, }, 122520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 123520e210cSAleksandar Markovic { 0x0000000000000000ULL, 0xffffffff00000000ULL, }, 124520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x00000000ffffffffULL, }, 125520e210cSAleksandar Markovic { 0xffffffff00000000ULL, 0x0000000000000000ULL, }, 126520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0x00000000ffffffffULL, }, 127520e210cSAleksandar Markovic { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, 128520e210cSAleksandar Markovic }; 129520e210cSAleksandar Markovic 130ca693d1cSAleksandar Markovic reset_msa_registers(); 131ca693d1cSAleksandar Markovic 132520e210cSAleksandar Markovic gettimeofday(&start, NULL); 133520e210cSAleksandar Markovic 134520e210cSAleksandar Markovic for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { 135520e210cSAleksandar Markovic for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { 136520e210cSAleksandar Markovic do_msa_CLE_U_W(b128_pattern[i], b128_pattern[j], 137520e210cSAleksandar Markovic b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); 138520e210cSAleksandar Markovic } 139520e210cSAleksandar Markovic } 140520e210cSAleksandar Markovic 141520e210cSAleksandar Markovic for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { 142520e210cSAleksandar Markovic for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { 143520e210cSAleksandar Markovic do_msa_CLE_U_W(b128_random[i], b128_random[j], 144520e210cSAleksandar Markovic b128_result[((PATTERN_INPUTS_SHORT_COUNT) * 145520e210cSAleksandar Markovic (PATTERN_INPUTS_SHORT_COUNT)) + 146520e210cSAleksandar Markovic RANDOM_INPUTS_SHORT_COUNT * i + j]); 147520e210cSAleksandar Markovic } 148520e210cSAleksandar Markovic } 149520e210cSAleksandar Markovic 150520e210cSAleksandar Markovic gettimeofday(&end, NULL); 151520e210cSAleksandar Markovic 152520e210cSAleksandar Markovic elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; 153520e210cSAleksandar Markovic elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; 154520e210cSAleksandar Markovic 155*8e6fe6b8SAleksandar Markovic ret = check_results_128(isa_ase_name, group_name, instruction_name, 156*8e6fe6b8SAleksandar Markovic TEST_COUNT_TOTAL, elapsed_time, 157520e210cSAleksandar Markovic &b128_result[0][0], &b128_expect[0][0]); 158520e210cSAleksandar Markovic 159520e210cSAleksandar Markovic return ret; 160520e210cSAleksandar Markovic } 161