diff --git a/runtime/src/main/cpp/Types.cpp b/runtime/src/main/cpp/Types.cpp index 34f3a7764b0..b7defd21d51 100644 --- a/runtime/src/main/cpp/Types.cpp +++ b/runtime/src/main/cpp/Types.cpp @@ -97,8 +97,15 @@ KVector4f Kotlin_Vector4f_of(KFloat f0, KFloat f1, KFloat f2, KFloat f3) { return {f0, f1, f2, f3}; } -KVector4i32 Kotlin_Vector4i32_of(KInt f0, KInt f1, KInt f2, KInt f3) { - return {f0, f1, f2, f3}; +/* + * In the current design all simd types are mapped internally to floating type, e.g. <4 x float>. + * However, some platforms (ex. arm32) have different calling convention for <4 x float> and <4 x i32>. + * To avoid illegal bitcast from/to function types the following function + * return type MUST be <4 x float> and explicit type cast is done on the variable type. + */ +KVector4f Kotlin_Vector4i32_of(KInt f0, KInt f1, KInt f2, KInt f3) { + KInt __attribute__ ((__vector_size__(16))) v4i = {f0, f1, f2, f3}; + return (KVector4f)v4i; } } // extern "C" diff --git a/runtime/src/main/cpp/Types.h b/runtime/src/main/cpp/Types.h index 473c38fd56b..b010cef5a6b 100644 --- a/runtime/src/main/cpp/Types.h +++ b/runtime/src/main/cpp/Types.h @@ -52,7 +52,6 @@ typedef float KFloat; typedef double KDouble; typedef void* KNativePtr; typedef KFloat __attribute__ ((__vector_size__ (16))) KVector4f; -typedef KInt __attribute__ ((__vector_size__ (16))) KVector4i32; typedef const void* KConstNativePtr;