1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 8
7
8 unsigned short X[N];
9 unsigned short Y[N];
10 unsigned int result[N];
11
12 /* unsigned short->unsigned int widening-mult. */
13 __attribute__ ((noinline, noclone)) void
14 foo (void)
15 {
16 result[0] = (unsigned int) (X[0] * Y[0]);
17 result[1] = (unsigned int) (X[1] * Y[1]);
18 result[2] = (unsigned int) (X[2] * Y[2]);
19 result[3] = (unsigned int) (X[3] * Y[3]);
20 result[4] = (unsigned int) (X[4] * Y[4]);
21 result[5] = (unsigned int) (X[5] * Y[5]);
22 result[6] = (unsigned int) (X[6] * Y[6]);
23 result[7] = (unsigned int) (X[7] * Y[7]);
24 }
25
26 int main (void)
27 {
28 int i, tmp;
29
30 check_vect ();
31
32 for (i = 0; i < N; i++)
33 {
34 X[i] = i;
35 Y[i] = 64-i;
36 }
37
38 foo ();
39
40 for (i = 0; i < N; i++)
41 {
42 __asm__ volatile ("");
43 tmp = X[i] * Y[i];
44 if (result[i] != tmp)
45 abort ();
46 }
47
48 return 0;
49 }
50
51 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp2" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */
52 /* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 8 "slp2" { target vect_widen_mult_hi_to_si_pattern } } } */
53 /* { dg-final { scan-tree-dump-times "pattern recognized" 8 "slp2" { target vect_widen_mult_hi_to_si_pattern } } } */