aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-1.c
blob: ff520c06f5265b5a421481617eae5d0d8bed1953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* { dg-require-effective-target vect_int } */

#include <stdarg.h>
#include "tree-vect.h"

#define N 8

unsigned short X[N];
unsigned short Y[N];
unsigned int result[N];

/* unsigned short->unsigned int widening-mult.  */
__attribute__ ((noinline, noclone)) void
foo (void)
{
  result[0] = (unsigned int) (X[0] * Y[0]);
  result[1] = (unsigned int) (X[1] * Y[1]);
  result[2] = (unsigned int) (X[2] * Y[2]);
  result[3] = (unsigned int) (X[3] * Y[3]);
  result[4] = (unsigned int) (X[4] * Y[4]);
  result[5] = (unsigned int) (X[5] * Y[5]);
  result[6] = (unsigned int) (X[6] * Y[6]);
  result[7] = (unsigned int) (X[7] * Y[7]);
}

int main (void)
{
  int i, tmp;

  check_vect ();

  for (i = 0; i < N; i++)
    {
      X[i] = i;
      Y[i] = 64-i;
    }

  foo ();

  for (i = 0; i < N; i++)
    {
      __asm__ volatile ("");
      tmp = X[i] * Y[i];
      if (result[i] != tmp)
        abort ();
    }

  return 0;
}

/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 8 "slp" { target vect_widen_mult_hi_to_si_pattern } } } */
/* { dg-final { scan-tree-dump-times "pattern recognized" 8 "slp" { target vect_widen_mult_hi_to_si_pattern } } } */
/* { dg-final { cleanup-tree-dump "slp" } } */