summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/aarch64/pr103350-2.c
blob: 2696212710b9da1c065cd26d26dd9f09719cf9e9 (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
47
48
49
50
51
52
53
/* { dg-do run } */
/* { dg-additional-options "-O2 -save-temps -fdump-rtl-ree-all -free -std=c99 -w" } */

typedef unsigned char __attribute__((__vector_size__ (8))) v64u8;
typedef unsigned char __attribute__((__vector_size__ (16))) v128u8;
typedef unsigned short __attribute__((__vector_size__ (8))) v64u16;
typedef unsigned short __attribute__((__vector_size__ (64))) v512u16;
typedef unsigned int __attribute__((__vector_size__ (16))) v128u32;
typedef unsigned long long u64;
typedef unsigned long long __attribute__((__vector_size__ (8))) v64u64;
typedef unsigned long long __attribute__((__vector_size__ (16))) v128u64;
typedef unsigned __int128 u128;
typedef unsigned __int128 __attribute__((__vector_size__ (64))) v512u128;
v512u16 foo0_v512u16_0;
u64 foo0_u64_0;
u64 foo0_u16_0;

void
foo0 (v64u16 v64u16_0, v64u64 v64u64_0, u128 u128_0, v64u8 * ret)
{
  /* { 0, 4, 0, 0 } */
  v128u32 v128u32_2 = __builtin_convertvector (v64u16_0, v128u32);
  /* 0 */
  foo0_u16_0 ^= foo0_u64_0 % u128_0;
  /* { 0, ... } */
  foo0_v512u16_0 *=
    __builtin_shufflevector (v64u16_0, v64u16_0, 7, 7, 2, 1, 0, 0, 3, 6, 2, 3,
			     1, 0, 7, 5, 6, 7, 4, 3, 2, 3, 0, 6, 1, 2, 3, 3,
			     6, 7, 6, 2, 4, 3);
  /* { 0, 0, 0, 0, 4, 0, ... } */
  v128u8 v128u8_r = (v128u8) ((v512u128) foo0_v512u16_0)[0] +
    (v128u8) v128u32_2;
  /* { 0, 0, 4, 0, 4, 0, 0, 0 } */
  v64u8 v64u8_r = (v64u8) ((v128u64) v128u8_r)[0] +
    (v64u8) v64u16_0 + (v64u8) v64u64_0;
  *ret = v64u8_r;
}

int
main (void)
{
  v64u8 x, exp = (v64u8){ 0, 0, 4, 0, 4, 0, 0, 0 };
  foo0 ((v64u16){0, 4}, (v64u64){}, 5, &x);
  /*
  for (unsigned i = 0; i < sizeof (x); i++)
    __builtin_printf ("%02x", x[i]);
  */
  for (unsigned i = 0; i < sizeof (x); i++)
    if (x[i] != exp[i]) __builtin_abort();
  return 0;
}

/* { dg-final { scan-rtl-dump {because some vector uses aren't extension} ree } } */