Fix incorrect _mm_cvtsbh_ss.
authorliuhongt <hongtao.liu@intel.com>
Wed, 23 Nov 2022 13:58:09 +0000 (21:58 +0800)
committerliuhongt <hongtao.liu@intel.com>
Mon, 28 Nov 2022 01:02:51 +0000 (09:02 +0800)
commita1ecc5600464f6a62faab246d522b6328badda90
tree0a9e0bae6c2827b439590d8b1353d89f3c4a2334
parent14d11df96336e9d06a4c8108b61815ad94866519
Fix incorrect _mm_cvtsbh_ss.

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.
gcc/config/i386/avx512bf16intrin.h
gcc/config/i386/i386-builtin-types.def
gcc/config/i386/i386-builtin.def
gcc/config/i386/i386-expand.cc
gcc/config/i386/i386.md
gcc/testsuite/gcc.target/i386/avx512bf16-cvtsbh2ss-1.c
gcc/testsuite/gcc.target/i386/extendbfsf.c [new file with mode: 0644]