mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-05 12:19:58 +00:00
shader: Add constant propagation for *&^| binary operations
This commit is contained in:
parent
f263760c5a
commit
2597cee85b
1 changed files with 12 additions and 0 deletions
|
@ -422,6 +422,9 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
|
||||||
return FoldAdd<u32>(block, inst);
|
return FoldAdd<u32>(block, inst);
|
||||||
case IR::Opcode::ISub32:
|
case IR::Opcode::ISub32:
|
||||||
return FoldISub32(inst);
|
return FoldISub32(inst);
|
||||||
|
case IR::Opcode::IMul32:
|
||||||
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a * b; });
|
||||||
|
return;
|
||||||
case IR::Opcode::BitCastF32U32:
|
case IR::Opcode::BitCastF32U32:
|
||||||
return FoldBitCast<IR::Opcode::BitCastF32U32, f32, u32>(inst, IR::Opcode::BitCastU32F32);
|
return FoldBitCast<IR::Opcode::BitCastF32U32, f32, u32>(inst, IR::Opcode::BitCastU32F32);
|
||||||
case IR::Opcode::BitCastU32F32:
|
case IR::Opcode::BitCastU32F32:
|
||||||
|
@ -479,6 +482,15 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
|
||||||
case IR::Opcode::INotEqual:
|
case IR::Opcode::INotEqual:
|
||||||
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a != b; });
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a != b; });
|
||||||
return;
|
return;
|
||||||
|
case IR::Opcode::BitwiseAnd32:
|
||||||
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a & b; });
|
||||||
|
return;
|
||||||
|
case IR::Opcode::BitwiseOr32:
|
||||||
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a | b; });
|
||||||
|
return;
|
||||||
|
case IR::Opcode::BitwiseXor32:
|
||||||
|
FoldWhenAllImmediates(inst, [](u32 a, u32 b) { return a ^ b; });
|
||||||
|
return;
|
||||||
case IR::Opcode::BitFieldUExtract:
|
case IR::Opcode::BitFieldUExtract:
|
||||||
FoldWhenAllImmediates(inst, [](u32 base, u32 shift, u32 count) {
|
FoldWhenAllImmediates(inst, [](u32 base, u32 shift, u32 count) {
|
||||||
if (static_cast<size_t>(shift) + static_cast<size_t>(count) > Common::BitSize<u32>()) {
|
if (static_cast<size_t>(shift) + static_cast<size_t>(count) > Common::BitSize<u32>()) {
|
||||||
|
|
Loading…
Reference in a new issue