| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */ |
| 3 |
/* { dg-require-effective-target vect_condition } */ |
| 4 |
/* { dg-require-effective-target vect_double } */ |
| 5 |
|
| 6 |
#include "tree-vect.h" |
| 7 |
|
| 8 |
extern void abort (void) __attribute__ ((noreturn)); |
| 9 |
|
| 10 |
#define N 27 |
| 11 |
|
| 12 |
/* Condition reduction with different types. */ |
| 13 |
|
| 14 |
int |
| 15 |
condition_reduction (double *a, double min_v) |
| 16 |
{ |
| 17 |
int last = 0; |
| 18 |
|
| 19 |
for (int i = 0; i < N; i++) |
| 20 |
if (a[i] < min_v) |
| 21 |
last = i; |
| 22 |
|
| 23 |
return last; |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
main (void) |
| 28 |
{ |
| 29 |
double a[N] = { |
| 30 |
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 31 |
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| 32 |
21, 22, 23, 24, 25, 26, 27 |
| 33 |
}; |
| 34 |
|
| 35 |
check_vect (); |
| 36 |
|
| 37 |
int ret = condition_reduction (a, 10); |
| 38 |
if (ret != 18) |
| 39 |
abort (); |
| 40 |
|
| 41 |
return 0; |
| 42 |
} |
| 43 |
|
| 44 |
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */ |
| 45 |
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST(?:(?!Analysis failed).)*Analysis succeeded" 2 "vect" { target { vect_fold_extract_last && vect_pack_trunc } } } } */ |
| 46 |
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 2 "vect" { target { ! vect_fold_extract_last } } } } */ |
| 47 |
|