i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr65947-9.c
blob1f2953060166f6029661941bb6bcfa33b1e9f46b
1 /* { dg-require-effective-target vect_condition } */
3 #include "tree-vect.h"
5 extern void abort (void) __attribute__ ((noreturn));
7 #define N 255
9 /* Condition reduction with maximum possible loop size. Will fail to
10 vectorize because the vectorisation requires a slot for default values. */
12 signed char __attribute__((noinline,noclone))
13 condition_reduction (signed char *a, signed char min_v)
15 signed char last = -72;
17 for (int i = 0; i < N; i++)
18 if (a[i] < min_v)
19 last = a[i];
21 return last;
24 int
25 main ()
27 signed char a[N] = {
28 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
29 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
30 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31 31, 32
33 __builtin_memset (a+32, 43, N-32);
35 check_vect ();
37 signed char ret = condition_reduction (a, 16);
38 if (ret != 10)
39 abort ();
41 ret = condition_reduction (a, 1);
42 if (ret != -72)
43 abort ();
45 return 0;
48 /* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! vect_fold_extract_last } } } } */
49 /* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" { target vect_fold_extract_last } } } */
50 /* { dg-final { scan-tree-dump "loop size is greater than data size" "vect" { target { ! vect_fold_extract_last } } } } */
51 /* { dg-final { scan-tree-dump-times "optimizing condition reduction with FOLD_EXTRACT_LAST" 1 "vect" { target vect_fold_extract_last } } } */
52 /* { dg-final { scan-tree-dump-not "condition expression based on integer induction." "vect" } } */