Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-widen-mult-u16.c
blob3aa0ff10dfec44f1de42736cbd55af51a6f42c33
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 unsigned short X[N] __attribute__ ((__aligned__(16)));
9 unsigned short Y[N] __attribute__ ((__aligned__(16)));
10 unsigned int result[N];
12 /* short->int widening-mult */
13 __attribute__ ((noinline)) int
14 foo1(int len) {
15 int i;
17 /* Not vectorized because X[i] and Y[i] are casted to 'int'
18 so the widening multiplication pattern is not recognized. */
19 for (i=0; i<len; i++) {
20 result[i] = (unsigned int)(X[i] * Y[i]);
24 int main (void)
26 int i;
28 check_vect ();
30 for (i=0; i<N; i++) {
31 X[i] = i;
32 Y[i] = 64-i;
35 foo1 (N);
37 for (i=0; i<N; i++) {
38 if (result[i] != X[i] * Y[i])
39 abort ();
42 return 0;
45 /*The induction loop is vectorized */
46 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail *-*-* } } } */
47 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */
48 /* { dg-final { cleanup-tree-dump "vect" } } */