Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512fp16-64-32-vecop-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mavx512fp16 -mavx512vl" } */
3
4 /* { dg-final { scan-assembler-times "vaddph" 2 { target { ! ia32 } } } } */
5 /* { dg-final { scan-assembler-times "vsubph" 2 { target { ! ia32 } } } } */
6 /* { dg-final { scan-assembler-times "vmulph" 2 { target { ! ia32 } } } } */
7 /* { dg-final { scan-assembler-times "vdivph" 2 { target { ! ia32 } } } } */
8
9 #define DO_PRAGMA(X) _Pragma(#X)
10
11 #define VEC_OP_VV(size, op, name) \
12 void \
13 __attribute__ ((noinline, noclone, optimize("tree-slp-vectorize"))) \
14 vecop_v##size##hf##name (_Float16 * restrict dst, \
15 _Float16 * restrict src1, _Float16 * restrict src2) \
16 { \
17 int i; \
18 DO_PRAGMA (GCC unroll size) \
19 for (i = 0; i < size; i++) \
20 dst[i] = src1[i] op src2[i]; \
21 }
22
23 VEC_OP_VV(4, +, add)
24 VEC_OP_VV(2, +, add)
25 VEC_OP_VV(4, -, sub)
26 VEC_OP_VV(2, -, sub)
27 VEC_OP_VV(4, *, mul)
28 VEC_OP_VV(2, *, mul)
29 VEC_OP_VV(4, /, div)
30 VEC_OP_VV(2, /, div)