Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512fp16-builtin-minmax-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-Ofast -mavx512fp16 -mprefer-vector-width=512" } */
3
4 _Float16
5 minf1 (_Float16 a, _Float16 b)
6 {
7 return __builtin_fminf16 (a, b);
8 }
9
10 void
11 minf2 (_Float16* __restrict psrc1, _Float16* __restrict psrc2,
12 _Float16* __restrict pdst)
13 {
14 for (int i = 0; i != 32; i++)
15 pdst[i] = __builtin_fminf16 (psrc1[i], psrc2[i]);
16 }
17
18 _Float16
19 maxf1 (_Float16 a, _Float16 b)
20 {
21 return __builtin_fmaxf16 (a, b);
22 }
23
24 void
25 maxf2 (_Float16* __restrict psrc1, _Float16* __restrict psrc2,
26 _Float16* __restrict pdst)
27 {
28 for (int i = 0; i != 32; i++)
29 pdst[i] = __builtin_fmaxf16 (psrc1[i], psrc2[i]);
30 }
31
32 /* { dg-final { scan-assembler-times "vmaxsh\[^\n\r\]*xmm\[0-9\]" 1 } } */
33 /* { dg-final { scan-assembler-times "vmaxph\[^\n\r\]*zmm\[0-9\]" 1 } } */
34 /* { dg-final { scan-assembler-times "vminsh\[^\n\r\]*xmm\[0-9\]" 1 } } */
35 /* { dg-final { scan-assembler-times "vminph\[^\n\r\]*zmm\[0-9\]" 1 } } */