mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-18 08:31:38 +00:00
[JVM IR] Use JVM8 support for unsigned int operations
- unmute tests - add test to ensure JVM target is respected - add test to cover smart-casted cases - implement function matching and replacement - Switching on uint constants - introduce lowering for standard library replacements
This commit is contained in:
committed by
Dmitry Petrov
parent
c95216dc5d
commit
f0ff8f202c
15
compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntCompare_before.kt
vendored
Normal file
15
compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntCompare_before.kt
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val ua = 1234U
|
||||
val ub = 5678U
|
||||
|
||||
fun box(): String {
|
||||
if (ua.compareTo(ub) > 0) {
|
||||
throw AssertionError()
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 1 kotlin/UnsignedKt.uintCompare
|
||||
// 0 INVOKESTATIC java/lang/Integer.compareUnsigned \(II\)I
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
val ua = 1234U
|
||||
val ub = 5678U
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
val ua = 1234U
|
||||
val ub = 5678U
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
val ua = 1234U
|
||||
val ub = 5678U
|
||||
|
||||
7
compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntSmartCasts_jvm18.kt
vendored
Normal file
7
compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedIntSmartCasts_jvm18.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun both(a: Any?, b: Any?) = if (a is UInt && b is UInt) a < b else null!!
|
||||
|
||||
// 1 compareUnsigned
|
||||
// 0 uintCompare
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
val min = 0U.toString()
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
val ua = 1234UL
|
||||
val ub = 5678UL
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
val ua = 1234UL
|
||||
val ub = 5678UL
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
val ua = 1234UL
|
||||
val ub = 5678UL
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36838 Use potentially intrinsified methods for unsigned available in JDK 1.8+ in JVM_IR
|
||||
|
||||
fun box(): String {
|
||||
val min = 0UL.toString()
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36839 Generate 'when' with unsigned subject using TABLESWITCH/LOOKUPSWITCH in JVM_IR
|
||||
|
||||
const val M1: UInt = 2147483648u
|
||||
|
||||
|
||||
Reference in New Issue
Block a user