| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 128 |
| 7 |
|
| 8 |
unsigned int uc[N]; |
| 9 |
|
| 10 |
/* Vectorization of reduction using loop-aware SLP. */ |
| 11 |
|
| 12 |
__attribute__ ((noinline)) |
| 13 |
int main1 (int n, int res0, int res1, int res2, int res3, int res4, int res5, int res6, int res7) |
| 14 |
{ |
| 15 |
int i; |
| 16 |
unsigned int max0 = 5, max1 = 10, max2 = 20, max3 = 30, max4 = 2, max5 = 13, max6 = 7, max7 = 313; |
| 17 |
|
| 18 |
for (i = 0; i < n; i++) { |
| 19 |
max2 = max2 < uc[8*i+2] ? uc[8*i+2] : max2; |
| 20 |
max3 = max3 < uc[8*i+3] ? uc[8*i+3] : max3; |
| 21 |
max1 = max1 < uc[8*i+1] ? uc[8*i+1] : max1; |
| 22 |
max7 = max7 < uc[8*i+7] ? uc[8*i+7] : max7; |
| 23 |
max6 = max6 < uc[8*i+6] ? uc[8*i+6] : max6; |
| 24 |
max0 = max0 < uc[8*i] ? uc[8*i] : max0; |
| 25 |
max4 = max4 < uc[8*i+4] ? uc[8*i+4] : max4; |
| 26 |
max5 = max5 < uc[8*i+5] ? uc[8*i+5] : max5; |
| 27 |
} |
| 28 |
|
| 29 |
/* Check results: */ |
| 30 |
if (max0 != res0 |
| 31 |
|| max1 != res1 |
| 32 |
|| max2 != res2 |
| 33 |
|| max3 != res3 |
| 34 |
|| max4 != res4 |
| 35 |
|| max5 != res5 |
| 36 |
|| max6 != res6 |
| 37 |
|| max7 != res7) |
| 38 |
abort (); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |
| 42 |
|
| 43 |
int main (void) |
| 44 |
{ |
| 45 |
int i; |
| 46 |
|
| 47 |
check_vect (); |
| 48 |
|
| 49 |
for (i = 0; i < N; i++) |
| 50 |
{ |
| 51 |
uc[i] = i+3; |
| 52 |
__asm__ volatile (""); |
| 53 |
} |
| 54 |
|
| 55 |
main1 (N/8, 123, 124, 125, 126, 127, 128, 129, 313); |
| 56 |
return 0; |
| 57 |
} |
| 58 |
|
| 59 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_min_max } } } */ |
| 60 |
/* For variable-length SVE, the number of scalar statements in the |
| 61 |
reduction exceeds the number of elements in a 128-bit granule. */ |
| 62 |
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! vect_multiple_sizes } xfail { vect_no_int_min_max || { aarch64_sve && vect_variable_length } } } } } */ |
| 63 |
/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" { target { vect_multiple_sizes && { ! { vect_load_lanes && vect_strided8 } } } } } } */ |
| 64 |
/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 0 "vect" { xfail { { aarch64_sve && vect_variable_length } || vect_no_int_min_max } } } } */ |
| 65 |
|