Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86 fixes for floating point #71

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/coreclr/nativeaot/zerolib.native/x86/stubs.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ Name label proc
PUBLIC Name
endm

.const
align 8

_Int32ToUInt32 DQ 0000000000000000H
DQ 41F0000000000000H ; 2**32
_DP2to32 EQU (_Int32ToUInt32+8)

.code

PUBLIC RhpByRefAssignRef
Expand Down Expand Up @@ -58,4 +65,21 @@ RhpCheckedAssignRefEBP PROC
ret
RhpCheckedAssignRefEBP ENDP

PUBLIC RhpLng2Dbl
RhpLng2Dbl PROC
mov edx,dword ptr [esp+8]
mov ecx,dword ptr [esp+4]
xorps xmm1,xmm1
cvtsi2sd xmm1,edx ; convert (signed) upper bits
xorps xmm0,xmm0
cvtsi2sd xmm0,ecx ; convert (signed) lower bits
shr ecx,31 ; get sign bit into ecx
mulsd xmm1,_DP2to32 ; adjust upper value for bit position
addsd xmm0,_Int32ToUInt32[ecx*8] ; adjust to unsigned
addsd xmm0,xmm1 ; combine upper and lower
movsd mmword ptr [esp+4],xmm0
fld qword ptr [esp+4]
ret
RhpLng2Dbl ENDP

end
Loading