On Thu, Mar 07, 2024 at 10:04:32PM +0100, Uros Bizjak wrote: [snip]
> The part we want to fix deals with the *user* of the CC register. It > is not true that this is always COMPARISON_P, so EQ, NE, GE, LT, ... > in the form of > > (LT:CCGC (reg:CCGC 17 flags) (const_int 0)) > > but can be something else, such as the above noted > > (unspec:DI [ > (reg:CC 17 flags) > ] UNSPEC_PUSHFL) But that is invalid RTL? The only valid use of a CC is written as cc-compared-to-0. It means "the result of something compared to 0, stored in that cc reg". (And you can copy a CC reg around, but that is not a use ;-) ) > The source code that deals with the *user* of the CC register assumes > the former form, so it blindly tries to update the mode of the CC > register inside LT comparison RTX Would you like it better if there was an assert for this? There are very many RTL requirements that aren't chacked for currently :-/ > (some other nearby source code even > checks for (const_int 0) RTX). Obviously, this is not the case with > the former form, where the update tries to: > > SUBST (XEXP (*cc_use_loc, 0), ...) > > on unspec, which has no XEXP (..., 0). > > And *this* is what triggers RTX checking assert. The unspec should have the CC compared with 0 as argument. Segher