Avoid bitcast from/to function types returning simd to respect the ca… (#3581)
* Avoid bitcast from/to function types returning simd to respect the calling conventions difference * minor: remove public declaration of KVector4i32
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user