summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-05-14 00:40:54 -0300
committerGravatar ameerj2021-07-22 21:51:31 -0400
commitd54d7de40e7295827b0e4e4026441b53d3fc9569 (patch)
tree29b5074f851292dace7aeb5da7716675544b3735 /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
parentglasm: Implement Storage atomics (diff)
downloadyuzu-d54d7de40e7295827b0e4e4026441b53d3fc9569.tar.gz
yuzu-d54d7de40e7295827b0e4e4026441b53d3fc9569.tar.xz
yuzu-d54d7de40e7295827b0e4e4026441b53d3fc9569.zip
glasm: Rework control flow introducing a syntax list
This commit regresses VertexA shaders, their transformation pass has to be adapted to the new control flow.
Diffstat (limited to 'src/shader_recompiler/ir_opt/constant_propagation_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/constant_propagation_pass.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
index b1c45d13a..66f1391db 100644
--- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
+++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
@@ -353,24 +353,6 @@ IR::Value EvalImmediates(const IR::Inst& inst, Func&& func, std::index_sequence<
353 return IR::Value{func(Arg<typename Traits::template ArgType<I>>(inst.Arg(I))...)}; 353 return IR::Value{func(Arg<typename Traits::template ArgType<I>>(inst.Arg(I))...)};
354} 354}
355 355
356void FoldBranchConditional(IR::Inst& inst) {
357 const IR::U1 cond{inst.Arg(0)};
358 if (cond.IsImmediate()) {
359 // TODO: Convert to Branch
360 return;
361 }
362 const IR::Inst* cond_inst{cond.InstRecursive()};
363 if (cond_inst->GetOpcode() == IR::Opcode::LogicalNot) {
364 const IR::Value true_label{inst.Arg(1)};
365 const IR::Value false_label{inst.Arg(2)};
366 // Remove negation on the conditional (take the parameter out of LogicalNot) and swap
367 // the branches
368 inst.SetArg(0, cond_inst->Arg(0));
369 inst.SetArg(1, false_label);
370 inst.SetArg(2, true_label);
371 }
372}
373
374std::optional<IR::Value> FoldCompositeExtractImpl(IR::Value inst_value, IR::Opcode insert, 356std::optional<IR::Value> FoldCompositeExtractImpl(IR::Value inst_value, IR::Opcode insert,
375 IR::Opcode construct, u32 first_index) { 357 IR::Opcode construct, u32 first_index) {
376 IR::Inst* const inst{inst_value.InstRecursive()}; 358 IR::Inst* const inst{inst_value.InstRecursive()};
@@ -581,8 +563,6 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
581 return (base & ~(~(~0u << bits) << offset)) | (insert << offset); 563 return (base & ~(~(~0u << bits) << offset)) | (insert << offset);
582 }); 564 });
583 return; 565 return;
584 case IR::Opcode::BranchConditional:
585 return FoldBranchConditional(inst);
586 case IR::Opcode::CompositeExtractF32x2: 566 case IR::Opcode::CompositeExtractF32x2:
587 return FoldCompositeExtract(inst, IR::Opcode::CompositeConstructF32x2, 567 return FoldCompositeExtract(inst, IR::Opcode::CompositeConstructF32x2,
588 IR::Opcode::CompositeInsertF32x2); 568 IR::Opcode::CompositeInsertF32x2);