@@ -169,11 +169,21 @@ end
169169 @test_intrinsic Core. Intrinsics. fptoui UInt Float16 (3.3 ) UInt (3 )
170170end
171171
172- extendhfsf2 (x:: Float16 ) = ccall (" extern __extendhfsf2" , llvmcall, Float32, (Float16,), x)
173- gnu_h2f_ieee (x:: Float16 ) = ccall (" extern __gnu_h2f_ieee" , llvmcall, Float32, (Float16,), x)
174- truncsfhf2 (x:: Float32 ) = ccall (" extern __truncsfhf2" , llvmcall, Float16, (Float32,), x)
175- gnu_f2h_ieee (x:: Float32 ) = ccall (" extern __gnu_f2h_ieee" , llvmcall, Float16, (Float32,), x)
176- truncdfhf2 (x:: Float64 ) = ccall (" extern __truncdfhf2" , llvmcall, Float16, (Float64,), x)
172+ if Sys. ARCH == :aarch64
173+ # On AArch64 we are following the `_Float16` ABI. Buthe these functions expect `Int16`.
174+ # TODO : SHould we have `Chalf == Int16` and `Cfloat16 == Float16`?
175+ extendhfsf2 (x:: Float16 ) = ccall (" extern __extendhfsf2" , llvmcall, Float32, (Int16,), reinterpret (Int16, x))
176+ gnu_h2f_ieee (x:: Float16 ) = ccall (" extern __gnu_h2f_ieee" , llvmcall, Float32, (Int16,), reinterpret (Int16, x))
177+ truncsfhf2 (x:: Float32 ) = reinterpret (Float16, ccall (" extern __truncsfhf2" , llvmcall, Int16, (Float32,), x))
178+ gnu_f2h_ieee (x:: Float32 ) = reinterpret (Float16, ccall (" extern __gnu_f2h_ieee" , llvmcall, Int16, (Float32,), x))
179+ truncdfhf2 (x:: Float64 ) = reinterpret (Float16, ccall (" extern __truncdfhf2" , llvmcall, Int16, (Float64,), x))
180+ else
181+ extendhfsf2 (x:: Float16 ) = ccall (" extern __extendhfsf2" , llvmcall, Float32, (Float16,), x)
182+ gnu_h2f_ieee (x:: Float16 ) = ccall (" extern __gnu_h2f_ieee" , llvmcall, Float32, (Float16,), x)
183+ truncsfhf2 (x:: Float32 ) = ccall (" extern __truncsfhf2" , llvmcall, Float16, (Float32,), x)
184+ gnu_f2h_ieee (x:: Float32 ) = ccall (" extern __gnu_f2h_ieee" , llvmcall, Float16, (Float32,), x)
185+ truncdfhf2 (x:: Float64 ) = ccall (" extern __truncdfhf2" , llvmcall, Float16, (Float64,), x)
186+ end
177187
178188@testset " Float16 intrinsics (crt)" begin
179189 @test extendhfsf2 (Float16 (3.3 )) == 3.3007812f0
0 commit comments