aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fold-vecperm-1.c
blob: 878d3920803dd277ae24ab4fedea8189bb15e040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-forwprop3" } */

typedef int v4si __attribute__((vector_size(16)));
typedef short v8hi __attribute__((vector_size(16)));

typedef union {
  v4si s;
  v8hi h;
} int128;

int128 concat (int128 a, int128 b) {
  int128 x, y, res;
  v4si zero = { 0, 0, 0, 0 };
  v4si sel0 = { 3, 4, 5, 6 };
  v8hi sel1 = { 0, 1, 10, 11, 12, 13, 14, 15 };
  x.s = __builtin_shuffle (a.s, zero, sel0);
  y.s = __builtin_shuffle (zero, b.s, sel0);
  res.h = __builtin_shuffle (x.h, y.h, sel1);
  return res;
}

/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 1 "forwprop3" } } */