mirror of
https://github.com/apple/swift-numerics
synced 2026-11-25 04:47:53 +00:00
Merge pull request #326 from stephentyrone/wasm-testing-1.1
[1.1] enable wasm testing
This commit is contained in:
3 files changed
+10
No files matched your search
@@ -8,6 +8,9 @@ jobs:
|
||||
tests:
|
||||
name: Test
|
||||
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
|
||||
with:
|
||||
enable_wasm_sdk_build: true
|
||||
wasm_sdk_build_command: swift build --target Numerics
|
||||
soundness:
|
||||
name: Soundness
|
||||
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
|
||||
|
||||
@@ -173,6 +173,10 @@ extension Float16: Real {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !arch(wasm32)
|
||||
// WASM doesn't have _Float16 on the C side, so we can't define the C hooks
|
||||
// that these use. TODO: implement these as Swift builtins instead.
|
||||
|
||||
@_transparent
|
||||
public static func _relaxedAdd(_ a: Float16, _ b: Float16) -> Float16 {
|
||||
_numerics_relaxed_addf16(a, b)
|
||||
@@ -182,6 +186,7 @@ extension Float16: Real {
|
||||
public static func _relaxedMul(_ a: Float16, _ b: Float16) -> Float16 {
|
||||
_numerics_relaxed_mulf16(a, b)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -389,6 +389,7 @@ HEADER_SHIM long double libm_lgammal(long double x, int *signp) {
|
||||
// MARK: - math inlines with relaxed semantics to support optimization.
|
||||
#define CLANG_RELAX_FP _Pragma("clang fp reassociate(on) contract(fast)")
|
||||
|
||||
#if !defined __wasm__ // No _Float16 on wasm
|
||||
/// a + b with the "allow reassociation" and "allow FMA formation" flags
|
||||
/// set in the IR.
|
||||
HEADER_SHIM _Float16 _numerics_relaxed_addf16(_Float16 a, _Float16 b) {
|
||||
@@ -402,6 +403,7 @@ HEADER_SHIM _Float16 _numerics_relaxed_mulf16(_Float16 a, _Float16 b) {
|
||||
CLANG_RELAX_FP
|
||||
return a * b;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// a + b with the "allow reassociation" and "allow FMA formation" flags
|
||||
/// set in the IR.
|
||||
|
||||
Reference in new issue
Block a user