Implement unrolling of loops using > or >=.
Bug swiftshader:53
Change-Id: I20500e567e58ed29caa0a0ad9ad7884e66e96cb9
Reviewed-on: https://swiftshader-review.googlesource.com/9811
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index da87532..8a84692 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -3517,7 +3517,7 @@
TIntermSequence &sequence = init->getSequence();
TIntermTyped *variable = sequence[0]->getAsTyped();
- if(variable && variable->getQualifier() == EvqTemporary)
+ if(variable && variable->getQualifier() == EvqTemporary && variable->getBasicType() == EbtInt)
{
TIntermBinary *assign = variable->getAsBinaryNode();
@@ -3608,6 +3608,19 @@
comparator = EOpLessThan;
limit += 1;
}
+ else if(comparator == EOpGreaterThanEqual)
+ {
+ comparator = EOpLessThan;
+ limit -= 1;
+ std::swap(initial, limit);
+ increment = -increment;
+ }
+ else if(comparator == EOpGreaterThan)
+ {
+ comparator = EOpLessThan;
+ std::swap(initial, limit);
+ increment = -increment;
+ }
if(comparator == EOpLessThan)
{