]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Fix up spaceship expanders for -mtune=i[45]86 [PR117053]
authorJakub Jelinek <jakub@redhat.com>
Fri, 11 Oct 2024 09:41:53 +0000 (11:41 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 11 Oct 2024 09:41:53 +0000 (11:41 +0200)
commitb0d624726cccdb855f9e1ba68edbd5c30913457b
treee5f659e0d687f41ba8d176d39560ce8d639ed26f
parentaa4c55b13049cbd282cc0e043cc3e45423fdd6de
i386: Fix up spaceship expanders for -mtune=i[45]86 [PR117053]

The adjusted and new spaceship expanders ICE with -mtune=i486 or
-mtune=i586.
The problem is that in that case TARGET_ZERO_EXTEND_WITH_AND is true
and zero_extendqisi2 isn't allowed in that case, and we can't use
the replacement AND, because that clobbers flags and we want to use them
again.

The following patch fixes that by using in those cases roughly what
we want to expand it to after peephole2 optimizations, i.e. xor
before the comparison, *setcc_qi_slp and sbbl $0 (or for signed
int case xoring of 2 regs, two *setcc_qi_slp, subl).
For *setcc_qi_slp, it uses the setcc_si_slp hacks with UNSPEC that
were in use for the floating point jp case (so such code is IMHO
undesirable for the !TARGET_ZERO_EXTEND_WITH_AND case as we want to
give combiner more liberty in that case).

2024-10-11  Jakub Jelinek  <jakub@redhat.com>

PR target/117053
* config/i386/i386-expand.cc (ix86_expand_fp_spaceship): Handle
TARGET_ZERO_EXTEND_WITH_AND differently.
(ix86_expand_int_spaceship): Likewise.

* g++.target/i386/pr116896-3.C: New test.
gcc/config/i386/i386-expand.cc
gcc/testsuite/g++.target/i386/pr116896-3.C [new file with mode: 0644]