https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101617
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- A few more canonicalization issues that need to be thought of: "a >>u (bitsize-1)" and "a <s 0" "a >>s (bitsize-1)" and "-(a <s 0)" (In reply to Andrew Pinski from comment #6) > Thinking about this some more, there is a canonicalization issue. We need to > decide if we want to canonicalization to just a ? -1 : 1; or expand it out. > a ? 1 : 0 makes sense to do (cast) a; So does "a ? 0 : 1". > > Does the current a ? -1 : 0 make sense or just add that to ifcvt. PR101339 is related to that canonicalization really. There are others. Even things like: (a == 0) + 2 Should that be: a == 0 ? 3 : 2 On the gimple level and then do the correct thing on the RTL level?