]> git.ipfire.org Git - thirdparty/gcc.git/commit
Reimplement packuswb/packusdw with UNSPEC_US_TRUNCATE instead of original us_truncate.
authorliuhongt <hongtao.liu@intel.com>
Wed, 14 Jun 2023 02:34:32 +0000 (10:34 +0800)
committerliuhongt <hongtao.liu@intel.com>
Mon, 19 Jun 2023 01:34:16 +0000 (09:34 +0800)
commit58e61a3ab1c13b6d5b07d86a30cf48a46e0345c8
treeebdefed46a7b070f4fd3b46738090d4f4cca13c3
parent81161d8a2e2ce1afc898e47bfe80dd04eb18f081
Reimplement packuswb/packusdw with UNSPEC_US_TRUNCATE instead of original us_truncate.

packuswb/packusdw does unsigned saturation for signed source, but rtl
us_truncate means does unsigned saturation for unsigned source.
So for value -1, packuswb will produce 0, but us_truncate produces
255. The patch reimplement those related patterns and functions with
UNSPEC_US_TRUNCATE instead of us_truncate.

gcc/ChangeLog:

PR target/110235
* config/i386/i386-expand.cc (ix86_split_mmx_pack): Use
UNSPEC_US_TRUNCATE instead of original us_truncate for
packusdw/packuswb.
* config/i386/mmx.md (mmx_pack<s_trunsuffix>swb): Substitute
with ..
(mmx_packsswb): .. this and ..
(mmx_packuswb): .. this.
(mmx_packusdw): Use UNSPEC_US_TRUNCATE instead of original
us_truncate.
(s_trunsuffix): Removed code iterator.
(any_s_truncate): Ditto.
* config/i386/sse.md (<sse2_avx2>_packuswb<mask_name>): Use
UNSPEC_US_TRUNCATE instead of original us_truncate.
(<sse4_1_avx2>_packusdw<mask_name>): Ditto.
* config/i386/i386.md (UNSPEC_US_TRUNCATE): New unspec_c_enum.
gcc/config/i386/i386-expand.cc
gcc/config/i386/i386.md
gcc/config/i386/mmx.md
gcc/config/i386/sse.md