From b8e6f1bc18f6ac54e6f04d226e3d334e8a699f3d Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Thu, 26 Sep 2024 15:13:27 +0200 Subject: [PATCH] Update tests to check for negative zero --- unittests/ASM/X87/FScale-Zero.asm | 15 ++++++++++++++- unittests/ASM/X87_F64/FScale-Zero_F64.asm | 13 +++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/unittests/ASM/X87/FScale-Zero.asm b/unittests/ASM/X87/FScale-Zero.asm index 4f6423c393..57db659f1d 100644 --- a/unittests/ASM/X87/FScale-Zero.asm +++ b/unittests/ASM/X87/FScale-Zero.asm @@ -5,11 +5,14 @@ "R9": "0", "R10": "0", "R11": "0", - "R12": "0" + "R12": "0", + "R13": "0x8000000000000000" } } %endif +section .data + neg_zero dq 0x8000000000000000 ; -0.0 section .bss align 8 @@ -69,4 +72,14 @@ fscale fst qword [rel intstor] mov r12, [rel intstor] +; tests scaling negative zero +mov rax, 1048576 +mov qword [rel intstor], rax +finit +fild qword [rel intstor] +fld qword [rel neg_zero] +fscale +fst qword [rel intstor] +mov r13, [rel intstor] + hlt diff --git a/unittests/ASM/X87_F64/FScale-Zero_F64.asm b/unittests/ASM/X87_F64/FScale-Zero_F64.asm index 6c178f97db..b3c14301db 100644 --- a/unittests/ASM/X87_F64/FScale-Zero_F64.asm +++ b/unittests/ASM/X87_F64/FScale-Zero_F64.asm @@ -11,6 +11,9 @@ } %endif +section .data + neg_zero dq 0x8000000000000000 ; -0.0 + section .bss intstor: resq 1 @@ -65,4 +68,14 @@ fscale fst qword [rel intstor] mov r12, [rel intstor] +; tests scaling negative zero +mov rax, 1048576 +mov qword [rel intstor], rax +finit +fild qword [rel intstor] +fld qword [rel neg_zero] +fscale +fst qword [rel intstor] +mov r13, [rel intstor] + hlt