From b13162c5bfe2d5df51bd7fce450719a49228d77a Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Wed, 30 Jul 2025 10:44:57 +0200 Subject: [PATCH] asm_tests: Division by zero does not set IE flag --- unittests/32Bit_ASM/X87/D8_F0_2.asm | 18 ++++++++++++++++++ unittests/ASM/X87/D8_F0_2.asm | 17 +++++++++++++++++ unittests/ASM/X87_F64/D8_F0_2_F64.asm | 18 ++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 unittests/32Bit_ASM/X87/D8_F0_2.asm create mode 100644 unittests/ASM/X87/D8_F0_2.asm create mode 100644 unittests/ASM/X87_F64/D8_F0_2_F64.asm diff --git a/unittests/32Bit_ASM/X87/D8_F0_2.asm b/unittests/32Bit_ASM/X87/D8_F0_2.asm new file mode 100644 index 000000000..af32cd1ce --- /dev/null +++ b/unittests/32Bit_ASM/X87/D8_F0_2.asm @@ -0,0 +1,18 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0" + }, + "Mode": "32BIT" +} +%endif + +; Tests that a division by zero does not set the IE flag +finit +fldz +fld1 +fdiv st0, st1 + +fnstsw ax +and eax, 1 +hlt diff --git a/unittests/ASM/X87/D8_F0_2.asm b/unittests/ASM/X87/D8_F0_2.asm new file mode 100644 index 000000000..5c10fbbee --- /dev/null +++ b/unittests/ASM/X87/D8_F0_2.asm @@ -0,0 +1,17 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0" + } +} +%endif + +; Tests that a division by zero does not set the IE flag +finit +fldz +fld1 +fdiv st0, st1 + +fnstsw ax +and rax, 1 +hlt diff --git a/unittests/ASM/X87_F64/D8_F0_2_F64.asm b/unittests/ASM/X87_F64/D8_F0_2_F64.asm new file mode 100644 index 000000000..318ebe82a --- /dev/null +++ b/unittests/ASM/X87_F64/D8_F0_2_F64.asm @@ -0,0 +1,18 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0" + }, + "Env": { "FEX_X87REDUCEDPRECISION" : "1" } +} +%endif + +; Tests that a division by zero does not set the IE flag +finit +fldz +fld1 +fdiv st0, st1 + +fnstsw ax +and rax, 1 +hlt