From f6a392e14b4a1ae29bacae866d5b62334aee12c9 Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Thu, 16 Jan 2025 09:49:01 +0100 Subject: [PATCH] asm test: Ensure predicate cache is reset when control flow leaves block --- unittests/ASM/X87/MemcopyWithCPUID.asm | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 unittests/ASM/X87/MemcopyWithCPUID.asm diff --git a/unittests/ASM/X87/MemcopyWithCPUID.asm b/unittests/ASM/X87/MemcopyWithCPUID.asm new file mode 100644 index 0000000000..62e7558747 --- /dev/null +++ b/unittests/ASM/X87/MemcopyWithCPUID.asm @@ -0,0 +1,36 @@ +%ifdef CONFIG +{ + "RegData": { + "RBX": "0x8000000000000000", + "RCX": "0x3fff" + } +} +%endif + +; Related to #4274 - ensures that if cpuid clobbers the predicate register, +; we reset the predicate cache. + +section .data +align 8 + +data: + dt 1.0 + +section .bss +align 8 + +data2: + resb 10 + +section .text +lea r8, [rel data] +fld tword [r8] + +mov rax, 0x0 +cpuid ; Will this instruction clobber the predicate register? + +fstp tword [rel data2] + +mov rbx, [rel data2] +mov rcx, [rel data2+8] +hlt