summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-02-25 02:31:15 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:22 +0200
commit8810c88b7e3de2766bf47e07e941fb2c58c6b4b0 (patch)
tree73619b1563eefc7103687de8e78bcf3f750812f7 /src/shader_recompiler/frontend
parentspirv: Move phi arguments emit to a separate function (diff)
downloadyuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar
yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.gz
yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.bz2
yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.lz
yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.xz
yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.tar.zst
yuzu-8810c88b7e3de2766bf47e07e941fb2c58c6b4b0.zip
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp12
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/select_source_with_predicate.cpp44
2 files changed, 44 insertions, 12 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
index 3f6dedfdd..82c73bf8c 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
@@ -729,18 +729,6 @@ void TranslatorVisitor::SAM(u64) {
ThrowNotImplemented(Opcode::SAM);
}
-void TranslatorVisitor::SEL_reg(u64) {
- ThrowNotImplemented(Opcode::SEL_reg);
-}
-
-void TranslatorVisitor::SEL_cbuf(u64) {
- ThrowNotImplemented(Opcode::SEL_cbuf);
-}
-
-void TranslatorVisitor::SEL_imm(u64) {
- ThrowNotImplemented(Opcode::SEL_imm);
-}
-
void TranslatorVisitor::SETCRSPTR(u64) {
ThrowNotImplemented(Opcode::SETCRSPTR);
}
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/select_source_with_predicate.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/select_source_with_predicate.cpp
new file mode 100644
index 000000000..25fc6b437
--- /dev/null
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/select_source_with_predicate.cpp
@@ -0,0 +1,44 @@
+// 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 {
+
+void SEL(TranslatorVisitor& v, u64 insn, const IR::U32& src) {
+ union {
+ u64 raw;
+ BitField<0, 8, IR::Reg> dest_reg;
+ BitField<8, 8, IR::Reg> op_a;
+ BitField<39, 3, IR::Pred> pred;
+ BitField<42, 1, u64> neg_pred;
+ } const sel{insn};
+
+ const IR::U1 pred = v.ir.GetPred(sel.pred);
+ IR::U32 op_a{v.X(sel.op_a)};
+ IR::U32 op_b{src};
+ if (sel.neg_pred != 0) {
+ std::swap(op_a, op_b);
+ }
+ const IR::U32 result{v.ir.Select(pred, op_a, op_b)};
+
+ v.X(sel.dest_reg, result);
+}
+} // Anonymous namespace
+
+void TranslatorVisitor::SEL_reg(u64 insn) {
+ SEL(*this, insn, GetReg20(insn));
+}
+
+void TranslatorVisitor::SEL_cbuf(u64 insn) {
+ SEL(*this, insn, GetCbuf(insn));
+}
+
+void TranslatorVisitor::SEL_imm(u64 insn) {
+ SEL(*this, insn, GetImm20(insn));
+}
+} // namespace Shader::Maxwell