From 0644714a1d62a3ae5e9cdbde329801eebdaf9437 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 18 Sep 2016 15:14:10 +0000 Subject: divmod edited for Thumb-2 --- thumb2divmod.s | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/thumb2divmod.s b/thumb2divmod.s index c2c205f..e123c5e 100644 --- a/thumb2divmod.s +++ b/thumb2divmod.s @@ -1,5 +1,7 @@ .arch armv7-a + .syntax unified + .thumb .fpu vfpv3-d16 .text @@ -7,8 +9,10 @@ divide: eor r12,r3,r4 cmp r4,#0 + it lt neglt r4,r4 cmp r3,#0 + it lt neglt r3,r3 cmp r4,#32 @@ -24,19 +28,24 @@ divide: bhs divide_large_result add r1,r1,r1,lsl #1 - add pc,pc,r1,lsl #2 + mov r14,pc + add r14,r14,r1,lsl #2 + mov pc,r14 nop .set shift,32-5-11 .rept 32-5-11 .set shift,shift-1 subs r1,r3,r4,lsl #shift + it cs movcs r3,r1 + it cs orrcs r2,r2,#1<