https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91154

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> So pretty much undo all ifcvt into conditional moves (aka pretend the target
> doesn't have cmov) or something else?
> The problem is that cmov isn't unconditionally bad or unconditionally good
> and moving in either direction usually results in significant regressions. 
> cmov is good if the branch will be often badly predicted, so when the branch
> prediction is close to 50%, and is bad when it is usually well predicted.

I'd only do it for MAX<small-constant, x> and MIN<large-constant, x>.  There's
also another conditional move a few instructions up, not sure if cmove
density would be another thing to key on.

If target costing generally favors the cmp + if-then-else then we may also
simply advertise [us]{min,max} patterns here?  That said, RTL expansion
doesn't look at cost but only asks can_conditionally_move_p (mode) but
hopefully if-conversion considers actual rtx-cost.

Other ideas welcome of course.

Reply via email to