You said you were going to shift the 64 bits into 32 afterwards so is there really any point in doing the following instruction as it will be shifted out afterwards, just possibly affecting the very bottom bit of the 32 bit result.Right, fixed it, it was dumb. I think my attempt to "correct" the code I inherited broke it further! Here is the fixed version :Code:
mul32x32_64 :.global mul32x32_64push {r4}uxth r2,r1 // r2 = blolsrs r1,r1,#16 // r1 = bhilsrs r3,r0,#16 // r3 = ahiuxth r0,r0 // r0 = alomovs r4,r0 // r4 = alomuls r0,r2 // alo x blomuls r4,r1 // alo x bhimuls r1,r3 // bhi x ahimuls r3,r2 // hi x lolsls r2,r4,#16 // r2 = lohi << 16lsrs r4,r4,#16 // r4 = lohi >> 16adds r0,r2 //adcs r1,r4 // r1:ro => (lohi<<16) + (hihi << 32) + lololsls r2,r3,#16 // r2 = hilo << 16lsrs r3,r3,#16 // r3 = hilo >> 16adds r0,r2 //adcs r1,r3 // r1:ro => (hilo<<16) + (lohi<<16) + (hihi << 32) + lolopop {r4}bx lr
muls r0,r2 // alo x blo
Statistics: Posted by MikeDB — Fri Sep 12, 2025 9:51 pm