| 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 |
|
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
extern void abort (void) __attribute__ ((noreturn)); |
| 8 |
|
| 9 |
#define N 27 |
| 10 |
|
| 11 |
/* Condition reduction with matches only in even lanes at runtime. */ |
| 12 |
|
| 13 |
int |
| 14 |
condition_reduction (int *a, int min_v) |
| 15 |
{ |
| 16 |
int last = N + 96; |
| 17 |
|
| 18 |
for (int i = 0; i < N; i++) |
| 19 |
if (a[i] > min_v) |
| 20 |
last = i; |
| 21 |
|
| 22 |
return last; |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
main (void) |
| 27 |
{ |
| 28 |
int a[N] = { |
| 29 |
47, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
| 30 |
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| 31 |
21, 22, 23, 24, 25, 26, 27 |
| 32 |
}; |
| 33 |
|
| 34 |
check_vect (); |
| 35 |
|
| 36 |
int ret = condition_reduction (a, 46); |
| 37 |
|
| 38 |
/* loop should have found a value of 0, not default N + 96. */ |
| 39 |
if (ret != 0) |
| 40 |
abort (); |
| 41 |
|
| 42 |
return 0; |
| 43 |
} |
| 44 |
|
| 45 |
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 2 "vect" } } */ |
| 46 |
/* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 2 "vect" { target vect_fold_extract_last } } } */ |
| 47 |
/* { dg-final { scan-tree-dump-times "condition expression based on integer induction." 2 "vect" { target { ! vect_fold_extract_last } } } } */ |