summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Arm64Emitter.cpp
AgeCommit message (Collapse)Author
2026-07-08mingw: lower case windows includesCraig Carnell
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.
2026-01-18Arm64Emitter: Fix Q bit of vector SHL/URSHR encodingJosJuice
This doesn't affect any existing callers, because all existing callers use quad registers.
2025-11-10Merge pull request #13875 from JosJuice/jitarm64-orr-base-without-mirrorJosJuice
JitArm64: Add missing ORR pattern in MOVI2RImpl
2025-08-24Arm64Emitter: Replace shifting size by 4 with IntLog2 minus 3JosJuice
The instruction implementations that were shifting the size by 4 would emit an incorrect instruction when given a size of 64. The correct implementation is to count the number of leading or trailing zeroes in the size parameter, which is what IntLog2 does. No callers are affected by this, as they all use sizes other than 64. Actually, some of these instructions are even invalid with a size of 64, but I'm changing them anyway for consistency with the others.
2025-08-21JitArm64: Add early exit in MOVI2RImpl ORR loopJosJuice
Just for performance.
2025-08-21JitArm64: Add missing ORR pattern in MOVI2RImplJosJuice
We should attempt to use not only mirrored versions of the immediate as an ORR base, but also the immediate itself. This lets us emit certain 64-bit constants using fewer instructions.
2025-03-11Core/Common: Fix typosLuz Paz
Found via `codespell -q 3 -S "./Externals,./Data/Sys/wiitdb-??.txt,*.po,*.pot" -L andf,asnd,bootup,brocken,bufferin,clen,collet,datas,delt,diety,extint,fpr,inout,inport,interm,nd,nin,ontop,pixelx,re-use,re-used,sav,stateman,strat,transer,wil`
2024-07-21Emitters: Define Trivial Getters Inlinemitaclaw
2024-05-07Arm64FloatEmitter: 64-Bit Assert In ABI_PushRegistersmitaclaw
2024-05-03Replace Common::BitCast with std::bit_castPokechu22
2024-04-21Arm64Emitter: Fix shadowed variableJosJuice
A lambda at the end of ARM64XEmitter::ParallelMoves named its parameter `move`.
2024-04-21Arm64Emitter: Fix incorrect assert categoryJosJuice
2024-02-06Arm64Emitter: Don't optimize ADD to MOV for SPJosJuice
Unlike ADD (immediate), MOV (register) treats SP as ZR. Therefore the ADDI2R optimization that was added in 67791d227c can't optimize ADD to MOV when exactly one of the registers is SP. There currently isn't any code in Dolphin that calls ADDI2R with parameters that would trigger this case.
2023-12-21JitArm64: Fix the "do nothing" cases of ANDI2R and friendsJosJuice
So somehow I forgot that AArch64 uses three-operand encoding... Fixes a regression from 6303416201 which manifested in various ways, such as incorrect rendering of the Wind Waker title screen.
2023-12-17JitArm64: Improve codegen in ANDI2R and friendsJosJuice
The codegen for the functions themselves, not for the emitted code. This seems to save 32 bytes per function. We also get rid of the oddity we had before where ANDI2R would do masking for 32-bit operations but the other functions wouldn't.
2023-12-17JitArm64: Optimize additional cases of ANDI2R and friendsJosJuice
Now we'll never need a scratch register for values that are all zeroes or all ones.
2023-12-17JitArm64: Optimize ANDI2R and friends to no-ops when possibleJosJuice
This optimizes rlwnmx with mask == 0xFFFFFFFF.
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-12-01JitArm64: Add special zero case to ADDI2RJosJuice
This normally doesn't reduce the instruction count, but is nonetheless useful on CPUs that can do 0-cycle moves.
2023-12-01JitArm64: Mask input to 32-bit ADDI2RJosJuice
In case the input was a s32 that got sign extended as part of conversion to u64.
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-08-22Move SmallVector to CommonJosJuice
We had one implementation of this type of data structure in Arm64Emitter and one in VideoCommon. This moves the Arm64Emitter implementation to its own file and adds begin and end functions to it, so that VideoCommon can use it. You may notice that the license header for the new file is CC0. I wrote the Arm64Emitter implementation of SmallVector, so this should be no problem.
2023-04-15Common/MathUtil: Move IntLog2 into MathUtil namespaceLioncash
Gets this out of the global namespace.
2022-12-10Arm64Emitter: Fix SHRN/SHRN2JosJuice
The "vector shift by immediate" category encodes the shift amount for right shifts as `size - amount`, whereas left shifts use `amount`. We're not actually using SHRN/SHRN2 anywhere, which is why this has gone undetected.
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-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-09-18Arm64Emitter: Add additional alignment assertionsPokechu22
Before, unaligned values would be silently ignored in most cases.
2022-08-05Arm64Emitter: Fix encoding of size for ADD (vector)JosJuice
This was causing a bug in the rounding of paired single multiplication operands. If Force25BitPrecision was called for quad registers, the element size of its ADD instruction would get treated as if it was 16 instead of the intended 64, which would cause the result of the calculation to be incorrect if the carry had to pass a 16-bit boundary. Fixes one of the two bugs reported in https://bugs.dolphin-emu.org/issues/12998.
2022-01-13Cast to int for enums that are not formattablePokechu22
2022-01-09Common/Assert: Actually use the ASSERT_MSG's log type parameterPokechu22
Since it was unused, nonexistent values were used in a few places. I've replaced them.
2022-01-09Common/Assert: Switch to fmtPokechu22
2021-12-10Treewide: Adjust order of includesPokechu22
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-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: Turn IsImmLogical into a constexpr constructorJosJuice
2021-07-10JitArm64: Accept LogicalImm struct as bitwise inst parameterJosJuice
2021-07-07Arm64Emitter: Fix 64-bit TBZ/TBNZ encodingJosJuice
We haven't actually used 64-bit TBZ/TBNZ anywhere in Dolphin, so this mistake hasn't broken anything, but let's fix it regardless.
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-28JitArm64: Fix MSVC warningsJosJuice
2021-05-22Apple M1: Build, Analytics, and Memory ManagementSkyler Saleh
Analytics: - Incorporated fix to allow the full set of analytics that was recommended by spotlightishere BuildMacOSUniversalBinary: - The x86_64 slice for a universal binary is now built for 10.12 - The universal binary build script now can be configured though command line options instead of modifying the script itself. - os.system calls were replaced with equivalent subprocess calls - Formatting was reworked to be more PEP 8 compliant - The script was refactored to make it more modular - The com.apple.security.cs.disable-library-validation entitlement was removed Memory Management: - Changed the JITPageWrite*Execute*() functions to incorporate support for nesting Other: - Fixed several small lint errors - Fixed doc and formatting mistakes - Several small refactors to make things clearer
2021-05-22Apple M1 Support for MacOSSkyler Saleh
This commit adds support for compiling Dolphin for ARM on MacOS so that it can run natively on the M1 processors without running through Rosseta2 emulation providing a 30-50% performance speedup and less hitches from Rosseta2. It consists of several key changes: - Adding support for W^X allocation(MAP_JIT) for the ARM JIT - Adding the machine context and config info to identify the M1 processor - Additions to the build system and docs to support building universal binaries - Adding code signing entitlements to access the MAP_JIT functionality - Updating the MoltenVK libvulkan.dylib to a newer version with M1 support
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.