aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr101384.c
blob: 7030c0a481e6326fa14884397782901f3a836cc7 (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
/* PR target/101384 */
/* { dg-do run } */
/* { dg-options "-O2 -Wno-psabi -w" } */

typedef unsigned char __attribute__((__vector_size__ (16))) U;
typedef unsigned short __attribute__((__vector_size__ (8 * sizeof (short)))) V;

U u;
V v;

__attribute__((noipa)) U
foo (void)
{
  U y = (U) { 0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff,
              0x80, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff } + u;
  return y;
}

__attribute__((noipa)) V
bar (void)
{
  V y = (V) { 0x8000, 0xffff, 0x8000, 0xffff,
              0x8000, 0xffff, 0x8000, 0xffff } + v;
  return y;
}

int
main ()
{
  U x = foo ();
  for (unsigned i = 0; i < 16; i++)
    if (x[i] != ((i & 3) ? 0xff : 0x80))
      __builtin_abort ();
  V y = bar ();
  for (unsigned i = 0; i < 8; i++)
    if (y[i] != ((i & 1) ? 0xffff : 0x8000))
      __builtin_abort ();
  return 0;
}