aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/sparc/bmaskbshuf-2.c
blob: 874e3db9982bbaceb9e0dcb4abceec8afed6f8a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* { dg-do run } */
/* { dg-require-effective-target ultrasparc_vis2_hw } */
/* { dg-options "-mcpu=ultrasparc3 -O" } */

typedef unsigned int Vect __attribute__((vector_size(8)));

extern void abort (void);

Vect a, b, c, d;

__attribute__((noinline, noclone)) void test (void)
{
  Vect mask = { 2, 2 };
  int i;

  c = __builtin_shuffle (a, mask);
  d = __builtin_shuffle (a, b, mask);

  __asm__ ("" : : "r" (&c), "r" (&d) : "memory");

  for (i = 0; i < 2; ++i)
    if (c[i] != a[mask[i] & 1])
      abort ();
    else if (mask[i] & 2)
      {
	if (d[i] != b[mask[i] & 1])
	  abort ();
      }
}

int main (void)
{
  int i;
  for (i = 0; i < 2; ++i)
    {
      a[i] = i + 2;
      b[i] = 2 + i + 2;
    }

  test ();
  return 0;
}