From 30e2a9bd29fd1d276f30a5e626540c8d85c788dd Mon Sep 17 00:00:00 2001 From: Afonso Bordado Date: Wed, 10 Aug 2022 17:08:39 +0100 Subject: [PATCH] cranelift: Upgrade libm to 0.2.4 (#4670) * cranelift: Upgrade libm to 0.2.4 This resolves an issue with incorrect fmaf on the x86_64-pc-windows-gnu target under some inputs. See: #4517 * supply-chain: Vet `libm` 0.2.4 --- Cargo.lock | 4 +-- .../filetests/runtests/fma-interpreter.clif | 27 ------------------- .../filetests/filetests/runtests/fma.clif | 2 ++ cranelift/interpreter/Cargo.toml | 2 +- supply-chain/audits.toml | 10 +++++++ 5 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 cranelift/filetests/filetests/runtests/fma-interpreter.clif diff --git a/Cargo.lock b/Cargo.lock index aeee11bec4..226ec05fdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1611,9 +1611,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" +checksum = "c7ce35d4899fa3c0558d4f5082c98927789a01024270711cf113999b66ced65a" [[package]] name = "linux-raw-sys" diff --git a/cranelift/filetests/filetests/runtests/fma-interpreter.clif b/cranelift/filetests/filetests/runtests/fma-interpreter.clif deleted file mode 100644 index c96c2a6e4f..0000000000 --- a/cranelift/filetests/filetests/runtests/fma-interpreter.clif +++ /dev/null @@ -1,27 +0,0 @@ -test interpret -target x86_64 has_avx=false has_fma=false - -; The interpreter can run `fma.clif` on most platforms, however on `x86_64-pc-windows-gnu` we -; use libm which has issues with some inputs. We should delete this file and enable the interpreter -; on the main `fma.clif` file once those are fixed. The same issue applies to x86 with fma disabled -; since it will call the native runtime's fma function. - -; See: https://github.com/bytecodealliance/wasmtime/pull/4517 -; See: https://github.com/rust-lang/libm/issues/263 - -function %fma_f32(f32, f32, f32) -> f32 { -block0(v0: f32, v1: f32, v2: f32): - v3 = fma v0, v1, v2 - return v3 -} -; run: %fma_f32(0x9.0, 0x9.0, 0x9.0) == 0x1.680000p6 -; run: %fma_f32(0x83.0, 0x2.68091p6, 0x9.88721p1) == 0x1.3b88e6p14 - - -function %fma_f64(f64, f64, f64) -> f64 { -block0(v0: f64, v1: f64, v2: f64): - v3 = fma v0, v1, v2 - return v3 -} -; run: %fma_f64(0x9.0, 0x9.0, 0x9.0) == 0x1.680000p6 -; run: %fma_f64(0x1.3b88ea148dd4ap14, 0x2.680916809121p6, 0x9.887218721837p1) == 0x1.7ba6ebee17417p21 diff --git a/cranelift/filetests/filetests/runtests/fma.clif b/cranelift/filetests/filetests/runtests/fma.clif index dfe7a95038..4f11b48f9c 100644 --- a/cranelift/filetests/filetests/runtests/fma.clif +++ b/cranelift/filetests/filetests/runtests/fma.clif @@ -1,6 +1,8 @@ +test interpret test run target aarch64 target s390x +target x86_64 has_avx=false has_fma=false function %fma_f32(f32, f32, f32) -> f32 { block0(v0: f32, v1: f32, v2: f32): diff --git a/cranelift/interpreter/Cargo.toml b/cranelift/interpreter/Cargo.toml index caa7b97750..9644856245 100644 --- a/cranelift/interpreter/Cargo.toml +++ b/cranelift/interpreter/Cargo.toml @@ -18,7 +18,7 @@ smallvec = "1.6.1" thiserror = "1.0.15" [target.x86_64-pc-windows-gnu.dependencies] -libm = "0.2" +libm = "0.2.4" [dev-dependencies] cranelift-frontend = { path = "../frontend", version = "0.88.0" } diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 9a4b9bd234..c172585c19 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -19,6 +19,16 @@ criteria = "safe-to-deploy" version = "1.0.0" notes = "I am the author of this crate." +[[audits.libm]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +delta = "0.2.2 -> 0.2.4" +notes = """ +This diff primarily fixes a few issues with the `fma`-related functions, +but also contains some other minor fixes as well. Everything looks A-OK and +as expected. +""" + [[audits.regalloc2]] who = "Jamey Sharp " criteria = "safe-to-deploy"