os-k/obj/kaleid/common/ultoa.S

56 lines
961 B
ArmAsm
Raw Normal View History

2019-01-02 16:33:29 +01:00
.file "convert.c"
.text
.p2align 4,,15
.globl ultoa
.type ultoa, @function
ultoa:
.LFB2:
.cfi_startproc
leal -2(%rdx), %ecx
movq %rdi, %rax
cmpl $34, %ecx
ja .L2
testq %rdi, %rdi
jne .L3
leaq 1(%rsi), %rcx
movb $48, (%rsi)
.L4:
movb $0, (%rcx)
movq %rsi, %rdi
movabsq $reverse, %rax
jmp *%rax
.p2align 4,,10
.p2align 3
.L3:
movslq %edx, %r8
movq %rsi, %rcx
movabsq $digits, %r9
.p2align 4,,10
.p2align 3
.L5:
xorl %edx, %edx
addq $1, %rcx
divq %r8
movzbl (%r9,%rdx), %edx
testq %rax, %rax
movb %dl, -1(%rcx)
jne .L5
jmp .L4
.p2align 4,,10
.p2align 3
.L2:
xorl %eax, %eax
ret
.cfi_endproc
.LFE2:
.size ultoa, .-ultoa
.section .rodata
.align 32
.type digits, @object
.size digits, 36
digits:
.byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43
.byte 0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50
.byte 0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a
.ident "GCC: (GNU) 7.3.0"