1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
/* { dg-do run { target { power10_hw } } } */
/* { dg-do link { target { ! power10_hw } } } */
/* { dg-options "-mdejagnu-cpu=power10 -O2" } */
/* { dg-require-effective-target power10_ok } */
#include <altivec.h>
#ifdef DEBUG
#include <stdio.h>
#endif
#define IMM0 0
#define IMM1 1
#define IMM2 2
#define IMM3 3
void abort (void);
int main ()
{
int i;
vector unsigned char vec_byte_arg;
vector unsigned char vec_byte_result, vec_byte_expected0, vec_byte_expected1;
vector unsigned char vec_byte_expected2, vec_byte_expected3;
vector unsigned short vec_hword_arg;
vector unsigned short vec_hword_result, vec_hword_expected0;
vector unsigned short vec_hword_expected1, vec_hword_expected2;
vector unsigned short vec_hword_expected3;
vector unsigned int vec_word_arg;
vector unsigned int vec_word_result, vec_word_expected0, vec_word_expected1;
vector unsigned int vec_word_expected2, vec_word_expected3;
vec_byte_arg = (vector unsigned char ){ 0xFF, 0xF0, 0x7F, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x01, 0x23,
0x45, 0x67, 0x00, 0x00 };
vec_byte_result = (vector unsigned char ){ 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF };
vec_byte_expected0 = (vector unsigned char){ 0x1F, 0x1E, 0x1D, 0x1C,
0x1B, 0x1A, 0x19, 0x18,
0x06, 0x05, 0x15, 0x04,
0x03, 0x02, 0x01, 0x00 };
vec_byte_expected1 = (vector unsigned char){ 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x07, 0x06, 0x04,
0x03, 0x02, 0x01, 0x00 };
vec_byte_expected2 = (vector unsigned char){ 0x10, 0x11, 0x12, 0x13,
0x14, 0x15, 0x16, 0x17,
0x00, 0x01, 0x1a, 0x02,
0x03, 0x04, 0x05, 0x06 };
vec_byte_expected3 = (vector unsigned char){ 0x08, 0x09, 0x0B, 0x0C,
0x0D, 0x0E, 0x0F, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
vec_hword_arg = (vector unsigned short) { 0x0004, 0xF003, 0x0002, 0x0001,
0xF004, 0x1003, 0xF002, 0x0001 };
vec_hword_expected0 = (vector unsigned short int){ 0x405, 0x1c1d, 0x203,
0x1819, 0x1617, 0x1,
0x1213, 0x1011 };
vec_hword_expected1 = (vector unsigned short int){ 0x0, 0x0, 0x0, 0x0,
0x0, 0xe0f, 0xa0b, 0x405 };
vec_hword_expected2 = (vector unsigned short int){ 0x100, 0x1312, 0x302,
0x1716, 0x1918, 0x504,
0x1d1c, 0x1f1e };
vec_hword_expected3 = (vector unsigned short int){ 0x100, 0x504, 0xb0a, 0x0,
0x0, 0x0, 0x0, 0x0 };
vec_word_arg = (vector unsigned int){ 0xFEDCBA90, 0xF101, 0xF0000202, 0xF303 };
vec_word_expected0 = (vector unsigned int){ 0x4050607, 0x18191a1b,
0x10203, 0x10111213 };
vec_word_expected1 = (vector unsigned int){ 0x0, 0x0, 0xc0d0e0f, 0x4050607 };
vec_word_expected2 = (vector unsigned int){ 0x3020100, 0x17161514,
0x7060504, 0x1f1e1d1c };
vec_word_expected3 = (vector unsigned int){ 0x3020100, 0xb0a0908, 0x0, 0x0 };
vec_byte_result = vec_genpcvm (vec_byte_arg, IMM0);
for (i = 0; i < 16; i++) {
if (vec_byte_expected0[i] != vec_byte_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 0), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
i, vec_byte_expected0[i], i, vec_byte_result[i]);
#else
abort();
#endif
}
vec_byte_result = vec_genpcvm (vec_byte_arg, IMM1);
for (i = 0; i < 16; i++) {
if (vec_byte_expected1[i] != vec_byte_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 1), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
i, vec_byte_expected1[i], i, vec_byte_result[i]);
#else
abort();
#endif
}
vec_byte_result = vec_genpcvm (vec_byte_arg, IMM2);
for (i = 0; i < 16; i++) {
if (vec_byte_expected2[i] != vec_byte_result[i])
#if DEBUG
printf("ERROR: vec_genpcvmbm(IMM = 2), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
i, vec_byte_expected2[i], i, vec_byte_result[i]);
#else
abort();
#endif
}
vec_byte_result = vec_genpcvm (vec_byte_arg, IMM3);
for (i = 0; i < 16; i++) {
if (vec_byte_expected3[i] != vec_byte_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 3), vec_byte_expected[%d] = 0x%x does not match vec_byte_result[%d] = 0x%x\n",
i, vec_byte_expected3[i], i, vec_byte_result[i]);
#else
abort();
#endif
}
vec_hword_result = vec_genpcvm (vec_hword_arg, IMM0);
for (i = 0; i < 8; i++) {
if (vec_hword_expected0[i] != vec_hword_result[i])
#if DEBUG
printf("ERROR: vec_genpcvmhm(IMM = 0), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
i, vec_hword_expected0[i], i, vec_hword_result[i]);
#else
abort();
#endif
}
vec_hword_result = vec_genpcvm (vec_hword_arg, IMM1);
for (i = 0; i < 8; i++) {
if (vec_hword_expected1[i] != vec_hword_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 1), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
i, vec_hword_expected1[i], i, vec_hword_result[i]);
#else
abort();
#endif
}
vec_hword_result = vec_genpcvm (vec_hword_arg, IMM2);
for (i = 0; i < 8; i++) {
if (vec_hword_expected2[i] != vec_hword_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 2), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
i, vec_hword_expected2[i], i, vec_hword_result[i]);
#else
abort();
#endif
}
vec_hword_result = vec_genpcvm (vec_hword_arg, IMM3);
for (i = 0; i < 8; i++) {
if (vec_hword_expected3[i] != vec_hword_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 3), vec_hword_expected[%d] = 0x%x does not match vec_hword_result[%d] = 0x%x\n",
i, vec_hword_expected3[i], i, vec_hword_result[i]);
#else
abort();
#endif
}
vec_word_result = vec_genpcvm (vec_word_arg, IMM0);
for (i = 0; i < 4; i++) {
if (vec_word_expected0[i] != vec_word_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 0), vec_word_expected[%d] = 0x%x does not match vec_word_result[%d] = 0x%x\n",
i, vec_word_expected0[i], i, vec_word_result[i]);
#else
abort();
#endif
}
vec_word_result = vec_genpcvm (vec_word_arg, IMM1);
for (i = 0; i < 4; i++) {
if (vec_word_expected1[i] != vec_word_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 1), vec_word_expected[%d] = 0%x does not match vec_word_result[%d] = 0x%x\n",
i, vec_word_expected1[i], i, vec_word_result[i]);
#else
abort();
#endif
}
vec_word_result = vec_genpcvm (vec_word_arg, IMM2);
for (i = 0; i < 4; i++) {
if (vec_word_expected2[i] != vec_word_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 2), vec_word_expected[%d] = 0x%x does not match vec_word_result[%d] = 0x%x\n",
i, vec_word_expected2[i], i, vec_word_result[i]);
#else
abort();
#endif
}
vec_word_result = vec_genpcvm (vec_word_arg, IMM3);
for (i = 0; i < 4; i++) {
if (vec_word_expected3[i] != vec_word_result[i])
#if DEBUG
printf("ERROR: vec_genpcvm(IMM = 3), vec_word_expected[%d] = 0x%x does not match vec_word_result[%d] = 0x%x\n",
i, vec_word_expected3[i], i, vec_word_result[i]);
#else
abort();
#endif
}
return 0;
}
|