mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 11:30:11 +01:00
nir: update nir_is_supported_terminator_condition()
Ever since4246c2869cand7d85dc4f35loop unrolling can no longer depend on inot being eliminated from the loop terminator condition so we need to be able to handle it. Here we simply check to see if the inot contains a simple terminator condition we previously handled. We also update the previous users of this function to use a newly name copy of the previous behaviour nir_is_terminator_condition_with_two_inputs(). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18006>
This commit is contained in:
parent
ae7532e0cc
commit
96c19d23c9
4 changed files with 18 additions and 5 deletions
|
|
@ -196,7 +196,7 @@ add_inlinable_uniforms(const nir_src *cond, nir_loop_info *info,
|
|||
/* Limit terminator condition to loop unroll support case which is a simple
|
||||
* comparison (ie. "i < count" is supported, but "i + 1 < count" is not).
|
||||
*/
|
||||
if (nir_is_supported_terminator_condition(cond_scalar)) {
|
||||
if (nir_is_terminator_condition_with_two_inputs(cond_scalar)) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(cond->ssa->parent_instr);
|
||||
|
||||
/* One side of comparison is induction variable, the other side is
|
||||
|
|
|
|||
|
|
@ -1035,7 +1035,7 @@ try_find_trip_count_vars_in_iand(nir_ssa_scalar *cond,
|
|||
bool found_induction_var = false;
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
nir_ssa_scalar src = nir_ssa_scalar_chase_alu_src(iand, i);
|
||||
if (nir_is_supported_terminator_condition(src) &&
|
||||
if (nir_is_terminator_condition_with_two_inputs(src) &&
|
||||
get_induction_and_limit_vars(src, ind, limit, limit_rhs, state)) {
|
||||
*cond = src;
|
||||
found_induction_var = true;
|
||||
|
|
@ -1097,7 +1097,7 @@ find_trip_count(loop_info_state *state, unsigned execution_mode)
|
|||
}
|
||||
|
||||
if (!basic_ind.def) {
|
||||
if (nir_is_supported_terminator_condition(cond)) {
|
||||
if (nir_is_terminator_condition_with_two_inputs(cond)) {
|
||||
get_induction_and_limit_vars(cond, &basic_ind,
|
||||
&limit, &limit_rhs, state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ nir_is_trivial_loop_if(nir_if *nif, nir_block *break_block)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
nir_is_supported_terminator_condition(nir_ssa_scalar cond)
|
||||
nir_is_terminator_condition_with_two_inputs(nir_ssa_scalar cond)
|
||||
{
|
||||
if (!nir_ssa_scalar_is_alu(cond))
|
||||
return false;
|
||||
|
|
@ -104,4 +104,17 @@ nir_is_supported_terminator_condition(nir_ssa_scalar cond)
|
|||
nir_op_infos[alu->op].num_inputs == 2;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
nir_is_supported_terminator_condition(nir_ssa_scalar cond)
|
||||
{
|
||||
if (!nir_ssa_scalar_is_alu(cond))
|
||||
return false;
|
||||
|
||||
nir_alu_instr *alu = nir_instr_as_alu(cond.def->parent_instr);
|
||||
return nir_alu_instr_is_comparison(alu) &&
|
||||
(nir_op_infos[alu->op].num_inputs == 2 ||
|
||||
(alu->op == nir_op_inot &&
|
||||
nir_is_terminator_condition_with_two_inputs(nir_ssa_scalar_chase_alu_src(cond, 0))));
|
||||
}
|
||||
|
||||
#endif /* NIR_LOOP_ANALYZE_H */
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ add_inlinable_uniforms(const nir_src *cond, nir_loop_info *info,
|
|||
/* Limit terminator condition to loop unroll support case which is a simple
|
||||
* comparison (ie. "i < count" is supported, but "i + 1 < count" is not).
|
||||
*/
|
||||
if (nir_is_supported_terminator_condition(cond_scalar)) {
|
||||
if (nir_is_terminator_condition_with_two_inputs(cond_scalar)) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(cond->ssa->parent_instr);
|
||||
|
||||
/* One side of comparison is induction variable, the other side is
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue