From 766fbe3db3603e4742b939d4ab585f295afbb850 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Tue, 10 Dec 2024 16:27:57 +0000 Subject: [PATCH] unittests: Add a test for constprop size bugs fails on main, fixed by this PR. --- unittests/ASM/FEX_bugs/OptSizeConfusion.asm | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 unittests/ASM/FEX_bugs/OptSizeConfusion.asm diff --git a/unittests/ASM/FEX_bugs/OptSizeConfusion.asm b/unittests/ASM/FEX_bugs/OptSizeConfusion.asm new file mode 100644 index 0000000000..3382bffaa9 --- /dev/null +++ b/unittests/ASM/FEX_bugs/OptSizeConfusion.asm @@ -0,0 +1,26 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x000000000f0f0f0f", + "RBX": "0x000000000f0f0f0f", + "RCX": "0x000000000f0f0f0f", + "RDX": "0x00000000ffffffff", + "R9": "0x000000000f0f0f0f" + } +} +%endif + +; FEX had several bugs in its constprop pass where 32->64 bit truncation behaviour wasn't accounted for leading +; to incorrectly inserting instead. + +mov rax, 0x0f0f0f0f0f0f0f0f +mov rbx, 0x0f0f0f0f0f0f0f0f +mov rcx, 0x0f0f0f0f0f0f0f0f +mov rdx, 1 +mov r9, 0x0f0f0f0f0f0f0f0f +xor eax, 0 +and ebx, ebx +shr ecx, 0 +neg edx +shl r9d, 0 +hlt