aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-widen-mult-const-u16.c
blob: e712da964239f75b9266467ee32d9c6f2c595607 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* { dg-require-effective-target vect_int } */

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

#define N 32

__attribute__ ((noinline)) void 
foo (unsigned int *__restrict a,
     unsigned short *__restrict b,
     int n)
{
  int i;

  for (i = 0; i < n; i++)
    a[i] = b[i] * 2333;

  for (i = 0; i < n; i++)
    if (a[i] != b[i] * 2333)
      abort ();
}

__attribute__ ((noinline)) void
bar (unsigned int *__restrict a,
     unsigned short *__restrict b,
     int n)
{
  int i;

  for (i = 0; i < n; i++)
    a[i] = (unsigned short) 2333 * b[i];

  for (i = 0; i < n; i++)
    if (a[i] != b[i] * (unsigned short) 2333)
      abort ();
}

__attribute__ ((noinline)) void
baz (unsigned int *__restrict a,
     unsigned short *__restrict b,
     int n)
{
  int i;

  for (i = 0; i < n; i++)
    a[i] = b[i] * 233333333;

  for (i = 0; i < n; i++)
    if (a[i] != b[i] * 233333333)
      abort ();
}


int main (void)
{
  int i;
  unsigned int a[N];
  unsigned short b[N];

  for (i = 0; i < N; i++)
    {
      a[i] = 0;
      b[i] = i;
      __asm__ volatile ("");
    }

  foo (a, b, N);
  bar (a, b, N);
  baz (a, b, N);
  return 0;
}

/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target vect_widen_mult_hi_to_si } } } */
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
/* { dg-final { scan-tree-dump-times "pattern recognized" 2 "vect" { target vect_widen_mult_hi_to_si_pattern } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */