diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-02-23 02:59:16 +0100 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:22 +0200 |
commit | e44752ddc8804961eb84f8c225bb36d5b4c77bc1 (patch) | |
tree | 84df0e38680470a0ee8c2230625193c4156ddea6 /src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_range_reduction.cpp | |
parent | shader: Fix MOV(reg), add SHL variants and emit neg and abs instructions (diff) | |
download | yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.tar yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.tar.gz yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.tar.bz2 yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.tar.lz yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.tar.xz yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.tar.zst yuzu-e44752ddc8804961eb84f8c225bb36d5b4c77bc1.zip |
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_range_reduction.cpp')
-rw-r--r-- | src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_range_reduction.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_range_reduction.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_range_reduction.cpp new file mode 100644 index 000000000..f91b93fad --- /dev/null +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_range_reduction.cpp @@ -0,0 +1,41 @@ +// 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/frontend/maxwell/translate/impl/impl.h" + +namespace Shader::Maxwell { +namespace { +enum class Mode : u64 { + SINCOS, + EX2, +}; + +void RRO(TranslatorVisitor& v, u64 insn, const IR::F32& src) { + union { + u64 raw; + BitField<0, 8, IR::Reg> dest_reg; + BitField<39, 1, Mode> mode; + BitField<45, 1, u64> neg; + BitField<49, 1, u64> abs; + } const rro{insn}; + + v.F(rro.dest_reg, v.ir.FPAbsNeg(src, rro.abs != 0, rro.neg != 0)); +} +} // Anonymous namespace + +void TranslatorVisitor::RRO_reg(u64 insn) { + RRO(*this, insn, GetFloatReg20(insn)); +} + +void TranslatorVisitor::RRO_cbuf(u64 insn) { + RRO(*this, insn, GetFloatCbuf(insn)); +} + +void TranslatorVisitor::RRO_imm(u64) { + throw NotImplementedException("RRO (imm)"); +} + +} // namespace Shader::Maxwell |