On Thu, Jul 14, 2022 at 6:58 PM Roger Sayle <ro...@nextmovesoftware.com> wrote:
>
>
> This patch resolves PR target/106278 a regression on x86_64 caused by my
> recent TImode STV improvements.  Now that TImode STV can handle comparisons
> such as "(set (regs:CC) (compare:CC (reg:TI) ...))" the convert_insn method
> sensibly checks that the mode of the SET_DEST is TImode before setting
> it to V1TImode [to avoid V1TImode appearing on the hard reg CC_FLAGS.
>
> Hence the current code looks like:
>
>       if (GET_MODE (dst) == TImode)
>         {
>           tmp = find_reg_equal_equiv_note (insn);
>           if (tmp && GET_MODE (XEXP (tmp, 0)) == TImode)
>             PUT_MODE (XEXP (tmp, 0), V1TImode);
>           PUT_MODE (dst, V1TImode);
>           fix_debug_reg_uses (dst);
>         }
>       break;
>
> which checks GET_MODE (dst) before calling PUT_MODE, and when a
> change is made updating the REG_EQUAL_NOTE tmp if it exists.
>
> The logical flaw (oversight) is that due to RTL sharing, the destination
> of this set may already have been updated to V1TImode, as this chain is
> being converted, but we still need to update any REG_EQUAL_NOTE that
> still has TImode.  Hence the correct code is actually:
>
>
>       if (GET_MODE (dst) == TImode)
>         {
>           PUT_MODE (dst, V1TImode);
>           fix_debug_reg_uses (dst);
>         }
>       if (GET_MODE (dst) == V1TImode)
>         {
>           tmp = find_reg_equal_equiv_note (insn);
>           if (tmp && GET_MODE (XEXP (tmp, 0)) == TImode)
>             PUT_MODE (XEXP (tmp, 0), V1TImode);
>         }
>       break;
>
> While fixing this behavior, I noticed I had some indentation whitespace
> issues and some vestigial dead code in this function/method that I've
> taken the liberty of cleaning up (as obvious) in this patch.

While it is desired to fix cosmetic issues, those kinds of changes
unnecessarily make review of the patch more difficult.

> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check, both with and without --target_board=unix{-m32},
> with no new failures.  Ok for mainline?

OK, but please do not mix cleanups with the functional changes.
Cleanups should be separated to a follow-up patch.

Thanks,
Uros.

>
>
> 2022-07-14  Roger Sayle  <ro...@nextmovesoftware.com>
>
> gcc/ChangeLog
>         PR target/106278
>         * config/i386/i386-features.cc (general_scalar_chain::convert_insn):
>         Fix indentation whitespace.
>         (timode_scalar_chain::fix_debug_reg_uses): Likewise.
>         (timode_scalar_chain::convert_insn): Delete dead code.
>         Update TImode REG_EQUAL_NOTE even if the SET_DEST is already V1TI.
>         Fix indentation whitespace.
>         (convertible_comparison_p): Likewise.
>         (timode_scalar_to_vector_candidate_p): Likewise.
>
> gcc/testsuite/ChangeLog
>         PR target/106278
>         * gcc.dg/pr106278.c: New test case.
>
>
> Thanks in advance,
> Roger
> --
>

Reply via email to