Commit graph

1816 commits

Author SHA1 Message Date
MerryMage
e10985d179 ir/basic_block: Add FastDispatchHint to TerminalToString
Use a boost::static_visitor to ensure this is caught at compile-time in the future.
2020-04-22 21:04:23 +01:00
Lioncash
af3614553b A64/impl: Move AccType and MemOp enum into general IR emitter header
These will be used by both frontends in the future, so this performs the
migratory changes separate from the changes that will make use of them.
2020-04-22 21:04:23 +01:00
Markus Wick
93668c24be A64/x64: Create a global_offset optimization for the page table.
Instead of looking up the page table like:
  table[addr >> 12][addr & 0xFFF]
We can use a global offset on the table to query the memory like:
  table[addr >> 12][addr]

This saves two instructions on *every* memory access within the recompiler.

Thanks at skmp for the idea.
2020-04-22 21:04:23 +01:00
MerryMage
6325ac23eb a32_emit_x64: Use std::get_if in EmitA32Coproc* 2020-04-22 21:04:23 +01:00
MerryMage
39bd2c034d constant_propagation_pass: Handle GetCarryFromOp for MostSignificantWord 2020-04-22 21:04:23 +01:00
MerryMage
ada66d7092 a32_interface: Remove unused TransferJitState function 2020-04-22 21:04:23 +01:00
MerryMage
b4884a51e0 a32_jitstate: Only transfer required state
Importantly, reset exclusive state upon transfer.
2020-04-22 21:04:23 +01:00
MerryMage
1aa7b62e92 A32/Thumb: Correct behaviour for UDF and Unpredictable instructions
Raise an exception instead of calling the interpreter and ASSERT-ing respectively.
2020-04-22 21:04:23 +01:00
MerryMage
c7d20f3f2f fuzz_arm: Test MSR and MRS instructions against unicorn
* Add always_little_endian option to mach unicorn behavior.
* Correct CPSR.Mode = Usermode
2020-04-22 21:04:23 +01:00
MerryMage
2f06ef5d4e a32_emit_x64: EmitA32SetCpsr: BUGFIX: Actually set CPSR.GE
Was unintentionally masking the writing of CPSR.GE due to 32-bit immediate sign extension.
2020-04-22 21:04:23 +01:00
MerryMage
0a6f822d76 a32_emit_x64: GenTerminalHandlers: Remove unnecessary mov 2020-04-22 21:04:23 +01:00
MerryMage
717bd2fbb2 A64: Add hook_hint_instructions option 2020-04-22 21:04:23 +01:00
MerryMage
396116ee61 A32: Add hook_hint_instructions option 2020-04-22 21:04:23 +01:00
MerryMage
2f2a859615 a32_jitstate: Consolidate upper bits of location descriptor into upper_location_descriptor
Also solves a performance regression initially introduced by b6e8297e369f2dc4758bafe944e51efb8d1a2552,
primarily due to excessively mismatched load/store sizes causing less than optimal load-to-store forwarding.
2020-04-22 21:04:23 +01:00
MerryMage
e41a7dc678 CMakeLists: Temporarily remove export
Unable to export fmt in projects that have DYNARMIC_NO_BUNDLED_FMT enabled
2020-04-22 21:04:22 +01:00
Merry
1c97edac77 Merge pull request #503 from lioncash/cmp
A64: Implement half-precision variants of FCMEQ
2020-04-22 21:04:22 +01:00
Merry
f252a62c1b Merge pull request #502 from lioncash/header
General: Remove unnecessary includes
2020-04-22 21:04:22 +01:00
Lioncash
11d1114a17 A64: Implement all half-precision variants of FCMEQ 2020-04-22 21:04:22 +01:00
Lioncash
22bd95902d backend/x64/reg_alloc: Apply const where applicable
Also tidies up bracing where applicable along the way.
2020-04-22 21:04:22 +01:00
Lioncash
349d4b577a General: Remove unnecessary includes
Removes unnecessary header dependencies that have accumulated over time
as changes have been made. Lessens the amount of files that need to be
rebuilt when the headers change.
2020-04-22 21:04:22 +01:00
Lioncash
43fd2b400a frontend/ir_emitter: Add half-precision opcode for FPVectorEquals 2020-04-22 21:04:22 +01:00
Lioncash
cba9351b82 backend/x64/emit_*: Apply const where applicable 2020-04-22 21:04:22 +01:00
Lioncash
557a01a787 common/fp/op: Add soft-float implementation of FPCompareEQ
This will be used to implement the half-precision floating-point
variants of FCMEQ in following changes.
2020-04-22 21:04:22 +01:00
Lioncash
dd315e89eb A64/translate/*: Apply const where applicable
Just some tidying up for consistency
2020-04-22 21:04:22 +01:00
Lioncash
d9d59bc1f4 common/cast_util: Declare BitCast and BitCastPointee with the noexcept specifier
std::bit_cast is also defined with the noexcept specifier, so we can do
the same here to match up with it and stay similar with the standard
library.
2020-04-22 21:04:22 +01:00
Lioncash
4f47861669 A64/translate/impl: Mark DecodeBitMasks and AdvSIMDExpandImm as static
These don't rely on instance state to perform their behavior. They're
just helper functions.
2020-04-22 21:04:22 +01:00
Lioncash
dddba94c17 disassembler_arm: Apply const where applicable 2020-04-22 21:04:22 +01:00
Lioncash
9365487797 frontend/A32/ir_emitter: Remove unnecessary includes
std::initializer_list isn't used anywhere in here, and we can just
forward declare the CoprocReg enum to avoid needing to include the
header.
2020-04-22 21:04:22 +01:00
Lioncash
23f56bdb67 x64/exception_handler_windows: Join namespace declaration
Uses a nested namespace declaration like the rest of the codebase.
2020-04-22 21:04:22 +01:00
Lioncash
3bbb06c34a a64_emit_x64: Apply [[maybe_unused]] to unused lambda parameter
This can result in an unused variable warning on Windows otherwise.
2020-04-22 21:04:22 +01:00
Lioncash
bfa8035414 A32/A64: Make public header inclusions consistent
For all public header inclusions, we use the <> form of including them
as opposed to "", which we typically use for internal headers.
2020-04-22 21:04:22 +01:00
Lioncash
ccf923305c a32_interface: Remove duplicated documentation comments
These already exist in the header, so these ones can be removed.
2020-04-22 21:04:22 +01:00
Lioncash
fb7d33830c A32: Make includes consistent
Normalizes includes to be relative to the project root, like the rest of
the includes in the project.
2020-04-22 21:04:22 +01:00
Lioncash
b57ed8917a frontend/A32/types: Remove redundant std::string initializer
std::string initializes to empty by default. While we're at it, brace a
lone unbraced if statement.
2020-04-22 21:04:22 +01:00
Lioncash
25b4e463d3 ir_opt/a64_get_set_elimination_pass: Remove redundant return
This lambda function has a void return type, so we don't need to
explicitly return at the end of it.
2020-04-22 21:04:22 +01:00
Lioncash
182ceb2807 General: Make parameter names from declarations and implementations consistent
Most of the time when this occurs, it's a bug. Thankfully this isn't the
case. However, we can resolve these cases to make the codebase more
consistent.
2020-04-22 21:04:22 +01:00
MerryMage
3513ed1c60 CMakeLists: Define FMT_USE_USER_DEFINED_LITERALS=0
This disable a fmtlib feature that depends on a non-standard feature
for its implementation.
2020-04-22 21:04:22 +01:00
Lioncash
b301fcd520 A32/translate/translate: Add missing doxygen parameter string 2020-04-22 21:04:22 +01:00
Lioncash
44b61212e5 Revert "CMakeLists: Handle DYNARMIC_NO_BUNDLED_FMT in relation to export()"
I was being silly. This isn't required.

This reverts commit 00b79cbb72c61744470e0aa1a96b673702b33931.
2020-04-22 21:04:22 +01:00
Lioncash
6b9bf7868a General: Correct typos is code comments 2020-04-22 21:04:22 +01:00
Lioncash
acd7ac5ed3 CMakeLists: Handle DYNARMIC_NO_BUNDLED_FMT in relation to export()
This is pretty gross, but until DYNARMIC_NO_BUNDLED_FMT is eliminated,
this fixes the use of it in existing libraries or applications making
use of dynarmic.
2020-04-22 21:04:22 +01:00
Lioncash
6187de7ca7 a32_interface: std::move UserConfig where applicable
UserConfig instances contain up to 16 std::shared_ptr<Coprocessor>
instances. We can std::move here to avoid performing 16 redundant atomic
reference increment and decrement operations.

Mostly inconsequential on x64, but we may as well signify intent.
2020-04-22 21:04:22 +01:00
MerryMage
7d20f3b861 A32/translate_thumb: Split off implementation into thumb16 and thumb32 2020-04-22 21:04:22 +01:00
Lioncash
b79ce71b0f ir/basic_block: std::move Terminal within SetTerminal and ReplaceTerminal
A terminal isn't a trivial type (and boost::variant is allowed to heap
allocate), so we can std::move it here to avoid a redundant copy.
2020-04-22 21:04:22 +01:00
MerryMage
e639aa1583 A32/translate: Rename translate_arm directory to impl
Mirror what the A64 frontend does.
2020-04-22 21:04:22 +01:00
Lioncash
63eff4e7cc ir/terminal: std::move constructor parameters where applicable
Allows the compiler to choose the most suitable code in this scenario,
given a Terminal isn't a trivial type.
2020-04-22 21:04:22 +01:00
Lioncash
b13b6610b5 a32_interface: Default destructor in the cpp file
Makes it more consistent with code throughout the codebase.
2020-04-22 21:04:22 +01:00
MerryMage
5f8eb7c51c A32/location_descriptor: Add CPSR.IT to A32::LocationDescriptor 2020-04-22 21:04:22 +01:00
MerryMage
13f65f55eb PSR: Use Common::ModifyBit{,s} 2020-04-22 21:04:22 +01:00
MerryMage
74633301c1 A32: Add ITState 2020-04-22 21:04:22 +01:00
MerryMage
6e2cd35e4f a32_jitstate: Optimize runtime location descriptor calculation
Calculation is now one unaligned 64-bit load.
2020-04-22 21:04:22 +01:00
MerryMage
0de3993373 a32_jitstate: Remove fpsr_idc
We do not really have accurate FPSR state in any case.
2020-04-22 21:04:22 +01:00
MerryMage
6f49c0ef8e {a32,a64}_jitstate: Rename CPSR_* to cpsr_* 2020-04-22 21:04:22 +01:00
MerryMage
8cd7837839 a32_jitstate: Remove old_FPSCR 2020-04-22 21:04:22 +01:00
MerryMage
b3bb544bca a32_jitstate: Rename FPSCR_nzcv to fpsr_nzcv 2020-04-22 21:04:22 +01:00
MerryMage
76f986979d a32_jitstate: Rename FPSCR_mode to fpcr_mode 2020-04-22 21:04:22 +01:00
MerryMage
49fca15f90 {a32,a64}_jitstate: Rename FPSCR_IDC to fpsr_idc 2020-04-22 21:04:21 +01:00
MerryMage
622c02f537 {a32,a64}_jitstate: Remove FPSCR_UFC 2020-04-22 21:04:21 +01:00
MerryMage
366d63f4b4 a32_jitstate: Enable SSE FTZ and DAZ 2020-04-22 21:04:21 +01:00
MerryMage
f178562ee7 a32_jitstate: Remove exception trap enables from FPSCR_MODE_MASK
We don't currently use this for anything (we do not currently trap
floating point exceptions).

This frees these bits up for other purposes.
2020-04-22 21:04:21 +01:00
Merry
fd6222f0a1 Merge pull request #500 from lioncash/cbz
A32: Implement Thumb-1's CBZ/CBNZ instructions
2020-04-22 21:04:21 +01:00
Merry
bab4e29075 Merge pull request #498 from lioncash/ahp
A32/location_descriptor: Add AHP bit to the FPSCR mask
2020-04-22 21:04:21 +01:00
Lioncash
2d695e3c7c common/fp/info: Make formatting of FPInfo struct member functions consistent
Orgranizes the functions to all be consistent with the half-precision
specialization.
2020-04-22 21:04:21 +01:00
Lioncash
05b330906e common/fp/util: Make ProcessNaN utility functions constexpr
Nothing in particular prevents these from being constexpr. Do so to make
them consistent with the bulk of other functions in this header that are
constexpr.
2020-04-22 21:04:21 +01:00
Lioncash
6b9a40bdc4 common/fp/op/FPNeg: Make FPNeg constexpr
Negation in (standard IEEE) floating-point is simply flipping the sign-bit, so this
operation will never be more complex than what is presented here, making
constexpr a reasonable allowance.
2020-04-22 21:04:21 +01:00
Lioncash
ef95e0fa7d CMakeLists: Add FPNeg.h to the library target sources
Ensures that the header shows up in IDE generated projects.
2020-04-22 21:04:21 +01:00
Lioncash
87083af733 general: Remove trailing spaces
General code-related cleanup. Gets rid of trailing spaces in the
codebase.
2020-04-22 21:04:21 +01:00
Lioncash
fdbafbc1ae x64/reg_alloc: Remove reference qualifier to variable in GetArgumentInfo()
The result of GetArg() is returned by value, so this is essentially
still a copy. While the previous code *is* valid, this communicates what
is actually happening a little more explicitly.
2020-04-22 21:04:20 +01:00
Lioncash
1f6878fb46 ir_opt/verification_pass: Add include for std::puts
Ensures that the header dependency is always satisfied directly, and not
through other project headers. While we're at it, we can qualify the
call with the std:: namespace.
2020-04-22 21:03:38 +01:00
Lioncash
fc9c59d056 ir_opt/verification_pass: Eliminate redundant GetArg()
Given the same argument is used inside the condition's body if it's
true, we can just utilize the local to cut out a GetArg() operation.
Avoids redundant internal assertion checking.
2020-04-22 21:03:35 +01:00
Lioncash
03e6899fd7 A32: Implement Thumb-1's CBZ/CBNZ instructions
Introduced in ARMv6T2, this allows for short forward branches.
2020-04-22 21:02:47 +01:00
Lioncash
d02a4e6fc9 A32/location_descriptor: Add AHP bit to the FPSCR mask
Ensures the alternate half-precision state is preserved within the
location descriptors, which will be necessary when implementing the
half-precision extensions for VFP and NEON.
2020-04-22 21:02:47 +01:00
Merry
f4990a5f6b Merge pull request #499 from lioncash/movw
A32: Implement ARM-mode MOVW
2020-04-22 21:02:47 +01:00
Lioncash
bd755ae494 frontend/ir/ir_emitter: Add A32 equivalent to A64's SetCheckBit
This will be used in a subsequent change to implement ARMv6T2's CBZ/CBNZ
Thumb-1 instructions.
2020-04-22 21:02:47 +01:00
Lioncash
c6e1fd1416 a64_emit_x64: Use const on locals where applicable
Normalizes the use of const in the source file.
2020-04-22 21:02:47 +01:00
Merry
f6f0b6da65 Merge pull request #497 from lioncash/boost
A32/coprocessor: Remove boost from public interface
2020-04-22 21:02:47 +01:00
Lioncash
106c8c2473 A32: Implement ARM-mode MOVW
Introduced to the ISA in ARMv6T2
2020-04-22 21:02:47 +01:00
Lioncash
fb437080be a32_emit_x64: Use const on locals where applicable
Normalizes the use of const in the source file.
2020-04-22 21:02:47 +01:00
Lioncash
9935f3aa28 A32: Implement Thumb-1 variant of SEVL
While we're at it, also add the Thumb-2 encoding to the encoding table
to make sure it isn't forgotten about in the future.
2020-04-22 21:02:47 +01:00
Lioncash
5f9ba970b9 emit_x64: Use const on locals where applicable 2020-04-22 21:02:47 +01:00
Lioncash
92daae9513 A32/coprocessor: Remove boost from public interface
Removes a boost header from the public includes in favor of using the
standard-provided std::variant.

The use of boost in public interfaces is often a dealbreaker for some
people. Given we use std::optional in the header already, we can
transition over to std::variant from boost::variant.

With this removal, this makes all of our dependencies internal to the
library itself.
2020-04-22 21:02:47 +01:00
Lioncash
9a097e307f A32: Implement the ARM-mode variant of SEVL 2020-04-22 21:02:47 +01:00
Lioncash
a40b921cb5 emit_x64: Remove unnecessary typename in GetBasicBlock()
This can be deduced from the name alone.
2020-04-22 21:02:47 +01:00
Lioncash
e89ca42048 A32: Implement Thumb-1 variant of YIELD 2020-04-22 21:02:47 +01:00
Lioncash
675f67e41d emit_x64_vector: Use const on locals where applicable
Normalizes the use of const in the source file.
2020-04-22 21:02:47 +01:00
Lioncash
ebab7ede55 A32: Implement Thumb-1 variant of WFI 2020-04-22 21:02:47 +01:00
Lioncash
cccbc7fd0e emit_x64_saturation: Use const on locals where applicable
Normalizes the use of const in the source file.
2020-04-22 21:02:47 +01:00
Lioncash
b4110af22a A32: Implement Thumb-1 variant of WFE 2020-04-22 21:02:47 +01:00
Lioncash
7316fa47b3 emit_x64_packed: Use const on locals where applicable
Normalizes the use of const across the source file.
2020-04-22 21:02:47 +01:00
Lioncash
3a9c2f81d0 block_of_code: Use variable template variants of type traits
Now all type traits are using the variable template variants where
applicable.
2020-04-22 21:02:47 +01:00
Lioncash
57675fe592 A32: Implement Thumb-1 variant of SEV 2020-04-22 21:02:47 +01:00
Lioncash
9b783a5527 emit_x64_data_processing: Use const on locals where applicable
Normalizes the use of const across the source file.
2020-04-22 21:02:47 +01:00
Lioncash
07699b47ba A32/translate_thumb: Add helper function for raising exceptions
Similar to the variant within the ARM-mode translator visitor. This will
be used in subsequent changes to implement the hint instructions
introduced in ARMv7.
2020-04-22 21:02:47 +01:00
Lioncash
f74762ae4e frontend/decoder/decoder_detail: Replace std::is_same, with std::is_same_v
Same thing, same readability, less characters.
2020-04-22 21:02:47 +01:00
Lioncash
64879396f6 A32: Implement Thumb-1 variant of NOP 2020-04-22 21:02:47 +01:00
Merry
6a67da1225 Merge pull request #493 from lioncash/ir
frontend/ir/ir_emitter: Remove unnecessary logical shift overloads
2020-04-22 21:02:47 +01:00
Merry
81b908b077 Merge pull request #495 from lioncash/bkpt
A32: Implement Thumb-16's variant of BKPT
2020-04-22 21:02:47 +01:00
Merry
30d28029a8 Merge pull request #492 from lioncash/vfp
A32: Rename vfp2-related files to vfp
2020-04-22 21:02:47 +01:00
Merry
c4fb7cf540 Merge pull request #494 from lioncash/pldw
A32: Handle PLDW
2020-04-22 21:02:47 +01:00
Lioncash
b17a5d3365 A32: Implement Thumb-16's variant of BKPT 2020-04-22 21:02:47 +01:00