simd: incorrect swift binding: Int64 != simd_long (aka Int) #81804
Labels
<
8000
div class="min-width-0 d-flex flex-wrap mt-n1">
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Description
From
simd/logic.h
, there's this set of simd_select(float,float,int) functions:simd_select(simd_half8 x, simd_half8 y, simd_short8 mask)
simd_select(simd_float8 x, simd_float8 y, simd_int8 mask)
simd_select(simd_double8 x, simd_double8 y, simd_long8 mask)
You'd expect the 3 operands to have the same width, but it isn't on the Swift side!
Defining LP64 also does not work.
Reproduction
Expected behavior
It should compile, just like when
SIMD_f = SIMD8<Float>; SIMD_i = SIMD8<Int32>
andSIMD_f = SIMD8<Float16>; SIMD_i == SIMD8<Int16>
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0
Additional information
Was trying to mimic f / 2^64, by doing
f.bitPattern &- Double(sign: .plus, exponentBitPattern: UInt(64), significandBitPattern: UInt64(0)).bitPattern
and then handling the case where f = 0.It'd be the only case when f becomes negative, so
simd_select(f, 0, unsafeBitCast(f, to: Int64.self)
came to the rescue.The text was updated successfully, but these errors were encountered: