summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-01-03 12:03:54 +1100
committerTimothy Arceri <[email protected]>2017-01-04 14:48:36 +1100
commit4b7dfd881296a542a0c08a12c27f643dabd7280c (patch)
treedeb00fa9d5298ca87310fd7ae789ed4903b66490
parentabcaba497d8c90a1e9dcede71261bdee16e2ed4e (diff)
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 <[email protected]>
-rw-r--r--src/compiler/nir/nir_loop_analyze.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c
index 71cbe3c5a8d..a5f464a45d1 100644
--- a/src/compiler/nir/nir_loop_analyze.c
+++ b/src/compiler/nir/nir_loop_analyze.c
@@ -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;
}