Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr106010-2c.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512fp16 -mavx512vl -ftree-vectorize -fvect-cost-model=unlimited -mprefer-vector-width=256 -fdump-tree-slp-details" } */
3 /* { dg-require-effective-target avx512fp16 } */
4
5 /* { dg-final { scan-tree-dump-times {(?n)add new stmt:.*MEM <vector\(16\) _Float16>} 2 "slp2" } } */
6 /* { dg-final { scan-tree-dump-times "basic block part vectorized using (?:32|64) byte vectors" 1 "slp2" } }*/
7
8 #include <string.h>
9
10 static void do_test (void);
11 #define DO_TEST do_test
12 #define AVX512FP16
13 #include "avx512-check.h"
14
15 void
16 __attribute__((noipa))
17 foo_ph (_Complex _Float16* a, _Complex _Float16* __restrict b)
18 {
19 a[0] = b[0];
20 a[1] = b[1];
21 a[2] = b[2];
22 a[3] = b[3];
23 a[4] = b[4];
24 a[5] = b[5];
25 a[6] = b[6];
26 a[7] = b[7];
27 }
28
29 void
30 do_test (void)
31 {
32 _Complex _Float16* ph_src = (_Complex _Float16*) malloc (32);
33 _Complex _Float16* ph_dst = (_Complex _Float16*) malloc (32);
34 char* p = (char* ) malloc (32);
35
36 __builtin_memset (ph_dst, 0, 32);
37
38 for (int i = 0; i != 32; i++)
39 p[i] = i;
40 __builtin_memcpy (ph_src, p, 32);
41
42 foo_ph (ph_dst, ph_src);
43 if (__builtin_memcmp (ph_dst, ph_src, 32) != 0)
44 __builtin_abort ();
45
46 return;
47 }