mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 18:00:17 +02:00
unittests/ASM: Adds test for too large branch objects
This commit is contained in:
1 parent
5ce6039a02
commit
df08981475
2 files changed
+79
No files matched your search
@@ -0,0 +1,39 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RAX": "1"
|
||||
},
|
||||
"Env": { "FEX_MAXINST" : "41010", "FEX_MULTIBLOCK": "1", "FEX_TSOENABLED": "0" }
|
||||
}
|
||||
%endif
|
||||
|
||||
; FEX-Emu had a bug where it tried to encode too large of a tbz/tbnz offset.
|
||||
|
||||
%macro TooConditionalBitBranch 0
|
||||
; Stresses ARM64's tbz/tbnz branch target of +-32KB.
|
||||
jmp %%top
|
||||
%%top:
|
||||
|
||||
lea rax, [rel data]
|
||||
mov rbx, 1
|
||||
%rep 2000
|
||||
add qword [rel data], rbx
|
||||
%endrep
|
||||
lea rax, [%%top]
|
||||
jpe %%top
|
||||
%endmacro
|
||||
|
||||
mov rax, 0
|
||||
cmp rax, 0
|
||||
mov rcx, 0
|
||||
|
||||
jz long_jump
|
||||
|
||||
TooConditionalBitBranch
|
||||
|
||||
long_jump:
|
||||
mov rax, 1
|
||||
hlt
|
||||
|
||||
data:
|
||||
dq 0, 0, 0, 0
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RAX": "1"
|
||||
},
|
||||
"Env": { "FEX_MAXINST" : "41010", "FEX_MULTIBLOCK": "1", "FEX_TSOENABLED": "0" }
|
||||
}
|
||||
%endif
|
||||
|
||||
; FEX-Emu had a bug where it tried encoding too large of a conditional branch offset.
|
||||
|
||||
%macro TooLargeConditionalBranch 0
|
||||
; Stresses ARM64's b.cc/cbz/cbnz branch target of +-1MB.
|
||||
jmp %%top
|
||||
%%top:
|
||||
|
||||
lea rax, [rel data]
|
||||
mov rbx, 1
|
||||
%rep 37500
|
||||
add qword [rel data], rbx
|
||||
%endrep
|
||||
lea rax, [%%top]
|
||||
jnz %%top
|
||||
%endmacro
|
||||
|
||||
mov rax, 0
|
||||
cmp rax, 0
|
||||
mov rcx, 0
|
||||
|
||||
jz long_jump
|
||||
|
||||
TooLargeConditionalBranch
|
||||
|
||||
long_jump:
|
||||
mov rax, 1
|
||||
hlt
|
||||
|
||||
data:
|
||||
dq 0, 0, 0, 0
|
||||
Reference in new issue
Block a user