Commit Graph

19 Commits

Author SHA1 Message Date
Paulo Matos
6c6d86f761 unittests: Set tag properly in X87 FST(reg) 2024-06-19 10:02:05 +02:00
Mai
afaff9293b
Merge pull request #2316 from Sonicadvance1/fix_negative_ficomi_f64
X87_F64: Fixes FICOM
2023-01-24 17:31:05 +00:00
Mai
ee58c5de1d
Merge pull request #2315 from Sonicadvance1/add_negative_unittests
unittests: Adds negative integer x87 tests
2023-01-18 20:27:59 +00:00
CallumDev
806587d6ae Fix FPREM flags calculation in F64 2023-01-09 22:21:23 +10:30
Ryan Houdek
f156615a3a unittests: Adds unittests to ensure FICOM works
Both x80 and x64 variants.
2023-01-08 11:04:28 -08:00
Ryan Houdek
555d2e5b0b unittests: Adds negative integer x87 tests
All of these operations were only testing positive integers which is why
they didn't show 16-bit failures.

Adds a bunch of negative tests to each ones now that #2314 is merged,
which would have caught them.
2023-01-08 10:44:46 -08:00
Ryan Houdek
76dd2369a7 unittests/asm: Adds more extensive FPREM/FPREM1 tests
unit tests that show the difference of output between FPREM and FPREM1.
Setup as known failures on everything except for host since we don't
implement fprem correctly.

An incorrect fix to FPREM is as follows:
```diff
--- a/External/FEXCore/Source/Common/SoftFloat.h
+++ b/External/FEXCore/Source/Common/SoftFloat.h
@@ -158,6 +158,10 @@ struct X80SoftFloat {

     return Result;
 #else
+    BIGFLOAT lhs_ = lhs;
+    BIGFLOAT rhs_ = rhs;
+    BIGFLOAT Result = fmodl(lhs_, rhs_);
+    return Result;
     return extF80_rem(lhs, rhs);
 #endif
   }
```

But we shouldn't implement this fix. We should instead implement a new `extF80_mod`
function that handles the rounding differences between FPREM and FPREM1.

Fixes #2097.
Doesn't attempt to resolve #1538
2022-10-22 20:47:24 -07:00
Ryan Houdek
3b0fb27ae9 Softfloat: Fixes FSCALE
I misread the implementation details of this instruction when
implementing.

The pseudocode says `ST(0) = ST(0) ∗ 2^rndint(ST(1))` so I understood
the instruction to use the current rounding mode of the host to extract
the integer portion of `ST(1)`.

The actual implementation is in the details of the statement `the
integer portion of the floating- point value in ST(1).`

This behaves like round towards zero/truncate, additional hardware
testing and documentation reading confirms this.

Fixes #1584
2022-03-13 14:11:31 -07:00
Ryan Houdek
6ba4aec88e unittests: Adds a BCD unit test
Nothing really fantastical found here. Just that sub-precision results
weren't rounded correctly on store

Fixes #770
2022-01-09 01:36:26 -08:00
Ryan Houdek
b8c5cf2736 Adds FXAM unit tests for ABI conformance
Wine was doing a fun x87 stack clean by checking tag bits for empty.
We hadn't previously supported anything but valid. Which cause wine to overflow the stack
trying to save all of the x87 values.

We now support valid and empty well enough that this doesn't break and we can unit test it
2021-07-27 08:25:40 -07:00
Ryan Houdek
4b6914ad80 Implements unit tests to test the stack popping
Only tests the stack popping for FCOMP, FUCOMP, FCOMPP, and FUCOMPP.
2020-10-27 23:11:30 -07:00
Ryan Houdek
a4f92b8564 Removes some undefined behaviour in f2xm1 unit test
If the input range is outside of -1.0 to +1.0 then the result is
undefined.
To avoid precision problems just check for zero, aka 2^0-1 which also
returns zero
2020-09-23 09:45:08 -07:00
Ryan Houdek
f5d15df6be Flips incorrect argument order in fyl2x unit test 2020-09-23 09:44:32 -07:00
Ryan Houdek
9ed9497f06 Removes some undefined behaviour in x87 inc/dec stp tests 2020-09-23 09:42:45 -07:00
Ryan Houdek
6cd4896db3 Fixes bugged x87 fcmov tests 2020-09-23 09:42:10 -07:00
Ryan Houdek
0c7c7ba670 Removes undefined behaviour in our unit tests
Most of these were relying on the upper 16bits of the 80bit MM registers
to be zero.
This isn't necessarily true as one will find out when running this under
the host runner.
2020-09-22 18:32:19 -07:00
Ryan Houdek
705c9a2633 Fixes st(i) unit test
This needs to pull the value off the stack /prior/ to pushing
2020-09-15 13:34:21 +03:00
Ryan Houdek
68fba3ffb5 Adds FFREEP unit test 2020-06-20 08:16:21 -07:00
Ryan Houdek
633e3ddb33 x87 based unit tests! 2020-05-28 14:47:43 -07:00