KT-10057 Use lcmp instead of Intrinsics.compare

Fix of https://youtrack.jetbrains.com/issue/KT-10057
This commit is contained in:
Mikaël Peltier
2018-02-09 16:26:25 +01:00
committed by Alexander Udalov
parent c47c1c5ffd
commit 8ab7e5c406
2 changed files with 3 additions and 2 deletions
@@ -26,7 +26,7 @@ class CompareTo : IntrinsicMethod() {
private fun genInvoke(type: Type?, v: InstructionAdapter) {
when (type) {
Type.INT_TYPE, Type.CHAR_TYPE -> v.invokestatic(IntrinsicMethods.INTRINSICS_CLASS_NAME, "compare", "(II)I", false)
Type.LONG_TYPE -> v.invokestatic(IntrinsicMethods.INTRINSICS_CLASS_NAME, "compare", "(JJ)I", false)
Type.LONG_TYPE -> v.lcmp()
Type.FLOAT_TYPE -> v.invokestatic("java/lang/Float", "compare", "(FF)I", false)
Type.DOUBLE_TYPE -> v.invokestatic("java/lang/Double", "compare", "(DD)I", false)
else -> throw UnsupportedOperationException()
@@ -11,7 +11,8 @@ fun less4(a: Long?, b: Long?) = if (a is Long && b is Long) a < b else true
fun less5(a: Any?, b: Any?) = if (a is Long && b is Long) a < b else true
// 3 Intrinsics\.areEqual
// 3 Intrinsics\.compare
// 0 Intrinsics\.compare
// 3 LCMP
// for compare:
// 3 IFGE
// 0 IF_ICMPGE