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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-reduc-1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_int } */
2
 
3
#include <stdarg.h>
4
#include "tree-vect.h"
5
 
6
#define N 16
7
#define DIFF 242
8
 
9
unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
10
unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
11
 
12
/* Test vectorization of reduction of unsigned-int.  */
13
 
14
__attribute__ ((noinline))
15
void main1 (unsigned int x, unsigned int max_result, unsigned int min_result)
16
{
17
  int i;
18
  unsigned int udiff = 2;
19
  unsigned int umax = x;
20
  unsigned int umin = x;
21
 
22
  /* Summation.  */
23
  for (i = 0; i < N; i++) {
24
    udiff += (ub[i] - uc[i]);
25
  }
26
 
27
  /* Maximum.  */
28
  for (i = 0; i < N; i++) {
29
    umax = umax < uc[i] ? uc[i] : umax;
30
  }
31
 
32
  /* Minimum.  */
33
  for (i = 0; i < N; i++) {
34
    umin = umin > uc[i] ? uc[i] : umin;
35
  }
36
 
37
  /* check results:  */
38
  if (udiff != DIFF)
39
    abort ();
40
  if (umax != max_result)
41
    abort ();
42
  if (umin != min_result)
43
    abort ();
44
}
45
 
46
int main (void)
47
{
48
  check_vect ();
49
 
50
  main1 (100, 100, 1);
51
  main1 (0, 15, 0);
52
  return 0;
53
}
54
 
55
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail { vect_no_int_add || vect_no_int_max } } } } */
56
/* { 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.