summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/ir/ir_emitter.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-02-24 09:21:30 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:22 +0200
commite87a502da2d5a8356a639d53c0a16a77890de4c7 (patch)
tree00fd1a9a32c0334c49189098829b782a37533c46 /src/shader_recompiler/frontend/ir/ir_emitter.cpp
parentshader: Implement more of XMAD and FFMA32I and fix XMAD.CBCC (diff)
downloadyuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.tar
yuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.tar.gz
yuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.tar.bz2
yuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.tar.lz
yuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.tar.xz
yuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.tar.zst
yuzu-e87a502da2d5a8356a639d53c0a16a77890de4c7.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index 8ba86e614..0209d5540 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -134,18 +134,27 @@ void IREmitter::SetOFlag(const U1& value) {
Inst(Opcode::SetOFlag, value);
}
-U1 IREmitter::Condition(IR::Condition cond) {
- if (cond == IR::Condition{true}) {
- return Imm1(true);
- } else if (cond == IR::Condition{false}) {
- return Imm1(false);
+static U1 GetFlowTest(IREmitter& ir, FlowTest flow_test) {
+ switch (flow_test) {
+ case FlowTest::T:
+ return ir.Imm1(true);
+ case FlowTest::F:
+ return ir.Imm1(false);
+ case FlowTest::EQ:
+ // TODO: Test this
+ return ir.GetZFlag();
+ case FlowTest::NE:
+ // TODO: Test this
+ return ir.LogicalNot(ir.GetZFlag());
+ default:
+ throw NotImplementedException("Flow test {}", flow_test);
}
+}
+
+U1 IREmitter::Condition(IR::Condition cond) {
const FlowTest flow_test{cond.FlowTest()};
const auto [pred, is_negated]{cond.Pred()};
- if (flow_test == FlowTest::T) {
- return GetPred(pred, is_negated);
- }
- throw NotImplementedException("Condition {}", cond);
+ return LogicalAnd(GetPred(pred, is_negated), GetFlowTest(*this, flow_test));
}
F32 IREmitter::GetAttribute(IR::Attribute attribute) {