unittests: Adds ptest unit test to ensure correct flag setting

ptest wasn't correctly setting OF, SF, AF, and PF to zero until now.
Do a unit test to ensure correct behaviour here
This commit is contained in:
Ryan Houdek 2022-01-11 01:19:10 -08:00
parent c87e11cee9
commit 4e2220c27f

View File

@ -0,0 +1,32 @@
%ifdef CONFIG
{
"RegData": {
"RAX": "0xFFFFFFFFFFFF43FF",
"RBX": "0"
}
}
%endif
; Set EFLAGS to known value with sahf
mov rax, -1
sahf
movups xmm0, [rel .data]
; Tests a bug that FEX had where ptest would not set OF, SF, AF, PF to zero
ptest xmm0, xmm0
; Now load back
; ZF = 1
; CF = 1
; OF, SF, AF, PF should be zero
lahf
; lahf doesn't get OF, get it with seto
mov rbx, 0
seto bl
hlt
.data:
dq 0
dq 0