summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx-vzeroupper-3.c
blob: 8053d787fea440006bf579e234d841a76279e978 (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
/* { dg-do run } */
/* { dg-require-effective-target avx } */
/* { dg-options "-O2 -mavx -mvzeroupper" } */

#include "avx-check.h"

int s[8] = {1, 2, 3, 4, 5, 6, 7, 8};
int d[8] = {11, 22, 33, 44, 55, 66, 77, 88};

void
__attribute__((noinline))
foo ()
{
  int i;
  for (i = 0; i < ARRAY_SIZE (d); i++)
    d[i] = s[i] + 0x1000;
}

static void
__attribute__((noinline))
bar (__m256i src)
{
  foo ();
  _mm256_storeu_si256 ((__m256i*) d, src);
  if (__builtin_memcmp (d, s, sizeof (d)))
    abort ();
}

static void
avx_test (void)
{
  __m256i src = _mm256_loadu_si256 ((__m256i*) s);
  bar (src);
}