i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-2char-big-array.c
blobf54bddb4c94dca98af0d456387e1623a7f2e3008
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 256
8 __attribute__ ((noinline))
9 void main1 (signed char x, signed char max_result, signed char min_result)
11 int i;
12 signed char b[N];
13 signed char c[N];
14 signed char check_diff = 2;
15 signed char diff = 2;
16 signed char max = x;
17 signed char min = x;
19 check_diff = 2;
20 for (i = 0; i < N; i++) {
21 b[i] = i;
22 c[i] = i;
23 if (i%16 == 0)
25 c[i] = i + 1;
26 check_diff += 1;
28 if (c[i] > max_result)
29 max_result = c[i];
30 if (c[i] < min_result)
31 min_result = c[i];
32 asm volatile ("" ::: "memory");
35 for (i = 0; i < N; i++) {
36 diff += (signed char) (c[i] - b[i]);
39 for (i = 0; i < N; i++) {
40 max = max < c[i] ? c[i] : max;
43 for (i = 0; i < N; i++) {
44 min = min > c[i] ? c[i] : min;
47 /* check results: */
48 if (diff != check_diff)
49 abort ();
50 if (max != max_result)
51 abort ();
52 if (min != min_result)
53 abort ();
56 int main (void)
58 check_vect ();
60 main1 (100, 100, 1);
61 main1 (0, 15, 0);
62 return 0;
65 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { ! vect_no_int_min_max } } } } */