1/* PR rtl-optimization/70007 */
2/* { dg-do run { target bmi2 } } */
3/* { dg-options "-O -fgcse -mbmi2 -Wno-psabi" } */
4/* { dg-require-effective-target int128 } */
5
6#include "bmi2-check.h"
7
8typedef unsigned short v32u16 __attribute__ ((vector_size (32)));
9typedef unsigned long long v32u64 __attribute__ ((vector_size (32)));
10typedef unsigned __int128 u128;
11typedef unsigned __int128 v32u128 __attribute__ ((vector_size (32)));
12
13u128
14foo (v32u16 v32u16_0, v32u64 v32u64_0, v32u64 v32u64_1)
15{
16  do {
17    v32u16_0[13] |= v32u64_1[3] = (v32u64_1[3] >> 19) | (v32u64_1[3] << 45);
18    v32u64_1 %= ~v32u64_1;
19    v32u64_0 *= (v32u64) v32u16_0;
20  } while (v32u64_0[0]);
21  return v32u64_1[3];
22}
23
24static void
25bmi2_test ()
26{
27  u128 x = foo((v32u16){(unsigned short) ~0xba31, 0x47c6}, (v32u64){64}, (v32u64){0, 0x8b217e2514d23242, 0xac569b6dff9f82, 0x9d4cffe03c139c});
28  if (x != 0x3c74da5ca328d09)
29    __builtin_abort();
30}
31