nir: fix loop iteration count calculation for floats

Fixes performance regression in SynMark PSPom caused by loops with float
counters not always unrolling.

For example:

   for (float i = 0.02; i < 0.9; i += 0.11)
      ...

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Timothy Arceri
2017-01-03 12:03:54 +11:00
parent abcaba497d
commit 4b7dfd8812

View File

@@ -384,8 +384,8 @@ get_iteration(nir_op cond_op, nir_const_value *initial, nir_const_value *step,
case nir_op_flt:
case nir_op_feq:
case nir_op_fne: {
int32_t initial_val = initial->f32[0];
int32_t span = limit->f32[0] - initial_val;
float initial_val = initial->f32[0];
float span = limit->f32[0] - initial_val;
iter = span / step->f32[0];
break;
}