]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR target/110083: Fix-up REG_EQUAL notes on COMPARE in STV.
authorRoger Sayle <roger@nextmovesoftware.com>
Sun, 4 Jun 2023 10:59:32 +0000 (11:59 +0100)
committerRoger Sayle <roger@nextmovesoftware.com>
Sun, 4 Jun 2023 10:59:32 +0000 (11:59 +0100)
commit8ab9fb6b8e05cf9acca7bd8282979ede53524cf1
tree47eccd69ff3795762432fb5758802ecabff038bc
parent2415024e0f81f8c09bf08f947c790b43de9d0bbc
PR target/110083: Fix-up REG_EQUAL notes on COMPARE in STV.

This patch fixes PR target/110083, an ICE-on-valid regression exposed by
my recent PTEST improvements (to address PR target/109973).  The latent
bug (admittedly mine) is that the scalar-to-vector (STV) pass doesn't update
or delete REG_EQUAL notes attached to COMPARE instructions.  As a result
the operands of COMPARE would be mismatched, with the register transformed
to V1TImode, but the immediate operand left as const_wide_int, which is
valid for TImode but not V1TImode.  This remained latent when the STV
conversion converted the mode of the COMPARE to CCmode, with later passes
recognizing the REG_EQUAL note is obviously invalid as the modes didn't
match, but now that we (correctly) preserve the CCZmode on COMPARE, the
mismatched operand modes trigger a sanity checking ICE downstream.

Fixed by updating (or deleting) any REG_EQUAL notes in convert_compare.

Before:
    (expr_list:REG_EQUAL (compare:CCZ (reg:V1TI 119 [ ivin.29_38 ])
        (const_wide_int 0x80000000000000000000000000000000))

After:
    (expr_list:REG_EQUAL (compare:CCZ (reg:V1TI 119 [ ivin.29_38 ])
        (const_vector:V1TI [
            (const_wide_int 0x80000000000000000000000000000000)
         ]))

2023-06-04  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR target/110083
* config/i386/i386-features.cc (scalar_chain::convert_compare):
Update or delete REG_EQUAL notes, converting CONST_INT and
CONST_WIDE_INT immediate operands to a suitable CONST_VECTOR.

gcc/testsuite/ChangeLog
PR target/110083
* gcc.target/i386/pr110083.c: New test case.
gcc/config/i386/i386-features.cc
gcc/testsuite/gcc.target/i386/pr110083.c [new file with mode: 0644]