1 /* PR target/80286 */
2 /* { dg-do run { target avx } } */
3 /* { dg-options "-O2 -mavx" } */
4 
5 #include "avx-check.h"
6 #include <immintrin.h>
7 
8 __m256i m;
9 
10 __attribute__((noinline, noclone)) __m128i
foo(__m128i x)11 foo (__m128i x)
12 {
13   int s = _mm_cvtsi128_si32 (_mm256_castsi256_si128 (m));
14   return _mm_srli_epi16 (x, s);
15 }
16 
17 static void
avx_test(void)18 avx_test (void)
19 {
20   __m128i a = (__m128i) (__v8hi) { 1 << 7, 2 << 8, 3 << 9, 4 << 10, 5 << 11, 6 << 12, 7 << 13, 8 << 12 };
21   m = (__m256i) (__v8si) { 7, 8, 9, 10, 11, 12, 13, 14 };
22   __m128i c = foo (a);
23   __m128i b = (__m128i) (__v8hi) { 1, 2 << 1, 3 << 2, 4 << 3, 5 << 4, 6 << 5, 7 << 6, 8 << 5 };
24   if (__builtin_memcmp (&c, &b, sizeof (__m128i)))
25     __builtin_abort ();
26 }
27