#include "funcdata.h"
#include "textflag.h"
-/* replaced use of R10 by R11 because the former can be the data segment base register */
-
-TEXT _mulv(SB), NOSPLIT, $0
- MOVW l0+0(FP), R2 /* l0 */
- MOVW h0+4(FP), R11 /* h0 */
- MOVW l1+8(FP), R4 /* l1 */
- MOVW h1+12(FP), R5 /* h1 */
- MULLU R4, R2, (R7,R6)
- MUL R11, R4, R8
- ADD R8, R7
- MUL R2, R5, R8
- ADD R8, R7
- MOVW R6, ret_lo+16(FP)
- MOVW R7, ret_hi+20(FP)
- RET
-
// trampoline for _sfloat2. passes LR as arg0 and
// saves registers R0-R13 and CPSR on the stack. R0-R12 and CPSR flags can
// be changed by _sfloat2.
-TEXT _sfloat(SB), NOSPLIT, $68-0 // 4 arg + 14*4 saved regs + cpsr + return value
+TEXT runtime·_sfloat(SB), NOSPLIT, $68-0 // 4 arg + 14*4 saved regs + cpsr + return value
MOVW R14, 4(R13)
MOVW R0, 8(R13)
MOVW $12(R13), R0
DATA fast_udiv_tab<>+0x3c(SB)/4, $0x81828384
GLOBL fast_udiv_tab<>(SB), RODATA, $64
-// The linker will pass numerator in R8
-#define Rn R8
-// The linker expects the result in RTMP
-#define RTMP R11
-
-TEXT _divu(SB), NOSPLIT, $16-0
- // It's not strictly true that there are no local pointers.
- // It could be that the saved registers Rq, Rr, Rs, and Rm
- // contain pointers. However, the only way this can matter
- // is if the stack grows (which it can't, udiv is nosplit)
- // or if a fault happens and more frames are added to
- // the stack due to deferred functions.
- // In the latter case, the stack can grow arbitrarily,
- // and garbage collection can happen, and those
- // operations care about pointers, but in that case
- // the calling frame is dead, and so are the saved
- // registers. So we can claim there are no pointers here.
- NO_LOCAL_POINTERS
- MOVW Rq, 4(R13)
- MOVW Rr, 8(R13)
- MOVW Rs, 12(R13)
- MOVW RM, 16(R13)
-
- MOVW Rn, Rr /* numerator */
- MOVW g_m(g), Rq
- MOVW m_divmod(Rq), Rq /* denominator */
- BL runtime·udiv(SB)
- MOVW Rq, RTMP
- MOVW 4(R13), Rq
- MOVW 8(R13), Rr
- MOVW 12(R13), Rs
- MOVW 16(R13), RM
- RET
-
-TEXT _modu(SB), NOSPLIT, $16-0
- NO_LOCAL_POINTERS
- MOVW Rq, 4(R13)
- MOVW Rr, 8(R13)
- MOVW Rs, 12(R13)
- MOVW RM, 16(R13)
-
- MOVW Rn, Rr /* numerator */
- MOVW g_m(g), Rq
- MOVW m_divmod(Rq), Rq /* denominator */
- BL runtime·udiv(SB)
- MOVW Rr, RTMP
- MOVW 4(R13), Rq
- MOVW 8(R13), Rr
- MOVW 12(R13), Rs
- MOVW 16(R13), RM
- RET
-
-TEXT _div(SB),NOSPLIT,$16-0
- NO_LOCAL_POINTERS
- MOVW Rq, 4(R13)
- MOVW Rr, 8(R13)
- MOVW Rs, 12(R13)
- MOVW RM, 16(R13)
- MOVW Rn, Rr /* numerator */
- MOVW g_m(g), Rq
- MOVW m_divmod(Rq), Rq /* denominator */
- CMP $0, Rr
- BGE d1
- RSB $0, Rr, Rr
- CMP $0, Rq
- BGE d2
- RSB $0, Rq, Rq
-d0:
- BL runtime·udiv(SB) /* none/both neg */
- MOVW Rq, RTMP
- B out1
-d1:
- CMP $0, Rq
- BGE d0
- RSB $0, Rq, Rq
-d2:
- BL runtime·udiv(SB) /* one neg */
- RSB $0, Rq, RTMP
-out1:
- MOVW 4(R13), Rq
- MOVW 8(R13), Rr
- MOVW 12(R13), Rs
- MOVW 16(R13), RM
- RET
-
-TEXT _mod(SB),NOSPLIT,$16-0
- NO_LOCAL_POINTERS
- MOVW Rq, 4(R13)
- MOVW Rr, 8(R13)
- MOVW Rs, 12(R13)
- MOVW RM, 16(R13)
- MOVW Rn, Rr /* numerator */
- MOVW g_m(g), Rq
- MOVW m_divmod(Rq), Rq /* denominator */
- CMP $0, Rq
- RSB.LT $0, Rq, Rq
- CMP $0, Rr
- BGE m1
- RSB $0, Rr, Rr
- BL runtime·udiv(SB) /* neg numerator */
- RSB $0, Rr, RTMP
- B out
-m1:
- BL runtime·udiv(SB) /* pos numerator */
- MOVW Rr, RTMP
-out:
- MOVW 4(R13), Rq
- MOVW 8(R13), Rr
- MOVW 12(R13), Rs
- MOVW 16(R13), RM
- RET
-
// _mul64by32 and _div64by32 not implemented on arm
TEXT runtime·_mul64by32(SB), NOSPLIT, $0
MOVW $0, R0