nir: optimise min/max fadd combos
shader-db results BDW: total instructions in shared programs: 13060410 -> 13060313 (-0.00%) instructions in affected programs: 24533 -> 24436 (-0.40%) helped: 88 HURT: 0 total cycles in shared programs: 256585692 -> 256586698 (0.00%) cycles in affected programs: 647290 -> 648296 (0.16%) helped: 35 HURT: 30 Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -130,6 +130,28 @@ is_used_more_than_once(nir_alu_instr *instr)
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
is_used_once(nir_alu_instr *instr)
|
||||
{
|
||||
bool zero_if_use = list_empty(&instr->dest.dest.ssa.if_uses);
|
||||
bool zero_use = list_empty(&instr->dest.dest.ssa.uses);
|
||||
|
||||
if (zero_if_use && zero_use)
|
||||
return false;
|
||||
|
||||
if (!zero_if_use && list_is_singular(&instr->dest.dest.ssa.uses))
|
||||
return false;
|
||||
|
||||
if (!zero_use && list_is_singular(&instr->dest.dest.ssa.if_uses))
|
||||
return false;
|
||||
|
||||
if (!list_is_singular(&instr->dest.dest.ssa.if_uses) &&
|
||||
!list_is_singular(&instr->dest.dest.ssa.uses))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
is_not_used_by_if(nir_alu_instr *instr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user