test_msa_move_v.c (6987B)
1/* 2 * Test program for MSA instruction MOVE.V 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 (PATTERN_INPUTS_COUNT + RANDOM_INPUTS_COUNT) 30 31 32int32_t main(void) 33{ 34 char *isa_ase_name = "MSA"; 35 char *group_name = "Move"; 36 char *instruction_name = "MOVE.V"; 37 int32_t ret; 38 uint32_t i; 39 struct timeval start, end; 40 double elapsed_time; 41 42 uint64_t b128_result[TEST_COUNT_TOTAL][2]; 43 uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { 44 { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ 45 { 0x0000000000000000ULL, 0x0000000000000000ULL, }, 46 { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, 47 { 0x5555555555555555ULL, 0x5555555555555555ULL, }, 48 { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, 49 { 0x3333333333333333ULL, 0x3333333333333333ULL, }, 50 { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, 51 { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, 52 { 0xf0f0f0f0f0f0f0f0ULL, 0xf0f0f0f0f0f0f0f0ULL, }, /* 8 */ 53 { 0x0f0f0f0f0f0f0f0fULL, 0x0f0f0f0f0f0f0f0fULL, }, 54 { 0xf83e0f83e0f83e0fULL, 0x83e0f83e0f83e0f8ULL, }, 55 { 0x07c1f07c1f07c1f0ULL, 0x7c1f07c1f07c1f07ULL, }, 56 { 0xfc0fc0fc0fc0fc0fULL, 0xc0fc0fc0fc0fc0fcULL, }, 57 { 0x03f03f03f03f03f0ULL, 0x3f03f03f03f03f03ULL, }, 58 { 0xfe03f80fe03f80feULL, 0x03f80fe03f80fe03ULL, }, 59 { 0x01fc07f01fc07f01ULL, 0xfc07f01fc07f01fcULL, }, 60 { 0xff00ff00ff00ff00ULL, 0xff00ff00ff00ff00ULL, }, /* 16 */ 61 { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, }, 62 { 0xff803fe00ff803feULL, 0x00ff803fe00ff803ULL, }, 63 { 0x007fc01ff007fc01ULL, 0xff007fc01ff007fcULL, }, 64 { 0xffc00ffc00ffc00fULL, 0xfc00ffc00ffc00ffULL, }, 65 { 0x003ff003ff003ff0ULL, 0x03ff003ff003ff00ULL, }, 66 { 0xffe003ff800ffe00ULL, 0x3ff800ffe003ff80ULL, }, 67 { 0x001ffc007ff001ffULL, 0xc007ff001ffc007fULL, }, 68 { 0xfff000fff000fff0ULL, 0x00fff000fff000ffULL, }, /* 24 */ 69 { 0x000fff000fff000fULL, 0xff000fff000fff00ULL, }, 70 { 0xfff8003ffe000fffULL, 0x8003ffe000fff800ULL, }, 71 { 0x0007ffc001fff000ULL, 0x7ffc001fff0007ffULL, }, 72 { 0xfffc000fffc000ffULL, 0xfc000fffc000fffcULL, }, 73 { 0x0003fff0003fff00ULL, 0x03fff0003fff0003ULL, }, 74 { 0xfffe0003fff8000fULL, 0xffe0003fff8000ffULL, }, 75 { 0x0001fffc0007fff0ULL, 0x001fffc0007fff00ULL, }, 76 { 0xffff0000ffff0000ULL, 0xffff0000ffff0000ULL, }, /* 32 */ 77 { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, }, 78 { 0xffff80003fffe000ULL, 0x0ffff80003fffe00ULL, }, 79 { 0x00007fffc0001fffULL, 0xf00007fffc0001ffULL, }, 80 { 0xffffc0000ffffc00ULL, 0x00ffffc0000ffffcULL, }, 81 { 0x00003ffff00003ffULL, 0xff00003ffff00003ULL, }, 82 { 0xffffe00003ffff80ULL, 0x000ffffe00003fffULL, }, 83 { 0x00001ffffc00007fULL, 0xfff00001ffffc000ULL, }, 84 { 0xfffff00000fffff0ULL, 0x0000fffff00000ffULL, }, /* 40 */ 85 { 0x00000fffff00000fULL, 0xffff00000fffff00ULL, }, 86 { 0xfffff800003ffffeULL, 0x00000fffff800003ULL, }, 87 { 0x000007ffffc00001ULL, 0xfffff000007ffffcULL, }, 88 { 0xfffffc00000fffffULL, 0xc00000fffffc0000ULL, }, 89 { 0x000003fffff00000ULL, 0x3fffff000003ffffULL, }, 90 { 0xfffffe000003ffffULL, 0xf800000fffffe000ULL, }, 91 { 0x000001fffffc0000ULL, 0x07fffff000001fffULL, }, 92 { 0xffffff000000ffffULL, 0xff000000ffffff00ULL, }, /* 48 */ 93 { 0x000000ffffff0000ULL, 0x00ffffff000000ffULL, }, 94 { 0xffffff8000003fffULL, 0xffe000000ffffff8ULL, }, 95 { 0x0000007fffffc000ULL, 0x001ffffff0000007ULL, }, 96 { 0xffffffc000000fffULL, 0xfffc000000ffffffULL, }, 97 { 0x0000003ffffff000ULL, 0x0003ffffff000000ULL, }, 98 { 0xffffffe0000003ffULL, 0xffff8000000fffffULL, }, 99 { 0x0000001ffffffc00ULL, 0x00007ffffff00000ULL, }, 100 { 0xfffffff0000000ffULL, 0xfffff0000000ffffULL, }, /* 56 */ 101 { 0x0000000fffffff00ULL, 0x00000fffffff0000ULL, }, 102 { 0xfffffff80000003fULL, 0xfffffe0000000fffULL, }, 103 { 0x00000007ffffffc0ULL, 0x000001fffffff000ULL, }, 104 { 0xfffffffc0000000fULL, 0xffffffc0000000ffULL, }, 105 { 0x00000003fffffff0ULL, 0x0000003fffffff00ULL, }, 106 { 0xfffffffe00000003ULL, 0xfffffff80000000fULL, }, 107 { 0x00000001fffffffcULL, 0x00000007fffffff0ULL, }, 108 { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ 109 { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, 110 { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, 111 { 0x704f164d5e31e24eULL, 0x8df188d8a942e2a0ULL, }, 112 { 0xb9926b7c7daf4258ULL, 0xa1227caddcce65b6ULL, }, 113 { 0xd027be89ff0a2ef9ULL, 0x170b5050fea53078ULL, }, 114 { 0xb83b580665cabc4aULL, 0x91230822bff0ba62ULL, }, 115 { 0xfc8f23f09aa6b782ULL, 0x93fd6637124275aeULL, }, 116 { 0x201e09cd56aee649ULL, 0xef5de039a6a52758ULL, }, /* 72 */ 117 { 0xa57cd91365d9e5d7ULL, 0x9321bc9881ecba5cULL, }, 118 { 0xa2e8f6f5c9cbc61bULL, 0xb2c471545e0d7a12ULL, }, 119 { 0xa89cf2f131a864aeULL, 0xd2a3e87a5db986e7ULL, }, 120 { 0xe61438e9a652ea0aULL, 0xa85483d97879d41cULL, }, 121 { 0x944a35fd192361a8ULL, 0xf3912da36a0b2d6bULL, }, 122 { 0x4630426322bef79cULL, 0xeb5686f7cb19304eULL, }, 123 { 0x8b5aa7a2f259deadULL, 0xd278cbcd696417e3ULL, }, 124 }; 125 126 reset_msa_registers(); 127 128 gettimeofday(&start, NULL); 129 130 for (i = 0; i < TEST_COUNT_TOTAL; i++) { 131 if (i < PATTERN_INPUTS_COUNT) { 132 do_msa_MOVE_V(b128_pattern[i], b128_result[i]); 133 } else { 134 do_msa_MOVE_V(b128_random[i - PATTERN_INPUTS_COUNT], 135 b128_result[i]); 136 } 137 } 138 139 gettimeofday(&end, NULL); 140 141 elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; 142 elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; 143 144 ret = check_results_128(isa_ase_name, group_name, instruction_name, 145 TEST_COUNT_TOTAL, elapsed_time, 146 &b128_result[0][0], &b128_expect[0][0]); 147 148 return ret; 149}