On Tue, 1 May 2012, Richard Henderson wrote: > On 04/27/2012 03:01 AM, Paolo Bonzini wrote: > > This patch teaches phiopt to look at phis whose arguments are -1 and 0, > > and produce negated setcc statements. > > Is this really a win over a COND_EXPR, i.e. (a < b ? -1 : 0)? > > There is quite a bit of logic inside the rtl and backend expansion of > cmove that would seem to be being bypassed by committing to this form.
Well, it's a choice of representation on GIMPLE. Allowing COND_EXPRs on the RHS is quite new (and does not play well with standard optimization passes). If RTL expansion logic prefers COND_EXPRs over the CFG/PHI style then we should see to present it with COND_EXPRs when we go out of SSA form (well we don't, but we do SSA name partitioning and certainly at that time we should adjust/optimize PHI nodes - also re-instantiating the now missing feature of splitting blocks to enable PHI argument CSE). Richard.