Skip to content

Commit

Permalink
Remove old asm dumps and add new
Browse files Browse the repository at this point in the history
  • Loading branch information
nakedible authored Dec 20, 2023
1 parent 49aaa7e commit 087c63f
Show file tree
Hide file tree
Showing 22 changed files with 1,418 additions and 971 deletions.
126 changes: 126 additions & 0 deletions asm/date_to_isoweekdate.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
datealgo::asm::date_to_isoweekdate:

movabs rax, 281474976710655

and rax, rdi

mov rcx, rax
shr rcx, 32

cmp cl, 3

sbb edi, 0

movzx edx, cl
lea esi, [rdx + 12]

cmp cl, 3

cmovae esi, edx

shr rax, 40

add edi, 1468000

imul rcx, rdi, 1374389535

mov rdx, rcx
shr rdx, 37

imul edi, edi, 1461

shr edi, 2
shr rcx, 39

imul esi, esi, 979

add esi, -2919
shr esi, 5

sub eax, edx

add ecx, edi

add ecx, eax

lea eax, [rcx + rsi]

add ecx, esi
add ecx, -307

movsxd rcx, ecx

movabs rdx, 2635249153387078802

imul rcx, rdx

add rcx, rdx

shr rcx, 61

sub eax, ecx
lea edx, [rax - 536895455]

lea edx, [4*rdx - 2147385461]

imul rsi, rdx, 963315389

shr rsi, 47
imul edi, esi, 146097
sub edx, edi

or edx, 3

imul rdx, rdx, 2939745

imul esi, esi, 100

mov rdi, rdx
shr rdi, 32

add edi, esi

cmp edx, -696719416

sbb edi, -1

lea edx, [rdi - 1468000]

dec edi

imul rsi, rdi, 1374389535

mov r8, rsi
shr r8, 37

imul edi, edi, 1461

shr edi, 2
shr rsi, 39

add eax, r8d
add eax, -536895455
add esi, edi
sub eax, esi
mov esi, eax
add esi, 536895152
movsxd rsi, esi
imul rsi, rsi, -1840700269
shr rsi, 32
add eax, esi
add eax, 536895152
mov esi, eax
shr esi, 2
shr eax, 31

shl rcx, 40

add eax, esi
inc eax
movzx eax, al
shl rax, 32
or rax, rcx
or rax, rdx

ret

50 changes: 50 additions & 0 deletions asm/date_to_rd.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
datealgo::asm::date_to_rd:

movabs rax, 281474976710655

and rax, rdi

mov rcx, rax
shr rcx, 32

cmp cl, 3

sbb edi, 0

movzx edx, cl
lea esi, [rdx + 12]

cmp cl, 3

cmovae esi, edx

shr rax, 40

add edi, 1468000

imul rcx, rdi, 1374389535

mov rdx, rcx
shr rdx, 37

imul edi, edi, 1461

shr edi, 2
shr rcx, 39

imul esi, esi, 979

add esi, -2919
shr esi, 5

sub eax, edx

add ecx, edi

add ecx, eax

lea eax, [rsi + rcx]
add eax, -536895459

ret

57 changes: 57 additions & 0 deletions asm/date_to_weekday.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
datealgo::asm::date_to_weekday:

movabs rax, 281474976710655

and rax, rdi

mov rcx, rax
shr rcx, 32

cmp cl, 3

sbb edi, 0

movzx edx, cl
lea esi, [rdx + 12]

cmp cl, 3

cmovae esi, edx

shr rax, 40

add edi, 1468000

imul rcx, rdi, 1374389535

mov rdx, rcx
shr rdx, 37

imul edi, edi, 1461

shr edi, 2
shr rcx, 39

imul esi, esi, 979

add esi, -2919
shr esi, 5

sub eax, edx

add ecx, edi

add ecx, eax

lea eax, [rsi + rcx]
add eax, -306
movsxd rcx, eax

movabs rax, 2635249153387078802

imul rax, rcx

shr rax, 61

ret

69 changes: 69 additions & 0 deletions asm/datetime_to_secs.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
datealgo::asm::datetime_to_secs:

mov ecx, dword ptr [rdi]

movzx eax, byte ptr [rdi + 4]
cmp eax, 3

sbb ecx, 0

lea edx, [rax + 12]

cmp eax, 3

cmovae edx, eax

movzx esi, byte ptr [rdi + 5]

add ecx, 1468000

imul rax, rcx, 1374389535

mov r8, rax
shr r8, 37

imul r9d, ecx, 1461
shr r9d, 2
shr rax, 39

imul ecx, edx, 979

add ecx, -2919
shr ecx, 5

sub esi, r8d
add eax, r9d

add eax, esi

lea edx, [rcx + rax]

add edx, -307
cmp edx, 1073719447
ja .LBB9_1

add eax, ecx
add eax, -536895459

movzx ecx, byte ptr [rdi + 8]

movzx edx, byte ptr [rdi + 7]

movzx esi, byte ptr [rdi + 6]

cdqe

imul rdi, rax, 86400

imul rsi, rsi, 3600
imul rax, rdx, 60
add rax, rcx
add rax, rsi
add rax, rdi

ret

.LBB9_1:
xor eax, eax
ret

Loading

0 comments on commit 087c63f

Please sign in to comment.