summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2020-06-19 21:32:07 -0400
committerGravatar GitHub2020-06-19 21:32:07 -0400
commit7daea551c0c2bb38c5c432543d2f114eb83220f4 (patch)
tree3d5fe91055abaf1dace9951e2e5b9ff5bb487029 /src
parentMerge pull request #4114 from MerryMage/nrvo (diff)
parentmacro_jit_x64: Remove unused function Read (diff)
downloadyuzu-7daea551c0c2bb38c5c432543d2f114eb83220f4.tar.gz
yuzu-7daea551c0c2bb38c5c432543d2f114eb83220f4.tar.xz
yuzu-7daea551c0c2bb38c5c432543d2f114eb83220f4.zip
Merge pull request #4087 from MerryMage/macrojit-inline-Read
macro_jit_x64: Inline Engines::Maxwell3D::GetRegisterValue
Diffstat (limited to 'src')
-rw-r--r--src/video_core/macro/macro_jit_x64.cpp35
-rw-r--r--src/video_core/macro/macro_jit_x64.h1
2 files changed, 22 insertions, 14 deletions
diff --git a/src/video_core/macro/macro_jit_x64.cpp b/src/video_core/macro/macro_jit_x64.cpp
index bee34a7c0..79434a63c 100644
--- a/src/video_core/macro/macro_jit_x64.cpp
+++ b/src/video_core/macro/macro_jit_x64.cpp
@@ -273,14 +273,6 @@ void MacroJITx64Impl::Compile_ExtractShiftLeftRegister(Macro::Opcode opcode) {
273 Compile_ProcessResult(opcode.result_operation, opcode.dst); 273 Compile_ProcessResult(opcode.result_operation, opcode.dst);
274} 274}
275 275
276static u32 Read(Engines::Maxwell3D* maxwell3d, u32 method) {
277 return maxwell3d->GetRegisterValue(method);
278}
279
280static void Send(Engines::Maxwell3D* maxwell3d, Macro::MethodAddress method_address, u32 value) {
281 maxwell3d->CallMethodFromMME(method_address.address, value);
282}
283
284void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) { 276void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) {
285 if (optimizer.zero_reg_skip && opcode.src_a == 0) { 277 if (optimizer.zero_reg_skip && opcode.src_a == 0) {
286 if (opcode.immediate == 0) { 278 if (opcode.immediate == 0) {
@@ -298,15 +290,27 @@ void MacroJITx64Impl::Compile_Read(Macro::Opcode opcode) {
298 sub(result, opcode.immediate * -1); 290 sub(result, opcode.immediate * -1);
299 } 291 }
300 } 292 }
301 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 293
302 mov(Common::X64::ABI_PARAM1, qword[STATE]); 294 // Equivalent to Engines::Maxwell3D::GetRegisterValue:
303 mov(Common::X64::ABI_PARAM2, RESULT); 295 if (optimizer.enable_asserts) {
304 Common::X64::CallFarFunction(*this, &Read); 296 Xbyak::Label pass_range_check;
305 Common::X64::ABI_PopRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 297 cmp(RESULT, static_cast<u32>(Engines::Maxwell3D::Regs::NUM_REGS));
306 mov(RESULT, Common::X64::ABI_RETURN.cvt32()); 298 jb(pass_range_check);
299 int3();
300 L(pass_range_check);
301 }
302 mov(rax, qword[STATE]);
303 mov(RESULT,
304 dword[rax + offsetof(Engines::Maxwell3D, regs) +
305 offsetof(Engines::Maxwell3D::Regs, reg_array) + RESULT.cvt64() * sizeof(u32)]);
306
307 Compile_ProcessResult(opcode.result_operation, opcode.dst); 307 Compile_ProcessResult(opcode.result_operation, opcode.dst);
308} 308}
309 309
310static void Send(Engines::Maxwell3D* maxwell3d, Macro::MethodAddress method_address, u32 value) {
311 maxwell3d->CallMethodFromMME(method_address.address, value);
312}
313
310void Tegra::MacroJITx64Impl::Compile_Send(Xbyak::Reg32 value) { 314void Tegra::MacroJITx64Impl::Compile_Send(Xbyak::Reg32 value) {
311 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0); 315 Common::X64::ABI_PushRegistersAndAdjustStack(*this, PersistentCallerSavedRegs(), 0);
312 mov(Common::X64::ABI_PARAM1, qword[STATE]); 316 mov(Common::X64::ABI_PARAM1, qword[STATE]);
@@ -438,6 +442,9 @@ void MacroJITx64Impl::Compile() {
438 // one if our register isn't "dirty" 442 // one if our register isn't "dirty"
439 optimizer.optimize_for_method_move = true; 443 optimizer.optimize_for_method_move = true;
440 444
445 // Enable run-time assertions in JITted code
446 optimizer.enable_asserts = false;
447
441 // Check to see if we can skip emitting certain instructions 448 // Check to see if we can skip emitting certain instructions
442 Optimizer_ScanFlags(); 449 Optimizer_ScanFlags();
443 450
diff --git a/src/video_core/macro/macro_jit_x64.h b/src/video_core/macro/macro_jit_x64.h
index 51ec090b8..a180e7428 100644
--- a/src/video_core/macro/macro_jit_x64.h
+++ b/src/video_core/macro/macro_jit_x64.h
@@ -76,6 +76,7 @@ private:
76 bool zero_reg_skip{}; 76 bool zero_reg_skip{};
77 bool skip_dummy_addimmediate{}; 77 bool skip_dummy_addimmediate{};
78 bool optimize_for_method_move{}; 78 bool optimize_for_method_move{};
79 bool enable_asserts{};
79 }; 80 };
80 OptimizerState optimizer{}; 81 OptimizerState optimizer{};
81 82