yuzu/src/shader_recompiler/frontend/maxwell/translate/impl/move_register.cpp

45 lines
1.2 KiB
C++
Raw Normal View History

2021-01-09 06:30:07 +00:00
// Copyright 2021 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/bit_field.h"
#include "common/common_types.h"
#include "shader_recompiler/exception.h"
2021-02-06 02:11:23 +00:00
#include "shader_recompiler/frontend/maxwell/opcodes.h"
2021-01-09 06:30:07 +00:00
#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
namespace Shader::Maxwell {
namespace {
2021-02-17 03:59:28 +00:00
void MOV(TranslatorVisitor& v, u64 insn, const IR::U32& src, bool is_mov32i = false) {
union {
u64 raw;
BitField<0, 8, IR::Reg> dest_reg;
BitField<39, 4, u64> mask;
BitField<12, 4, u64> mov32i_mask;
} const mov{insn};
if ((is_mov32i ? mov.mov32i_mask : mov.mask) != 0xf) {
2021-01-09 06:30:07 +00:00
throw NotImplementedException("Non-full move mask");
}
2021-02-17 03:59:28 +00:00
v.X(mov.dest_reg, src);
2021-01-09 06:30:07 +00:00
}
} // Anonymous namespace
void TranslatorVisitor::MOV_reg(u64 insn) {
2021-02-17 03:59:28 +00:00
MOV(*this, insn, GetReg8(insn));
2021-01-09 06:30:07 +00:00
}
void TranslatorVisitor::MOV_cbuf(u64 insn) {
2021-02-17 03:59:28 +00:00
MOV(*this, insn, GetCbuf(insn));
2021-01-09 06:30:07 +00:00
}
void TranslatorVisitor::MOV_imm(u64 insn) {
2021-02-17 03:59:28 +00:00
MOV(*this, insn, GetImm20(insn));
}
void TranslatorVisitor::MOV32I(u64 insn) {
MOV(*this, insn, GetImm32(insn), true);
2021-01-09 06:30:07 +00:00
}
} // namespace Shader::Maxwell