unittests: Adds more imul unit tests for flags

This commit is contained in:
Ryan Houdek committed 2021-07-03 21:48:18 -07:00
1 parent 5a7dd844b0
commit b7b9d4089f
6 files changed
+358 -1

No files matched your search

@@ -0,0 +1,70 @@
%ifdef CONFIG
{
"RegData": {
"RDI": "0x00000000000003fc"
},
"Mode": "32BIT"
}
%endif
%macro ofcfmerge 0
; Get CF
setc al
; Get OF
seto bl
and eax, 1
and ebx, 1
; Merge in to results
shl edi, 1
or edi, eax
; Merge in to results
shl edi, 1
or edi, ebx
%endmacro
mov edi, 0
; Max Negative
mov al, 0x80
mov bl, 0x80
imul bl
ofcfmerge
; Max Positive
mov al, 0x79
mov bl, 0x79
imul bl
ofcfmerge
; Max Positive and Max Negative
mov al, 0x79
mov bl, 0x80
imul bl
ofcfmerge
; Max Positive and Max Negative
mov al, 0x80
mov bl, 0x79
imul bl
ofcfmerge
; No Overflow
mov al, 0x1
mov bl, 0x1
imul bl
ofcfmerge
hlt
+69
View File
@@ -0,0 +1,69 @@
%ifdef CONFIG
{
"RegData": {
"RDI": "0x00000000000003fc"
}
}
%endif
%macro ofcfmerge 0
; Get CF
setc al
; Get OF
seto bl
and eax, 1
and ebx, 1
; Merge in to results
shl edi, 1
or edi, eax
; Merge in to results
shl edi, 1
or edi, ebx
%endmacro
mov edi, 0
; Max Negative
mov al, 0x80
mov bl, 0x80
imul bl
ofcfmerge
; Max Positive
mov al, 0x7F
mov bl, 0x7F
imul bl
ofcfmerge
; Max Positive and Max Negative
mov al, 0x7F
mov bl, 0x80
imul bl
ofcfmerge
; Max Positive and Max Negative
mov al, 0x80
mov bl, 0x7F
imul bl
ofcfmerge
; No Overflow
mov al, 0x1
mov bl, 0x1
imul bl
ofcfmerge
hlt
+69
View File
@@ -0,0 +1,69 @@
%ifdef CONFIG
{
"RegData": {
"RDI": "0x00000000000003fc"
}
}
%endif
%macro ofcfmerge 0
; Get CF
setc al
; Get OF
seto bl
and eax, 1
and ebx, 1
; Merge in to results
shl edi, 1
or edi, eax
; Merge in to results
shl edi, 1
or edi, ebx
%endmacro
mov edi, 0
; Max Negative
mov ax, 0x8000
mov bx, 0x8000
imul bx
ofcfmerge
; Max Positive
mov ax, 0x7FFF
mov bx, 0x7FFF
imul bx
ofcfmerge
; Max Positive and Max Negative
mov ax, 0x7FFF
mov bx, 0x8000
imul bx
ofcfmerge
; Max Positive and Max Negative
mov ax, 0x8000
mov bx, 0x7FFF
imul bx
ofcfmerge
; No Overflow
mov ax, 0x1
mov bx, 0x1
imul bx
ofcfmerge
hlt
+69
View File
@@ -0,0 +1,69 @@
%ifdef CONFIG
{
"RegData": {
"RDI": "0x00000000000003fc"
}
}
%endif
%macro ofcfmerge 0
; Get CF
setc al
; Get OF
seto bl
and eax, 1
and ebx, 1
; Merge in to results
shl edi, 1
or edi, eax
; Merge in to results
shl edi, 1
or edi, ebx
%endmacro
mov edi, 0
; Max Negative
mov eax, 0x80000000
mov ebx, 0x80000000
imul ebx
ofcfmerge
; Max Positive
mov eax, 0x7FFFFFFF
mov ebx, 0x7FFFFFFF
imul ebx
ofcfmerge
; Max Positive and Max Negative
mov eax, 0x7FFFFFFF
mov ebx, 0x80000000
imul ebx
ofcfmerge
; Max Positive and Max Negative
mov eax, 0x80000000
mov ebx, 0x7FFFFFFF
imul ebx
ofcfmerge
; No Overflow
mov eax, 0x1
mov ebx, 0x1
imul ebx
ofcfmerge
hlt
+69
View File
@@ -0,0 +1,69 @@
%ifdef CONFIG
{
"RegData": {
"RDI": "0x00000000000003fc"
}
}
%endif
%macro ofcfmerge 0
; Get CF
setc al
; Get OF
seto bl
and eax, 1
and ebx, 1
; Merge in to results
shl edi, 1
or edi, eax
; Merge in to results
shl edi, 1
or edi, ebx
%endmacro
mov edi, 0
; Max Negative
mov rax, 0x8000000000000000
mov rbx, 0x8000000000000000
imul rbx
ofcfmerge
; Max Positive
mov rax, 0x7FFFFFFFFFFFFFFF
mov rbx, 0x7FFFFFFFFFFFFFFF
imul rbx
ofcfmerge
; Max Positive and Max Negative
mov rax, 0x7FFFFFFFFFFFFFFF
mov rbx, 0x8000000000000000
imul rbx
ofcfmerge
; Max Positive and Max Negative
mov rax, 0x8000000000000000
mov rbx, 0x7FFFFFFFFFFFFFFF
imul rbx
ofcfmerge
; No Overflow
mov rax, 0x1
mov rbx, 0x1
imul rbx
ofcfmerge
hlt
+12 -1
View File
@@ -1,7 +1,7 @@
%ifdef CONFIG
{
"RegData": {
"R15": "0x0000000000c00030"
"R15": "0x000f000000c00030"
}
}
%endif
@@ -28,6 +28,17 @@
mov r8, 0xe0000000
mov r15, 0
; Negative * Negative
mov eax, 0x00008000
mov ebx, 0x00008000
imul ax, bx
ofcfmerge
mov eax, 0x80000000
mov ebx, 0x80000000
imul eax, ebx
ofcfmerge
; Positive * Positive
mov rax, 128
mov rbx, 32