diff --git a/backend.native/tests/codegen/arithmetic/basic.kt b/backend.native/tests/codegen/arithmetic/basic.kt index 63adc4d176d..28afd4c1746 100644 --- a/backend.native/tests/codegen/arithmetic/basic.kt +++ b/backend.native/tests/codegen/arithmetic/basic.kt @@ -87,4 +87,10 @@ fun integralToFloat() { fun compareIntToFloat() { assertEquals(1, 0.compareTo(-0.0f)) assertEquals(0, 0.compareTo(+0.0f)) +} + +@Test +fun testKt37412() { + val two = 2.0 + assertEquals(2, two.toInt()) } \ No newline at end of file diff --git a/konan/konan.properties b/konan/konan.properties index 7a3c7eb76ed..0f839583877 100644 --- a/konan/konan.properties +++ b/konan/konan.properties @@ -277,7 +277,11 @@ target-sysroot-xcode_11_4-watchos_x86.default = \ arch.watchos_x86 = i386 targetSysRoot.watchos_x86 = target-sysroot-xcode_11_4-watchos_x86 -clangFlags.watchos_x86 = -cc1 -emit-obj -disable-llvm-passes -x ir +# -target-cpu pentium4 makes sure that cogenerator knows which CPU flavour to emit code for. +# Can be seen on optimized build and FP tests, where value is passed on stack +# by Kotlin and taken from SSE registers by C code. +# TODO: once this information is available in function attributes, we can remove this flag. +clangFlags.watchos_x86 = -cc1 -emit-obj -disable-llvm-passes -x ir -target-cpu pentium4 clangNooptFlags.watchos_x86 = -O1 clangOptFlags.watchos_x86 = -O3 clangDebugFlags.watchos_x86 = -O0 @@ -549,7 +553,12 @@ dependencies.mingw_x64-android_x86 = \ libffi-3.2.1-mingw-w64-x86-64 quadruple.android_x86 = i686-linux-android -clangFlags.android_x86 = -cc1 -target-cpu i686 -emit-obj -disable-llvm-passes -x ir -femulated-tls -mrelocation-model pic + +# -target-cpu pentium4 makes sure that cogenerator knows which CPU flavour to emit code for. +# Can be seen on optimized build and FP tests, where value is passed on stack +# by Kotlin and taken from SSE registers by C code. +# TODO: once this information is available in function attributes, we can set target CPU to i686. +clangFlags.android_x86 = -cc1 -target-cpu pentium4 -emit-obj -disable-llvm-passes -x ir -femulated-tls -mrelocation-model pic clangOptFlags.android_x86 = -O3 -ffunction-sections clangNooptFlags.android_x86 = -O1 targetSysRoot.android_x86 = target-sysroot-1-android_ndk