Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerPC: Raise alignment exceptions in more situations #9865

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JosJuice
Copy link
Member

@JosJuice JosJuice commented Jul 5, 2021

Intends to improve https://bugs.dolphin-emu.org/issues/12565.

To avoid affecting the performance, the JITs will most of the time not raise alignment exceptions unless you enable the new INI-only setting AlignmentExceptions.

@@ -340,6 +340,9 @@ alignas(16) static const float m_m128 = -128.0f;
// Sizes of the various quantized store types
constexpr std::array<u8, 8> sizes{{32, 0, 0, 0, 8, 16, 8, 16}};

// TODO: Use the actual instruction being emulated (needed for alignment exception emulation)
static const UGeckoInstruction ps_placeholder_instruction = 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could someone who knows Jit64 better give me some advice here? Basically, I want to pass an additional argument to the quantized loadstore routines (so that the slowmem handler then can forward the argument when calling Read_* or Write_*), but all of RSCRATCH, RSCRATCH2 and RSCRATCH_EXTRA are already used for arguments to the quantized loadstore routines. How should I pass the argument?

@JosJuice JosJuice force-pushed the alignment-exceptions branch 3 times, most recently from ec3dcf7 to 82fbdd2 Compare July 5, 2021 10:21
@JosJuice JosJuice marked this pull request as draft July 5, 2021 13:06
@JosJuice JosJuice force-pushed the alignment-exceptions branch 3 times, most recently from ce0ff5a to 4095bb4 Compare July 11, 2021 11:08
@JosJuice JosJuice force-pushed the alignment-exceptions branch 3 times, most recently from 8f6a506 to f2fe307 Compare July 27, 2021 07:49
@JosJuice JosJuice force-pushed the alignment-exceptions branch 5 times, most recently from 009a9d5 to bc62fca Compare August 16, 2021 17:54
@JosJuice JosJuice marked this pull request as ready for review August 16, 2021 18:01
@JosJuice
Copy link
Member Author

While alignment exceptions turned out to have nothing to do with issue 12565, alignment exceptions are still something that would make sense for us to emulate (even if it doesn't affect any games). I've cleaned up the PR after the merge of the PR that fixed 12565, and it should be more or less done other than my earlier question about Jit64.

@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from be099c2 to bc08553 Compare August 16, 2021 19:45
@JosJuice JosJuice force-pushed the alignment-exceptions branch 4 times, most recently from 8a8cbc4 to 952c071 Compare September 5, 2021 20:19
@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from 62a4279 to ff28ef5 Compare October 13, 2021 21:07
@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from dd78802 to bd63545 Compare March 19, 2023 16:58
@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from 1fe4da8 to f683037 Compare May 30, 2023 18:57
@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from 486399a to 4821ecc Compare July 2, 2023 08:01
@JosJuice JosJuice force-pushed the alignment-exceptions branch 4 times, most recently from 7e94d09 to 09fa2dc Compare September 2, 2023 17:24
@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from 4ee50ff to 966dd51 Compare November 13, 2023 18:29
@JosJuice JosJuice force-pushed the alignment-exceptions branch 3 times, most recently from 7b8ae93 to 222e159 Compare January 12, 2024 18:57
@JosJuice JosJuice force-pushed the alignment-exceptions branch 2 times, most recently from d92c173 to a2ba3fc Compare April 20, 2024 15:43
Cleanup, and preparation for one of the upcoming commits.
We will need to check for EXCEPTION_ALIGNMENT in addition to
EXCEPTION_DSI. Let's also throw in EXCEPTION_FAKE_MEMCHECK_HIT
while we're at it so we can skip doing fake DSI exceptions for that.

Reordering the exceptions enum is done for the sake of saving one
instruction on AArch64 when checking for loadstore exceptions.
(Bitwise operations can encode immediates containing a run of ones
of an arbitrary length, rotated by an arbitrary amount of bits.
In order to make use of this, all loadstore exceptions should
have adjacent bit positions.)
To avoid affecting performance, the JITs will most of the time not raise
alignment exceptions unless you enable the new INI-only setting
AlignmentExceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants