@@ -1163,7 +1164,8 @@ scalar_chain::convert_op (rtx *op, rtx_insn *insn)
else
{
gcc_assert (SUBREG_P (*op));
- gcc_assert (GET_MODE (*op) == vmode);
+ if (GET_MODE (*op) != V1TImode)
+ *op = gen_lowpart (V1TImode, *op);
Convert_op is shared by timode_scalar_chain (vmode=V1TImode) and
general_scalar_chain, hardcoded V1TImode may generate invalid rtx?
The vmode could be V2DImode(for ia32), and src now is V1TImode?
> -----Original Message-----
> From: Roger Sayle <[email protected]>
> Sent: Saturday, May 16, 2026 4:27 PM
> To: 'GCC Patches' <[email protected]>
> Cc: Liu, Hongtao <[email protected]>; 'Hongtao Liu'
> <[email protected]>; 'Uros Bizjak' <[email protected]>
> Subject: [x86_64 PING] Handle SUBREG conversions in TImode STV (for ptest).
>
>
> I'd like to ping/resubmit this patch from June 2023:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-June/622706.html
>
> Re-tested against mainline with no failures. The only change is to add -mno-
> stackrealign to the new test case, to keep STV happy on some operating
> systems. Ok for mainline?
>
>
> 2026-05-16 Roger Sayle <[email protected]>
>
> gcc/ChangeLog
> * config/i386/i386-features.cc (scalar_chain::add_insn): Don't
> call analyze_register_chain if the USE is a SUBREG.
> (timode_scalar_chain::convert_op): Call gen_lowpart to convert
> TImode SUBREGs to V1TImode SUBREGs.
> (convertible_comparison_p): We can now handle all general_operands
> of *cmp<dwi>_doubleword.
> (timode_remove_non_convertible_regs): We only need to check TImode
> uses that aren't TImode SUBREGs of registers in other modes.
>
> gcc/testsuite/ChangeLog
> * gcc.target/i386/sse4_1-ptest-7.c: New test case.
>
>
> Thanks in advance,
> Roger
> --