OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [no-scevccp-outer-7.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 16
7
 
8
unsigned short in[N];
9
unsigned short coef[N];
10
unsigned short a[N];
11
 
12
__attribute__ ((noinline)) unsigned int
13
foo (short scale){
14
  int i;
15
  unsigned short j;
16
  unsigned int sum = 0;
17
  unsigned short sum_j;
18
 
19
  for (i = 0; i < N; i++) {
20
    sum_j = 0;
21
    for (j = 0; j < N; j++) {
22
      sum_j += j;
23
    }
24
    a[i] = sum_j;
25
    sum += ((unsigned int) in[i] * (unsigned int) coef[i]) >> scale;
26
  }
27
  return sum;
28
}
29
 
30
unsigned short
31
bar (void)
32
{
33
  unsigned short j;
34
  unsigned short sum_j;
35
 
36
  sum_j = 0;
37
  for (j = 0; j < N; j++) {
38
    sum_j += j;
39
  }
40
 
41
  return sum_j;
42
}
43
 
44
int main (void)
45
{
46
  int i;
47
  unsigned short j, sum_j;
48
  unsigned int sum = 0;
49
  unsigned int res;
50
 
51
  check_vect ();
52
 
53
  for (i=0; i<N; i++){
54
    in[i] = 2*i;
55
    coef[i] = i;
56
  }
57
 
58
  res = foo (2);
59
 
60
  /* check results:  */
61
  for (i=0; i<N; i++)
62
    {
63
      if (a[i] != bar ())
64
        abort ();
65
      sum += ((unsigned int) in[i] * (unsigned int) coef[i]) >> 2;
66
    }
67
  if (res != sum)
68
    abort ();
69
 
70
  return 0;
71
}
72
 
73
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { target vect_widen_mult_hi_to_si } } } */
74
/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 1 "vect" } } */
75
/* { dg-final { cleanup-tree-dump "vect" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.