mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-30 00:20:59 +00:00
Set default rounding mode to FE_NEAREST again. Thanks to Matthias Bentrup for providing some explanations.
This commit is contained in:
parent
ebec84c55d
commit
8a500d71da
6 changed files with 34 additions and 59 deletions
|
@ -45,9 +45,6 @@ IFDEF idx64
|
|||
|
||||
qsnapvectorsse PROC
|
||||
sub rsp, 8
|
||||
stmxcsr [rsp] ; save SSE control word
|
||||
ldmxcsr ssecw ; set to round nearest
|
||||
|
||||
movaps xmm1, ssemask ; initialize the mask register
|
||||
movups xmm0, [rcx] ; here is stored our vector. Read 4 values in one go
|
||||
movaps xmm2, xmm0 ; keep a copy of the original data
|
||||
|
@ -57,20 +54,13 @@ IFDEF idx64
|
|||
cvtdq2ps xmm0, xmm0 ; convert 4 int to single fp
|
||||
orps xmm0, xmm1 ; combine all 4 values again
|
||||
movups [rcx], xmm0 ; write 3 rounded and 1 unchanged values back to memory
|
||||
|
||||
ldmxcsr [rsp] ; restore sse control word to old value
|
||||
add rsp, 8
|
||||
ret
|
||||
qsnapvectorsse ENDP
|
||||
|
||||
ELSE
|
||||
|
||||
qsnapvectorsse PROC
|
||||
sub esp, 8
|
||||
stmxcsr [esp] ; save SSE control word
|
||||
ldmxcsr ssecw ; set to round nearest
|
||||
|
||||
mov eax, dword ptr 12[esp] ; store address of vector in eax
|
||||
mov eax, dword ptr 4[esp] ; store address of vector in eax
|
||||
movaps xmm1, ssemask ; initialize the mask register for maskmovdqu
|
||||
movups xmm0, [eax] ; here is stored our vector. Read 4 values in one go
|
||||
movaps xmm2, xmm0 ; keep a copy of the original data
|
||||
|
@ -80,9 +70,6 @@ ELSE
|
|||
cvtdq2ps xmm0, xmm0 ; convert 4 int to single fp
|
||||
orps xmm0, xmm1 ; combine all 4 values again
|
||||
movups [eax], xmm0 ; write 3 rounded and 1 unchanged values back to memory
|
||||
|
||||
ldmxcsr [esp] ; restore sse control word to old value
|
||||
add esp, 8
|
||||
ret
|
||||
qsnapvectorsse ENDP
|
||||
|
||||
|
@ -95,14 +82,9 @@ ELSE
|
|||
|
||||
qsnapvectorx87 PROC
|
||||
mov eax, dword ptr 4[esp]
|
||||
sub esp, 2
|
||||
fnstcw word ptr [esp]
|
||||
fldcw fpucw
|
||||
qroundx87 [eax]
|
||||
qroundx87 4[eax]
|
||||
qroundx87 8[eax]
|
||||
fldcw [esp]
|
||||
add esp, 2
|
||||
ret
|
||||
qsnapvectorx87 ENDP
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue