summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c
blob: ad16a5329bf1bd9e800cb8831ce236346359ad1a (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* { dg-do run } */
/* { dg-require-effective-target avx } */
/* { dg-options "-O3 -dp -mavx -mavx256-split-unaligned-load" } */

#include "avx-check.h"

#define N 128

char **ep;
char **fp;
char **mp;
char **lp;

__attribute__ ((noinline))
void
foo (void)
{
  mp = (char **) malloc (N);
  lp = (char **) malloc (N);
  ep = (char **) malloc (N);
  fp = (char **) malloc (N);
}

void
avx_test (void)
{
  int i;
  char **ap, **bp, **cp, **dp;
  char *str = "STR";

  foo ();

  cp = mp;
  dp = lp;

  for (i = N; i >= 0; i--)
    {
      *cp++ = str;
      *dp++ = str;
    }

  ap = ep;
  bp = fp;
  cp = mp;
  dp = lp;

  for (i = N; i >= 0; i--)
    {
      *ap++ = *cp++;
      *bp++ = *dp++;
    }

  for (i = N; i >= 0; i--)
    {
      if (strcmp (*--ap, "STR") != 0)
	abort ();
      if (strcmp (*--bp, "STR") != 0)
	abort ();
    }
}