James Greenhalgh wrote:

> -  /* Do not allow wide int constants - this requires support in movti.  */
> +  /* Only allow simple 128-bit immediates.  */
>    if (CONST_WIDE_INT_P (x))
> -    return false;
> +    return aarch64_mov128_immediate (x);

> I can see why this could be correct, but it is unclear why it is neccessary
> to fix the bug. What goes wrong if we leave this as "return false".

It's not necessary, things only go wrong if you return true for a wider set of
immediates than those directly supported by the movti pattern - and that may
be a regalloc issue.

However removing it (returning false in all cases) actually improves code 
quality
due to a bug in memset expansion. Therefore I'll commit it as returning false
for now (there was no change in test results) and update it once memset is fixed
and inlining works as expected.

Returning true means memset(p, 32, 63) expands as:

        mov     x2, 2314885530818453536
        mov     x3, 2314885530818453536
        mov     x6, 2314885530818453536
        mov     w5, 538976288
        mov     w4, 8224
        mov     w1, 32
        stp     x2, x3, [x0]
        stp     x2, x3, [x0, 16]
        stp     x2, x3, [x0, 32]
        str     x6, [x0, 48]
        str     w5, [x0, 56]
        strh    w4, [x0, 60]
        strb    w1, [x0, 62]
        ret

Wilco

    

Reply via email to