]> git.ipfire.org Git - thirdparty/gcc.git/commit
Optimize a < 0 ? -1 : 0 to (signed)a >> 31.
authorliuhongt <hongtao.liu@intel.com>
Thu, 20 Jun 2024 04:41:13 +0000 (12:41 +0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 26 Jun 2024 03:12:44 +0000 (11:12 +0800)
commitaac00d09859cc5934bd0f7493d537b8430337773
treef98de0cf9615b66407c35161abdb2b25a37cf04c
parent01f8b1002147c08f206a058a6d1f7bfb006aa324
Optimize a < 0 ? -1 : 0 to (signed)a >> 31.

Try to optimize x < 0 ? -1 : 0 into (signed) x >> 31
and x < 0 ? 1 : 0 into (unsigned) x >> 31.

Move the optimization did in ix86_expand_int_vcond to match.pd

gcc/ChangeLog:

PR target/114189
* match.pd: Simplify a < 0 ? -1 : 0 to (signed) >> 31 and a <
0 ? 1 : 0 to (unsigned) a >> 31 for vector integer type.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx2-pr115517.c: New test.
* gcc.target/i386/avx512-pr115517.c: New test.
* g++.target/i386/avx2-pr115517.C: New test.
* g++.target/i386/avx512-pr115517.C: New test.
* g++.dg/tree-ssa/pr88152-1.C: Adjust testcase.
gcc/match.pd
gcc/testsuite/g++.dg/tree-ssa/pr88152-1.C
gcc/testsuite/g++.target/i386/avx2-pr115517.C [new file with mode: 0644]
gcc/testsuite/g++.target/i386/avx512-pr115517.C [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx2-pr115517.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512-pr115517.c [new file with mode: 0644]