|
|
|
@ -64,22 +64,25 @@ void VisitMark(IR::Block& block, IR::Inst& inst) { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (must_patch_outside) { |
|
|
|
const auto it{IR::Block::InstructionList::s_iterator_to(inst)}; |
|
|
|
if (Settings::values.rescale_hack.GetValue()){ |
|
|
|
IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)}; |
|
|
|
const IR::F32 new_inst{&*block.PrependNewInst(it, inst)}; |
|
|
|
const IR::F32 up_factor{ir.FPRecip(ir.ResolutionDownFactor())}; |
|
|
|
const IR::Value converted{ir.FPMul(new_inst, up_factor)}; |
|
|
|
} |
|
|
|
else { |
|
|
|
IR::IREmitter ir{block, it}; |
|
|
|
IR::Inst* const new_inst{&*block.PrependNewInst(it, inst)}; |
|
|
|
const IR::F32 new_bitcast{ir.ConvertUToF(32, 32, IR::Value{new_inst})}; |
|
|
|
const IR::F32 up_factor{ir.FPRecip(ir.ResolutionDownFactor())}; |
|
|
|
const IR::Value converted{ir.FPMul(new_bitcast, up_factor)}; |
|
|
|
} |
|
|
|
inst.ReplaceUsesWith(converted); |
|
|
|
const auto it{IR::Block::InstructionList::s_iterator_to(inst)}; |
|
|
|
IR::Value converted; |
|
|
|
IR::IREmitter ir{block, it}; |
|
|
|
|
|
|
|
if (Settings::values.rescale_hack.GetValue()) { |
|
|
|
IR::Inst* const new_inst{&*block.PrependNewInst(it, inst)}; |
|
|
|
const IR::F32 up_factor{ir.FPRecip(ir.ResolutionDownFactor())}; |
|
|
|
converted = ir.FPMul(IR::Value{new_inst}, up_factor); |
|
|
|
} |
|
|
|
else { |
|
|
|
IR::Inst* const new_inst{&*block.PrependNewInst(it, inst)}; |
|
|
|
const IR::F32 new_bitcast{ir.ConvertUToF(32, 32, IR::Value{new_inst})}; |
|
|
|
const IR::F32 up_factor{ir.FPRecip(ir.ResolutionDownFactor())}; |
|
|
|
converted = ir.FPMul(new_bitcast, up_factor); |
|
|
|
} |
|
|
|
|
|
|
|
inst.ReplaceUsesWith(converted); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|