1/* PR target/54703 */
2/* { dg-do run { target sse2_runtime } } */
3/* { dg-options "-O -msse2" } */
4/* { dg-additional-options "-mavx -mtune=bdver1" { target avx_runtime } } */
5
6extern void abort (void);
7typedef double V __attribute__((vector_size(16)));
8
9union {
10  unsigned long long m[2];
11  V v;
12} u = { { 0xffffffffff000000ULL, 0xffffffffff000000ULL } };
13
14static inline V
15foo (V x)
16{
17  V y = __builtin_ia32_andpd (x, u.v);
18  V z = __builtin_ia32_subpd (x, y);
19  return __builtin_ia32_mulpd (y, z);
20}
21
22void
23test (V *x)
24{
25  V a = { 2.1, 2.1 };
26  *x = foo (foo (a));
27}
28
29int
30main ()
31{
32  test (&u.v);
33  if (u.m[0] != 0x3acbf487f0a30550ULL || u.m[1] != u.m[0])
34    abort ();
35  return 0;
36}
37