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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vect/] [vect-cselim-1.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 50
7
 
8
typedef struct {
9
  short a;
10
  short b;
11
} data;
12
 
13
data in1[N], in2[N], out[N];
14
short result[N*2] = {7,-7,9,-6,11,-5,13,-4,15,-3,17,-2,19,-1,21,0,23,1,25,2,27,3,29,4,31,5,33,6,35,7,37,8,39,9,41,10,43,11,45,12,47,13,49,14,51,15,53,16,55,17,57,18,59,19,61,20,63,21,65,22,67,23,69,24,71,25,73,26,75,27,77,28,79,29,81,30,83,31,85,32,87,33,89,34,91,35,93,36,95,37,97,38,99,39,101,40,103,41,105,42};
15
short out1[N], out2[N];
16
 
17
__attribute__ ((noinline)) void
18
foo ()
19
{
20
  int i;
21
  short c, d;
22
 
23
  /* Vectorizable with conditional store sinking.  */
24
  for (i = 0; i < N; i++)
25
    {
26
      c = in1[i].b;
27
      d = in2[i].b;
28
 
29
      if (c >= d)
30
        {
31
          out[i].b = c;
32
          out[i].a = d + 5;
33
        }
34
      else
35
        {
36
          out[i].b = d - 12;
37
          out[i].a = c + d;
38
        }
39
    }
40
 
41
  /* Not vectorizable.  */
42
  for (i = 0; i < N; i++)
43
    {
44
      c = in1[i].b;
45
      d = in2[i].b;
46
 
47
      if (c >= d)
48
        {
49
          out1[i] = c;
50
        }
51
      else
52
        {
53
          out2[i] = c + d;
54
        }
55
    }
56
}
57
 
58
int
59
main (void)
60
{
61
  int i;
62
 
63
  check_vect ();
64
 
65
  for (i = 0; i < N; i++)
66
    {
67
      in1[i].a = i;
68
      in1[i].b = i + 2;
69
      in2[i].a = 5;
70
      in2[i].b = i + 5;
71
      __asm__ volatile ("");
72
    }
73
 
74
  foo ();
75
 
76
  for (i = 0; i < N; i++)
77
    {
78
      if (out[i].a != result[2*i] || out[i].b != result[2*i+1])
79
        abort ();
80
    }
81
 
82
  return 0;
83
}
84
 
85
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { xfail { vect_no_align || { ! vect_strided2 } } } } } */
86
/* { 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.