| author | |
| committer | |
| log | f86684f4100c1dcc886357b79108df1e8f9e3f2e |
| tree | ae7a4da31310f7f025804b9545058822d0adb112 |
| parent | 8d4668231a9812067d5b12ebabd78871dfb8517a |
2 files changed, 119 insertions(+), 117 deletions(-)
std/special/compiler_rt/aulldiv.zig+59-58| ... | @@ -1,65 +1,66 @@ | ... | @@ -1,65 +1,66 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong; | ||
| 3 | const is_win32 = builtin.os == builtin.Os.windows and builtin.arch == builtin.Arch.i386; | ||
| 2 | 4 | ||
| 3 | export nakedcc fn _aulldiv() { | 5 | export nakedcc fn _aulldiv() { |
| 4 | @setDebugSafety(this, false); | 6 | if (is_win32) { |
| 5 | 7 | @setDebugSafety(this, false); | |
| 6 | if (comptime builtin.os == builtin.Os.windows) { | 8 | @setGlobalLinkage(_aulldiv, linkage); |
| 7 | if (comptime builtin.arch == builtin.Arch.i386) { | 9 | asm volatile ( |
| 8 | asm volatile ( | 10 | \\.intel_syntax noprefix |
| 9 | \\.intel_syntax noprefix | 11 | \\ |
| 10 | \\ | 12 | \\ push ebx |
| 11 | \\ push ebx | 13 | \\ push esi |
| 12 | \\ push esi | 14 | \\ mov eax,dword ptr [esp+18h] |
| 13 | \\ mov eax,dword ptr [esp+18h] | 15 | \\ or eax,eax |
| 14 | \\ or eax,eax | 16 | \\ jne L1 |
| 15 | \\ jne L1 | 17 | \\ mov ecx,dword ptr [esp+14h] |
| 16 | \\ mov ecx,dword ptr [esp+14h] | 18 | \\ mov eax,dword ptr [esp+10h] |
| 17 | \\ mov eax,dword ptr [esp+10h] | 19 | \\ xor edx,edx |
| 18 | \\ xor edx,edx | 20 | \\ div ecx |
| 19 | \\ div ecx | 21 | \\ mov ebx,eax |
| 20 | \\ mov ebx,eax | 22 | \\ mov eax,dword ptr [esp+0Ch] |
| 21 | \\ mov eax,dword ptr [esp+0Ch] | 23 | \\ div ecx |
| 22 | \\ div ecx | 24 | \\ mov edx,ebx |
| 23 | \\ mov edx,ebx | 25 | \\ jmp L2 |
| 24 | \\ jmp L2 | 26 | \\ L1: |
| 25 | \\ L1: | 27 | \\ mov ecx,eax |
| 26 | \\ mov ecx,eax | 28 | \\ mov ebx,dword ptr [esp+14h] |
| 27 | \\ mov ebx,dword ptr [esp+14h] | 29 | \\ mov edx,dword ptr [esp+10h] |
| 28 | \\ mov edx,dword ptr [esp+10h] | 30 | \\ mov eax,dword ptr [esp+0Ch] |
| 29 | \\ mov eax,dword ptr [esp+0Ch] | 31 | \\ L3: |
| 30 | \\ L3: | 32 | \\ shr ecx,1 |
| 31 | \\ shr ecx,1 | 33 | \\ rcr ebx,1 |
| 32 | \\ rcr ebx,1 | 34 | \\ shr edx,1 |
| 33 | \\ shr edx,1 | 35 | \\ rcr eax,1 |
| 34 | \\ rcr eax,1 | 36 | \\ or ecx,ecx |
| 35 | \\ or ecx,ecx | 37 | \\ jne L3 |
| 36 | \\ jne L3 | 38 | \\ div ebx |
| 37 | \\ div ebx | 39 | \\ mov esi,eax |
| 38 | \\ mov esi,eax | 40 | \\ mul dword ptr [esp+18h] |
| 39 | \\ mul dword ptr [esp+18h] | 41 | \\ mov ecx,eax |
| 40 | \\ mov ecx,eax | 42 | \\ mov eax,dword ptr [esp+14h] |
| 41 | \\ mov eax,dword ptr [esp+14h] | 43 | \\ mul esi |
| 42 | \\ mul esi | 44 | \\ add edx,ecx |
| 43 | \\ add edx,ecx | 45 | \\ jb L4 |
| 44 | \\ jb L4 | 46 | \\ cmp edx,dword ptr [esp+10h] |
| 45 | \\ cmp edx,dword ptr [esp+10h] | 47 | \\ ja L4 |
| 46 | \\ ja L4 | 48 | \\ jb L5 |
| 47 | \\ jb L5 | 49 | \\ cmp eax,dword ptr [esp+0Ch] |
| 48 | \\ cmp eax,dword ptr [esp+0Ch] | 50 | \\ jbe L5 |
| 49 | \\ jbe L5 | 51 | \\ L4: |
| 50 | \\ L4: | 52 | \\ dec esi |
| 51 | \\ dec esi | 53 | \\ L5: |
| 52 | \\ L5: | 54 | \\ xor edx,edx |
| 53 | \\ xor edx,edx | 55 | \\ mov eax,esi |
| 54 | \\ mov eax,esi | 56 | \\ L2: |
| 55 | \\ L2: | 57 | \\ pop esi |
| 56 | \\ pop esi | 58 | \\ pop ebx |
| 57 | \\ pop ebx | 59 | \\ ret 10h |
| 58 | \\ ret 10h | 60 | ); |
| 59 | ); | 61 | unreachable; |
| 60 | unreachable; | ||
| 61 | } | ||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | @setGlobalLinkage(_aulldiv, builtin.GlobalLinkage.Internal); | 64 | @setGlobalLinkage(_aulldiv, builtin.GlobalLinkage.Internal); |
| 65 | unreachable; | ||
| 65 | } | 66 | } |
std/special/compiler_rt/aullrem.zig+60-59| ... | @@ -1,66 +1,67 @@ | ... | @@ -1,66 +1,67 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong; | ||
| 3 | const is_win32 = builtin.os == builtin.Os.windows and builtin.arch == builtin.Arch.i386; | ||
| 2 | 4 | ||
| 3 | export nakedcc fn _aullrem() { | 5 | export nakedcc fn _aullrem() { |
| 4 | @setDebugSafety(this, false); | 6 | if (is_win32) { |
| 5 | 7 | @setDebugSafety(this, false); | |
| 6 | if (comptime builtin.os == builtin.Os.windows) { | 8 | @setGlobalLinkage(_aullrem, linkage); |
| 7 | if (comptime builtin.arch == builtin.Arch.i386) { | 9 | asm volatile ( |
| 8 | asm volatile ( | 10 | \\.intel_syntax noprefix |
| 9 | \\.intel_syntax noprefix | 11 | \\ |
| 10 | \\ | 12 | \\ push ebx |
| 11 | \\ push ebx | 13 | \\ mov eax,dword ptr [esp+14h] |
| 12 | \\ mov eax,dword ptr [esp+14h] | 14 | \\ or eax,eax |
| 13 | \\ or eax,eax | 15 | \\ jne L1a |
| 14 | \\ jne L1a | 16 | \\ mov ecx,dword ptr [esp+10h] |
| 15 | \\ mov ecx,dword ptr [esp+10h] | 17 | \\ mov eax,dword ptr [esp+0Ch] |
| 16 | \\ mov eax,dword ptr [esp+0Ch] | 18 | \\ xor edx,edx |
| 17 | \\ xor edx,edx | 19 | \\ div ecx |
| 18 | \\ div ecx | 20 | \\ mov eax,dword ptr [esp+8] |
| 19 | \\ mov eax,dword ptr [esp+8] | 21 | \\ div ecx |
| 20 | \\ div ecx | 22 | \\ mov eax,edx |
| 21 | \\ mov eax,edx | 23 | \\ xor edx,edx |
| 22 | \\ xor edx,edx | 24 | \\ jmp L2a |
| 23 | \\ jmp L2a | 25 | \\ L1a: |
| 24 | \\ L1a: | 26 | \\ mov ecx,eax |
| 25 | \\ mov ecx,eax | 27 | \\ mov ebx,dword ptr [esp+10h] |
| 26 | \\ mov ebx,dword ptr [esp+10h] | 28 | \\ mov edx,dword ptr [esp+0Ch] |
| 27 | \\ mov edx,dword ptr [esp+0Ch] | 29 | \\ mov eax,dword ptr [esp+8] |
| 28 | \\ mov eax,dword ptr [esp+8] | 30 | \\ L3a: |
| 29 | \\ L3a: | 31 | \\ shr ecx,1 |
| 30 | \\ shr ecx,1 | 32 | \\ rcr ebx,1 |
| 31 | \\ rcr ebx,1 | 33 | \\ shr edx,1 |
| 32 | \\ shr edx,1 | 34 | \\ rcr eax,1 |
| 33 | \\ rcr eax,1 | 35 | \\ or ecx,ecx |
| 34 | \\ or ecx,ecx | 36 | \\ jne L3a |
| 35 | \\ jne L3a | 37 | \\ div ebx |
| 36 | \\ div ebx | 38 | \\ mov ecx,eax |
| 37 | \\ mov ecx,eax | 39 | \\ mul dword ptr [esp+14h] |
| 38 | \\ mul dword ptr [esp+14h] | 40 | \\ xchg eax,ecx |
| 39 | \\ xchg eax,ecx | 41 | \\ mul dword ptr [esp+10h] |
| 40 | \\ mul dword ptr [esp+10h] | 42 | \\ add edx,ecx |
| 41 | \\ add edx,ecx | 43 | \\ jb L4a |
| 42 | \\ jb L4a | 44 | \\ cmp edx,dword ptr [esp+0Ch] |
| 43 | \\ cmp edx,dword ptr [esp+0Ch] | 45 | \\ ja L4a |
| 44 | \\ ja L4a | 46 | \\ jb L5a |
| 45 | \\ jb L5a | 47 | \\ cmp eax,dword ptr [esp+8] |
| 46 | \\ cmp eax,dword ptr [esp+8] | 48 | \\ jbe L5a |
| 47 | \\ jbe L5a | 49 | \\ L4a: |
| 48 | \\ L4a: | 50 | \\ sub eax,dword ptr [esp+10h] |
| 49 | \\ sub eax,dword ptr [esp+10h] | 51 | \\ sbb edx,dword ptr [esp+14h] |
| 50 | \\ sbb edx,dword ptr [esp+14h] | 52 | \\ L5a: |
| 51 | \\ L5a: | 53 | \\ sub eax,dword ptr [esp+8] |
| 52 | \\ sub eax,dword ptr [esp+8] | 54 | \\ sbb edx,dword ptr [esp+0Ch] |
| 53 | \\ sbb edx,dword ptr [esp+0Ch] | 55 | \\ neg edx |
| 54 | \\ neg edx | 56 | \\ neg eax |
| 55 | \\ neg eax | 57 | \\ sbb edx,0 |
| 56 | \\ sbb edx,0 | 58 | \\ L2a: |
| 57 | \\ L2a: | 59 | \\ pop ebx |
| 58 | \\ pop ebx | 60 | \\ ret 10h |
| 59 | \\ ret 10h | 61 | ); |
| 60 | ); | 62 | unreachable; |
| 61 | unreachable; | ||
| 62 | } | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @setGlobalLinkage(_aullrem, builtin.GlobalLinkage.Internal); | 65 | @setGlobalLinkage(_aullrem, builtin.GlobalLinkage.Internal); |
| 66 | unreachable; | ||
| 66 | } | 67 | } |