tests/tcg: target/mips: Fix test utilities for 128-bit tests

Add "static" and "const" modifiers where appropriate, and fix other
minor issues.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1551800076-8104-7-git-send-email-aleksandar.markovic@rt-rk.com>
This commit is contained in:
Aleksandar Markovic 2019-03-05 16:34:28 +01:00
parent ace4458466
commit dd3ba7036f
2 changed files with 10 additions and 9 deletions

View File

@ -28,7 +28,7 @@
#define PATTERN_INPUTS_COUNT 64
#define PATTERN_INPUTS_SHORT_COUNT 8
uint64_t b128_pattern[PATTERN_INPUTS_COUNT][2] = {
static const uint64_t b128_pattern[PATTERN_INPUTS_COUNT][2] = {
{ 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFFFULL, }, /* 0 */
{ 0x0000000000000000ULL, 0x0000000000000000ULL, },
{ 0xAAAAAAAAAAAAAAAAULL, 0xAAAAAAAAAAAAAAAAULL, },
@ -99,7 +99,7 @@ uint64_t b128_pattern[PATTERN_INPUTS_COUNT][2] = {
#define RANDOM_INPUTS_COUNT 16
#define RANDOM_INPUTS_SHORT_COUNT 4
uint64_t b128_random[RANDOM_INPUTS_COUNT][2] = {
static const uint64_t b128_random[RANDOM_INPUTS_COUNT][2] = {
{ 0x886AE6CC28625540ULL, 0x4B670B5EFE7BB00CULL, }, /* 0 */
{ 0xFBBE00634D93C708ULL, 0x12F7BB1A153F52FCULL, },
{ 0xAC5AAEAAB9CF8B80ULL, 0x27D8C6FFAB2B2514ULL, },

View File

@ -27,14 +27,14 @@
#include <inttypes.h>
#include <string.h>
#define PRINT_RESULTS 1
#define PRINT_RESULTS 0
static inline int32_t check_results(char *instruction_name,
uint32_t test_count,
double elapsed_time,
uint64_t *b128_result,
uint64_t *b128_expect)
static inline int32_t check_results(const char *instruction_name,
const uint32_t test_count,
const double elapsed_time,
const uint64_t *b128_result,
const uint64_t *b128_expect)
{
#if PRINT_RESULTS
uint32_t ii;
@ -58,7 +58,8 @@ static inline int32_t check_results(char *instruction_name,
printf("%s: ", instruction_name);
for (i = 0; i < test_count; i++) {
if (b128_result[i] == b128_expect[i]) {
if ((b128_result[2 * i] == b128_expect[2 * i]) &&
(b128_result[2 * i + 1] == b128_expect[2 * i + 1])) {
pass_count++;
} else {
fail_count++;