On Fri, Nov 25, 2022 at 01:39:04PM +0800, liuhongt wrote: > Update in V3: > Remove !flag_signaling_nans since there's already HONOR_NANS (BFmode). > > Here's the patch: > > After supporting real __bf16, the implementation of _mm_cvtsbh_ss went > wrong. > > The patch add a builtin to generate pslld for the intrinsic, also > extendbfsf2 is supported with pslld when !HONOR_NANS (BFmode). > > truncsfbf2 is supported with vcvtneps2bf16 when > !HONOR_NANS (BFmode) && flag_unsafe_math_optimizations. > > gcc/ChangeLog: > > PR target/107748 > * config/i386/avx512bf16intrin.h (_mm_cvtsbh_ss): Refined. > * config/i386/i386-builtin-types.def (FLOAT_FTYPE_BFLOAT16): > New function type. > * config/i386/i386-builtin.def (BDESC): New builtin. > * config/i386/i386-expand.cc (ix86_expand_args_builtin): > Handle the builtin. > * config/i386/i386.md (extendbfsf2): New expander. > (extendbfsf2_1): New define_insn. > (truncsfbf2): Ditto. > > gcc/testsuite/ChangeLog: > > * gcc.target/i386/avx512bf16-cvtsbh2ss-1.c: Scan pslld. > * gcc.target/i386/extendbfsf.c: New test.
LGTM. Jakub