
Compiler intrinsics exposed in a portable way for kotlin
Exposes SSE, SSE2, SSE3, SSSE3, SSE4.1, and SSE4.2 compiler intrincs to Kotlin/Native as functions.
SSE Support can be checked by using the boolean constants defined by the library (simply called SSE, SSE2, etc). This allows changing implementation at runtime based on hardware SSE support:
fun round(x: Vector128): Vector128 = when {
SSE4_1 -> sse4_1_round_ps(x, SSE4_1_FROUND_NEARBYINT)
else -> {
vectorOf(
round(x.getFloatAt(0)),
round(x.getFloatAt(1)),
round(x.getFloatAt(2)),
round(x.getFloatAt(3)),
)
}
}In order to use the SIMD functions from common source sets like
nativeMain or similar, cinterop commonization needs to be enabled in gradle.properties:
kotlin.mpp.enableCinteropCommonization=trueThis is only required if using functions from the platform.simd package directly.
Exposes SSE, SSE2, SSE3, SSSE3, SSE4.1, and SSE4.2 compiler intrincs to Kotlin/Native as functions.
SSE Support can be checked by using the boolean constants defined by the library (simply called SSE, SSE2, etc). This allows changing implementation at runtime based on hardware SSE support:
fun round(x: Vector128): Vector128 = when {
SSE4_1 -> sse4_1_round_ps(x, SSE4_1_FROUND_NEARBYINT)
else -> {
vectorOf(
round(x.getFloatAt(0)),
round(x.getFloatAt(1)),
round(x.getFloatAt(2)),
round(x.getFloatAt(3)),
)
}
}In order to use the SIMD functions from common source sets like
nativeMain or similar, cinterop commonization needs to be enabled in gradle.properties:
kotlin.mpp.enableCinteropCommonization=trueThis is only required if using functions from the platform.simd package directly.