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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [vshuf-main.inc] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* Driver fragment for __builtin_shuffle of any vector shape.  */
2
 
3
extern void abort (void);
4
 
5
#ifndef UNSUPPORTED
6
V a, b, c, d;
7
 
8
#define T(num, msk...) \
9
__attribute__((noinline, noclone)) void         \
10
test_##num (void)                               \
11
{                                               \
12
  VI mask = { msk };                            \
13
  int i;                                        \
14
  c = __builtin_shuffle (a, mask);              \
15
  d = __builtin_shuffle (a, b, mask);           \
16
  __asm ("" : : "r" (&c), "r" (&d) : "memory");  \
17
  for (i = 0; i < N; ++i)                       \
18
    if (c[i] != a[mask[i] & (N - 1)])           \
19
      abort ();                                 \
20
    else if ((mask[i] & N))                     \
21
      {                                         \
22
        if (d[i] != b[mask[i] & (N - 1)])       \
23
          abort ();                             \
24
      }                                         \
25
    else if (d[i] != a[mask[i] & (N - 1)])      \
26
      abort ();                                 \
27
}
28
TESTS
29
#ifdef EXPENSIVE
30
EXPTESTS
31
#endif
32
#endif
33
 
34
int
35
main ()
36
{
37
#ifndef UNSUPPORTED
38
  int i;
39
  for (i = 0; i < N; ++i)
40
    {
41
      a[i] = i + 2;
42
      b[i] = N + i + 2;
43
    }
44
 
45
#undef T
46
#define T(num, msk...) \
47
  test_##num ();
48
  TESTS
49
#ifdef EXPENSIVE
50
  EXPTESTS
51
#endif
52
#endif
53
 
54
  return 0;
55
}

powered by: WebSVN 2.1.0

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