1 /*
2  * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version
7  * 2 of the License, or (at your option) any later version.
8  */
9 #define GPR_1	1
10 #define GPR_2	2
11 #define GPR_3	3
12 #define GPR_4	4
13 
14 #define FPR_1	0.001
15 #define FPR_2	0.002
16 #define FPR_3	0.003
17 #define FPR_4	0.004
18 
19 #define FPR_1_REP 0x3f50624de0000000
20 #define FPR_2_REP 0x3f60624de0000000
21 #define FPR_3_REP 0x3f689374c0000000
22 #define FPR_4_REP 0x3f70624de0000000
23 
24 /* Buffer must have 18 elements */
validate_gpr(unsigned long * gpr,unsigned long val)25 int validate_gpr(unsigned long *gpr, unsigned long val)
26 {
27 	int i, found = 1;
28 
29 	for (i = 0; i < 18; i++) {
30 		if (gpr[i] != val) {
31 			printf("GPR[%d]: %lx Expected: %lx\n",
32 				i+14, gpr[i], val);
33 			found = 0;
34 		}
35 	}
36 
37 	if (!found)
38 		return TEST_FAIL;
39 	return TEST_PASS;
40 }
41 
42 /* Buffer must have 32 elements */
validate_fpr(unsigned long * fpr,unsigned long val)43 int validate_fpr(unsigned long *fpr, unsigned long val)
44 {
45 	int i, found = 1;
46 
47 	for (i = 0; i < 32; i++) {
48 		if (fpr[i] != val) {
49 			printf("FPR[%d]: %lx Expected: %lx\n", i, fpr[i], val);
50 			found = 0;
51 		}
52 	}
53 
54 	if (!found)
55 		return TEST_FAIL;
56 	return TEST_PASS;
57 }
58 
59 /* Buffer must have 32 elements */
validate_fpr_float(float * fpr,float val)60 int validate_fpr_float(float *fpr, float val)
61 {
62 	int i, found = 1;
63 
64 	for (i = 0; i < 32; i++) {
65 		if (fpr[i] != val) {
66 			printf("FPR[%d]: %f Expected: %f\n", i, fpr[i], val);
67 			found = 0;
68 		}
69 	}
70 
71 	if (!found)
72 		return TEST_FAIL;
73 	return TEST_PASS;
74 }
75