mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 01:42:54 +03:00
Merge commit '3b6080cb20924f0c4f94e47bbbbfcae8b07d82e5' into sync_cg_clif-2026-04-28
This commit is contained in:
@@ -242,7 +242,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
needs: [todo_check, rustfmt, test, bench, dist]
|
||||
# FIXME add bench back once rust-lang/cargo#16925 has been fixed
|
||||
needs: [todo_check, rustfmt, test, dist]
|
||||
|
||||
permissions:
|
||||
contents: write # for creating the dev tag and release
|
||||
|
||||
@@ -43,27 +43,27 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-assembler-x64"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f248321c6a7d4de5dcf2939368e96a397ad3f53b6a076e38d0104d1da326d37"
|
||||
checksum = "6edb5bdd1af46714e3224a017fabbbd57f70df4e840eb5ad6a7429dc456119d6"
|
||||
dependencies = [
|
||||
"cranelift-assembler-x64-meta",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-assembler-x64-meta"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab6d78ff1f7d9bf8b7e1afbedbf78ba49e38e9da479d4c8a2db094e22f64e2bc"
|
||||
checksum = "a819599186e1b1a1f88d464e06045696afc7aa3e0cc018aa0b2999cb63d1d088"
|
||||
dependencies = [
|
||||
"cranelift-srcgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b6005ba640213a5b95382aeaf6b82bf028309581c8d7349778d66f27dc1180b"
|
||||
checksum = "36e2c152d488e03c87b913bc2ed3414416eb1e0d66d61b49af60bf456a9665c7"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
"wasmtime-internal-core",
|
||||
@@ -71,18 +71,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bitset"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81fb5b134a12b559ff0c0f5af0fcd755ad380723b5016c4e0d36f74d39485340"
|
||||
checksum = "b6559d4fbc253d1396e1f6beeae57fa88a244f02aaf0cde2a735afd3492d9b2e"
|
||||
dependencies = [
|
||||
"wasmtime-internal-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85837de8be7f17a4034a6b08816f05a3144345d2091937b39d415990daca28f4"
|
||||
checksum = "96d9315d98d6e0a64454d4c83be2ee0e8055c3f80c3b2d7bcad7079f281a06ff"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"cranelift-assembler-x64",
|
||||
@@ -107,9 +107,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e433faa87d38e5b8ff469e44a26fea4f93e58abd7a7c10bad9810056139700c9"
|
||||
checksum = "d89c00a88081c55e3087c45bebc77e0cc973de2d7b44ef6a943c7122647b89f5"
|
||||
dependencies = [
|
||||
"cranelift-assembler-x64-meta",
|
||||
"cranelift-codegen-shared",
|
||||
@@ -119,24 +119,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-shared"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5397ba61976e13944ca71230775db13ee1cb62849701ed35b753f4761ed0a9b7"
|
||||
checksum = "879f77c497a1eb6273482aa1ac3b23cb8563ff04edb39ed5dfcfd28c8deff8f5"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-control"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc81c88765580720eb30f4fc2c1bfdb75fcbf3094f87b3cd69cecca79d77a245"
|
||||
checksum = "498dc1f17a6910c88316d49c7176d8fa97cf10c30859c32a266040449317f963"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "463feed5d46cf8763f3ba3045284cf706dd161496e20ec9c14afbb4ba09b9e66"
|
||||
checksum = "c2acba797f6a46042ce82aaf7680d0c3567fe2001e238db9df649fd104a2727f"
|
||||
dependencies = [
|
||||
"cranelift-bitset",
|
||||
"wasmtime-internal-core",
|
||||
@@ -144,9 +144,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c5eca7696c1c04ab4c7ed8d18eadbb47d6cc9f14ec86fe0881bf1d7e97e261"
|
||||
checksum = "4dca3df1d107d98d88f159ad1d5eaa2d5cdb678b3d5bcfadc6fc83d8ebb448ea"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"log",
|
||||
@@ -156,15 +156,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-isle"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1153844610cc9c6da8cf10ce205e45da1a585b7688ed558aa808bbe2e4e6d77"
|
||||
checksum = "f62dd18116d88bed649871feceda79dad7b59cc685ea8998c2b3e64d0e689602"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-jit"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41836de8321b303d3d4188e58cc09c30c7645337342acfcfb363732695cae098"
|
||||
checksum = "0a4942770ce6662b44d903493d7c5b00f9a986a713a61aae148306eaef21ebd4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cranelift-codegen",
|
||||
@@ -182,9 +182,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-module"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b731f66cb1b69b60a74216e632968ebdbb95c488d26aa1448ec226ae0ffec33e"
|
||||
checksum = "fb5ca0d214ecee44405ea9f0c65a5318b41ac469e8258fd9fe944e564c1c1b0b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cranelift-codegen",
|
||||
@@ -193,9 +193,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-native"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a97b583fe9a60f06b0464cee6be5a17f623fd91b217aaac99b51b339d19911af"
|
||||
checksum = "f843b80360d7fdf61a6124642af7597f6d55724cf521210c34af8a1c66daca6e"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"libc",
|
||||
@@ -204,9 +204,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-object"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9809d2d419cd18f17377f4ce64a7ad22eeda0d042c08833d3796657f1ddebc82"
|
||||
checksum = "b9d212d15015c374333b11b833111b7c7e686bfaec02385af53611050bce7e9d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cranelift-codegen",
|
||||
@@ -219,9 +219,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-srcgen"
|
||||
version = "0.130.0"
|
||||
version = "0.131.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8594dc6bb4860fa8292f1814c76459dbfb933e1978d8222de6380efce45c7cee"
|
||||
checksum = "090ee5de58c6f17eb5e3a5ae8cf1695c7efea04ec4dd0ecba6a5b996c9bad7dc"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
@@ -277,6 +277,15 @@ dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
@@ -285,12 +294,12 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.13.0"
|
||||
version = "2.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.1",
|
||||
"hashbrown 0.17.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -338,12 +347,12 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.38.1"
|
||||
version = "0.39.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271638cd5fa9cca89c4c304675ca658efc4e64a66c716b7cfe1afb4b9611dbbc"
|
||||
checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"hashbrown 0.16.1",
|
||||
"hashbrown 0.17.0",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
]
|
||||
@@ -482,9 +491,9 @@ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-core"
|
||||
version = "43.0.0"
|
||||
version = "44.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e671917bb6856ae360cb59d7aaf26f1cfd042c7b924319dd06fd380739fc0b2e"
|
||||
checksum = "816a61a75275c6be435131fc625a4f5956daf24d9f9f59443e81cbef228929b3"
|
||||
dependencies = [
|
||||
"hashbrown 0.16.1",
|
||||
"libm",
|
||||
@@ -492,9 +501,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-jit-icache-coherence"
|
||||
version = "43.0.0"
|
||||
version = "44.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b3112806515fac8495883885eb8dbdde849988ae91fe6beb544c0d7c0f4c9aa"
|
||||
checksum = "2fd683a94490bf755d016a09697b0955602c50106b1ded97d16983ab2ded9fed"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
||||
@@ -8,15 +8,15 @@ crate-type = ["dylib"]
|
||||
|
||||
[dependencies]
|
||||
# These have to be in sync with each other
|
||||
cranelift-codegen = { version = "0.130.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
|
||||
cranelift-frontend = { version = "0.130.0" }
|
||||
cranelift-module = { version = "0.130.0" }
|
||||
cranelift-native = { version = "0.130.0" }
|
||||
cranelift-jit = { version = "0.130.0", optional = true }
|
||||
cranelift-object = { version = "0.130.0" }
|
||||
cranelift-codegen = { version = "0.131.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
|
||||
cranelift-frontend = { version = "0.131.0" }
|
||||
cranelift-module = { version = "0.131.0" }
|
||||
cranelift-native = { version = "0.131.0" }
|
||||
cranelift-jit = { version = "0.131.0", optional = true }
|
||||
cranelift-object = { version = "0.131.0" }
|
||||
target-lexicon = "0.13"
|
||||
gimli = { version = "0.33", default-features = false, features = ["write"] }
|
||||
object = { version = "0.38.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
|
||||
object = { version = "0.39.1", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
|
||||
|
||||
indexmap = "2.0.0"
|
||||
libloading = { version = "0.9.0", optional = true }
|
||||
@@ -24,12 +24,12 @@ smallvec = "1.8.1"
|
||||
|
||||
[patch.crates-io]
|
||||
# Uncomment to use an unreleased version of cranelift
|
||||
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" }
|
||||
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" }
|
||||
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" }
|
||||
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" }
|
||||
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" }
|
||||
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" }
|
||||
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
|
||||
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
|
||||
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
|
||||
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
|
||||
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
|
||||
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-44.0.0" }
|
||||
|
||||
# Uncomment to use local checkout of cranelift
|
||||
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
|
||||
|
||||
@@ -178,9 +178,7 @@ fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget {
|
||||
&& !file_name_str.contains("rustc_std_workspace_")
|
||||
&& !file_name_str.contains("rustc_demangle")
|
||||
&& !file_name_str.contains("rustc_literal_escaper"))
|
||||
|| file_name_str.contains("chalk")
|
||||
|| file_name_str.contains("tracing")
|
||||
|| file_name_str.contains("regex")
|
||||
|| file_name_str.contains("LLVM")
|
||||
{
|
||||
// These are large crates that are part of the rustc-dev component and are not
|
||||
// necessary to run regular programs.
|
||||
@@ -208,9 +206,9 @@ fn build_clif_sysroot_for_triple(
|
||||
|
||||
apply_patches(dirs, "stdlib", &sysroot_src_orig, &STDLIB_SRC.to_path(dirs));
|
||||
|
||||
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
|
||||
// recompilation as they are not affected by changes in cg_clif.
|
||||
ensure_empty_dir(&build_dir.join("deps"));
|
||||
// Cleanup the build dir, but keep the incremental cache for faster
|
||||
// recompilation as it is not affected by changes in cg_clif.
|
||||
ensure_empty_dir(&build_dir.join("build"));
|
||||
}
|
||||
|
||||
// Build sysroot
|
||||
@@ -243,6 +241,7 @@ fn build_clif_sysroot_for_triple(
|
||||
build_cmd.arg("--features").arg("backtrace panic-unwind");
|
||||
build_cmd.arg(format!("-Zroot-dir={}", STDLIB_SRC.to_path(dirs).display()));
|
||||
build_cmd.arg("-Zno-embed-metadata");
|
||||
build_cmd.arg("-Zbuild-dir-new-layout");
|
||||
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
|
||||
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
|
||||
if compiler.triple.contains("apple") {
|
||||
@@ -254,7 +253,13 @@ fn build_clif_sysroot_for_triple(
|
||||
}
|
||||
spawn_and_wait(build_cmd);
|
||||
|
||||
for entry in fs::read_dir(build_dir.join("deps")).unwrap() {
|
||||
for entry in fs::read_dir(build_dir.join("build"))
|
||||
.unwrap()
|
||||
.flat_map(|entry| entry.unwrap().path().read_dir().unwrap())
|
||||
.map(|entry| entry.unwrap().path().join("out"))
|
||||
.filter(|entry| entry.exists())
|
||||
.flat_map(|entry| entry.read_dir().unwrap())
|
||||
{
|
||||
let entry = entry.unwrap();
|
||||
if let Some(ext) = entry.path().extension() {
|
||||
if ext == "d" || ext == "dSYM" || ext == "clif" {
|
||||
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
From 2aa88b261ffb51d3f18a4b9d3b79232d7445e5f3 Mon Sep 17 00:00:00 2001
|
||||
From: bjorn3 <17426603+bjorn3@users.noreply.github.com>
|
||||
Date: Thu, 16 Apr 2026 17:29:02 +0200
|
||||
Subject: [PATCH] Disable f16 usage in portable-simd
|
||||
|
||||
It is currently broken on x86_64-pc-windows-gnu
|
||||
---
|
||||
Cargo.toml | 8 ++------
|
||||
crates/core_simd/src/alias.rs | 10 ----------
|
||||
crates/core_simd/src/cast.rs | 3 ---
|
||||
crates/core_simd/src/lib.rs | 1 -
|
||||
crates/core_simd/src/ops.rs | 2 +-
|
||||
crates/core_simd/src/ops/unary.rs | 2 --
|
||||
crates/core_simd/src/simd/cmp/eq.rs | 2 +-
|
||||
crates/core_simd/src/simd/cmp/ord.rs | 2 +-
|
||||
crates/core_simd/src/simd/num/float.rs | 2 +-
|
||||
crates/core_simd/src/vector.rs | 7 -------
|
||||
crates/core_simd/tests/f16_ops.rs | 10 ----------
|
||||
crates/std_float/src/lib.rs | 9 ---------
|
||||
crates/test_helpers/src/biteq.rs | 2 +-
|
||||
crates/test_helpers/src/lib.rs | 2 --
|
||||
crates/test_helpers/src/subnormals.rs | 2 +-
|
||||
15 files changed, 8 insertions(+), 56 deletions(-)
|
||||
delete mode 100644 crates/core_simd/tests/f16_ops.rs
|
||||
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
index 883140b..45296b4 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -1,10 +1,6 @@
|
||||
[workspace]
|
||||
resolver = "1"
|
||||
-members = [
|
||||
- "crates/core_simd",
|
||||
- "crates/std_float",
|
||||
- "crates/test_helpers",
|
||||
-]
|
||||
+members = ["crates/core_simd", "crates/std_float", "crates/test_helpers"]
|
||||
|
||||
[profile.test.package."*"]
|
||||
opt-level = 2
|
||||
@@ -15,4 +11,4 @@ opt-level = 2
|
||||
[workspace.dependencies.proptest]
|
||||
version = "1.11"
|
||||
default-features = false
|
||||
-features = ["alloc", "f16"]
|
||||
+features = ["alloc"]
|
||||
diff --git a/crates/core_simd/src/alias.rs b/crates/core_simd/src/alias.rs
|
||||
index 6dcfcb6..23f121c 100644
|
||||
--- a/crates/core_simd/src/alias.rs
|
||||
+++ b/crates/core_simd/src/alias.rs
|
||||
@@ -153,16 +153,6 @@ alias! {
|
||||
usizex64 64
|
||||
}
|
||||
|
||||
- f16 = {
|
||||
- f16x1 1
|
||||
- f16x2 2
|
||||
- f16x4 4
|
||||
- f16x8 8
|
||||
- f16x16 16
|
||||
- f16x32 32
|
||||
- f16x64 64
|
||||
- }
|
||||
-
|
||||
f32 = {
|
||||
f32x1 1
|
||||
f32x2 2
|
||||
diff --git a/crates/core_simd/src/cast.rs b/crates/core_simd/src/cast.rs
|
||||
index 69dc7ba..1c3592f 100644
|
||||
--- a/crates/core_simd/src/cast.rs
|
||||
+++ b/crates/core_simd/src/cast.rs
|
||||
@@ -44,9 +44,6 @@ impl SimdCast for u64 {}
|
||||
unsafe impl Sealed for usize {}
|
||||
impl SimdCast for usize {}
|
||||
// Safety: primitive number types can be cast to other primitive number types
|
||||
-unsafe impl Sealed for f16 {}
|
||||
-impl SimdCast for f16 {}
|
||||
-// Safety: primitive number types can be cast to other primitive number types
|
||||
unsafe impl Sealed for f32 {}
|
||||
impl SimdCast for f32 {}
|
||||
// Safety: primitive number types can be cast to other primitive number types
|
||||
diff --git a/crates/core_simd/src/lib.rs b/crates/core_simd/src/lib.rs
|
||||
index 413a886..115be44 100644
|
||||
--- a/crates/core_simd/src/lib.rs
|
||||
+++ b/crates/core_simd/src/lib.rs
|
||||
@@ -1,7 +1,6 @@
|
||||
#![no_std]
|
||||
#![feature(
|
||||
convert_float_to_int,
|
||||
- f16,
|
||||
core_intrinsics,
|
||||
decl_macro,
|
||||
repr_simd,
|
||||
diff --git a/crates/core_simd/src/ops.rs b/crates/core_simd/src/ops.rs
|
||||
index c0a06ed..eb6601f 100644
|
||||
--- a/crates/core_simd/src/ops.rs
|
||||
+++ b/crates/core_simd/src/ops.rs
|
||||
@@ -245,7 +245,7 @@ for_base_ops! {
|
||||
// We don't need any special precautions here:
|
||||
// Floats always accept arithmetic ops, but may become NaN.
|
||||
for_base_ops! {
|
||||
- T = (f16, f32, f64);
|
||||
+ T = (f32, f64);
|
||||
type Lhs = Simd<T, N>;
|
||||
type Rhs = Simd<T, N>;
|
||||
type Output = Self;
|
||||
diff --git a/crates/core_simd/src/ops/unary.rs b/crates/core_simd/src/ops/unary.rs
|
||||
index af7aa8a..e1c0616 100644
|
||||
--- a/crates/core_simd/src/ops/unary.rs
|
||||
+++ b/crates/core_simd/src/ops/unary.rs
|
||||
@@ -19,8 +19,6 @@ macro_rules! neg {
|
||||
}
|
||||
|
||||
neg! {
|
||||
- impl<const N: usize> Neg for Simd<f16, N>
|
||||
-
|
||||
impl<const N: usize> Neg for Simd<f32, N>
|
||||
|
||||
impl<const N: usize> Neg for Simd<f64, N>
|
||||
diff --git a/crates/core_simd/src/simd/cmp/eq.rs b/crates/core_simd/src/simd/cmp/eq.rs
|
||||
index 7683640..d553d6c 100644
|
||||
--- a/crates/core_simd/src/simd/cmp/eq.rs
|
||||
+++ b/crates/core_simd/src/simd/cmp/eq.rs
|
||||
@@ -42,7 +42,7 @@ macro_rules! impl_number {
|
||||
}
|
||||
}
|
||||
|
||||
-impl_number! { f16, f32, f64, u8, u16, u32, u64, usize, i8, i16, i32, i64, isize }
|
||||
+impl_number! { f32, f64, u8, u16, u32, u64, usize, i8, i16, i32, i64, isize }
|
||||
|
||||
macro_rules! impl_mask {
|
||||
{ $($integer:ty),* } => {
|
||||
diff --git a/crates/core_simd/src/simd/cmp/ord.rs b/crates/core_simd/src/simd/cmp/ord.rs
|
||||
index 5a4e74c..5672fbb 100644
|
||||
--- a/crates/core_simd/src/simd/cmp/ord.rs
|
||||
+++ b/crates/core_simd/src/simd/cmp/ord.rs
|
||||
@@ -144,7 +144,7 @@ macro_rules! impl_float {
|
||||
}
|
||||
}
|
||||
|
||||
-impl_float! { f16, f32, f64 }
|
||||
+impl_float! { f32, f64 }
|
||||
|
||||
macro_rules! impl_mask {
|
||||
{ $($integer:ty),* } => {
|
||||
diff --git a/crates/core_simd/src/simd/num/float.rs b/crates/core_simd/src/simd/num/float.rs
|
||||
index 510f4c9..175cbce 100644
|
||||
--- a/crates/core_simd/src/simd/num/float.rs
|
||||
+++ b/crates/core_simd/src/simd/num/float.rs
|
||||
@@ -444,4 +444,4 @@ macro_rules! impl_trait {
|
||||
}
|
||||
}
|
||||
|
||||
-impl_trait! { f16 { bits: u16, mask: i16 }, f32 { bits: u32, mask: i32 }, f64 { bits: u64, mask: i64 } }
|
||||
+impl_trait! { f32 { bits: u32, mask: i32 }, f64 { bits: u64, mask: i64 } }
|
||||
diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs
|
||||
index fbef69f..c8e0b8c 100644
|
||||
--- a/crates/core_simd/src/vector.rs
|
||||
+++ b/crates/core_simd/src/vector.rs
|
||||
@@ -1146,13 +1146,6 @@ unsafe impl SimdElement for isize {
|
||||
type Mask = isize;
|
||||
}
|
||||
|
||||
-impl Sealed for f16 {}
|
||||
-
|
||||
-// Safety: f16 is a valid SIMD element type, and is supported by this API
|
||||
-unsafe impl SimdElement for f16 {
|
||||
- type Mask = i16;
|
||||
-}
|
||||
-
|
||||
impl Sealed for f32 {}
|
||||
|
||||
// Safety: f32 is a valid SIMD element type, and is supported by this API
|
||||
diff --git a/crates/core_simd/tests/f16_ops.rs b/crates/core_simd/tests/f16_ops.rs
|
||||
deleted file mode 100644
|
||||
index f89bdf4..0000000
|
||||
--- a/crates/core_simd/tests/f16_ops.rs
|
||||
+++ /dev/null
|
||||
@@ -1,10 +0,0 @@
|
||||
-#![feature(portable_simd)]
|
||||
-#![feature(f16)]
|
||||
-
|
||||
-#[macro_use]
|
||||
-mod ops_macros;
|
||||
-
|
||||
-// FIXME: some f16 operations cause rustc to hang on wasm simd
|
||||
-// https://github.com/llvm/llvm-project/issues/189251
|
||||
-#[cfg(not(all(target_arch = "wasm32", target_feature = "simd128")))]
|
||||
-impl_float_tests! { f16, i16 }
|
||||
diff --git a/crates/std_float/src/lib.rs b/crates/std_float/src/lib.rs
|
||||
index ff35254..acc1bfc 100644
|
||||
--- a/crates/std_float/src/lib.rs
|
||||
+++ b/crates/std_float/src/lib.rs
|
||||
@@ -2,7 +2,6 @@
|
||||
feature = "as_crate",
|
||||
feature(core_intrinsics),
|
||||
feature(portable_simd),
|
||||
- feature(f16),
|
||||
allow(internal_features)
|
||||
)]
|
||||
#[cfg(not(feature = "as_crate"))]
|
||||
@@ -170,17 +169,9 @@ pub trait StdFloat: Sealed + Sized {
|
||||
fn fract(self) -> Self;
|
||||
}
|
||||
|
||||
-impl<const N: usize> Sealed for Simd<f16, N> {}
|
||||
impl<const N: usize> Sealed for Simd<f32, N> {}
|
||||
impl<const N: usize> Sealed for Simd<f64, N> {}
|
||||
|
||||
-impl<const N: usize> StdFloat for Simd<f16, N> {
|
||||
- #[inline]
|
||||
- fn fract(self) -> Self {
|
||||
- self - self.trunc()
|
||||
- }
|
||||
-}
|
||||
-
|
||||
impl<const N: usize> StdFloat for Simd<f32, N> {
|
||||
#[inline]
|
||||
fn fract(self) -> Self {
|
||||
diff --git a/crates/test_helpers/src/biteq.rs b/crates/test_helpers/src/biteq.rs
|
||||
index 36761e3..cbc20cd 100644
|
||||
--- a/crates/test_helpers/src/biteq.rs
|
||||
+++ b/crates/test_helpers/src/biteq.rs
|
||||
@@ -53,7 +53,7 @@ macro_rules! impl_float_biteq {
|
||||
};
|
||||
}
|
||||
|
||||
-impl_float_biteq! { f16, f32, f64 }
|
||||
+impl_float_biteq! { f32, f64 }
|
||||
|
||||
impl<T> BitEq for *const T {
|
||||
fn biteq(&self, other: &Self) -> bool {
|
||||
diff --git a/crates/test_helpers/src/lib.rs b/crates/test_helpers/src/lib.rs
|
||||
index 82adb06..4b03674 100644
|
||||
--- a/crates/test_helpers/src/lib.rs
|
||||
+++ b/crates/test_helpers/src/lib.rs
|
||||
@@ -1,4 +1,3 @@
|
||||
-#![feature(f16)]
|
||||
#![cfg_attr(
|
||||
any(target_arch = "powerpc", target_arch = "powerpc64"),
|
||||
feature(powerpc_target_feature, stdarch_powerpc)
|
||||
@@ -47,7 +46,6 @@ impl_num! { u16 }
|
||||
impl_num! { u32 }
|
||||
impl_num! { u64 }
|
||||
impl_num! { usize }
|
||||
-impl_num! { f16 }
|
||||
impl_num! { f32 }
|
||||
impl_num! { f64 }
|
||||
|
||||
diff --git a/crates/test_helpers/src/subnormals.rs b/crates/test_helpers/src/subnormals.rs
|
||||
index 44dfbb3..b5f19ba 100644
|
||||
--- a/crates/test_helpers/src/subnormals.rs
|
||||
+++ b/crates/test_helpers/src/subnormals.rs
|
||||
@@ -39,7 +39,7 @@ macro_rules! impl_else {
|
||||
}
|
||||
}
|
||||
|
||||
-impl_float! { f16, f32, f64 }
|
||||
+impl_float! { f32, f64 }
|
||||
impl_else! { i8, i16, i32, i64, isize, u8, u16, u32, u64, usize }
|
||||
|
||||
/// AltiVec should flush subnormal inputs to zero, but QEMU seems to only flush outputs.
|
||||
--
|
||||
2.53.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2026-03-25"
|
||||
channel = "nightly-2026-04-28"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"]
|
||||
profile = "minimal"
|
||||
|
||||
@@ -67,9 +67,9 @@ index bc68bfe396..00143ef3ed 100644
|
||||
--- a/src/bootstrap/src/core/config/config.rs
|
||||
+++ b/src/bootstrap/src/core/config/config.rs
|
||||
@@ -2230,7 +2230,7 @@ pub fn download_ci_rustc_commit<'a>(
|
||||
return None;
|
||||
}
|
||||
|
||||
match freshness {
|
||||
PathFreshness::LastModifiedUpstream { upstream } => upstream,
|
||||
PathFreshness::HasLocalModifications { upstream, modifications } => {
|
||||
- if dwn_ctx.is_running_on_ci() {
|
||||
+ if false && dwn_ctx.is_running_on_ci() {
|
||||
eprintln!("CI rustc commit matches with HEAD and we are in CI.");
|
||||
|
||||
@@ -50,6 +50,7 @@ rm tests/ui/c-variadic/copy.rs # same
|
||||
rm tests/ui/sanitizer/kcfi-c-variadic.rs # same
|
||||
rm tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs # variadics for calling conventions other than C unsupported
|
||||
rm tests/ui/delegation/fn-header.rs
|
||||
rm tests/ui/c-variadic/roundtrip.rs
|
||||
|
||||
# inline assembly features
|
||||
rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly
|
||||
@@ -144,6 +145,7 @@ rm tests/ui/consts/issue-33537.rs # same
|
||||
rm tests/ui/consts/const-mut-refs-crate.rs # same
|
||||
rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift
|
||||
rm -r tests/run-make/short-ice # ICE backtrace begin/end marker mismatch
|
||||
rm -r tests/run-make/naked-dead-code-elimination # function not eliminated
|
||||
|
||||
# doesn't work due to the way the rustc test suite is invoked.
|
||||
# should work when using ./x.py test the way it is intended
|
||||
|
||||
@@ -51,6 +51,40 @@ fn f64_to_f16(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
|
||||
if ret_ty == types::I16 { fx.bcx.ins().bitcast(types::F16, MemFlags::new(), ret) } else { ret }
|
||||
}
|
||||
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Remove once backend lowerings have
|
||||
// been added to Cranelift.
|
||||
pub(crate) fn maybe_with_f16_to_f32(
|
||||
fx: &mut FunctionCx<'_, '_, '_>,
|
||||
val: Value,
|
||||
f: impl FnOnce(&mut FunctionCx<'_, '_, '_>, Value) -> Value,
|
||||
) -> Value {
|
||||
if fx.bcx.func.dfg.value_type(val) == types::F16 {
|
||||
let val = f16_to_f32(fx, val);
|
||||
let res = f(fx, val);
|
||||
f32_to_f16(fx, res)
|
||||
} else {
|
||||
f(fx, val)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Remove once backend lowerings have
|
||||
// been added to Cranelift.
|
||||
pub(crate) fn maybe_with_f16_to_f32_pair(
|
||||
fx: &mut FunctionCx<'_, '_, '_>,
|
||||
a: Value,
|
||||
b: Value,
|
||||
f: impl FnOnce(&mut FunctionCx<'_, '_, '_>, Value, Value) -> Value,
|
||||
) -> Value {
|
||||
if fx.bcx.func.dfg.value_type(a) == types::F16 {
|
||||
let a = f16_to_f32(fx, a);
|
||||
let b = f16_to_f32(fx, b);
|
||||
let res = f(fx, a, b);
|
||||
f32_to_f16(fx, res)
|
||||
} else {
|
||||
f(fx, a, b)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn fcmp(fx: &mut FunctionCx<'_, '_, '_>, cc: FloatCC, lhs: Value, rhs: Value) -> Value {
|
||||
let ty = fx.bcx.func.dfg.value_type(lhs);
|
||||
match ty {
|
||||
|
||||
@@ -43,7 +43,7 @@ pub(crate) fn emit(&mut self, product: &mut ObjectProduct) {
|
||||
let _: Result<()> = sections.for_each(|id, section| {
|
||||
if let Some(section_id) = section_map.get(&id) {
|
||||
for reloc in §ion.relocs {
|
||||
product.add_debug_reloc(§ion_map, section_id, reloc);
|
||||
product.add_debug_reloc(§ion_map, section_id, reloc, true);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use cranelift_module::{DataId, FuncId};
|
||||
use cranelift_object::ObjectProduct;
|
||||
use gimli::SectionId;
|
||||
use object::write::{Relocation, StandardSegment};
|
||||
use object::write::{Relocation, StandardSection, StandardSegment};
|
||||
use object::{RelocationEncoding, RelocationFlags, SectionKind};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
@@ -16,6 +16,7 @@ fn add_debug_reloc(
|
||||
section_map: &FxHashMap<SectionId, Self::SectionId>,
|
||||
from: &Self::SectionId,
|
||||
reloc: &DebugReloc,
|
||||
use_section_symbol: bool,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,29 +28,31 @@ fn add_debug_section(
|
||||
id: SectionId,
|
||||
data: Vec<u8>,
|
||||
) -> (object::write::SectionId, object::write::SymbolId) {
|
||||
let name = if self.object.format() == object::BinaryFormat::MachO {
|
||||
id.name().replace('.', "__") // machO expects __debug_info instead of .debug_info
|
||||
let (section_id, align);
|
||||
if id == SectionId::EhFrame {
|
||||
section_id = self.object.section_id(StandardSection::EhFrame);
|
||||
align = 8;
|
||||
} else {
|
||||
id.name().to_string()
|
||||
}
|
||||
.into_bytes();
|
||||
|
||||
let segment = self.object.segment_name(StandardSegment::Debug).to_vec();
|
||||
// FIXME use SHT_X86_64_UNWIND for .eh_frame
|
||||
let section_id = self.object.add_section(
|
||||
segment,
|
||||
name,
|
||||
if id == SectionId::DebugStr || id == SectionId::DebugLineStr {
|
||||
SectionKind::DebugString
|
||||
} else if id == SectionId::EhFrame {
|
||||
SectionKind::ReadOnlyData
|
||||
let name = if self.object.format() == object::BinaryFormat::MachO {
|
||||
id.name().replace('.', "__") // machO expects __debug_info instead of .debug_info
|
||||
} else {
|
||||
SectionKind::Debug
|
||||
},
|
||||
);
|
||||
self.object
|
||||
.section_mut(section_id)
|
||||
.set_data(data, if id == SectionId::EhFrame { 8 } else { 1 });
|
||||
id.name().to_string()
|
||||
}
|
||||
.into_bytes();
|
||||
|
||||
let segment = self.object.segment_name(StandardSegment::Debug).to_vec();
|
||||
section_id = self.object.add_section(
|
||||
segment,
|
||||
name,
|
||||
if id == SectionId::DebugStr || id == SectionId::DebugLineStr {
|
||||
SectionKind::DebugString
|
||||
} else {
|
||||
SectionKind::Debug
|
||||
},
|
||||
);
|
||||
align = 1;
|
||||
}
|
||||
self.object.section_mut(section_id).set_data(data, align);
|
||||
let symbol_id = self.object.section_symbol(section_id);
|
||||
(section_id, symbol_id)
|
||||
}
|
||||
@@ -59,6 +62,7 @@ fn add_debug_reloc(
|
||||
section_map: &FxHashMap<SectionId, Self::SectionId>,
|
||||
from: &Self::SectionId,
|
||||
reloc: &DebugReloc,
|
||||
use_section_symbol: bool,
|
||||
) {
|
||||
let (symbol, symbol_offset) = match reloc.name {
|
||||
DebugRelocName::Section(id) => (section_map.get(&id).unwrap().1, 0),
|
||||
@@ -69,7 +73,11 @@ fn add_debug_reloc(
|
||||
} else {
|
||||
self.data_symbol(DataId::from_u32(id & !(1 << 31)))
|
||||
};
|
||||
self.object.symbol_section_and_offset(symbol_id).unwrap_or((symbol_id, 0))
|
||||
if use_section_symbol {
|
||||
self.object.symbol_section_and_offset(symbol_id).unwrap_or((symbol_id, 0))
|
||||
} else {
|
||||
(symbol_id, 0)
|
||||
}
|
||||
}
|
||||
};
|
||||
self.object
|
||||
|
||||
@@ -120,13 +120,12 @@ pub(crate) fn add_function(
|
||||
func_id: FuncId,
|
||||
context: &Context,
|
||||
) {
|
||||
if let target_lexicon::OperatingSystem::MacOSX { .. } =
|
||||
module.isa().triple().operating_system
|
||||
let triple = module.isa().triple();
|
||||
if matches!(triple.operating_system, target_lexicon::OperatingSystem::MacOSX { .. })
|
||||
&& triple.architecture == target_lexicon::Architecture::X86_64
|
||||
{
|
||||
// The object crate doesn't currently support DW_GNU_EH_PE_absptr, which macOS
|
||||
// requires for unwinding tables. In addition on arm64 it currently doesn't
|
||||
// support 32bit relocations as we currently use for the unwinding table.
|
||||
// See gimli-rs/object#415 and rust-lang/rustc_codegen_cranelift#1371
|
||||
// requires for unwinding tables. See gimli-rs/object#415.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,8 +249,9 @@ pub(crate) fn emit(self, product: &mut ObjectProduct) {
|
||||
let mut section_map = FxHashMap::default();
|
||||
section_map.insert(id, section_id);
|
||||
|
||||
let use_section_symbol = product.object.format() != object::BinaryFormat::MachO;
|
||||
for reloc in &eh_frame.0.relocs {
|
||||
product.add_debug_reloc(§ion_map, §ion_id, reloc);
|
||||
product.add_debug_reloc(§ion_map, §ion_id, reloc, use_section_symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
use cranelift_jit::{JITBuilder, JITModule};
|
||||
use rustc_codegen_ssa::CrateInfo;
|
||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir::mono::MonoItem;
|
||||
use rustc_middle::mono::MonoItem;
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::OutputFilenames;
|
||||
use rustc_span::sym;
|
||||
|
||||
@@ -235,6 +235,9 @@ pub(crate) fn compile_global_asm(
|
||||
.arg("-")
|
||||
.arg("-Abad_asm_style")
|
||||
.arg("-Zcodegen-backend=llvm")
|
||||
// JSON targets currently require `-Zunstable-options`
|
||||
// Tracking issue: https://github.com/rust-lang/rust/issues/151528
|
||||
.arg("-Zunstable-options")
|
||||
.stdin(Stdio::piped())
|
||||
.spawn()
|
||||
.expect("Failed to spawn `as`.");
|
||||
|
||||
@@ -1197,12 +1197,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
let a = a.load_scalar(fx);
|
||||
let b = b.load_scalar(fx);
|
||||
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Use `fmin` directly once
|
||||
// Cranelift backend lowerings are implemented.
|
||||
let a = codegen_f16_f128::f16_to_f32(fx, a);
|
||||
let b = codegen_f16_f128::f16_to_f32(fx, b);
|
||||
let val = fx.bcx.ins().fmin(a, b);
|
||||
let val = codegen_f16_f128::f32_to_f16(fx, val);
|
||||
let val = codegen_f16_f128::maybe_with_f16_to_f32_pair(fx, a, b, |fx, a, b| {
|
||||
fx.bcx.ins().fmin(a, b)
|
||||
});
|
||||
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f16));
|
||||
ret.write_cvalue(fx, val);
|
||||
}
|
||||
@@ -1240,12 +1237,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
let a = a.load_scalar(fx);
|
||||
let b = b.load_scalar(fx);
|
||||
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Use `fmax` directly once
|
||||
// Cranelift backend lowerings are implemented.
|
||||
let a = codegen_f16_f128::f16_to_f32(fx, a);
|
||||
let b = codegen_f16_f128::f16_to_f32(fx, b);
|
||||
let val = fx.bcx.ins().fmax(a, b);
|
||||
let val = codegen_f16_f128::f32_to_f16(fx, val);
|
||||
let val = codegen_f16_f128::maybe_with_f16_to_f32_pair(fx, a, b, |fx, a, b| {
|
||||
fx.bcx.ins().fmax(a, b)
|
||||
});
|
||||
let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f16));
|
||||
ret.write_cvalue(fx, val);
|
||||
}
|
||||
|
||||
@@ -91,23 +91,26 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
fx.bcx.ins().icmp(IntCC::SignedGreaterThanOrEqual, x_lane, y_lane)
|
||||
}
|
||||
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Replace with Cranelift
|
||||
// `fcmp` once `f16`/`f128` backend lowerings have been added to
|
||||
// Cranelift.
|
||||
(ty::Float(_), sym::simd_eq) => {
|
||||
fx.bcx.ins().fcmp(FloatCC::Equal, x_lane, y_lane)
|
||||
codegen_f16_f128::fcmp(fx, FloatCC::Equal, x_lane, y_lane)
|
||||
}
|
||||
(ty::Float(_), sym::simd_ne) => {
|
||||
fx.bcx.ins().fcmp(FloatCC::NotEqual, x_lane, y_lane)
|
||||
codegen_f16_f128::fcmp(fx, FloatCC::NotEqual, x_lane, y_lane)
|
||||
}
|
||||
(ty::Float(_), sym::simd_lt) => {
|
||||
fx.bcx.ins().fcmp(FloatCC::LessThan, x_lane, y_lane)
|
||||
codegen_f16_f128::fcmp(fx, FloatCC::LessThan, x_lane, y_lane)
|
||||
}
|
||||
(ty::Float(_), sym::simd_le) => {
|
||||
fx.bcx.ins().fcmp(FloatCC::LessThanOrEqual, x_lane, y_lane)
|
||||
codegen_f16_f128::fcmp(fx, FloatCC::LessThanOrEqual, x_lane, y_lane)
|
||||
}
|
||||
(ty::Float(_), sym::simd_gt) => {
|
||||
fx.bcx.ins().fcmp(FloatCC::GreaterThan, x_lane, y_lane)
|
||||
codegen_f16_f128::fcmp(fx, FloatCC::GreaterThan, x_lane, y_lane)
|
||||
}
|
||||
(ty::Float(_), sym::simd_ge) => {
|
||||
fx.bcx.ins().fcmp(FloatCC::GreaterThanOrEqual, x_lane, y_lane)
|
||||
codegen_f16_f128::fcmp(fx, FloatCC::GreaterThanOrEqual, x_lane, y_lane)
|
||||
}
|
||||
|
||||
_ => unreachable!(),
|
||||
@@ -391,6 +394,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
intrinsic,
|
||||
) {
|
||||
(ty::Int(_), sym::simd_neg) => fx.bcx.ins().ineg(lane),
|
||||
(ty::Float(FloatTy::F16), sym::simd_neg) => codegen_f16_f128::neg_f16(fx, lane),
|
||||
(ty::Float(_), sym::simd_neg) => fx.bcx.ins().fneg(lane),
|
||||
|
||||
(ty::Uint(ty::UintTy::U8) | ty::Int(ty::IntTy::I8), sym::simd_bswap) => lane,
|
||||
@@ -418,50 +422,65 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
|
||||
// FIXME use vector instructions when possible
|
||||
simd_pair_for_each_lane(fx, x, y, ret, &|fx, lane_ty, _ret_lane_ty, x_lane, y_lane| {
|
||||
match (lane_ty.kind(), intrinsic) {
|
||||
(ty::Uint(_), sym::simd_add) => fx.bcx.ins().iadd(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_sub) => fx.bcx.ins().isub(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_mul) => fx.bcx.ins().imul(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_div) => fx.bcx.ins().udiv(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_rem) => fx.bcx.ins().urem(x_lane, y_lane),
|
||||
codegen_f16_f128::maybe_with_f16_to_f32_pair(
|
||||
fx,
|
||||
x_lane,
|
||||
y_lane,
|
||||
|fx, x_lane, y_lane| match (lane_ty.kind(), intrinsic) {
|
||||
(ty::Uint(_), sym::simd_add) => fx.bcx.ins().iadd(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_sub) => fx.bcx.ins().isub(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_mul) => fx.bcx.ins().imul(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_div) => fx.bcx.ins().udiv(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_rem) => fx.bcx.ins().urem(x_lane, y_lane),
|
||||
|
||||
(ty::Int(_), sym::simd_add) => fx.bcx.ins().iadd(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_sub) => fx.bcx.ins().isub(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_mul) => fx.bcx.ins().imul(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_div) => fx.bcx.ins().sdiv(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_rem) => fx.bcx.ins().srem(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_add) => fx.bcx.ins().iadd(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_sub) => fx.bcx.ins().isub(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_mul) => fx.bcx.ins().imul(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_div) => fx.bcx.ins().sdiv(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_rem) => fx.bcx.ins().srem(x_lane, y_lane),
|
||||
|
||||
(ty::Float(_), sym::simd_add) => fx.bcx.ins().fadd(x_lane, y_lane),
|
||||
(ty::Float(_), sym::simd_sub) => fx.bcx.ins().fsub(x_lane, y_lane),
|
||||
(ty::Float(_), sym::simd_mul) => fx.bcx.ins().fmul(x_lane, y_lane),
|
||||
(ty::Float(_), sym::simd_div) => fx.bcx.ins().fdiv(x_lane, y_lane),
|
||||
(ty::Float(FloatTy::F32), sym::simd_rem) => fx.lib_call(
|
||||
"fmodf",
|
||||
vec![AbiParam::new(types::F32), AbiParam::new(types::F32)],
|
||||
vec![AbiParam::new(types::F32)],
|
||||
&[x_lane, y_lane],
|
||||
)[0],
|
||||
(ty::Float(FloatTy::F64), sym::simd_rem) => fx.lib_call(
|
||||
"fmod",
|
||||
vec![AbiParam::new(types::F64), AbiParam::new(types::F64)],
|
||||
vec![AbiParam::new(types::F64)],
|
||||
&[x_lane, y_lane],
|
||||
)[0],
|
||||
(ty::Float(_), sym::simd_add) => fx.bcx.ins().fadd(x_lane, y_lane),
|
||||
(ty::Float(_), sym::simd_sub) => fx.bcx.ins().fsub(x_lane, y_lane),
|
||||
(ty::Float(_), sym::simd_mul) => fx.bcx.ins().fmul(x_lane, y_lane),
|
||||
(ty::Float(_), sym::simd_div) => fx.bcx.ins().fdiv(x_lane, y_lane),
|
||||
(ty::Float(FloatTy::F16), sym::simd_rem) => fx.lib_call(
|
||||
"fmodf",
|
||||
vec![AbiParam::new(types::F32), AbiParam::new(types::F32)],
|
||||
vec![AbiParam::new(types::F32)],
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Already converted
|
||||
// by the FIXME above.
|
||||
// fx.bcx.ins().fpromote(types::F32, lhs),
|
||||
// fx.bcx.ins().fpromote(types::F32, rhs),
|
||||
&[x_lane, y_lane],
|
||||
)[0],
|
||||
(ty::Float(FloatTy::F32), sym::simd_rem) => fx.lib_call(
|
||||
"fmodf",
|
||||
vec![AbiParam::new(types::F32), AbiParam::new(types::F32)],
|
||||
vec![AbiParam::new(types::F32)],
|
||||
&[x_lane, y_lane],
|
||||
)[0],
|
||||
(ty::Float(FloatTy::F64), sym::simd_rem) => fx.lib_call(
|
||||
"fmod",
|
||||
vec![AbiParam::new(types::F64), AbiParam::new(types::F64)],
|
||||
vec![AbiParam::new(types::F64)],
|
||||
&[x_lane, y_lane],
|
||||
)[0],
|
||||
|
||||
(ty::Uint(_), sym::simd_shl) => fx.bcx.ins().ishl(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_shr) => fx.bcx.ins().ushr(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_and) => fx.bcx.ins().band(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_or) => fx.bcx.ins().bor(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_xor) => fx.bcx.ins().bxor(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_shl) => fx.bcx.ins().ishl(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_shr) => fx.bcx.ins().ushr(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_and) => fx.bcx.ins().band(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_or) => fx.bcx.ins().bor(x_lane, y_lane),
|
||||
(ty::Uint(_), sym::simd_xor) => fx.bcx.ins().bxor(x_lane, y_lane),
|
||||
|
||||
(ty::Int(_), sym::simd_shl) => fx.bcx.ins().ishl(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_shr) => fx.bcx.ins().sshr(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_and) => fx.bcx.ins().band(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_or) => fx.bcx.ins().bor(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_xor) => fx.bcx.ins().bxor(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_shl) => fx.bcx.ins().ishl(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_shr) => fx.bcx.ins().sshr(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_and) => fx.bcx.ins().band(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_or) => fx.bcx.ins().bor(x_lane, y_lane),
|
||||
(ty::Int(_), sym::simd_xor) => fx.bcx.ins().bxor(x_lane, y_lane),
|
||||
|
||||
_ => unreachable!(),
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -486,7 +505,11 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
let b_lane = b.value_lane(fx, lane).load_scalar(fx);
|
||||
let c_lane = c.value_lane(fx, lane).load_scalar(fx);
|
||||
|
||||
let res_lane = fx.bcx.ins().fma(a_lane, b_lane, c_lane);
|
||||
let res_lane = if *lane_ty.kind() == ty::Float(FloatTy::F16) {
|
||||
codegen_f16_f128::fma_f16(fx, a_lane, b_lane, c_lane)
|
||||
} else {
|
||||
fx.bcx.ins().fma(a_lane, b_lane, c_lane)
|
||||
};
|
||||
let res_lane = CValue::by_val(res_lane, res_lane_layout);
|
||||
|
||||
ret.place_lane(fx, lane).write_cvalue(fx, res_lane);
|
||||
@@ -584,14 +607,15 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
ty::Float(_) => {}
|
||||
_ => unreachable!("{:?}", lane_ty),
|
||||
}
|
||||
match intrinsic {
|
||||
|
||||
codegen_f16_f128::maybe_with_f16_to_f32(fx, lane, |fx, lane| match intrinsic {
|
||||
sym::simd_fabs => fx.bcx.ins().fabs(lane),
|
||||
sym::simd_fsqrt => fx.bcx.ins().sqrt(lane),
|
||||
sym::simd_ceil => fx.bcx.ins().ceil(lane),
|
||||
sym::simd_floor => fx.bcx.ins().floor(lane),
|
||||
sym::simd_trunc => fx.bcx.ins().trunc(lane),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@@ -607,7 +631,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
|
||||
simd_reduce(fx, v, Some(acc), ret, &|fx, lane_ty, a, b| {
|
||||
if lane_ty.is_floating_point() {
|
||||
fx.bcx.ins().fadd(a, b)
|
||||
codegen_f16_f128::maybe_with_f16_to_f32_pair(fx, a, b, |fx, a, b| {
|
||||
fx.bcx.ins().fadd(a, b)
|
||||
})
|
||||
} else {
|
||||
fx.bcx.ins().iadd(a, b)
|
||||
}
|
||||
@@ -625,7 +651,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
|
||||
simd_reduce(fx, v, None, ret, &|fx, lane_ty, a, b| {
|
||||
if lane_ty.is_floating_point() {
|
||||
fx.bcx.ins().fadd(a, b)
|
||||
codegen_f16_f128::maybe_with_f16_to_f32_pair(fx, a, b, |fx, a, b| {
|
||||
fx.bcx.ins().fadd(a, b)
|
||||
})
|
||||
} else {
|
||||
fx.bcx.ins().iadd(a, b)
|
||||
}
|
||||
@@ -644,7 +672,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
|
||||
simd_reduce(fx, v, Some(acc), ret, &|fx, lane_ty, a, b| {
|
||||
if lane_ty.is_floating_point() {
|
||||
fx.bcx.ins().fmul(a, b)
|
||||
codegen_f16_f128::maybe_with_f16_to_f32_pair(fx, a, b, |fx, a, b| {
|
||||
fx.bcx.ins().fmul(a, b)
|
||||
})
|
||||
} else {
|
||||
fx.bcx.ins().imul(a, b)
|
||||
}
|
||||
@@ -662,7 +692,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
||||
|
||||
simd_reduce(fx, v, None, ret, &|fx, lane_ty, a, b| {
|
||||
if lane_ty.is_floating_point() {
|
||||
fx.bcx.ins().fmul(a, b)
|
||||
codegen_f16_f128::maybe_with_f16_to_f32_pair(fx, a, b, |fx, a, b| {
|
||||
fx.bcx.ins().fmul(a, b)
|
||||
})
|
||||
} else {
|
||||
fx.bcx.ins().imul(a, b)
|
||||
}
|
||||
|
||||
@@ -358,7 +358,6 @@ pub(crate) fn codegen_float_binop<'tcx>(
|
||||
} else {
|
||||
(lhs, rhs)
|
||||
};
|
||||
let b = fx.bcx.ins();
|
||||
let res = match bin_op {
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Remove once backend lowerings
|
||||
// have been added to Cranelift.
|
||||
@@ -367,10 +366,10 @@ pub(crate) fn codegen_float_binop<'tcx>(
|
||||
{
|
||||
codegen_f16_f128::codegen_f128_binop(fx, bin_op, lhs, rhs)
|
||||
}
|
||||
BinOp::Add => b.fadd(lhs, rhs),
|
||||
BinOp::Sub => b.fsub(lhs, rhs),
|
||||
BinOp::Mul => b.fmul(lhs, rhs),
|
||||
BinOp::Div => b.fdiv(lhs, rhs),
|
||||
BinOp::Add => fx.bcx.ins().fadd(lhs, rhs),
|
||||
BinOp::Sub => fx.bcx.ins().fsub(lhs, rhs),
|
||||
BinOp::Mul => fx.bcx.ins().fmul(lhs, rhs),
|
||||
BinOp::Div => fx.bcx.ins().fdiv(lhs, rhs),
|
||||
BinOp::Rem => {
|
||||
let (name, ty, lhs, rhs) = match in_lhs.layout().ty.kind() {
|
||||
ty::Float(FloatTy::F16) => (
|
||||
@@ -389,22 +388,12 @@ pub(crate) fn codegen_float_binop<'tcx>(
|
||||
_ => bug!(),
|
||||
};
|
||||
|
||||
let ret_val = fx.lib_call(
|
||||
fx.lib_call(
|
||||
name,
|
||||
vec![AbiParam::new(ty), AbiParam::new(ty)],
|
||||
vec![AbiParam::new(ty)],
|
||||
&[lhs, rhs],
|
||||
)[0];
|
||||
|
||||
let ret_val = if *in_lhs.layout().ty.kind() == ty::Float(FloatTy::F16) {
|
||||
// FIXME(bytecodealliance/wasmtime#8312): Use native Cranelift
|
||||
// operation once Cranelift backend lowerings have been
|
||||
// implemented.
|
||||
codegen_f16_f128::f32_to_f16(fx, ret_val)
|
||||
} else {
|
||||
ret_val
|
||||
};
|
||||
return CValue::by_val(ret_val, in_lhs.layout());
|
||||
)[0]
|
||||
}
|
||||
BinOp::Eq | BinOp::Lt | BinOp::Le | BinOp::Ne | BinOp::Ge | BinOp::Gt => {
|
||||
let fltcc = match bin_op {
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
use std::io::Write;
|
||||
|
||||
use cranelift_codegen::entity::SecondaryMap;
|
||||
use cranelift_codegen::ir::Fact;
|
||||
use cranelift_codegen::ir::entities::AnyEntity;
|
||||
use cranelift_codegen::write::{FuncWriter, PlainWriter};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
@@ -182,13 +181,8 @@ fn write_entity_definition(
|
||||
_func: &Function,
|
||||
entity: AnyEntity,
|
||||
value: &dyn fmt::Display,
|
||||
maybe_fact: Option<&Fact>,
|
||||
) -> fmt::Result {
|
||||
if let Some(fact) = maybe_fact {
|
||||
write!(w, " {} ! {} = {}", entity, fact, value)?;
|
||||
} else {
|
||||
write!(w, " {} = {}", entity, value)?;
|
||||
}
|
||||
write!(w, " {} = {}", entity, value)?;
|
||||
|
||||
if let Some(comment) = self.entity_comments.get(&entity) {
|
||||
writeln!(w, " ; {}", comment.replace('\n', "\n; "))
|
||||
|
||||
@@ -204,7 +204,9 @@ pub(crate) fn value_field(
|
||||
let (field_ptr, field_layout) = codegen_field(fx, ptr, None, layout, field);
|
||||
CValue::by_ref(field_ptr, field_layout)
|
||||
}
|
||||
CValueInner::ByRef(_, Some(_)) => todo!(),
|
||||
CValueInner::ByRef(_, Some(_)) => {
|
||||
bug!("value_field for unsized by-ref value not supported")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,7 +657,13 @@ fn transmute_scalar<'tcx>(
|
||||
flags,
|
||||
);
|
||||
}
|
||||
CValueInner::ByRef(_, Some(_)) => todo!(),
|
||||
CValueInner::ByRef(_from_ptr, Some(_extra)) => {
|
||||
bug!(
|
||||
"write_cvalue for unsized by-ref value not allowed: dst={:?} src={:?}",
|
||||
dst_layout.ty,
|
||||
from.layout().ty
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user