summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Arm64Emitter.h
AgeCommit message (Collapse)Author
2026-01-18Jit: Implement error-free transformation for single-precision FMAJosJuice
This implements the equivalent of 07443e2d41 in Jit64 and JitArm64. Aims to fix https://bugs.dolphin-emu.org/issues/13865.
2024-07-21Emitters: Define Trivial Getters Inlinemitaclaw
2023-12-16JitArm64: Use enum class for LogicalImm size parameterJosJuice
This should prevent issues like the one fixed in the previous commit from happening again.
2023-11-01JitArm64: Add utility for calling a function with argumentsJosJuice
With this, situations where multiple arguments need to be moved from multiple registers become easy to handle, and we also get compile-time checking that the number of arguments is correct.
2023-06-18Arm64Emitter/x64Emitter: Use nodiscard for FixupBranchJosJuice
This should prevent future occurrences of the type of problem that was fixed in b713042.
2023-02-15Fix uninitialized variable warnings (C26495)Pokechu22
2022-12-21Replace BitUtils with C++20: Counting ZeroesMinty-Meeo
With the upgrade to C++20, std::countl_zero and std::countr_zero can replace these home-spun implementations from the BitUtil.h library.
2022-12-11Replace BitUtils with C++20: RotateLeft/RotateRightJosJuice
Now that we've flipped the C++20 switch, let's start making use of the nice new <bit> header. I'm planning on handling this move away from BitUtils.h incrementally in a series of PRs. There may be a few functions remaining in BitUtils.h by the end that C++20 doesn't have any equivalents for.
2022-12-03JitArm64: Implement accurate NaNsJosJuice
For quite some time now, we've had a setting on x86-64 that makes Dolphin handle NaNs in a more accurate but slower way. There's only one game that cares about this, Dragon Ball: Revenge of King Piccolo, and what that game cares about more specifically is that the default NaN (or "generated NaN" as I believe it's called in PowerPC documentation) is the same as on PowerPC. On ARM, the default NaN is the same as on PowerPC, so for the longest time we didn't need to do anything special to get Dragon Ball: Revenge of King Piccolo working. However, in 93e636a I changed how we handle FMA instructions in a way that resulted in the sign of NaNs becoming inverted for nmadd/nmsub instructions, breaking the game. To fix this, let's implement the AccurateNaNs setting, like on x86-64.
2022-11-26JitArm64: Optimize ps_mergeXXJosJuice
1. In some cases, ps_merge01 can be implemented using one instruction. 2. When we need two instructions for ps_merge01, it's best to start with a MOV to avoid false dependencies on the destination register. 3. ps_merge10 can be implemented using a single EXT instruction.
2022-11-21Arm64Emitter: Add MOVPage2R utility functionJosJuice
This new function is like MOVP2R, except it masks out the lower 12 bits, returning them instead of writing them to the register. These lower 12 bits can then be used as an offset for LDR/STR. This lets us turn ADRP+ADD+LDR sequences with a zero offset into ADRP+LDR sequences with a non-zero offset, saving one instruction.
2022-11-01Arm64Emitter: Add ArithOption with ExtendSpecifierBram Speeckaert
ARM64 can do perform various types of sign and zero extension on a register value before using it. The Arm64Emitter already had support for this, but it was kinda hidden away. This commit exposes the functionality by making the ExtendSpecifier enum available everywhere and adding a new ArithOption constructor.
2022-10-22JitArm64: Reimplement Force25BitPrecisionJosJuice
The previous implementation of Force25BitPrecision was essentially a translation of the x86-64 implementation. It worked, but we can make a more efficient implementation by using an AArch64 instruction I don't believe x86-64 has an equivalent of: URSHR. The latency is the same as before, but the instruction count and register count are both reduced.
2022-10-19Arm64Emitter: Combine immh and immb for Emit(Scalar)ShiftImmJosJuice
This simplifies the callers of EmitShiftImm and EmitScalarShiftImm.
2022-07-10Arm64Emitter: Simplify LogicalImm furtherMerry
h/t @dougallj
2022-07-07Arm64Emitter: Simplify LogicalImm logicMerry
Heavily simplify logical immediate encoding. This is based on the observation that if a valid repeating element exists, it repeats through `value`. Thus it does not matter which one you analyse. Thus we skip over the least significent element if LSB = 1 by masking it out with `inverse_mask_from_trailing_ones`, to avoid the degenerate case of a stretch of 1 bits going 'round the end' of the word.
2021-11-20Merge pull request #10055 from JosJuice/jitarm64-reuse-memoryJMC47
JitArm64: Codegen space reuse
2021-11-06Arm64Emitter: Add FRINTI instructionMerry
2021-10-13Arm64Emitter: Check end of allocated space when emitting codeJosJuice
JitArm64 port of 5b52b3e.
2021-10-11Merge pull request #9884 from JosJuice/jitarm64-paired-loadstore-addrJMC47
JitArm64: Improve psq_l/psq_st address checking
2021-09-08JitArm64: Add bitset constants for caller saved registersJosJuice
2021-08-26JitArm64: divwx - Optimize power-of-two divisorsJosJuice
Power-of-two divisors can be done more elegantly, so handle them separately.
2021-08-26JitArm64: divwx - Optimize constant dividendJosJuice
When the dividend is known at compile time, we can eliminate some of the branching and precompute the result for the overflow case.
2021-07-31JitArm64: Implement mtfsfxJosJuice
The sixth and final part of implementing the FPSCR system register instructions.
2021-07-12JitArm64: Stop using hand-encoded logical immediatesJosJuice
2021-07-10JitArm64: Encode logical immediates at compile-time where possibleJosJuice
Manually encoding and decoding logical immediates is error-prone. Using ORRI2R and friends lets us avoid doing the work manually, but in exchange, there is a runtime performance penalty. It's probably rather small, but still, it would be nice if we could let the compiler do the work at compile-time. And that's exactly what this commit does, so now I have no excuse for trying to manually write logical immediates anymore.
2021-07-10JitArm64: Turn IsImmLogical into a constexpr constructorJosJuice
2021-07-10JitArm64: Accept LogicalImm struct as bitwise inst parameterJosJuice
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2021-05-20Merge pull request #9712 from JosJuice/jitarm64-fmul-roundingMai M
JitArm64: Fix fmul rounding issues
2021-05-15JitArm64: Fix fmul rounding issuesJosJuice
This is a port of 4f18f60 to JitArm64.
2021-05-15JitArm64: Implement fresJosJuice
2021-04-25JitArm64: Optimize ConvertSingleToDouble, part 2JosJuice
If we can prove that FCVT will provide a correct conversion, we can use FCVT. This makes the common case a bit faster and the less likely cases (unfortunately including zero, which FCVT actually can convert correctly) a bit slower.
2021-03-19JitArm64: Constant carry flag optimizationsJosJuice
If we know at compile time that the PPC carry flag definitely has a certain value, we can bake that value into the emitted code and skip having to read from PPCState.
2021-03-13Arm64Gen: Convert ARM64Reg to enum classDentomologist
Most changes are just adding ARM64Reg:: in front of the constants.
2021-02-13Arm64Emitter: Use ORR in MOVI2RJosJuice
2021-02-13Arm64Emitter: Improve MOVI2RJosJuice
More or less a complete rewrite of the function which aims to be equally good or better for each given input, without relying on special cases like the old implementation did. In particular, we now have more extensive support for MOVN, as mentioned in a TODO comment.
2021-02-13Arm64Emitter: Allow specifying 21th bit of ADRP immJosJuice
2021-02-13Arm64Emitter: Remove optimize parameter from MOVI2RJosJuice
I don't really see the use of this. (Maybe in the past it was used for when we need a constant number of instructions for backpatching? But we don't use MOVI2R for that now.)
2021-02-07JitArm64: More constant propagation optimizationsJosJuice
PR 9262 added a bunch of Jit64 optimizations, some of which were already in JitArm64 and some which weren't. This change ports the latter ones to JitArm64.
2021-01-31Arm64Emitter: Add BFXILMerryMage
2021-01-23JitArm64: Avoid using X30 with BLRJosJuice
At least on some CPUs (I found out about this from the Arm Cortex-A76 Software Optimization Guide), using X30 with BLR is one cycle slower than using another register.
2021-01-17Arm64Emitter: Convert ShiftType to enum classDentomologist
2021-01-15Arm64Emitter: Convert IndexType to enum classDentomologist
2021-01-01Arm64Emitter: Remove unused OpType enumLioncash
This isn't used anywhere, so we can remove it.
2021-01-01Arm64Emitter: Convert ArithOption enums into enum classesLioncash
Makes the enums strongly typed. While we're at it, we can also make these enums private.
2020-12-30Arm64Emitter: Add shorthand member functions for hint instructionsLioncash
Allows for more concise code.
2020-12-30Arm64Emitter: Make ShiftAmount enum an enum classLioncash
Reduces namespace pollution and makes the enum strongly typed.
2020-12-30Arm64Emitter: Make RoundingMode enum an enum classLioncash
Prevents namespace pollution and makes the enum members strongly typed.
2020-12-30Arm64Emitter: Make PStateField enum an enum classLioncash
Prevents namespace pollution and makes the enum members strongly typed.