1
2
3
4
5
6
7
8
9#define VEC_MAX 128
10#define VSX_MAX 32
11#define VMX_MAX 32
12
13
14
15
16
17int validate_vsx(unsigned long *vsx, unsigned long *load)
18{
19 int i;
20
21 for (i = 0; i < VSX_MAX; i++) {
22 if (vsx[i] != load[2 * i + 1]) {
23 printf("vsx[%d]: %lx load[%d] %lx\n",
24 i, vsx[i], 2 * i + 1, load[2 * i + 1]);
25 return TEST_FAIL;
26 }
27 }
28 return TEST_PASS;
29}
30
31
32
33
34
35int validate_vmx(unsigned long vmx[][2], unsigned long *load)
36{
37 int i;
38
39 for (i = 0; i < VMX_MAX; i++) {
40 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
41 if ((vmx[i][0] != load[64 + 2 * i]) ||
42 (vmx[i][1] != load[65 + 2 * i])) {
43 printf("vmx[%d][0]: %lx load[%d] %lx\n",
44 i, vmx[i][0], 64 + 2 * i,
45 load[64 + 2 * i]);
46 printf("vmx[%d][1]: %lx load[%d] %lx\n",
47 i, vmx[i][1], 65 + 2 * i,
48 load[65 + 2 * i]);
49 return TEST_FAIL;
50 }
51 #else
52
53
54
55 if ((vmx[i][0] != load[65 + 2 * i]) ||
56 (vmx[i][1] != load[64 + 2 * i])) {
57 printf("vmx[%d][0]: %lx load[%d] %lx\n",
58 i, vmx[i][0], 65 + 2 * i,
59 load[65 + 2 * i]);
60 printf("vmx[%d][1]: %lx load[%d] %lx\n",
61 i, vmx[i][1], 64 + 2 * i,
62 load[64 + 2 * i]);
63 return TEST_FAIL;
64 }
65 #endif
66 }
67 return TEST_PASS;
68}
69
70
71
72
73
74int compare_vsx_vmx(unsigned long *store, unsigned long *load)
75{
76 int i;
77
78 for (i = 0; i < VSX_MAX; i++) {
79 if (store[1 + 2 * i] != load[1 + 2 * i]) {
80 printf("store[%d]: %lx load[%d] %lx\n",
81 1 + 2 * i, store[i],
82 1 + 2 * i, load[i]);
83 return TEST_FAIL;
84 }
85 }
86
87 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
88 for (i = 64; i < VEC_MAX; i++) {
89 if (store[i] != load[i]) {
90 printf("store[%d]: %lx load[%d] %lx\n",
91 i, store[i], i, load[i]);
92 return TEST_FAIL;
93 }
94 }
95 #else
96 for (i = 64; i < VEC_MAX; i++) {
97 if (!(i % 2) && (store[i] != load[i+1])) {
98 printf("store[%d]: %lx load[%d] %lx\n",
99 i, store[i], i+1, load[i+1]);
100 return TEST_FAIL;
101 }
102 if ((i % 2) && (store[i] != load[i-1])) {
103 printf("here store[%d]: %lx load[%d] %lx\n",
104 i, store[i], i-1, load[i-1]);
105 return TEST_FAIL;
106 }
107 }
108 #endif
109 return TEST_PASS;
110}
111
112void load_vsx_vmx(unsigned long *load, unsigned long *vsx,
113 unsigned long vmx[][2])
114{
115 int i;
116
117 for (i = 0; i < VSX_MAX; i++)
118 vsx[i] = load[1 + 2 * i];
119
120 for (i = 0; i < VMX_MAX; i++) {
121 vmx[i][0] = load[64 + 2 * i];
122 vmx[i][1] = load[65 + 2 * i];
123 }
124}
125
126void loadvsx(void *p, int tmp);
127void storevsx(void *p, int tmp);
128