Take into account step sign in pre-condition for simple progression

So far, all non-end-inclusive progressions had step > 0.
With intrinsics for 'reversed' this will change.
This commit is contained in:
Dmitry Petrov
2017-12-11 12:52:24 +03:00
parent 821843e13f
commit 1493805f8e
@@ -77,10 +77,20 @@ class ForInSimpleProgressionLoopGenerator(
v.load(endVar, asmElementType) v.load(endVar, asmElementType)
if (asmElementType.sort == Type.LONG) { if (asmElementType.sort == Type.LONG) {
v.lcmp() v.lcmp()
v.ifge(loopExit) if (step > 0) {
v.ifge(loopExit)
}
else {
v.ifle(loopExit)
}
} }
else { else {
v.ificmpge(loopExit) if (step > 0) {
v.ificmpge(loopExit)
}
else {
v.ificmple(loopExit)
}
} }
} }
} }