]> git.ipfire.org Git - thirdparty/gcc.git/commit
Guard truncate from vector float to vector __bf16 with !flag_rounding_math && HONOR_N...
authorliuhongt <hongtao.liu@intel.com>
Thu, 7 Nov 2024 02:15:42 +0000 (18:15 -0800)
committerliuhongt <hongtao.liu@intel.com>
Mon, 11 Nov 2024 02:20:23 +0000 (18:20 -0800)
commitde867e8da30bf5e0cb51c3946ec43c3c4778d4a0
tree0fdb1dfc26d2e7121de3e339ea2abc63fcfaf45d
parentca1cff0c924dfce7d7792dbeab978bbbf65df0fa
Guard truncate from vector float to vector __bf16 with !flag_rounding_math && HONOR_NANS (BFmode).

hw instruction doesn't raise exceptions, turns sNAN into qNAN quietly,
and always round to nearest (even). Output denormals are always
flushed to zero and input denormals are always treated as zero. MXCSR
is not consulted nor updated.
W/o native instructions, flag_unsafe_math_optimizations is needed for
the permutation instructions.
Similar guard extend from vector __bf16 to vector float with
!HONOR_NANS (BFmode).

gcc/ChangeLog:

* config/i386/i386.md (truncsf2bf2): Add !flag_rounding_math
to the condition, require flag_unsafe_math_optimizations when
native instruction is not available.
* config/i386/mmx.md: (truncv2sfv2bf2): Ditto.
(extendv2bfv2sf2): Add !HONOR_NANS (BFmode) to the condition.
* config/i386/sse.md: (truncv4sfv4sf2): Add
!flag_rounding_math to the condition, require
flag_unsafe_math_optimizations when native instruction is not
available.
(truncv8sfv8bf2): Ditto.
(truncv16sfv16bf2): Ditto.
(extendv4bfv4sf2): Add !HONOR_NANS (BFmode) to the condition.
(extendv8bfv8sf2): Ditto.
(extendv16bfv16sf2): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512bf16-truncsfbf.c: Add -ffast-math.
* gcc.target/i386/avx512bw-extendbf2sf.c: Ditto.
* gcc.target/i386/avx512bw-truncsfbf.c: Ditto.
* gcc.target/i386/sse2-extendbf2sf.c: Ditto.
* gcc.target/i386/ssse3-truncsfbf.c: Ditto.
gcc/config/i386/i386.md
gcc/config/i386/mmx.md
gcc/config/i386/sse.md
gcc/testsuite/gcc.target/i386/avx512bf16-truncsfbf.c
gcc/testsuite/gcc.target/i386/avx512bw-extendbf2sf.c
gcc/testsuite/gcc.target/i386/avx512bw-truncsfbf.c
gcc/testsuite/gcc.target/i386/sse2-extendbf2sf.c
gcc/testsuite/gcc.target/i386/ssse3-truncsfbf.c