Skip to content

Commit 0fff916

Browse files
committed
Disable _Float16 shims for relaxed operations on Intel.
The C type isn't available yet in clang on i386 or x86_64; once the calling conventions are stabilized in clang, we can reenable this.
1 parent 9c0332d commit 0fff916

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Sources/RealModule/Float16+Real.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ extension Float16: Real {
173173
}
174174
#endif
175175

176+
// TODO: once clang stabilizes the calling conventions for _Float16 on Intel,
177+
// we can re-enable these; presently the type is disabled on the target.
178+
#if !(arch(i386) || arch(x86_64))
176179
@_transparent
177180
public static func _mulAdd(_ a: Float16, _ b: Float16, _ c: Float16) -> Float16 {
178181
_numerics_muladdf16(a, b, c)
@@ -187,6 +190,7 @@ extension Float16: Real {
187190
public static func _relaxedMul(_ a: Float16, _ b: Float16) -> Float16 {
188191
_numerics_relaxed_mulf16(a, b)
189192
}
193+
#endif
190194
}
191195

192196
#endif

Sources/_NumericsShims/include/_NumericsShims.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ HEADER_SHIM long double libm_lgammal(long double x, int *signp) {
383383
#endif
384384

385385
// MARK: - math inlines with relaxed semantics to support optimization.
386-
386+
#if !(__i386__ || __x86_64__)
387387
/// a*b + c evaluated _either_ as two operations or fma, whichever is faster.
388388
HEADER_SHIM _Float16 _numerics_muladdf16(_Float16 a, _Float16 b, _Float16 c) {
389389
#pragma STDC FP_CONTRACT ON
@@ -403,6 +403,7 @@ HEADER_SHIM _Float16 _numerics_relaxed_mulf16(_Float16 a, _Float16 b) {
403403
#pragma clang fp reassociate(on) contract(fast)
404404
return a * b;
405405
}
406+
#endif
406407

407408
/// a*b + c evaluated _either_ as two operations or fma, whichever is faster.
408409
HEADER_SHIM float _numerics_muladdf(float a, float b, float c) {

0 commit comments

Comments
 (0)