On 20/07/16 14:40, Wilco Dijkstra wrote:
> Richard Earnshaw wrote:
>> Why does combine care what the cost is if the instruction isn't valid?
> 
> No idea. Combine does lots of odd things that don't make sense to me. 
> Unfortunately the costs we give for cases like this need to be accurate or
> they negatively affect code quality. The reason for this patch was to fix
> some unexpected slowdowns caused by the cost for zero_extend being
> too high.
> 
> Wilco
> 

Well if I take your testcase and plug it into a fairly recent gcc I get:

x:
        mov     w1, 20
        umull   x0, w0, w1
        ret

If I change the constant to 33, I then get:

x:
        uxtw    x0, w0
        add     x0, x0, x0, lsl 5
        ret

Both of which look reasonable to me.

Reply via email to