forked from gcc-mirror/gcc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AVX512FP16: Add expander for smin/maxhf3.
gcc/ChangeLog: * config/i386/i386.md (<code>hf3): New expander. gcc/testsuite/ChangeLog: * gcc.target/i386/avx512fp16-builtin-minmax-1.c: New test.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
gcc/testsuite/gcc.target/i386/avx512fp16-builtin-minmax-1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* { dg-do compile } */ | ||
/* { dg-options "-Ofast -mavx512fp16 -mprefer-vector-width=512" } */ | ||
|
||
_Float16 | ||
minf1 (_Float16 a, _Float16 b) | ||
{ | ||
return __builtin_fminf16 (a, b); | ||
} | ||
|
||
void | ||
minf2 (_Float16* __restrict psrc1, _Float16* __restrict psrc2, | ||
_Float16* __restrict pdst) | ||
{ | ||
for (int i = 0; i != 32; i++) | ||
pdst[i] = __builtin_fminf16 (psrc1[i], psrc2[i]); | ||
} | ||
|
||
_Float16 | ||
maxf1 (_Float16 a, _Float16 b) | ||
{ | ||
return __builtin_fmaxf16 (a, b); | ||
} | ||
|
||
void | ||
maxf2 (_Float16* __restrict psrc1, _Float16* __restrict psrc2, | ||
_Float16* __restrict pdst) | ||
{ | ||
for (int i = 0; i != 32; i++) | ||
pdst[i] = __builtin_fmaxf16 (psrc1[i], psrc2[i]); | ||
} | ||
|
||
/* { dg-final { scan-assembler-times "vmaxsh\[^\n\r\]*xmm\[0-9\]" 1 } } */ | ||
/* { dg-final { scan-assembler-times "vmaxph\[^\n\r\]*zmm\[0-9\]" 1 } } */ | ||
/* { dg-final { scan-assembler-times "vminsh\[^\n\r\]*xmm\[0-9\]" 1 } } */ | ||
/* { dg-final { scan-assembler-times "vminph\[^\n\r\]*zmm\[0-9\]" 1 } } */ |