Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr106010-8b.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx -ftree-vectorize -fvect-cost-model=unlimited -mprefer-vector-width=256" } */
3 /* { dg-require-effective-target avx } */
4
5 #include "avx-check.h"
6 #include <string.h>
7 #include "pr106010-8a.c"
8
9 void
10 avx_test (void)
11 {
12 _Complex double pd_src = 1.0 + 2.0i;
13 _Complex double* pd_dst = (_Complex double*) malloc (2 * N * sizeof (double));
14 _Complex float ps_src = 1.0 + 2.0i;
15 _Complex float* ps_dst = (_Complex float*) malloc (2 * N * sizeof (float));
16 _Complex long long epi64_src = 1 + 2i;;
17 _Complex long long* epi64_dst = (_Complex long long*) malloc (2 * N * sizeof (long long));
18 _Complex int epi32_src = 1 + 2i;
19 _Complex int* epi32_dst = (_Complex int*) malloc (2 * N * sizeof (int));
20 _Complex short epi16_src = 1 + 2i;
21 _Complex short* epi16_dst = (_Complex short*) malloc (2 * N * sizeof (short));
22 _Complex char epi8_src = 1 + 2i;
23 _Complex char* epi8_dst = (_Complex char*) malloc (2 * N * sizeof (char));
24
25 __builtin_memset (pd_dst, 0, 2 * N * sizeof (double));
26 __builtin_memset (ps_dst, 0, 2 * N * sizeof (float));
27 __builtin_memset (epi64_dst, 0, 2 * N * sizeof (long long));
28 __builtin_memset (epi32_dst, 0, 2 * N * sizeof (int));
29 __builtin_memset (epi16_dst, 0, 2 * N * sizeof (short));
30 __builtin_memset (epi8_dst, 0, 2 * N * sizeof (char));
31
32 foo_pd (pd_dst);
33 foo_ps (ps_dst);
34 foo_epi64 (epi64_dst);
35 foo_epi32 (epi32_dst);
36 foo_epi16 (epi16_dst);
37 foo_epi8 (epi8_dst);
38 for (int i = 0 ; i != N; i++)
39 {
40 if (pd_dst[i] != pd_src)
41 __builtin_abort ();
42 if (ps_dst[i] != ps_src)
43 __builtin_abort ();
44 if (epi64_dst[i] != epi64_src)
45 __builtin_abort ();
46 if (epi32_dst[i] != epi32_src)
47 __builtin_abort ();
48 if (epi16_dst[i] != epi16_src)
49 __builtin_abort ();
50 if (epi8_dst[i] != epi8_src)
51 __builtin_abort ();
52 }
53 }