i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-over-widen-19.c
blobc93cd4d09af5fc602b5019352073404bb1f5d127
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_shift } */
3 /* { dg-require-effective-target vect_pack_trunc } */
4 /* { dg-require-effective-target vect_unpack } */
6 #include "tree-vect.h"
8 #define N 111
10 /* This shouldn't be treated as an over-widening operation: it's better
11 to reuse the extensions of di and ei for di + ei than to add them
12 as shorts and introduce a third extension. */
14 void __attribute__ ((noipa))
15 f (unsigned int *restrict a, unsigned int *restrict b,
16 unsigned int *restrict c, unsigned char *restrict d,
17 unsigned char *restrict e)
19 for (__INTPTR_TYPE__ i = 0; i < N; ++i)
21 unsigned int di = d[i];
22 unsigned int ei = e[i];
23 a[i] = di;
24 b[i] = ei;
25 c[i] = di + ei;
29 int
30 main (void)
32 check_vect ();
34 unsigned int a[N], b[N], c[N];
35 unsigned char d[N], e[N];
36 for (int i = 0; i < N; ++i)
38 d[i] = i * 2 + 3;
39 e[i] = i + 100;
40 asm volatile ("" ::: "memory");
42 f (a, b, c, d, e);
43 #pragma GCC novector
44 for (int i = 0; i < N; ++i)
45 if (a[i] != i * 2 + 3
46 || b[i] != i + 100
47 || c[i] != i * 3 + 103)
48 __builtin_abort ();
50 return 0;
53 /* { dg-final { scan-tree-dump-not {vect_recog_over_widening_pattern: detected} "vect" } } */
54 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */