summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/sve_vec_perm_3.c
blob: 4f70abd35e58be8f7441c6f70e226dcb826b0587 (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
43
44
45
46
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-vectorize -march=armv8-a+sve -msve-vector-bits=scalable" } */

#include <stdint.h>

#define VEC_PERM(TYPE)					\
TYPE __attribute__ ((weak))				\
vec_zip_##TYPE (TYPE *restrict a, TYPE *restrict b,	\
		TYPE *restrict c, long n)		\
{							\
  for (long i = 0; i < n; ++i)				\
    {							\
      a[i * 8] = c[i * 4];				\
      a[i * 8 + 1] = b[i * 4];				\
      a[i * 8 + 2] = c[i * 4 + 1];			\
      a[i * 8 + 3] = b[i * 4 + 1];			\
      a[i * 8 + 4] = c[i * 4 + 2];			\
      a[i * 8 + 5] = b[i * 4 + 2];			\
      a[i * 8 + 6] = c[i * 4 + 3];			\
      a[i * 8 + 7] = b[i * 4 + 3];			\
    }							\
}

#define TEST_ALL(T)				\
  T (int8_t)					\
  T (uint8_t)					\
  T (int16_t)					\
  T (uint16_t)					\
  T (int32_t)					\
  T (uint32_t)					\
  T (int64_t)					\
  T (uint64_t)					\
  T (float)					\
  T (double)

TEST_ALL (VEC_PERM)

/* { dg-final { scan-assembler-times {\tzip1\tz[0-9]+\.b, z[0-9]+\.b, z[0-9]+\.b\n} 24 } } */
/* { dg-final { scan-assembler-times {\tzip2\tz[0-9]+\.b, z[0-9]+\.b, z[0-9]+\.b\n} 24 } } */
/* { dg-final { scan-assembler-times {\tzip1\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 24 } } */
/* { dg-final { scan-assembler-times {\tzip2\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 24 } } */
/* Currently we can't use SLP for groups bigger than 128 bits.  */
/* { dg-final { scan-assembler-times {\tzip1\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 36 { xfail *-*-* } } } */
/* { dg-final { scan-assembler-times {\tzip2\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s\n} 36 { xfail *-*-* } } } */
/* { dg-final { scan-assembler-times {\tzip1\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 36 { xfail *-*-* } } } */
/* { dg-final { scan-assembler-times {\tzip2\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 36 { xfail *-*-* } } } */