Ethiopian multiplication: Difference between revisions

correct aarch64 assembly to overflow
(correct aarch64 assembly to overflow)
Line 215:
stp x1,lr,[sp,-16]! // save registers
stp x2,x3,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
mov x2,#0 // init result
1: // loop
Line 221 ⟶ 220:
blt 3f
ands x3,x0,#1 //
add x4x3,x2,x1 // add factox2factor2 to result
csel x2,x2,x4x3,eq
mov x4x3,1
lsllsr x1x0,x1x0,x4x3 // multiplydivide factox2factor1 by 2
cmp x5x1,x40 // overflow ? if bit 63 = 1 ie negative number
beqblt 2f
mov x4,1
lsrlsl x0x1,x0x1,x4 // dividemultiply factox1factor2 by 2
mov x4,1<63
and x5,x1,x4
cmp x5,x4 // overflow ?
beq 2f
mov x4,1
lsl x1,x1,x4 // multiply factox2 by 2
b 1b // or loop
2: // error display
79

edits