OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-cond-3.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-require-effective-target vect_condition } */
2
 
3
#include <stdlib.h> 
4
#include <stdio.h> 
5
#include "tree-vect.h"
6
 
7
#define M 32
8
#define N 16
9
 
10
int x_in[M];
11
int x_out_a[M], x_out_b[M];
12
int c[N] = {3,2,1,10,1,42,3,4,50,9,32,8,11,10,1,2};
13
int a[N+1] = {0,16,32,48,64,128,256,512,0,16,32,48,64,128,256,512,1024};
14
int b[N+1] = {17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
15
int check_result_a[M] = {1024,1024,1024,256,256,256,256,256,256,256,256,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48};
16
int check_result_b[M] = {17,17,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
17
 
18
__attribute__ ((noinline)) void
19
foo ()
20
{
21
  int j, i, x;
22
  int curr_a, flag, next_a, curr_b, next_b;
23
 
24
  for (j = 0; j < M; j++)
25
    {
26
      x = x_in[j];
27
      curr_a = a[0];
28
      curr_b = b[0];
29
 
30
      for (i = 0; i < N; i++)
31
        {
32
          flag = x > c[i];
33
          next_a = a[i+1];
34
          next_b = b[i+1];
35
          curr_a = flag ? curr_a : next_a;
36
          curr_b = flag ? next_b : curr_b;
37
        }
38
 
39
      x_out_a[j] = curr_a;
40
      x_out_b[j] = curr_b;
41
    }
42
}
43
 
44
int main (void)
45
{
46
  int i,j;
47
 
48
  check_vect ();
49
 
50
  for (j = 0; j < M; j++)
51
    x_in[j] = j;
52
 
53
  foo ();
54
 
55
  for (j = 0; j < M; j++)
56
    if (x_out_a[j] != check_result_a[j]
57
        || x_out_b[j] != check_result_b[j])
58
      abort ();
59
 
60
  return 0;
61
}
62
 
63
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
64
/* { dg-final { cleanup-tree-dump "vect" } } */
65
 
66
 

powered by: WebSVN 2.1.0

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