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 #ifdef __LITTLE_ENDIAN__
82 vec_uc_expected1
= (vector
unsigned char){8, 7, 6, 5, 4, 3, 2, 1,
83 0, 0, 0, 0, 0, 0, 0, 0,};
85 vec_uc_expected1
= (vector
unsigned char){0, 0, 0, 0, 0, 0, 0, 0,
86 1, 2, 3, 4, 5, 6, 7, 8,};
89 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
92 printf("Error: result does not match expected result\n");
93 printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
97 printf(" %d,", vec_uc_expected1
[i
]);
99 printf("\nvec_xl_len_r(%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
103 printf(" %d,", vec_uc_result1
[i
]);
113 vec_uc_result1
= vec_xl_len_r(data_uc
, size
);
115 #ifdef __LITTLE_ENDIAN__
116 vec_uc_expected1
= (vector
unsigned char){ 4, 3, 2, 1, 0, 0, 0, 0,
117 0, 0, 0, 0, 0, 0, 0, 0 };
119 vec_uc_expected1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
120 0, 0, 0, 0, 1, 2, 3, 4 };
123 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
126 printf("Error: result does not match expected result\n");
127 printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
131 printf(" %d,", vec_uc_expected1
[i
]);
133 printf("\nvec_xl_len_r(%d): vec_uc_result1[0] to vec_uc_result1[15]\n",
137 printf(" %d,", vec_uc_result1
[i
]);
146 vec_uc_result1
= vec_xl_len_r(data_uc
, size
);
148 #ifdef __LITTLE_ENDIAN__
149 vec_uc_expected1
= (vector
unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
150 0, 0, 0, 0, 0, 0, 0, 0 };
152 vec_uc_expected1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
153 0, 0, 0, 0, 0, 0, 1, 2 };
156 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
159 printf("Error: result does not match expected result\n");
160 printf("vec_xl_len_r(%d): vec_uc_expected1[0] to vec_uc_expected1[15]\n",
163 printf(" %d,", vec_uc_expected1
[i
]);
165 printf("\nvec_xl_len_r(%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
169 printf(" %d,", vec_uc_result1
[i
]);
179 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 0, 0, 0, 0, 0, 0,
180 0, 0, 0, 0, 0, 0, 0, 0 };
181 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
182 9, 10, 11, 12, 13, 14, 15, 16 };
186 vec_uc_result1
[i
] = 0;
188 address
= &vec_uc_result1
[0];
189 vec_xst_len (store_data_uc
, address
, size
);
191 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
194 printf("Error: result does not match expected result\n");
195 printf("vec_xst_len (%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
199 printf(" %d,", vec_uc_expected1
[i
]);
201 printf("\nvec_xst_len (%d) store_data_uc[0] to store_data_uc[15]\n",
205 printf(" %d,", vec_uc_result1
[i
]);
213 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
214 9, 10, 11, 12, 13, 14, 0, 0 };
215 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
216 9, 10, 11, 12, 13, 14, 15, 16 };
220 vec_uc_result1
[i
] = 0;
222 address
= &vec_uc_result1
[0];
224 vec_xst_len (store_data_uc
, address
, size
);
226 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
229 printf("Error: result does not match expected result\n");
230 printf("vec_xst_len (%d) vec_uc_result1[0] to vec_uc_result1[15]\n",
234 printf(" %d,", vec_uc_expected1
[i
]);
236 printf("\nvec_xst_len (%d) store_data_uc[0] to store_data_uc[15]\n",
240 printf(" %d,", vec_uc_result1
[i
]);
249 #ifdef __LITTLE_ENDIAN__
250 vec_uc_expected1
= (vector
unsigned char){ 16, 15, 14, 13, 12, 11, 10, 9,
251 8, 7, 6, 5, 4, 3, 2, 1 };
253 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
254 9, 10, 11, 12, 13, 14, 15, 16 };
256 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
257 9, 10, 11, 12, 13, 14, 15, 16 };
258 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0 };
263 address
= &vec_uc_result1
[0];
265 vec_xst_len_r(store_data_uc
, address
, size
);
267 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
270 printf("Error: result does not match expected result\n");
271 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
275 printf(" %d,", vec_uc_expected1
[i
]);
277 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
280 printf(" %d,", vec_uc_result1
[i
]);
288 #ifdef __LITTLE_ENDIAN__
289 vec_uc_expected1
= (vector
unsigned char){ 2, 1, 0, 0, 0, 0, 0, 0,
290 0, 0, 0, 0, 0, 0, 0, 0 };
292 vec_uc_expected1
= (vector
unsigned char){ 15, 16, 0, 0, 0, 0, 0, 0,
293 0, 0, 0, 0, 0, 0, 0, 0 };
295 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
296 9, 10, 11, 12, 13, 14, 15, 16 };
297 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
298 0, 0, 0, 0, 0, 0, 0, 0 };
302 address
= &vec_uc_result1
[0];
304 vec_xst_len_r(store_data_uc
, address
, size
);
306 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
309 printf("Error: result does not match expected result\n");
310 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
314 printf(" %d,", vec_uc_expected1
[i
]);
316 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
319 printf(" %d,", vec_uc_result1
[i
]);
327 #ifdef __LITTLE_ENDIAN__
328 vec_uc_expected1
= (vector
unsigned char){ 16, 15, 14, 13, 12, 11, 10, 9,
329 8, 7, 6, 5, 4, 3, 2, 1 };
331 vec_uc_expected1
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
332 9, 10, 11, 12, 13, 14, 15, 16 };
334 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
335 9, 10, 11, 12, 13, 14, 15, 16 };
336 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0 };
341 address
= &vec_uc_result1
[0];
343 vec_xst_len_r(store_data_uc
, address
, size
);
345 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
348 printf("Error: result does not match expected result\n");
349 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
353 printf(" %d,", vec_uc_expected1
[i
]);
355 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
358 printf(" %d,", vec_uc_result1
[i
]);
366 #ifdef __LITTLE_ENDIAN__
367 vec_uc_expected1
= (vector
unsigned char){ 14, 13, 12, 11, 10, 9, 8, 7,
368 6, 5, 4, 3, 2, 1, 0, 0 };
370 vec_uc_expected1
= (vector
unsigned char){ 3, 4, 5, 6, 7, 8, 9, 10,
371 11, 12, 13, 14, 15, 16, 0, 0 };
373 store_data_uc
= (vector
unsigned char){ 1, 2, 3, 4, 5, 6, 7, 8,
374 9, 10, 11, 12, 13, 14, 15, 16 };
375 vec_uc_result1
= (vector
unsigned char){ 0, 0, 0, 0, 0, 0, 0, 0,
376 0, 0, 0, 0, 0, 0, 0, 0 };
380 address
= &vec_uc_result1
[0];
382 vec_xst_len_r(store_data_uc
, address
, size
);
384 if (result_wrong (vec_uc_expected1
, vec_uc_result1
))
387 printf("Error: result does not match expected result\n");
388 printf("vec_xst_len_r(%d) vec_uc_expected1[0] to vec_uc_expected1[15]\n",
392 printf(" %d,", vec_uc_expected1
[i
]);
394 printf("\nvec_xst_len_r(%d) result[0] to result[15]\n", size
);
397 printf(" %d,", vec_uc_result1
[i
]);