diff options
| author | 2021-05-14 04:48:46 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:31 -0400 | |
| commit | bf5e48ffe4bd48ea681f2a01c8919c97125e88df (patch) | |
| tree | 2127c2f01aa19b98672f1ac9f34395b9b0240b3e /src/shader_recompiler/frontend/ir/ir_emitter.cpp | |
| parent | glasm: Write result to scalar on integer comparison instructions (diff) | |
| download | yuzu-bf5e48ffe4bd48ea681f2a01c8919c97125e88df.tar.gz yuzu-bf5e48ffe4bd48ea681f2a01c8919c97125e88df.tar.xz yuzu-bf5e48ffe4bd48ea681f2a01c8919c97125e88df.zip | |
glasm: Initial implementation of phi nodes on GLASM
Diffstat (limited to 'src/shader_recompiler/frontend/ir/ir_emitter.cpp')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index eb45aa477..def29143e 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -61,6 +61,14 @@ F64 IREmitter::Imm64(f64 value) const { | |||
| 61 | return F64{Value{value}}; | 61 | return F64{Value{value}}; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | void IREmitter::DummyReference(const Value& value) { | ||
| 65 | Inst(Opcode::DummyReference, value); | ||
| 66 | } | ||
| 67 | |||
| 68 | void IREmitter::PhiMove(IR::Inst& phi, const Value& value) { | ||
| 69 | Inst(Opcode::PhiMove, Value{&phi}, value); | ||
| 70 | } | ||
| 71 | |||
| 64 | void IREmitter::Prologue() { | 72 | void IREmitter::Prologue() { |
| 65 | Inst(Opcode::Prologue); | 73 | Inst(Opcode::Prologue); |
| 66 | } | 74 | } |
| @@ -69,10 +77,6 @@ void IREmitter::Epilogue() { | |||
| 69 | Inst(Opcode::Epilogue); | 77 | Inst(Opcode::Epilogue); |
| 70 | } | 78 | } |
| 71 | 79 | ||
| 72 | void IREmitter::BranchConditionRef(const U1& cond) { | ||
| 73 | Inst(Opcode::BranchConditionRef, cond); | ||
| 74 | } | ||
| 75 | |||
| 76 | void IREmitter::DemoteToHelperInvocation() { | 80 | void IREmitter::DemoteToHelperInvocation() { |
| 77 | Inst(Opcode::DemoteToHelperInvocation); | 81 | Inst(Opcode::DemoteToHelperInvocation); |
| 78 | } | 82 | } |
| @@ -106,6 +110,9 @@ void IREmitter::SetReg(IR::Reg reg, const U32& value) { | |||
| 106 | } | 110 | } |
| 107 | 111 | ||
| 108 | U1 IREmitter::GetPred(IR::Pred pred, bool is_negated) { | 112 | U1 IREmitter::GetPred(IR::Pred pred, bool is_negated) { |
| 113 | if (pred == Pred::PT) { | ||
| 114 | return Imm1(!is_negated); | ||
| 115 | } | ||
| 109 | const U1 value{Inst<U1>(Opcode::GetPred, pred)}; | 116 | const U1 value{Inst<U1>(Opcode::GetPred, pred)}; |
| 110 | if (is_negated) { | 117 | if (is_negated) { |
| 111 | return Inst<U1>(Opcode::LogicalNot, value); | 118 | return Inst<U1>(Opcode::LogicalNot, value); |
| @@ -264,6 +271,9 @@ static U1 GetFlowTest(IREmitter& ir, FlowTest flow_test) { | |||
| 264 | U1 IREmitter::Condition(IR::Condition cond) { | 271 | U1 IREmitter::Condition(IR::Condition cond) { |
| 265 | const FlowTest flow_test{cond.GetFlowTest()}; | 272 | const FlowTest flow_test{cond.GetFlowTest()}; |
| 266 | const auto [pred, is_negated]{cond.GetPred()}; | 273 | const auto [pred, is_negated]{cond.GetPred()}; |
| 274 | if (flow_test == FlowTest::T) { | ||
| 275 | return GetPred(pred, is_negated); | ||
| 276 | } | ||
| 267 | return LogicalAnd(GetPred(pred, is_negated), GetFlowTest(*this, flow_test)); | 277 | return LogicalAnd(GetPred(pred, is_negated), GetFlowTest(*this, flow_test)); |
| 268 | } | 278 | } |
| 269 | 279 | ||