1 /* { dg-do run { target lp64 } } */
2 /* { dg-require-effective-target p9vector_hw } */
3 /* { dg-options "-mdejagnu-cpu=power9 -O2" } */
8 #include <altivec.h> // vector
19 int result_wrong(vector
unsigned char vec_expected
,
20 vector
unsigned char vec_actual
)
25 if (vec_expected
[i
] != vec_actual
[i
])
34 unsigned char data_uc
[100];
35 vector
unsigned char store_data_uc
;
36 unsigned char *address
;
37 vector
unsigned char *datap
;
39 vector
unsigned char vec_uc_expected1
, vec_uc_result1
;
49 vec_uc_result1
= vec_xl_len (data_uc
, size
);
51 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
52 0, 0, 0, 0, 0, 0, 0, 0};
54 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
57 printf("Error: result does not match expected result\n");
58 printf("vec_xl_len (%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
62 printf(" %d,",vec_uc_expected1
[i
]);
64 printf("\nvec_xl_len (%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
68 printf(" %d,", vec_uc_result1
[i
]);
79 vec_uc_result1
= vec_xl_len_r(data_uc
, size
);
81 vec_uc_expected1
= (vector
unsigned char){8, 7, 6, 5, 4, 3, 2, 1,
82 0, 0, 0, 0, 0, 0, 0, 0,};
84 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
87 printf("Error: result does not match expected result\n");
88 printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
92 printf(" %d,", vec_uc_expected1
[i
]);
94 printf("\nvec_xl_len_r(%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
98 printf(" %d,", vec_uc_result1
[i
]);
108 vec_uc_result1
= vec_xl_len_r(data_uc
, size
);
110 vec_uc_expected1
= (vector
unsigned char){ 4, 3, 2, 1, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0 };
113 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
116 printf("Error: result does not match expected result\n");
117 printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
121 printf(" %d,", vec_uc_expected1
[i
]);
123 printf("\nvec_xl_len_r(%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
127 printf(" %d,", vec_uc_result1
[i
]);
136 vec_uc_result1
= vec_xl_len_r(data_uc
, size
);
138 vec_uc_expected1
= (vector
unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
139 0, 0, 0, 0, 0, 0, 0, 0 };
141 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
144 printf("Error: result does not match expected result\n");
145 printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
148 printf(" %d,", vec_uc_expected1
[i
]);
150 printf("\nvec_xl_len_r(%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
154 printf(" %d,", vec_uc_result1
[i
]);
164 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 0, 0, 0, 0, 0, 0,
165 0, 0, 0, 0, 0, 0, 0, 0 };
166 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
167 9, 10, 11, 12, 13, 14, 15, 16 };
171 vec_uc_result1
[i
] = 0;
173 address
= &vec_uc_result1
[0];
174 vec_xst_len (store_data_uc
, address
, size
);
176 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
179 printf("Error: result does not match expected result\n");
180 printf("vec_xst_len (%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
184 printf(" %d,", vec_uc_expected1
[i
]);
186 printf("\nvec_xst_len (%d) store_data_uc[0] to store_data_uc[15]\n",
190 printf(" %d,", vec_uc_result1
[i
]);
198 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
199 9, 10, 11, 12, 13, 14, 0, 0 };
200 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
201 9, 10, 11, 12, 13, 14, 15, 16 };
205 vec_uc_result1
[i
] = 0;
207 address
= &vec_uc_result1
[0];
209 vec_xst_len (store_data_uc
, address
, size
);
211 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
214 printf("Error: result does not match expected result\n");
215 printf("vec_xst_len (%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
219 printf(" %d,", vec_uc_expected1
[i
]);
221 printf("\nvec_xst_len (%d) store_data_uc[0] to store_data_uc[15]\n",
225 printf(" %d,", vec_uc_result1
[i
]);
234 vec_uc_expected1
= (vector
unsigned char){ 16, 15, 14, 13, 12, 11, 10, 9,
235 8, 7, 6, 5, 4, 3, 2, 1 };
236 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
237 9, 10, 11, 12, 13, 14, 15, 16 };
238 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
239 0, 0, 0, 0, 0, 0, 0, 0 };
243 address
= &vec_uc_result1
[0];
245 vec_xst_len_r(store_data_uc
, address
, size
);
247 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
250 printf("Error: result does not match expected result\n");
251 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
255 printf(" %d,", vec_uc_expected1
[i
]);
257 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
260 printf(" %d,", vec_uc_result1
[i
]);
268 vec_uc_expected1
= (vector
unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
269 0, 0, 0, 0, 0, 0, 0, 0 };
270 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
271 9, 10, 11, 12, 13, 14, 15, 16 };
272 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
273 0, 0, 0, 0, 0, 0, 0, 0 };
277 address
= &vec_uc_result1
[0];
279 vec_xst_len_r(store_data_uc
, address
, size
);
281 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
284 printf("Error: result does not match expected result\n");
285 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
289 printf(" %d,", vec_uc_expected1
[i
]);
291 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
294 printf(" %d,", vec_uc_result1
[i
]);
302 vec_uc_expected1
= (vector
unsigned char){ 16, 15, 14, 13, 12, 11, 10, 9,
303 8, 7, 6, 5, 4, 3, 2, 1 };
304 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
305 9, 10, 11, 12, 13, 14, 15, 16 };
306 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
307 0, 0, 0, 0, 0, 0, 0, 0 };
311 address
= &vec_uc_result1
[0];
313 vec_xst_len_r(store_data_uc
, address
, size
);
315 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
318 printf("Error: result does not match expected result\n");
319 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
323 printf(" %d,", vec_uc_expected1
[i
]);
325 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
328 printf(" %d,", vec_uc_result1
[i
]);
336 vec_uc_expected1
= (vector
unsigned char){ 14, 13, 12, 11, 10, 9, 8, 7,
337 6, 5, 4, 3, 2, 1, 0, 0 };
338 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
339 9, 10, 11, 12, 13, 14, 15, 16 };
340 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
341 0, 0, 0, 0, 0, 0, 0, 0 };
345 address
= &vec_uc_result1
[0];
347 vec_xst_len_r(store_data_uc
, address
, size
);
349 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
352 printf("Error: result does not match expected result\n");
353 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
357 printf(" %d,", vec_uc_expected1
[i
]);
359 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
362 printf(" %d,", vec_uc_result1
[i
]);