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