2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-pr64286.c
blob2edb3210c4b810a59bb501c8c850b3e6b9c1d689
1 /* PR rtl-optimization/64286 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -mavx2" } */
4 /* { dg-require-effective-target avx2 } */
6 #include <string.h>
7 #include <stdlib.h>
8 #include <x86intrin.h>
9 #include "avx2-check.h"
11 __m128i v;
12 __m256i w;
14 __attribute__((noinline, noclone)) void
15 foo (__m128i *p, __m128i *q)
17 __m128i a = _mm_loadu_si128 (p);
18 __m128i b = _mm_xor_si128 (a, v);
19 w = _mm256_cvtepu8_epi16 (a);
20 *q = b;
23 static void
24 avx2_test (void)
26 v = _mm_set1_epi8 (0x40);
27 __m128i c = _mm_set_epi8 (16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
28 __m128i d;
29 foo (&c, &d);
30 __m128i e = _mm_set_epi8 (0x50, 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49,
31 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41);
32 __m256i f = _mm256_set_epi16 (16, 15, 14, 13, 12, 11, 10, 9,
33 8, 7, 6, 5, 4, 3, 2, 1);
34 if (memcmp (&w, &f, sizeof (w)) != 0
35 || memcmp (&d, &e, sizeof (d)) != 0)
36 abort ();