Ryujinx-uplift/Ryujinx.Tests/Cpu
riperiperi 9db73f74cf
ARMeilleure: Respect FZ/RM flags for all floating point operations (#4618)
* ARMeilleure: Respect Fz flag for all floating point operations.

This is a change in strategy for emulating the Fz FPCR flag. Before, it was set before instructions that "needed it" and reset after. However, this missed a few hot instructions like the multiplication instruction, and the entirety of A32.

The new strategy is to set the Fz flag only in the following circumstances:

- Set to match FPCR before translated functions/loop are executed.
- Reset when calling SoftFloat methods, set when returning.
- Reset when exiting execution.

This allows us to remove the code around the existing Fz aware instructions, and get the accuracy benefits on all floating point instructions executed while in translated code.

Single step executions now need to be called with a context wrapper - right now it just contains the Fz flag initialization, and won't actually do anything on ARM.

This fixes a bug in Breath of the Wild where some physics interactions could randomly crash the game due to subnormal values not flushing to zero.

This is draft right now because I need to answer the questions:
- Does dotnet avoid changing the value of Mxcsr?
- Is it a good idea to assume that? Or should the flag set/restore be done on every managed method call, not just softfloat?
- If we assume that, do we want a unit test to verify the behaviour?

I recommend testing a bunch of games, especially games affected when this was originally added, such as #1611.

* Remove unused method

* Use FMA for Fmadd, Fmsub, Fnmadd, Fnmsub, Fmla, Fmls

...when available.

Similar implementation to A32

* Use FMA for Frecps, Frsqrts

* Don't set DAZ.

* Add round mode to ARM FP mode

* Fix mistakes

* Add test for FP state when calling managed methods

* Add explanatory comment to test.

* Cleanup

* Add A64 FPCR flags

* Vrintx_S A32 fast path on A64 backend

* Address feedback 1, re-enable DAZ

* Fix FMA instructions By Elem

* Address feedback
2023-04-10 12:22:58 +02:00
..
Arm64CodeGenCommonTests.cs Arm64: Simplify TryEncodeBitMask and use for constants (#4328) 2023-01-22 14:15:49 +00:00
CpuContext.cs Refactor CPU interface to allow the implementation of other CPU emulators (#3362) 2022-05-31 16:29:35 -03:00
CpuTest32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTest.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAlu32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAlu.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluBinary32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluBinary.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluImm32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluImm.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluRs32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluRs.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestAluRx.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestBf32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestBfm.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestCcmpImm.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestCcmpReg.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestCsel.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestMisc32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestMisc.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestMov.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestMul32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestMul.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimd32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimd.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdCrypto32.cs Implement AESMC, AESIMC, AESE, AESD and VEOR AArch32 instructions (#982) 2020-03-14 10:29:58 +11:00
CpuTestSimdCrypto.cs Add a new JIT compiler for CPU code (#693) 2019-08-08 21:56:22 +03:00
CpuTestSimdCvt32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdCvt.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdExt.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdFcond.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdFmov.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdImm.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdIns.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdLogical32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdMemory32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdMov32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdReg32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdReg.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdRegElem32.cs Removed unused usings. (#3593) 2022-08-18 18:04:54 +02:00
CpuTestSimdRegElem.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdRegElemF.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdShImm32.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdShImm.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSimdTbl.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestSystem.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
CpuTestT32Alu.cs Removed unused usings. (#3593) 2022-08-18 18:04:54 +02:00
CpuTestT32Flow.cs T32: Implement B, B.cond, BL, BLX (#3155) 2022-03-04 23:05:08 +01:00
CpuTestT32Mem.cs Removed unused usings. (#3593) 2022-08-18 18:04:54 +02:00
CpuTestThumb.cs Replace unicorn bindings with Nuget package (#4378) 2023-02-09 02:24:32 +01:00
EnvironmentTests.cs ARMeilleure: Respect FZ/RM flags for all floating point operations (#4618) 2023-04-10 12:22:58 +02:00
PrecomputedMemoryThumbTestCase.cs Removed unused usings. (#3593) 2022-08-18 18:04:54 +02:00
PrecomputedThumbTestCase.cs T32: Implement ALU (shifted register) instructions (#3135) 2022-02-22 19:11:28 -03:00