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

--- Comment #1 from zhongyunde at tom dot com <zhongyunde at tom dot com> ---
this may can be enhance by ivopts.
If the case adjusted as following, then the 'and     w2, w2, 65535 ' will
disappear.


typedef unsigned int UINT32;
typedef unsigned short UINT16;


UINT16 array[12];

void foo (UINT32 len, UINT32 step)              
{
    UINT32 index = 0;
    UINT32 sum = 0;
    for (index = 0; index < len; index++ )
        {  
            array[index] = sum;
            sum += step;
        }
}

// the assemble of kernel loop body --------------------------
.L9:
        add     x2, x2, 2 // ivtmp.6, ivtmp.6,
.L3:
        strh    w3, [x4]        // sum, MEM[base: _12, offset: 0B]
        cmp     x2, x0    // ivtmp.6, _22
        add     w3, w3, w1        // sum, sum, step
        mov     x4, x2    // ivtmp.6, ivtmp.6
        bne     .L9             //,

Reply via email to