This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM57L843: Use of MLA instruction at Optimization Level -Og

Part Number: RM57L843

Tool/software:

int myfunc(int num) {
    int x,i;
    for(i=0; i<10; i++)
    {
      x= (num*num)+i;
    }
    return x;
}

For the sample code above, I am using ARM GCC 10.2.1. When I use optimization level -O1 the following assembly code is generated: 

myfunc:
        mov     r3, r0
        mul     r3, r0, r3
        add     r0, r3, #9
        bx      lr

When I use -Og the following assembly is generated:

myfunc:
        mov     r3, #0
        b       .L2
.L3:
        mla     r2, r0, r0, r3
        add     r3, r3, #1
.L2:
        cmp     r3, #9
        ble     .L3
        mov     r0, r2
        bx      lr

Can someone please tell me what flag causes the generation of MLA instruction when using -Og. Apparently -Og uses all flags used by -O1 except those which interfere with debugging. I have manually checked all O1 flags but can't reproduce the result generated by -Og. My goal is to identify specific flag that enables this instruction. Thanks