70 Commits

Author SHA1 Message Date
Tim Jarzombek 398e0b025d Fix bugs caught by fuzzing 2026-02-12 21:11:11 -05:00
dingusdev 213dd4c16e Update copyright info further 2026-01-30 08:12:04 -07:00
Maxim Poliakovski e75ee8d32a Update copyright year. 2026-01-30 12:15:00 +01:00
dingusdev 742a810624 Restored floating point testing 2026-01-07 18:45:47 -07:00
dingusdev 88b5b2ec66 Prep for Alpha 1.0.3 2025-04-18 21:22:19 -07:00
joevt 82a48899f0 Change ppc_opcode_grabber to a variable. 2025-02-10 07:01:32 -07:00
joevt 2f30395d00 Break long lines.
Make them 130 characters or less.
2025-01-30 06:30:51 -07:00
Mihai Parparita 134339ae9d Mitigate performance impact of respecting FP bit
In #135 we switched from a static OpcodeGrabber table to a
curOpcodeGrabber pointer in ppc_main_opcode. This results in an extra
indirection (as far as generated assembly having an additional load),
which reduces execution speed.

Switch to making the opcode grabber into a parameter to
ppc_main_opcode, and make ppc_exec_inner keep it up to date (via an
EXEF_OPCODE exception flag).

Also fixes FPU instructions in ppctests - we now need to set the FP
MSR bit when initializing the CPU.
2025-01-25 17:58:31 -08:00
Mihai Parparita b759f25d87 ppc: Use a unified opcode lookup table
Instead of a primary opcode lookup table with 64 entries and a few
smaller tables with 4-2048 entries, use a single 64 * 2048 (128K)
entry table to dispatch opcodes.

Helps with performance, since we avoid the function call overhead for
some frequently-used instructions (e.g. branch, integer, floating point).
Saves ~2 seconds from the time to Welcome to Macintosh (same measurement
methodology as #125)

Secondarily also makes opcode registration/decoding a bit more uniform,
and scannable, since it's now all in initialize_ppc_opcode_table.
2024-11-30 20:37:26 +01:00
Mihai Parparita 564c43c907 Remove ppc_cur_instruction global variable
Replace it wth an explicit opcode parameter that is passed around. That
is both slightly easier to reason about (to trace where it comes from)
and slightly faster, since it can be read from a register.

On my machine takes booting to "Welcome to Macintosh" being output in
a verbose boot of Mac OS X 10.2.8 from 31.8s to 30.6s (average of 5
runs, measured using deterministic mode and looking at when execution
reaches PC 0x90004a88).
2024-11-28 23:41:38 +01:00
joevt b38b1731a0 ppcopcodes: Don't change MQ if not MPC601.
MQ should not be writable if not doing MPC601.
Fix is_601 and include_601.
This fixes risu tests.
2024-11-27 07:59:19 -07:00
dingusdev 02c8c8cde0 Fix bench + test compilation (again) 2024-09-30 20:35:33 -07:00
joevt 4f45d7de35 cpu: Add cpu options to ppc_cpu_init.
The first option is a flag that enables MPC601 (POWER) instructions for CPUs that are not MPC601.
This can be useful for the following reasons:
1) To produce results similar to classic Mac OS which emulates MPC601 instructions on CPUs that don't implement MPC601 instructions. This option is used to compare the risu traces produced in Mac OS 9 on a G3 or G4 with DPPC.
2) May increase performance in apps that use POWER instructions on emulated machines with CPUs that are not MPC601. It is not known if any such apps exist but there could be since Apple included MPC601 emulation in classic Mac OS.
2024-04-10 06:43:18 -07:00
joevt 566706dd62 ppctests: Fix compiler warnings. 2024-03-28 07:17:38 -07:00
joevt 78558e4c52 debugger: Ensure space between opcode and operand.
Instructions that are 8 characters or longer (such as mtdbat3l) did not have a space between opcode and operand. Now there is always a space. The width of the opcode column is unchanged except for those opcodes that have 8 or more characters.
2024-03-28 06:54:23 -07:00
joevt 267a9448ea ppctest: Fix floating-point tests.
genppctests.py
- Fix incorrect bits for some floating-point instruction opcodes or fields.
- Use separate register for FP results like DolphinPPCTests does.
- Remove extra FMULS.
- Use a regular expression for parsing ppcfloattest.txt. Don't parse the values, just put them in the output ppcloattests.csv file.

ppcfloattest.txt
- Clear crf0 and crf7 because we only care about crf1.
- Use values from DolphinPPCTests (0.0, 0.5, 1.0, 3.5, DBL_MAX, FLT_MAX, 2.4679999352, 4.9359998704, etc.). Some of the values were rounded. This will un-round them. Specify snan or qnan instead of nan.
- One of the FCMPO and FCMPU tests had qnan instead of snan input values.

ppcfloattest.csv
- Regenerate this file using the updated genppctests.py which uses the updated ppcfloattest.txt.

ppctests
- Update double_from_string to be able to parse the new values (snan, qnan, FLT_MAX, DBL_MAX).
2024-02-10 14:56:21 -07:00
dingusdev a5ce6a806f CPU clean-up 2024-01-07 17:04:51 -07:00
dingusdev 924b80574a Further fix from last commit 2024-01-05 15:53:56 -07:00
dingusdev f3a759c80d CPU code clean-up 2024-01-05 15:11:37 -07:00
Maxim Poliakovski a1d8f8aa4e ppctests: fix test cases with SNaN/QNaN operands. 2023-11-30 17:44:46 +01:00
Maxim Poliakovski 0a9107b602 ppcfloattests.csv: remove unrelated CR7 changes. 2023-11-30 12:28:32 +01:00
Maxim Poliakovski 6abb07e61b Add rounding control for the host FPU. 2023-11-30 12:06:44 +01:00
dingusdev 87b8a8e0a0 Correcting multiply tests 2023-11-28 19:02:48 -07:00
dingusdev c2a63bab09 FP Opcode Test Fixes 2021-10-30 16:43:13 -07:00
dingusdev 767735251b FP comp tests & various fixes 2021-10-24 14:00:35 -07:00
dingusdev a28ef677fd Fixing FP mul ops & tests 2021-10-23 13:05:20 -07:00
Maxim Poliakovski c0cd6eb38f Add missing licence headers, update license date. 2021-10-23 21:00:31 +02:00
dingusdev fb277945c2 Floating point test fixes 2021-10-19 07:16:15 -07:00
dingusdev 3c7fc58ac0 Small test case fixes for floating points 2021-10-16 22:33:56 -07:00
dingusdev 00dd99d851 Temporarily removing comparisons
These seem to cause the test program to crash. Will reinstate once the cause of the crash is resolved.
2021-10-15 20:02:00 -07:00
dingusdev 7d7a4b453f Partial test file reading fix 2021-10-15 06:28:11 -07:00
dingusdev 7ce94a6ab5 Further fixing the test code 2021-10-14 21:05:58 -07:00
dingusdev 9251745d6f Fixed floating-point test generation 2021-10-14 07:19:04 -07:00
dingusdev 07a4166eef Preliminary work on floating point tests 2021-06-25 21:20:53 -07:00
dingusdev 593230f326 Disassembler - floating point instruction fixes 2021-01-23 22:44:14 -07:00
dingusdev 680b437b74 Fixed disassembly for fctiwz, frsp, and fctiw 2021-01-23 21:30:29 -07:00
dingusdev 2539faef7e Small typo fixes 2021-01-23 15:10:08 -07:00
Maxim Poliakovski 014eefdf7e ppcdisasm: fix frsp and add tests for it. 2021-01-23 02:32:30 +01:00
dingusdev dc58386237 Started re-refactoring opcode retrieval 2020-10-17 14:30:37 -07:00
Waqar Ahmed 0ab9380be3 clang-format everything 2020-05-12 23:55:45 +05:00
dingusdev e31f7873f5 Fixed redunant variable names for PPC emulation. 2020-03-04 21:29:04 -07:00
Maxim Poliakovski cbb46e8f30 More tests to reaveal wrong disassembly. 2020-03-01 18:21:57 +01:00
dingusdev e9a616ffeb Started working on incorporating loguru 2020-02-23 20:59:10 -07:00
dingusdev 6428f324f6 icbi fixed 2020-02-19 19:37:51 -07:00
dingusdev 9138b9bafc Quick fix for cmp 2020-02-19 19:12:23 -07:00
dingusdev c71be1bc37 Fixed compare instructions 2020-02-19 19:03:39 -07:00
Maxim Poliakovski 8671517a08 ppcdisasm: new tests and fixes for rlwinm/rlwimi. 2020-02-20 02:27:48 +01:00
dingusdev 6f6e5671d4 Fixed test cases for stfd(u) and sllq(.) 2020-02-15 12:09:27 -07:00
dingusdev ef27fcec69 More tests, more fixes
Only significant bugs left are with stfd(u) and sllq(.)
2020-02-15 11:29:03 -07:00
dingusdev 4f02a98c2b More tests +fix for fsel 2020-02-14 07:58:30 -07:00