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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-reduc-2.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 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 240
8
 
9
/* Test vectorization of reduction of signed-int.  */
10
 
11
void main1 (int x, int max_result, int min_result)
12
{
13
  int i;
14
  int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
15
  int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
16
  int diff = 0;
17
  int max = x;
18
  int min = x;
19
 
20
  for (i = 0; i < N; i++) {
21
    diff += (b[i] - c[i]);
22
  }
23
 
24
  for (i = 0; i < N; i++) {
25
    max = max < c[i] ? c[i] : max;
26
  }
27
 
28
  for (i = 0; i < N; i++) {
29
    min = min > c[i] ? c[i] : min;
30
  }
31
 
32
  /* check results:  */
33
  if (diff != DIFF)
34
    abort ();
35
  if (max != max_result)
36
    abort ();
37
  if (min != min_result)
38
    abort ();
39
}
40
 
41
int main (void)
42
{
43
  check_vect ();
44
 
45
  main1 (100, 100, 1);
46
  main1 (0, 15, 0);
47
  return 0;
48
}
49
 
50
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail { vect_no_int_add || vect_no_int_max } } } } */
51
/* { 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.