summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/loop_analysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Remove ir_binop_greater and ir_binop_lequal expressionsIan Romanick2017-10-301-14/+9
| | | | | | | | | | | | | | | | | | | NIR does not have these instructions. TGSI and Mesa IR both implement them using < and >=, repsectively. Removing them deletes a bunch of code and means I don't have to add code to the SPIR-V generator for them. v2: Rebase on 2+ years of change... and fix a major bug added in the rebase. text data bss dec hex filename 8255291 268856 294072 8818219 868e2b 32-bit i965_dri.so before 8254235 268856 294072 8817163 868a0b 32-bit i965_dri.so after 7815339 345592 420592 8581523 82f193 64-bit i965_dri.so before 7813995 345560 420592 8580147 82ec33 64-bit i965_dri.so after Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: make loop unrolling more like the nir unrolling pathTimothy Arceri2017-10-101-28/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code assumed that loop terminators will always be at the start of the loop, resulting in otherwise unrollable loops not being unrolled at all. For example the current code would unroll: int j = 0; do { if (j > 5) break; ... do stuff ... j++; } while (j < 4); But would fail to unroll the following as no iteration limit was calculated because it failed to find the terminator: int j = 0; do { ... do stuff ... j++; } while (j < 4); Also we would fail to unroll the following as we ended up calculating the iteration limit as 6 rather than 4. The unroll code then assumed we had 3 terminators rather the 2 as it wasn't able to determine that "if (j > 5)" was redundant. int j = 0; do { if (j > 5) break; ... do stuff ... if (bool(i)) break; j++; } while (j < 4); This patch changes this pass to be more like the NIR unrolling pass. With this change we handle loop terminators correctly and also handle cases where the terminators have instructions in their branches other than a break. V2: - fixed regression where loops with a break in else were never unrolled in v1. - fixed confusing/wrong naming of bools in complex unrolling. Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* glsl: check if induction var incremented before use in terminatorTimothy Arceri2017-10-101-0/+38
| | | | | | | | | | | | | | | | | | do-while loops can increment the starting value before the condition is checked. e.g. do { ndx++; } while (ndx < 3); This commit changes the code to detect this and reduces the iteration count by 1 if found. V2: fix terminator spelling Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Elie Tournier <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* glsl: move loop analysis helpers to loop_analysis.cppTimothy Arceri2017-09-211-0/+139
| | | | Reviewed-by: Thomas Helland <[email protected]>
* glsl: Convert loop analysis to the util hash tableThomas Helland2016-09-121-11/+14
| | | | | Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: move to compiler/Emil Velikov2016-01-261-0/+640
Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>