FEX/unittests/ASM/X87_F64/DA_02_F64.asm
Ryan Houdek f156615a3a unittests: Adds unittests to ensure FICOM works
Both x80 and x64 variants.
2023-01-08 11:04:28 -08:00

86 lines
1.3 KiB
NASM

%ifdef CONFIG
{
"RegData": {
"RSI": ["0x18"]
},
"Env": { "FEX_X87REDUCEDPRECISION" : "1" }
}
%endif
mov rdx, 0xe0000000
mov rsi, 0
; Matching positive-positive
mov rax, 0x3ff0000000000000 ; 1.0
mov [rdx + 8 * 0], rax
mov eax, 1
mov [rdx + 8 * 1], eax
fld qword [rdx + 8 * 0]
ficomp dword [rdx + 8 * 1]
; Get the status word
mov rax, 0
fstsw ax
; Extract C3 to see if it was equal
shr ax, 14
and ax, 1
or rsi, rax
shl rsi, 1
; Matching negative-negative
mov rax, 0xbff0000000000000 ; -1.0
mov [rdx + 8 * 0], rax
mov eax, -1
mov [rdx + 8 * 1], eax
fld qword [rdx + 8 * 0]
ficomp dword [rdx + 8 * 1]
; Get the status word
mov rax, 0
fstsw ax
; Extract C3 to see if it was equal
shr ax, 14
and ax, 1
or rsi, rax
shl rsi, 1
; Nonmatching negative-positive
mov rax, 0xbff0000000000000 ; -1.0
mov [rdx + 8 * 0], rax
mov eax, 1
mov [rdx + 8 * 1], eax
fld qword [rdx + 8 * 0]
ficomp dword [rdx + 8 * 1]
; Get the status word
mov rax, 0
fstsw ax
; Extract C3 to see if it was equal
shr ax, 14
and ax, 1
or rsi, rax
shl rsi, 1
; Nonmatching positive-negative
mov rax, 0x3ff0000000000000 ; 1.0
mov [rdx + 8 * 0], rax
mov eax, -1
mov [rdx + 8 * 1], eax
fld qword [rdx + 8 * 0]
ficomp dword [rdx + 8 * 1]
; Get the status word
mov rax, 0
fstsw ax
; Extract C3 to see if it was equal
shr ax, 14
and ax, 1
or rsi, rax
shl rsi, 1
hlt