GLOBL newton_sqrt STMFD sp!,{r4-r12,lr} newton_sqrt: # a r12, d r3, s r2, b r1, q r0 ORR r2, r0, r0, LSR#1 ORR r2, r2, r2, LSR#2 ORR r2, r2, r2, LSR#4 ORR r2, r2, r2, LSR#8 BIC r2, r2, r2, LSR#16 RSB r2, r2, r2, LSL#9 RSB r2, r2, r2, LSL#11 RSB r2, r2, r2, LSL#14 ADR r12, unorm_arm7m_hash_table LDRB r2, [r12, r2, LSR#26] BIC r2, r2, #1 MOVS r3, r0, LSL r2 ADDNE r0, pc, r3, LSR#25 LDRNEB r0, [r0, #tab-base-32] base: BEQ div_by_zero ADD r0,r0,#0x100 AND r4 , r0 , #0x00ff AND r5 , r0 , #0xff00 ORR r4 ,r4,r5 MUL r12 ,r4 ,r4 # SMULBB r12,r0,r0 MOV r1,r3,LSR #17 AND r5, r1,#0x00ff AND r6 ,r1,#0xff00 ORR r5,r6,r5 UMULL r6,r7,r12,r5 MOV r7 , r7 , LSL #16 MOV r6, r6, LSR #16 ORR r12,r7,r6 # SMULWB r12,r12,r1 MOV r1,r0,LSL#7 RSB r12,r12,#3<<15 MUL r0,r12,r1 UMULL r1,r12,r3,r0 MOV r2,r2,LSR#1 UMULL r1,r12,r0,r12 RSB r2,r2,#15 RSB r12,r12,#3<<30 UMULL r1,r0,r12,r0 MOV r0,r0,LSR r2 BX lr LDMFD sp!,{r4-r12,pc} div_by_zero: MOV r0, #0x7FFFFFFF BX lr
|