-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FScale'ing zero that should return zero
Added tests will fail without the current patch. This will properly check if we return the correct sign of zero.
- Loading branch information
Showing
4 changed files
with
175 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"R8": "0", | ||
"R9": "0", | ||
"R10": "0", | ||
"R11": "0", | ||
"R12": "0", | ||
"R13": "0x8000000000000000" | ||
} | ||
} | ||
%endif | ||
|
||
section .data | ||
neg_zero dq 0x8000000000000000 ; -0.0 | ||
|
||
section .bss | ||
align 8 | ||
intstor resq 1 | ||
|
||
section .text | ||
global _start | ||
|
||
_start: | ||
; scale by zero (st1 == 0) | ||
mov rax, 0 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r8, [rel intstor] | ||
|
||
; scale by zero (st1 == 1) | ||
mov rax, 1 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r9, [rel intstor] | ||
|
||
; scale by zero (st1 == 100) | ||
mov rax, 100 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r10, [rel intstor] | ||
|
||
; scale by zero (st1 == 1024) | ||
mov rax, 1024 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r11, [rel intstor] | ||
|
||
; scale by zero (st1 == 1048576) | ||
mov rax, 1048576 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
%ifdef CONFIG | ||
{ | ||
"RegData": { | ||
"R8": "0", | ||
"R9": "0", | ||
"R10": "0", | ||
"R11": "0", | ||
"R12": "0" | ||
}, | ||
"Env": { "FEX_X87REDUCEDPRECISION" : "1" } | ||
} | ||
%endif | ||
|
||
section .data | ||
neg_zero dq 0x8000000000000000 ; -0.0 | ||
|
||
section .bss | ||
intstor: resq 1 | ||
|
||
section .text | ||
; scale by zero (st1 == 0) | ||
mov rax, 0 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r8, [rel intstor] | ||
|
||
; scale by zero (st1 == 1) | ||
mov rax, 1 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r9, [rel intstor] | ||
|
||
; scale by zero (st1 == 100) | ||
mov rax, 100 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r10, [rel intstor] | ||
|
||
; scale by zero (st1 == 1024) | ||
mov rax, 1024 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
fscale | ||
fst qword [rel intstor] | ||
mov r11, [rel intstor] | ||
|
||
; scale by zero (st1 == 1048576) | ||
mov rax, 1048576 | ||
mov qword [rel intstor], rax | ||
finit | ||
fild qword [rel intstor] | ||
fldz | ||
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 |