mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-12 14:48:52 +00:00
ir_passes: Fold readlane with ff1 pattern (#3224)
This commit is contained in:
@@ -95,6 +95,20 @@ void ReadLaneEliminationPass(IR::Program& program) {
|
||||
if (inst.GetOpcode() != IR::Opcode::ReadLane) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for the following pattern and replace it with ReadFirstLane
|
||||
// s_ff1_i32_b64 sgpr, exec
|
||||
// v_readlane_b32 sdst, vgpr, sgpr
|
||||
if (const auto lane = inst.Arg(1); !lane.IsImmediate()) {
|
||||
if (lane.InstRecursive()->GetOpcode() == IR::Opcode::FindILsb64) {
|
||||
const auto value = inst.Arg(0);
|
||||
inst.ReplaceOpcode(IR::Opcode::ReadFirstLane);
|
||||
inst.ClearArgs();
|
||||
inst.SetArg(0, value);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const u32 lane = inst.Arg(1).U32();
|
||||
IR::Inst* prod = inst.Arg(0).InstRecursive();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user