brintos

brintos / linux-shallow public Read only

0
0
Text · 1.3 KiB · a5470b8 Raw
71 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.4 */5#define GPR_1	16#define GPR_2	27#define GPR_3	38#define GPR_4	49 10#define FPR_1	0.00111#define FPR_2	0.00212#define FPR_3	0.00313#define FPR_4	0.00414 15#define FPR_1_REP 0x3f50624dd2f1a9fcull16#define FPR_2_REP 0x3f60624dd2f1a9fcull17#define FPR_3_REP 0x3f689374bc6a7efaull18#define FPR_4_REP 0x3f70624dd2f1a9fcull19 20/* Buffer must have 18 elements */21int validate_gpr(unsigned long *gpr, unsigned long val)22{23	int i, found = 1;24 25	for (i = 0; i < 18; i++) {26		if (gpr[i] != val) {27			printf("GPR[%d]: %lx Expected: %lx\n",28				i+14, gpr[i], val);29			found = 0;30		}31	}32 33	if (!found)34		return TEST_FAIL;35	return TEST_PASS;36}37 38/* Buffer must have 32 elements */39int validate_fpr(__u64 *fpr, __u64 val)40{41	int i, found = 1;42 43	for (i = 0; i < 32; i++) {44		if (fpr[i] != val) {45			printf("FPR[%d]: %llx Expected: %llx\n", i, fpr[i], val);46			found = 0;47		}48	}49 50	if (!found)51		return TEST_FAIL;52	return TEST_PASS;53}54 55/* Buffer must have 32 elements */56int validate_fpr_double(double *fpr, double val)57{58	int i, found = 1;59 60	for (i = 0; i < 32; i++) {61		if (fpr[i] != val) {62			printf("FPR[%d]: %f Expected: %f\n", i, fpr[i], val);63			found = 0;64		}65	}66 67	if (!found)68		return TEST_FAIL;69	return TEST_PASS;70}71