using gcc quadmath
Re: using gcc quadmath
Yea srvaldez.
That works fine (32 bits)
That works fine (32 bits)
Re: using gcc quadmath
here's a working example
output
Code: Select all
#Inclib "quadmath-0"
Type float128
As Long m1, m2, m3, m4
End Type
Extern "c"
Declare Function strtoflt128 (Byval As Zstring Ptr, Byval As Byte Ptr Ptr) As float128
End Extern
Sub acosq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _acosq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub acoshq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _acoshq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub asinq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _asinq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub asinhq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _asinhq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub atanq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _atanq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub atanhq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _atanhq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub atan2q_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _atan2q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub cbrtq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _cbrtq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub ceilq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _ceilq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub copysignq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _copysignq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub coshq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _coshq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub cosq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _cosq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub erfq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _erfq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub erfcq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _erfcq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub expq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _expq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub expm1q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _expm1q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub fabsq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _fabsq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub fdimq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _fdimq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub finiteq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _finiteq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub floorq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _floorq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub fmaq_ Naked(Byval a As float128, Byval b As float128, Byval d As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds first dword of 'c'
'esp+52 holds pointer to 'd'
Asm
Push ebp
mov ebp, esp
Sub esp, 4*oword
And esp, -16
'since the values of the arguments may not be 16-byte aligned we copy one dword at a time
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
'copy 'c' to stack
movups xmm1,xmmword Ptr [ebp+36+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+32], xmm1
'eax = address of 'd'
mov eax,dword Ptr [ebp+52+4]
'subtract 12 from esp to make 'push eax' 16-byte aligned.
Sub esp,12
Push eax 'push address of d onto stack
Call _fmaq
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub fmaxq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _fmaxq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub fminq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _fminq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub fmodq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _fmodq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub frexpq_ Naked(Byval a As float128, Byref n As long, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'n'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp,-16
sub esp,12
Push dword Ptr [ebp+20+4]
sub esp,16
movups xmm1,xmmword Ptr [ebp+4+4]
movaps xmmword Ptr [esp], xmm1
Sub esp, 12
Push dword Ptr [ebp+24+4]
Call _frexpq
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub hypotq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _hypotq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub isinfq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _isinfq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub ilogbq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _ilogbq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub isnanq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _isnanq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub j0q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _j0q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub j1q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _j1q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub jnq_ Naked(Byval n As Long, Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds 'n'
'esp+8 holds first dword of 'a'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+8+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,8
mov eax,dword Ptr [ebp+4+4]
Push eax
Push dword Ptr [ebp+24+4] 'push address of c onto stack
Call _jnq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub ldexpq_ Naked(Byval a As float128, Byval n As long, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'n'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp,-16
sub esp,12
Push dword Ptr [ebp+20+4]
sub esp,16
movups xmm1,xmmword Ptr [ebp+4+4]
movaps xmmword Ptr [esp], xmm1
Sub esp, 12
Push dword Ptr [ebp+24+4]
Call _ldexpq
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub lgammaq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _lgammaq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub llrintq_ Naked(Byval a As float128, Byref c As Longint)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Call _llrintq 'need extra underscore
mov edx,dword Ptr [ebp+20+4] 'c
mov dword Ptr [edx],eax
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub llroundq_ Naked(Byval a As float128, Byref c As Longint)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Call _llroundq 'need extra underscore
mov edx,dword Ptr [ebp+20+4] 'c
mov dword Ptr [edx],eax
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub logbq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _logbq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub logq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _logq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub Log10q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _log10q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub log2q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _log2q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub Log1pq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _log1pq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub lrintq_ Naked(Byval a As float128, Byref c As Long)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Call _lrintq 'need extra underscore
mov edx,dword Ptr [ebp+20+4] 'c
mov dword Ptr [edx],eax
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub lroundq_ Naked(Byval a As float128, Byref c As Long)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Call _lroundq 'need extra underscore
mov edx,dword Ptr [ebp+20+4] 'c
mov dword Ptr [edx],eax
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub modfq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _modfq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub nanq_ Naked(Byval a As Const Zstring Ptr, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
Push dword Ptr [ebp+4+4]
Push dword Ptr [ebp+8+4] 'push address of c onto stack
Call _nanq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub nearbyintq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _nearbyintq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub nextafterq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _nextafterq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub powq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _powq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub remainderq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call _remainderq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub remquoq_ Naked(Byval a As float128, Byval b As float128, Byref n As Long, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
Sub esp, 12
Push dword Ptr [ebp+36+4]
Sub esp, 16
mov edx, dword Ptr [ebp+24]
mov dword Ptr [esp], edx
mov edx, dword Ptr [ebp+28]
mov dword Ptr [esp+4], edx
mov edx, dword Ptr [ebp+32]
mov dword Ptr [esp+8], edx
mov edx, dword Ptr [ebp+36]
mov dword Ptr [esp+12], edx
Sub esp, 16
mov edx, dword Ptr [ebp+8]
mov dword Ptr [esp], edx
mov edx, dword Ptr [ebp+12]
mov dword Ptr [esp+4], edx
mov edx, dword Ptr [ebp+16]
mov dword Ptr [esp+8], edx
mov edx, dword Ptr [ebp+20]
mov dword Ptr [esp+12], edx
Sub esp, 12
Push dword Ptr [ebp+40+4]
Call _remquoq
mov esp,ebp
pop ebp
ret
End Asm
End Sub
Sub rintq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _rintq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub roundq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _roundq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub scalblnq_ Naked(Byval a As float128, Byval n As Long, Byref c As float128) 'returns x * 2^n
'esp holds return address
'esp+4 holds 'n'
'esp+8 holds first dword of 'a'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, oword
And esp, -16
Sub esp,12
push dword Ptr [ebp+20+4]
sub esp,16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+24+4] 'push address of c onto stack
Call _scalblnq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub scalbnq_ Naked(Byval a As float128, Byval n As Long, Byref c As float128) 'returns x * 2^n
'esp holds return address
'esp+4 holds 'n'
'esp+8 holds first dword of 'a'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, oword
And esp, -16
Sub esp,12
push dword Ptr [ebp+20+4]
sub esp,16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+24+4] 'push address of c onto stack
Call _scalbnq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub signbitq_ Naked(Byval a As float128, Byref c As Long)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Call _signbitq 'need extra underscore
mov edx,dword Ptr [ebp+20+4] 'c
mov dword Ptr [edx],eax
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub sincosq_ Naked(Byval a As float128, Byref b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 8
Sub esp, 8
Push dword Ptr [ebp+28]
Push dword Ptr [ebp+24]
Sub esp, 16
mov eax, dword Ptr [ebp+8]
mov dword Ptr [esp], eax
mov eax, dword Ptr [ebp+12]
mov dword Ptr [esp+4], eax
mov eax, dword Ptr [ebp+16]
mov dword Ptr [esp+8], eax
mov eax, dword Ptr [ebp+20]
mov dword Ptr [esp+12], eax
Call _sincosq
Add esp, 32
nop
leave
ret
End Asm
End Sub
Sub sinhq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _sinhq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub sinq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _sinq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub sqrtq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _sqrtq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub tanq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _tanq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub tanhq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _tanhq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub tgammaq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _tgammaq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub truncq_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _truncq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub y0q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _y0q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub y1q_ Naked(Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+20+4] 'push address of c onto stack
Call _y1q 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub ynq_ Naked(Byval n As Long, Byval a As float128, Byref c As float128)
'esp holds return address
'esp+4 holds 'n'
'esp+8 holds first dword of 'a'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+8+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
Sub esp,8
mov eax,dword Ptr [ebp+4+4]
Push eax
Push dword Ptr [ebp+24+4] 'push address of c onto stack
Call _ynq 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub addq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call ___addtf3 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub subq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call ___subtf3 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub mulq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call ___multf3 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Sub divq_ Naked(Byval a As float128, Byval b As float128, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 3*oword
And esp, -16
'copy 'a' to stack
movups xmm1,xmmword Ptr [ebp+4+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp], xmm1
'copy 'b' to stack
movups xmm1,xmmword Ptr [ebp+20+4] 'need to add 4 due to 'push 'ebp'
movaps xmmword Ptr [esp+16], xmm1
Sub esp,12 'subtract 12 from esp to make 'push eax' 16-byte aligned.
Push dword Ptr [ebp+36+4] 'push address of c onto stack
Call ___divtf3 'need extra underscore
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
'conversion functions
declare function lngf128 cdecl alias "__floatsitf"(byval a as long) as float128
declare function lngintf128 cdecl alias "__floatditf"(byval a as longint) as float128
declare function dblf128 cdecl alias "__extenddftf2"(byval a as double) as float128
declare function sngf128 cdecl alias "__extendsftf2"(byval a as single) as float128
declare function f128lng cdecl alias "__fixtfsi"(byval a as float128) as long
declare function f128lngint cdecl alias "__fixtfdi"(byval a as float128) as longint
declare function f128dbl cdecl alias "__trunctfdf2"(byval a as float128) as double
declare function f128sng cdecl alias "__trunctfsf2"(byval a as float128) as single
Sub snprintfq_ Naked(Byval st As Zstring Ptr, Byval size As Long, Byval form As Zstring Ptr, Byval prec As Long, Byval r As float128)
'esp holds return address
'esp+4 holds pointer to 'st'
'esp+8 holds 'size'
'esp+12 holds pointer to 'form'
'esp+16 holds 'prec'
'esp+20 holds first dword of 'r'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp, -16
'push value of float128 in reverse order
Push dword Ptr [ebp+20+12+4]
Push dword Ptr [ebp+20+8+4]
Push dword Ptr [ebp+20+4+4]
Push dword Ptr [ebp+20+0+4]
Push dword Ptr [ebp+16+4] 'prec
Push dword Ptr [ebp+12+4] 'form
Push dword Ptr [ebp+8+4] 'size
Push dword Ptr [ebp+4+4] 'st
Call _quadmath_snprintf
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Dim As float128 x, y, z
Dim As Zstring Ptr s= Allocate(256)
y = strtoflt128 ("20.0q", 0)
Print " sin quadmath"
For i As Long =1 To 20
x = strtoflt128 (Str(i)+"Q", 0)
divq_(x,y,z)
sinq_(z,z)
Print Using "sinq(##";i;:Print "/20) = ";:snprintfq_(s, 256, "%33.*Qg", 33, z):?*s
Print "sin fb ";Sin(Cdbl(i)/20)
Next
Deallocate(s)
?"press return to end"
Sleep
Code: Select all
123 + 321 = 444
123 - 321 = -198
123 * 321 = 39483
123 / 321 = 0.383177570093457943925233644859813
sin(1) = 0.841470984807896506652502321630299
Last edited by srvaldez on Aug 07, 2017 14:48, edited 5 times in total.
Re: using gcc quadmath
dodicat, would you test this add function?
Code: Select all
sub addq_ naked(byval a as float128, byval b as float128, byref c as float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds first dword of 'b'
'esp+36 holds pointer to 'c'
asm
push ebp
mov ebp, esp
sub esp, 56
lea eax, [ebp-24]
sub esp, 16
mov edx, DWORD PTR [ebp+24]
mov DWORD PTR [esp], edx
mov edx, DWORD PTR [ebp+28]
mov DWORD PTR [esp+4], edx
mov edx, DWORD PTR [ebp+32]
mov DWORD PTR [esp+8], edx
mov edx, DWORD PTR [ebp+36]
mov DWORD PTR [esp+12], edx
sub esp, 16
mov edx, DWORD PTR [ebp+8]
mov DWORD PTR [esp], edx
mov edx, DWORD PTR [ebp+12]
mov DWORD PTR [esp+4], edx
mov edx, DWORD PTR [ebp+16]
mov DWORD PTR [esp+8], edx
mov edx, DWORD PTR [ebp+20]
mov DWORD PTR [esp+12], edx
sub esp, 12
push eax
call ___addtf3
add esp, 44
mov eax, DWORD PTR [ebp-24]
mov DWORD PTR [ebp-56], eax
mov eax, DWORD PTR [ebp-20]
mov DWORD PTR [ebp-52], eax
mov eax, DWORD PTR [ebp-16]
mov DWORD PTR [ebp-48], eax
mov eax, DWORD PTR [ebp-12]
mov DWORD PTR [ebp-44], eax
mov eax, DWORD PTR [ebp-56]
mov DWORD PTR [ebp-40], eax
mov eax, DWORD PTR [ebp-52]
mov DWORD PTR [ebp-36], eax
mov eax, DWORD PTR [ebp-48]
mov DWORD PTR [ebp-32], eax
mov eax, DWORD PTR [ebp-44]
mov DWORD PTR [ebp-28], eax
mov eax, DWORD PTR [ebp+40]
mov ecx, DWORD PTR [ebp-40]
mov DWORD PTR [eax], ecx
mov ecx, DWORD PTR [ebp-36]
mov DWORD PTR [eax+4], ecx
mov ecx, DWORD PTR [ebp-32]
mov DWORD PTR [eax+8], ecx
mov ecx, DWORD PTR [ebp-28]
mov DWORD PTR [eax+12], ecx
nop
leave
ret
end asm
end sub
Re: using gcc quadmath
Congrats!
> 'since the values of the arguments may not be 16-byte aligned we copy one dword at a time
You have movups for unaligned data.
> 'since the values of the arguments may not be 16-byte aligned we copy one dword at a time
You have movups for unaligned data.
Re: using gcc quadmath
thank you for the tip :-)
I am having no luck with frexpq however.
I am having no luck with frexpq however.
Re: using gcc quadmath
hello dodicat
you mentioned that you didn't have the 64-bit QuadMath dll, I uploaded them for you, both 32 and 64-bit.
the basic arithmetic functions are not part of quadmath dll but of the gcc runtime lib, I included them as well, I hope they will work for you.
regarding using quadmath in 64-bit, all you need is the function declarations, you can try this incomplete version.
you mentioned that you didn't have the 64-bit QuadMath dll, I uploaded them for you, both 32 and 64-bit.
the basic arithmetic functions are not part of quadmath dll but of the gcc runtime lib, I included them as well, I hope they will work for you.
regarding using quadmath in 64-bit, all you need is the function declarations, you can try this incomplete version.
Code: Select all
/' GCC Quad-Precision Math Library
Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Written by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
This file is part of the libquadmath library.
Libquadmath is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libquadmath is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html
You should have received a copy of the GNU Library General Public
License along with libquadmath; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. '/
#inclib "quadmath-0"
type float128
as long m1, m2, m3, m4
end type
declare function addf128 cdecl alias "__addtf3" (byval a as float128, byval b as float128) as float128
declare function subf128 cdecl alias "__subtf3" (byval a as float128, byval b as float128) as float128
declare function mulf128 cdecl alias "__multf3" (byval a as float128, byval b as float128) as float128
declare function divf128 cdecl alias "__divtf3" (byval a as float128, byval b as float128) as float128
'conversion functions
declare function lngf128 cdecl alias "__floatsitf"(byval a as long) as float128
declare function lngintf128 cdecl alias "__floatditf"(byval a as longint) as float128
declare function dblf128 cdecl alias "__extenddftf2"(byval a as double) as float128
declare function sngf128 cdecl alias "__extendsftf2"(byval a as single) as float128
declare function f128lng cdecl alias "__fixtfsi"(byval a as float128) as long
declare function f128lngint cdecl alias "__fixtfdi"(byval a as float128) as longint
declare function f128dbl cdecl alias "__trunctfdf2"(byval a as float128) as double
declare function f128sng cdecl alias "__trunctfsf2"(byval a as float128) as single
extern "C"
declare function acosq(byval as float128) as float128
declare function acoshq(byval as float128) as float128
declare function asinq(byval as float128) as float128
declare function asinhq(byval as float128) as float128
declare function atanq(byval as float128) as float128
declare function atanhq(byval as float128) as float128
declare function atan2q(byval as float128, byval as float128) as float128
declare function cbrtq(byval as float128) as float128
declare function ceilq(byval as float128) as float128
declare function copysignq(byval as float128, byval as float128) as float128
declare function coshq(byval as float128) as float128
declare function cosq(byval as float128) as float128
declare function erfq(byval as float128) as float128
declare function erfcq(byval as float128) as float128
declare function expq(byval as float128) as float128
declare function expm1q(byval as float128) as float128
declare function fabsq(byval as float128) as float128
declare function fdimq(byval as float128, byval as float128) as float128
declare function finiteq(byval as float128) as long
declare function floorq(byval as float128) as float128
declare function fmaq(byval as float128, byval as float128, byval as float128) as float128
declare function fmaxq(byval as float128, byval as float128) as float128
declare function fminq(byval as float128, byval as float128) as float128
declare function fmodq(byval as float128, byval as float128) as float128
declare function frexpq(byval as float128, byval as long ptr) as float128
declare function hypotq(byval as float128, byval as float128) as float128
declare function isinfq(byval as float128) as long
declare function ilogbq(byval as float128) as long
declare function isnanq(byval as float128) as long
declare function j0q(byval as float128) as float128
declare function j1q(byval as float128) as float128
declare function jnq(byval as long, byval as float128) as float128
declare function ldexpq(byval as float128, byval as long) as float128
declare function lgammaq(byval as float128) as float128
declare function llrintq(byval as float128) as longint
declare function llroundq(byval as float128) as longint
declare function logbq(byval as float128) as float128
declare function logq(byval as float128) as float128
declare function log10q(byval as float128) as float128
declare function log2q(byval as float128) as float128
declare function log1pq(byval as float128) as float128
declare function lrintq(byval as float128) as long
declare function lroundq(byval as float128) as long
declare function modfq(byval as float128, byval as float128 ptr) as float128
declare function nanq(byval as const zstring ptr) as float128
declare function nearbyintq(byval as float128) as float128
declare function nextafterq(byval as float128, byval as float128) as float128
declare function powq(byval as float128, byval as float128) as float128
declare function remainderq(byval as float128, byval as float128) as float128
declare function remquoq (byval as float128, byval as float128, byval as long ptr) as float128
declare function rintq(byval as float128) as float128
declare function roundq(byval as float128) as float128
declare function scalblnq(byval as float128, byval as long) as float128
declare function scalbnq(byval as float128, byval as long) as float128
declare function signbitq(byval as float128) as long
declare sub sincosq(byval as float128, byval as float128 ptr, byval as float128 ptr)
declare function sinhq(byval as float128) as float128
declare function sinq (byval as float128) as float128
declare function sqrtq(byval as float128) as float128
declare function tanq(byval as float128) as float128
declare function tanhq(byval as float128) as float128
declare function tgammaq(byval as float128) as float128
declare function truncq(byval as float128) as float128
declare function y0q(byval as float128) as float128
declare function y1q(byval as float128) as float128
declare function ynq(byval as long, byval as float128) as float128
declare function strtoflt128 (byval as zstring ptr, byval as byte ptr ptr) as float128
declare function quadmath_snprintf (byval st as zstring ptr, byval size as long, byval form as zstring ptr, byval as long, byval as float128) as long
end extern
dim as float128 x, y, z, one = strtoflt128 ("1Q", 0)
dim as zstring ptr s= allocate(256)
dim as longint k
x = strtoflt128 ("123Q", 0)
y = strtoflt128 ("321Q", 0)
z = strtoflt128 ("0Q", 0)
z=addf128(x, y):quadmath_snprintf(s, 256, "%33.*Qg", 33, z):?"123 + 321 = ";*s
z=subf128(x, y):quadmath_snprintf(s, 256, "%33.*Qg", 33, z):?"123 - 321 = ";*s
z=mulf128(x, y):quadmath_snprintf(s, 256, "%33.*Qg", 33, z):?"123 * 321 = ";*s
z=divf128(x, y):quadmath_snprintf(s, 256, "%33.*Qg", 33, z):?"123 / 321 = ";*s
y = strtoflt128 ("20Q", 0)
for i as long=1 to 20
x=lngf128(i)
k=f128lngint(x)
x=divf128(x,y)
z=sinq(x)
print using "sin(##/20) = ";k;:quadmath_snprintf(s, 256, "%33.*Qg", 33, z):?*s
print "sin FB ";sin(cdbl(i)/20)
print "f128sng ";f128sng(z)
next
deallocate(s)
Re: using gcc quadmath
thanks jj2007 :-)
Code: Select all
Sub frexpq_ Naked(Byval a As float128, Byref n As long, Byref c As float128)
'esp holds return address
'esp+4 holds first dword of 'a'
'esp+20 holds pointer to 'n'
'esp+24 holds pointer to 'c'
Asm
Push ebp
mov ebp, esp
Sub esp, 2*oword
And esp,-16
sub esp,12
Push dword Ptr [ebp+20+4]
sub esp,16
movups xmm1,xmmword Ptr [ebp+4+4]
movaps xmmword Ptr [esp], xmm1
Sub esp, 12
Push dword Ptr [ebp+24+4]
Call _frexpq
mov esp,ebp
Pop ebp
ret
End Asm
End Sub
Re: using gcc quadmath
just in case anyone is interested, I made wrapper of QuadMath, it's the only way it will work reliably with FB
Re: using gcc quadmath
Thanks srvaldez.
Unfortunately I keep getting an error (The application was unable to start correctly (0xc000007b).
(Both your sets of dll's)
Also I got libwinthread-1.dll not found when I try your asm code on 32 bits.
Funny the C code runs perfectly with the math functions in the dll I downloaded initially.
And with the four arithmetic ops.
But the fb code fails with the dll.
Anyway, I'll leave it for now and thanks again.
Unfortunately I keep getting an error (The application was unable to start correctly (0xc000007b).
(Both your sets of dll's)
Also I got libwinthread-1.dll not found when I try your asm code on 32 bits.
Funny the C code runs perfectly with the math functions in the dll I downloaded initially.
And with the four arithmetic ops.
But the fb code fails with the dll.
Anyway, I'll leave it for now and thanks again.
Re: using gcc quadmath
thanks for trying it out, in my initial release I forgot to include the conversion functions, I re-uploaded them again, hopefully it will work now.
<edit> only works when compiling using -gen gcc, also quadmath.bi changed in regard of the conversion functions, so you need to update that file also.
<edit> only works when compiling using -gen gcc, also quadmath.bi changed in regard of the conversion functions, so you need to update that file also.
Re: using gcc quadmath
in case anyone is interested I updated QuadMath with complex arithmetic and named the dll's according to 32 or 64 bit to prevent confusion.
remember to compile with -gen gcc
remember to compile with -gen gcc
Code: Select all
#include "quadmath.bi"
dim as float128 a, b
dim as complex128 x, z
dim as zstring ptr s= allocate(256)
a=lngf128(-2)
b=lngf128(0)
x.re=a : x.im=b
z=csqrtq(x)
quadmath_snprintf(s, 256, "%33.*Qg", 10, z.re)
print " csqrt(-2) = ";ltrim(*s);" + ";
quadmath_snprintf(s, 256, "%33.*Qg", 33, z.im)
print ltrim(*s);" i"
z=caddq(z,z)
quadmath_snprintf(s, 256, "%33.*Qg", 10, z.re)
print "csqrt(-2) + csqrt(-2) = ";ltrim(*s);" + ";
quadmath_snprintf(s, 256, "%33.*Qg", 33, z.im)
print ltrim(*s);" i"
deallocate(s)
sleep
Code: Select all
csqrt(-2) = 0 + 1.4142135623730950488016887242097 i
csqrt(-2) + csqrt(-2) = 0 + 2.8284271247461900976033774484194 i
Re: using gcc quadmath
Looks interesting, but it throws an error:srvaldez wrote:just in case anyone is interested, I made wrapper of QuadMath, it's the only way it will work reliably with FB
\AllBasics\FreeBasic\fbc.exe -s console "C:\Masm32\MasmBasic\LibQuad\Quadmth\tmp\quad-math-test3.bas"
C:\AllBasics\FreeBasic\bin\win32\ld.exe: cannot find -lquadmath32
I don't use FB often, so probably it's a very dumb error... do I have to set a path somewhere?
Re: using gcc quadmath
good day jj2007
you can either place a copy of the QuadMath import lib (or a copy of the dll) in C:\AllBasics\FreeBasic\lib\win32\ , sorry for forgetting to include them, (now they are included)
or compile with -p path of the quadmath32.dll
remember that it only works when compiling using -gen gcc, for example: fbc -w all -gen gcc quad-math-test3.bas
or if you don't have the import lib: fbc -w all -gen gcc -p path to quadmath32.dll quad-math-test3.bas
[edit] you also need gcc-5.2.0-for-FB-win32-gengcc.zip and place the content of the bin folder into C:\AllBasics\FreeBasic\bin
you can get the zip archive from http://www.freebasic.net/forum/viewtopi ... =1&t=24363
you can either place a copy of the QuadMath import lib (or a copy of the dll) in C:\AllBasics\FreeBasic\lib\win32\ , sorry for forgetting to include them, (now they are included)
or compile with -p path of the quadmath32.dll
remember that it only works when compiling using -gen gcc, for example: fbc -w all -gen gcc quad-math-test3.bas
or if you don't have the import lib: fbc -w all -gen gcc -p path to quadmath32.dll quad-math-test3.bas
[edit] you also need gcc-5.2.0-for-FB-win32-gengcc.zip and place the content of the bin folder into C:\AllBasics\FreeBasic\bin
you can get the zip archive from http://www.freebasic.net/forum/viewtopi ... =1&t=24363
Last edited by srvaldez on Aug 09, 2017 13:42, edited 1 time in total.
Re: using gcc quadmath
I use the geany IDE https://www.geany.org and if you have a dll for which you don't have an import lib you can set the compile command in granny as: fbc -w all -gen gcc "%f" -p "%d" it will search for the appropriate lib or dll in the same directory where your basic source is.
[darn spelling auto-correct, geany->granny]
[darn spelling auto-correct, geany->granny]