diff --git a/.github/ISSUE_TEMPLATE/documentation.yaml b/.github/ISSUE_TEMPLATE/documentation.yaml index 712b32759ae0..4a79cd4ba97c 100644 --- a/.github/ISSUE_TEMPLATE/documentation.yaml +++ b/.github/ISSUE_TEMPLATE/documentation.yaml @@ -1,5 +1,5 @@ name: Documentation problem -description: Create a report for a documentation problem. +description: Report an issue with documentation content. labels: ["A-docs"] body: - type: markdown @@ -19,20 +19,20 @@ body: - [The Rustonomicon](https://github.com/rust-lang/nomicon/issues) - [The Embedded Book](https://github.com/rust-embedded/book/issues) - All other documentation issues should be filed here. + Or, if you find an issue related to rustdoc (e.g. doctest, rustdoc UI), please use the rustdoc issue template instead. - Or, if you find an issue related to rustdoc (e.g. doctest, rustdoc UI), please use the bug report or blank issue template instead. + All other documentation issues should be filed here. - type: textarea id: location attributes: - label: Location + label: Location (URL) validations: - required: true + required: true - type: textarea id: summary attributes: label: Summary validations: - required: true \ No newline at end of file + required: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e92afc14c20d..6ce543071d84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,7 +117,7 @@ jobs: with: fetch-depth: 2 - # Free up disk space on Linux by removing preinstalled components that + # Free up disk space on Linux and Windows by removing preinstalled components that # we do not need. We do this to enable some of the less resource # intensive jobs to run on free runners, which however also have # less disk space. @@ -125,6 +125,13 @@ jobs: run: src/ci/scripts/free-disk-space.sh if: matrix.free_disk + # If we don't need to free up disk space then just report how much space we have + - name: print disk usage + run: | + echo "disk usage:" + df -h + if: matrix.free_disk == false + # Rust Log Analyzer can't currently detect the PR number of a GitHub # Actions build on its own, so a hint in the log message is needed to # point it in the right direction. @@ -152,9 +159,6 @@ jobs: - name: show the current environment run: src/ci/scripts/dump-environment.sh - - name: install rust - run: src/ci/scripts/install-rust.sh - - name: install awscli run: src/ci/scripts/install-awscli.sh diff --git a/.gitmodules b/.gitmodules index 439fde6d7660..8617643a1202 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,7 +25,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/20.1-2025-07-13 + branch = rustc/21.1-2025-08-01 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/.mailmap b/.mailmap index 90533e81b39f..2b75f5a145f2 100644 --- a/.mailmap +++ b/.mailmap @@ -597,6 +597,7 @@ Sam Radhakrishnan Samuel Tardieu Santiago Pastorino Santiago Pastorino +Sasha Pourcelot Sasha Scott McMurray Scott McMurray Scott Olson Scott Olson diff --git a/Cargo.lock b/Cargo.lock index 6be3bced5e16..dbb76ada8377 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -466,6 +466,8 @@ version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -516,9 +518,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" dependencies = [ "clap_builder", "clap_derive", @@ -536,9 +538,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" dependencies = [ "anstream", "anstyle", @@ -566,7 +568,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "clippy" -version = "0.1.90" +version = "0.1.91" dependencies = [ "anstream", "askama", @@ -593,7 +595,7 @@ dependencies = [ [[package]] name = "clippy_config" -version = "0.1.90" +version = "0.1.91" dependencies = [ "clippy_utils", "itertools", @@ -616,7 +618,7 @@ dependencies = [ [[package]] name = "clippy_lints" -version = "0.1.90" +version = "0.1.91" dependencies = [ "arrayvec", "cargo_metadata 0.18.1", @@ -647,7 +649,7 @@ dependencies = [ [[package]] name = "clippy_utils" -version = "0.1.90" +version = "0.1.91" dependencies = [ "arrayvec", "itertools", @@ -655,6 +657,26 @@ dependencies = [ "serde", ] +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + +[[package]] +name = "codespan-reporting" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" +dependencies = [ + "serde", + "termcolor", + "unicode-width 0.2.1", +] + [[package]] name = "collect-license-metadata" version = "0.1.0" @@ -913,6 +935,68 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "cxx" +version = "1.0.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3523cc02ad831111491dd64b27ad999f1ae189986728e477604e61b81f828df" +dependencies = [ + "cc", + "cxxbridge-cmd", + "cxxbridge-flags", + "cxxbridge-macro", + "foldhash", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212b754247a6f07b10fa626628c157593f0abf640a3dd04cce2760eca970f909" +dependencies = [ + "cc", + "codespan-reporting", + "indexmap", + "proc-macro2", + "quote", + "scratch", + "syn 2.0.104", +] + +[[package]] +name = "cxxbridge-cmd" +version = "1.0.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f426a20413ec2e742520ba6837c9324b55ffac24ead47491a6e29f933c5b135a" +dependencies = [ + "clap", + "codespan-reporting", + "indexmap", + "proc-macro2", + "quote", + "syn 2.0.104", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258b6069020b4e5da6415df94a50ee4f586a6c38b037a180e940a43d06a070d" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8dec184b52be5008d6eaf7e62fc1802caf1ad1227d11b3b7df2c409c7ffc3f4" +dependencies = [ + "indexmap", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.104", +] + [[package]] name = "darling" version = "0.20.11" @@ -967,7 +1051,7 @@ dependencies = [ [[package]] name = "declare_clippy_lint" -version = "0.1.90" +version = "0.1.91" [[package]] name = "derive-where" @@ -1087,7 +1171,7 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users 0.5.0", + "redox_users 0.5.2", "windows-sys 0.60.2", ] @@ -1373,6 +1457,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "genmc-sys" +version = "0.1.0" +dependencies = [ + "cc", + "cmake", + "cxx", + "cxx-build", + "git2", +] + [[package]] name = "getopts" version = "0.2.23" @@ -1427,6 +1522,21 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "git2" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "openssl-probe", + "openssl-sys", + "url", +] + [[package]] name = "glob" version = "0.3.2" @@ -1876,16 +1986,16 @@ dependencies = [ [[package]] name = "ipc-channel" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b1c98b70019c830a1fc39cecfe1f60ff99c4122f0a189697c810c90ec545c14" +checksum = "1700f6b8b9f00cdd675f32fbb3a5be882213140dfe045805273221ca266c43f8" dependencies = [ "bincode", "crossbeam-channel", "fnv", "libc", "mio", - "rand 0.9.1", + "rand 0.9.2", "serde", "tempfile", "uuid", @@ -1984,9 +2094,9 @@ dependencies = [ [[package]] name = "jsonpath-rust" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d057f8fd19e20c3f14d3663983397155739b6bc1148dc5cd4c4a1a5b3130eb0" +checksum = "633a7320c4bb672863a3782e89b9094ad70285e097ff6832cddd0ec615beadfa" dependencies = [ "pest", "pest_derive", @@ -2060,6 +2170,19 @@ dependencies = [ "cc", ] +[[package]] +name = "libgit2-sys" +version = "0.18.2+1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" +dependencies = [ + "cc", + "libc", + "libz-sys", + "openssl-sys", + "pkg-config", +] + [[package]] name = "libloading" version = "0.8.8" @@ -2067,7 +2190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -2078,9 +2201,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4488594b9328dee448adb906d8b126d9b7deb7cf5c22161ee591610bb1be83c0" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ "bitflags", "libc", @@ -2099,6 +2222,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6f6da007f968f9def0d65a05b187e2960183de70c160204ecfccf0ee330212" +dependencies = [ + "cc", +] + [[package]] name = "linkchecker" version = "0.1.0" @@ -2308,6 +2440,7 @@ dependencies = [ "chrono-tz", "colored 3.0.0", "directories", + "genmc-sys", "getrandom 0.3.3", "ipc-channel", "libc", @@ -2315,7 +2448,7 @@ dependencies = [ "libloading", "measureme", "nix", - "rand 0.9.1", + "rand 0.9.2", "regex", "rustc_version", "serde", @@ -2510,9 +2643,9 @@ dependencies = [ [[package]] name = "object" -version = "0.37.1" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03fd943161069e1768b4b3d050890ba48730e590f57e56d4aa04e7e090e61b4a" +checksum = "b3e3d0a7419f081f4a808147e845310313a39f322d7ae1f996b7f001d6cbed04" dependencies = [ "crc32fast", "flate2", @@ -2520,7 +2653,7 @@ dependencies = [ "indexmap", "memchr", "ruzstd 0.8.1", - "wasmparser 0.234.0", + "wasmparser 0.236.0", ] [[package]] @@ -2948,9 +3081,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", @@ -3034,9 +3167,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.13" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ "bitflags", ] @@ -3054,9 +3187,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.16", "libredox", @@ -3146,7 +3279,7 @@ dependencies = [ "build_helper", "gimli 0.32.0", "libc", - "object 0.37.1", + "object 0.37.2", "regex", "serde_json", "similar", @@ -3168,9 +3301,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -3231,7 +3364,7 @@ name = "rustc_abi" version = "0.0.0" dependencies = [ "bitflags", - "rand 0.9.1", + "rand 0.9.2", "rand_xoshiro", "rustc_data_structures", "rustc_hashes", @@ -3284,6 +3417,7 @@ dependencies = [ "rustc_data_structures", "rustc_macros", "rustc_serialize", + "rustc_span", ] [[package]] @@ -3293,7 +3427,6 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -3343,20 +3476,6 @@ dependencies = [ "thin-vec", ] -[[package]] -name = "rustc_attr_data_structures" -version = "0.0.0" -dependencies = [ - "rustc_abi", - "rustc_ast", - "rustc_ast_pretty", - "rustc_data_structures", - "rustc_macros", - "rustc_serialize", - "rustc_span", - "thin-vec", -] - [[package]] name = "rustc_attr_parsing" version = "0.0.0" @@ -3364,7 +3483,6 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_errors", "rustc_feature", "rustc_fluent_macro", @@ -3420,7 +3538,6 @@ version = "0.0.0" dependencies = [ "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -3452,11 +3569,10 @@ dependencies = [ "itertools", "libc", "measureme", - "object 0.37.1", + "object 0.37.2", "rustc-demangle", "rustc_abi", "rustc_ast", - "rustc_attr_data_structures", "rustc_codegen_ssa", "rustc_data_structures", "rustc_errors", @@ -3491,13 +3607,12 @@ dependencies = [ "cc", "itertools", "libc", - "object 0.37.1", + "object 0.37.2", "pathdiff", "regex", "rustc_abi", "rustc_arena", "rustc_ast", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -3535,7 +3650,6 @@ dependencies = [ "rustc_abi", "rustc_apfloat", "rustc_ast", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_errors", "rustc_fluent_macro", @@ -3681,7 +3795,6 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_error_codes", "rustc_error_messages", @@ -3711,7 +3824,6 @@ dependencies = [ "rustc_ast", "rustc_ast_passes", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -3735,8 +3847,8 @@ dependencies = [ name = "rustc_feature" version = "0.0.0" dependencies = [ - "rustc_attr_data_structures", "rustc_data_structures", + "rustc_hir", "rustc_span", "serde", "serde_json", @@ -3781,7 +3893,7 @@ dependencies = [ "rustc_abi", "rustc_arena", "rustc_ast", - "rustc_attr_data_structures", + "rustc_ast_pretty", "rustc_data_structures", "rustc_hashes", "rustc_index", @@ -3802,7 +3914,6 @@ dependencies = [ "rustc_abi", "rustc_arena", "rustc_ast", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -3829,7 +3940,6 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_hir", "rustc_span", ] @@ -3841,7 +3951,6 @@ dependencies = [ "itertools", "rustc_abi", "rustc_ast", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -3866,7 +3975,7 @@ dependencies = [ name = "rustc_incremental" version = "0.0.0" dependencies = [ - "rand 0.9.1", + "rand 0.9.2", "rustc_ast", "rustc_data_structures", "rustc_errors", @@ -3987,7 +4096,6 @@ dependencies = [ "rustc_abi", "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -4061,7 +4169,6 @@ dependencies = [ "odht", "rustc_abi", "rustc_ast", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -4097,7 +4204,6 @@ dependencies = [ "rustc_arena", "rustc_ast", "rustc_ast_ir", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_error_messages", "rustc_errors", @@ -4131,7 +4237,6 @@ dependencies = [ "rustc_apfloat", "rustc_arena", "rustc_ast", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_errors", "rustc_fluent_macro", @@ -4178,7 +4283,6 @@ dependencies = [ "rustc_abi", "rustc_arena", "rustc_ast", - "rustc_attr_data_structures", "rustc_const_eval", "rustc_data_structures", "rustc_errors", @@ -4204,7 +4308,6 @@ version = "0.0.0" dependencies = [ "rustc_abi", "rustc_ast", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_errors", "rustc_fluent_macro", @@ -4275,7 +4378,6 @@ dependencies = [ "rustc_ast", "rustc_ast_lowering", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -4322,7 +4424,6 @@ name = "rustc_privacy" version = "0.0.0" dependencies = [ "rustc_ast", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_errors", "rustc_fluent_macro", @@ -4397,7 +4498,6 @@ dependencies = [ "parking_lot", "rustc_abi", "rustc_ast", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_errors", "rustc_feature", @@ -4419,12 +4519,12 @@ name = "rustc_resolve" version = "0.0.0" dependencies = [ "bitflags", + "indexmap", "itertools", "pulldown-cmark", "rustc_arena", "rustc_ast", "rustc_ast_pretty", - "rustc_attr_data_structures", "rustc_attr_parsing", "rustc_data_structures", "rustc_errors", @@ -4479,7 +4579,7 @@ dependencies = [ "bitflags", "getopts", "libc", - "rand 0.9.1", + "rand 0.9.2", "rustc_abi", "rustc_ast", "rustc_data_structures", @@ -4543,7 +4643,7 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags", - "object 0.37.1", + "object 0.37.2", "rustc_abi", "rustc_data_structures", "rustc_fs_util", @@ -4564,7 +4664,7 @@ dependencies = [ "crossbeam-deque", "crossbeam-utils", "libc", - "rand 0.9.1", + "rand 0.9.2", "rand_xorshift", "scoped-tls", "smallvec", @@ -4587,7 +4687,6 @@ dependencies = [ "itertools", "rustc_abi", "rustc_ast", - "rustc_attr_data_structures", "rustc_data_structures", "rustc_errors", "rustc_fluent_macro", @@ -4877,6 +4976,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scratch" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f6280af86e5f559536da57a45ebc84948833b3bee313a7dd25232e09c878a52" + [[package]] name = "self_cell" version = "1.2.0" @@ -4935,9 +5040,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.141" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -5270,7 +5375,7 @@ version = "0.1.0" dependencies = [ "indicatif", "num", - "rand 0.9.1", + "rand 0.9.2", "rand_chacha 0.9.0", "rayon", ] @@ -5995,12 +6100,12 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.235.0" +version = "0.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bc393c395cb621367ff02d854179882b9a351b4e0c93d1397e6090b53a5c2a" +checksum = "3108979166ab0d3c7262d2e16a2190ffe784b2a5beb963edef154b5e8e07680b" dependencies = [ "leb128fmt", - "wasmparser 0.235.0", + "wasmparser 0.236.0", ] [[package]] @@ -6040,9 +6145,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "16d1eee846a705f6f3cb9d7b9f79b54583810f1fb57a1e3aea76d1742db2e3d2" dependencies = [ "bitflags", "indexmap", @@ -6051,22 +6156,22 @@ dependencies = [ [[package]] name = "wast" -version = "235.0.0" +version = "236.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eda4293f626c99021bb3a6fbe4fbbe90c0e31a5ace89b5f620af8925de72e13" +checksum = "11d6b6faeab519ba6fbf9b26add41617ca6f5553f99ebc33d876e591d2f4f3c6" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width 0.2.1", - "wasm-encoder 0.235.0", + "wasm-encoder 0.236.0", ] [[package]] name = "wat" -version = "1.235.0" +version = "1.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e777e0327115793cb96ab220b98f85327ec3d11f34ec9e8d723264522ef206aa" +checksum = "cc31704322400f461f7f31a5f9190d5488aaeafb63ae69ad2b5888d2704dcb08" dependencies = [ "wast", ] @@ -6322,7 +6427,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -6358,10 +6463,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/RELEASES.md b/RELEASES.md index 1ae221774dc9..b6dc06286467 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,140 @@ +Version 1.89.0 (2025-08-07) +========================== + + + +Language +-------- +- [Stabilize explicitly inferred const arguments (`feature(generic_arg_infer)`)](https://github.com/rust-lang/rust/pull/141610) +- [Add a warn-by-default `mismatched_lifetime_syntaxes` lint.](https://github.com/rust-lang/rust/pull/138677) + This lint detects when the same lifetime is referred to by different syntax categories between function arguments and return values, which can be confusing to read, especially in unsafe code. + This lint supersedes the warn-by-default `elided_named_lifetimes` lint. +- [Expand `unpredictable_function_pointer_comparisons` to also lint on function pointer comparisons in external macros](https://github.com/rust-lang/rust/pull/134536) +- [Make the `dangerous_implicit_autorefs` lint deny-by-default](https://github.com/rust-lang/rust/pull/141661) +- [Stabilize the avx512 target features](https://github.com/rust-lang/rust/pull/138940) +- [Stabilize `kl` and `widekl` target features for x86](https://github.com/rust-lang/rust/pull/140766) +- [Stabilize `sha512`, `sm3` and `sm4` target features for x86](https://github.com/rust-lang/rust/pull/140767) +- [Stabilize LoongArch target features `f`, `d`, `frecipe`, `lasx`, `lbt`, `lsx`, and `lvz`](https://github.com/rust-lang/rust/pull/135015) +- [Remove `i128` and `u128` from `improper_ctypes_definitions`](https://github.com/rust-lang/rust/pull/137306) +- [Stabilize `repr128` (`#[repr(u128)]`, `#[repr(i128)]`)](https://github.com/rust-lang/rust/pull/138285) +- [Allow `#![doc(test(attr(..)))]` everywhere](https://github.com/rust-lang/rust/pull/140560) +- [Extend temporary lifetime extension to also go through tuple struct and tuple variant constructors](https://github.com/rust-lang/rust/pull/140593) +- [`extern "C"` functions on the `wasm32-unknown-unknown` target now have a standards compliant ABI](https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/) + + + +Compiler +-------- +- [Default to non-leaf frame pointers on aarch64-linux](https://github.com/rust-lang/rust/pull/140832) +- [Enable non-leaf frame pointers for Arm64EC Windows](https://github.com/rust-lang/rust/pull/140862) +- [Set Apple frame pointers by architecture](https://github.com/rust-lang/rust/pull/141797) + + + + +Platform Support +---------------- +- [Add new Tier-3 targets `loongarch32-unknown-none` and `loongarch32-unknown-none-softfloat`](https://github.com/rust-lang/rust/pull/142053) +- [`x86_64-apple-darwin` is in the process of being demoted to Tier 2 with host tools](https://github.com/rust-lang/rfcs/pull/3841) + +Refer to Rust's [platform support page][platform-support-doc] +for more information on Rust's tiered platform support. + +[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html + + + +Libraries +--------- +- [Specify the base path for `file!`](https://github.com/rust-lang/rust/pull/134442) +- [Allow storing `format_args!()` in a variable](https://github.com/rust-lang/rust/pull/140748) +- [Add `#[must_use]` to `[T; N]::map`](https://github.com/rust-lang/rust/pull/140957) +- [Implement `DerefMut` for `Lazy{Cell,Lock}`](https://github.com/rust-lang/rust/pull/129334) +- [Implement `Default` for `array::IntoIter`](https://github.com/rust-lang/rust/pull/141574) +- [Implement `Clone` for `slice::ChunkBy`](https://github.com/rust-lang/rust/pull/138016) +- [Implement `io::Seek` for `io::Take`](https://github.com/rust-lang/rust/pull/138023) + + + + +Stabilized APIs +--------------- + +- [`NonZero`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html) +- Many intrinsics for x86, not enumerated here + - [AVX512 intrinsics](https://github.com/rust-lang/rust/issues/111137) + - [`SHA512`, `SM3` and `SM4` intrinsics](https://github.com/rust-lang/rust/issues/126624) +- [`File::lock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.lock) +- [`File::lock_shared`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.lock_shared) +- [`File::try_lock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.try_lock) +- [`File::try_lock_shared`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.try_lock_shared) +- [`File::unlock`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.unlock) +- [`NonNull::from_ref`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.from_ref) +- [`NonNull::from_mut`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.from_mut) +- [`NonNull::without_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.without_provenance) +- [`NonNull::with_exposed_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.with_exposed_provenance) +- [`NonNull::expose_provenance`](https://doc.rust-lang.org/stable/std/ptr/struct.NonNull.html#method.expose_provenance) +- [`OsString::leak`](https://doc.rust-lang.org/stable/std/ffi/struct.OsString.html#method.leak) +- [`PathBuf::leak`](https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#method.leak) +- [`Result::flatten`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.flatten) +- [`std::os::linux::net::TcpStreamExt::quickack`](https://doc.rust-lang.org/stable/std/os/linux/net/trait.TcpStreamExt.html#tymethod.quickack) +- [`std::os::linux::net::TcpStreamExt::set_quickack`](https://doc.rust-lang.org/stable/std/os/linux/net/trait.TcpStreamExt.html#tymethod.set_quickack) + +These previously stable APIs are now stable in const contexts: + +- [`<[T; N]>::as_mut_slice`](https://doc.rust-lang.org/stable/std/primitive.array.html#method.as_mut_slice) +- [`<[u8]>::eq_ignore_ascii_case`](https://doc.rust-lang.org/stable/std/primitive.slice.html#impl-%5Bu8%5D/method.eq_ignore_ascii_case) +- [`str::eq_ignore_ascii_case`](https://doc.rust-lang.org/stable/std/primitive.str.html#impl-str/method.eq_ignore_ascii_case) + + + + +Cargo +----- +- [`cargo fix` and `cargo clippy --fix` now default to the same Cargo target selection as other build commands.](https://github.com/rust-lang/cargo/pull/15192/) Previously it would apply to all targets (like binaries, examples, tests, etc.). The `--edition` flag still applies to all targets. +- [Stabilize doctest-xcompile.](https://github.com/rust-lang/cargo/pull/15462/) Doctests are now tested when cross-compiling. Just like other tests, it will use the [`runner` setting](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) to run the tests. If you need to disable tests for a target, you can use the [ignore doctest attribute](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#ignoring-targets) to specify the targets to ignore. + + + + +Rustdoc +----- +- [On mobile, make the sidebar full width and linewrap](https://github.com/rust-lang/rust/pull/139831). This makes long section and item names much easier to deal with on mobile. + + + + +Compatibility Notes +------------------- +- [Make `missing_fragment_specifier` an unconditional error](https://github.com/rust-lang/rust/pull/128425) +- [Enabling the `neon` target feature on `aarch64-unknown-none-softfloat` causes a warning](https://github.com/rust-lang/rust/pull/135160) because mixing code with and without that target feature is not properly supported by LLVM +- [Sized Hierarchy: Part I](https://github.com/rust-lang/rust/pull/137944) + - Introduces a small breaking change affecting `?Sized` bounds on impls on recursive types which contain associated type projections. It is not expected to affect any existing published crates. Can be fixed by refactoring the involved types or opting into the `sized_hierarchy` unstable feature. See the [FCP report](https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485) for a code example. +- The warn-by-default `elided_named_lifetimes` lint is [superseded by the warn-by-default `mismatched_lifetime_syntaxes` lint.](https://github.com/rust-lang/rust/pull/138677) +- [Error on recursive opaque types earlier in the type checker](https://github.com/rust-lang/rust/pull/139419) +- [Type inference side effects from requiring element types of array repeat expressions are `Copy` are now only available at the end of type checking](https://github.com/rust-lang/rust/pull/139635) +- [The deprecated accidentally-stable `std::intrinsics::{copy,copy_nonoverlapping,write_bytes}` are now proper intrinsics](https://github.com/rust-lang/rust/pull/139916). There are no debug assertions guarding against UB, and they cannot be coerced to function pointers. +- [Remove long-deprecated `std::intrinsics::drop_in_place`](https://github.com/rust-lang/rust/pull/140151) +- [Make well-formedness predicates no longer coinductive](https://github.com/rust-lang/rust/pull/140208) +- [Remove hack when checking impl method compatibility](https://github.com/rust-lang/rust/pull/140557) +- [Remove unnecessary type inference due to built-in trait object impls](https://github.com/rust-lang/rust/pull/141352) +- [Lint against "stdcall", "fastcall", and "cdecl" on non-x86-32 targets](https://github.com/rust-lang/rust/pull/141435) +- [Future incompatibility warnings relating to the never type (`!`) are now reported in dependencies](https://github.com/rust-lang/rust/pull/141937) +- [Ensure `std::ptr::copy_*` intrinsics also perform the static self-init checks](https://github.com/rust-lang/rust/pull/142575) +- [`extern "C"` functions on the `wasm32-unknown-unknown` target now have a standards compliant ABI](https://blog.rust-lang.org/2025/04/04/c-abi-changes-for-wasm32-unknown-unknown/) + + + +Internal Changes +---------------- + +These changes do not affect any public interfaces of Rust, but they represent +significant improvements to the performance or internals of rustc and related +tools. + +- [Correctly un-remap compiler sources paths with the `rustc-dev` component](https://github.com/rust-lang/rust/pull/142377) + + Version 1.88.0 (2025-06-26) ========================== diff --git a/bootstrap.example.toml b/bootstrap.example.toml index 73e93ccbe420..89da6eeb5315 100644 --- a/bootstrap.example.toml +++ b/bootstrap.example.toml @@ -465,6 +465,11 @@ # What custom diff tool to use for displaying compiletest tests. #build.compiletest-diff-tool = +# Whether to allow `compiletest` self-tests and `compiletest`-managed test +# suites to be run against the stage 0 rustc. This is only intended to be used +# when the stage 0 compiler is actually built from in-tree sources. +#build.compiletest-allow-stage0 = false + # Whether to use the precompiled stage0 libtest with compiletest. #build.compiletest-use-stage0-libtest = true @@ -475,6 +480,9 @@ # Note that if any value is manually given to bootstrap such as # `./x test tidy --extra-checks=js`, this value is ignored. # Use `--extra-checks=''` to temporarily disable all extra checks. +# +# Automatically enabled in the "tools" profile. +# Set to the empty string to force disable (recommeded for hdd systems). #build.tidy-extra-checks = "" # Indicates whether ccache is used when building certain artifacts (e.g. LLVM). @@ -732,11 +740,19 @@ # result (broken, compiling, testing) into this JSON file. #rust.save-toolstates = (path) -# This is an array of the codegen backends that will be compiled for the rustc -# that's being compiled. The default is to only build the LLVM codegen backend, -# and currently the only standard options supported are `"llvm"`, `"cranelift"` -# and `"gcc"`. The first backend in this list will be used as default by rustc -# when no explicit backend is specified. +# This array serves three distinct purposes: +# - Backends in this list will be automatically compiled and included in the sysroot of each +# rustc compiled by bootstrap. +# - The first backend in this list will be configured as the **default codegen backend** by each +# rustc compiled by bootstrap. In other words, if the first backend is e.g. cranelift, then when +# we build a stage 1 rustc, it will by default compile Rust programs using the Cranelift backend. +# This also means that stage 2 rustc would get built by the Cranelift backend. +# - Running `x dist` (without additional arguments, or with `--include-default-paths`) will produce +# a dist component/tarball for the Cranelift backend if it is included in this array. +# +# Note that the LLVM codegen backend is special and will always be built and distributed. +# +# Currently, the only standard options supported here are `"llvm"`, `"cranelift"` and `"gcc"`. #rust.codegen-backends = ["llvm"] # Indicates whether LLD will be compiled and made available in the sysroot for rustc to execute, and diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs index 716bb716cdb5..c2405553756b 100644 --- a/compiler/rustc_abi/src/layout.rs +++ b/compiler/rustc_abi/src/layout.rs @@ -1,3 +1,4 @@ +use std::collections::BTreeSet; use std::fmt::{self, Write}; use std::ops::{Bound, Deref}; use std::{cmp, iter}; @@ -5,7 +6,7 @@ use std::{cmp, iter}; use rustc_hashes::Hash64; use rustc_index::Idx; use rustc_index::bit_set::BitMatrix; -use tracing::debug; +use tracing::{debug, trace}; use crate::{ AbiAlign, Align, BackendRepr, FieldsShape, HasDataLayout, IndexSlice, IndexVec, Integer, @@ -766,30 +767,63 @@ impl LayoutCalculator { let niche_filling_layout = calculate_niche_filling_layout(); - let (mut min, mut max) = (i128::MAX, i128::MIN); let discr_type = repr.discr_type(); - let bits = Integer::from_attr(dl, discr_type).size().bits(); - for (i, mut val) in discriminants { - if !repr.c() && variants[i].iter().any(|f| f.is_uninhabited()) { - continue; - } - if discr_type.is_signed() { - // sign extend the raw representation to be an i128 - val = (val << (128 - bits)) >> (128 - bits); - } - if val < min { - min = val; - } - if val > max { - max = val; - } - } - // We might have no inhabited variants, so pretend there's at least one. - if (min, max) == (i128::MAX, i128::MIN) { - min = 0; - max = 0; - } - assert!(min <= max, "discriminant range is {min}...{max}"); + let discr_int = Integer::from_attr(dl, discr_type); + // Because we can only represent one range of valid values, we'll look for the + // largest range of invalid values and pick everything else as the range of valid + // values. + + // First we need to sort the possible discriminant values so that we can look for the largest gap: + let valid_discriminants: BTreeSet = discriminants + .filter(|&(i, _)| repr.c() || variants[i].iter().all(|f| !f.is_uninhabited())) + .map(|(_, val)| { + if discr_type.is_signed() { + // sign extend the raw representation to be an i128 + // FIXME: do this at the discriminant iterator creation sites + discr_int.size().sign_extend(val as u128) + } else { + val + } + }) + .collect(); + trace!(?valid_discriminants); + let discriminants = valid_discriminants.iter().copied(); + //let next_discriminants = discriminants.clone().cycle().skip(1); + let next_discriminants = + discriminants.clone().chain(valid_discriminants.first().copied()).skip(1); + // Iterate over pairs of each discriminant together with the next one. + // Since they were sorted, we can now compute the niche sizes and pick the largest. + let discriminants = discriminants.zip(next_discriminants); + let largest_niche = discriminants.max_by_key(|&(start, end)| { + trace!(?start, ?end); + // If this is a wraparound range, the niche size is `MAX - abs(diff)`, as the diff between + // the two end points is actually the size of the valid discriminants. + let dist = if start > end { + // Overflow can happen for 128 bit discriminants if `end` is negative. + // But in that case casting to `u128` still gets us the right value, + // as the distance must be positive if the lhs of the subtraction is larger than the rhs. + let dist = start.wrapping_sub(end); + if discr_type.is_signed() { + discr_int.signed_max().wrapping_sub(dist) as u128 + } else { + discr_int.size().unsigned_int_max() - dist as u128 + } + } else { + // Overflow can happen for 128 bit discriminants if `start` is negative. + // But in that case casting to `u128` still gets us the right value, + // as the distance must be positive if the lhs of the subtraction is larger than the rhs. + end.wrapping_sub(start) as u128 + }; + trace!(?dist); + dist + }); + trace!(?largest_niche); + + // `max` is the last valid discriminant before the largest niche + // `min` is the first valid discriminant after the largest niche + let (max, min) = largest_niche + // We might have no inhabited variants, so pretend there's at least one. + .unwrap_or((0, 0)); let (min_ity, signed) = discr_range_of_repr(min, max); //Integer::repr_discr(tcx, ty, &repr, min, max); let mut align = dl.aggregate_align; diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 8e346706877d..14e256b8045d 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1205,6 +1205,19 @@ impl Integer { } } + /// Returns the smallest signed value that can be represented by this Integer. + #[inline] + pub fn signed_min(self) -> i128 { + use Integer::*; + match self { + I8 => i8::MIN as i128, + I16 => i16::MIN as i128, + I32 => i32::MIN as i128, + I64 => i64::MIN as i128, + I128 => i128::MIN, + } + } + /// Finds the smallest Integer type which can represent the signed value. #[inline] pub fn fit_signed(x: i128) -> Integer { diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 984b280e81b5..8160ed3cc46f 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -23,7 +23,7 @@ use std::{cmp, fmt}; pub use GenericArgs::*; pub use UnsafeSource::*; -pub use rustc_ast_ir::{Movability, Mutability, Pinnedness}; +pub use rustc_ast_ir::{FloatTy, IntTy, Movability, Mutability, Pinnedness, UintTy}; use rustc_data_structures::packed::Pu128; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::stack::ensure_sufficient_stack; @@ -35,7 +35,6 @@ use rustc_span::{ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, use thin_vec::{ThinVec, thin_vec}; pub use crate::format::*; -use crate::ptr::P; use crate::token::{self, CommentKind, Delimiter}; use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, TokenStream}; use crate::util::parser::{ExprPrecedence, Fixity}; @@ -225,7 +224,7 @@ pub struct PathSegment { /// `Some` means that parameter list is supplied (`Path`) /// but it can be empty (`Path<>`). /// `P` is used as a size optimization for the common case with no parameters. - pub args: Option>, + pub args: Option>, } // Succeeds if the path segment is arg-free and matches the given symbol. @@ -286,7 +285,7 @@ pub enum GenericArg { /// `'a` in `Foo<'a>`. Lifetime(#[visitable(extra = LifetimeCtxt::GenericArg)] Lifetime), /// `Bar` in `Foo`. - Type(P), + Type(Box), /// `1` in `Foo<1>`. Const(AnonConst), } @@ -328,15 +327,15 @@ impl AngleBracketedArg { } } -impl From for P { +impl From for Box { fn from(val: AngleBracketedArgs) -> Self { - P(GenericArgs::AngleBracketed(val)) + Box::new(GenericArgs::AngleBracketed(val)) } } -impl From for P { +impl From for Box { fn from(val: ParenthesizedArgs) -> Self { - P(GenericArgs::Parenthesized(val)) + Box::new(GenericArgs::Parenthesized(val)) } } @@ -350,7 +349,7 @@ pub struct ParenthesizedArgs { pub span: Span, /// `(A, B)` - pub inputs: ThinVec>, + pub inputs: ThinVec>, /// ```text /// Foo(A, B) -> C @@ -435,10 +434,10 @@ pub enum GenericParamKind { /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). Lifetime, Type { - default: Option>, + default: Option>, }, Const { - ty: P, + ty: Box, /// Span of the whole parameter definition, including default. span: Span, /// Optional default value for the const generic param. @@ -526,7 +525,7 @@ pub struct WhereBoundPredicate { /// Any generics from a `for` binding. pub bound_generic_params: ThinVec, /// The type being bounded. - pub bounded_ty: P, + pub bounded_ty: Box, /// Trait and lifetime bounds (`Clone + Send + 'static`). #[visitable(extra = BoundKind::Bound)] pub bounds: GenericBounds, @@ -548,8 +547,8 @@ pub struct WhereRegionPredicate { /// E.g., `T = int`. #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct WhereEqPredicate { - pub lhs_ty: P, - pub rhs_ty: P, + pub lhs_ty: Box, + pub rhs_ty: Box, } #[derive(Clone, Encodable, Decodable, Debug, Walkable)] @@ -558,7 +557,7 @@ pub struct Crate { /// expansion placeholders or an unassigned value (`DUMMY_NODE_ID`) before that. pub id: NodeId, pub attrs: AttrVec, - pub items: ThinVec>, + pub items: ThinVec>, pub spans: ModSpans, pub is_placeholder: bool, } @@ -638,7 +637,7 @@ pub struct Pat { impl Pat { /// Attempt reparsing the pattern as a type. /// This is intended for use by diagnostics. - pub fn to_ty(&self) -> Option> { + pub fn to_ty(&self) -> Option> { let kind = match &self.kind { PatKind::Missing => unreachable!(), // In a type expression `_` is an inference variable. @@ -671,7 +670,7 @@ impl Pat { _ => return None, }; - Some(P(Ty { kind, id: self.id, span: self.span, tokens: None })) + Some(Box::new(Ty { kind, id: self.id, span: self.span, tokens: None })) } /// Walk top-down and call `it` in each place where a pattern occurs @@ -764,8 +763,8 @@ impl Pat { } } -impl From> for Pat { - fn from(value: P) -> Self { +impl From> for Pat { + fn from(value: Box) -> Self { *value } } @@ -780,7 +779,7 @@ pub struct PatField { /// The identifier for the field. pub ident: Ident, /// The pattern the field is destructured to. - pub pat: P, + pub pat: Box, pub is_shorthand: bool, pub attrs: AttrVec, pub id: NodeId, @@ -865,44 +864,44 @@ pub enum PatKind { /// or a unit struct/variant pattern, or a const pattern (in the last two cases the third /// field must be `None`). Disambiguation cannot be done with parser alone, so it happens /// during name resolution. - Ident(BindingMode, Ident, Option>), + Ident(BindingMode, Ident, Option>), /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`). - Struct(Option>, Path, ThinVec, PatFieldsRest), + Struct(Option>, Path, ThinVec, PatFieldsRest), /// A tuple struct/variant pattern (`Variant(x, y, .., z)`). - TupleStruct(Option>, Path, ThinVec>), + TupleStruct(Option>, Path, ThinVec>), /// An or-pattern `A | B | C`. /// Invariant: `pats.len() >= 2`. - Or(ThinVec>), + Or(ThinVec>), /// A possibly qualified path pattern. /// Unqualified path patterns `A::B::C` can legally refer to variants, structs, constants /// or associated constants. Qualified path patterns `::B::C`/`::B::C` can /// only legally refer to associated constants. - Path(Option>, Path), + Path(Option>, Path), /// A tuple pattern (`(a, b)`). - Tuple(ThinVec>), + Tuple(ThinVec>), /// A `box` pattern. - Box(P), + Box(Box), /// A `deref` pattern (currently `deref!()` macro-based syntax). - Deref(P), + Deref(Box), /// A reference pattern (e.g., `&mut (a, b)`). - Ref(P, Mutability), + Ref(Box, Mutability), /// A literal, const block or path. - Expr(P), + Expr(Box), /// A range pattern (e.g., `1...2`, `1..2`, `1..`, `..2`, `1..=2`, `..=2`). - Range(Option>, Option>, Spanned), + Range(Option>, Option>, Spanned), /// A slice pattern `[a, b, c]`. - Slice(ThinVec>), + Slice(ThinVec>), /// A rest pattern `..`. /// @@ -922,13 +921,13 @@ pub enum PatKind { Never, /// A guard pattern (e.g., `x if guard(x)`). - Guard(P, P), + Guard(Box, Box), /// Parentheses in patterns used for grouping (i.e., `(PAT)`). - Paren(P), + Paren(Box), /// A macro pattern; pre-expansion. - MacCall(P), + MacCall(Box), /// Placeholder for a pattern that wasn't syntactically well formed in some way. Err(ErrorGuaranteed), @@ -1223,22 +1222,22 @@ impl Stmt { #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum StmtKind { /// A local (let) binding. - Let(P), + Let(Box), /// An item definition. - Item(P), + Item(Box), /// Expr without trailing semi-colon. - Expr(P), + Expr(Box), /// Expr with a trailing semi-colon. - Semi(P), + Semi(Box), /// Just a trailing semi-colon. Empty, /// Macro. - MacCall(P), + MacCall(Box), } #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct MacCallStmt { - pub mac: P, + pub mac: Box, pub style: MacStmtStyle, pub attrs: AttrVec, pub tokens: Option, @@ -1262,8 +1261,8 @@ pub enum MacStmtStyle { pub struct Local { pub id: NodeId, pub super_: Option, - pub pat: P, - pub ty: Option>, + pub pat: Box, + pub ty: Option>, pub kind: LocalKind, pub span: Span, pub colon_sp: Option, @@ -1278,10 +1277,10 @@ pub enum LocalKind { Decl, /// Local declaration with an initializer. /// Example: `let x = y;` - Init(P), + Init(Box), /// Local declaration with an initializer and an `else` clause. /// Example: `let Some(x) = y else { return };` - InitElse(P, P), + InitElse(Box, Box), } impl LocalKind { @@ -1315,11 +1314,11 @@ impl LocalKind { pub struct Arm { pub attrs: AttrVec, /// Match arm pattern, e.g. `10` in `match foo { 10 => {}, _ => {} }`. - pub pat: P, + pub pat: Box, /// Match arm guard, e.g. `n > 10` in `match foo { n if n > 10 => {}, _ => {} }`. - pub guard: Option>, + pub guard: Option>, /// Match arm body. Omitted if the pattern is a never pattern. - pub body: Option>, + pub body: Option>, pub span: Span, pub id: NodeId, pub is_placeholder: bool, @@ -1332,7 +1331,7 @@ pub struct ExprField { pub id: NodeId, pub span: Span, pub ident: Ident, - pub expr: P, + pub expr: Box, pub is_shorthand: bool, pub is_placeholder: bool, } @@ -1357,7 +1356,7 @@ pub enum UnsafeSource { #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct AnonConst { pub id: NodeId, - pub value: P, + pub value: Box, } /// An expression. @@ -1469,7 +1468,7 @@ impl Expr { } /// Attempts to reparse as `Ty` (for diagnostic purposes). - pub fn to_ty(&self) -> Option> { + pub fn to_ty(&self) -> Option> { let kind = match &self.kind { // Trivial conversions. ExprKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()), @@ -1511,7 +1510,7 @@ impl Expr { _ => return None, }; - Some(P(Ty { kind, id: self.id, span: self.span, tokens: None })) + Some(Box::new(Ty { kind, id: self.id, span: self.span, tokens: None })) } pub fn precedence(&self) -> ExprPrecedence { @@ -1632,8 +1631,8 @@ impl Expr { } } -impl From> for Expr { - fn from(value: P) -> Self { +impl From> for Expr { + fn from(value: Box) -> Self { *value } } @@ -1645,8 +1644,8 @@ pub struct Closure { pub constness: Const, pub coroutine_kind: Option, pub movability: Movability, - pub fn_decl: P, - pub body: P, + pub fn_decl: Box, + pub body: Box, /// The span of the declaration block: 'move |...| -> ...' pub fn_decl_span: Span, /// The span of the argument block `|...|` @@ -1677,9 +1676,9 @@ pub struct MethodCall { /// The method name and its generic arguments, e.g. `foo::`. pub seg: PathSegment, /// The receiver, e.g. `x`. - pub receiver: P, + pub receiver: Box, /// The arguments, e.g. `a, b, c`. - pub args: ThinVec>, + pub args: ThinVec>, /// The span of the function, without the dot and receiver e.g. `foo::(a, b, c)`. pub span: Span, @@ -1688,7 +1687,7 @@ pub struct MethodCall { #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub enum StructRest { /// `..x`. - Base(P), + Base(Box), /// `..`. Rest(Span), /// No trailing `..` or expression. @@ -1697,7 +1696,7 @@ pub enum StructRest { #[derive(Clone, Encodable, Decodable, Debug, Walkable)] pub struct StructExpr { - pub qself: Option>, + pub qself: Option>, pub path: Path, pub fields: ThinVec, pub rest: StructRest, @@ -1707,7 +1706,7 @@ pub struct StructExpr { #[derive(Clone, Encodable, Decodable, Debug)] pub enum ExprKind { /// An array (e.g, `[a, b, c, d]`). - Array(ThinVec>), + Array(ThinVec>), /// Allow anonymous constants from an inline `const` block. ConstBlock(AnonConst), /// A function call. @@ -1716,90 +1715,90 @@ pub enum ExprKind { /// and the second field is the list of arguments. /// This also represents calling the constructor of /// tuple-like ADTs such as tuple structs and enum variants. - Call(P, ThinVec>), + Call(Box, ThinVec>), /// A method call (e.g., `x.foo::(a, b, c)`). MethodCall(Box), /// A tuple (e.g., `(a, b, c, d)`). - Tup(ThinVec>), + Tup(ThinVec>), /// A binary operation (e.g., `a + b`, `a * b`). - Binary(BinOp, P, P), + Binary(BinOp, Box, Box), /// A unary operation (e.g., `!x`, `*x`). - Unary(UnOp, P), + Unary(UnOp, Box), /// A literal (e.g., `1`, `"foo"`). Lit(token::Lit), /// A cast (e.g., `foo as f64`). - Cast(P, P), + Cast(Box, Box), /// A type ascription (e.g., `builtin # type_ascribe(42, usize)`). /// /// Usually not written directly in user code but /// indirectly via the macro `type_ascribe!(...)`. - Type(P, P), + Type(Box, Box), /// A `let pat = expr` expression that is only semantically allowed in the condition /// of `if` / `while` expressions. (e.g., `if let 0 = x { .. }`). /// /// `Span` represents the whole `let pat = expr` statement. - Let(P, P, Span, Recovered), + Let(Box, Box, Span, Recovered), /// An `if` block, with an optional `else` block. /// /// `if expr { block } else { expr }` /// /// If present, the "else" expr is always `ExprKind::Block` (for `else`) or /// `ExprKind::If` (for `else if`). - If(P, P, Option>), + If(Box, Box, Option>), /// A while loop, with an optional label. /// /// `'label: while expr { block }` - While(P, P, Option for &F where - F: ~const Fn, + F: [const] Fn, { extern "rust-call" fn call(&self, args: A) -> F::Output { (**self).call(args) @@ -271,7 +271,7 @@ mod impls { #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")] impl const FnMut for &F where - F: ~const Fn, + F: [const] Fn, { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { (**self).call(args) @@ -282,7 +282,7 @@ mod impls { #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")] impl const FnOnce for &F where - F: ~const Fn, + F: [const] Fn, { type Output = F::Output; @@ -295,7 +295,7 @@ mod impls { #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")] impl const FnMut for &mut F where - F: ~const FnMut, + F: [const] FnMut, { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { (*self).call_mut(args) @@ -306,7 +306,7 @@ mod impls { #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")] impl const FnOnce for &mut F where - F: ~const FnMut, + F: [const] FnMut, { type Output = F::Output; extern "rust-call" fn call_once(self, args: A) -> F::Output { diff --git a/library/core/src/ops/index.rs b/library/core/src/ops/index.rs index d8489e9a9491..1aed2fb4742e 100644 --- a/library/core/src/ops/index.rs +++ b/library/core/src/ops/index.rs @@ -169,7 +169,7 @@ see chapter in The Book : ~const Index { +pub trait IndexMut: [const] Index { /// Performs the mutable indexing (`container[index]`) operation. /// /// # Panics diff --git a/library/core/src/ops/range.rs b/library/core/src/ops/range.rs index ad3b6439a610..f33a33e6b752 100644 --- a/library/core/src/ops/range.rs +++ b/library/core/src/ops/range.rs @@ -1141,6 +1141,12 @@ impl<'a, T: ?Sized + 'a> RangeBounds for (Bound<&'a T>, Bound<&'a T>) { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `start..` with `(Bound::Included(start), Bound::Unbounded)`. #[stable(feature = "collections_range", since = "1.28.0")] impl RangeBounds for RangeFrom<&T> { fn start_bound(&self) -> Bound<&T> { @@ -1151,6 +1157,12 @@ impl RangeBounds for RangeFrom<&T> { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `..end` with `(Bound::Unbounded, Bound::Excluded(end))`. #[stable(feature = "collections_range", since = "1.28.0")] impl RangeBounds for RangeTo<&T> { fn start_bound(&self) -> Bound<&T> { @@ -1161,6 +1173,12 @@ impl RangeBounds for RangeTo<&T> { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `start..end` with `(Bound::Included(start), Bound::Excluded(end))`. #[stable(feature = "collections_range", since = "1.28.0")] impl RangeBounds for Range<&T> { fn start_bound(&self) -> Bound<&T> { @@ -1171,6 +1189,12 @@ impl RangeBounds for Range<&T> { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `start..=end` with `(Bound::Included(start), Bound::Included(end))`. #[stable(feature = "collections_range", since = "1.28.0")] impl RangeBounds for RangeInclusive<&T> { fn start_bound(&self) -> Bound<&T> { @@ -1181,6 +1205,12 @@ impl RangeBounds for RangeInclusive<&T> { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `..=end` with `(Bound::Unbounded, Bound::Included(end))`. #[stable(feature = "collections_range", since = "1.28.0")] impl RangeBounds for RangeToInclusive<&T> { fn start_bound(&self) -> Bound<&T> { diff --git a/library/core/src/ops/try_trait.rs b/library/core/src/ops/try_trait.rs index a889c824be53..76bf438878f0 100644 --- a/library/core/src/ops/try_trait.rs +++ b/library/core/src/ops/try_trait.rs @@ -130,7 +130,7 @@ use crate::ops::ControlFlow; #[lang = "Try"] #[const_trait] #[rustc_const_unstable(feature = "const_try", issue = "74935")] -pub trait Try: ~const FromResidual { +pub trait Try: [const] FromResidual { /// The type of the value produced by `?` when *not* short-circuiting. #[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")] type Output; diff --git a/library/core/src/option.rs b/library/core/src/option.rs index ed070fbd2274..560d20ce6179 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -651,7 +651,7 @@ impl Option { #[inline] #[stable(feature = "is_some_and", since = "1.70.0")] #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] - pub const fn is_some_and(self, f: impl ~const FnOnce(T) -> bool + ~const Destruct) -> bool { + pub const fn is_some_and(self, f: impl [const] FnOnce(T) -> bool + [const] Destruct) -> bool { match self { None => false, Some(x) => f(x), @@ -700,7 +700,7 @@ impl Option { #[inline] #[stable(feature = "is_none_or", since = "1.82.0")] #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] - pub const fn is_none_or(self, f: impl ~const FnOnce(T) -> bool + ~const Destruct) -> bool { + pub const fn is_none_or(self, f: impl [const] FnOnce(T) -> bool + [const] Destruct) -> bool { match self { None => true, Some(x) => f(x), @@ -1030,7 +1030,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn unwrap_or(self, default: T) -> T where - T: ~const Destruct, + T: [const] Destruct, { match self { Some(x) => x, @@ -1053,7 +1053,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn unwrap_or_else(self, f: F) -> T where - F: ~const FnOnce() -> T + ~const Destruct, + F: [const] FnOnce() -> T + [const] Destruct, { match self { Some(x) => x, @@ -1085,7 +1085,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn unwrap_or_default(self) -> T where - T: ~const Default, + T: [const] Default, { match self { Some(x) => x, @@ -1152,7 +1152,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map(self, f: F) -> Option where - F: ~const FnOnce(T) -> U + ~const Destruct, + F: [const] FnOnce(T) -> U + [const] Destruct, { match self { Some(x) => Some(f(x)), @@ -1183,7 +1183,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn inspect(self, f: F) -> Self where - F: ~const FnOnce(&T) + ~const Destruct, + F: [const] FnOnce(&T) + [const] Destruct, { if let Some(ref x) = self { f(x); @@ -1216,8 +1216,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map_or(self, default: U, f: F) -> U where - F: ~const FnOnce(T) -> U + ~const Destruct, - U: ~const Destruct, + F: [const] FnOnce(T) -> U + [const] Destruct, + U: [const] Destruct, { match self { Some(t) => f(t), @@ -1263,8 +1263,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map_or_else(self, default: D, f: F) -> U where - D: ~const FnOnce() -> U + ~const Destruct, - F: ~const FnOnce(T) -> U + ~const Destruct, + D: [const] FnOnce() -> U + [const] Destruct, + F: [const] FnOnce(T) -> U + [const] Destruct, { match self { Some(t) => f(t), @@ -1294,8 +1294,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn map_or_default(self, f: F) -> U where - U: ~const Default, - F: ~const FnOnce(T) -> U + ~const Destruct, + U: [const] Default, + F: [const] FnOnce(T) -> U + [const] Destruct, { match self { Some(t) => f(t), @@ -1327,7 +1327,7 @@ impl Option { #[inline] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] - pub const fn ok_or(self, err: E) -> Result { + pub const fn ok_or(self, err: E) -> Result { match self { Some(v) => Ok(v), None => Err(err), @@ -1355,7 +1355,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn ok_or_else(self, err: F) -> Result where - F: ~const FnOnce() -> E + ~const Destruct, + F: [const] FnOnce() -> E + [const] Destruct, { match self { Some(v) => Ok(v), @@ -1487,8 +1487,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn and(self, optb: Option) -> Option where - T: ~const Destruct, - U: ~const Destruct, + T: [const] Destruct, + U: [const] Destruct, { match self { Some(_) => optb, @@ -1531,7 +1531,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn and_then(self, f: F) -> Option where - F: ~const FnOnce(T) -> Option + ~const Destruct, + F: [const] FnOnce(T) -> Option + [const] Destruct, { match self { Some(x) => f(x), @@ -1568,8 +1568,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn filter

(self, predicate: P) -> Self where - P: ~const FnOnce(&T) -> bool + ~const Destruct, - T: ~const Destruct, + P: [const] FnOnce(&T) -> bool + [const] Destruct, + T: [const] Destruct, { if let Some(x) = self { if predicate(&x) { @@ -1611,7 +1611,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn or(self, optb: Option) -> Option where - T: ~const Destruct, + T: [const] Destruct, { match self { x @ Some(_) => x, @@ -1637,10 +1637,10 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn or_else(self, f: F) -> Option where - F: ~const FnOnce() -> Option + ~const Destruct, + F: [const] FnOnce() -> Option + [const] Destruct, //FIXME(const_hack): this `T: ~const Destruct` is unnecessary, but even precise live drops can't tell // no value of type `T` gets dropped here - T: ~const Destruct, + T: [const] Destruct, { match self { x @ Some(_) => x, @@ -1674,7 +1674,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn xor(self, optb: Option) -> Option where - T: ~const Destruct, + T: [const] Destruct, { match (self, optb) { (a @ Some(_), None) => a, @@ -1712,7 +1712,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn insert(&mut self, value: T) -> &mut T where - T: ~const Destruct, + T: [const] Destruct, { *self = Some(value); @@ -1768,7 +1768,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn get_or_insert_default(&mut self) -> &mut T where - T: ~const Default + ~const Destruct, + T: [const] Default + [const] Destruct, { self.get_or_insert_with(T::default) } @@ -1795,8 +1795,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn get_or_insert_with(&mut self, f: F) -> &mut T where - F: ~const FnOnce() -> T + ~const Destruct, - T: ~const Destruct, + F: [const] FnOnce() -> T + [const] Destruct, + T: [const] Destruct, { if let None = self { *self = Some(f()); @@ -1863,7 +1863,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn take_if

(&mut self, predicate: P) -> Option where - P: ~const FnOnce(&mut T) -> bool + ~const Destruct, + P: [const] FnOnce(&mut T) -> bool + [const] Destruct, { if self.as_mut().map_or(false, predicate) { self.take() } else { None } } @@ -1911,8 +1911,8 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn zip(self, other: Option) -> Option<(T, U)> where - T: ~const Destruct, - U: ~const Destruct, + T: [const] Destruct, + U: [const] Destruct, { match (self, other) { (Some(a), Some(b)) => Some((a, b)), @@ -1952,9 +1952,9 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn zip_with(self, other: Option, f: F) -> Option where - F: ~const FnOnce(T, U) -> R + ~const Destruct, - T: ~const Destruct, - U: ~const Destruct, + F: [const] FnOnce(T, U) -> R + [const] Destruct, + T: [const] Destruct, + U: [const] Destruct, { match (self, other) { (Some(a), Some(b)) => Some(f(a, b)), @@ -2149,7 +2149,7 @@ impl const Clone for Option where // FIXME(const_hack): the T: ~const Destruct should be inferred from the Self: ~const Destruct in clone_from. // See https://github.com/rust-lang/rust/issues/144207 - T: ~const Clone + ~const Destruct, + T: [const] Clone + [const] Destruct, { #[inline] fn clone(&self) -> Self { @@ -2307,7 +2307,7 @@ impl<'a, T> const From<&'a mut Option> for Option<&'a mut T> { impl crate::marker::StructuralPartialEq for Option {} #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] -impl const PartialEq for Option { +impl const PartialEq for Option { #[inline] fn eq(&self, other: &Self) -> bool { // Spelling out the cases explicitly optimizes better than diff --git a/library/core/src/panic/location.rs b/library/core/src/panic/location.rs index 972270208852..6ef7d5a22a30 100644 --- a/library/core/src/panic/location.rs +++ b/library/core/src/panic/location.rs @@ -1,5 +1,7 @@ +use crate::cmp::Ordering; use crate::ffi::CStr; use crate::fmt; +use crate::hash::{Hash, Hasher}; use crate::marker::PhantomData; use crate::ptr::NonNull; @@ -32,7 +34,7 @@ use crate::ptr::NonNull; /// Files are compared as strings, not `Path`, which could be unexpected. /// See [`Location::file`]'s documentation for more discussion. #[lang = "panic_location"] -#[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] +#[derive(Copy, Clone)] #[stable(feature = "panic_hooks", since = "1.10.0")] pub struct Location<'a> { // A raw pointer is used rather than a reference because the pointer is valid for one more byte @@ -44,6 +46,44 @@ pub struct Location<'a> { _filename: PhantomData<&'a str>, } +#[stable(feature = "panic_hooks", since = "1.10.0")] +impl PartialEq for Location<'_> { + fn eq(&self, other: &Self) -> bool { + // Compare col / line first as they're cheaper to compare and more likely to differ, + // while not impacting the result. + self.col == other.col && self.line == other.line && self.file() == other.file() + } +} + +#[stable(feature = "panic_hooks", since = "1.10.0")] +impl Eq for Location<'_> {} + +#[stable(feature = "panic_hooks", since = "1.10.0")] +impl Ord for Location<'_> { + fn cmp(&self, other: &Self) -> Ordering { + self.file() + .cmp(other.file()) + .then_with(|| self.line.cmp(&other.line)) + .then_with(|| self.col.cmp(&other.col)) + } +} + +#[stable(feature = "panic_hooks", since = "1.10.0")] +impl PartialOrd for Location<'_> { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +#[stable(feature = "panic_hooks", since = "1.10.0")] +impl Hash for Location<'_> { + fn hash(&self, state: &mut H) { + self.file().hash(state); + self.line.hash(state); + self.col.hash(state); + } +} + #[stable(feature = "panic_hooks", since = "1.10.0")] impl fmt::Debug for Location<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 9a1ba7d1728c..1c824e336bed 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -271,6 +271,7 @@ mod prim_bool {} /// When the compiler sees a value of type `!` in a [coercion site], it implicitly inserts a /// coercion to allow the type checker to infer any type: /// +// FIXME: use `core::convert::absurd` here instead, once it's merged /// ```rust,ignore (illustrative-and-has-placeholders) /// // this /// let x: u8 = panic!(); @@ -281,7 +282,6 @@ mod prim_bool {} /// // where absurd is a function with the following signature /// // (it's sound, because `!` always marks unreachable code): /// fn absurd(_: !) -> T { ... } -// FIXME: use `core::convert::absurd` here instead, once it's merged /// ``` /// /// This can lead to compilation errors if the type cannot be inferred: diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs index bd5b4e21baa0..402634e49b37 100644 --- a/library/core/src/ptr/alignment.rs +++ b/library/core/src/ptr/alignment.rs @@ -1,3 +1,5 @@ +#![allow(clippy::enum_clike_unportable_variant)] + use crate::num::NonZero; use crate::ub_checks::assert_unsafe_precondition; use crate::{cmp, fmt, hash, mem, num}; @@ -241,7 +243,7 @@ impl const Default for Alignment { #[cfg(target_pointer_width = "16")] #[derive(Copy, Clone, PartialEq, Eq)] -#[repr(u16)] +#[repr(usize)] enum AlignmentEnum { _Align1Shl0 = 1 << 0, _Align1Shl1 = 1 << 1, @@ -263,7 +265,7 @@ enum AlignmentEnum { #[cfg(target_pointer_width = "32")] #[derive(Copy, Clone, PartialEq, Eq)] -#[repr(u32)] +#[repr(usize)] enum AlignmentEnum { _Align1Shl0 = 1 << 0, _Align1Shl1 = 1 << 1, @@ -301,7 +303,7 @@ enum AlignmentEnum { #[cfg(target_pointer_width = "64")] #[derive(Copy, Clone, PartialEq, Eq)] -#[repr(u64)] +#[repr(usize)] enum AlignmentEnum { _Align1Shl0 = 1 << 0, _Align1Shl1 = 1 << 1, diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 2ad520b7ead7..8b3703bd4b32 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -1528,7 +1528,7 @@ impl *const [T] { #[inline] pub const unsafe fn get_unchecked(self, index: I) -> *const I::Output where - I: ~const SliceIndex<[T]>, + I: [const] SliceIndex<[T]>, { // SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds. unsafe { index.get_unchecked(self) } diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index dbe3999b4a43..1a2a5182567b 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -974,9 +974,10 @@ pub const fn dangling_mut() -> *mut T { #[must_use] #[inline(always)] #[stable(feature = "exposed_provenance", since = "1.84.0")] +#[rustc_const_unstable(feature = "const_exposed_provenance", issue = "144538")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[allow(fuzzy_provenance_casts)] // this *is* the explicit provenance API one should use instead -pub fn with_exposed_provenance(addr: usize) -> *const T { +pub const fn with_exposed_provenance(addr: usize) -> *const T { addr as *const T } @@ -1014,9 +1015,10 @@ pub fn with_exposed_provenance(addr: usize) -> *const T { #[must_use] #[inline(always)] #[stable(feature = "exposed_provenance", since = "1.84.0")] +#[rustc_const_unstable(feature = "const_exposed_provenance", issue = "144538")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[allow(fuzzy_provenance_casts)] // this *is* the explicit provenance API one should use instead -pub fn with_exposed_provenance_mut(addr: usize) -> *mut T { +pub const fn with_exposed_provenance_mut(addr: usize) -> *mut T { addr as *mut T } diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 579e2461103d..af39ec86d7ac 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -1885,7 +1885,7 @@ impl *mut [T] { #[inline(always)] pub const unsafe fn get_unchecked_mut(self, index: I) -> *mut I::Output where - I: ~const SliceIndex<[T]>, + I: [const] SliceIndex<[T]>, { // SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds. unsafe { index.get_unchecked_mut(self) } diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 62da6567cca7..8667361fecc7 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -1601,7 +1601,7 @@ impl NonNull<[T]> { #[inline] pub const unsafe fn get_unchecked_mut(self, index: I) -> NonNull where - I: ~const SliceIndex<[T]>, + I: [const] SliceIndex<[T]>, { // SAFETY: the caller ensures that `self` is dereferenceable and `index` in-bounds. // As a consequence, the resulting pointer cannot be null. diff --git a/library/core/src/range.rs b/library/core/src/range.rs index 5cd7956291ca..7158fa0fcf06 100644 --- a/library/core/src/range.rs +++ b/library/core/src/range.rs @@ -167,6 +167,12 @@ impl RangeBounds for Range { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `start..end` with `(Bound::Included(start), Bound::Excluded(end))`. #[unstable(feature = "new_range_api", issue = "125687")] impl RangeBounds for Range<&T> { fn start_bound(&self) -> Bound<&T> { @@ -346,6 +352,12 @@ impl RangeBounds for RangeInclusive { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `start..=end` with `(Bound::Included(start), Bound::Included(end))`. #[unstable(feature = "new_range_api", issue = "125687")] impl RangeBounds for RangeInclusive<&T> { fn start_bound(&self) -> Bound<&T> { @@ -491,6 +503,12 @@ impl RangeBounds for RangeFrom { } } +// This impl intentionally does not have `T: ?Sized`; +// see https://github.com/rust-lang/rust/pull/61584 for discussion of why. +// +/// If you need to use this implementation where `T` is unsized, +/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound], +/// i.e. replace `start..` with `(Bound::Included(start), Bound::Unbounded)`. #[unstable(feature = "new_range_api", issue = "125687")] impl RangeBounds for RangeFrom<&T> { fn start_bound(&self) -> Bound<&T> { diff --git a/library/core/src/result.rs b/library/core/src/result.rs index f65257ff59b9..6148bdb866ad 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -534,6 +534,7 @@ #![stable(feature = "rust1", since = "1.0.0")] use crate::iter::{self, FusedIterator, TrustedLen}; +use crate::marker::Destruct; use crate::ops::{self, ControlFlow, Deref, DerefMut}; use crate::{convert, fmt, hint}; @@ -606,7 +607,13 @@ impl Result { #[must_use] #[inline] #[stable(feature = "is_some_and", since = "1.70.0")] - pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn is_ok_and(self, f: F) -> bool + where + F: [const] FnOnce(T) -> bool + [const] Destruct, + T: [const] Destruct, + E: [const] Destruct, + { match self { Err(_) => false, Ok(x) => f(x), @@ -655,7 +662,13 @@ impl Result { #[must_use] #[inline] #[stable(feature = "is_some_and", since = "1.70.0")] - pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn is_err_and(self, f: F) -> bool + where + F: [const] FnOnce(E) -> bool + [const] Destruct, + E: [const] Destruct, + T: [const] Destruct, + { match self { Ok(_) => false, Err(e) => f(e), @@ -682,8 +695,13 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] #[rustc_diagnostic_item = "result_ok_method"] - pub fn ok(self) -> Option { + pub const fn ok(self) -> Option + where + T: [const] Destruct, + E: [const] Destruct, + { match self { Ok(x) => Some(x), Err(_) => None, @@ -706,7 +724,12 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn err(self) -> Option { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn err(self) -> Option + where + T: [const] Destruct, + E: [const] Destruct, + { match self { Ok(_) => None, Err(x) => Some(x), @@ -796,7 +819,11 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn map U>(self, op: F) -> Result { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn map(self, op: F) -> Result + where + F: [const] FnOnce(T) -> U + [const] Destruct, + { match self { Ok(t) => Ok(op(t)), Err(e) => Err(e), @@ -823,8 +850,15 @@ impl Result { /// ``` #[inline] #[stable(feature = "result_map_or", since = "1.41.0")] + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] #[must_use = "if you don't need the returned value, use `if let` instead"] - pub fn map_or U>(self, default: U, f: F) -> U { + pub const fn map_or(self, default: U, f: F) -> U + where + F: [const] FnOnce(T) -> U + [const] Destruct, + T: [const] Destruct, + E: [const] Destruct, + U: [const] Destruct, + { match self { Ok(t) => f(t), Err(_) => default, @@ -851,7 +885,12 @@ impl Result { /// ``` #[inline] #[stable(feature = "result_map_or_else", since = "1.41.0")] - pub fn map_or_else U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn map_or_else(self, default: D, f: F) -> U + where + D: [const] FnOnce(E) -> U + [const] Destruct, + F: [const] FnOnce(T) -> U + [const] Destruct, + { match self { Ok(t) => f(t), Err(e) => default(e), @@ -877,10 +916,13 @@ impl Result { /// [default value]: Default::default #[inline] #[unstable(feature = "result_option_map_or_default", issue = "138099")] - pub fn map_or_default(self, f: F) -> U + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn map_or_default(self, f: F) -> U where - U: Default, - F: FnOnce(T) -> U, + F: [const] FnOnce(T) -> U + [const] Destruct, + U: [const] Default, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(t) => f(t), @@ -908,7 +950,11 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn map_err F>(self, op: O) -> Result { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn map_err(self, op: O) -> Result + where + O: [const] FnOnce(E) -> F + [const] Destruct, + { match self { Ok(t) => Ok(t), Err(e) => Err(op(e)), @@ -930,7 +976,11 @@ impl Result { /// ``` #[inline] #[stable(feature = "result_option_inspect", since = "1.76.0")] - pub fn inspect(self, f: F) -> Self { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn inspect(self, f: F) -> Self + where + F: [const] FnOnce(&T) + [const] Destruct, + { if let Ok(ref t) = self { f(t); } @@ -954,7 +1004,11 @@ impl Result { /// ``` #[inline] #[stable(feature = "result_option_inspect", since = "1.76.0")] - pub fn inspect_err(self, f: F) -> Self { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn inspect_err(self, f: F) -> Self + where + F: [const] FnOnce(&E) + [const] Destruct, + { if let Err(ref e) = self { f(e); } @@ -1033,7 +1087,8 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter(&self) -> Iter<'_, T> { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn iter(&self) -> Iter<'_, T> { Iter { inner: self.as_ref().ok() } } @@ -1056,7 +1111,8 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn iter_mut(&mut self) -> IterMut<'_, T> { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn iter_mut(&mut self) -> IterMut<'_, T> { IterMut { inner: self.as_mut().ok() } } @@ -1195,9 +1251,11 @@ impl Result { /// [`FromStr`]: crate::str::FromStr #[inline] #[stable(feature = "result_unwrap_or_default", since = "1.16.0")] - pub fn unwrap_or_default(self) -> T + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn unwrap_or_default(self) -> T where - T: Default, + T: [const] Default + [const] Destruct, + E: [const] Destruct, { match self { Ok(x) => x, @@ -1292,7 +1350,7 @@ impl Result { #[rustc_const_unstable(feature = "const_try", issue = "74935")] pub const fn into_ok(self) -> T where - E: ~const Into, + E: [const] Into, { match self { Ok(x) => x, @@ -1329,7 +1387,7 @@ impl Result { #[rustc_const_unstable(feature = "const_try", issue = "74935")] pub const fn into_err(self) -> E where - T: ~const Into, + T: [const] Into, { match self { Ok(x) => x.into(), @@ -1370,7 +1428,13 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn and(self, res: Result) -> Result { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn and(self, res: Result) -> Result + where + T: [const] Destruct, + E: [const] Destruct, + U: [const] Destruct, + { match self { Ok(_) => res, Err(e) => Err(e), @@ -1409,8 +1473,12 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] #[rustc_confusables("flat_map", "flatmap")] - pub fn and_then Result>(self, op: F) -> Result { + pub const fn and_then(self, op: F) -> Result + where + F: [const] FnOnce(T) -> Result + [const] Destruct, + { match self { Ok(t) => op(t), Err(e) => Err(e), @@ -1446,7 +1514,13 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn or(self, res: Result) -> Result { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn or(self, res: Result) -> Result + where + T: [const] Destruct, + E: [const] Destruct, + F: [const] Destruct, + { match self { Ok(v) => Ok(v), Err(_) => res, @@ -1471,7 +1545,11 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn or_else Result>(self, op: O) -> Result { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn or_else(self, op: O) -> Result + where + O: [const] FnOnce(E) -> Result + [const] Destruct, + { match self { Ok(t) => Ok(t), Err(e) => op(e), @@ -1498,7 +1576,12 @@ impl Result { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn unwrap_or(self, default: T) -> T { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn unwrap_or(self, default: T) -> T + where + T: [const] Destruct, + E: [const] Destruct, + { match self { Ok(t) => t, Err(_) => default, @@ -1519,7 +1602,11 @@ impl Result { #[inline] #[track_caller] #[stable(feature = "rust1", since = "1.0.0")] - pub fn unwrap_or_else T>(self, op: F) -> T { + #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] + pub const fn unwrap_or_else(self, op: F) -> T + where + F: [const] FnOnce(E) -> T + [const] Destruct, + { match self { Ok(t) => t, Err(e) => op(e), @@ -1544,7 +1631,7 @@ impl Result { /// /// ```no_run /// let x: Result = Err("emergency failure"); - /// unsafe { x.unwrap_unchecked(); } // Undefined behavior! + /// unsafe { x.unwrap_unchecked() }; // Undefined behavior! /// ``` #[inline] #[track_caller] @@ -1762,7 +1849,7 @@ impl Result, E> { #[cold] #[track_caller] fn unwrap_failed(msg: &str, error: &dyn fmt::Debug) -> ! { - panic!("{msg}: {error:?}") + panic!("{msg}: {error:?}"); } // This is a separate function to avoid constructing a `dyn Debug` @@ -1773,7 +1860,7 @@ fn unwrap_failed(msg: &str, error: &dyn fmt::Debug) -> ! { #[inline] #[cold] #[track_caller] -fn unwrap_failed(_msg: &str, _error: &T) -> ! { +const fn unwrap_failed(_msg: &str, _error: &T) -> ! { panic!() } @@ -2077,7 +2164,7 @@ impl const ops::Try for Result { #[unstable(feature = "try_trait_v2", issue = "84277", old_name = "try_trait")] #[rustc_const_unstable(feature = "const_try", issue = "74935")] -impl> const ops::FromResidual> +impl> const ops::FromResidual> for Result { #[inline] @@ -2091,7 +2178,7 @@ impl> const ops::FromResidual> const ops::FromResidual> for Result { +impl> const ops::FromResidual> for Result { #[inline] fn from_residual(ops::Yeet(e): ops::Yeet) -> Self { Err(From::from(e)) diff --git a/library/core/src/slice/cmp.rs b/library/core/src/slice/cmp.rs index 1eda8bc1bec4..68bd12aa7bf2 100644 --- a/library/core/src/slice/cmp.rs +++ b/library/core/src/slice/cmp.rs @@ -11,7 +11,7 @@ use crate::ops::ControlFlow; #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<[U]> for [T] where - T: ~const PartialEq, + T: [const] PartialEq, { fn eq(&self, other: &[U]) -> bool { SlicePartialEq::equal(self, other) @@ -109,7 +109,7 @@ trait SlicePartialEq { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const SlicePartialEq for [A] where - A: ~const PartialEq, + A: [const] PartialEq, { default fn equal(&self, other: &[B]) -> bool { if self.len() != other.len() { @@ -138,7 +138,7 @@ where #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const SlicePartialEq for [A] where - A: ~const BytewiseEq, + A: [const] BytewiseEq, { fn equal(&self, other: &[B]) -> bool { if self.len() != other.len() { diff --git a/library/core/src/slice/index.rs b/library/core/src/slice/index.rs index 322b3580eded..ae360df80f60 100644 --- a/library/core/src/slice/index.rs +++ b/library/core/src/slice/index.rs @@ -9,7 +9,7 @@ use crate::{ops, range}; #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const ops::Index for [T] where - I: ~const SliceIndex<[T]>, + I: [const] SliceIndex<[T]>, { type Output = I::Output; @@ -23,7 +23,7 @@ where #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const ops::IndexMut for [T] where - I: ~const SliceIndex<[T]>, + I: [const] SliceIndex<[T]>, { #[inline(always)] fn index_mut(&mut self, index: I) -> &mut I::Output { diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index 33132dcc7148..ae910e052520 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -2301,255 +2301,6 @@ impl ExactSizeIterator for ArrayWindows<'_, T, N> { } } -/// An iterator over a slice in (non-overlapping) chunks (`N` elements at a -/// time), starting at the beginning of the slice. -/// -/// When the slice len is not evenly divided by the chunk size, the last -/// up to `N-1` elements will be omitted but can be retrieved from -/// the [`remainder`] function from the iterator. -/// -/// This struct is created by the [`array_chunks`] method on [slices]. -/// -/// # Example -/// -/// ``` -/// #![feature(array_chunks)] -/// -/// let slice = ['l', 'o', 'r', 'e', 'm']; -/// let mut iter = slice.array_chunks::<2>(); -/// assert_eq!(iter.next(), Some(&['l', 'o'])); -/// assert_eq!(iter.next(), Some(&['r', 'e'])); -/// assert_eq!(iter.next(), None); -/// ``` -/// -/// [`array_chunks`]: slice::array_chunks -/// [`remainder`]: ArrayChunks::remainder -/// [slices]: slice -#[derive(Debug)] -#[unstable(feature = "array_chunks", issue = "74985")] -#[must_use = "iterators are lazy and do nothing unless consumed"] -pub struct ArrayChunks<'a, T: 'a, const N: usize> { - iter: Iter<'a, [T; N]>, - rem: &'a [T], -} - -impl<'a, T, const N: usize> ArrayChunks<'a, T, N> { - #[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")] - #[inline] - pub(super) const fn new(slice: &'a [T]) -> Self { - let (array_slice, rem) = slice.as_chunks(); - Self { iter: array_slice.iter(), rem } - } - - /// Returns the remainder of the original slice that is not going to be - /// returned by the iterator. The returned slice has at most `N-1` - /// elements. - #[must_use] - #[unstable(feature = "array_chunks", issue = "74985")] - pub fn remainder(&self) -> &'a [T] { - self.rem - } -} - -// FIXME(#26925) Remove in favor of `#[derive(Clone)]` -#[unstable(feature = "array_chunks", issue = "74985")] -impl Clone for ArrayChunks<'_, T, N> { - fn clone(&self) -> Self { - ArrayChunks { iter: self.iter.clone(), rem: self.rem } - } -} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl<'a, T, const N: usize> Iterator for ArrayChunks<'a, T, N> { - type Item = &'a [T; N]; - - #[inline] - fn next(&mut self) -> Option<&'a [T; N]> { - self.iter.next() - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } - - #[inline] - fn count(self) -> usize { - self.iter.count() - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - self.iter.nth(n) - } - - #[inline] - fn last(self) -> Option { - self.iter.last() - } - - unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> &'a [T; N] { - // SAFETY: The safety guarantees of `__iterator_get_unchecked` are - // transferred to the caller. - unsafe { self.iter.__iterator_get_unchecked(i) } - } -} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl<'a, T, const N: usize> DoubleEndedIterator for ArrayChunks<'a, T, N> { - #[inline] - fn next_back(&mut self) -> Option<&'a [T; N]> { - self.iter.next_back() - } - - #[inline] - fn nth_back(&mut self, n: usize) -> Option { - self.iter.nth_back(n) - } -} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl ExactSizeIterator for ArrayChunks<'_, T, N> { - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for ArrayChunks<'_, T, N> {} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl FusedIterator for ArrayChunks<'_, T, N> {} - -#[doc(hidden)] -#[unstable(feature = "array_chunks", issue = "74985")] -unsafe impl<'a, T, const N: usize> TrustedRandomAccess for ArrayChunks<'a, T, N> {} - -#[doc(hidden)] -#[unstable(feature = "array_chunks", issue = "74985")] -unsafe impl<'a, T, const N: usize> TrustedRandomAccessNoCoerce for ArrayChunks<'a, T, N> { - const MAY_HAVE_SIDE_EFFECT: bool = false; -} - -/// An iterator over a slice in (non-overlapping) mutable chunks (`N` elements -/// at a time), starting at the beginning of the slice. -/// -/// When the slice len is not evenly divided by the chunk size, the last -/// up to `N-1` elements will be omitted but can be retrieved from -/// the [`into_remainder`] function from the iterator. -/// -/// This struct is created by the [`array_chunks_mut`] method on [slices]. -/// -/// # Example -/// -/// ``` -/// #![feature(array_chunks)] -/// -/// let mut slice = ['l', 'o', 'r', 'e', 'm']; -/// let iter = slice.array_chunks_mut::<2>(); -/// ``` -/// -/// [`array_chunks_mut`]: slice::array_chunks_mut -/// [`into_remainder`]: ../../std/slice/struct.ArrayChunksMut.html#method.into_remainder -/// [slices]: slice -#[derive(Debug)] -#[unstable(feature = "array_chunks", issue = "74985")] -#[must_use = "iterators are lazy and do nothing unless consumed"] -pub struct ArrayChunksMut<'a, T: 'a, const N: usize> { - iter: IterMut<'a, [T; N]>, - rem: &'a mut [T], -} - -impl<'a, T, const N: usize> ArrayChunksMut<'a, T, N> { - #[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")] - #[inline] - pub(super) const fn new(slice: &'a mut [T]) -> Self { - let (array_slice, rem) = slice.as_chunks_mut(); - Self { iter: array_slice.iter_mut(), rem } - } - - /// Returns the remainder of the original slice that is not going to be - /// returned by the iterator. The returned slice has at most `N-1` - /// elements. - #[must_use = "`self` will be dropped if the result is not used"] - #[unstable(feature = "array_chunks", issue = "74985")] - pub fn into_remainder(self) -> &'a mut [T] { - self.rem - } -} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl<'a, T, const N: usize> Iterator for ArrayChunksMut<'a, T, N> { - type Item = &'a mut [T; N]; - - #[inline] - fn next(&mut self) -> Option<&'a mut [T; N]> { - self.iter.next() - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } - - #[inline] - fn count(self) -> usize { - self.iter.count() - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - self.iter.nth(n) - } - - #[inline] - fn last(self) -> Option { - self.iter.last() - } - - unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> &'a mut [T; N] { - // SAFETY: The safety guarantees of `__iterator_get_unchecked` are transferred to - // the caller. - unsafe { self.iter.__iterator_get_unchecked(i) } - } -} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl<'a, T, const N: usize> DoubleEndedIterator for ArrayChunksMut<'a, T, N> { - #[inline] - fn next_back(&mut self) -> Option<&'a mut [T; N]> { - self.iter.next_back() - } - - #[inline] - fn nth_back(&mut self, n: usize) -> Option { - self.iter.nth_back(n) - } -} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl ExactSizeIterator for ArrayChunksMut<'_, T, N> { - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for ArrayChunksMut<'_, T, N> {} - -#[unstable(feature = "array_chunks", issue = "74985")] -impl FusedIterator for ArrayChunksMut<'_, T, N> {} - -#[doc(hidden)] -#[unstable(feature = "array_chunks", issue = "74985")] -unsafe impl<'a, T, const N: usize> TrustedRandomAccess for ArrayChunksMut<'a, T, N> {} - -#[doc(hidden)] -#[unstable(feature = "array_chunks", issue = "74985")] -unsafe impl<'a, T, const N: usize> TrustedRandomAccessNoCoerce for ArrayChunksMut<'a, T, N> { - const MAY_HAVE_SIDE_EFFECT: bool = false; -} - /// An iterator over a slice in (non-overlapping) chunks (`chunk_size` elements at a /// time), starting at the end of the slice. /// diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 6fe5affc48be..64f5b5dd8313 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -52,8 +52,6 @@ pub use index::SliceIndex; pub use index::{range, try_range}; #[unstable(feature = "array_windows", issue = "75027")] pub use iter::ArrayWindows; -#[unstable(feature = "array_chunks", issue = "74985")] -pub use iter::{ArrayChunks, ArrayChunksMut}; #[stable(feature = "slice_group_by", since = "1.77.0")] pub use iter::{ChunkBy, ChunkByMut}; #[stable(feature = "rust1", since = "1.0.0")] @@ -571,7 +569,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const fn get(&self, index: I) -> Option<&I::Output> where - I: ~const SliceIndex, + I: [const] SliceIndex, { index.get(self) } @@ -598,7 +596,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const fn get_mut(&mut self, index: I) -> Option<&mut I::Output> where - I: ~const SliceIndex, + I: [const] SliceIndex, { index.get_mut(self) } @@ -638,7 +636,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const unsafe fn get_unchecked(&self, index: I) -> &I::Output where - I: ~const SliceIndex, + I: [const] SliceIndex, { // SAFETY: the caller must uphold most of the safety requirements for `get_unchecked`; // the slice is dereferenceable because `self` is a safe reference. @@ -683,7 +681,7 @@ impl [T] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] pub const unsafe fn get_unchecked_mut(&mut self, index: I) -> &mut I::Output where - I: ~const SliceIndex, + I: [const] SliceIndex, { // SAFETY: the caller must uphold the safety requirements for `get_unchecked_mut`; // the slice is dereferenceable because `self` is a safe reference. @@ -971,7 +969,7 @@ impl [T] { /// assert!(v == [3, 2, 1]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_slice_reverse", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_slice_reverse", since = "1.90.0")] #[inline] pub const fn reverse(&mut self) { let half_len = self.len() / 2; @@ -1232,7 +1230,7 @@ impl [T] { /// /// [`chunks`]: slice::chunks /// [`rchunks_exact`]: slice::rchunks_exact - /// [`as_chunks`]: slice::chunks + /// [`as_chunks`]: slice::as_chunks #[stable(feature = "chunks_exact", since = "1.31.0")] #[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")] #[inline] @@ -1448,42 +1446,6 @@ impl [T] { (remainder, array_slice) } - /// Returns an iterator over `N` elements of the slice at a time, starting at the - /// beginning of the slice. - /// - /// The chunks are array references and do not overlap. If `N` does not divide the - /// length of the slice, then the last up to `N-1` elements will be omitted and can be - /// retrieved from the `remainder` function of the iterator. - /// - /// This method is the const generic equivalent of [`chunks_exact`]. - /// - /// # Panics - /// - /// Panics if `N` is zero. This check will most probably get changed to a compile time - /// error before this method gets stabilized. - /// - /// # Examples - /// - /// ``` - /// #![feature(array_chunks)] - /// let slice = ['l', 'o', 'r', 'e', 'm']; - /// let mut iter = slice.array_chunks(); - /// assert_eq!(iter.next().unwrap(), &['l', 'o']); - /// assert_eq!(iter.next().unwrap(), &['r', 'e']); - /// assert!(iter.next().is_none()); - /// assert_eq!(iter.remainder(), &['m']); - /// ``` - /// - /// [`chunks_exact`]: slice::chunks_exact - #[unstable(feature = "array_chunks", issue = "74985")] - #[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")] - #[inline] - #[track_caller] - pub const fn array_chunks(&self) -> ArrayChunks<'_, T, N> { - assert!(N != 0, "chunk size must be non-zero"); - ArrayChunks::new(self) - } - /// Splits the slice into a slice of `N`-element arrays, /// assuming that there's no remainder. /// @@ -1646,44 +1608,6 @@ impl [T] { (remainder, array_slice) } - /// Returns an iterator over `N` elements of the slice at a time, starting at the - /// beginning of the slice. - /// - /// The chunks are mutable array references and do not overlap. If `N` does not divide - /// the length of the slice, then the last up to `N-1` elements will be omitted and - /// can be retrieved from the `into_remainder` function of the iterator. - /// - /// This method is the const generic equivalent of [`chunks_exact_mut`]. - /// - /// # Panics - /// - /// Panics if `N` is zero. This check will most probably get changed to a compile time - /// error before this method gets stabilized. - /// - /// # Examples - /// - /// ``` - /// #![feature(array_chunks)] - /// let v = &mut [0, 0, 0, 0, 0]; - /// let mut count = 1; - /// - /// for chunk in v.array_chunks_mut() { - /// *chunk = [count; 2]; - /// count += 1; - /// } - /// assert_eq!(v, &[1, 1, 2, 2, 0]); - /// ``` - /// - /// [`chunks_exact_mut`]: slice::chunks_exact_mut - #[unstable(feature = "array_chunks", issue = "74985")] - #[rustc_const_unstable(feature = "const_slice_make_iter", issue = "137737")] - #[inline] - #[track_caller] - pub const fn array_chunks_mut(&mut self) -> ArrayChunksMut<'_, T, N> { - assert!(N != 0, "chunk size must be non-zero"); - ArrayChunksMut::new(self) - } - /// Returns an iterator over overlapping windows of `N` elements of a slice, /// starting at the beginning of the slice. /// @@ -4050,8 +3974,9 @@ impl [T] { /// /// [`split_at_mut`]: slice::split_at_mut #[stable(feature = "swap_with_slice", since = "1.27.0")] + #[rustc_const_unstable(feature = "const_swap_with_slice", issue = "142204")] #[track_caller] - pub fn swap_with_slice(&mut self, other: &mut [T]) { + pub const fn swap_with_slice(&mut self, other: &mut [T]) { assert!(self.len() == other.len(), "destination and source slices have different lengths"); // SAFETY: `self` is valid for `self.len()` elements by definition, and `src` was // checked to have the same length. The slices cannot overlap because diff --git a/library/core/src/str/iter.rs b/library/core/src/str/iter.rs index bcf886484add..d2985d8a1866 100644 --- a/library/core/src/str/iter.rs +++ b/library/core/src/str/iter.rs @@ -52,7 +52,7 @@ impl<'a> Iterator for Chars<'a> { const CHUNK_SIZE: usize = 32; if remainder >= CHUNK_SIZE { - let mut chunks = self.iter.as_slice().array_chunks::(); + let mut chunks = self.iter.as_slice().as_chunks::().0.iter(); let mut bytes_skipped: usize = 0; while remainder > CHUNK_SIZE diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 029abf175391..1b6e84175b93 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -407,17 +407,22 @@ impl str { /// ``` #[unstable(feature = "round_char_boundary", issue = "93743")] #[inline] - pub fn floor_char_boundary(&self, index: usize) -> usize { + pub const fn floor_char_boundary(&self, index: usize) -> usize { if index >= self.len() { self.len() } else { - let lower_bound = index.saturating_sub(3); - let new_index = self.as_bytes()[lower_bound..=index] - .iter() - .rposition(|b| b.is_utf8_char_boundary()); + let mut i = index; + while i > 0 { + if self.as_bytes()[i].is_utf8_char_boundary() { + break; + } + i -= 1; + } - // SAFETY: we know that the character boundary will be within four bytes - unsafe { lower_bound + new_index.unwrap_unchecked() } + // The character boundary will be within four bytes of the index + debug_assert!(i >= index.saturating_sub(3)); + + i } } @@ -445,15 +450,22 @@ impl str { /// ``` #[unstable(feature = "round_char_boundary", issue = "93743")] #[inline] - pub fn ceil_char_boundary(&self, index: usize) -> usize { + pub const fn ceil_char_boundary(&self, index: usize) -> usize { if index >= self.len() { self.len() } else { - let upper_bound = Ord::min(index + 4, self.len()); - self.as_bytes()[index..upper_bound] - .iter() - .position(|b| b.is_utf8_char_boundary()) - .map_or(upper_bound, |pos| pos + index) + let mut i = index; + while i < self.len() { + if self.as_bytes()[i].is_utf8_char_boundary() { + break; + } + i += 1; + } + + // The character boundary will be within four bytes of the index + debug_assert!(i <= index + 3); + + i } } @@ -591,7 +603,7 @@ impl str { #[stable(feature = "str_checked_slicing", since = "1.20.0")] #[rustc_const_unstable(feature = "const_index", issue = "143775")] #[inline] - pub const fn get>(&self, i: I) -> Option<&I::Output> { + pub const fn get>(&self, i: I) -> Option<&I::Output> { i.get(self) } @@ -624,7 +636,7 @@ impl str { #[stable(feature = "str_checked_slicing", since = "1.20.0")] #[rustc_const_unstable(feature = "const_index", issue = "143775")] #[inline] - pub const fn get_mut>(&mut self, i: I) -> Option<&mut I::Output> { + pub const fn get_mut>(&mut self, i: I) -> Option<&mut I::Output> { i.get_mut(self) } diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs index bcbbb11c83b2..e116b1383832 100644 --- a/library/core/src/str/pattern.rs +++ b/library/core/src/str/pattern.rs @@ -996,7 +996,10 @@ impl<'b> Pattern for &'b str { return haystack.as_bytes().contains(&self.as_bytes()[0]); } - #[cfg(all(target_arch = "x86_64", target_feature = "sse2"))] + #[cfg(any( + all(target_arch = "x86_64", target_feature = "sse2"), + all(target_arch = "loongarch64", target_feature = "lsx") + ))] if self.len() <= 32 { if let Some(result) = simd_contains(self, haystack) { return result; @@ -1770,11 +1773,18 @@ impl TwoWayStrategy for RejectAndMatch { /// If we ever ship std with for x86-64-v3 or adapt this for other platforms then wider vectors /// should be evaluated. /// +/// Similarly, on LoongArch the 128-bit LSX vector extension is the baseline, +/// so we also use `u8x16` there. Wider vector widths may be considered +/// for future LoongArch extensions (e.g., LASX). +/// /// For haystacks smaller than vector-size + needle length it falls back to /// a naive O(n*m) search so this implementation should not be called on larger needles. /// /// [0]: http://0x80.pl/articles/simd-strfind.html#sse-avx2 -#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))] +#[cfg(any( + all(target_arch = "x86_64", target_feature = "sse2"), + all(target_arch = "loongarch64", target_feature = "lsx") +))] #[inline] fn simd_contains(needle: &str, haystack: &str) -> Option { let needle = needle.as_bytes(); @@ -1906,7 +1916,10 @@ fn simd_contains(needle: &str, haystack: &str) -> Option { /// # Safety /// /// Both slices must have the same length. -#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))] // only called on x86 +#[cfg(any( + all(target_arch = "x86_64", target_feature = "sse2"), + all(target_arch = "loongarch64", target_feature = "lsx") +))] #[inline] unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool { debug_assert_eq!(x.len(), y.len()); diff --git a/library/core/src/str/traits.rs b/library/core/src/str/traits.rs index 1597d1c1fa86..dc88f35eca7e 100644 --- a/library/core/src/str/traits.rs +++ b/library/core/src/str/traits.rs @@ -53,7 +53,7 @@ impl PartialOrd for str { #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const ops::Index for str where - I: ~const SliceIndex, + I: [const] SliceIndex, { type Output = I::Output; @@ -67,7 +67,7 @@ where #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const ops::IndexMut for str where - I: ~const SliceIndex, + I: [const] SliceIndex, { #[inline] fn index_mut(&mut self, index: I) -> &mut I::Output { diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 546f3d91a809..44a6895f90ac 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -563,8 +563,8 @@ impl AtomicBool { /// `align_of::() == 1`). /// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`. /// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not - /// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes, - /// without synchronization. + /// allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different + /// sizes, without synchronization. /// /// [valid]: crate::ptr#safety /// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses @@ -1245,8 +1245,8 @@ impl AtomicBool { /// Returning an `*mut` pointer from a shared reference to this atomic is safe because the /// atomic types work with interior mutability. All modifications of an atomic change the value /// through a shared reference, and can do so safely as long as they use atomic operations. Any - /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same - /// restriction: operations on it must be atomic. + /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the + /// requirements of the [memory model]. /// /// # Examples /// @@ -1264,6 +1264,8 @@ impl AtomicBool { /// } /// # } /// ``` + /// + /// [memory model]: self#memory-model-for-atomic-accesses #[inline] #[stable(feature = "atomic_as_ptr", since = "1.70.0")] #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] @@ -1519,8 +1521,8 @@ impl AtomicPtr { /// can be bigger than `align_of::<*mut T>()`). /// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`. /// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not - /// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes, - /// without synchronization. + /// allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different + /// sizes, without synchronization. /// /// [valid]: crate::ptr#safety /// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses @@ -2291,7 +2293,7 @@ impl AtomicPtr { #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn fetch_byte_add(&self, val: usize, order: Ordering) -> *mut T { // SAFETY: data races are prevented by atomic intrinsics. - unsafe { atomic_add(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } + unsafe { atomic_add(self.p.get(), val, order).cast() } } /// Offsets the pointer's address by subtracting `val` *bytes*, returning the @@ -2316,9 +2318,10 @@ impl AtomicPtr { /// #![feature(strict_provenance_atomic_ptr)] /// use core::sync::atomic::{AtomicPtr, Ordering}; /// - /// let atom = AtomicPtr::::new(core::ptr::without_provenance_mut(1)); - /// assert_eq!(atom.fetch_byte_sub(1, Ordering::Relaxed).addr(), 1); - /// assert_eq!(atom.load(Ordering::Relaxed).addr(), 0); + /// let mut arr = [0i64, 1]; + /// let atom = AtomicPtr::::new(&raw mut arr[1]); + /// assert_eq!(atom.fetch_byte_sub(8, Ordering::Relaxed).addr(), (&raw const arr[1]).addr()); + /// assert_eq!(atom.load(Ordering::Relaxed).addr(), (&raw const arr[0]).addr()); /// ``` #[inline] #[cfg(target_has_atomic = "ptr")] @@ -2326,7 +2329,7 @@ impl AtomicPtr { #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn fetch_byte_sub(&self, val: usize, order: Ordering) -> *mut T { // SAFETY: data races are prevented by atomic intrinsics. - unsafe { atomic_sub(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } + unsafe { atomic_sub(self.p.get(), val, order).cast() } } /// Performs a bitwise "or" operation on the address of the current pointer, @@ -2377,7 +2380,7 @@ impl AtomicPtr { #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn fetch_or(&self, val: usize, order: Ordering) -> *mut T { // SAFETY: data races are prevented by atomic intrinsics. - unsafe { atomic_or(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } + unsafe { atomic_or(self.p.get(), val, order).cast() } } /// Performs a bitwise "and" operation on the address of the current @@ -2427,7 +2430,7 @@ impl AtomicPtr { #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn fetch_and(&self, val: usize, order: Ordering) -> *mut T { // SAFETY: data races are prevented by atomic intrinsics. - unsafe { atomic_and(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } + unsafe { atomic_and(self.p.get(), val, order).cast() } } /// Performs a bitwise "xor" operation on the address of the current @@ -2475,7 +2478,7 @@ impl AtomicPtr { #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn fetch_xor(&self, val: usize, order: Ordering) -> *mut T { // SAFETY: data races are prevented by atomic intrinsics. - unsafe { atomic_xor(self.p.get(), core::ptr::without_provenance_mut(val), order).cast() } + unsafe { atomic_xor(self.p.get(), val, order).cast() } } /// Returns a mutable pointer to the underlying pointer. @@ -2487,8 +2490,8 @@ impl AtomicPtr { /// Returning an `*mut` pointer from a shared reference to this atomic is safe because the /// atomic types work with interior mutability. All modifications of an atomic change the value /// through a shared reference, and can do so safely as long as they use atomic operations. Any - /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same - /// restriction: operations on it must be atomic. + /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the + /// requirements of the [memory model]. /// /// # Examples /// @@ -2507,6 +2510,8 @@ impl AtomicPtr { /// my_atomic_op(atomic.as_ptr()); /// } /// ``` + /// + /// [memory model]: self#memory-model-for-atomic-accesses #[inline] #[stable(feature = "atomic_as_ptr", since = "1.70.0")] #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] @@ -2698,8 +2703,8 @@ macro_rules! atomic_int { }] /// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`. /// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not - /// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes, - /// without synchronization. + /// allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different + /// sizes, without synchronization. /// /// [valid]: crate::ptr#safety /// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses @@ -3619,8 +3624,8 @@ macro_rules! atomic_int { /// Returning an `*mut` pointer from a shared reference to this atomic is safe because the /// atomic types work with interior mutability. All modifications of an atomic change the value /// through a shared reference, and can do so safely as long as they use atomic operations. Any - /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the same - /// restriction: operations on it must be atomic. + /// use of the returned raw pointer requires an `unsafe` block and still has to uphold the + /// requirements of the [memory model]. /// /// # Examples /// @@ -3640,6 +3645,8 @@ macro_rules! atomic_int { /// } /// # } /// ``` + /// + /// [memory model]: self#memory-model-for-atomic-accesses #[inline] #[stable(feature = "atomic_as_ptr", since = "1.70.0")] #[rustc_const_stable(feature = "atomic_as_ptr", since = "1.70.0")] @@ -3975,15 +3982,15 @@ unsafe fn atomic_swap(dst: *mut T, val: T, order: Ordering) -> T { #[inline] #[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces -unsafe fn atomic_add(dst: *mut T, val: T, order: Ordering) -> T { +unsafe fn atomic_add(dst: *mut T, val: U, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_add`. unsafe { match order { - Relaxed => intrinsics::atomic_xadd::(dst, val), - Acquire => intrinsics::atomic_xadd::(dst, val), - Release => intrinsics::atomic_xadd::(dst, val), - AcqRel => intrinsics::atomic_xadd::(dst, val), - SeqCst => intrinsics::atomic_xadd::(dst, val), + Relaxed => intrinsics::atomic_xadd::(dst, val), + Acquire => intrinsics::atomic_xadd::(dst, val), + Release => intrinsics::atomic_xadd::(dst, val), + AcqRel => intrinsics::atomic_xadd::(dst, val), + SeqCst => intrinsics::atomic_xadd::(dst, val), } } } @@ -3992,15 +3999,15 @@ unsafe fn atomic_add(dst: *mut T, val: T, order: Ordering) -> T { #[inline] #[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces -unsafe fn atomic_sub(dst: *mut T, val: T, order: Ordering) -> T { +unsafe fn atomic_sub(dst: *mut T, val: U, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_sub`. unsafe { match order { - Relaxed => intrinsics::atomic_xsub::(dst, val), - Acquire => intrinsics::atomic_xsub::(dst, val), - Release => intrinsics::atomic_xsub::(dst, val), - AcqRel => intrinsics::atomic_xsub::(dst, val), - SeqCst => intrinsics::atomic_xsub::(dst, val), + Relaxed => intrinsics::atomic_xsub::(dst, val), + Acquire => intrinsics::atomic_xsub::(dst, val), + Release => intrinsics::atomic_xsub::(dst, val), + AcqRel => intrinsics::atomic_xsub::(dst, val), + SeqCst => intrinsics::atomic_xsub::(dst, val), } } } @@ -4141,15 +4148,15 @@ unsafe fn atomic_compare_exchange_weak( #[inline] #[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces -unsafe fn atomic_and(dst: *mut T, val: T, order: Ordering) -> T { +unsafe fn atomic_and(dst: *mut T, val: U, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_and` unsafe { match order { - Relaxed => intrinsics::atomic_and::(dst, val), - Acquire => intrinsics::atomic_and::(dst, val), - Release => intrinsics::atomic_and::(dst, val), - AcqRel => intrinsics::atomic_and::(dst, val), - SeqCst => intrinsics::atomic_and::(dst, val), + Relaxed => intrinsics::atomic_and::(dst, val), + Acquire => intrinsics::atomic_and::(dst, val), + Release => intrinsics::atomic_and::(dst, val), + AcqRel => intrinsics::atomic_and::(dst, val), + SeqCst => intrinsics::atomic_and::(dst, val), } } } @@ -4157,15 +4164,15 @@ unsafe fn atomic_and(dst: *mut T, val: T, order: Ordering) -> T { #[inline] #[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces -unsafe fn atomic_nand(dst: *mut T, val: T, order: Ordering) -> T { +unsafe fn atomic_nand(dst: *mut T, val: U, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_nand` unsafe { match order { - Relaxed => intrinsics::atomic_nand::(dst, val), - Acquire => intrinsics::atomic_nand::(dst, val), - Release => intrinsics::atomic_nand::(dst, val), - AcqRel => intrinsics::atomic_nand::(dst, val), - SeqCst => intrinsics::atomic_nand::(dst, val), + Relaxed => intrinsics::atomic_nand::(dst, val), + Acquire => intrinsics::atomic_nand::(dst, val), + Release => intrinsics::atomic_nand::(dst, val), + AcqRel => intrinsics::atomic_nand::(dst, val), + SeqCst => intrinsics::atomic_nand::(dst, val), } } } @@ -4173,15 +4180,15 @@ unsafe fn atomic_nand(dst: *mut T, val: T, order: Ordering) -> T { #[inline] #[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces -unsafe fn atomic_or(dst: *mut T, val: T, order: Ordering) -> T { +unsafe fn atomic_or(dst: *mut T, val: U, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_or` unsafe { match order { - SeqCst => intrinsics::atomic_or::(dst, val), - Acquire => intrinsics::atomic_or::(dst, val), - Release => intrinsics::atomic_or::(dst, val), - AcqRel => intrinsics::atomic_or::(dst, val), - Relaxed => intrinsics::atomic_or::(dst, val), + SeqCst => intrinsics::atomic_or::(dst, val), + Acquire => intrinsics::atomic_or::(dst, val), + Release => intrinsics::atomic_or::(dst, val), + AcqRel => intrinsics::atomic_or::(dst, val), + Relaxed => intrinsics::atomic_or::(dst, val), } } } @@ -4189,15 +4196,15 @@ unsafe fn atomic_or(dst: *mut T, val: T, order: Ordering) -> T { #[inline] #[cfg(target_has_atomic)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces -unsafe fn atomic_xor(dst: *mut T, val: T, order: Ordering) -> T { +unsafe fn atomic_xor(dst: *mut T, val: U, order: Ordering) -> T { // SAFETY: the caller must uphold the safety contract for `atomic_xor` unsafe { match order { - SeqCst => intrinsics::atomic_xor::(dst, val), - Acquire => intrinsics::atomic_xor::(dst, val), - Release => intrinsics::atomic_xor::(dst, val), - AcqRel => intrinsics::atomic_xor::(dst, val), - Relaxed => intrinsics::atomic_xor::(dst, val), + SeqCst => intrinsics::atomic_xor::(dst, val), + Acquire => intrinsics::atomic_xor::(dst, val), + Release => intrinsics::atomic_xor::(dst, val), + AcqRel => intrinsics::atomic_xor::(dst, val), + Relaxed => intrinsics::atomic_xor::(dst, val), } } } diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 0fb5c0bac756..9a0f5e0faefa 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -373,7 +373,6 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_constructors_lite)] /// use std::time::Duration; /// /// let duration = Duration::from_hours(6); @@ -381,7 +380,8 @@ impl Duration { /// assert_eq!(6 * 60 * 60, duration.as_secs()); /// assert_eq!(0, duration.subsec_nanos()); /// ``` - #[unstable(feature = "duration_constructors_lite", issue = "140881")] + #[stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")] #[must_use] #[inline] pub const fn from_hours(hours: u64) -> Duration { @@ -401,7 +401,6 @@ impl Duration { /// # Examples /// /// ``` - /// #![feature(duration_constructors_lite)] /// use std::time::Duration; /// /// let duration = Duration::from_mins(10); @@ -409,7 +408,8 @@ impl Duration { /// assert_eq!(10 * 60, duration.as_secs()); /// assert_eq!(0, duration.subsec_nanos()); /// ``` - #[unstable(feature = "duration_constructors_lite", issue = "140881")] + #[stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "duration_constructors_lite", since = "CURRENT_RUSTC_VERSION")] #[must_use] #[inline] pub const fn from_mins(mins: u64) -> Duration { diff --git a/library/coretests/tests/char.rs b/library/coretests/tests/char.rs index 153fb36925e6..852f073bae18 100644 --- a/library/coretests/tests/char.rs +++ b/library/coretests/tests/char.rs @@ -21,7 +21,6 @@ fn test_convert() { assert!(char::try_from(0xFFFF_FFFF_u32).is_err()); } -/* FIXME(#110395) #[test] const fn test_convert_const() { assert!(u32::from('a') == 0x61); @@ -31,7 +30,6 @@ const fn test_convert_const() { assert!(char::from(b'a') == 'a'); assert!(char::from(b'\xFF') == '\u{FF}'); } -*/ #[test] fn test_from_str() { diff --git a/library/coretests/tests/convert.rs b/library/coretests/tests/convert.rs index f76dd277884e..f1048f4cf09c 100644 --- a/library/coretests/tests/convert.rs +++ b/library/coretests/tests/convert.rs @@ -1,4 +1,3 @@ -/* FIXME(#110395) #[test] fn convert() { const fn from(x: i32) -> i32 { @@ -15,4 +14,3 @@ fn convert() { const BAR: Vec = into(Vec::new()); assert_eq!(BAR, Vec::::new()); } -*/ diff --git a/library/coretests/tests/floats/f128.rs b/library/coretests/tests/floats/f128.rs index 36d6a20a9442..ac4a20665305 100644 --- a/library/coretests/tests/floats/f128.rs +++ b/library/coretests/tests/floats/f128.rs @@ -15,21 +15,6 @@ const TOL: f128 = 1e-12; /// signs. const TOL_PRECISE: f128 = 1e-28; -/// Smallest number -const TINY_BITS: u128 = 0x1; - -/// Next smallest number -const TINY_UP_BITS: u128 = 0x2; - -/// Exponent = 0b11...10, Sifnificand 0b1111..10. Min val > 0 -const MAX_DOWN_BITS: u128 = 0x7ffefffffffffffffffffffffffffffe; - -/// Zeroed exponent, full significant -const LARGEST_SUBNORMAL_BITS: u128 = 0x0000ffffffffffffffffffffffffffff; - -/// Exponent = 0b1, zeroed significand -const SMALLEST_NORMAL_BITS: u128 = 0x00010000000000000000000000000000; - /// First pattern over the mantissa const NAN_MASK1: u128 = 0x0000aaaaaaaaaaaaaaaaaaaaaaaaaaaa; @@ -39,106 +24,6 @@ const NAN_MASK2: u128 = 0x00005555555555555555555555555555; // FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support // the intrinsics. -#[test] -#[cfg(any(miri, target_has_reliable_f128_math))] -fn test_abs() { - assert_biteq!(f128::INFINITY.abs(), f128::INFINITY); - assert_biteq!(1f128.abs(), 1f128); - assert_biteq!(0f128.abs(), 0f128); - assert_biteq!((-0f128).abs(), 0f128); - assert_biteq!((-1f128).abs(), 1f128); - assert_biteq!(f128::NEG_INFINITY.abs(), f128::INFINITY); - assert_biteq!((1f128 / f128::NEG_INFINITY).abs(), 0f128); - assert!(f128::NAN.abs().is_nan()); -} - -#[test] -fn test_is_sign_positive() { - assert!(f128::INFINITY.is_sign_positive()); - assert!(1f128.is_sign_positive()); - assert!(0f128.is_sign_positive()); - assert!(!(-0f128).is_sign_positive()); - assert!(!(-1f128).is_sign_positive()); - assert!(!f128::NEG_INFINITY.is_sign_positive()); - assert!(!(1f128 / f128::NEG_INFINITY).is_sign_positive()); - assert!(f128::NAN.is_sign_positive()); - assert!(!(-f128::NAN).is_sign_positive()); -} - -#[test] -fn test_is_sign_negative() { - assert!(!f128::INFINITY.is_sign_negative()); - assert!(!1f128.is_sign_negative()); - assert!(!0f128.is_sign_negative()); - assert!((-0f128).is_sign_negative()); - assert!((-1f128).is_sign_negative()); - assert!(f128::NEG_INFINITY.is_sign_negative()); - assert!((1f128 / f128::NEG_INFINITY).is_sign_negative()); - assert!(!f128::NAN.is_sign_negative()); - assert!((-f128::NAN).is_sign_negative()); -} - -#[test] -fn test_next_up() { - let tiny = f128::from_bits(TINY_BITS); - let tiny_up = f128::from_bits(TINY_UP_BITS); - let max_down = f128::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f128::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f128::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f128::NEG_INFINITY.next_up(), f128::MIN); - assert_biteq!(f128::MIN.next_up(), -max_down); - assert_biteq!((-1.0 - f128::EPSILON).next_up(), -1.0f128); - assert_biteq!((-smallest_normal).next_up(), -largest_subnormal); - assert_biteq!((-tiny_up).next_up(), -tiny); - assert_biteq!((-tiny).next_up(), -0.0f128); - assert_biteq!((-0.0f128).next_up(), tiny); - assert_biteq!(0.0f128.next_up(), tiny); - assert_biteq!(tiny.next_up(), tiny_up); - assert_biteq!(largest_subnormal.next_up(), smallest_normal); - assert_biteq!(1.0f128.next_up(), 1.0 + f128::EPSILON); - assert_biteq!(f128::MAX.next_up(), f128::INFINITY); - assert_biteq!(f128::INFINITY.next_up(), f128::INFINITY); - - // Check that NaNs roundtrip. - let nan0 = f128::NAN; - let nan1 = f128::from_bits(f128::NAN.to_bits() ^ 0x002a_aaaa); - let nan2 = f128::from_bits(f128::NAN.to_bits() ^ 0x0055_5555); - assert_biteq!(nan0.next_up(), nan0); - assert_biteq!(nan1.next_up(), nan1); - assert_biteq!(nan2.next_up(), nan2); -} - -#[test] -fn test_next_down() { - let tiny = f128::from_bits(TINY_BITS); - let tiny_up = f128::from_bits(TINY_UP_BITS); - let max_down = f128::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f128::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f128::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f128::NEG_INFINITY.next_down(), f128::NEG_INFINITY); - assert_biteq!(f128::MIN.next_down(), f128::NEG_INFINITY); - assert_biteq!((-max_down).next_down(), f128::MIN); - assert_biteq!((-1.0f128).next_down(), -1.0 - f128::EPSILON); - assert_biteq!((-largest_subnormal).next_down(), -smallest_normal); - assert_biteq!((-tiny).next_down(), -tiny_up); - assert_biteq!((-0.0f128).next_down(), -tiny); - assert_biteq!((0.0f128).next_down(), -tiny); - assert_biteq!(tiny.next_down(), 0.0f128); - assert_biteq!(tiny_up.next_down(), tiny); - assert_biteq!(smallest_normal.next_down(), largest_subnormal); - assert_biteq!((1.0 + f128::EPSILON).next_down(), 1.0f128); - assert_biteq!(f128::MAX.next_down(), max_down); - assert_biteq!(f128::INFINITY.next_down(), f128::MAX); - - // Check that NaNs roundtrip. - let nan0 = f128::NAN; - let nan1 = f128::from_bits(f128::NAN.to_bits() ^ 0x002a_aaaa); - let nan2 = f128::from_bits(f128::NAN.to_bits() ^ 0x0055_5555); - assert_biteq!(nan0.next_down(), nan0); - assert_biteq!(nan1.next_down(), nan1); - assert_biteq!(nan2.next_down(), nan2); -} - #[test] #[cfg(not(miri))] #[cfg(target_has_reliable_f128_math)] @@ -193,19 +78,6 @@ fn test_powi() { assert_biteq!(neg_inf.powi(2), inf); } -#[test] -#[cfg(not(miri))] -#[cfg(target_has_reliable_f128_math)] -fn test_sqrt_domain() { - assert!(f128::NAN.sqrt().is_nan()); - assert!(f128::NEG_INFINITY.sqrt().is_nan()); - assert!((-1.0f128).sqrt().is_nan()); - assert_biteq!((-0.0f128).sqrt(), -0.0); - assert_biteq!(0.0f128.sqrt(), 0.0); - assert_biteq!(1.0f128.sqrt(), 1.0); - assert_biteq!(f128::INFINITY.sqrt(), f128::INFINITY); -} - #[test] fn test_to_degrees() { let pi: f128 = consts::PI; @@ -260,168 +132,6 @@ fn test_float_bits_conv() { assert_eq!(f128::from_bits(masked_nan2).to_bits(), masked_nan2); } -#[test] -#[should_panic] -fn test_clamp_min_greater_than_max() { - let _ = 1.0f128.clamp(3.0, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_min_is_nan() { - let _ = 1.0f128.clamp(f128::NAN, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_max_is_nan() { - let _ = 1.0f128.clamp(3.0, f128::NAN); -} - -#[test] -fn test_total_cmp() { - use core::cmp::Ordering; - - fn quiet_bit_mask() -> u128 { - 1 << (f128::MANTISSA_DIGITS - 2) - } - - // FIXME(f16_f128): test subnormals when powf is available - // fn min_subnorm() -> f128 { - // f128::MIN_POSITIVE / f128::powf(2.0, f128::MANTISSA_DIGITS as f128 - 1.0) - // } - - // fn max_subnorm() -> f128 { - // f128::MIN_POSITIVE - min_subnorm() - // } - - fn q_nan() -> f128 { - f128::from_bits(f128::NAN.to_bits() | quiet_bit_mask()) - } - - fn s_nan() -> f128 { - f128::from_bits((f128::NAN.to_bits() & !quiet_bit_mask()) + 42) - } - - assert_eq!(Ordering::Equal, (-q_nan()).total_cmp(&-q_nan())); - assert_eq!(Ordering::Equal, (-s_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Equal, (-f128::INFINITY).total_cmp(&-f128::INFINITY)); - assert_eq!(Ordering::Equal, (-f128::MAX).total_cmp(&-f128::MAX)); - assert_eq!(Ordering::Equal, (-2.5_f128).total_cmp(&-2.5)); - assert_eq!(Ordering::Equal, (-1.0_f128).total_cmp(&-1.0)); - assert_eq!(Ordering::Equal, (-1.5_f128).total_cmp(&-1.5)); - assert_eq!(Ordering::Equal, (-0.5_f128).total_cmp(&-0.5)); - assert_eq!(Ordering::Equal, (-f128::MIN_POSITIVE).total_cmp(&-f128::MIN_POSITIVE)); - // assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm())); - // assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Equal, (-0.0_f128).total_cmp(&-0.0)); - assert_eq!(Ordering::Equal, 0.0_f128.total_cmp(&0.0)); - // assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm())); - // assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Equal, f128::MIN_POSITIVE.total_cmp(&f128::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, 0.5_f128.total_cmp(&0.5)); - assert_eq!(Ordering::Equal, 1.0_f128.total_cmp(&1.0)); - assert_eq!(Ordering::Equal, 1.5_f128.total_cmp(&1.5)); - assert_eq!(Ordering::Equal, 2.5_f128.total_cmp(&2.5)); - assert_eq!(Ordering::Equal, f128::MAX.total_cmp(&f128::MAX)); - assert_eq!(Ordering::Equal, f128::INFINITY.total_cmp(&f128::INFINITY)); - assert_eq!(Ordering::Equal, s_nan().total_cmp(&s_nan())); - assert_eq!(Ordering::Equal, q_nan().total_cmp(&q_nan())); - - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f128::INFINITY)); - assert_eq!(Ordering::Less, (-f128::INFINITY).total_cmp(&-f128::MAX)); - assert_eq!(Ordering::Less, (-f128::MAX).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-2.5_f128).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-1.5_f128).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-1.0_f128).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-0.5_f128).total_cmp(&-f128::MIN_POSITIVE)); - // assert_eq!(Ordering::Less, (-f128::MIN_POSITIVE).total_cmp(&-max_subnorm())); - // assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm())); - // assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-0.0_f128).total_cmp(&0.0)); - // assert_eq!(Ordering::Less, 0.0_f128.total_cmp(&min_subnorm())); - // assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm())); - // assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f128::MIN_POSITIVE)); - assert_eq!(Ordering::Less, f128::MIN_POSITIVE.total_cmp(&0.5)); - assert_eq!(Ordering::Less, 0.5_f128.total_cmp(&1.0)); - assert_eq!(Ordering::Less, 1.0_f128.total_cmp(&1.5)); - assert_eq!(Ordering::Less, 1.5_f128.total_cmp(&2.5)); - assert_eq!(Ordering::Less, 2.5_f128.total_cmp(&f128::MAX)); - assert_eq!(Ordering::Less, f128::MAX.total_cmp(&f128::INFINITY)); - assert_eq!(Ordering::Less, f128::INFINITY.total_cmp(&s_nan())); - assert_eq!(Ordering::Less, s_nan().total_cmp(&q_nan())); - - assert_eq!(Ordering::Greater, (-s_nan()).total_cmp(&-q_nan())); - assert_eq!(Ordering::Greater, (-f128::INFINITY).total_cmp(&-s_nan())); - assert_eq!(Ordering::Greater, (-f128::MAX).total_cmp(&-f128::INFINITY)); - assert_eq!(Ordering::Greater, (-2.5_f128).total_cmp(&-f128::MAX)); - assert_eq!(Ordering::Greater, (-1.5_f128).total_cmp(&-2.5)); - assert_eq!(Ordering::Greater, (-1.0_f128).total_cmp(&-1.5)); - assert_eq!(Ordering::Greater, (-0.5_f128).total_cmp(&-1.0)); - assert_eq!(Ordering::Greater, (-f128::MIN_POSITIVE).total_cmp(&-0.5)); - // assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f128::MIN_POSITIVE)); - // assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm())); - // assert_eq!(Ordering::Greater, (-0.0_f128).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Greater, 0.0_f128.total_cmp(&-0.0)); - // assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0)); - // assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm())); - // assert_eq!(Ordering::Greater, f128::MIN_POSITIVE.total_cmp(&max_subnorm())); - assert_eq!(Ordering::Greater, 0.5_f128.total_cmp(&f128::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, 1.0_f128.total_cmp(&0.5)); - assert_eq!(Ordering::Greater, 1.5_f128.total_cmp(&1.0)); - assert_eq!(Ordering::Greater, 2.5_f128.total_cmp(&1.5)); - assert_eq!(Ordering::Greater, f128::MAX.total_cmp(&2.5)); - assert_eq!(Ordering::Greater, f128::INFINITY.total_cmp(&f128::MAX)); - assert_eq!(Ordering::Greater, s_nan().total_cmp(&f128::INFINITY)); - assert_eq!(Ordering::Greater, q_nan().total_cmp(&s_nan())); - - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f128::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f128::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f128::MIN_POSITIVE)); - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm())); - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.0)); - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm())); - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f128::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f128::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f128::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&s_nan())); - - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f128::INFINITY)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f128::MAX)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f128::MIN_POSITIVE)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.0)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f128::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f128::MAX)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f128::INFINITY)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&s_nan())); -} - #[test] fn test_algebraic() { let a: f128 = 123.0; diff --git a/library/coretests/tests/floats/f16.rs b/library/coretests/tests/floats/f16.rs index 351c008a37ba..bb9c8a002fe8 100644 --- a/library/coretests/tests/floats/f16.rs +++ b/library/coretests/tests/floats/f16.rs @@ -21,21 +21,6 @@ const TOL_P2: f16 = 0.5; #[allow(unused)] const TOL_P4: f16 = 10.0; -/// Smallest number -const TINY_BITS: u16 = 0x1; - -/// Next smallest number -const TINY_UP_BITS: u16 = 0x2; - -/// Exponent = 0b11...10, Sifnificand 0b1111..10. Min val > 0 -const MAX_DOWN_BITS: u16 = 0x7bfe; - -/// Zeroed exponent, full significant -const LARGEST_SUBNORMAL_BITS: u16 = 0x03ff; - -/// Exponent = 0b1, zeroed significand -const SMALLEST_NORMAL_BITS: u16 = 0x0400; - /// First pattern over the mantissa const NAN_MASK1: u16 = 0x02aa; @@ -45,106 +30,6 @@ const NAN_MASK2: u16 = 0x0155; // FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support // the intrinsics. -#[test] -#[cfg(any(miri, target_has_reliable_f16_math))] -fn test_abs() { - assert_biteq!(f16::INFINITY.abs(), f16::INFINITY); - assert_biteq!(1f16.abs(), 1f16); - assert_biteq!(0f16.abs(), 0f16); - assert_biteq!((-0f16).abs(), 0f16); - assert_biteq!((-1f16).abs(), 1f16); - assert_biteq!(f16::NEG_INFINITY.abs(), f16::INFINITY); - assert_biteq!((1f16 / f16::NEG_INFINITY).abs(), 0f16); - assert!(f16::NAN.abs().is_nan()); -} - -#[test] -fn test_is_sign_positive() { - assert!(f16::INFINITY.is_sign_positive()); - assert!(1f16.is_sign_positive()); - assert!(0f16.is_sign_positive()); - assert!(!(-0f16).is_sign_positive()); - assert!(!(-1f16).is_sign_positive()); - assert!(!f16::NEG_INFINITY.is_sign_positive()); - assert!(!(1f16 / f16::NEG_INFINITY).is_sign_positive()); - assert!(f16::NAN.is_sign_positive()); - assert!(!(-f16::NAN).is_sign_positive()); -} - -#[test] -fn test_is_sign_negative() { - assert!(!f16::INFINITY.is_sign_negative()); - assert!(!1f16.is_sign_negative()); - assert!(!0f16.is_sign_negative()); - assert!((-0f16).is_sign_negative()); - assert!((-1f16).is_sign_negative()); - assert!(f16::NEG_INFINITY.is_sign_negative()); - assert!((1f16 / f16::NEG_INFINITY).is_sign_negative()); - assert!(!f16::NAN.is_sign_negative()); - assert!((-f16::NAN).is_sign_negative()); -} - -#[test] -fn test_next_up() { - let tiny = f16::from_bits(TINY_BITS); - let tiny_up = f16::from_bits(TINY_UP_BITS); - let max_down = f16::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f16::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f16::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f16::NEG_INFINITY.next_up(), f16::MIN); - assert_biteq!(f16::MIN.next_up(), -max_down); - assert_biteq!((-1.0 - f16::EPSILON).next_up(), -1.0f16); - assert_biteq!((-smallest_normal).next_up(), -largest_subnormal); - assert_biteq!((-tiny_up).next_up(), -tiny); - assert_biteq!((-tiny).next_up(), -0.0f16); - assert_biteq!((-0.0f16).next_up(), tiny); - assert_biteq!(0.0f16.next_up(), tiny); - assert_biteq!(tiny.next_up(), tiny_up); - assert_biteq!(largest_subnormal.next_up(), smallest_normal); - assert_biteq!(1.0f16.next_up(), 1.0 + f16::EPSILON); - assert_biteq!(f16::MAX.next_up(), f16::INFINITY); - assert_biteq!(f16::INFINITY.next_up(), f16::INFINITY); - - // Check that NaNs roundtrip. - let nan0 = f16::NAN; - let nan1 = f16::from_bits(f16::NAN.to_bits() ^ NAN_MASK1); - let nan2 = f16::from_bits(f16::NAN.to_bits() ^ NAN_MASK2); - assert_biteq!(nan0.next_up(), nan0); - assert_biteq!(nan1.next_up(), nan1); - assert_biteq!(nan2.next_up(), nan2); -} - -#[test] -fn test_next_down() { - let tiny = f16::from_bits(TINY_BITS); - let tiny_up = f16::from_bits(TINY_UP_BITS); - let max_down = f16::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f16::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f16::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f16::NEG_INFINITY.next_down(), f16::NEG_INFINITY); - assert_biteq!(f16::MIN.next_down(), f16::NEG_INFINITY); - assert_biteq!((-max_down).next_down(), f16::MIN); - assert_biteq!((-1.0f16).next_down(), -1.0 - f16::EPSILON); - assert_biteq!((-largest_subnormal).next_down(), -smallest_normal); - assert_biteq!((-tiny).next_down(), -tiny_up); - assert_biteq!((-0.0f16).next_down(), -tiny); - assert_biteq!((0.0f16).next_down(), -tiny); - assert_biteq!(tiny.next_down(), 0.0f16); - assert_biteq!(tiny_up.next_down(), tiny); - assert_biteq!(smallest_normal.next_down(), largest_subnormal); - assert_biteq!((1.0 + f16::EPSILON).next_down(), 1.0f16); - assert_biteq!(f16::MAX.next_down(), max_down); - assert_biteq!(f16::INFINITY.next_down(), f16::MAX); - - // Check that NaNs roundtrip. - let nan0 = f16::NAN; - let nan1 = f16::from_bits(f16::NAN.to_bits() ^ NAN_MASK1); - let nan2 = f16::from_bits(f16::NAN.to_bits() ^ NAN_MASK2); - assert_biteq!(nan0.next_down(), nan0); - assert_biteq!(nan1.next_down(), nan1); - assert_biteq!(nan2.next_down(), nan2); -} - #[test] #[cfg(not(miri))] #[cfg(target_has_reliable_f16_math)] @@ -195,19 +80,6 @@ fn test_powi() { assert_biteq!(neg_inf.powi(2), inf); } -#[test] -#[cfg(not(miri))] -#[cfg(target_has_reliable_f16_math)] -fn test_sqrt_domain() { - assert!(f16::NAN.sqrt().is_nan()); - assert!(f16::NEG_INFINITY.sqrt().is_nan()); - assert!((-1.0f16).sqrt().is_nan()); - assert_biteq!((-0.0f16).sqrt(), -0.0); - assert_biteq!(0.0f16.sqrt(), 0.0); - assert_biteq!(1.0f16.sqrt(), 1.0); - assert_biteq!(f16::INFINITY.sqrt(), f16::INFINITY); -} - #[test] fn test_to_degrees() { let pi: f16 = consts::PI; @@ -259,172 +131,6 @@ fn test_float_bits_conv() { assert_eq!(f16::from_bits(masked_nan2).to_bits(), masked_nan2); } -#[test] -#[should_panic] -fn test_clamp_min_greater_than_max() { - let _ = 1.0f16.clamp(3.0, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_min_is_nan() { - let _ = 1.0f16.clamp(f16::NAN, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_max_is_nan() { - let _ = 1.0f16.clamp(3.0, f16::NAN); -} - -#[test] -#[cfg(not(miri))] -#[cfg(target_has_reliable_f16_math)] -fn test_total_cmp() { - use core::cmp::Ordering; - - fn quiet_bit_mask() -> u16 { - 1 << (f16::MANTISSA_DIGITS - 2) - } - - fn min_subnorm() -> f16 { - f16::MIN_POSITIVE / f16::powf(2.0, f16::MANTISSA_DIGITS as f16 - 1.0) - } - - fn max_subnorm() -> f16 { - f16::MIN_POSITIVE - min_subnorm() - } - - fn q_nan() -> f16 { - f16::from_bits(f16::NAN.to_bits() | quiet_bit_mask()) - } - - // FIXME(f16_f128): Tests involving sNaN are disabled because without optimizations, - // `total_cmp` is getting incorrectly lowered to code that includes a `extend`/`trunc` round - // trip, which quiets sNaNs. See: https://github.com/llvm/llvm-project/issues/104915 - // fn s_nan() -> f16 { - // f16::from_bits((f16::NAN.to_bits() & !quiet_bit_mask()) + 42) - // } - - assert_eq!(Ordering::Equal, (-q_nan()).total_cmp(&-q_nan())); - // assert_eq!(Ordering::Equal, (-s_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Equal, (-f16::INFINITY).total_cmp(&-f16::INFINITY)); - assert_eq!(Ordering::Equal, (-f16::MAX).total_cmp(&-f16::MAX)); - assert_eq!(Ordering::Equal, (-2.5_f16).total_cmp(&-2.5)); - assert_eq!(Ordering::Equal, (-1.0_f16).total_cmp(&-1.0)); - assert_eq!(Ordering::Equal, (-1.5_f16).total_cmp(&-1.5)); - assert_eq!(Ordering::Equal, (-0.5_f16).total_cmp(&-0.5)); - assert_eq!(Ordering::Equal, (-f16::MIN_POSITIVE).total_cmp(&-f16::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Equal, (-0.0_f16).total_cmp(&-0.0)); - assert_eq!(Ordering::Equal, 0.0_f16.total_cmp(&0.0)); - assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm())); - assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Equal, f16::MIN_POSITIVE.total_cmp(&f16::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, 0.5_f16.total_cmp(&0.5)); - assert_eq!(Ordering::Equal, 1.0_f16.total_cmp(&1.0)); - assert_eq!(Ordering::Equal, 1.5_f16.total_cmp(&1.5)); - assert_eq!(Ordering::Equal, 2.5_f16.total_cmp(&2.5)); - assert_eq!(Ordering::Equal, f16::MAX.total_cmp(&f16::MAX)); - assert_eq!(Ordering::Equal, f16::INFINITY.total_cmp(&f16::INFINITY)); - // assert_eq!(Ordering::Equal, s_nan().total_cmp(&s_nan())); - assert_eq!(Ordering::Equal, q_nan().total_cmp(&q_nan())); - - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f16::INFINITY)); - assert_eq!(Ordering::Less, (-f16::INFINITY).total_cmp(&-f16::MAX)); - assert_eq!(Ordering::Less, (-f16::MAX).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-2.5_f16).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-1.5_f16).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-1.0_f16).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-0.5_f16).total_cmp(&-f16::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-f16::MIN_POSITIVE).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-0.0_f16).total_cmp(&0.0)); - assert_eq!(Ordering::Less, 0.0_f16.total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f16::MIN_POSITIVE)); - assert_eq!(Ordering::Less, f16::MIN_POSITIVE.total_cmp(&0.5)); - assert_eq!(Ordering::Less, 0.5_f16.total_cmp(&1.0)); - assert_eq!(Ordering::Less, 1.0_f16.total_cmp(&1.5)); - assert_eq!(Ordering::Less, 1.5_f16.total_cmp(&2.5)); - assert_eq!(Ordering::Less, 2.5_f16.total_cmp(&f16::MAX)); - assert_eq!(Ordering::Less, f16::MAX.total_cmp(&f16::INFINITY)); - // assert_eq!(Ordering::Less, f16::INFINITY.total_cmp(&s_nan())); - // assert_eq!(Ordering::Less, s_nan().total_cmp(&q_nan())); - - // assert_eq!(Ordering::Greater, (-s_nan()).total_cmp(&-q_nan())); - // assert_eq!(Ordering::Greater, (-f16::INFINITY).total_cmp(&-s_nan())); - assert_eq!(Ordering::Greater, (-f16::MAX).total_cmp(&-f16::INFINITY)); - assert_eq!(Ordering::Greater, (-2.5_f16).total_cmp(&-f16::MAX)); - assert_eq!(Ordering::Greater, (-1.5_f16).total_cmp(&-2.5)); - assert_eq!(Ordering::Greater, (-1.0_f16).total_cmp(&-1.5)); - assert_eq!(Ordering::Greater, (-0.5_f16).total_cmp(&-1.0)); - assert_eq!(Ordering::Greater, (-f16::MIN_POSITIVE).total_cmp(&-0.5)); - assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f16::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Greater, (-0.0_f16).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Greater, 0.0_f16.total_cmp(&-0.0)); - assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0)); - assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm())); - assert_eq!(Ordering::Greater, f16::MIN_POSITIVE.total_cmp(&max_subnorm())); - assert_eq!(Ordering::Greater, 0.5_f16.total_cmp(&f16::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, 1.0_f16.total_cmp(&0.5)); - assert_eq!(Ordering::Greater, 1.5_f16.total_cmp(&1.0)); - assert_eq!(Ordering::Greater, 2.5_f16.total_cmp(&1.5)); - assert_eq!(Ordering::Greater, f16::MAX.total_cmp(&2.5)); - assert_eq!(Ordering::Greater, f16::INFINITY.total_cmp(&f16::MAX)); - // assert_eq!(Ordering::Greater, s_nan().total_cmp(&f16::INFINITY)); - // assert_eq!(Ordering::Greater, q_nan().total_cmp(&s_nan())); - - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f16::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f16::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f16::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f16::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f16::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f16::INFINITY)); - // assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&s_nan())); - - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f16::INFINITY)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f16::MAX)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-2.5)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.5)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.0)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.5)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f16::MIN_POSITIVE)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.0)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.0)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm())); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f16::MIN_POSITIVE)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.5)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.0)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.5)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&2.5)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f16::MAX)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f16::INFINITY)); - // assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&s_nan())); -} - #[test] fn test_algebraic() { let a: f16 = 123.0; diff --git a/library/coretests/tests/floats/f32.rs b/library/coretests/tests/floats/f32.rs index 267b0e4e2943..e77e44655dc8 100644 --- a/library/coretests/tests/floats/f32.rs +++ b/library/coretests/tests/floats/f32.rs @@ -3,21 +3,6 @@ use core::f32::consts; use super::{assert_approx_eq, assert_biteq}; -/// Smallest number -const TINY_BITS: u32 = 0x1; - -/// Next smallest number -const TINY_UP_BITS: u32 = 0x2; - -/// Exponent = 0b11...10, Sifnificand 0b1111..10. Min val > 0 -const MAX_DOWN_BITS: u32 = 0x7f7f_fffe; - -/// Zeroed exponent, full significant -const LARGEST_SUBNORMAL_BITS: u32 = 0x007f_ffff; - -/// Exponent = 0b1, zeroed significand -const SMALLEST_NORMAL_BITS: u32 = 0x0080_0000; - /// First pattern over the mantissa const NAN_MASK1: u32 = 0x002a_aaaa; @@ -29,117 +14,6 @@ const NAN_MASK2: u32 = 0x0055_5555; /// They serve as a way to get an idea of the real precision of floating point operations on different platforms. const APPROX_DELTA: f32 = if cfg!(miri) { 1e-4 } else { 1e-6 }; -#[test] -fn test_abs() { - assert_biteq!(f32::INFINITY.abs(), f32::INFINITY); - assert_biteq!(1f32.abs(), 1f32); - assert_biteq!(0f32.abs(), 0f32); - assert_biteq!((-0f32).abs(), 0f32); - assert_biteq!((-1f32).abs(), 1f32); - assert_biteq!(f32::NEG_INFINITY.abs(), f32::INFINITY); - assert_biteq!((1f32 / f32::NEG_INFINITY).abs(), 0f32); - assert!(f32::NAN.abs().is_nan()); -} - -#[test] -fn test_signum() { - assert_biteq!(f32::INFINITY.signum(), 1f32); - assert_biteq!(1f32.signum(), 1f32); - assert_biteq!(0f32.signum(), 1f32); - assert_biteq!((-0f32).signum(), -1f32); - assert_biteq!((-1f32).signum(), -1f32); - assert_biteq!(f32::NEG_INFINITY.signum(), -1f32); - assert_biteq!((1f32 / f32::NEG_INFINITY).signum(), -1f32); - assert!(f32::NAN.signum().is_nan()); -} - -#[test] -fn test_is_sign_positive() { - assert!(f32::INFINITY.is_sign_positive()); - assert!(1f32.is_sign_positive()); - assert!(0f32.is_sign_positive()); - assert!(!(-0f32).is_sign_positive()); - assert!(!(-1f32).is_sign_positive()); - assert!(!f32::NEG_INFINITY.is_sign_positive()); - assert!(!(1f32 / f32::NEG_INFINITY).is_sign_positive()); - assert!(f32::NAN.is_sign_positive()); - assert!(!(-f32::NAN).is_sign_positive()); -} - -#[test] -fn test_is_sign_negative() { - assert!(!f32::INFINITY.is_sign_negative()); - assert!(!1f32.is_sign_negative()); - assert!(!0f32.is_sign_negative()); - assert!((-0f32).is_sign_negative()); - assert!((-1f32).is_sign_negative()); - assert!(f32::NEG_INFINITY.is_sign_negative()); - assert!((1f32 / f32::NEG_INFINITY).is_sign_negative()); - assert!(!f32::NAN.is_sign_negative()); - assert!((-f32::NAN).is_sign_negative()); -} - -#[test] -fn test_next_up() { - let tiny = f32::from_bits(TINY_BITS); - let tiny_up = f32::from_bits(TINY_UP_BITS); - let max_down = f32::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f32::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f32::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f32::NEG_INFINITY.next_up(), f32::MIN); - assert_biteq!(f32::MIN.next_up(), -max_down); - assert_biteq!((-1.0f32 - f32::EPSILON).next_up(), -1.0f32); - assert_biteq!((-smallest_normal).next_up(), -largest_subnormal); - assert_biteq!((-tiny_up).next_up(), -tiny); - assert_biteq!((-tiny).next_up(), -0.0f32); - assert_biteq!((-0.0f32).next_up(), tiny); - assert_biteq!(0.0f32.next_up(), tiny); - assert_biteq!(tiny.next_up(), tiny_up); - assert_biteq!(largest_subnormal.next_up(), smallest_normal); - assert_biteq!(1.0f32.next_up(), 1.0 + f32::EPSILON); - assert_biteq!(f32::MAX.next_up(), f32::INFINITY); - assert_biteq!(f32::INFINITY.next_up(), f32::INFINITY); - - // Check that NaNs roundtrip. - let nan0 = f32::NAN; - let nan1 = f32::from_bits(f32::NAN.to_bits() ^ NAN_MASK1); - let nan2 = f32::from_bits(f32::NAN.to_bits() ^ NAN_MASK2); - assert_biteq!(nan0.next_up(), nan0); - assert_biteq!(nan1.next_up(), nan1); - assert_biteq!(nan2.next_up(), nan2); -} - -#[test] -fn test_next_down() { - let tiny = f32::from_bits(TINY_BITS); - let tiny_up = f32::from_bits(TINY_UP_BITS); - let max_down = f32::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f32::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f32::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f32::NEG_INFINITY.next_down(), f32::NEG_INFINITY); - assert_biteq!(f32::MIN.next_down(), f32::NEG_INFINITY); - assert_biteq!((-max_down).next_down(), f32::MIN); - assert_biteq!((-1.0f32).next_down(), -1.0 - f32::EPSILON); - assert_biteq!((-largest_subnormal).next_down(), -smallest_normal); - assert_biteq!((-tiny).next_down(), -tiny_up); - assert_biteq!((-0.0f32).next_down(), -tiny); - assert_biteq!((0.0f32).next_down(), -tiny); - assert_biteq!(tiny.next_down(), 0.0f32); - assert_biteq!(tiny_up.next_down(), tiny); - assert_biteq!(smallest_normal.next_down(), largest_subnormal); - assert_biteq!((1.0 + f32::EPSILON).next_down(), 1.0f32); - assert_biteq!(f32::MAX.next_down(), max_down); - assert_biteq!(f32::INFINITY.next_down(), f32::MAX); - - // Check that NaNs roundtrip. - let nan0 = f32::NAN; - let nan1 = f32::from_bits(f32::NAN.to_bits() ^ NAN_MASK1); - let nan2 = f32::from_bits(f32::NAN.to_bits() ^ NAN_MASK2); - assert_biteq!(nan0.next_down(), nan0); - assert_biteq!(nan1.next_down(), nan1); - assert_biteq!(nan2.next_down(), nan2); -} - // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ #[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)] #[test] @@ -186,17 +60,6 @@ fn test_powi() { assert_biteq!(neg_inf.powi(2), inf); } -#[test] -fn test_sqrt_domain() { - assert!(f32::NAN.sqrt().is_nan()); - assert!(f32::NEG_INFINITY.sqrt().is_nan()); - assert!((-1.0f32).sqrt().is_nan()); - assert_biteq!((-0.0f32).sqrt(), -0.0); - assert_biteq!(0.0f32.sqrt(), 0.0); - assert_biteq!(1.0f32.sqrt(), 1.0); - assert_biteq!(f32::INFINITY.sqrt(), f32::INFINITY); -} - #[test] fn test_to_degrees() { let pi: f32 = consts::PI; @@ -249,167 +112,6 @@ fn test_float_bits_conv() { assert_eq!(f32::from_bits(masked_nan2).to_bits(), masked_nan2); } -#[test] -#[should_panic] -fn test_clamp_min_greater_than_max() { - let _ = 1.0f32.clamp(3.0, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_min_is_nan() { - let _ = 1.0f32.clamp(f32::NAN, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_max_is_nan() { - let _ = 1.0f32.clamp(3.0, f32::NAN); -} - -#[test] -fn test_total_cmp() { - use core::cmp::Ordering; - - fn quiet_bit_mask() -> u32 { - 1 << (f32::MANTISSA_DIGITS - 2) - } - - fn min_subnorm() -> f32 { - f32::MIN_POSITIVE / f32::powf(2.0, f32::MANTISSA_DIGITS as f32 - 1.0) - } - - fn max_subnorm() -> f32 { - f32::MIN_POSITIVE - min_subnorm() - } - - fn q_nan() -> f32 { - f32::from_bits(f32::NAN.to_bits() | quiet_bit_mask()) - } - - fn s_nan() -> f32 { - f32::from_bits((f32::NAN.to_bits() & !quiet_bit_mask()) + 42) - } - - assert_eq!(Ordering::Equal, (-q_nan()).total_cmp(&-q_nan())); - assert_eq!(Ordering::Equal, (-s_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Equal, (-f32::INFINITY).total_cmp(&-f32::INFINITY)); - assert_eq!(Ordering::Equal, (-f32::MAX).total_cmp(&-f32::MAX)); - assert_eq!(Ordering::Equal, (-2.5_f32).total_cmp(&-2.5)); - assert_eq!(Ordering::Equal, (-1.0_f32).total_cmp(&-1.0)); - assert_eq!(Ordering::Equal, (-1.5_f32).total_cmp(&-1.5)); - assert_eq!(Ordering::Equal, (-0.5_f32).total_cmp(&-0.5)); - assert_eq!(Ordering::Equal, (-f32::MIN_POSITIVE).total_cmp(&-f32::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Equal, (-0.0_f32).total_cmp(&-0.0)); - assert_eq!(Ordering::Equal, 0.0_f32.total_cmp(&0.0)); - assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm())); - assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Equal, f32::MIN_POSITIVE.total_cmp(&f32::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, 0.5_f32.total_cmp(&0.5)); - assert_eq!(Ordering::Equal, 1.0_f32.total_cmp(&1.0)); - assert_eq!(Ordering::Equal, 1.5_f32.total_cmp(&1.5)); - assert_eq!(Ordering::Equal, 2.5_f32.total_cmp(&2.5)); - assert_eq!(Ordering::Equal, f32::MAX.total_cmp(&f32::MAX)); - assert_eq!(Ordering::Equal, f32::INFINITY.total_cmp(&f32::INFINITY)); - assert_eq!(Ordering::Equal, s_nan().total_cmp(&s_nan())); - assert_eq!(Ordering::Equal, q_nan().total_cmp(&q_nan())); - - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f32::INFINITY)); - assert_eq!(Ordering::Less, (-f32::INFINITY).total_cmp(&-f32::MAX)); - assert_eq!(Ordering::Less, (-f32::MAX).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-2.5_f32).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-1.5_f32).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-1.0_f32).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-0.5_f32).total_cmp(&-f32::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-f32::MIN_POSITIVE).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-0.0_f32).total_cmp(&0.0)); - assert_eq!(Ordering::Less, 0.0_f32.total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f32::MIN_POSITIVE)); - assert_eq!(Ordering::Less, f32::MIN_POSITIVE.total_cmp(&0.5)); - assert_eq!(Ordering::Less, 0.5_f32.total_cmp(&1.0)); - assert_eq!(Ordering::Less, 1.0_f32.total_cmp(&1.5)); - assert_eq!(Ordering::Less, 1.5_f32.total_cmp(&2.5)); - assert_eq!(Ordering::Less, 2.5_f32.total_cmp(&f32::MAX)); - assert_eq!(Ordering::Less, f32::MAX.total_cmp(&f32::INFINITY)); - assert_eq!(Ordering::Less, f32::INFINITY.total_cmp(&s_nan())); - assert_eq!(Ordering::Less, s_nan().total_cmp(&q_nan())); - - assert_eq!(Ordering::Greater, (-s_nan()).total_cmp(&-q_nan())); - assert_eq!(Ordering::Greater, (-f32::INFINITY).total_cmp(&-s_nan())); - assert_eq!(Ordering::Greater, (-f32::MAX).total_cmp(&-f32::INFINITY)); - assert_eq!(Ordering::Greater, (-2.5_f32).total_cmp(&-f32::MAX)); - assert_eq!(Ordering::Greater, (-1.5_f32).total_cmp(&-2.5)); - assert_eq!(Ordering::Greater, (-1.0_f32).total_cmp(&-1.5)); - assert_eq!(Ordering::Greater, (-0.5_f32).total_cmp(&-1.0)); - assert_eq!(Ordering::Greater, (-f32::MIN_POSITIVE).total_cmp(&-0.5)); - assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f32::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Greater, (-0.0_f32).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Greater, 0.0_f32.total_cmp(&-0.0)); - assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0)); - assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm())); - assert_eq!(Ordering::Greater, f32::MIN_POSITIVE.total_cmp(&max_subnorm())); - assert_eq!(Ordering::Greater, 0.5_f32.total_cmp(&f32::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, 1.0_f32.total_cmp(&0.5)); - assert_eq!(Ordering::Greater, 1.5_f32.total_cmp(&1.0)); - assert_eq!(Ordering::Greater, 2.5_f32.total_cmp(&1.5)); - assert_eq!(Ordering::Greater, f32::MAX.total_cmp(&2.5)); - assert_eq!(Ordering::Greater, f32::INFINITY.total_cmp(&f32::MAX)); - assert_eq!(Ordering::Greater, s_nan().total_cmp(&f32::INFINITY)); - assert_eq!(Ordering::Greater, q_nan().total_cmp(&s_nan())); - - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f32::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f32::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f32::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f32::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f32::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f32::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&s_nan())); - - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f32::INFINITY)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f32::MAX)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f32::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f32::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f32::MAX)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f32::INFINITY)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&s_nan())); -} - #[test] fn test_algebraic() { let a: f32 = 123.0; diff --git a/library/coretests/tests/floats/f64.rs b/library/coretests/tests/floats/f64.rs index 735b7a765151..fea9cc19b39f 100644 --- a/library/coretests/tests/floats/f64.rs +++ b/library/coretests/tests/floats/f64.rs @@ -3,136 +3,12 @@ use core::f64::consts; use super::{assert_approx_eq, assert_biteq}; -/// Smallest number -const TINY_BITS: u64 = 0x1; - -/// Next smallest number -const TINY_UP_BITS: u64 = 0x2; - -/// Exponent = 0b11...10, Sifnificand 0b1111..10. Min val > 0 -const MAX_DOWN_BITS: u64 = 0x7fef_ffff_ffff_fffe; - -/// Zeroed exponent, full significant -const LARGEST_SUBNORMAL_BITS: u64 = 0x000f_ffff_ffff_ffff; - -/// Exponent = 0b1, zeroed significand -const SMALLEST_NORMAL_BITS: u64 = 0x0010_0000_0000_0000; - /// First pattern over the mantissa const NAN_MASK1: u64 = 0x000a_aaaa_aaaa_aaaa; /// Second pattern over the mantissa const NAN_MASK2: u64 = 0x0005_5555_5555_5555; -#[test] -fn test_abs() { - assert_biteq!(f64::INFINITY.abs(), f64::INFINITY); - assert_biteq!(1f64.abs(), 1f64); - assert_biteq!(0f64.abs(), 0f64); - assert_biteq!((-0f64).abs(), 0f64); - assert_biteq!((-1f64).abs(), 1f64); - assert_biteq!(f64::NEG_INFINITY.abs(), f64::INFINITY); - assert_biteq!((1f64 / f64::NEG_INFINITY).abs(), 0f64); - assert!(f64::NAN.abs().is_nan()); -} - -#[test] -fn test_signum() { - assert_biteq!(f64::INFINITY.signum(), 1f64); - assert_biteq!(1f64.signum(), 1f64); - assert_biteq!(0f64.signum(), 1f64); - assert_biteq!((-0f64).signum(), -1f64); - assert_biteq!((-1f64).signum(), -1f64); - assert_biteq!(f64::NEG_INFINITY.signum(), -1f64); - assert_biteq!((1f64 / f64::NEG_INFINITY).signum(), -1f64); - assert!(f64::NAN.signum().is_nan()); -} - -#[test] -fn test_is_sign_positive() { - assert!(f64::INFINITY.is_sign_positive()); - assert!(1f64.is_sign_positive()); - assert!(0f64.is_sign_positive()); - assert!(!(-0f64).is_sign_positive()); - assert!(!(-1f64).is_sign_positive()); - assert!(!f64::NEG_INFINITY.is_sign_positive()); - assert!(!(1f64 / f64::NEG_INFINITY).is_sign_positive()); - assert!(f64::NAN.is_sign_positive()); - assert!(!(-f64::NAN).is_sign_positive()); -} - -#[test] -fn test_is_sign_negative() { - assert!(!f64::INFINITY.is_sign_negative()); - assert!(!1f64.is_sign_negative()); - assert!(!0f64.is_sign_negative()); - assert!((-0f64).is_sign_negative()); - assert!((-1f64).is_sign_negative()); - assert!(f64::NEG_INFINITY.is_sign_negative()); - assert!((1f64 / f64::NEG_INFINITY).is_sign_negative()); - assert!(!f64::NAN.is_sign_negative()); - assert!((-f64::NAN).is_sign_negative()); -} - -#[test] -fn test_next_up() { - let tiny = f64::from_bits(TINY_BITS); - let tiny_up = f64::from_bits(TINY_UP_BITS); - let max_down = f64::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f64::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f64::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f64::NEG_INFINITY.next_up(), f64::MIN); - assert_biteq!(f64::MIN.next_up(), -max_down); - assert_biteq!((-1.0 - f64::EPSILON).next_up(), -1.0f64); - assert_biteq!((-smallest_normal).next_up(), -largest_subnormal); - assert_biteq!((-tiny_up).next_up(), -tiny); - assert_biteq!((-tiny).next_up(), -0.0f64); - assert_biteq!((-0.0f64).next_up(), tiny); - assert_biteq!(0.0f64.next_up(), tiny); - assert_biteq!(tiny.next_up(), tiny_up); - assert_biteq!(largest_subnormal.next_up(), smallest_normal); - assert_biteq!(1.0f64.next_up(), 1.0 + f64::EPSILON); - assert_biteq!(f64::MAX.next_up(), f64::INFINITY); - assert_biteq!(f64::INFINITY.next_up(), f64::INFINITY); - - let nan0 = f64::NAN; - let nan1 = f64::from_bits(f64::NAN.to_bits() ^ NAN_MASK1); - let nan2 = f64::from_bits(f64::NAN.to_bits() ^ NAN_MASK2); - assert_biteq!(nan0.next_up(), nan0); - assert_biteq!(nan1.next_up(), nan1); - assert_biteq!(nan2.next_up(), nan2); -} - -#[test] -fn test_next_down() { - let tiny = f64::from_bits(TINY_BITS); - let tiny_up = f64::from_bits(TINY_UP_BITS); - let max_down = f64::from_bits(MAX_DOWN_BITS); - let largest_subnormal = f64::from_bits(LARGEST_SUBNORMAL_BITS); - let smallest_normal = f64::from_bits(SMALLEST_NORMAL_BITS); - assert_biteq!(f64::NEG_INFINITY.next_down(), f64::NEG_INFINITY); - assert_biteq!(f64::MIN.next_down(), f64::NEG_INFINITY); - assert_biteq!((-max_down).next_down(), f64::MIN); - assert_biteq!((-1.0f64).next_down(), -1.0 - f64::EPSILON); - assert_biteq!((-largest_subnormal).next_down(), -smallest_normal); - assert_biteq!((-tiny).next_down(), -tiny_up); - assert_biteq!((-0.0f64).next_down(), -tiny); - assert_biteq!((0.0f64).next_down(), -tiny); - assert_biteq!(tiny.next_down(), 0.0f64); - assert_biteq!(tiny_up.next_down(), tiny); - assert_biteq!(smallest_normal.next_down(), largest_subnormal); - assert_biteq!((1.0 + f64::EPSILON).next_down(), 1.0f64); - assert_biteq!(f64::MAX.next_down(), max_down); - assert_biteq!(f64::INFINITY.next_down(), f64::MAX); - - let nan0 = f64::NAN; - let nan1 = f64::from_bits(f64::NAN.to_bits() ^ NAN_MASK1); - let nan2 = f64::from_bits(f64::NAN.to_bits() ^ NAN_MASK2); - assert_biteq!(nan0.next_down(), nan0); - assert_biteq!(nan1.next_down(), nan1); - assert_biteq!(nan2.next_down(), nan2); -} - // FIXME(#140515): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/ #[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)] #[test] @@ -179,17 +55,6 @@ fn test_powi() { assert_biteq!(neg_inf.powi(2), inf); } -#[test] -fn test_sqrt_domain() { - assert!(f64::NAN.sqrt().is_nan()); - assert!(f64::NEG_INFINITY.sqrt().is_nan()); - assert!((-1.0f64).sqrt().is_nan()); - assert_biteq!((-0.0f64).sqrt(), -0.0); - assert_biteq!(0.0f64.sqrt(), 0.0); - assert_biteq!(1.0f64.sqrt(), 1.0); - assert_biteq!(f64::INFINITY.sqrt(), f64::INFINITY); -} - #[test] fn test_to_degrees() { let pi: f64 = consts::PI; @@ -240,167 +105,6 @@ fn test_float_bits_conv() { assert_eq!(f64::from_bits(masked_nan2).to_bits(), masked_nan2); } -#[test] -#[should_panic] -fn test_clamp_min_greater_than_max() { - let _ = 1.0f64.clamp(3.0, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_min_is_nan() { - let _ = 1.0f64.clamp(f64::NAN, 1.0); -} - -#[test] -#[should_panic] -fn test_clamp_max_is_nan() { - let _ = 1.0f64.clamp(3.0, f64::NAN); -} - -#[test] -fn test_total_cmp() { - use core::cmp::Ordering; - - fn quiet_bit_mask() -> u64 { - 1 << (f64::MANTISSA_DIGITS - 2) - } - - fn min_subnorm() -> f64 { - f64::MIN_POSITIVE / f64::powf(2.0, f64::MANTISSA_DIGITS as f64 - 1.0) - } - - fn max_subnorm() -> f64 { - f64::MIN_POSITIVE - min_subnorm() - } - - fn q_nan() -> f64 { - f64::from_bits(f64::NAN.to_bits() | quiet_bit_mask()) - } - - fn s_nan() -> f64 { - f64::from_bits((f64::NAN.to_bits() & !quiet_bit_mask()) + 42) - } - - assert_eq!(Ordering::Equal, (-q_nan()).total_cmp(&-q_nan())); - assert_eq!(Ordering::Equal, (-s_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Equal, (-f64::INFINITY).total_cmp(&-f64::INFINITY)); - assert_eq!(Ordering::Equal, (-f64::MAX).total_cmp(&-f64::MAX)); - assert_eq!(Ordering::Equal, (-2.5_f64).total_cmp(&-2.5)); - assert_eq!(Ordering::Equal, (-1.0_f64).total_cmp(&-1.0)); - assert_eq!(Ordering::Equal, (-1.5_f64).total_cmp(&-1.5)); - assert_eq!(Ordering::Equal, (-0.5_f64).total_cmp(&-0.5)); - assert_eq!(Ordering::Equal, (-f64::MIN_POSITIVE).total_cmp(&-f64::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, (-max_subnorm()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Equal, (-min_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Equal, (-0.0_f64).total_cmp(&-0.0)); - assert_eq!(Ordering::Equal, 0.0_f64.total_cmp(&0.0)); - assert_eq!(Ordering::Equal, min_subnorm().total_cmp(&min_subnorm())); - assert_eq!(Ordering::Equal, max_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Equal, f64::MIN_POSITIVE.total_cmp(&f64::MIN_POSITIVE)); - assert_eq!(Ordering::Equal, 0.5_f64.total_cmp(&0.5)); - assert_eq!(Ordering::Equal, 1.0_f64.total_cmp(&1.0)); - assert_eq!(Ordering::Equal, 1.5_f64.total_cmp(&1.5)); - assert_eq!(Ordering::Equal, 2.5_f64.total_cmp(&2.5)); - assert_eq!(Ordering::Equal, f64::MAX.total_cmp(&f64::MAX)); - assert_eq!(Ordering::Equal, f64::INFINITY.total_cmp(&f64::INFINITY)); - assert_eq!(Ordering::Equal, s_nan().total_cmp(&s_nan())); - assert_eq!(Ordering::Equal, q_nan().total_cmp(&q_nan())); - - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f64::INFINITY)); - assert_eq!(Ordering::Less, (-f64::INFINITY).total_cmp(&-f64::MAX)); - assert_eq!(Ordering::Less, (-f64::MAX).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-2.5_f64).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-1.5_f64).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-1.0_f64).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-0.5_f64).total_cmp(&-f64::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-f64::MIN_POSITIVE).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-max_subnorm()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-min_subnorm()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-0.0_f64).total_cmp(&0.0)); - assert_eq!(Ordering::Less, 0.0_f64.total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, min_subnorm().total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, max_subnorm().total_cmp(&f64::MIN_POSITIVE)); - assert_eq!(Ordering::Less, f64::MIN_POSITIVE.total_cmp(&0.5)); - assert_eq!(Ordering::Less, 0.5_f64.total_cmp(&1.0)); - assert_eq!(Ordering::Less, 1.0_f64.total_cmp(&1.5)); - assert_eq!(Ordering::Less, 1.5_f64.total_cmp(&2.5)); - assert_eq!(Ordering::Less, 2.5_f64.total_cmp(&f64::MAX)); - assert_eq!(Ordering::Less, f64::MAX.total_cmp(&f64::INFINITY)); - assert_eq!(Ordering::Less, f64::INFINITY.total_cmp(&s_nan())); - assert_eq!(Ordering::Less, s_nan().total_cmp(&q_nan())); - - assert_eq!(Ordering::Greater, (-s_nan()).total_cmp(&-q_nan())); - assert_eq!(Ordering::Greater, (-f64::INFINITY).total_cmp(&-s_nan())); - assert_eq!(Ordering::Greater, (-f64::MAX).total_cmp(&-f64::INFINITY)); - assert_eq!(Ordering::Greater, (-2.5_f64).total_cmp(&-f64::MAX)); - assert_eq!(Ordering::Greater, (-1.5_f64).total_cmp(&-2.5)); - assert_eq!(Ordering::Greater, (-1.0_f64).total_cmp(&-1.5)); - assert_eq!(Ordering::Greater, (-0.5_f64).total_cmp(&-1.0)); - assert_eq!(Ordering::Greater, (-f64::MIN_POSITIVE).total_cmp(&-0.5)); - assert_eq!(Ordering::Greater, (-max_subnorm()).total_cmp(&-f64::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, (-min_subnorm()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Greater, (-0.0_f64).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Greater, 0.0_f64.total_cmp(&-0.0)); - assert_eq!(Ordering::Greater, min_subnorm().total_cmp(&0.0)); - assert_eq!(Ordering::Greater, max_subnorm().total_cmp(&min_subnorm())); - assert_eq!(Ordering::Greater, f64::MIN_POSITIVE.total_cmp(&max_subnorm())); - assert_eq!(Ordering::Greater, 0.5_f64.total_cmp(&f64::MIN_POSITIVE)); - assert_eq!(Ordering::Greater, 1.0_f64.total_cmp(&0.5)); - assert_eq!(Ordering::Greater, 1.5_f64.total_cmp(&1.0)); - assert_eq!(Ordering::Greater, 2.5_f64.total_cmp(&1.5)); - assert_eq!(Ordering::Greater, f64::MAX.total_cmp(&2.5)); - assert_eq!(Ordering::Greater, f64::INFINITY.total_cmp(&f64::MAX)); - assert_eq!(Ordering::Greater, s_nan().total_cmp(&f64::INFINITY)); - assert_eq!(Ordering::Greater, q_nan().total_cmp(&s_nan())); - - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-s_nan())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f64::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f64::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-f64::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f64::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f64::MAX)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&f64::INFINITY)); - assert_eq!(Ordering::Less, (-q_nan()).total_cmp(&s_nan())); - - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f64::INFINITY)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f64::MAX)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-2.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-1.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-f64::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-max_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-min_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&-0.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&min_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&max_subnorm())); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f64::MIN_POSITIVE)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&0.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.0)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&1.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&2.5)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f64::MAX)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&f64::INFINITY)); - assert_eq!(Ordering::Less, (-s_nan()).total_cmp(&s_nan())); -} - #[test] fn test_algebraic() { let a: f64 = 123.0; diff --git a/library/coretests/tests/floats/mod.rs b/library/coretests/tests/floats/mod.rs index 43431bba6954..2c2a07920d06 100644 --- a/library/coretests/tests/floats/mod.rs +++ b/library/coretests/tests/floats/mod.rs @@ -2,34 +2,80 @@ use std::num::FpCategory as Fp; use std::ops::{Add, Div, Mul, Rem, Sub}; trait TestableFloat { + /// Unsigned int with the same size, for converting to/from bits. + type Int; /// Set the default tolerance for float comparison based on the type. const APPROX: Self; + const ZERO: Self; + const ONE: Self; const MIN_POSITIVE_NORMAL: Self; const MAX_SUBNORMAL: Self; + /// Smallest number + const TINY: Self; + /// Next smallest number + const TINY_UP: Self; + /// Exponent = 0b11...10, Significand 0b1111..10. Min val > 0 + const MAX_DOWN: Self; + /// First pattern over the mantissa + const NAN_MASK1: Self::Int; + /// Second pattern over the mantissa + const NAN_MASK2: Self::Int; } impl TestableFloat for f16 { + type Int = u16; const APPROX: Self = 1e-3; + const ZERO: Self = 0.0; + const ONE: Self = 1.0; const MIN_POSITIVE_NORMAL: Self = Self::MIN_POSITIVE; const MAX_SUBNORMAL: Self = Self::MIN_POSITIVE.next_down(); + const TINY: Self = Self::from_bits(0x1); + const TINY_UP: Self = Self::from_bits(0x2); + const MAX_DOWN: Self = Self::from_bits(0x7bfe); + const NAN_MASK1: Self::Int = 0x02aa; + const NAN_MASK2: Self::Int = 0x0155; } impl TestableFloat for f32 { + type Int = u32; const APPROX: Self = 1e-6; + const ZERO: Self = 0.0; + const ONE: Self = 1.0; const MIN_POSITIVE_NORMAL: Self = Self::MIN_POSITIVE; const MAX_SUBNORMAL: Self = Self::MIN_POSITIVE.next_down(); + const TINY: Self = Self::from_bits(0x1); + const TINY_UP: Self = Self::from_bits(0x2); + const MAX_DOWN: Self = Self::from_bits(0x7f7f_fffe); + const NAN_MASK1: Self::Int = 0x002a_aaaa; + const NAN_MASK2: Self::Int = 0x0055_5555; } impl TestableFloat for f64 { + type Int = u64; const APPROX: Self = 1e-6; + const ZERO: Self = 0.0; + const ONE: Self = 1.0; const MIN_POSITIVE_NORMAL: Self = Self::MIN_POSITIVE; const MAX_SUBNORMAL: Self = Self::MIN_POSITIVE.next_down(); + const TINY: Self = Self::from_bits(0x1); + const TINY_UP: Self = Self::from_bits(0x2); + const MAX_DOWN: Self = Self::from_bits(0x7fef_ffff_ffff_fffe); + const NAN_MASK1: Self::Int = 0x000a_aaaa_aaaa_aaaa; + const NAN_MASK2: Self::Int = 0x0005_5555_5555_5555; } impl TestableFloat for f128 { + type Int = u128; const APPROX: Self = 1e-9; + const ZERO: Self = 0.0; + const ONE: Self = 1.0; const MIN_POSITIVE_NORMAL: Self = Self::MIN_POSITIVE; const MAX_SUBNORMAL: Self = Self::MIN_POSITIVE.next_down(); + const TINY: Self = Self::from_bits(0x1); + const TINY_UP: Self = Self::from_bits(0x2); + const MAX_DOWN: Self = Self::from_bits(0x7ffefffffffffffffffffffffffffffe); + const NAN_MASK1: Self::Int = 0x0000aaaaaaaaaaaaaaaaaaaaaaaaaaaa; + const NAN_MASK2: Self::Int = 0x00005555555555555555555555555555; } /// Determine the tolerance for values of the argument type. @@ -342,15 +388,14 @@ float_test! { f128: #[cfg(any(miri, target_has_reliable_f128))], }, test { - let zero: Float = 0.0; - assert_biteq!(0.0, zero); - assert!(!zero.is_infinite()); - assert!(zero.is_finite()); - assert!(zero.is_sign_positive()); - assert!(!zero.is_sign_negative()); - assert!(!zero.is_nan()); - assert!(!zero.is_normal()); - assert!(matches!(zero.classify(), Fp::Zero)); + assert_biteq!(0.0, Float::ZERO); + assert!(!Float::ZERO.is_infinite()); + assert!(Float::ZERO.is_finite()); + assert!(Float::ZERO.is_sign_positive()); + assert!(!Float::ZERO.is_sign_negative()); + assert!(!Float::ZERO.is_nan()); + assert!(!Float::ZERO.is_normal()); + assert!(matches!(Float::ZERO.classify(), Fp::Zero)); } } @@ -381,15 +426,14 @@ float_test! { f128: #[cfg(any(miri, target_has_reliable_f128))], }, test { - let one: Float = 1.0; - assert_biteq!(1.0, one); - assert!(!one.is_infinite()); - assert!(one.is_finite()); - assert!(one.is_sign_positive()); - assert!(!one.is_sign_negative()); - assert!(!one.is_nan()); - assert!(one.is_normal()); - assert!(matches!(one.classify(), Fp::Normal)); + assert_biteq!(1.0, Float::ONE); + assert!(!Float::ONE.is_infinite()); + assert!(Float::ONE.is_finite()); + assert!(Float::ONE.is_sign_positive()); + assert!(!Float::ONE.is_sign_negative()); + assert!(!Float::ONE.is_nan()); + assert!(Float::ONE.is_normal()); + assert!(matches!(Float::ONE.classify(), Fp::Normal)); } } @@ -403,11 +447,10 @@ float_test! { let nan: Float = Float::NAN; let inf: Float = Float::INFINITY; let neg_inf: Float = Float::NEG_INFINITY; - let zero: Float = 0.0; let pos: Float = 5.3; let neg: Float = -10.732; assert!(nan.is_nan()); - assert!(!zero.is_nan()); + assert!(!Float::ZERO.is_nan()); assert!(!pos.is_nan()); assert!(!neg.is_nan()); assert!(!inf.is_nan()); @@ -425,13 +468,12 @@ float_test! { let nan: Float = Float::NAN; let inf: Float = Float::INFINITY; let neg_inf: Float = Float::NEG_INFINITY; - let zero: Float = 0.0; let pos: Float = 42.8; let neg: Float = -109.2; assert!(!nan.is_infinite()); assert!(inf.is_infinite()); assert!(neg_inf.is_infinite()); - assert!(!zero.is_infinite()); + assert!(!Float::ZERO.is_infinite()); assert!(!pos.is_infinite()); assert!(!neg.is_infinite()); } @@ -447,13 +489,12 @@ float_test! { let nan: Float = Float::NAN; let inf: Float = Float::INFINITY; let neg_inf: Float = Float::NEG_INFINITY; - let zero: Float = 0.0; let pos: Float = 42.8; let neg: Float = -109.2; assert!(!nan.is_finite()); assert!(!inf.is_finite()); assert!(!neg_inf.is_finite()); - assert!(zero.is_finite()); + assert!(Float::ZERO.is_finite()); assert!(pos.is_finite()); assert!(neg.is_finite()); } @@ -469,15 +510,13 @@ float_test! { let nan: Float = Float::NAN; let inf: Float = Float::INFINITY; let neg_inf: Float = Float::NEG_INFINITY; - let zero: Float = 0.0; let neg_zero: Float = -0.0; - let one : Float = 1.0; assert!(!nan.is_normal()); assert!(!inf.is_normal()); assert!(!neg_inf.is_normal()); - assert!(!zero.is_normal()); + assert!(!Float::ZERO.is_normal()); assert!(!neg_zero.is_normal()); - assert!(one.is_normal()); + assert!(Float::ONE.is_normal()); assert!(Float::MIN_POSITIVE_NORMAL.is_normal()); assert!(!Float::MAX_SUBNORMAL.is_normal()); } @@ -492,15 +531,13 @@ float_test! { let nan: Float = Float::NAN; let inf: Float = Float::INFINITY; let neg_inf: Float = Float::NEG_INFINITY; - let zero: Float = 0.0; let neg_zero: Float = -0.0; - let one: Float = 1.0; assert!(matches!(nan.classify(), Fp::Nan)); assert!(matches!(inf.classify(), Fp::Infinite)); assert!(matches!(neg_inf.classify(), Fp::Infinite)); - assert!(matches!(zero.classify(), Fp::Zero)); + assert!(matches!(Float::ZERO.classify(), Fp::Zero)); assert!(matches!(neg_zero.classify(), Fp::Zero)); - assert!(matches!(one.classify(), Fp::Normal)); + assert!(matches!(Float::ONE.classify(), Fp::Normal)); assert!(matches!(Float::MIN_POSITIVE_NORMAL.classify(), Fp::Normal)); assert!(matches!(Float::MAX_SUBNORMAL.classify(), Fp::Subnormal)); } @@ -720,10 +757,14 @@ float_test! { f128: #[cfg(any(miri, target_has_reliable_f128_math))], }, test { - assert_biteq!((-1.0 as Float).abs(), 1.0); - assert_biteq!((1.0 as Float).abs(), 1.0); - assert_biteq!(Float::NEG_INFINITY.abs(), Float::INFINITY); assert_biteq!(Float::INFINITY.abs(), Float::INFINITY); + assert_biteq!(Float::ONE.abs(), Float::ONE); + assert_biteq!(Float::ZERO.abs(), Float::ZERO); + assert_biteq!((-Float::ZERO).abs(), Float::ZERO); + assert_biteq!((-Float::ONE).abs(), Float::ONE); + assert_biteq!(Float::NEG_INFINITY.abs(), Float::INFINITY); + assert_biteq!((Float::ONE / Float::NEG_INFINITY).abs(), Float::ZERO); + assert!(Float::NAN.abs().is_nan()); } } @@ -951,3 +992,351 @@ float_test! { assert!(Float::NEG_INFINITY.fract().is_nan()); } } + +float_test! { + name: signum, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16_math))], + f128: #[cfg(any(miri, target_has_reliable_f128_math))], + }, + test { + assert_biteq!(Float::INFINITY.signum(), Float::ONE); + assert_biteq!(Float::ONE.signum(), Float::ONE); + assert_biteq!(Float::ZERO.signum(), Float::ONE); + assert_biteq!((-Float::ZERO).signum(), -Float::ONE); + assert_biteq!((-Float::ONE).signum(), -Float::ONE); + assert_biteq!(Float::NEG_INFINITY.signum(), -Float::ONE); + assert_biteq!((Float::ONE / Float::NEG_INFINITY).signum(), -Float::ONE); + assert!(Float::NAN.signum().is_nan()); + } +} + +float_test! { + name: is_sign_positive, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16))], + f128: #[cfg(any(miri, target_has_reliable_f128))], + }, + test { + assert!(Float::INFINITY.is_sign_positive()); + assert!(Float::ONE.is_sign_positive()); + assert!(Float::ZERO.is_sign_positive()); + assert!(!(-Float::ZERO).is_sign_positive()); + assert!(!(-Float::ONE).is_sign_positive()); + assert!(!Float::NEG_INFINITY.is_sign_positive()); + assert!(!(Float::ONE / Float::NEG_INFINITY).is_sign_positive()); + assert!(Float::NAN.is_sign_positive()); + assert!(!(-Float::NAN).is_sign_positive()); + } +} + +float_test! { + name: is_sign_negative, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16))], + f128: #[cfg(any(miri, target_has_reliable_f128))], + }, + test { + assert!(!Float::INFINITY.is_sign_negative()); + assert!(!Float::ONE.is_sign_negative()); + assert!(!Float::ZERO.is_sign_negative()); + assert!((-Float::ZERO).is_sign_negative()); + assert!((-Float::ONE).is_sign_negative()); + assert!(Float::NEG_INFINITY.is_sign_negative()); + assert!((Float::ONE / Float::NEG_INFINITY).is_sign_negative()); + assert!(!Float::NAN.is_sign_negative()); + assert!((-Float::NAN).is_sign_negative()); + } +} + +float_test! { + name: next_up, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16))], + f128: #[cfg(any(miri, target_has_reliable_f128))], + }, + test { + assert_biteq!(Float::NEG_INFINITY.next_up(), Float::MIN); + assert_biteq!(Float::MIN.next_up(), -Float::MAX_DOWN); + assert_biteq!((-Float::ONE - Float::EPSILON).next_up(), -Float::ONE); + assert_biteq!((-Float::MIN_POSITIVE_NORMAL).next_up(), -Float::MAX_SUBNORMAL); + assert_biteq!((-Float::TINY_UP).next_up(), -Float::TINY); + assert_biteq!((-Float::TINY).next_up(), -Float::ZERO); + assert_biteq!((-Float::ZERO).next_up(), Float::TINY); + assert_biteq!(Float::ZERO.next_up(), Float::TINY); + assert_biteq!(Float::TINY.next_up(), Float::TINY_UP); + assert_biteq!(Float::MAX_SUBNORMAL.next_up(), Float::MIN_POSITIVE_NORMAL); + assert_biteq!(Float::ONE.next_up(), 1.0 + Float::EPSILON); + assert_biteq!(Float::MAX.next_up(), Float::INFINITY); + assert_biteq!(Float::INFINITY.next_up(), Float::INFINITY); + + // Check that NaNs roundtrip. + let nan0 = Float::NAN; + let nan1 = Float::from_bits(Float::NAN.to_bits() ^ Float::NAN_MASK1); + let nan2 = Float::from_bits(Float::NAN.to_bits() ^ Float::NAN_MASK2); + assert_biteq!(nan0.next_up(), nan0); + assert_biteq!(nan1.next_up(), nan1); + assert_biteq!(nan2.next_up(), nan2); + } +} + +float_test! { + name: next_down, + attrs: { + f16: #[cfg(any(miri, target_has_reliable_f16))], + f128: #[cfg(any(miri, target_has_reliable_f128))], + }, + test { + assert_biteq!(Float::NEG_INFINITY.next_down(), Float::NEG_INFINITY); + assert_biteq!(Float::MIN.next_down(), Float::NEG_INFINITY); + assert_biteq!((-Float::MAX_DOWN).next_down(), Float::MIN); + assert_biteq!((-Float::ONE).next_down(), -1.0 - Float::EPSILON); + assert_biteq!((-Float::MAX_SUBNORMAL).next_down(), -Float::MIN_POSITIVE_NORMAL); + assert_biteq!((-Float::TINY).next_down(), -Float::TINY_UP); + assert_biteq!((-Float::ZERO).next_down(), -Float::TINY); + assert_biteq!((Float::ZERO).next_down(), -Float::TINY); + assert_biteq!(Float::TINY.next_down(), Float::ZERO); + assert_biteq!(Float::TINY_UP.next_down(), Float::TINY); + assert_biteq!(Float::MIN_POSITIVE_NORMAL.next_down(), Float::MAX_SUBNORMAL); + assert_biteq!((1.0 + Float::EPSILON).next_down(), Float::ONE); + assert_biteq!(Float::MAX.next_down(), Float::MAX_DOWN); + assert_biteq!(Float::INFINITY.next_down(), Float::MAX); + + // Check that NaNs roundtrip. + let nan0 = Float::NAN; + let nan1 = Float::from_bits(Float::NAN.to_bits() ^ Float::NAN_MASK1); + let nan2 = Float::from_bits(Float::NAN.to_bits() ^ Float::NAN_MASK2); + assert_biteq!(nan0.next_down(), nan0); + assert_biteq!(nan1.next_down(), nan1); + assert_biteq!(nan2.next_down(), nan2); + } +} + +// FIXME(f16_f128,miri): many of these have to be disabled since miri does not yet support +// the intrinsics. + +float_test! { + name: sqrt_domain, + attrs: { + const: #[cfg(false)], + f16: #[cfg(all(not(miri), target_has_reliable_f16_math))], + f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], + }, + test { + assert!(Float::NAN.sqrt().is_nan()); + assert!(Float::NEG_INFINITY.sqrt().is_nan()); + assert!((-Float::ONE).sqrt().is_nan()); + assert_biteq!((-Float::ZERO).sqrt(), -Float::ZERO); + assert_biteq!(Float::ZERO.sqrt(), Float::ZERO); + assert_biteq!(Float::ONE.sqrt(), Float::ONE); + assert_biteq!(Float::INFINITY.sqrt(), Float::INFINITY); + } +} + +float_test! { + name: clamp_min_greater_than_max, + attrs: { + const: #[cfg(false)], + f16: #[should_panic, cfg(any(miri, target_has_reliable_f16))], + f32: #[should_panic], + f64: #[should_panic], + f128: #[should_panic, cfg(any(miri, target_has_reliable_f128))], + }, + test { + let _ = Float::ONE.clamp(3.0, 1.0); + } +} + +float_test! { + name: clamp_min_is_nan, + attrs: { + const: #[cfg(false)], + f16: #[should_panic, cfg(any(miri, target_has_reliable_f16))], + f32: #[should_panic], + f64: #[should_panic], + f128: #[should_panic, cfg(any(miri, target_has_reliable_f128))], + }, + test { + let _ = Float::ONE.clamp(Float::NAN, 1.0); + } +} + +float_test! { + name: clamp_max_is_nan, + attrs: { + const: #[cfg(false)], + f16: #[should_panic, cfg(any(miri, target_has_reliable_f16))], + f32: #[should_panic], + f64: #[should_panic], + f128: #[should_panic, cfg(any(miri, target_has_reliable_f128))], + }, + test { + let _ = Float::ONE.clamp(3.0, Float::NAN); + } +} + +float_test! { + name: total_cmp, + attrs: { + const: #[cfg(false)], + f16: #[cfg(all(not(miri), target_has_reliable_f16_math))], + f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], + }, + test { + use core::cmp::Ordering; + + fn quiet_bit_mask() -> ::Int { + 1 << (Float::MANTISSA_DIGITS - 2) + } + + fn q_nan() -> Float { + Float::from_bits(Float::NAN.to_bits() | quiet_bit_mask()) + } + + assert_eq!(Ordering::Equal, Float::total_cmp(&-q_nan(), &-q_nan())); + assert_eq!(Ordering::Equal, Float::total_cmp(&-Float::INFINITY, &-Float::INFINITY)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-Float::MAX, &-Float::MAX)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-2.5, &-2.5)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-1.0, &-1.0)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-1.5, &-1.5)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-0.5, &-0.5)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-Float::MIN_POSITIVE, &-Float::MIN_POSITIVE)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-Float::MAX_SUBNORMAL, &-Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-Float::TINY, &-Float::TINY)); + assert_eq!(Ordering::Equal, Float::total_cmp(&-0.0, &-0.0)); + assert_eq!(Ordering::Equal, Float::total_cmp(&0.0, &0.0)); + assert_eq!(Ordering::Equal, Float::total_cmp(&Float::TINY, &Float::TINY)); + assert_eq!(Ordering::Equal, Float::total_cmp(&Float::MAX_SUBNORMAL, &Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Equal, Float::total_cmp(&Float::MIN_POSITIVE, &Float::MIN_POSITIVE)); + assert_eq!(Ordering::Equal, Float::total_cmp(&0.5, &0.5)); + assert_eq!(Ordering::Equal, Float::total_cmp(&1.0, &1.0)); + assert_eq!(Ordering::Equal, Float::total_cmp(&1.5, &1.5)); + assert_eq!(Ordering::Equal, Float::total_cmp(&2.5, &2.5)); + assert_eq!(Ordering::Equal, Float::total_cmp(&Float::MAX, &Float::MAX)); + assert_eq!(Ordering::Equal, Float::total_cmp(&Float::INFINITY, &Float::INFINITY)); + assert_eq!(Ordering::Equal, Float::total_cmp(&q_nan(), &q_nan())); + + assert_eq!(Ordering::Less, Float::total_cmp(&-Float::INFINITY, &-Float::MAX)); + assert_eq!(Ordering::Less, Float::total_cmp(&-Float::MAX, &-2.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-2.5, &-1.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-1.5, &-1.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-1.0, &-0.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-0.5, &-Float::MIN_POSITIVE)); + assert_eq!(Ordering::Less, Float::total_cmp(&-Float::MIN_POSITIVE, &-Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Less, Float::total_cmp(&-Float::MAX_SUBNORMAL, &-Float::TINY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-Float::TINY, &-0.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-0.0, &0.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&0.0, &Float::TINY)); + assert_eq!(Ordering::Less, Float::total_cmp(&Float::TINY, &Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Less, Float::total_cmp(&Float::MAX_SUBNORMAL, &Float::MIN_POSITIVE)); + assert_eq!(Ordering::Less, Float::total_cmp(&Float::MIN_POSITIVE, &0.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&0.5, &1.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&1.0, &1.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&1.5, &2.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&2.5, &Float::MAX)); + assert_eq!(Ordering::Less, Float::total_cmp(&Float::MAX, &Float::INFINITY)); + + assert_eq!(Ordering::Greater, Float::total_cmp(&-Float::MAX, &-Float::INFINITY)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-2.5, &-Float::MAX)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-1.5, &-2.5)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-1.0, &-1.5)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-0.5, &-1.0)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-Float::MIN_POSITIVE, &-0.5)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-Float::MAX_SUBNORMAL, &-Float::MIN_POSITIVE)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-Float::TINY, &-Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Greater, Float::total_cmp(&-0.0, &-Float::TINY)); + assert_eq!(Ordering::Greater, Float::total_cmp(&0.0, &-0.0)); + assert_eq!(Ordering::Greater, Float::total_cmp(&Float::TINY, &0.0)); + assert_eq!(Ordering::Greater, Float::total_cmp(&Float::MAX_SUBNORMAL, &Float::TINY)); + assert_eq!(Ordering::Greater, Float::total_cmp(&Float::MIN_POSITIVE, &Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Greater, Float::total_cmp(&0.5, &Float::MIN_POSITIVE)); + assert_eq!(Ordering::Greater, Float::total_cmp(&1.0, &0.5)); + assert_eq!(Ordering::Greater, Float::total_cmp(&1.5, &1.0)); + assert_eq!(Ordering::Greater, Float::total_cmp(&2.5, &1.5)); + assert_eq!(Ordering::Greater, Float::total_cmp(&Float::MAX, &2.5)); + assert_eq!(Ordering::Greater, Float::total_cmp(&Float::INFINITY, &Float::MAX)); + + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-Float::INFINITY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-Float::MAX)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-2.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-1.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-1.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-0.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-Float::MIN_POSITIVE)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-Float::TINY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-0.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &0.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &Float::TINY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &Float::MIN_POSITIVE)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &0.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &1.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &1.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &2.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &Float::MAX)); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &Float::INFINITY)); + + } +} + +// FIXME(f16): Tests involving sNaN are disabled because without optimizations, `total_cmp` is +// getting incorrectly lowered to code that includes a `extend`/`trunc` round trip, which quiets +// sNaNs. See: https://github.com/llvm/llvm-project/issues/104915 + +float_test! { + name: total_cmp_s_nan, + attrs: { + const: #[cfg(false)], + f16: #[cfg(false)], + f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], + }, + test { + use core::cmp::Ordering; + + fn quiet_bit_mask() -> ::Int { + 1 << (Float::MANTISSA_DIGITS - 2) + } + + fn q_nan() -> Float { + Float::from_bits(Float::NAN.to_bits() | quiet_bit_mask()) + } + + fn s_nan() -> Float { + Float::from_bits((Float::NAN.to_bits() & !quiet_bit_mask()) + 42) + } + assert_eq!(Ordering::Equal, Float::total_cmp(&-s_nan(), &-s_nan())); + assert_eq!(Ordering::Equal, Float::total_cmp(&s_nan(), &s_nan())); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-s_nan())); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-Float::INFINITY)); + assert_eq!(Ordering::Less, Float::total_cmp(&Float::INFINITY, &s_nan())); + assert_eq!(Ordering::Less, Float::total_cmp(&s_nan(), &q_nan())); + assert_eq!(Ordering::Greater, Float::total_cmp(&-s_nan(), &-q_nan())); + assert_eq!(Ordering::Greater, Float::total_cmp(&-Float::INFINITY, &-s_nan())); + assert_eq!(Ordering::Greater, Float::total_cmp(&s_nan(), &Float::INFINITY)); + assert_eq!(Ordering::Greater, Float::total_cmp(&q_nan(), &s_nan())); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &-s_nan())); + assert_eq!(Ordering::Less, Float::total_cmp(&-q_nan(), &s_nan())); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-Float::INFINITY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-Float::MAX)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-2.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-1.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-1.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-0.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-Float::MIN_POSITIVE)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-Float::TINY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &-0.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &0.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &Float::TINY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &Float::MAX_SUBNORMAL)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &Float::MIN_POSITIVE)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &0.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &1.0)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &1.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &2.5)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &Float::MAX)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &Float::INFINITY)); + assert_eq!(Ordering::Less, Float::total_cmp(&-s_nan(), &s_nan())); + } +} diff --git a/library/coretests/tests/lib.rs b/library/coretests/tests/lib.rs index c5bfd1574e29..0c4d49f3c994 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -2,7 +2,6 @@ #![cfg_attr(target_has_atomic = "128", feature(integer_atomics))] #![cfg_attr(test, feature(cfg_select))] #![feature(alloc_layout_extra)] -#![feature(array_chunks)] #![feature(array_ptr_get)] #![feature(array_try_from_fn)] #![feature(array_windows)] @@ -19,9 +18,13 @@ #![feature(const_deref)] #![feature(const_destruct)] #![feature(const_eval_select)] +#![feature(const_from)] #![feature(const_ops)] +#![feature(const_option_ops)] #![feature(const_ref_cell)] +#![feature(const_result_trait_fn)] #![feature(const_trait_impl)] +#![feature(control_flow_ok)] #![feature(core_float_math)] #![feature(core_intrinsics)] #![feature(core_intrinsics_fallbacks)] @@ -30,9 +33,9 @@ #![feature(core_private_diy_float)] #![feature(cstr_display)] #![feature(dec2flt)] +#![feature(drop_guard)] #![feature(duration_constants)] #![feature(duration_constructors)] -#![feature(duration_constructors_lite)] #![feature(error_generic_member_access)] #![feature(exact_div)] #![feature(exact_size_is_empty)] @@ -82,6 +85,7 @@ #![feature(pointer_is_aligned_to)] #![feature(portable_simd)] #![feature(ptr_metadata)] +#![feature(result_option_map_or_default)] #![feature(slice_from_ptr_range)] #![feature(slice_internals)] #![feature(slice_partition_dedup)] diff --git a/library/coretests/tests/mem.rs b/library/coretests/tests/mem.rs index 9c15be4a8c4b..e896c61ef488 100644 --- a/library/coretests/tests/mem.rs +++ b/library/coretests/tests/mem.rs @@ -1,5 +1,6 @@ use core::mem::*; use core::{array, ptr}; +use std::cell::Cell; #[cfg(panic = "unwind")] use std::rc::Rc; @@ -795,3 +796,48 @@ fn const_maybe_uninit_zeroed() { assert_eq!(unsafe { (*UNINIT.0.cast::<[[u8; SIZE]; 1]>())[0] }, [0u8; SIZE]); } + +#[test] +fn drop_guards_only_dropped_by_closure_when_run() { + let value_drops = Cell::new(0); + let value = DropGuard::new((), |()| value_drops.set(1 + value_drops.get())); + let closure_drops = Cell::new(0); + let guard = DropGuard::new(value, |_| closure_drops.set(1 + closure_drops.get())); + assert_eq!(value_drops.get(), 0); + assert_eq!(closure_drops.get(), 0); + drop(guard); + assert_eq!(value_drops.get(), 1); + assert_eq!(closure_drops.get(), 1); +} + +#[test] +fn drop_guard_into_inner() { + let dropped = Cell::new(false); + let value = DropGuard::new(42, |_| dropped.set(true)); + let guard = DropGuard::new(value, |_| dropped.set(true)); + let inner = DropGuard::into_inner(guard); + assert_eq!(dropped.get(), false); + assert_eq!(*inner, 42); +} + +#[test] +#[cfg(panic = "unwind")] +fn drop_guard_always_drops_value_if_closure_drop_unwinds() { + // Create a value with a destructor, which we will validate ran successfully. + let mut value_was_dropped = false; + let value_with_tracked_destruction = DropGuard::new((), |_| value_was_dropped = true); + + // Create a closure that will begin unwinding when dropped. + let drop_bomb = DropGuard::new((), |_| panic!()); + let closure_that_panics_on_drop = move |_| { + let _drop_bomb = drop_bomb; + }; + + // This will run the closure, which will panic when dropped. This should + // run the destructor of the value we passed, which we validate. + let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { + let guard = DropGuard::new(value_with_tracked_destruction, closure_that_panics_on_drop); + DropGuard::into_inner(guard); + })); + assert!(value_was_dropped); +} diff --git a/library/coretests/tests/nonzero.rs b/library/coretests/tests/nonzero.rs index 00232c9b7061..eb06c34fd020 100644 --- a/library/coretests/tests/nonzero.rs +++ b/library/coretests/tests/nonzero.rs @@ -214,13 +214,11 @@ fn nonzero_const() { const ONE: Option> = NonZero::new(1); assert!(ONE.is_some()); - /* FIXME(#110395) const FROM_NONZERO_U8: u8 = u8::from(NONZERO_U8); assert_eq!(FROM_NONZERO_U8, 5); const NONZERO_CONVERT: NonZero = NonZero::::from(NONZERO_U8); assert_eq!(NONZERO_CONVERT.get(), 5); - */ } #[test] @@ -321,7 +319,7 @@ fn nonzero_trailing_zeros() { } #[test] -fn test_nonzero_isolate_most_significant_one() { +fn test_nonzero_isolate_highest_one() { // Signed most significant one macro_rules! nonzero_int_impl { ($($T:ty),+) => { @@ -335,8 +333,8 @@ fn test_nonzero_isolate_most_significant_one() { let mut i = 0; while i < <$T>::BITS { assert_eq!( - NonZero::<$T>::new(BITS >> i).unwrap().isolate_most_significant_one(), - NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_most_significant_one() + NonZero::<$T>::new(BITS >> i).unwrap().isolate_highest_one(), + NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_highest_one() ); i += 1; } @@ -356,8 +354,8 @@ fn test_nonzero_isolate_most_significant_one() { let mut i = 0; while i < <$T>::BITS { assert_eq!( - NonZero::<$T>::new(BITS >> i).unwrap().isolate_most_significant_one(), - NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_most_significant_one(), + NonZero::<$T>::new(BITS >> i).unwrap().isolate_highest_one(), + NonZero::<$T>::new(MOST_SIG_ONE >> i).unwrap().isolate_highest_one(), ); i += 1; } @@ -371,7 +369,7 @@ fn test_nonzero_isolate_most_significant_one() { } #[test] -fn test_nonzero_isolate_least_significant_one() { +fn test_nonzero_isolate_lowest_one() { // Signed least significant one macro_rules! nonzero_int_impl { ($($T:ty),+) => { @@ -385,8 +383,8 @@ fn test_nonzero_isolate_least_significant_one() { let mut i = 0; while i < <$T>::BITS { assert_eq!( - NonZero::<$T>::new(BITS << i).unwrap().isolate_least_significant_one(), - NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_least_significant_one() + NonZero::<$T>::new(BITS << i).unwrap().isolate_lowest_one(), + NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_lowest_one() ); i += 1; } @@ -406,8 +404,8 @@ fn test_nonzero_isolate_least_significant_one() { let mut i = 0; while i < <$T>::BITS { assert_eq!( - NonZero::<$T>::new(BITS << i).unwrap().isolate_least_significant_one(), - NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_least_significant_one(), + NonZero::<$T>::new(BITS << i).unwrap().isolate_lowest_one(), + NonZero::<$T>::new(LEAST_SIG_ONE << i).unwrap().isolate_lowest_one(), ); i += 1; } diff --git a/library/coretests/tests/num/const_from.rs b/library/coretests/tests/num/const_from.rs index fa58e7718791..aca18ef39de1 100644 --- a/library/coretests/tests/num/const_from.rs +++ b/library/coretests/tests/num/const_from.rs @@ -1,4 +1,3 @@ -/* FIXME(#110395) #[test] fn from() { use core::convert::TryFrom; @@ -24,4 +23,3 @@ fn from() { const I16_FROM_U16: Result = i16::try_from(1u16); assert_eq!(I16_FROM_U16, Ok(1i16)); } -*/ diff --git a/library/coretests/tests/num/int_macros.rs b/library/coretests/tests/num/int_macros.rs index 41d399c1ad9f..ca32fce861f8 100644 --- a/library/coretests/tests/num/int_macros.rs +++ b/library/coretests/tests/num/int_macros.rs @@ -194,7 +194,7 @@ macro_rules! int_module { } #[test] - fn test_isolate_most_significant_one() { + fn test_isolate_highest_one() { const BITS: $T = -1; const MOST_SIG_ONE: $T = 1 << (<$T>::BITS - 1); @@ -203,15 +203,15 @@ macro_rules! int_module { let mut i = 0; while i < <$T>::BITS { assert_eq!( - (BITS >> i).isolate_most_significant_one(), - (MOST_SIG_ONE >> i).isolate_most_significant_one() + (BITS >> i).isolate_highest_one(), + (MOST_SIG_ONE >> i).isolate_highest_one() ); i += 1; } } #[test] - fn test_isolate_least_significant_one() { + fn test_isolate_lowest_one() { const BITS: $T = -1; const LEAST_SIG_ONE: $T = 1; @@ -220,8 +220,8 @@ macro_rules! int_module { let mut i = 0; while i < <$T>::BITS { assert_eq!( - (BITS << i).isolate_least_significant_one(), - (LEAST_SIG_ONE << i).isolate_least_significant_one() + (BITS << i).isolate_lowest_one(), + (LEAST_SIG_ONE << i).isolate_lowest_one() ); i += 1; } diff --git a/library/coretests/tests/num/uint_macros.rs b/library/coretests/tests/num/uint_macros.rs index 7e02027bdd6a..8f389de70aa2 100644 --- a/library/coretests/tests/num/uint_macros.rs +++ b/library/coretests/tests/num/uint_macros.rs @@ -151,7 +151,7 @@ macro_rules! uint_module { } #[test] - fn test_isolate_most_significant_one() { + fn test_isolate_highest_one() { const BITS: $T = <$T>::MAX; const MOST_SIG_ONE: $T = 1 << (<$T>::BITS - 1); @@ -160,15 +160,15 @@ macro_rules! uint_module { let mut i = 0; while i < <$T>::BITS { assert_eq!( - (BITS >> i).isolate_most_significant_one(), - (MOST_SIG_ONE >> i).isolate_most_significant_one(), + (BITS >> i).isolate_highest_one(), + (MOST_SIG_ONE >> i).isolate_highest_one(), ); i += 1; } } #[test] - fn test_isolate_least_significant_one() { + fn test_isolate_lowest_one() { const BITS: $T = <$T>::MAX; const LEAST_SIG_ONE: $T = 1; @@ -177,8 +177,8 @@ macro_rules! uint_module { let mut i = 0; while i < <$T>::BITS { assert_eq!( - (BITS << i).isolate_least_significant_one(), - (LEAST_SIG_ONE << i).isolate_least_significant_one(), + (BITS << i).isolate_lowest_one(), + (LEAST_SIG_ONE << i).isolate_lowest_one(), ); i += 1; } diff --git a/library/coretests/tests/ops/control_flow.rs b/library/coretests/tests/ops/control_flow.rs index eacfd63a6c48..1df6599ac4a5 100644 --- a/library/coretests/tests/ops/control_flow.rs +++ b/library/coretests/tests/ops/control_flow.rs @@ -16,3 +16,15 @@ fn control_flow_discriminants_match_result() { discriminant_value(&Result::::Ok(3)), ); } + +#[test] +fn control_flow_break_ok() { + assert_eq!(ControlFlow::::Break('b').break_ok(), Ok('b')); + assert_eq!(ControlFlow::::Continue(3).break_ok(), Err(3)); +} + +#[test] +fn control_flow_continue_ok() { + assert_eq!(ControlFlow::::Break('b').continue_ok(), Err('b')); + assert_eq!(ControlFlow::::Continue(3).continue_ok(), Ok(3)); +} diff --git a/library/coretests/tests/option.rs b/library/coretests/tests/option.rs index 336a79a02cee..fc0f82ad6bb3 100644 --- a/library/coretests/tests/option.rs +++ b/library/coretests/tests/option.rs @@ -87,7 +87,6 @@ fn test_and() { assert_eq!(x.and(Some(2)), None); assert_eq!(x.and(None::), None); - /* FIXME(#110395) const FOO: Option = Some(1); const A: Option = FOO.and(Some(2)); const B: Option = FOO.and(None); @@ -99,7 +98,6 @@ fn test_and() { const D: Option = BAR.and(None); assert_eq!(C, None); assert_eq!(D, None); - */ } #[test] diff --git a/library/coretests/tests/panic/location.rs b/library/coretests/tests/panic/location.rs index 5ce0b06e90e1..910001bcc1c5 100644 --- a/library/coretests/tests/panic/location.rs +++ b/library/coretests/tests/panic/location.rs @@ -3,6 +3,23 @@ use core::panic::Location; // Note: Some of the following tests depend on the source location, // so please be careful when editing this file. +mod file_a; +mod file_b; +mod file_c; + +// A small shuffled set of locations for testing, along with their true order. +const LOCATIONS: [(usize, &'static Location<'_>); 9] = [ + (7, file_c::two()), + (0, file_a::one()), + (3, file_b::one()), + (5, file_b::three()), + (8, file_c::three()), + (6, file_c::one()), + (2, file_a::three()), + (4, file_b::two()), + (1, file_a::two()), +]; + #[test] fn location_const_caller() { const _CALLER_REFERENCE: &Location<'static> = Location::caller(); @@ -20,7 +37,7 @@ fn location_const_file() { fn location_const_line() { const CALLER: &Location<'static> = Location::caller(); const LINE: u32 = CALLER.line(); - assert_eq!(LINE, 21); + assert_eq!(LINE, 38); } #[test] @@ -34,6 +51,28 @@ fn location_const_column() { fn location_debug() { let f = format!("{:?}", Location::caller()); assert!(f.contains(&format!("{:?}", file!()))); - assert!(f.contains("35")); + assert!(f.contains("52")); assert!(f.contains("29")); } + +#[test] +fn location_eq() { + for (i, a) in LOCATIONS { + for (j, b) in LOCATIONS { + if i == j { + assert_eq!(a, b); + } else { + assert_ne!(a, b); + } + } + } +} + +#[test] +fn location_ord() { + let mut locations = LOCATIONS.clone(); + locations.sort_by_key(|(_o, l)| **l); + for (correct, (order, _l)) in locations.iter().enumerate() { + assert_eq!(correct, *order); + } +} diff --git a/library/coretests/tests/panic/location/file_a.rs b/library/coretests/tests/panic/location/file_a.rs new file mode 100644 index 000000000000..1ceb225ee9c3 --- /dev/null +++ b/library/coretests/tests/panic/location/file_a.rs @@ -0,0 +1,15 @@ +use core::panic::Location; + +// Used for test super::location_{ord, eq}. Must be in a dedicated file. + +pub const fn one() -> &'static Location<'static> { + Location::caller() +} + +pub const fn two() -> &'static Location<'static> { + Location::caller() +} + +pub const fn three() -> &'static Location<'static> { + Location::caller() +} diff --git a/library/coretests/tests/panic/location/file_b.rs b/library/coretests/tests/panic/location/file_b.rs new file mode 100644 index 000000000000..1ceb225ee9c3 --- /dev/null +++ b/library/coretests/tests/panic/location/file_b.rs @@ -0,0 +1,15 @@ +use core::panic::Location; + +// Used for test super::location_{ord, eq}. Must be in a dedicated file. + +pub const fn one() -> &'static Location<'static> { + Location::caller() +} + +pub const fn two() -> &'static Location<'static> { + Location::caller() +} + +pub const fn three() -> &'static Location<'static> { + Location::caller() +} diff --git a/library/coretests/tests/panic/location/file_c.rs b/library/coretests/tests/panic/location/file_c.rs new file mode 100644 index 000000000000..2ac416c19cf4 --- /dev/null +++ b/library/coretests/tests/panic/location/file_c.rs @@ -0,0 +1,11 @@ +// Used for test super::location_{ord, eq}. Must be in a dedicated file. + +// This is used for testing column ordering of Location, hence this ugly one-liner. +// We must fmt skip the entire containing module or else tidy will still complain. +#[rustfmt::skip] +mod no_fmt { + use core::panic::Location; + pub const fn one() -> &'static Location<'static> { Location::caller() } pub const fn two() -> &'static Location<'static> { Location::caller() } pub const fn three() -> &'static Location<'static> { Location::caller() } +} + +pub use no_fmt::*; diff --git a/library/coretests/tests/result.rs b/library/coretests/tests/result.rs index 90ec844bc577..39898d5dbb76 100644 --- a/library/coretests/tests/result.rs +++ b/library/coretests/tests/result.rs @@ -421,3 +421,86 @@ fn result_try_trait_v2_branch() { assert_eq!(Ok::, ()>(one).branch(), Continue(one)); assert_eq!(Err::, ()>(()).branch(), Break(Err(()))); } + +// helper functions for const contexts +const fn eq10(x: u8) -> bool { + x == 10 +} +const fn eq20(e: u8) -> bool { + e == 20 +} +const fn double_u16(x: u8) -> u16 { + x as u16 * 2 +} +const fn to_u16(x: u8) -> u16 { + x as u16 +} +const fn err_to_u16_plus1(e: u8) -> u16 { + e as u16 + 1 +} +const fn inc_u8(x: u8) -> u8 { + x + 1 +} +const fn noop_u8_ref(_x: &u8) {} +const fn add1_result(x: u8) -> Result { + Ok(x + 1) +} +const fn add5_result(e: u8) -> Result { + Ok(e + 5) +} +const fn plus7_u8(e: u8) -> u8 { + e + 7 +} + +#[test] +fn test_const_result() { + const { + let r_ok: Result = Ok(10); + let r_err: Result = Err(20); + assert!(r_ok.is_ok()); + assert!(r_err.is_err()); + + let ok_and = r_ok.is_ok_and(eq10); + let err_and = r_err.is_err_and(eq20); + assert!(ok_and); + assert!(err_and); + + let opt_ok: Option = r_ok.ok(); + let opt_err: Option = r_err.err(); + assert!(opt_ok.unwrap() == 10); + assert!(opt_err.unwrap() == 20); + + let mapped: Result = r_ok.map(double_u16); + let map_or: u16 = r_ok.map_or(0, to_u16); + let map_or_else: u16 = r_err.map_or_else(err_to_u16_plus1, to_u16); + let map_or_default: u8 = r_err.map_or_default(inc_u8); + assert!(mapped.unwrap_or_default() == 20); + assert!(map_or == 10); + assert!(map_or_else == 21); + assert!(map_or_default == 0); + + let _map_err: Result = r_err.map_err(to_u16); + //FIXME: currently can't unwrap const error + // assert!(map_err.unwrap_err() == 20); + + let inspected_ok: Result = r_ok.inspect(noop_u8_ref); + let inspected_err: Result = r_err.inspect_err(noop_u8_ref); + assert!(inspected_ok.is_ok()); + assert!(inspected_err.is_err()); + + let unwrapped_default: u8 = r_err.unwrap_or_default(); + assert!(unwrapped_default == 0); + + let and_then: Result = r_ok.and_then(add1_result); + let or: Result = r_err.or(Ok(5)); + let or_else: Result = r_err.or_else(add5_result); + assert!(and_then.unwrap_or_default() == 11); + assert!(or.unwrap_or_default() == 5); + assert!(or_else.unwrap_or_default() == 25); + + let u_or: u8 = r_err.unwrap_or(7); + let u_or_else: u8 = r_err.unwrap_or_else(plus7_u8); + assert!(u_or == 7); + assert!(u_or_else == 27); + }; +} diff --git a/library/coretests/tests/slice.rs b/library/coretests/tests/slice.rs index d17e681480c7..992f24cb18f2 100644 --- a/library/coretests/tests/slice.rs +++ b/library/coretests/tests/slice.rs @@ -611,190 +611,6 @@ fn test_chunks_exact_mut_zip() { assert_eq!(v1, [13, 14, 19, 20, 4]); } -#[test] -fn test_array_chunks_infer() { - let v: &[i32] = &[0, 1, 2, 3, 4, -4]; - let c = v.array_chunks(); - for &[a, b, c] in c { - assert_eq!(a + b + c, 3); - } - - let v2: &[i32] = &[0, 1, 2, 3, 4, 5, 6]; - let total = v2.array_chunks().map(|&[a, b]| a * b).sum::(); - assert_eq!(total, 2 * 3 + 4 * 5); -} - -#[test] -fn test_array_chunks_count() { - let v: &[i32] = &[0, 1, 2, 3, 4, 5]; - let c = v.array_chunks::<3>(); - assert_eq!(c.count(), 2); - - let v2: &[i32] = &[0, 1, 2, 3, 4]; - let c2 = v2.array_chunks::<2>(); - assert_eq!(c2.count(), 2); - - let v3: &[i32] = &[]; - let c3 = v3.array_chunks::<2>(); - assert_eq!(c3.count(), 0); -} - -#[test] -fn test_array_chunks_nth() { - let v: &[i32] = &[0, 1, 2, 3, 4, 5]; - let mut c = v.array_chunks::<2>(); - assert_eq!(c.nth(1).unwrap(), &[2, 3]); - assert_eq!(c.next().unwrap(), &[4, 5]); - - let v2: &[i32] = &[0, 1, 2, 3, 4, 5, 6]; - let mut c2 = v2.array_chunks::<3>(); - assert_eq!(c2.nth(1).unwrap(), &[3, 4, 5]); - assert_eq!(c2.next(), None); -} - -#[test] -fn test_array_chunks_nth_back() { - let v: &[i32] = &[0, 1, 2, 3, 4, 5]; - let mut c = v.array_chunks::<2>(); - assert_eq!(c.nth_back(1).unwrap(), &[2, 3]); - assert_eq!(c.next().unwrap(), &[0, 1]); - assert_eq!(c.next(), None); - - let v2: &[i32] = &[0, 1, 2, 3, 4]; - let mut c2 = v2.array_chunks::<3>(); - assert_eq!(c2.nth_back(0).unwrap(), &[0, 1, 2]); - assert_eq!(c2.next(), None); - assert_eq!(c2.next_back(), None); - - let v3: &[i32] = &[0, 1, 2, 3, 4]; - let mut c3 = v3.array_chunks::<10>(); - assert_eq!(c3.nth_back(0), None); -} - -#[test] -fn test_array_chunks_last() { - let v: &[i32] = &[0, 1, 2, 3, 4, 5]; - let c = v.array_chunks::<2>(); - assert_eq!(c.last().unwrap(), &[4, 5]); - - let v2: &[i32] = &[0, 1, 2, 3, 4]; - let c2 = v2.array_chunks::<2>(); - assert_eq!(c2.last().unwrap(), &[2, 3]); -} - -#[test] -fn test_array_chunks_remainder() { - let v: &[i32] = &[0, 1, 2, 3, 4]; - let c = v.array_chunks::<2>(); - assert_eq!(c.remainder(), &[4]); -} - -#[test] -fn test_array_chunks_zip() { - let v1: &[i32] = &[0, 1, 2, 3, 4]; - let v2: &[i32] = &[6, 7, 8, 9, 10]; - - let res = v1 - .array_chunks::<2>() - .zip(v2.array_chunks::<2>()) - .map(|(a, b)| a.iter().sum::() + b.iter().sum::()) - .collect::>(); - assert_eq!(res, vec![14, 22]); -} - -#[test] -fn test_array_chunks_mut_infer() { - let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5, 6]; - for a in v.array_chunks_mut() { - let sum = a.iter().sum::(); - *a = [sum; 3]; - } - assert_eq!(v, &[3, 3, 3, 12, 12, 12, 6]); - - let v2: &mut [i32] = &mut [0, 1, 2, 3, 4, 5, 6]; - v2.array_chunks_mut().for_each(|[a, b]| core::mem::swap(a, b)); - assert_eq!(v2, &[1, 0, 3, 2, 5, 4, 6]); -} - -#[test] -fn test_array_chunks_mut_count() { - let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; - let c = v.array_chunks_mut::<3>(); - assert_eq!(c.count(), 2); - - let v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; - let c2 = v2.array_chunks_mut::<2>(); - assert_eq!(c2.count(), 2); - - let v3: &mut [i32] = &mut []; - let c3 = v3.array_chunks_mut::<2>(); - assert_eq!(c3.count(), 0); -} - -#[test] -fn test_array_chunks_mut_nth() { - let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; - let mut c = v.array_chunks_mut::<2>(); - assert_eq!(c.nth(1).unwrap(), &[2, 3]); - assert_eq!(c.next().unwrap(), &[4, 5]); - - let v2: &mut [i32] = &mut [0, 1, 2, 3, 4, 5, 6]; - let mut c2 = v2.array_chunks_mut::<3>(); - assert_eq!(c2.nth(1).unwrap(), &[3, 4, 5]); - assert_eq!(c2.next(), None); -} - -#[test] -fn test_array_chunks_mut_nth_back() { - let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; - let mut c = v.array_chunks_mut::<2>(); - assert_eq!(c.nth_back(1).unwrap(), &[2, 3]); - assert_eq!(c.next().unwrap(), &[0, 1]); - assert_eq!(c.next(), None); - - let v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; - let mut c2 = v2.array_chunks_mut::<3>(); - assert_eq!(c2.nth_back(0).unwrap(), &[0, 1, 2]); - assert_eq!(c2.next(), None); - assert_eq!(c2.next_back(), None); - - let v3: &mut [i32] = &mut [0, 1, 2, 3, 4]; - let mut c3 = v3.array_chunks_mut::<10>(); - assert_eq!(c3.nth_back(0), None); -} - -#[test] -fn test_array_chunks_mut_last() { - let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5]; - let c = v.array_chunks_mut::<2>(); - assert_eq!(c.last().unwrap(), &[4, 5]); - - let v2: &mut [i32] = &mut [0, 1, 2, 3, 4]; - let c2 = v2.array_chunks_mut::<2>(); - assert_eq!(c2.last().unwrap(), &[2, 3]); -} - -#[test] -fn test_array_chunks_mut_remainder() { - let v: &mut [i32] = &mut [0, 1, 2, 3, 4]; - let c = v.array_chunks_mut::<2>(); - assert_eq!(c.into_remainder(), &[4]); -} - -#[test] -fn test_array_chunks_mut_zip() { - let v1: &mut [i32] = &mut [0, 1, 2, 3, 4]; - let v2: &[i32] = &[6, 7, 8, 9, 10]; - - for (a, b) in v1.array_chunks_mut::<2>().zip(v2.array_chunks::<2>()) { - let sum = b.iter().sum::(); - for v in a { - *v += sum; - } - } - assert_eq!(v1, [13, 14, 19, 20, 4]); -} - #[test] fn test_array_windows_infer() { let v: &[i32] = &[0, 1, 0, 1]; diff --git a/library/panic_abort/Cargo.toml b/library/panic_abort/Cargo.toml index e8c66f1a4dd3..ecf043ac7071 100644 --- a/library/panic_abort/Cargo.toml +++ b/library/panic_abort/Cargo.toml @@ -12,8 +12,7 @@ bench = false doc = false [dependencies] -core = { path = "../core" } -compiler_builtins = { path = "../compiler-builtins/compiler-builtins" } +core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" } [target.'cfg(target_os = "android")'.dependencies] libc = { version = "0.2", default-features = false } diff --git a/library/panic_unwind/Cargo.toml b/library/panic_unwind/Cargo.toml index 47914b9cd3c6..13d1a7160da8 100644 --- a/library/panic_unwind/Cargo.toml +++ b/library/panic_unwind/Cargo.toml @@ -13,10 +13,9 @@ doc = false [dependencies] alloc = { path = "../alloc" } -core = { path = "../core" } -unwind = { path = "../unwind" } -compiler_builtins = { path = "../compiler-builtins/compiler-builtins" } cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] } +core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" } +unwind = { path = "../unwind" } [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies] libc = { version = "0.2", default-features = false } diff --git a/library/rustc-std-workspace-alloc/Cargo.toml b/library/rustc-std-workspace-alloc/Cargo.toml index 5a177808d1bd..a5b51059119c 100644 --- a/library/rustc-std-workspace-alloc/Cargo.toml +++ b/library/rustc-std-workspace-alloc/Cargo.toml @@ -9,6 +9,9 @@ edition = "2024" [lib] path = "lib.rs" +test = false +bench = false +doc = false [dependencies] alloc = { path = "../alloc" } diff --git a/library/rustc-std-workspace-core/Cargo.toml b/library/rustc-std-workspace-core/Cargo.toml index 1ddc112380f1..d68965c63457 100644 --- a/library/rustc-std-workspace-core/Cargo.toml +++ b/library/rustc-std-workspace-core/Cargo.toml @@ -11,6 +11,9 @@ edition = "2024" [lib] path = "lib.rs" +test = false +bench = false +doc = false [dependencies] core = { path = "../core", public = true } diff --git a/library/rustc-std-workspace-core/README.md b/library/rustc-std-workspace-core/README.md index 55a36e741065..15bc93f7948a 100644 --- a/library/rustc-std-workspace-core/README.md +++ b/library/rustc-std-workspace-core/README.md @@ -11,6 +11,12 @@ on crates.io will draw a dependency edge to `libcore`, the version defined in this repository. That should draw all the dependency edges to ensure Cargo builds crates successfully! +`rustc-std-workspace-core` also ensures `compiler-builtins` is in the crate +graph. This crate is used by other crates in `library/`, other than `std` and +`alloc`, so the `compiler-builtins` setup only needs to be configured in a +single place. (Otherwise these crates would just need to depend on `core` and +`compiler-builtins` separately.) + Note that crates on crates.io need to depend on this crate with the name `core` for everything to work correctly. To do that they can use: diff --git a/library/rustc-std-workspace-std/Cargo.toml b/library/rustc-std-workspace-std/Cargo.toml index f70994e1f886..6079dc85d906 100644 --- a/library/rustc-std-workspace-std/Cargo.toml +++ b/library/rustc-std-workspace-std/Cargo.toml @@ -9,6 +9,9 @@ edition = "2024" [lib] path = "lib.rs" +test = false +bench = false +doc = false [dependencies] std = { path = "../std" } diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 29ab9be0e69c..7bc52976500d 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -18,7 +18,6 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } core = { path = "../core", public = true } -compiler_builtins = { path = "../compiler-builtins/compiler-builtins" } unwind = { path = "../unwind" } hashbrown = { version = "0.15", default-features = false, features = [ 'rustc-dep-of-std', diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index edbdd0411457..15a7a770d1a8 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -135,6 +135,8 @@ use crate::ops::Index; /// ]); /// ``` /// +/// ## `Entry` API +/// /// `HashMap` implements an [`Entry` API](#method.entry), which allows /// for complex methods of getting, setting, updating and removing keys and /// their values: @@ -167,6 +169,8 @@ use crate::ops::Index; /// player_stats.entry("mana").and_modify(|mana| *mana += 200).or_insert(100); /// ``` /// +/// ## Usage with custom key types +/// /// The easiest way to use `HashMap` with a custom key type is to derive [`Eq`] and [`Hash`]. /// We must also derive [`PartialEq`]. /// diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 72ad7c244eeb..a220a3f56e9a 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -814,7 +814,7 @@ impl File { /// /// If this file handle/descriptor, or a clone of it, already holds a lock, the exact behavior /// is unspecified and platform dependent, including the possibility that it will deadlock. - /// However, if this method returns `Ok(true)`, then it has acquired an exclusive lock. + /// However, if this method returns `Ok(())`, then it has acquired an exclusive lock. /// /// If the file is not open for writing, it is unspecified whether this function returns an error. /// @@ -879,7 +879,7 @@ impl File { /// /// If this file handle, or a clone of it, already holds a lock, the exact behavior is /// unspecified and platform dependent, including the possibility that it will deadlock. - /// However, if this method returns `Ok(true)`, then it has acquired a shared lock. + /// However, if this method returns `Ok(())`, then it has acquired a shared lock. /// /// The lock will be released when this file (along with any other file descriptors/handles /// duplicated or inherited from it) is closed, or if the [`unlock`] method is called. @@ -1111,6 +1111,11 @@ impl File { /// `futimes` on macOS before 10.13) and the `SetFileTime` function on Windows. Note that this /// [may change in the future][changes]. /// + /// On most platforms, including UNIX and Windows platforms, this function can also change the + /// timestamps of a directory. To get a `File` representing a directory in order to call + /// `set_times`, open the directory with `File::open` without attempting to obtain write + /// permission. + /// /// [changes]: io#platform-specific-behavior /// /// # Errors @@ -1128,7 +1133,7 @@ impl File { /// use std::fs::{self, File, FileTimes}; /// /// let src = fs::metadata("src")?; - /// let dest = File::options().write(true).open("dest")?; + /// let dest = File::open("dest")?; /// let times = FileTimes::new() /// .set_accessed(src.accessed()?) /// .set_modified(src.modified()?); diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 323742a75b05..0c5375306472 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -294,6 +294,8 @@ #![feature(f128)] #![feature(ffi_const)] #![feature(formatting_options)] +#![feature(hash_map_internals)] +#![feature(hash_map_macro)] #![feature(if_let_guard)] #![feature(intra_doc_pointers)] #![feature(iter_advance_by)] @@ -319,18 +321,17 @@ #![feature(try_blocks)] #![feature(try_trait_v2)] #![feature(type_alias_impl_trait)] -#![feature(unsigned_signed_diff)] // tidy-alphabetical-end // // Library features (core): // tidy-alphabetical-start -#![feature(array_chunks)] #![feature(bstr)] #![feature(bstr_internals)] #![feature(char_internals)] #![feature(clone_to_uninit)] #![feature(core_intrinsics)] #![feature(core_io_borrowed_buf)] +#![feature(drop_guard)] #![feature(duration_constants)] #![feature(error_generic_member_access)] #![feature(error_iter)] diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index 25e2b7ea1370..254570ae9c83 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -379,3 +379,77 @@ macro_rules! dbg { ($($crate::dbg!($val)),+,) }; } + +#[doc(hidden)] +#[macro_export] +#[allow_internal_unstable(hash_map_internals)] +#[unstable(feature = "hash_map_internals", issue = "none")] +macro_rules! repetition_utils { + (@count $($tokens:tt),*) => {{ + [$($crate::repetition_utils!(@replace $tokens => ())),*].len() + }}; + + (@replace $x:tt => $y:tt) => { $y } +} + +/// Creates a [`HashMap`] containing the arguments. +/// +/// `hash_map!` allows specifying the entries that make +/// up the [`HashMap`] where the key and value are separated by a `=>`. +/// +/// The entries are separated by commas with a trailing comma being allowed. +/// +/// It is semantically equivalent to using repeated [`HashMap::insert`] +/// on a newly created hashmap. +/// +/// `hash_map!` will attempt to avoid repeated reallocations by +/// using [`HashMap::with_capacity`]. +/// +/// # Examples +/// +/// ```rust +/// #![feature(hash_map_macro)] +/// +/// let map = hash_map! { +/// "key" => "value", +/// "key1" => "value1" +/// }; +/// +/// assert_eq!(map.get("key"), Some(&"value")); +/// assert_eq!(map.get("key1"), Some(&"value1")); +/// assert!(map.get("brrrrrrooooommm").is_none()); +/// ``` +/// +/// And with a trailing comma +/// +///```rust +/// #![feature(hash_map_macro)] +/// +/// let map = hash_map! { +/// "key" => "value", // notice the , +/// }; +/// +/// assert_eq!(map.get("key"), Some(&"value")); +/// ``` +/// +/// The key and value are moved into the HashMap. +/// +/// [`HashMap`]: crate::collections::HashMap +/// [`HashMap::insert`]: crate::collections::HashMap::insert +/// [`HashMap::with_capacity`]: crate::collections::HashMap::with_capacity +#[macro_export] +#[allow_internal_unstable(hash_map_internals)] +#[unstable(feature = "hash_map_macro", issue = "144032")] +macro_rules! hash_map { + () => {{ + $crate::collections::HashMap::new() + }}; + + ( $( $key:expr => $value:expr ),* $(,)? ) => {{ + let mut map = $crate::collections::HashMap::with_capacity( + const { $crate::repetition_utils!(@count $($key),*) } + ); + $( map.insert($key, $value); )* + map + }} +} diff --git a/library/std/src/num/f32.rs b/library/std/src/num/f32.rs index 2bff73add33d..5dee68ad909e 100644 --- a/library/std/src/num/f32.rs +++ b/library/std/src/num/f32.rs @@ -44,7 +44,7 @@ impl f32 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn floor(self) -> f32 { core::f32::math::floor(self) @@ -67,7 +67,7 @@ impl f32 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn ceil(self) -> f32 { core::f32::math::ceil(self) @@ -96,7 +96,7 @@ impl f32 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn round(self) -> f32 { core::f32::math::round(self) @@ -123,7 +123,7 @@ impl f32 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "round_ties_even", since = "1.77.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn round_ties_even(self) -> f32 { core::f32::math::round_ties_even(self) @@ -149,7 +149,7 @@ impl f32 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn trunc(self) -> f32 { core::f32::math::trunc(self) @@ -173,7 +173,7 @@ impl f32 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn fract(self) -> f32 { core::f32::math::fract(self) diff --git a/library/std/src/num/f64.rs b/library/std/src/num/f64.rs index b71e319f4074..3ec80f68bdb2 100644 --- a/library/std/src/num/f64.rs +++ b/library/std/src/num/f64.rs @@ -44,7 +44,7 @@ impl f64 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn floor(self) -> f64 { core::f64::math::floor(self) @@ -67,7 +67,7 @@ impl f64 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn ceil(self) -> f64 { core::f64::math::ceil(self) @@ -96,7 +96,7 @@ impl f64 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn round(self) -> f64 { core::f64::math::round(self) @@ -123,7 +123,7 @@ impl f64 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "round_ties_even", since = "1.77.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn round_ties_even(self) -> f64 { core::f64::math::round_ties_even(self) @@ -149,7 +149,7 @@ impl f64 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn trunc(self) -> f64 { core::f64::math::trunc(self) @@ -173,7 +173,7 @@ impl f64 { #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_float_round_methods", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "const_float_round_methods", since = "1.90.0")] #[inline] pub const fn fract(self) -> f64 { core::f64::math::fract(self) diff --git a/library/std/src/panic.rs b/library/std/src/panic.rs index 234fb284a590..cff4f20b5a81 100644 --- a/library/std/src/panic.rs +++ b/library/std/src/panic.rs @@ -108,8 +108,6 @@ impl<'a> PanicHookInfo<'a> { /// # Example /// /// ```should_panic - /// #![feature(panic_payload_as_str)] - /// /// std::panic::set_hook(Box::new(|panic_info| { /// if let Some(s) = panic_info.payload_as_str() { /// println!("panic occurred: {s:?}"); @@ -122,7 +120,7 @@ impl<'a> PanicHookInfo<'a> { /// ``` #[must_use] #[inline] - #[unstable(feature = "panic_payload_as_str", issue = "125175")] + #[stable(feature = "panic_payload_as_str", since = "CURRENT_RUSTC_VERSION")] pub fn payload_as_str(&self) -> Option<&str> { if let Some(s) = self.payload.downcast_ref::<&str>() { Some(s) @@ -388,7 +386,7 @@ pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { /// ``` #[stable(feature = "resume_unwind", since = "1.9.0")] pub fn resume_unwind(payload: Box) -> ! { - panicking::rust_panic_without_hook(payload) + panicking::resume_unwind(payload) } /// Makes all future panics abort directly without running the panic hook or unwinding. diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index 7873049d20bf..87a3fc80dfab 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -269,6 +269,7 @@ fn default_hook(info: &PanicHookInfo<'_>) { thread::with_current_name(|name| { let name = name.unwrap_or(""); + let tid = thread::current_os_id(); // Try to write the panic message to a buffer first to prevent other concurrent outputs // interleaving with it. @@ -277,7 +278,7 @@ fn default_hook(info: &PanicHookInfo<'_>) { let write_msg = |dst: &mut dyn crate::io::Write| { // We add a newline to ensure the panic message appears at the start of a line. - writeln!(dst, "\nthread '{name}' panicked at {location}:\n{msg}") + writeln!(dst, "\nthread '{name}' ({tid}) panicked at {location}:\n{msg}") }; if write_msg(&mut cursor).is_ok() { @@ -627,7 +628,7 @@ pub fn panicking() -> bool { /// Entry point of panics from the core crate (`panic_impl` lang item). #[cfg(not(any(test, doctest)))] #[panic_handler] -pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! { +pub fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! { struct FormatStringPayload<'a> { inner: &'a core::panic::PanicMessage<'a>, string: Option, @@ -696,14 +697,14 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! { let msg = info.message(); crate::sys::backtrace::__rust_end_short_backtrace(move || { if let Some(s) = msg.as_str() { - rust_panic_with_hook( + panic_with_hook( &mut StaticStrPayload(s), loc, info.can_unwind(), info.force_no_backtrace(), ); } else { - rust_panic_with_hook( + panic_with_hook( &mut FormatStringPayload { inner: &msg, string: None }, loc, info.can_unwind(), @@ -767,7 +768,7 @@ pub const fn begin_panic(msg: M) -> ! { let loc = Location::caller(); crate::sys::backtrace::__rust_end_short_backtrace(move || { - rust_panic_with_hook( + panic_with_hook( &mut Payload { inner: Some(msg) }, loc, /* can_unwind */ true, @@ -792,7 +793,7 @@ fn payload_as_str(payload: &dyn Any) -> &str { /// panics, panic hooks, and finally dispatching to the panic runtime to either /// abort or unwind. #[optimize(size)] -fn rust_panic_with_hook( +fn panic_with_hook( payload: &mut dyn PanicPayload, location: &Location<'_>, can_unwind: bool, @@ -861,7 +862,7 @@ fn rust_panic_with_hook( /// This is the entry point for `resume_unwind`. /// It just forwards the payload to the panic runtime. #[cfg_attr(feature = "panic_immediate_abort", inline)] -pub fn rust_panic_without_hook(payload: Box) -> ! { +pub fn resume_unwind(payload: Box) -> ! { panic_count::increase(false); struct RewrapBox(Box); @@ -885,8 +886,8 @@ pub fn rust_panic_without_hook(payload: Box) -> ! { rust_panic(&mut RewrapBox(payload)) } -/// An unmangled function (through `rustc_std_internal_symbol`) on which to slap -/// yer breakpoints. +/// A function with a fixed suffix (through `rustc_std_internal_symbol`) +/// on which to slap yer breakpoints. #[inline(never)] #[cfg_attr(not(test), rustc_std_internal_symbol)] #[cfg(not(feature = "panic_immediate_abort"))] diff --git a/library/std/src/path.rs b/library/std/src/path.rs index d9c34d4fa045..e7ba69364358 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2683,6 +2683,8 @@ impl Path { /// /// assert_eq!("foo", Path::new("foo.rs").file_prefix().unwrap()); /// assert_eq!("foo", Path::new("foo.tar.gz").file_prefix().unwrap()); + /// assert_eq!(".config", Path::new(".config").file_prefix().unwrap()); + /// assert_eq!(".config", Path::new(".config.toml").file_prefix().unwrap()); /// ``` /// /// # See Also @@ -3259,8 +3261,8 @@ impl Path { /// /// # Examples /// - #[cfg_attr(unix, doc = "```no_run")] - #[cfg_attr(not(unix), doc = "```ignore")] + /// ```rust,no_run + /// # #[cfg(unix)] { /// use std::path::Path; /// use std::os::unix::fs::symlink; /// @@ -3268,6 +3270,7 @@ impl Path { /// symlink("/origin_does_not_exist/", link_path).unwrap(); /// assert_eq!(link_path.is_symlink(), true); /// assert_eq!(link_path.exists(), false); + /// # } /// ``` /// /// # See Also diff --git a/library/std/src/sync/lazy_lock.rs b/library/std/src/sync/lazy_lock.rs index eba849d16dac..a40e29a772a9 100644 --- a/library/std/src/sync/lazy_lock.rs +++ b/library/std/src/sync/lazy_lock.rs @@ -25,6 +25,22 @@ union Data { /// /// [`LazyCell`]: crate::cell::LazyCell /// +/// # Poisoning +/// +/// If the initialization closure passed to [`LazyLock::new`] panics, the lock will be poisoned. +/// Once the lock is poisoned, any threads that attempt to access this lock (via a dereference +/// or via an explicit call to [`force()`]) will panic. +/// +/// This concept is similar to that of poisoning in the [`std::sync::poison`] module. A key +/// difference, however, is that poisoning in `LazyLock` is _unrecoverable_. All future accesses of +/// the lock from other threads will panic, whereas a type in [`std::sync::poison`] like +/// [`std::sync::poison::Mutex`] allows recovery via [`PoisonError::into_inner()`]. +/// +/// [`force()`]: LazyLock::force +/// [`std::sync::poison`]: crate::sync::poison +/// [`std::sync::poison::Mutex`]: crate::sync::poison::Mutex +/// [`PoisonError::into_inner()`]: crate::sync::poison::PoisonError::into_inner +/// /// # Examples /// /// Initialize static variables with `LazyLock`. @@ -102,6 +118,10 @@ impl T> LazyLock { /// /// Returns `Ok(value)` if `Lazy` is initialized and `Err(f)` otherwise. /// + /// # Panics + /// + /// Panics if the lock is poisoned. + /// /// # Examples /// /// ``` @@ -136,6 +156,15 @@ impl T> LazyLock { /// Forces the evaluation of this lazy value and returns a mutable reference to /// the result. /// + /// # Panics + /// + /// If the initialization closure panics (the one that is passed to the [`new()`] method), the + /// panic is propagated to the caller, and the lock becomes poisoned. This will cause all future + /// accesses of the lock (via [`force()`] or a dereference) to panic. + /// + /// [`new()`]: LazyLock::new + /// [`force()`]: LazyLock::force + /// /// # Examples /// /// ``` @@ -193,6 +222,15 @@ impl T> LazyLock { /// This method will block the calling thread if another initialization /// routine is currently running. /// + /// # Panics + /// + /// If the initialization closure panics (the one that is passed to the [`new()`] method), the + /// panic is propagated to the caller, and the lock becomes poisoned. This will cause all future + /// accesses of the lock (via [`force()`] or a dereference) to panic. + /// + /// [`new()`]: LazyLock::new + /// [`force()`]: LazyLock::force + /// /// # Examples /// /// ``` @@ -227,7 +265,8 @@ impl T> LazyLock { } impl LazyLock { - /// Returns a mutable reference to the value if initialized, or `None` if not. + /// Returns a mutable reference to the value if initialized. Otherwise (if uninitialized or + /// poisoned), returns `None`. /// /// # Examples /// @@ -256,7 +295,8 @@ impl LazyLock { } } - /// Returns a reference to the value if initialized, or `None` if not. + /// Returns a reference to the value if initialized. Otherwise (if uninitialized or poisoned), + /// returns `None`. /// /// # Examples /// @@ -307,6 +347,14 @@ impl T> Deref for LazyLock { /// This method will block the calling thread if another initialization /// routine is currently running. /// + /// # Panics + /// + /// If the initialization closure panics (the one that is passed to the [`new()`] method), the + /// panic is propagated to the caller, and the lock becomes poisoned. This will cause all future + /// accesses of the lock (via [`force()`] or a dereference) to panic. + /// + /// [`new()`]: LazyLock::new + /// [`force()`]: LazyLock::force #[inline] fn deref(&self) -> &T { LazyLock::force(self) @@ -315,6 +363,14 @@ impl T> Deref for LazyLock { #[stable(feature = "lazy_deref_mut", since = "1.89.0")] impl T> DerefMut for LazyLock { + /// # Panics + /// + /// If the initialization closure panics (the one that is passed to the [`new()`] method), the + /// panic is propagated to the caller, and the lock becomes poisoned. This will cause all future + /// accesses of the lock (via [`force()`] or a dereference) to panic. + /// + /// [`new()`]: LazyLock::new + /// [`force()`]: LazyLock::force #[inline] fn deref_mut(&mut self) -> &mut T { LazyLock::force_mut(self) diff --git a/library/std/src/sync/mod.rs b/library/std/src/sync/mod.rs index e67b4f6f22f5..6ef3bf25cf67 100644 --- a/library/std/src/sync/mod.rs +++ b/library/std/src/sync/mod.rs @@ -225,6 +225,8 @@ pub use self::poison::{MappedMutexGuard, MappedRwLockReadGuard, MappedRwLockWrit pub mod mpmc; pub mod mpsc; +#[unstable(feature = "sync_nonpoison", issue = "134645")] +pub mod nonpoison; #[unstable(feature = "sync_poison_mod", issue = "134646")] pub mod poison; diff --git a/library/std/src/sync/nonpoison.rs b/library/std/src/sync/nonpoison.rs new file mode 100644 index 000000000000..2bbf226dc2cd --- /dev/null +++ b/library/std/src/sync/nonpoison.rs @@ -0,0 +1,37 @@ +//! Non-poisoning synchronous locks. +//! +//! The difference from the locks in the [`poison`] module is that the locks in this module will not +//! become poisoned when a thread panics while holding a guard. +//! +//! [`poison`]: super::poison + +use crate::fmt; + +/// A type alias for the result of a nonblocking locking method. +#[unstable(feature = "sync_nonpoison", issue = "134645")] +pub type TryLockResult = Result; + +/// A lock could not be acquired at this time because the operation would otherwise block. +#[unstable(feature = "sync_nonpoison", issue = "134645")] +pub struct WouldBlock; + +#[unstable(feature = "sync_nonpoison", issue = "134645")] +impl fmt::Debug for WouldBlock { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + "WouldBlock".fmt(f) + } +} + +#[unstable(feature = "sync_nonpoison", issue = "134645")] +impl fmt::Display for WouldBlock { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + "try_lock failed because the operation would block".fmt(f) + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +pub use self::mutex::MappedMutexGuard; +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +pub use self::mutex::{Mutex, MutexGuard}; + +mod mutex; diff --git a/library/std/src/sync/nonpoison/mutex.rs b/library/std/src/sync/nonpoison/mutex.rs new file mode 100644 index 000000000000..b6861c78f001 --- /dev/null +++ b/library/std/src/sync/nonpoison/mutex.rs @@ -0,0 +1,611 @@ +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::marker::PhantomData; +use crate::mem::{self, ManuallyDrop}; +use crate::ops::{Deref, DerefMut}; +use crate::ptr::NonNull; +use crate::sync::nonpoison::{TryLockResult, WouldBlock}; +use crate::sys::sync as sys; + +/// A mutual exclusion primitive useful for protecting shared data that does not keep track of +/// lock poisoning. +/// +/// For more information about mutexes, check out the documentation for the poisoning variant of +/// this lock at [`poison::Mutex`]. +/// +/// [`poison::Mutex`]: crate::sync::poison::Mutex +/// +/// # Examples +/// +/// Note that this `Mutex` does **not** propagate threads that panic while holding the lock via +/// poisoning. If you need this functionality, see [`poison::Mutex`]. +/// +/// ``` +/// #![feature(nonpoison_mutex)] +/// +/// use std::thread; +/// use std::sync::{Arc, nonpoison::Mutex}; +/// +/// let mutex = Arc::new(Mutex::new(0u32)); +/// let mut handles = Vec::new(); +/// +/// for n in 0..10 { +/// let m = Arc::clone(&mutex); +/// let handle = thread::spawn(move || { +/// let mut guard = m.lock(); +/// *guard += 1; +/// panic!("panic from thread {n} {guard}") +/// }); +/// handles.push(handle); +/// } +/// +/// for h in handles { +/// let _ = h.join(); +/// } +/// +/// println!("Finished, locked {} times", mutex.lock()); +/// ``` +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +#[cfg_attr(not(test), rustc_diagnostic_item = "NonPoisonMutex")] +pub struct Mutex { + inner: sys::Mutex, + data: UnsafeCell, +} + +/// `T` must be `Send` for a [`Mutex`] to be `Send` because it is possible to acquire +/// the owned `T` from the `Mutex` via [`into_inner`]. +/// +/// [`into_inner`]: Mutex::into_inner +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +unsafe impl Send for Mutex {} + +/// `T` must be `Send` for [`Mutex`] to be `Sync`. +/// This ensures that the protected data can be accessed safely from multiple threads +/// without causing data races or other unsafe behavior. +/// +/// [`Mutex`] provides mutable access to `T` to one thread at a time. However, it's essential +/// for `T` to be `Send` because it's not safe for non-`Send` structures to be accessed in +/// this manner. For instance, consider [`Rc`], a non-atomic reference counted smart pointer, +/// which is not `Send`. With `Rc`, we can have multiple copies pointing to the same heap +/// allocation with a non-atomic reference count. If we were to use `Mutex>`, it would +/// only protect one instance of `Rc` from shared access, leaving other copies vulnerable +/// to potential data races. +/// +/// Also note that it is not necessary for `T` to be `Sync` as `&T` is only made available +/// to one thread at a time if `T` is not `Sync`. +/// +/// [`Rc`]: crate::rc::Rc +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +unsafe impl Sync for Mutex {} + +/// An RAII implementation of a "scoped lock" of a mutex. When this structure is +/// dropped (falls out of scope), the lock will be unlocked. +/// +/// The data protected by the mutex can be accessed through this guard via its +/// [`Deref`] and [`DerefMut`] implementations. +/// +/// This structure is created by the [`lock`] and [`try_lock`] methods on +/// [`Mutex`]. +/// +/// [`lock`]: Mutex::lock +/// [`try_lock`]: Mutex::try_lock +#[must_use = "if unused the Mutex will immediately unlock"] +#[must_not_suspend = "holding a MutexGuard across suspend \ + points can cause deadlocks, delays, \ + and cause Futures to not implement `Send`"] +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +#[clippy::has_significant_drop] +#[cfg_attr(not(test), rustc_diagnostic_item = "NonPoisonMutexGuard")] +pub struct MutexGuard<'a, T: ?Sized + 'a> { + lock: &'a Mutex, +} + +/// A [`MutexGuard`] is not `Send` to maximize platform portablity. +/// +/// On platforms that use POSIX threads (commonly referred to as pthreads) there is a requirement to +/// release mutex locks on the same thread they were acquired. +/// For this reason, [`MutexGuard`] must not implement `Send` to prevent it being dropped from +/// another thread. +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl !Send for MutexGuard<'_, T> {} + +/// `T` must be `Sync` for a [`MutexGuard`] to be `Sync` +/// because it is possible to get a `&T` from `&MutexGuard` (via `Deref`). +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +unsafe impl Sync for MutexGuard<'_, T> {} + +// FIXME(nonpoison_condvar): Use this link instead: [`Condvar`]: crate::sync::nonpoison::Condvar +/// An RAII mutex guard returned by `MutexGuard::map`, which can point to a +/// subfield of the protected data. When this structure is dropped (falls out +/// of scope), the lock will be unlocked. +/// +/// The main difference between `MappedMutexGuard` and [`MutexGuard`] is that the +/// former cannot be used with [`Condvar`], since that could introduce soundness issues if the +/// locked object is modified by another thread while the `Mutex` is unlocked. +/// +/// The data protected by the mutex can be accessed through this guard via its +/// [`Deref`] and [`DerefMut`] implementations. +/// +/// This structure is created by the [`map`] and [`filter_map`] methods on +/// [`MutexGuard`]. +/// +/// [`map`]: MutexGuard::map +/// [`filter_map`]: MutexGuard::filter_map +/// [`Condvar`]: crate::sync::Condvar +#[must_use = "if unused the Mutex will immediately unlock"] +#[must_not_suspend = "holding a MappedMutexGuard across suspend \ + points can cause deadlocks, delays, \ + and cause Futures to not implement `Send`"] +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +// #[unstable(feature = "nonpoison_mutex", issue = "134645")] +#[clippy::has_significant_drop] +pub struct MappedMutexGuard<'a, T: ?Sized + 'a> { + // NB: we use a pointer instead of `&'a mut T` to avoid `noalias` violations, because a + // `MappedMutexGuard` argument doesn't hold uniqueness for its whole scope, only until it drops. + // `NonNull` is covariant over `T`, so we add a `PhantomData<&'a mut T>` field + // below for the correct variance over `T` (invariance). + data: NonNull, + inner: &'a sys::Mutex, + _variance: PhantomData<&'a mut T>, +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +// #[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl !Send for MappedMutexGuard<'_, T> {} +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +// #[unstable(feature = "nonpoison_mutex", issue = "134645")] +unsafe impl Sync for MappedMutexGuard<'_, T> {} + +impl Mutex { + /// Creates a new mutex in an unlocked state ready for use. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// + /// use std::sync::nonpoison::Mutex; + /// + /// let mutex = Mutex::new(0); + /// ``` + #[unstable(feature = "nonpoison_mutex", issue = "134645")] + #[inline] + pub const fn new(t: T) -> Mutex { + Mutex { inner: sys::Mutex::new(), data: UnsafeCell::new(t) } + } + + /// Returns the contained value by cloning it. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// #![feature(lock_value_accessors)] + /// + /// use std::sync::nonpoison::Mutex; + /// + /// let mut mutex = Mutex::new(7); + /// + /// assert_eq!(mutex.get_cloned(), 7); + /// ``` + #[unstable(feature = "lock_value_accessors", issue = "133407")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn get_cloned(&self) -> T + where + T: Clone, + { + self.lock().clone() + } + + /// Sets the contained value. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// #![feature(lock_value_accessors)] + /// + /// use std::sync::nonpoison::Mutex; + /// + /// let mut mutex = Mutex::new(7); + /// + /// assert_eq!(mutex.get_cloned(), 7); + /// mutex.set(11); + /// assert_eq!(mutex.get_cloned(), 11); + /// ``` + #[unstable(feature = "lock_value_accessors", issue = "133407")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn set(&self, value: T) { + if mem::needs_drop::() { + // If the contained value has a non-trivial destructor, we + // call that destructor after the lock has been released. + drop(self.replace(value)) + } else { + *self.lock() = value; + } + } + + /// Replaces the contained value with `value`, and returns the old contained value. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// #![feature(lock_value_accessors)] + /// + /// use std::sync::nonpoison::Mutex; + /// + /// let mut mutex = Mutex::new(7); + /// + /// assert_eq!(mutex.replace(11), 7); + /// assert_eq!(mutex.get_cloned(), 11); + /// ``` + #[unstable(feature = "lock_value_accessors", issue = "133407")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn replace(&self, value: T) -> T { + let mut guard = self.lock(); + mem::replace(&mut *guard, value) + } +} + +impl Mutex { + /// Acquires a mutex, blocking the current thread until it is able to do so. + /// + /// This function will block the local thread until it is available to acquire + /// the mutex. Upon returning, the thread is the only thread with the lock + /// held. An RAII guard is returned to allow scoped unlock of the lock. When + /// the guard goes out of scope, the mutex will be unlocked. + /// + /// The exact behavior on locking a mutex in the thread which already holds + /// the lock is left unspecified. However, this function will not return on + /// the second call (it might panic or deadlock, for example). + /// + /// # Panics + /// + /// This function might panic when called if the lock is already held by + /// the current thread. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// + /// use std::sync::{Arc, nonpoison::Mutex}; + /// use std::thread; + /// + /// let mutex = Arc::new(Mutex::new(0)); + /// let c_mutex = Arc::clone(&mutex); + /// + /// thread::spawn(move || { + /// *c_mutex.lock() = 10; + /// }).join().expect("thread::spawn failed"); + /// assert_eq!(*mutex.lock(), 10); + /// ``` + #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn lock(&self) -> MutexGuard<'_, T> { + unsafe { + self.inner.lock(); + MutexGuard::new(self) + } + } + + /// Attempts to acquire this lock. + /// + /// This function does not block. If the lock could not be acquired at this time, then + /// [`WouldBlock`] is returned. Otherwise, an RAII guard is returned. + /// + /// The lock will be unlocked when the guard is dropped. + /// + /// # Errors + /// + /// If the mutex could not be acquired because it is already locked, then this call will return + /// the [`WouldBlock`] error. + /// + /// # Examples + /// + /// ``` + /// use std::sync::{Arc, Mutex}; + /// use std::thread; + /// + /// let mutex = Arc::new(Mutex::new(0)); + /// let c_mutex = Arc::clone(&mutex); + /// + /// thread::spawn(move || { + /// let mut lock = c_mutex.try_lock(); + /// if let Ok(ref mut mutex) = lock { + /// **mutex = 10; + /// } else { + /// println!("try_lock failed"); + /// } + /// }).join().expect("thread::spawn failed"); + /// assert_eq!(*mutex.lock().unwrap(), 10); + /// ``` + #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn try_lock(&self) -> TryLockResult> { + unsafe { if self.inner.try_lock() { Ok(MutexGuard::new(self)) } else { Err(WouldBlock) } } + } + + /// Consumes this mutex, returning the underlying data. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// + /// use std::sync::nonpoison::Mutex; + /// + /// let mutex = Mutex::new(0); + /// assert_eq!(mutex.into_inner(), 0); + /// ``` + #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn into_inner(self) -> T + where + T: Sized, + { + self.data.into_inner() + } + + /// Returns a mutable reference to the underlying data. + /// + /// Since this call borrows the `Mutex` mutably, no actual locking needs to + /// take place -- the mutable borrow statically guarantees no locks exist. + /// + /// # Examples + /// + /// ``` + /// #![feature(nonpoison_mutex)] + /// + /// use std::sync::nonpoison::Mutex; + /// + /// let mut mutex = Mutex::new(0); + /// *mutex.get_mut() = 10; + /// assert_eq!(*mutex.lock(), 10); + /// ``` + #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn get_mut(&mut self) -> &mut T { + self.data.get_mut() + } + + /// Returns a raw pointer to the underlying data. + /// + /// The returned pointer is always non-null and properly aligned, but it is + /// the user's responsibility to ensure that any reads and writes through it + /// are properly synchronized to avoid data races, and that it is not read + /// or written through after the mutex is dropped. + #[unstable(feature = "mutex_data_ptr", issue = "140368")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn data_ptr(&self) -> *mut T { + self.data.get() + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl From for Mutex { + /// Creates a new mutex in an unlocked state ready for use. + /// This is equivalent to [`Mutex::new`]. + fn from(t: T) -> Self { + Mutex::new(t) + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl Default for Mutex { + /// Creates a `Mutex`, with the `Default` value for T. + fn default() -> Mutex { + Mutex::new(Default::default()) + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl fmt::Debug for Mutex { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let mut d = f.debug_struct("Mutex"); + match self.try_lock() { + Ok(guard) => { + d.field("data", &&*guard); + } + Err(WouldBlock) => { + d.field("data", &""); + } + } + d.finish_non_exhaustive() + } +} + +impl<'mutex, T: ?Sized> MutexGuard<'mutex, T> { + unsafe fn new(lock: &'mutex Mutex) -> MutexGuard<'mutex, T> { + return MutexGuard { lock }; + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl Deref for MutexGuard<'_, T> { + type Target = T; + + fn deref(&self) -> &T { + unsafe { &*self.lock.data.get() } + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl DerefMut for MutexGuard<'_, T> { + fn deref_mut(&mut self) -> &mut T { + unsafe { &mut *self.lock.data.get() } + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl Drop for MutexGuard<'_, T> { + #[inline] + fn drop(&mut self) { + unsafe { + self.lock.inner.unlock(); + } + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl fmt::Debug for MutexGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&**self, f) + } +} + +#[unstable(feature = "nonpoison_mutex", issue = "134645")] +impl fmt::Display for MutexGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + +impl<'a, T: ?Sized> MutexGuard<'a, T> { + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data, e.g. + /// an enum variant. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MutexGuard::map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn map(orig: Self, f: F) -> MappedMutexGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `filter_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { &mut *orig.lock.data.get() })); + let orig = ManuallyDrop::new(orig); + MappedMutexGuard { data, inner: &orig.lock.inner, _variance: PhantomData } + } + + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data. The + /// original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MutexGuard::filter_map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn filter_map(orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&mut T) -> Option<&mut U>, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `filter_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { &mut *orig.lock.data.get() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedMutexGuard { data, inner: &orig.lock.inner, _variance: PhantomData }) + } + None => Err(orig), + } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Deref for MappedMutexGuard<'_, T> { + type Target = T; + + fn deref(&self) -> &T { + unsafe { self.data.as_ref() } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl DerefMut for MappedMutexGuard<'_, T> { + fn deref_mut(&mut self) -> &mut T { + unsafe { self.data.as_mut() } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl Drop for MappedMutexGuard<'_, T> { + #[inline] + fn drop(&mut self) { + unsafe { + self.inner.unlock(); + } + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Debug for MappedMutexGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&**self, f) + } +} + +#[unstable(feature = "mapped_lock_guards", issue = "117108")] +impl fmt::Display for MappedMutexGuard<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + (**self).fmt(f) + } +} + +impl<'a, T: ?Sized> MappedMutexGuard<'a, T> { + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data, e.g. + /// an enum variant. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedMutexGuard::map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn map(mut orig: Self, f: F) -> MappedMutexGuard<'a, U> + where + F: FnOnce(&mut T) -> &mut U, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `filter_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + let data = NonNull::from(f(unsafe { orig.data.as_mut() })); + let orig = ManuallyDrop::new(orig); + MappedMutexGuard { data, inner: orig.inner, _variance: PhantomData } + } + + /// Makes a [`MappedMutexGuard`] for a component of the borrowed data. The + /// original guard is returned as an `Err(...)` if the closure returns + /// `None`. + /// + /// The `Mutex` is already locked, so this cannot fail. + /// + /// This is an associated function that needs to be used as + /// `MappedMutexGuard::filter_map(...)`. A method would interfere with methods of the + /// same name on the contents of the `MutexGuard` used through `Deref`. + #[unstable(feature = "mapped_lock_guards", issue = "117108")] + // #[unstable(feature = "nonpoison_mutex", issue = "134645")] + pub fn filter_map(mut orig: Self, f: F) -> Result, Self> + where + F: FnOnce(&mut T) -> Option<&mut U>, + U: ?Sized, + { + // SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard + // was created, and have been upheld throughout `map` and/or `filter_map`. + // The signature of the closure guarantees that it will not "leak" the lifetime of the reference + // passed to it. If the closure panics, the guard will be dropped. + match f(unsafe { orig.data.as_mut() }) { + Some(data) => { + let data = NonNull::from(data); + let orig = ManuallyDrop::new(orig); + Ok(MappedMutexGuard { data, inner: orig.inner, _variance: PhantomData }) + } + None => Err(orig), + } + } +} diff --git a/library/std/src/sync/once_lock.rs b/library/std/src/sync/once_lock.rs index a5c3a6c46a43..b224044cbe09 100644 --- a/library/std/src/sync/once_lock.rs +++ b/library/std/src/sync/once_lock.rs @@ -16,6 +16,8 @@ use crate::sync::Once; /// A `OnceLock` can be thought of as a safe abstraction over uninitialized data that becomes /// initialized once written. /// +/// Unlike [`Mutex`](crate::sync::Mutex), `OnceLock` is never poisoned on panic. +/// /// [`OnceCell`]: crate::cell::OnceCell /// [`LazyLock`]: crate::sync::LazyLock /// [`LazyLock::new(|| ...)`]: crate::sync::LazyLock::new diff --git a/library/std/src/sync/poison.rs b/library/std/src/sync/poison.rs index 0c05f152ef84..31889dcc10fa 100644 --- a/library/std/src/sync/poison.rs +++ b/library/std/src/sync/poison.rs @@ -2,18 +2,21 @@ //! //! # Poisoning //! -//! All synchronization objects in this module implement a strategy called "poisoning" -//! where if a thread panics while holding the exclusive access granted by the primitive, -//! the state of the primitive is set to "poisoned". -//! This information is then propagated to all other threads +//! All synchronization objects in this module implement a strategy called +//! "poisoning" where a primitive becomes poisoned if it recognizes that some +//! thread has panicked while holding the exclusive access granted by the +//! primitive. This information is then propagated to all other threads //! to signify that the data protected by this primitive is likely tainted //! (some invariant is not being upheld). //! -//! The specifics of how this "poisoned" state affects other threads -//! depend on the primitive. See [#Overview] below. +//! The specifics of how this "poisoned" state affects other threads and whether +//! the panics are recognized reliably or on a best-effort basis depend on the +//! primitive. See [Overview](#overview) below. //! //! For the alternative implementations that do not employ poisoning, -//! see `std::sync::nonpoisoning`. +//! see [`std::sync::nonpoison`]. +//! +//! [`std::sync::nonpoison`]: crate::sync::nonpoison //! //! # Overview //! @@ -34,14 +37,15 @@ //! - [`Mutex`]: Mutual Exclusion mechanism, which ensures that at //! most one thread at a time is able to access some data. //! -//! [`Mutex::lock()`] returns a [`LockResult`], -//! providing a way to deal with the poisoned state. -//! See [`Mutex`'s documentation](Mutex#poisoning) for more. +//! Panicking while holding the lock typically poisons the mutex, but it is +//! not guaranteed to detect this condition in all circumstances. +//! [`Mutex::lock()`] returns a [`LockResult`], providing a way to deal with +//! the poisoned state. See [`Mutex`'s documentation](Mutex#poisoning) for more. //! //! - [`Once`]: A thread-safe way to run a piece of code only once. //! Mostly useful for implementing one-time global initialization. //! -//! [`Once`] is poisoned if the piece of code passed to +//! [`Once`] is reliably poisoned if the piece of code passed to //! [`Once::call_once()`] or [`Once::call_once_force()`] panics. //! When in poisoned state, subsequent calls to [`Once::call_once()`] will panic too. //! [`Once::call_once_force()`] can be used to clear the poisoned state. @@ -51,13 +55,11 @@ //! writer at a time. In some cases, this can be more efficient than //! a mutex. //! -//! This implementation, like [`Mutex`], will become poisoned on a panic. +//! This implementation, like [`Mutex`], usually becomes poisoned on a panic. //! Note, however, that an `RwLock` may only be poisoned if a panic occurs //! while it is locked exclusively (write mode). If a panic occurs in any reader, //! then the lock will not be poisoned. -// FIXME(sync_nonpoison) add links to sync::nonpoison to the doc comment above. - #[stable(feature = "rust1", since = "1.0.0")] pub use self::condvar::{Condvar, WaitTimeoutResult}; #[unstable(feature = "mapped_lock_guards", issue = "117108")] diff --git a/library/std/src/sync/poison/condvar.rs b/library/std/src/sync/poison/condvar.rs index 7f0f3f652bcb..0e9d4233c657 100644 --- a/library/std/src/sync/poison/condvar.rs +++ b/library/std/src/sync/poison/condvar.rs @@ -13,7 +13,7 @@ use crate::time::{Duration, Instant}; #[stable(feature = "wait_timeout", since = "1.5.0")] pub struct WaitTimeoutResult(bool); -// FIXME(sync_nonpoison): `WaitTimeoutResult` is actually poisoning-agnostic, it seems. +// FIXME(nonpoison_condvar): `WaitTimeoutResult` is actually poisoning-agnostic, it seems. // Should we take advantage of this fact? impl WaitTimeoutResult { /// Returns `true` if the wait was known to have timed out. diff --git a/library/std/src/sync/poison/mutex.rs b/library/std/src/sync/poison/mutex.rs index 30325be685c3..6205c4fa4ca4 100644 --- a/library/std/src/sync/poison/mutex.rs +++ b/library/std/src/sync/poison/mutex.rs @@ -18,20 +18,69 @@ use crate::sys::sync as sys; /// # Poisoning /// /// The mutexes in this module implement a strategy called "poisoning" where a -/// mutex is considered poisoned whenever a thread panics while holding the -/// mutex. Once a mutex is poisoned, all other threads are unable to access the -/// data by default as it is likely tainted (some invariant is not being -/// upheld). +/// mutex becomes poisoned if it recognizes that the thread holding it has +/// panicked. /// -/// For a mutex, this means that the [`lock`] and [`try_lock`] methods return a +/// Once a mutex is poisoned, all other threads are unable to access the data by +/// default as it is likely tainted (some invariant is not being upheld). For a +/// mutex, this means that the [`lock`] and [`try_lock`] methods return a /// [`Result`] which indicates whether a mutex has been poisoned or not. Most /// usage of a mutex will simply [`unwrap()`] these results, propagating panics /// among threads to ensure that a possibly invalid invariant is not witnessed. /// -/// A poisoned mutex, however, does not prevent all access to the underlying -/// data. The [`PoisonError`] type has an [`into_inner`] method which will return -/// the guard that would have otherwise been returned on a successful lock. This -/// allows access to the data, despite the lock being poisoned. +/// Poisoning is only advisory: the [`PoisonError`] type has an [`into_inner`] +/// method which will return the guard that would have otherwise been returned +/// on a successful lock. This allows access to the data, despite the lock being +/// poisoned. +/// +/// In addition, the panic detection is not ideal, so even unpoisoned mutexes +/// need to be handled with care, since certain panics may have been skipped. +/// Here is a non-exhaustive list of situations where this might occur: +/// +/// - If a mutex is locked while a panic is underway, e.g. within a [`Drop`] +/// implementation or a [panic hook], panicking for the second time while the +/// lock is held will leave the mutex unpoisoned. Note that while double panic +/// usually aborts the program, [`catch_unwind`] can prevent this. +/// +/// - Locking and unlocking the mutex across different panic contexts, e.g. by +/// storing the guard to a [`Cell`] within [`Drop::drop`] and accessing it +/// outside, or vice versa, can affect poisoning status in an unexpected way. +/// +/// - Foreign exceptions do not currently trigger poisoning even in absence of +/// other panics. +/// +/// While this rarely happens in realistic code, `unsafe` code cannot rely on +/// poisoning for soundness, since the behavior of poisoning can depend on +/// outside context. Here's an example of **incorrect** use of poisoning: +/// +/// ```rust +/// use std::sync::Mutex; +/// +/// struct MutexBox { +/// data: Mutex<*mut T>, +/// } +/// +/// impl MutexBox { +/// pub fn new(value: T) -> Self { +/// Self { +/// data: Mutex::new(Box::into_raw(Box::new(value))), +/// } +/// } +/// +/// pub fn replace_with(&self, f: impl FnOnce(T) -> T) { +/// let ptr = self.data.lock().expect("poisoned"); +/// // While `f` is running, the data is moved out of `*ptr`. If `f` +/// // panics, `*ptr` keeps pointing at a dropped value. The intention +/// // is that this will poison the mutex, so the following calls to +/// // `replace_with` will panic without reading `*ptr`. But since +/// // poisoning is not guaranteed to occur if this is run from a panic +/// // hook, this can lead to use-after-free. +/// unsafe { +/// (*ptr).write(f((*ptr).read())); +/// } +/// } +/// } +/// ``` /// /// [`new`]: Self::new /// [`lock`]: Self::lock @@ -39,6 +88,9 @@ use crate::sys::sync as sys; /// [`unwrap()`]: Result::unwrap /// [`PoisonError`]: super::PoisonError /// [`into_inner`]: super::PoisonError::into_inner +/// [panic hook]: crate::panic::set_hook +/// [`catch_unwind`]: crate::panic::catch_unwind +/// [`Cell`]: crate::cell::Cell /// /// # Examples /// @@ -650,7 +702,7 @@ impl fmt::Debug for Mutex { d.field("data", &&**err.get_ref()); } Err(TryLockError::WouldBlock) => { - d.field("data", &format_args!("")); + d.field("data", &""); } } d.field("poisoned", &self.poison.get()); diff --git a/library/std/src/sync/poison/once.rs b/library/std/src/sync/poison/once.rs index 103e51954079..faf2913c5473 100644 --- a/library/std/src/sync/poison/once.rs +++ b/library/std/src/sync/poison/once.rs @@ -136,7 +136,8 @@ impl Once { /// it will *poison* this [`Once`] instance, causing all future invocations of /// `call_once` to also panic. /// - /// This is similar to [poisoning with mutexes][poison]. + /// This is similar to [poisoning with mutexes][poison], but this mechanism + /// is guaranteed to never skip panics within `f`. /// /// [poison]: struct.Mutex.html#poisoning #[inline] @@ -293,6 +294,9 @@ impl Once { /// Blocks the current thread until initialization has completed, ignoring /// poisoning. + /// + /// If this [`Once`] has been poisoned, this function blocks until it + /// becomes completed, unlike [`Once::wait()`], which panics in this case. #[stable(feature = "once_wait", since = "1.86.0")] pub fn wait_force(&self) { if !self.inner.is_completed() { diff --git a/library/std/src/sync/poison/rwlock.rs b/library/std/src/sync/poison/rwlock.rs index 934a173425a8..2c92602bc878 100644 --- a/library/std/src/sync/poison/rwlock.rs +++ b/library/std/src/sync/poison/rwlock.rs @@ -46,10 +46,12 @@ use crate::sys::sync as sys; /// /// # Poisoning /// -/// An `RwLock`, like [`Mutex`], will become poisoned on a panic. Note, however, -/// that an `RwLock` may only be poisoned if a panic occurs while it is locked -/// exclusively (write mode). If a panic occurs in any reader, then the lock -/// will not be poisoned. +/// An `RwLock`, like [`Mutex`], will [usually] become poisoned on a panic. Note, +/// however, that an `RwLock` may only be poisoned if a panic occurs while it is +/// locked exclusively (write mode). If a panic occurs in any reader, then the +/// lock will not be poisoned. +/// +/// [usually]: super::Mutex#poisoning /// /// # Examples /// diff --git a/library/std/src/sys/args/common.rs b/library/std/src/sys/args/common.rs index e787105a05a7..33f3794ee633 100644 --- a/library/std/src/sys/args/common.rs +++ b/library/std/src/sys/args/common.rs @@ -12,7 +12,7 @@ impl !Sync for Args {} impl Args { #[inline] - pub(super) fn new(args: Vec) -> Self { + pub fn new(args: Vec) -> Self { Args { iter: args.into_iter() } } } diff --git a/library/std/src/sys/configure_builtins.rs b/library/std/src/sys/configure_builtins.rs new file mode 100644 index 000000000000..9d776b778dcb --- /dev/null +++ b/library/std/src/sys/configure_builtins.rs @@ -0,0 +1,22 @@ +/// Hook into .init_array to enable LSE atomic operations at startup, if +/// supported. +#[cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "compiler-builtins-c")))] +#[used] +#[unsafe(link_section = ".init_array.90")] +static RUST_LSE_INIT: extern "C" fn() = { + extern "C" fn init_lse() { + use crate::arch; + + // This is provided by compiler-builtins::aarch64_linux. + unsafe extern "C" { + fn __rust_enable_lse(); + } + + if arch::is_aarch64_feature_detected!("lse") { + unsafe { + __rust_enable_lse(); + } + } + } + init_lse +}; diff --git a/library/std/src/sys/fs/windows.rs b/library/std/src/sys/fs/windows.rs index 9b674a251652..09feddd0be9a 100644 --- a/library/std/src/sys/fs/windows.rs +++ b/library/std/src/sys/fs/windows.rs @@ -80,7 +80,7 @@ pub struct OpenOptions { attributes: u32, share_mode: u32, security_qos_flags: u32, - security_attributes: *mut c::SECURITY_ATTRIBUTES, + inherit_handle: bool, } #[derive(Clone, PartialEq, Eq, Debug)] @@ -203,7 +203,7 @@ impl OpenOptions { share_mode: c::FILE_SHARE_READ | c::FILE_SHARE_WRITE | c::FILE_SHARE_DELETE, attributes: 0, security_qos_flags: 0, - security_attributes: ptr::null_mut(), + inherit_handle: false, } } @@ -243,8 +243,8 @@ impl OpenOptions { // receive is `SECURITY_ANONYMOUS = 0x0`, which we can't check for later on. self.security_qos_flags = flags | c::SECURITY_SQOS_PRESENT; } - pub fn security_attributes(&mut self, attrs: *mut c::SECURITY_ATTRIBUTES) { - self.security_attributes = attrs; + pub fn inherit_handle(&mut self, inherit: bool) { + self.inherit_handle = inherit; } fn get_access_mode(&self) -> io::Result { @@ -307,12 +307,17 @@ impl File { fn open_native(path: &WCStr, opts: &OpenOptions) -> io::Result { let creation = opts.get_creation_mode()?; + let sa = c::SECURITY_ATTRIBUTES { + nLength: size_of::() as u32, + lpSecurityDescriptor: ptr::null_mut(), + bInheritHandle: opts.inherit_handle as c::BOOL, + }; let handle = unsafe { c::CreateFileW( path.as_ptr(), opts.get_access_mode()?, opts.share_mode, - opts.security_attributes, + if opts.inherit_handle { &sa } else { ptr::null() }, creation, opts.get_flags_and_attributes(), ptr::null_mut(), diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs index f9a02b522e5e..8ec0a0e33023 100644 --- a/library/std/src/sys/mod.rs +++ b/library/std/src/sys/mod.rs @@ -1,5 +1,10 @@ #![allow(unsafe_op_in_unsafe_fn)] +/// The configure builtins provides runtime support compiler-builtin features +/// which require dynamic intialization to work as expected, e.g. aarch64 +/// outline-atomics. +mod configure_builtins; + /// The PAL (platform abstraction layer) contains platform-specific abstractions /// for implementing the features in the other submodules, e.g. UNIX file /// descriptors. diff --git a/library/std/src/sys/pal/hermit/thread.rs b/library/std/src/sys/pal/hermit/thread.rs index 9bc5a16b8002..cc4734b68190 100644 --- a/library/std/src/sys/pal/hermit/thread.rs +++ b/library/std/src/sys/pal/hermit/thread.rs @@ -58,7 +58,11 @@ impl Thread { } } - pub unsafe fn new(stack: usize, p: Box) -> io::Result { + pub unsafe fn new( + stack: usize, + _name: Option<&str>, + p: Box, + ) -> io::Result { unsafe { Thread::new_with_coreid(stack, p, -1 /* = no specific core */) } @@ -111,6 +115,10 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { unsafe { Ok(NonZero::new_unchecked(hermit_abi::available_parallelism())) } } diff --git a/library/std/src/sys/pal/itron/thread.rs b/library/std/src/sys/pal/itron/thread.rs index 813e1cbcd58f..4e14cb3cbcaa 100644 --- a/library/std/src/sys/pal/itron/thread.rs +++ b/library/std/src/sys/pal/itron/thread.rs @@ -86,7 +86,11 @@ impl Thread { /// # Safety /// /// See `thread::Builder::spawn_unchecked` for safety requirements. - pub unsafe fn new(stack: usize, p: Box) -> io::Result { + pub unsafe fn new( + stack: usize, + _name: Option<&str>, + p: Box, + ) -> io::Result { let inner = Box::new(ThreadInner { start: UnsafeCell::new(ManuallyDrop::new(p)), lifecycle: AtomicUsize::new(LIFECYCLE_INIT), @@ -357,6 +361,10 @@ unsafe fn terminate_and_delete_current_task() -> ! { unsafe { crate::hint::unreachable_unchecked() }; } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { super::unsupported() } diff --git a/library/std/src/sys/pal/sgx/thread.rs b/library/std/src/sys/pal/sgx/thread.rs index 85f6dcd96b4a..1f613badcd70 100644 --- a/library/std/src/sys/pal/sgx/thread.rs +++ b/library/std/src/sys/pal/sgx/thread.rs @@ -1,6 +1,6 @@ #![cfg_attr(test, allow(dead_code))] // why is this necessary? -use super::abi::usercalls; +use super::abi::{thread, usercalls}; use super::unsupported; use crate::ffi::CStr; use crate::io; @@ -96,7 +96,11 @@ pub mod wait_notify { impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(_stack: usize, p: Box) -> io::Result { + pub unsafe fn new( + _stack: usize, + _name: Option<&str>, + p: Box, + ) -> io::Result { let mut queue_lock = task_queue::lock(); unsafe { usercalls::launch_thread()? }; let (task, handle) = task_queue::Task::new(p); @@ -145,6 +149,10 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + Some(thread::current().addr().get() as u64) +} + pub fn available_parallelism() -> io::Result> { unsupported() } diff --git a/library/std/src/sys/pal/teeos/thread.rs b/library/std/src/sys/pal/teeos/thread.rs index b9cdc7a2a58b..1812d11e692e 100644 --- a/library/std/src/sys/pal/teeos/thread.rs +++ b/library/std/src/sys/pal/teeos/thread.rs @@ -22,7 +22,11 @@ unsafe extern "C" { impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(stack: usize, p: Box) -> io::Result { + pub unsafe fn new( + stack: usize, + _name: Option<&str>, + p: Box, + ) -> io::Result { let p = Box::into_raw(Box::new(p)); let mut native: libc::pthread_t = unsafe { mem::zeroed() }; let mut attr: libc::pthread_attr_t = unsafe { mem::zeroed() }; @@ -140,6 +144,10 @@ impl Drop for Thread { } } +pub(crate) fn current_os_id() -> Option { + None +} + // Note: Both `sched_getaffinity` and `sysconf` are available but not functional on // teeos, so this function always returns an Error! pub fn available_parallelism() -> io::Result> { diff --git a/library/std/src/sys/pal/uefi/helpers.rs b/library/std/src/sys/pal/uefi/helpers.rs index 271dc4d11de7..b50574de937a 100644 --- a/library/std/src/sys/pal/uefi/helpers.rs +++ b/library/std/src/sys/pal/uefi/helpers.rs @@ -444,17 +444,17 @@ impl<'a> DevicePathNode<'a> { impl<'a> PartialEq for DevicePathNode<'a> { fn eq(&self, other: &Self) -> bool { - let self_len = self.length(); - let other_len = other.length(); - - self_len == other_len - && unsafe { - compiler_builtins::mem::memcmp( - self.protocol.as_ptr().cast(), - other.protocol.as_ptr().cast(), - usize::from(self_len), - ) == 0 - } + // Compare as a single buffer rather than by field since it optimizes better. + // + // SAFETY: `Protocol` is followed by a buffer of `length - sizeof::()`. `Protocol` + // has no padding so it is sound to interpret as a slice. + unsafe { + let s1 = + slice::from_raw_parts(self.protocol.as_ptr().cast::(), self.length().into()); + let s2 = + slice::from_raw_parts(other.protocol.as_ptr().cast::(), other.length().into()); + s1 == s2 + } } } diff --git a/library/std/src/sys/pal/uefi/thread.rs b/library/std/src/sys/pal/uefi/thread.rs index e4776ec42fbb..47a48008c76d 100644 --- a/library/std/src/sys/pal/uefi/thread.rs +++ b/library/std/src/sys/pal/uefi/thread.rs @@ -11,7 +11,11 @@ pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024; impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(_stack: usize, _p: Box) -> io::Result { + pub unsafe fn new( + _stack: usize, + _name: Option<&str>, + _p: Box, + ) -> io::Result { unsupported() } @@ -52,6 +56,10 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { // UEFI is single threaded Ok(NonZero::new(1).unwrap()) diff --git a/library/std/src/sys/pal/unix/stack_overflow.rs b/library/std/src/sys/pal/unix/stack_overflow.rs index a3be2cdf738f..0d2100d66bc0 100644 --- a/library/std/src/sys/pal/unix/stack_overflow.rs +++ b/library/std/src/sys/pal/unix/stack_overflow.rs @@ -8,8 +8,8 @@ pub struct Handler { } impl Handler { - pub unsafe fn new() -> Handler { - make_handler(false) + pub unsafe fn new(thread_name: Option>) -> Handler { + make_handler(false, thread_name) } fn null() -> Handler { @@ -72,7 +72,6 @@ mod imp { use crate::sync::OnceLock; use crate::sync::atomic::{Atomic, AtomicBool, AtomicPtr, AtomicUsize, Ordering}; use crate::sys::pal::unix::os; - use crate::thread::with_current_name; use crate::{io, mem, panic, ptr}; // Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages @@ -120,7 +119,8 @@ mod imp { && thread_info.guard_page_range.contains(&fault_addr) { let name = thread_info.thread_name.as_deref().unwrap_or(""); - rtprintpanic!("\nthread '{name}' has overflowed its stack\n"); + let tid = crate::thread::current_os_id(); + rtprintpanic!("\nthread '{name}' ({tid}) has overflowed its stack\n"); rtabort!("stack overflow"); } }) @@ -158,13 +158,12 @@ mod imp { if !NEED_ALTSTACK.load(Ordering::Relaxed) { // haven't set up our sigaltstack yet NEED_ALTSTACK.store(true, Ordering::Release); - let handler = unsafe { make_handler(true) }; + let handler = unsafe { make_handler(true, None) }; MAIN_ALTSTACK.store(handler.data, Ordering::Relaxed); mem::forget(handler); if let Some(guard_page_range) = guard_page_range.take() { - let thread_name = with_current_name(|name| name.map(Box::from)); - set_current_info(guard_page_range, thread_name); + set_current_info(guard_page_range, Some(Box::from("main"))); } } @@ -230,14 +229,13 @@ mod imp { /// # Safety /// Mutates the alternate signal stack #[forbid(unsafe_op_in_unsafe_fn)] - pub unsafe fn make_handler(main_thread: bool) -> Handler { + pub unsafe fn make_handler(main_thread: bool, thread_name: Option>) -> Handler { if !NEED_ALTSTACK.load(Ordering::Acquire) { return Handler::null(); } if !main_thread { if let Some(guard_page_range) = unsafe { current_guard() } { - let thread_name = with_current_name(|name| name.map(Box::from)); set_current_info(guard_page_range, thread_name); } } @@ -634,7 +632,10 @@ mod imp { pub unsafe fn cleanup() {} - pub unsafe fn make_handler(_main_thread: bool) -> super::Handler { + pub unsafe fn make_handler( + _main_thread: bool, + _thread_name: Option>, + ) -> super::Handler { super::Handler::null() } @@ -696,7 +697,8 @@ mod imp { if code == c::EXCEPTION_STACK_OVERFLOW { crate::thread::with_current_name(|name| { let name = name.unwrap_or(""); - rtprintpanic!("\nthread '{name}' has overflowed its stack\n"); + let tid = crate::thread::current_os_id(); + rtprintpanic!("\nthread '{name}' ({tid}) has overflowed its stack\n"); }); } c::EXCEPTION_CONTINUE_SEARCH @@ -717,7 +719,10 @@ mod imp { pub unsafe fn cleanup() {} - pub unsafe fn make_handler(main_thread: bool) -> super::Handler { + pub unsafe fn make_handler( + main_thread: bool, + _thread_name: Option>, + ) -> super::Handler { if !main_thread { reserve_stack(); } diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index e4f5520d8a33..36e53e7cadca 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -22,6 +22,11 @@ pub const DEFAULT_MIN_STACK_SIZE: usize = 256 * 1024; #[cfg(any(target_os = "espidf", target_os = "nuttx"))] pub const DEFAULT_MIN_STACK_SIZE: usize = 0; // 0 indicates that the stack size configured in the ESP-IDF/NuttX menuconfig system should be used +struct ThreadData { + name: Option>, + f: Box, +} + pub struct Thread { id: libc::pthread_t, } @@ -34,8 +39,12 @@ unsafe impl Sync for Thread {} impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces - pub unsafe fn new(stack: usize, p: Box) -> io::Result { - let p = Box::into_raw(Box::new(p)); + pub unsafe fn new( + stack: usize, + name: Option<&str>, + f: Box, + ) -> io::Result { + let data = Box::into_raw(Box::new(ThreadData { name: name.map(Box::from), f })); let mut native: libc::pthread_t = mem::zeroed(); let mut attr: mem::MaybeUninit = mem::MaybeUninit::uninit(); assert_eq!(libc::pthread_attr_init(attr.as_mut_ptr()), 0); @@ -73,7 +82,7 @@ impl Thread { }; } - let ret = libc::pthread_create(&mut native, attr.as_ptr(), thread_start, p as *mut _); + let ret = libc::pthread_create(&mut native, attr.as_ptr(), thread_start, data as *mut _); // Note: if the thread creation fails and this assert fails, then p will // be leaked. However, an alternative design could cause double-free // which is clearly worse. @@ -82,19 +91,20 @@ impl Thread { return if ret != 0 { // The thread failed to start and as a result p was not consumed. Therefore, it is // safe to reconstruct the box so that it gets deallocated. - drop(Box::from_raw(p)); + drop(Box::from_raw(data)); Err(io::Error::from_raw_os_error(ret)) } else { Ok(Thread { id: native }) }; - extern "C" fn thread_start(main: *mut libc::c_void) -> *mut libc::c_void { + extern "C" fn thread_start(data: *mut libc::c_void) -> *mut libc::c_void { unsafe { + let data = Box::from_raw(data as *mut ThreadData); // Next, set up our stack overflow handler which may get triggered if we run // out of stack. - let _handler = stack_overflow::Handler::new(); + let _handler = stack_overflow::Handler::new(data.name); // Finally, let's run some code. - Box::from_raw(main as *mut Box)(); + (data.f)(); } ptr::null_mut() } @@ -388,6 +398,62 @@ impl Drop for Thread { } } +pub(crate) fn current_os_id() -> Option { + // Most Unix platforms have a way to query an integer ID of the current thread, all with + // slightly different spellings. + // + // The OS thread ID is used rather than `pthread_self` so as to match what will be displayed + // for process inspection (debuggers, trace, `top`, etc.). + cfg_if::cfg_if! { + // Most platforms have a function returning a `pid_t` or int, which is an `i32`. + if #[cfg(any(target_os = "android", target_os = "linux"))] { + use crate::sys::weak::syscall; + + // `libc::gettid` is only available on glibc 2.30+, but the syscall is available + // since Linux 2.4.11. + syscall!(fn gettid() -> libc::pid_t;); + + // SAFETY: FFI call with no preconditions. + let id: libc::pid_t = unsafe { gettid() }; + Some(id as u64) + } else if #[cfg(target_os = "nto")] { + // SAFETY: FFI call with no preconditions. + let id: libc::pid_t = unsafe { libc::gettid() }; + Some(id as u64) + } else if #[cfg(target_os = "openbsd")] { + // SAFETY: FFI call with no preconditions. + let id: libc::pid_t = unsafe { libc::getthrid() }; + Some(id as u64) + } else if #[cfg(target_os = "freebsd")] { + // SAFETY: FFI call with no preconditions. + let id: libc::c_int = unsafe { libc::pthread_getthreadid_np() }; + Some(id as u64) + } else if #[cfg(target_os = "netbsd")] { + // SAFETY: FFI call with no preconditions. + let id: libc::lwpid_t = unsafe { libc::_lwp_self() }; + Some(id as u64) + } else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] { + // On Illumos and Solaris, the `pthread_t` is the same as the OS thread ID. + // SAFETY: FFI call with no preconditions. + let id: libc::pthread_t = unsafe { libc::pthread_self() }; + Some(id as u64) + } else if #[cfg(target_vendor = "apple")] { + // Apple allows querying arbitrary thread IDs, `thread=NULL` queries the current thread. + let mut id = 0u64; + // SAFETY: `thread_id` is a valid pointer, no other preconditions. + let status: libc::c_int = unsafe { libc::pthread_threadid_np(0, &mut id) }; + if status == 0 { + Some(id) + } else { + None + } + } else { + // Other platforms don't have an OS thread ID or don't have a way to access it. + None + } + } +} + #[cfg(any( target_os = "linux", target_os = "nto", diff --git a/library/std/src/sys/pal/unsupported/thread.rs b/library/std/src/sys/pal/unsupported/thread.rs index 8a3119fa292d..34d9b5ec70c6 100644 --- a/library/std/src/sys/pal/unsupported/thread.rs +++ b/library/std/src/sys/pal/unsupported/thread.rs @@ -10,7 +10,11 @@ pub const DEFAULT_MIN_STACK_SIZE: usize = 64 * 1024; impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(_stack: usize, _p: Box) -> io::Result { + pub unsafe fn new( + _stack: usize, + _name: Option<&str>, + _p: Box, + ) -> io::Result { unsupported() } @@ -35,6 +39,10 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { unsupported() } diff --git a/library/std/src/sys/pal/wasi/thread.rs b/library/std/src/sys/pal/wasi/thread.rs index 5f21a553673a..4755e2ef5da0 100644 --- a/library/std/src/sys/pal/wasi/thread.rs +++ b/library/std/src/sys/pal/wasi/thread.rs @@ -73,7 +73,7 @@ impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements cfg_if::cfg_if! { if #[cfg(target_feature = "atomics")] { - pub unsafe fn new(stack: usize, p: Box) -> io::Result { + pub unsafe fn new(stack: usize, _name: Option<&str>, p: Box) -> io::Result { let p = Box::into_raw(Box::new(p)); let mut native: libc::pthread_t = unsafe { mem::zeroed() }; let mut attr: libc::pthread_attr_t = unsafe { mem::zeroed() }; @@ -120,7 +120,7 @@ impl Thread { } } } else { - pub unsafe fn new(_stack: usize, _p: Box) -> io::Result { + pub unsafe fn new(_stack: usize, _name: Option<&str>, _p: Box) -> io::Result { crate::sys::unsupported() } } @@ -194,6 +194,10 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { cfg_if::cfg_if! { if #[cfg(target_feature = "atomics")] { diff --git a/library/std/src/sys/pal/wasm/atomics/thread.rs b/library/std/src/sys/pal/wasm/atomics/thread.rs index 44ce3eab109f..42a7dbdf8b8b 100644 --- a/library/std/src/sys/pal/wasm/atomics/thread.rs +++ b/library/std/src/sys/pal/wasm/atomics/thread.rs @@ -10,7 +10,11 @@ pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 1024; impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(_stack: usize, _p: Box) -> io::Result { + pub unsafe fn new( + _stack: usize, + _name: Option<&str>, + _p: Box, + ) -> io::Result { unsupported() } @@ -52,6 +56,10 @@ impl Thread { pub fn join(self) {} } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { unsupported() } diff --git a/library/std/src/sys/pal/windows/c/bindings.txt b/library/std/src/sys/pal/windows/c/bindings.txt index 827d96e73db4..c8e4dca47816 100644 --- a/library/std/src/sys/pal/windows/c/bindings.txt +++ b/library/std/src/sys/pal/windows/c/bindings.txt @@ -2185,6 +2185,7 @@ GetSystemInfo GetSystemTimeAsFileTime GetSystemTimePreciseAsFileTime GetTempPathW +GetThreadId GetUserProfileDirectoryW GetWindowsDirectoryW HANDLE diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index b2e3aabc6335..45a273d241a9 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -61,6 +61,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : * windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME)); windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME)); windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32); +windows_targets::link!("kernel32.dll" "system" fn GetThreadId(thread : HANDLE) -> u32); windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32); windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL); diff --git a/library/std/src/sys/pal/windows/stack_overflow.rs b/library/std/src/sys/pal/windows/stack_overflow.rs index 734cd30bed08..9a40551b985e 100644 --- a/library/std/src/sys/pal/windows/stack_overflow.rs +++ b/library/std/src/sys/pal/windows/stack_overflow.rs @@ -20,7 +20,8 @@ unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POIN if code == c::EXCEPTION_STACK_OVERFLOW { thread::with_current_name(|name| { let name = name.unwrap_or(""); - rtprintpanic!("\nthread '{name}' has overflowed its stack\n"); + let tid = thread::current_os_id(); + rtprintpanic!("\nthread '{name}' ({tid}) has overflowed its stack\n"); }); } c::EXCEPTION_CONTINUE_SEARCH diff --git a/library/std/src/sys/pal/windows/thread.rs b/library/std/src/sys/pal/windows/thread.rs index 147851717553..c708da5af12a 100644 --- a/library/std/src/sys/pal/windows/thread.rs +++ b/library/std/src/sys/pal/windows/thread.rs @@ -20,7 +20,11 @@ pub struct Thread { impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces - pub unsafe fn new(stack: usize, p: Box) -> io::Result { + pub unsafe fn new( + stack: usize, + _name: Option<&str>, + p: Box, + ) -> io::Result { let p = Box::into_raw(Box::new(p)); // CreateThread rounds up values for the stack size to the nearest page size (at least 4kb). @@ -123,6 +127,14 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + // SAFETY: FFI call with no preconditions. + let id: u32 = unsafe { c::GetThreadId(c::GetCurrentThread()) }; + + // A return value of 0 indicates failed lookup. + if id == 0 { None } else { Some(id.into()) } +} + pub fn available_parallelism() -> io::Result> { let res = unsafe { let mut sysinfo: c::SYSTEM_INFO = crate::mem::zeroed(); diff --git a/library/std/src/sys/pal/xous/thread.rs b/library/std/src/sys/pal/xous/thread.rs index 1b344e984dc3..92803c94c6e7 100644 --- a/library/std/src/sys/pal/xous/thread.rs +++ b/library/std/src/sys/pal/xous/thread.rs @@ -20,7 +20,11 @@ pub const GUARD_PAGE_SIZE: usize = 4096; impl Thread { // unsafe: see thread::Builder::spawn_unchecked for safety requirements - pub unsafe fn new(stack: usize, p: Box) -> io::Result { + pub unsafe fn new( + stack: usize, + _name: Option<&str>, + p: Box, + ) -> io::Result { let p = Box::into_raw(Box::new(p)); let mut stack_size = crate::cmp::max(stack, MIN_STACK_SIZE); @@ -141,6 +145,10 @@ impl Thread { } } +pub(crate) fn current_os_id() -> Option { + None +} + pub fn available_parallelism() -> io::Result> { // We're unicore right now. Ok(unsafe { NonZero::new_unchecked(1) }) diff --git a/library/std/src/sys/process/windows.rs b/library/std/src/sys/process/windows.rs index 1ee3fbd285f5..f9e15b824757 100644 --- a/library/std/src/sys/process/windows.rs +++ b/library/std/src/sys/process/windows.rs @@ -623,16 +623,10 @@ impl Stdio { // permissions as well as the ability to be inherited to child // processes (as this is about to be inherited). Stdio::Null => { - let size = size_of::(); - let mut sa = c::SECURITY_ATTRIBUTES { - nLength: size as u32, - lpSecurityDescriptor: ptr::null_mut(), - bInheritHandle: 1, - }; let mut opts = OpenOptions::new(); opts.read(stdio_id == c::STD_INPUT_HANDLE); opts.write(stdio_id != c::STD_INPUT_HANDLE); - opts.security_attributes(&mut sa); + opts.inherit_handle(true); File::open(Path::new(r"\\.\NUL"), &opts).map(|file| file.into_inner()) } } diff --git a/library/std/src/sys/random/sgx.rs b/library/std/src/sys/random/sgx.rs index c3647a8df220..462b19003fad 100644 --- a/library/std/src/sys/random/sgx.rs +++ b/library/std/src/sys/random/sgx.rs @@ -46,22 +46,22 @@ fn rdrand16() -> u16 { } pub fn fill_bytes(bytes: &mut [u8]) { - let mut chunks = bytes.array_chunks_mut(); - for chunk in &mut chunks { + let (chunks, remainder) = bytes.as_chunks_mut(); + for chunk in chunks { *chunk = rdrand64().to_ne_bytes(); } - let mut chunks = chunks.into_remainder().array_chunks_mut(); - for chunk in &mut chunks { + let (chunks, remainder) = remainder.as_chunks_mut(); + for chunk in chunks { *chunk = rdrand32().to_ne_bytes(); } - let mut chunks = chunks.into_remainder().array_chunks_mut(); - for chunk in &mut chunks { + let (chunks, remainder) = remainder.as_chunks_mut(); + for chunk in chunks { *chunk = rdrand16().to_ne_bytes(); } - if let [byte] = chunks.into_remainder() { + if let [byte] = remainder { *byte = rdrand16() as u8; } } diff --git a/library/std/src/sys/random/uefi.rs b/library/std/src/sys/random/uefi.rs index 5f001f0f532a..4a71d32fffeb 100644 --- a/library/std/src/sys/random/uefi.rs +++ b/library/std/src/sys/random/uefi.rs @@ -138,12 +138,11 @@ mod rdrand { } unsafe fn rdrand_exact(dest: &mut [u8]) -> Option<()> { - let mut chunks = dest.array_chunks_mut(); - for chunk in &mut chunks { + let (chunks, tail) = dest.as_chunks_mut(); + for chunk in chunks { *chunk = unsafe { rdrand() }?.to_ne_bytes(); } - let tail = chunks.into_remainder(); let n = tail.len(); if n > 0 { let src = unsafe { rdrand() }?.to_ne_bytes(); diff --git a/library/std/src/thread/current.rs b/library/std/src/thread/current.rs index 414711298f04..5c8799035269 100644 --- a/library/std/src/thread/current.rs +++ b/library/std/src/thread/current.rs @@ -1,4 +1,4 @@ -use super::{Thread, ThreadId}; +use super::{Thread, ThreadId, imp}; use crate::mem::ManuallyDrop; use crate::ptr; use crate::sys::thread_local::local_pointer; @@ -148,6 +148,17 @@ pub(crate) fn current_id() -> ThreadId { id::get_or_init() } +/// Gets the OS thread ID of the thread that invokes it, if available. If not, return the Rust +/// thread ID. +/// +/// We use a `u64` to all possible platform IDs without excess `cfg`; most use `int`, some use a +/// pointer, and Apple uses `uint64_t`. This is a "best effort" approach for diagnostics and is +/// allowed to fall back to a non-OS ID (such as the Rust thread ID) or a non-unique ID (such as a +/// PID) if the thread ID cannot be retrieved. +pub(crate) fn current_os_id() -> u64 { + imp::current_os_id().unwrap_or_else(|| current_id().as_u64().get()) +} + /// Gets a reference to the handle of the thread that invokes it, if the handle /// has been initialized. pub(super) fn try_with_current(f: F) -> R diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 8cd1e0163a12..292323d01189 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -183,7 +183,7 @@ mod current; #[stable(feature = "rust1", since = "1.0.0")] pub use current::current; -pub(crate) use current::{current_id, current_or_unnamed, drop_current}; +pub(crate) use current::{current_id, current_or_unnamed, current_os_id, drop_current}; use current::{set_current, try_with_current}; mod spawnhook; @@ -595,7 +595,7 @@ impl Builder { // Similarly, the `sys` implementation must guarantee that no references to the closure // exist after the thread has terminated, which is signaled by `Thread::join` // returning. - native: unsafe { imp::Thread::new(stack_size, main)? }, + native: unsafe { imp::Thread::new(stack_size, my_thread.name(), main)? }, thread: my_thread, packet: my_packet, }) @@ -2018,6 +2018,9 @@ fn _assert_sync_and_send() { /// which may take time on systems with large numbers of mountpoints. /// (This does not apply to cgroup v2, or to processes not in a /// cgroup.) +/// - It does not attempt to take `ulimit` into account. If there is a limit set on the number of +/// threads, `available_parallelism` cannot know how much of that limit a Rust program should +/// take, or know in a reliable and race-free way how much of that limit is already taken. /// /// On all targets: /// - It may overcount the amount of parallelism available when running in a VM diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs index 59ec48a57d1c..ae889f1e7782 100644 --- a/library/std/src/thread/tests.rs +++ b/library/std/src/thread/tests.rs @@ -346,6 +346,13 @@ fn test_thread_id_not_equal() { assert!(thread::current().id() != spawned_id); } +#[test] +fn test_thread_os_id_not_equal() { + let spawned_id = thread::spawn(|| thread::current_os_id()).join().unwrap(); + let current_id = thread::current_os_id(); + assert!(current_id != spawned_id); +} + #[test] fn test_scoped_threads_drop_result_before_join() { let actually_finished = &AtomicBool::new(false); diff --git a/library/std/tests/sync/lib.rs b/library/std/tests/sync/lib.rs index 51190f0894fb..94f1fe96b6a2 100644 --- a/library/std/tests/sync/lib.rs +++ b/library/std/tests/sync/lib.rs @@ -6,7 +6,10 @@ #![feature(reentrant_lock)] #![feature(rwlock_downgrade)] #![feature(std_internals)] +#![feature(sync_nonpoison)] +#![feature(nonpoison_mutex)] #![allow(internal_features)] +#![feature(macro_metavar_expr_concat)] // For concatenating identifiers in macros. mod barrier; mod condvar; @@ -29,3 +32,55 @@ mod rwlock; #[path = "../common/mod.rs"] mod common; + +#[track_caller] +fn result_unwrap(x: Result) -> T { + x.unwrap() +} + +/// A macro that generates two test cases for both the poison and nonpoison locks. +/// +/// To write a test that tests both `poison` and `nonpoison` locks, import any of the types +/// under both `poison` and `nonpoison` using the module name `locks` instead. For example, write +/// `use locks::Mutex;` instead of `use std::sync::poiosn::Mutex`. This will import the correct type +/// for each test variant. +/// +/// Write a test as normal in the `test_body`, but instead of calling `unwrap` on `poison` methods +/// that return a `LockResult` or similar, call the function `maybe_unwrap(...)` on the result. +/// +/// For example, call `maybe_unwrap(mutex.lock())` instead of `mutex.lock().unwrap()` or +/// `maybe_unwrap(rwlock.read())` instead of `rwlock.read().unwrap()`. +/// +/// For the `poison` types, `maybe_unwrap` will simply unwrap the `Result` (usually this is a form +/// of `LockResult`, but it could also be other kinds of results). For the `nonpoison` types, it is +/// a no-op (the identity function). +/// +/// The test names will be prefiex with `poison_` or `nonpoison_`. +macro_rules! nonpoison_and_poison_unwrap_test { + ( + name: $name:ident, + test_body: {$($test_body:tt)*} + ) => { + // Creates the nonpoison test. + #[test] + fn ${concat(nonpoison_, $name)}() { + #[allow(unused_imports)] + use ::std::convert::identity as maybe_unwrap; + use ::std::sync::nonpoison as locks; + + $($test_body)* + } + + // Creates the poison test with the suffix `_unwrap_poisoned`. + #[test] + fn ${concat(poison_, $name)}() { + #[allow(unused_imports)] + use super::result_unwrap as maybe_unwrap; + use ::std::sync::poison as locks; + + $($test_body)* + } + } +} + +use nonpoison_and_poison_unwrap_test; diff --git a/library/std/tests/sync/mutex.rs b/library/std/tests/sync/mutex.rs index ac82914d6de4..90cefc0d5946 100644 --- a/library/std/tests/sync/mutex.rs +++ b/library/std/tests/sync/mutex.rs @@ -6,7 +6,71 @@ use std::sync::mpsc::channel; use std::sync::{Arc, Condvar, MappedMutexGuard, Mutex, MutexGuard, TryLockError}; use std::{hint, mem, thread}; -struct Packet(Arc<(Mutex, Condvar)>); +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Nonpoison & Poison Tests +//////////////////////////////////////////////////////////////////////////////////////////////////// +use super::nonpoison_and_poison_unwrap_test; + +nonpoison_and_poison_unwrap_test!( + name: smoke, + test_body: { + use locks::Mutex; + + let m = Mutex::new(()); + drop(maybe_unwrap(m.lock())); + drop(maybe_unwrap(m.lock())); + } +); + +nonpoison_and_poison_unwrap_test!( + name: lots_and_lots, + test_body: { + use locks::Mutex; + + const J: u32 = 1000; + const K: u32 = 3; + + let m = Arc::new(Mutex::new(0)); + + fn inc(m: &Mutex) { + for _ in 0..J { + *maybe_unwrap(m.lock()) += 1; + } + } + + let (tx, rx) = channel(); + for _ in 0..K { + let tx2 = tx.clone(); + let m2 = m.clone(); + thread::spawn(move || { + inc(&m2); + tx2.send(()).unwrap(); + }); + let tx2 = tx.clone(); + let m2 = m.clone(); + thread::spawn(move || { + inc(&m2); + tx2.send(()).unwrap(); + }); + } + + drop(tx); + for _ in 0..2 * K { + rx.recv().unwrap(); + } + assert_eq!(*maybe_unwrap(m.lock()), J * K * 2); + } +); + +nonpoison_and_poison_unwrap_test!( + name: try_lock, + test_body: { + use locks::Mutex; + + let m = Mutex::new(()); + *m.try_lock().unwrap() = (); + } +); #[derive(Eq, PartialEq, Debug)] struct NonCopy(i32); @@ -26,58 +90,278 @@ fn test_needs_drop() { assert!(mem::needs_drop::()); } -#[derive(Clone, Eq, PartialEq, Debug)] -struct Cloneable(i32); +nonpoison_and_poison_unwrap_test!( + name: test_into_inner, + test_body: { + use locks::Mutex; -#[test] -fn smoke() { - let m = Mutex::new(()); - drop(m.lock().unwrap()); - drop(m.lock().unwrap()); -} - -#[test] -fn lots_and_lots() { - const J: u32 = 1000; - const K: u32 = 3; - - let m = Arc::new(Mutex::new(0)); - - fn inc(m: &Mutex) { - for _ in 0..J { - *m.lock().unwrap() += 1; - } + let m = Mutex::new(NonCopy(10)); + assert_eq!(maybe_unwrap(m.into_inner()), NonCopy(10)); } +); + +nonpoison_and_poison_unwrap_test!( + name: test_into_inner_drop, + test_body: { + use locks::Mutex; + + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = Mutex::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + { + let _inner = maybe_unwrap(m.into_inner()); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + } + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } +); + +nonpoison_and_poison_unwrap_test!( + name: test_get_mut, + test_body: { + use locks::Mutex; + + let mut m = Mutex::new(NonCopy(10)); + *maybe_unwrap(m.get_mut()) = NonCopy(20); + assert_eq!(maybe_unwrap(m.into_inner()), NonCopy(20)); + } +); + +nonpoison_and_poison_unwrap_test!( + name: test_get_cloned, + test_body: { + use locks::Mutex; + + #[derive(Clone, Eq, PartialEq, Debug)] + struct Cloneable(i32); + + let m = Mutex::new(Cloneable(10)); + + assert_eq!(maybe_unwrap(m.get_cloned()), Cloneable(10)); + } +); + +nonpoison_and_poison_unwrap_test!( + name: test_set, + test_body: { + use locks::Mutex; + + fn inner(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T) + where + T: Debug + Eq, + { + let m = Mutex::new(init()); + + assert_eq!(*maybe_unwrap(m.lock()), init()); + maybe_unwrap(m.set(value())); + assert_eq!(*maybe_unwrap(m.lock()), value()); + } + + inner(|| NonCopy(10), || NonCopy(20)); + inner(|| NonCopyNeedsDrop(10), || NonCopyNeedsDrop(20)); + } +); + +// Ensure that old values that are replaced by `set` are correctly dropped. +nonpoison_and_poison_unwrap_test!( + name: test_set_drop, + test_body: { + use locks::Mutex; + + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = Mutex::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + + let different = Foo(Arc::new(AtomicUsize::new(42))); + maybe_unwrap(m.set(different)); + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } +); + +nonpoison_and_poison_unwrap_test!( + name: test_replace, + test_body: { + use locks::Mutex; + + fn inner(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T) + where + T: Debug + Eq, + { + let m = Mutex::new(init()); + + assert_eq!(*maybe_unwrap(m.lock()), init()); + assert_eq!(maybe_unwrap(m.replace(value())), init()); + assert_eq!(*maybe_unwrap(m.lock()), value()); + } + + inner(|| NonCopy(10), || NonCopy(20)); + inner(|| NonCopyNeedsDrop(10), || NonCopyNeedsDrop(20)); + } +); + +// FIXME(nonpoison_condvar): Move this to the `condvar.rs` test file once `nonpoison::condvar` gets +// implemented. +#[test] +fn test_mutex_arc_condvar() { + struct Packet(Arc<(Mutex, Condvar)>); + + let packet = Packet(Arc::new((Mutex::new(false), Condvar::new()))); + let packet2 = Packet(packet.0.clone()); let (tx, rx) = channel(); - for _ in 0..K { - let tx2 = tx.clone(); - let m2 = m.clone(); - thread::spawn(move || { - inc(&m2); - tx2.send(()).unwrap(); - }); - let tx2 = tx.clone(); - let m2 = m.clone(); - thread::spawn(move || { - inc(&m2); - tx2.send(()).unwrap(); - }); - } - drop(tx); - for _ in 0..2 * K { + let _t = thread::spawn(move || { + // Wait until our parent has taken the lock. + rx.recv().unwrap(); + let &(ref lock, ref cvar) = &*packet2.0; + + // Set the data to `true` and wake up our parent. + let mut guard = lock.lock().unwrap(); + *guard = true; + cvar.notify_one(); + }); + + let &(ref lock, ref cvar) = &*packet.0; + let mut guard = lock.lock().unwrap(); + // Wake up our child. + tx.send(()).unwrap(); + + // Wait until our child has set the data to `true`. + assert!(!*guard); + while !*guard { + guard = cvar.wait(guard).unwrap(); + } +} + +nonpoison_and_poison_unwrap_test!( + name: test_mutex_arc_nested, + test_body: { + use locks::Mutex; + + // Tests nested mutexes and access + // to underlying data. + let arc = Arc::new(Mutex::new(1)); + let arc2 = Arc::new(Mutex::new(arc)); + let (tx, rx) = channel(); + let _t = thread::spawn(move || { + let lock = maybe_unwrap(arc2.lock()); + let lock2 = maybe_unwrap(lock.lock()); + assert_eq!(*lock2, 1); + tx.send(()).unwrap(); + }); rx.recv().unwrap(); } - assert_eq!(*m.lock().unwrap(), J * K * 2); -} +); -#[test] -fn try_lock() { - let m = Mutex::new(()); - *m.try_lock().unwrap() = (); -} +nonpoison_and_poison_unwrap_test!( + name: test_mutex_unsized, + test_body: { + use locks::Mutex; + let mutex: &Mutex<[i32]> = &Mutex::new([1, 2, 3]); + { + let b = &mut *maybe_unwrap(mutex.lock()); + b[0] = 4; + b[2] = 5; + } + let comp: &[i32] = &[4, 2, 5]; + assert_eq!(&*maybe_unwrap(mutex.lock()), comp); + } +); + +nonpoison_and_poison_unwrap_test!( + name: test_mapping_mapped_guard, + test_body: { + use locks::{Mutex, MutexGuard, MappedMutexGuard}; + + let arr = [0; 4]; + let lock = Mutex::new(arr); + let guard = maybe_unwrap(lock.lock()); + let guard = MutexGuard::map(guard, |arr| &mut arr[..2]); + let mut guard = MappedMutexGuard::map(guard, |slice| &mut slice[1..]); + assert_eq!(guard.len(), 1); + guard[0] = 42; + drop(guard); + assert_eq!(*maybe_unwrap(lock.lock()), [0, 42, 0, 0]); + } +); + +#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] +nonpoison_and_poison_unwrap_test!( + name: test_panics, + test_body: { + use locks::Mutex; + + let mutex = Mutex::new(42); + + let catch_unwind_result1 = panic::catch_unwind(AssertUnwindSafe(|| { + let _guard1 = maybe_unwrap(mutex.lock()); + + panic!("test panic with mutex once"); + })); + assert!(catch_unwind_result1.is_err()); + + let catch_unwind_result2 = panic::catch_unwind(AssertUnwindSafe(|| { + let _guard2 = maybe_unwrap(mutex.lock()); + + panic!("test panic with mutex twice"); + })); + assert!(catch_unwind_result2.is_err()); + + let catch_unwind_result3 = panic::catch_unwind(AssertUnwindSafe(|| { + let _guard3 = maybe_unwrap(mutex.lock()); + + panic!("test panic with mutex thrice"); + })); + assert!(catch_unwind_result3.is_err()); + } +); + +#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] +nonpoison_and_poison_unwrap_test!( + name: test_mutex_arc_access_in_unwind, + test_body: { + use locks::Mutex; + + let arc = Arc::new(Mutex::new(1)); + let arc2 = arc.clone(); + let _ = thread::spawn(move || -> () { + struct Unwinder { + i: Arc>, + } + impl Drop for Unwinder { + fn drop(&mut self) { + *maybe_unwrap(self.i.lock()) += 1; + } + } + let _u = Unwinder { i: arc2 }; + panic!(); + }) + .join(); + let lock = maybe_unwrap(arc.lock()); + assert_eq!(*lock, 2); + } +); + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Poison Tests +//////////////////////////////////////////////////////////////////////////////////////////////////// + +/// Creates a mutex that is immediately poisoned. fn new_poisoned_mutex(value: T) -> Mutex { let mutex = Mutex::new(value); @@ -93,30 +377,6 @@ fn new_poisoned_mutex(value: T) -> Mutex { mutex } -#[test] -fn test_into_inner() { - let m = Mutex::new(NonCopy(10)); - assert_eq!(m.into_inner().unwrap(), NonCopy(10)); -} - -#[test] -fn test_into_inner_drop() { - struct Foo(Arc); - impl Drop for Foo { - fn drop(&mut self) { - self.0.fetch_add(1, Ordering::SeqCst); - } - } - let num_drops = Arc::new(AtomicUsize::new(0)); - let m = Mutex::new(Foo(num_drops.clone())); - assert_eq!(num_drops.load(Ordering::SeqCst), 0); - { - let _inner = m.into_inner().unwrap(); - assert_eq!(num_drops.load(Ordering::SeqCst), 0); - } - assert_eq!(num_drops.load(Ordering::SeqCst), 1); -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn test_into_inner_poison() { @@ -128,16 +388,12 @@ fn test_into_inner_poison() { } } -#[test] -fn test_get_cloned() { - let m = Mutex::new(Cloneable(10)); - - assert_eq!(m.get_cloned().unwrap(), Cloneable(10)); -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn test_get_cloned_poison() { + #[derive(Clone, Eq, PartialEq, Debug)] + struct Cloneable(i32); + let m = new_poisoned_mutex(Cloneable(10)); match m.get_cloned() { @@ -146,13 +402,6 @@ fn test_get_cloned_poison() { } } -#[test] -fn test_get_mut() { - let mut m = Mutex::new(NonCopy(10)); - *m.get_mut().unwrap() = NonCopy(20); - assert_eq!(m.into_inner().unwrap(), NonCopy(20)); -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn test_get_mut_poison() { @@ -164,23 +413,6 @@ fn test_get_mut_poison() { } } -#[test] -fn test_set() { - fn inner(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T) - where - T: Debug + Eq, - { - let m = Mutex::new(init()); - - assert_eq!(*m.lock().unwrap(), init()); - m.set(value()).unwrap(); - assert_eq!(*m.lock().unwrap(), value()); - } - - inner(|| NonCopy(10), || NonCopy(20)); - inner(|| NonCopyNeedsDrop(10), || NonCopyNeedsDrop(20)); -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn test_set_poison() { @@ -203,23 +435,6 @@ fn test_set_poison() { inner(|| NonCopyNeedsDrop(10), || NonCopyNeedsDrop(20)); } -#[test] -fn test_replace() { - fn inner(mut init: impl FnMut() -> T, mut value: impl FnMut() -> T) - where - T: Debug + Eq, - { - let m = Mutex::new(init()); - - assert_eq!(*m.lock().unwrap(), init()); - assert_eq!(m.replace(value()).unwrap(), init()); - assert_eq!(*m.lock().unwrap(), value()); - } - - inner(|| NonCopy(10), || NonCopy(20)); - inner(|| NonCopyNeedsDrop(10), || NonCopyNeedsDrop(20)); -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn test_replace_poison() { @@ -242,32 +457,11 @@ fn test_replace_poison() { inner(|| NonCopyNeedsDrop(10), || NonCopyNeedsDrop(20)); } -#[test] -fn test_mutex_arc_condvar() { - let packet = Packet(Arc::new((Mutex::new(false), Condvar::new()))); - let packet2 = Packet(packet.0.clone()); - let (tx, rx) = channel(); - let _t = thread::spawn(move || { - // wait until parent gets in - rx.recv().unwrap(); - let &(ref lock, ref cvar) = &*packet2.0; - let mut lock = lock.lock().unwrap(); - *lock = true; - cvar.notify_one(); - }); - - let &(ref lock, ref cvar) = &*packet.0; - let mut lock = lock.lock().unwrap(); - tx.send(()).unwrap(); - assert!(!*lock); - while !*lock { - lock = cvar.wait(lock).unwrap(); - } -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn test_arc_condvar_poison() { + struct Packet(Arc<(Mutex, Condvar)>); + let packet = Packet(Arc::new((Mutex::new(1), Condvar::new()))); let packet2 = Packet(packet.0.clone()); let (tx, rx) = channel(); @@ -326,69 +520,6 @@ fn test_mutex_arc_poison_mapped() { assert!(arc.is_poisoned()); } -#[test] -fn test_mutex_arc_nested() { - // Tests nested mutexes and access - // to underlying data. - let arc = Arc::new(Mutex::new(1)); - let arc2 = Arc::new(Mutex::new(arc)); - let (tx, rx) = channel(); - let _t = thread::spawn(move || { - let lock = arc2.lock().unwrap(); - let lock2 = lock.lock().unwrap(); - assert_eq!(*lock2, 1); - tx.send(()).unwrap(); - }); - rx.recv().unwrap(); -} - -#[test] -#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] -fn test_mutex_arc_access_in_unwind() { - let arc = Arc::new(Mutex::new(1)); - let arc2 = arc.clone(); - let _ = thread::spawn(move || -> () { - struct Unwinder { - i: Arc>, - } - impl Drop for Unwinder { - fn drop(&mut self) { - *self.i.lock().unwrap() += 1; - } - } - let _u = Unwinder { i: arc2 }; - panic!(); - }) - .join(); - let lock = arc.lock().unwrap(); - assert_eq!(*lock, 2); -} - -#[test] -fn test_mutex_unsized() { - let mutex: &Mutex<[i32]> = &Mutex::new([1, 2, 3]); - { - let b = &mut *mutex.lock().unwrap(); - b[0] = 4; - b[2] = 5; - } - let comp: &[i32] = &[4, 2, 5]; - assert_eq!(&*mutex.lock().unwrap(), comp); -} - -#[test] -fn test_mapping_mapped_guard() { - let arr = [0; 4]; - let mut lock = Mutex::new(arr); - let guard = lock.lock().unwrap(); - let guard = MutexGuard::map(guard, |arr| &mut arr[..2]); - let mut guard = MappedMutexGuard::map(guard, |slice| &mut slice[1..]); - assert_eq!(guard.len(), 1); - guard[0] = 42; - drop(guard); - assert_eq!(*lock.get_mut().unwrap(), [0, 42, 0, 0]); -} - #[test] #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")] fn panic_while_mapping_unlocked_poison() { diff --git a/library/std_detect/src/detect/arch/riscv.rs b/library/std_detect/src/detect/arch/riscv.rs index b86190d7bbf0..1d21b1d48558 100644 --- a/library/std_detect/src/detect/arch/riscv.rs +++ b/library/std_detect/src/detect/arch/riscv.rs @@ -73,6 +73,7 @@ features! { /// * Zihintpause: `"zihintpause"` /// * Zihpm: `"zihpm"` /// * Zimop: `"zimop"` + /// * Zabha: `"zabha"` /// * Zacas: `"zacas"` /// * Zawrs: `"zawrs"` /// * Zfa: `"zfa"` @@ -195,6 +196,8 @@ features! { /// "Zaamo" Extension for Atomic Memory Operations @FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zawrs: "zawrs"; /// "Zawrs" Extension for Wait-on-Reservation-Set Instructions + @FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zabha: "zabha"; + /// "Zabha" Extension for Byte and Halfword Atomic Memory Operations @FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zacas: "zacas"; /// "Zacas" Extension for Atomic Compare-and-Swap (CAS) Instructions @FEATURE: #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")] zam: "zam"; diff --git a/library/std_detect/src/detect/macros.rs b/library/std_detect/src/detect/macros.rs index c2a006d3753a..17140e15653d 100644 --- a/library/std_detect/src/detect/macros.rs +++ b/library/std_detect/src/detect/macros.rs @@ -131,14 +131,13 @@ macro_rules! features { }; } - #[test] //tidy:skip #[deny(unexpected_cfgs)] #[deny(unfulfilled_lint_expectations)] - fn unexpected_cfgs() { + const _: () = { $( check_cfg_feature!($feature, $feature_lit $(, without cfg check: $feature_cfg_check)? $(: $($target_feature_lit),*)?); )* - } + }; /// Each variant denotes a position in a bitset for a particular feature. /// diff --git a/library/std_detect/src/detect/os/linux/riscv.rs b/library/std_detect/src/detect/os/linux/riscv.rs index dbb3664890e5..18f9f68ec67e 100644 --- a/library/std_detect/src/detect/os/linux/riscv.rs +++ b/library/std_detect/src/detect/os/linux/riscv.rs @@ -10,13 +10,13 @@ use super::super::riscv::imply_features; use super::auxvec; use crate::detect::{Feature, bit, cache}; -// See +// See // for runtime status query constants. const PR_RISCV_V_GET_CONTROL: libc::c_int = 70; const PR_RISCV_V_VSTATE_CTRL_ON: libc::c_int = 2; const PR_RISCV_V_VSTATE_CTRL_CUR_MASK: libc::c_int = 3; -// See +// See // for riscv_hwprobe struct and hardware probing constants. #[repr(C)] @@ -98,6 +98,7 @@ const RISCV_HWPROBE_EXT_ZVFBFWMA: u64 = 1 << 54; const RISCV_HWPROBE_EXT_ZICBOM: u64 = 1 << 55; const RISCV_HWPROBE_EXT_ZAAMO: u64 = 1 << 56; const RISCV_HWPROBE_EXT_ZALRSC: u64 = 1 << 57; +const RISCV_HWPROBE_EXT_ZABHA: u64 = 1 << 58; const RISCV_HWPROBE_KEY_CPUPERF_0: i64 = 5; const RISCV_HWPROBE_MISALIGNED_FAST: u64 = 3; @@ -138,7 +139,7 @@ pub(crate) fn detect_features() -> cache::Initializer { // Use auxiliary vector to enable single-letter ISA extensions. // The values are part of the platform-specific [asm/hwcap.h][hwcap] // - // [hwcap]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/include/uapi/asm/hwcap.h?h=v6.15 + // [hwcap]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/riscv/include/uapi/asm/hwcap.h?h=v6.16 let auxv = auxvec::auxv().expect("read auxvec"); // should not fail on RISC-V platform let mut has_i = bit::test(auxv.hwcap, (b'i' - b'a').into()); #[allow(clippy::eq_op)] @@ -233,6 +234,7 @@ pub(crate) fn detect_features() -> cache::Initializer { enable_feature(Feature::zalrsc, test(RISCV_HWPROBE_EXT_ZALRSC)); enable_feature(Feature::zaamo, test(RISCV_HWPROBE_EXT_ZAAMO)); enable_feature(Feature::zawrs, test(RISCV_HWPROBE_EXT_ZAWRS)); + enable_feature(Feature::zabha, test(RISCV_HWPROBE_EXT_ZABHA)); enable_feature(Feature::zacas, test(RISCV_HWPROBE_EXT_ZACAS)); enable_feature(Feature::ztso, test(RISCV_HWPROBE_EXT_ZTSO)); diff --git a/library/std_detect/src/detect/os/riscv.rs b/library/std_detect/src/detect/os/riscv.rs index 46b7dd71eb35..c6acbd3525bd 100644 --- a/library/std_detect/src/detect/os/riscv.rs +++ b/library/std_detect/src/detect/os/riscv.rs @@ -90,7 +90,7 @@ pub(crate) fn imply_features(mut value: cache::Initializer) -> cache::Initialize group!(zks == zbkb & zbkc & zbkx & zksed & zksh); group!(zk == zkn & zkr & zkt); - imply!(zacas => zaamo); + imply!(zabha | zacas => zaamo); group!(a == zalrsc & zaamo); group!(b == zba & zbb & zbs); @@ -135,4 +135,5 @@ pub(crate) fn imply_features(mut value: cache::Initializer) -> cache::Initialize } #[cfg(test)] +#[path = "riscv/tests.rs"] mod tests; diff --git a/library/std_detect/tests/cpu-detection.rs b/library/std_detect/tests/cpu-detection.rs index 5ad32d83237c..0c4fa57f2b46 100644 --- a/library/std_detect/tests/cpu-detection.rs +++ b/library/std_detect/tests/cpu-detection.rs @@ -242,6 +242,7 @@ fn riscv_linux() { println!("zalrsc: {}", is_riscv_feature_detected!("zalrsc")); println!("zaamo: {}", is_riscv_feature_detected!("zaamo")); println!("zawrs: {}", is_riscv_feature_detected!("zawrs")); + println!("zabha: {}", is_riscv_feature_detected!("zabha")); println!("zacas: {}", is_riscv_feature_detected!("zacas")); println!("zam: {}", is_riscv_feature_detected!("zam")); println!("ztso: {}", is_riscv_feature_detected!("ztso")); diff --git a/library/stdarch/.github/workflows/rustc-pull.yml b/library/stdarch/.github/workflows/rustc-pull.yml index 6b90d8a500f0..1379bd06b0e9 100644 --- a/library/stdarch/.github/workflows/rustc-pull.yml +++ b/library/stdarch/.github/workflows/rustc-pull.yml @@ -12,6 +12,7 @@ jobs: if: github.repository == 'rust-lang/stdarch' uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main with: + github-app-id: ${{ vars.APP_CLIENT_ID }} # https://rust-lang.zulipchat.com/#narrow/channel/208962-t-libs.2Fstdarch/topic/Subtree.20sync.20automation/with/528461782 zulip-stream-id: 208962 zulip-bot-email: "stdarch-ci-bot@rust-lang.zulipchat.com" @@ -19,4 +20,4 @@ jobs: branch-name: rustc-pull secrets: zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }} - token: ${{ secrets.GITHUB_TOKEN }} + github-app-secret: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/library/stdarch/Cargo.lock b/library/stdarch/Cargo.lock index 21ce304db0d8..9df0791b8652 100644 --- a/library/stdarch/Cargo.lock +++ b/library/stdarch/Cargo.lock @@ -73,7 +73,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -90,9 +90,9 @@ checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "cc" -version = "1.2.30" +version = "1.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" +checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" dependencies = [ "shlex", ] @@ -105,9 +105,9 @@ checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "clap" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" dependencies = [ "clap_builder", "clap_derive", @@ -115,14 +115,14 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -134,7 +134,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -182,32 +182,11 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "csv" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" -dependencies = [ - "memchr", -] - [[package]] name = "darling" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ "darling_core", "darling_macro", @@ -215,27 +194,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 1.0.109", + "strsim", + "syn", ] [[package]] name = "darling_macro" -version = "0.13.4" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -357,14 +336,11 @@ name = "intrinsic-test" version = "0.1.0" dependencies = [ "clap", - "csv", "diff", "itertools", - "lazy_static", "log", "pretty_env_logger", "rayon", - "regex", "serde", "serde_json", ] @@ -401,12 +377,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - [[package]] name = "libc" version = "0.2.174" @@ -576,9 +546,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "ryu" @@ -618,14 +588,14 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -635,24 +605,25 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.14.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" dependencies = [ "serde", + "serde_derive", "serde_with_macros", ] [[package]] name = "serde_with_macros" -version = "1.5.2" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" dependencies = [ "darling", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -679,7 +650,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -724,7 +695,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.104", + "syn", ] [[package]] @@ -736,29 +707,12 @@ dependencies = [ "rand", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.104" @@ -943,5 +897,5 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] diff --git a/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile b/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile index 5ab3431ba272..b5c6874ca52e 100644 --- a/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile +++ b/library/stdarch/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update && \ gcc-loongarch64-linux-gnu libc6-dev-loong64-cross -ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc-14 \ +ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc \ CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-loongarch64-static -cpu max -L /usr/loongarch64-linux-gnu" \ OBJDUMP=loongarch64-linux-gnu-objdump \ STDARCH_TEST_SKIP_FEATURE=frecipe diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs index 4361acdc1fcc..cda0ebec6779 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs @@ -6,7058 +6,7059 @@ // OUT_DIR=`pwd`/crates/core_arch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lasx.spec // ``` +use crate::mem::transmute; use super::types::*; #[allow(improper_ctypes)] unsafe extern "unadjusted" { #[link_name = "llvm.loongarch.lasx.xvsll.b"] - fn __lasx_xvsll_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsll_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsll.h"] - fn __lasx_xvsll_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsll_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsll.w"] - fn __lasx_xvsll_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsll_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsll.d"] - fn __lasx_xvsll_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsll_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslli.b"] - fn __lasx_xvslli_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvslli_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslli.h"] - fn __lasx_xvslli_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvslli_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslli.w"] - fn __lasx_xvslli_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvslli_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslli.d"] - fn __lasx_xvslli_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvslli_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsra.b"] - fn __lasx_xvsra_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsra_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsra.h"] - fn __lasx_xvsra_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsra_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsra.w"] - fn __lasx_xvsra_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsra_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsra.d"] - fn __lasx_xvsra_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsra_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrai.b"] - fn __lasx_xvsrai_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvsrai_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrai.h"] - fn __lasx_xvsrai_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvsrai_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrai.w"] - fn __lasx_xvsrai_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvsrai_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrai.d"] - fn __lasx_xvsrai_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvsrai_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrar.b"] - fn __lasx_xvsrar_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsrar_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrar.h"] - fn __lasx_xvsrar_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsrar_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrar.w"] - fn __lasx_xvsrar_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsrar_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrar.d"] - fn __lasx_xvsrar_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsrar_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrari.b"] - fn __lasx_xvsrari_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvsrari_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrari.h"] - fn __lasx_xvsrari_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvsrari_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrari.w"] - fn __lasx_xvsrari_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvsrari_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrari.d"] - fn __lasx_xvsrari_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvsrari_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrl.b"] - fn __lasx_xvsrl_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsrl_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrl.h"] - fn __lasx_xvsrl_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsrl_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrl.w"] - fn __lasx_xvsrl_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsrl_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrl.d"] - fn __lasx_xvsrl_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsrl_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrli.b"] - fn __lasx_xvsrli_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvsrli_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrli.h"] - fn __lasx_xvsrli_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvsrli_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrli.w"] - fn __lasx_xvsrli_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvsrli_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrli.d"] - fn __lasx_xvsrli_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvsrli_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrlr.b"] - fn __lasx_xvsrlr_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsrlr_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrlr.h"] - fn __lasx_xvsrlr_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsrlr_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrlr.w"] - fn __lasx_xvsrlr_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsrlr_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrlr.d"] - fn __lasx_xvsrlr_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsrlr_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrlri.b"] - fn __lasx_xvsrlri_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvsrlri_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrlri.h"] - fn __lasx_xvsrlri_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvsrlri_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrlri.w"] - fn __lasx_xvsrlri_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvsrlri_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrlri.d"] - fn __lasx_xvsrlri_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvsrlri_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvbitclr.b"] - fn __lasx_xvbitclr_b(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvbitclr_b(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitclr.h"] - fn __lasx_xvbitclr_h(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvbitclr_h(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvbitclr.w"] - fn __lasx_xvbitclr_w(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvbitclr_w(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvbitclr.d"] - fn __lasx_xvbitclr_d(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvbitclr_d(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvbitclri.b"] - fn __lasx_xvbitclri_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvbitclri_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitclri.h"] - fn __lasx_xvbitclri_h(a: v16u16, b: u32) -> v16u16; + fn __lasx_xvbitclri_h(a: __v16u16, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvbitclri.w"] - fn __lasx_xvbitclri_w(a: v8u32, b: u32) -> v8u32; + fn __lasx_xvbitclri_w(a: __v8u32, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvbitclri.d"] - fn __lasx_xvbitclri_d(a: v4u64, b: u32) -> v4u64; + fn __lasx_xvbitclri_d(a: __v4u64, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvbitset.b"] - fn __lasx_xvbitset_b(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvbitset_b(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitset.h"] - fn __lasx_xvbitset_h(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvbitset_h(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvbitset.w"] - fn __lasx_xvbitset_w(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvbitset_w(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvbitset.d"] - fn __lasx_xvbitset_d(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvbitset_d(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvbitseti.b"] - fn __lasx_xvbitseti_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvbitseti_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitseti.h"] - fn __lasx_xvbitseti_h(a: v16u16, b: u32) -> v16u16; + fn __lasx_xvbitseti_h(a: __v16u16, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvbitseti.w"] - fn __lasx_xvbitseti_w(a: v8u32, b: u32) -> v8u32; + fn __lasx_xvbitseti_w(a: __v8u32, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvbitseti.d"] - fn __lasx_xvbitseti_d(a: v4u64, b: u32) -> v4u64; + fn __lasx_xvbitseti_d(a: __v4u64, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvbitrev.b"] - fn __lasx_xvbitrev_b(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvbitrev_b(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitrev.h"] - fn __lasx_xvbitrev_h(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvbitrev_h(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvbitrev.w"] - fn __lasx_xvbitrev_w(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvbitrev_w(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvbitrev.d"] - fn __lasx_xvbitrev_d(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvbitrev_d(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvbitrevi.b"] - fn __lasx_xvbitrevi_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvbitrevi_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitrevi.h"] - fn __lasx_xvbitrevi_h(a: v16u16, b: u32) -> v16u16; + fn __lasx_xvbitrevi_h(a: __v16u16, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvbitrevi.w"] - fn __lasx_xvbitrevi_w(a: v8u32, b: u32) -> v8u32; + fn __lasx_xvbitrevi_w(a: __v8u32, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvbitrevi.d"] - fn __lasx_xvbitrevi_d(a: v4u64, b: u32) -> v4u64; + fn __lasx_xvbitrevi_d(a: __v4u64, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvadd.b"] - fn __lasx_xvadd_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvadd_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvadd.h"] - fn __lasx_xvadd_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvadd_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvadd.w"] - fn __lasx_xvadd_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvadd_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvadd.d"] - fn __lasx_xvadd_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvadd_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddi.bu"] - fn __lasx_xvaddi_bu(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvaddi_bu(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvaddi.hu"] - fn __lasx_xvaddi_hu(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvaddi_hu(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvaddi.wu"] - fn __lasx_xvaddi_wu(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvaddi_wu(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddi.du"] - fn __lasx_xvaddi_du(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvaddi_du(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsub.b"] - fn __lasx_xvsub_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsub_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsub.h"] - fn __lasx_xvsub_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsub_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsub.w"] - fn __lasx_xvsub_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsub_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsub.d"] - fn __lasx_xvsub_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsub_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubi.bu"] - fn __lasx_xvsubi_bu(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvsubi_bu(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsubi.hu"] - fn __lasx_xvsubi_hu(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvsubi_hu(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsubi.wu"] - fn __lasx_xvsubi_wu(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvsubi_wu(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsubi.du"] - fn __lasx_xvsubi_du(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvsubi_du(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmax.b"] - fn __lasx_xvmax_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvmax_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmax.h"] - fn __lasx_xvmax_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvmax_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmax.w"] - fn __lasx_xvmax_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvmax_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmax.d"] - fn __lasx_xvmax_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmax_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaxi.b"] - fn __lasx_xvmaxi_b(a: v32i8, b: i32) -> v32i8; + fn __lasx_xvmaxi_b(a: __v32i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmaxi.h"] - fn __lasx_xvmaxi_h(a: v16i16, b: i32) -> v16i16; + fn __lasx_xvmaxi_h(a: __v16i16, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmaxi.w"] - fn __lasx_xvmaxi_w(a: v8i32, b: i32) -> v8i32; + fn __lasx_xvmaxi_w(a: __v8i32, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmaxi.d"] - fn __lasx_xvmaxi_d(a: v4i64, b: i32) -> v4i64; + fn __lasx_xvmaxi_d(a: __v4i64, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmax.bu"] - fn __lasx_xvmax_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvmax_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvmax.hu"] - fn __lasx_xvmax_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvmax_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmax.wu"] - fn __lasx_xvmax_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvmax_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmax.du"] - fn __lasx_xvmax_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvmax_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmaxi.bu"] - fn __lasx_xvmaxi_bu(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvmaxi_bu(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvmaxi.hu"] - fn __lasx_xvmaxi_hu(a: v16u16, b: u32) -> v16u16; + fn __lasx_xvmaxi_hu(a: __v16u16, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmaxi.wu"] - fn __lasx_xvmaxi_wu(a: v8u32, b: u32) -> v8u32; + fn __lasx_xvmaxi_wu(a: __v8u32, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmaxi.du"] - fn __lasx_xvmaxi_du(a: v4u64, b: u32) -> v4u64; + fn __lasx_xvmaxi_du(a: __v4u64, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmin.b"] - fn __lasx_xvmin_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvmin_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmin.h"] - fn __lasx_xvmin_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvmin_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmin.w"] - fn __lasx_xvmin_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvmin_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmin.d"] - fn __lasx_xvmin_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmin_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmini.b"] - fn __lasx_xvmini_b(a: v32i8, b: i32) -> v32i8; + fn __lasx_xvmini_b(a: __v32i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmini.h"] - fn __lasx_xvmini_h(a: v16i16, b: i32) -> v16i16; + fn __lasx_xvmini_h(a: __v16i16, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmini.w"] - fn __lasx_xvmini_w(a: v8i32, b: i32) -> v8i32; + fn __lasx_xvmini_w(a: __v8i32, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmini.d"] - fn __lasx_xvmini_d(a: v4i64, b: i32) -> v4i64; + fn __lasx_xvmini_d(a: __v4i64, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmin.bu"] - fn __lasx_xvmin_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvmin_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvmin.hu"] - fn __lasx_xvmin_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvmin_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmin.wu"] - fn __lasx_xvmin_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvmin_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmin.du"] - fn __lasx_xvmin_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvmin_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmini.bu"] - fn __lasx_xvmini_bu(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvmini_bu(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvmini.hu"] - fn __lasx_xvmini_hu(a: v16u16, b: u32) -> v16u16; + fn __lasx_xvmini_hu(a: __v16u16, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmini.wu"] - fn __lasx_xvmini_wu(a: v8u32, b: u32) -> v8u32; + fn __lasx_xvmini_wu(a: __v8u32, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmini.du"] - fn __lasx_xvmini_du(a: v4u64, b: u32) -> v4u64; + fn __lasx_xvmini_du(a: __v4u64, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvseq.b"] - fn __lasx_xvseq_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvseq_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvseq.h"] - fn __lasx_xvseq_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvseq_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvseq.w"] - fn __lasx_xvseq_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvseq_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvseq.d"] - fn __lasx_xvseq_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvseq_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvseqi.b"] - fn __lasx_xvseqi_b(a: v32i8, b: i32) -> v32i8; + fn __lasx_xvseqi_b(a: __v32i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvseqi.h"] - fn __lasx_xvseqi_h(a: v16i16, b: i32) -> v16i16; + fn __lasx_xvseqi_h(a: __v16i16, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvseqi.w"] - fn __lasx_xvseqi_w(a: v8i32, b: i32) -> v8i32; + fn __lasx_xvseqi_w(a: __v8i32, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvseqi.d"] - fn __lasx_xvseqi_d(a: v4i64, b: i32) -> v4i64; + fn __lasx_xvseqi_d(a: __v4i64, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslt.b"] - fn __lasx_xvslt_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvslt_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslt.h"] - fn __lasx_xvslt_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvslt_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslt.w"] - fn __lasx_xvslt_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvslt_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslt.d"] - fn __lasx_xvslt_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvslt_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslti.b"] - fn __lasx_xvslti_b(a: v32i8, b: i32) -> v32i8; + fn __lasx_xvslti_b(a: __v32i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslti.h"] - fn __lasx_xvslti_h(a: v16i16, b: i32) -> v16i16; + fn __lasx_xvslti_h(a: __v16i16, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslti.w"] - fn __lasx_xvslti_w(a: v8i32, b: i32) -> v8i32; + fn __lasx_xvslti_w(a: __v8i32, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslti.d"] - fn __lasx_xvslti_d(a: v4i64, b: i32) -> v4i64; + fn __lasx_xvslti_d(a: __v4i64, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslt.bu"] - fn __lasx_xvslt_bu(a: v32u8, b: v32u8) -> v32i8; + fn __lasx_xvslt_bu(a: __v32u8, b: __v32u8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslt.hu"] - fn __lasx_xvslt_hu(a: v16u16, b: v16u16) -> v16i16; + fn __lasx_xvslt_hu(a: __v16u16, b: __v16u16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslt.wu"] - fn __lasx_xvslt_wu(a: v8u32, b: v8u32) -> v8i32; + fn __lasx_xvslt_wu(a: __v8u32, b: __v8u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslt.du"] - fn __lasx_xvslt_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvslt_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslti.bu"] - fn __lasx_xvslti_bu(a: v32u8, b: u32) -> v32i8; + fn __lasx_xvslti_bu(a: __v32u8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslti.hu"] - fn __lasx_xvslti_hu(a: v16u16, b: u32) -> v16i16; + fn __lasx_xvslti_hu(a: __v16u16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslti.wu"] - fn __lasx_xvslti_wu(a: v8u32, b: u32) -> v8i32; + fn __lasx_xvslti_wu(a: __v8u32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslti.du"] - fn __lasx_xvslti_du(a: v4u64, b: u32) -> v4i64; + fn __lasx_xvslti_du(a: __v4u64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsle.b"] - fn __lasx_xvsle_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsle_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsle.h"] - fn __lasx_xvsle_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsle_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsle.w"] - fn __lasx_xvsle_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsle_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsle.d"] - fn __lasx_xvsle_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsle_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslei.b"] - fn __lasx_xvslei_b(a: v32i8, b: i32) -> v32i8; + fn __lasx_xvslei_b(a: __v32i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslei.h"] - fn __lasx_xvslei_h(a: v16i16, b: i32) -> v16i16; + fn __lasx_xvslei_h(a: __v16i16, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslei.w"] - fn __lasx_xvslei_w(a: v8i32, b: i32) -> v8i32; + fn __lasx_xvslei_w(a: __v8i32, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslei.d"] - fn __lasx_xvslei_d(a: v4i64, b: i32) -> v4i64; + fn __lasx_xvslei_d(a: __v4i64, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsle.bu"] - fn __lasx_xvsle_bu(a: v32u8, b: v32u8) -> v32i8; + fn __lasx_xvsle_bu(a: __v32u8, b: __v32u8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsle.hu"] - fn __lasx_xvsle_hu(a: v16u16, b: v16u16) -> v16i16; + fn __lasx_xvsle_hu(a: __v16u16, b: __v16u16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsle.wu"] - fn __lasx_xvsle_wu(a: v8u32, b: v8u32) -> v8i32; + fn __lasx_xvsle_wu(a: __v8u32, b: __v8u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsle.du"] - fn __lasx_xvsle_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvsle_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvslei.bu"] - fn __lasx_xvslei_bu(a: v32u8, b: u32) -> v32i8; + fn __lasx_xvslei_bu(a: __v32u8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvslei.hu"] - fn __lasx_xvslei_hu(a: v16u16, b: u32) -> v16i16; + fn __lasx_xvslei_hu(a: __v16u16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvslei.wu"] - fn __lasx_xvslei_wu(a: v8u32, b: u32) -> v8i32; + fn __lasx_xvslei_wu(a: __v8u32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvslei.du"] - fn __lasx_xvslei_du(a: v4u64, b: u32) -> v4i64; + fn __lasx_xvslei_du(a: __v4u64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsat.b"] - fn __lasx_xvsat_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvsat_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsat.h"] - fn __lasx_xvsat_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvsat_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsat.w"] - fn __lasx_xvsat_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvsat_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsat.d"] - fn __lasx_xvsat_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvsat_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsat.bu"] - fn __lasx_xvsat_bu(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvsat_bu(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvsat.hu"] - fn __lasx_xvsat_hu(a: v16u16, b: u32) -> v16u16; + fn __lasx_xvsat_hu(a: __v16u16, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvsat.wu"] - fn __lasx_xvsat_wu(a: v8u32, b: u32) -> v8u32; + fn __lasx_xvsat_wu(a: __v8u32, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvsat.du"] - fn __lasx_xvsat_du(a: v4u64, b: u32) -> v4u64; + fn __lasx_xvsat_du(a: __v4u64, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvadda.b"] - fn __lasx_xvadda_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvadda_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvadda.h"] - fn __lasx_xvadda_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvadda_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvadda.w"] - fn __lasx_xvadda_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvadda_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvadda.d"] - fn __lasx_xvadda_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvadda_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsadd.b"] - fn __lasx_xvsadd_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsadd_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsadd.h"] - fn __lasx_xvsadd_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsadd_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsadd.w"] - fn __lasx_xvsadd_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsadd_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsadd.d"] - fn __lasx_xvsadd_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsadd_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsadd.bu"] - fn __lasx_xvsadd_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvsadd_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvsadd.hu"] - fn __lasx_xvsadd_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvsadd_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvsadd.wu"] - fn __lasx_xvsadd_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvsadd_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvsadd.du"] - fn __lasx_xvsadd_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvsadd_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvavg.b"] - fn __lasx_xvavg_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvavg_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvavg.h"] - fn __lasx_xvavg_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvavg_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvavg.w"] - fn __lasx_xvavg_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvavg_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvavg.d"] - fn __lasx_xvavg_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvavg_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvavg.bu"] - fn __lasx_xvavg_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvavg_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvavg.hu"] - fn __lasx_xvavg_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvavg_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvavg.wu"] - fn __lasx_xvavg_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvavg_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvavg.du"] - fn __lasx_xvavg_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvavg_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvavgr.b"] - fn __lasx_xvavgr_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvavgr_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvavgr.h"] - fn __lasx_xvavgr_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvavgr_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvavgr.w"] - fn __lasx_xvavgr_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvavgr_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvavgr.d"] - fn __lasx_xvavgr_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvavgr_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvavgr.bu"] - fn __lasx_xvavgr_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvavgr_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvavgr.hu"] - fn __lasx_xvavgr_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvavgr_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvavgr.wu"] - fn __lasx_xvavgr_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvavgr_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvavgr.du"] - fn __lasx_xvavgr_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvavgr_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvssub.b"] - fn __lasx_xvssub_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvssub_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssub.h"] - fn __lasx_xvssub_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvssub_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssub.w"] - fn __lasx_xvssub_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvssub_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssub.d"] - fn __lasx_xvssub_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvssub_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssub.bu"] - fn __lasx_xvssub_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvssub_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssub.hu"] - fn __lasx_xvssub_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvssub_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssub.wu"] - fn __lasx_xvssub_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvssub_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvssub.du"] - fn __lasx_xvssub_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvssub_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvabsd.b"] - fn __lasx_xvabsd_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvabsd_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvabsd.h"] - fn __lasx_xvabsd_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvabsd_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvabsd.w"] - fn __lasx_xvabsd_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvabsd_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvabsd.d"] - fn __lasx_xvabsd_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvabsd_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvabsd.bu"] - fn __lasx_xvabsd_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvabsd_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvabsd.hu"] - fn __lasx_xvabsd_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvabsd_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvabsd.wu"] - fn __lasx_xvabsd_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvabsd_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvabsd.du"] - fn __lasx_xvabsd_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvabsd_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmul.b"] - fn __lasx_xvmul_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvmul_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmul.h"] - fn __lasx_xvmul_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvmul_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmul.w"] - fn __lasx_xvmul_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvmul_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmul.d"] - fn __lasx_xvmul_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmul_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmadd.b"] - fn __lasx_xvmadd_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8; + fn __lasx_xvmadd_b(a: __v32i8, b: __v32i8, c: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmadd.h"] - fn __lasx_xvmadd_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16; + fn __lasx_xvmadd_h(a: __v16i16, b: __v16i16, c: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmadd.w"] - fn __lasx_xvmadd_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32; + fn __lasx_xvmadd_w(a: __v8i32, b: __v8i32, c: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmadd.d"] - fn __lasx_xvmadd_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64; + fn __lasx_xvmadd_d(a: __v4i64, b: __v4i64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmsub.b"] - fn __lasx_xvmsub_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8; + fn __lasx_xvmsub_b(a: __v32i8, b: __v32i8, c: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmsub.h"] - fn __lasx_xvmsub_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16; + fn __lasx_xvmsub_h(a: __v16i16, b: __v16i16, c: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmsub.w"] - fn __lasx_xvmsub_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32; + fn __lasx_xvmsub_w(a: __v8i32, b: __v8i32, c: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmsub.d"] - fn __lasx_xvmsub_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64; + fn __lasx_xvmsub_d(a: __v4i64, b: __v4i64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvdiv.b"] - fn __lasx_xvdiv_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvdiv_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvdiv.h"] - fn __lasx_xvdiv_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvdiv_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvdiv.w"] - fn __lasx_xvdiv_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvdiv_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvdiv.d"] - fn __lasx_xvdiv_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvdiv_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvdiv.bu"] - fn __lasx_xvdiv_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvdiv_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvdiv.hu"] - fn __lasx_xvdiv_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvdiv_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvdiv.wu"] - fn __lasx_xvdiv_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvdiv_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvdiv.du"] - fn __lasx_xvdiv_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvdiv_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvhaddw.h.b"] - fn __lasx_xvhaddw_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvhaddw_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvhaddw.w.h"] - fn __lasx_xvhaddw_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvhaddw_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvhaddw.d.w"] - fn __lasx_xvhaddw_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvhaddw_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvhaddw.hu.bu"] - fn __lasx_xvhaddw_hu_bu(a: v32u8, b: v32u8) -> v16u16; + fn __lasx_xvhaddw_hu_bu(a: __v32u8, b: __v32u8) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvhaddw.wu.hu"] - fn __lasx_xvhaddw_wu_hu(a: v16u16, b: v16u16) -> v8u32; + fn __lasx_xvhaddw_wu_hu(a: __v16u16, b: __v16u16) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvhaddw.du.wu"] - fn __lasx_xvhaddw_du_wu(a: v8u32, b: v8u32) -> v4u64; + fn __lasx_xvhaddw_du_wu(a: __v8u32, b: __v8u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvhsubw.h.b"] - fn __lasx_xvhsubw_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvhsubw_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvhsubw.w.h"] - fn __lasx_xvhsubw_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvhsubw_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvhsubw.d.w"] - fn __lasx_xvhsubw_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvhsubw_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvhsubw.hu.bu"] - fn __lasx_xvhsubw_hu_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvhsubw_hu_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvhsubw.wu.hu"] - fn __lasx_xvhsubw_wu_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvhsubw_wu_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvhsubw.du.wu"] - fn __lasx_xvhsubw_du_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvhsubw_du_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmod.b"] - fn __lasx_xvmod_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvmod_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmod.h"] - fn __lasx_xvmod_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvmod_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmod.w"] - fn __lasx_xvmod_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvmod_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmod.d"] - fn __lasx_xvmod_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmod_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmod.bu"] - fn __lasx_xvmod_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvmod_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvmod.hu"] - fn __lasx_xvmod_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvmod_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmod.wu"] - fn __lasx_xvmod_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvmod_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmod.du"] - fn __lasx_xvmod_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvmod_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvrepl128vei.b"] - fn __lasx_xvrepl128vei_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvrepl128vei_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvrepl128vei.h"] - fn __lasx_xvrepl128vei_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvrepl128vei_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvrepl128vei.w"] - fn __lasx_xvrepl128vei_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvrepl128vei_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvrepl128vei.d"] - fn __lasx_xvrepl128vei_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvrepl128vei_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpickev.b"] - fn __lasx_xvpickev_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvpickev_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvpickev.h"] - fn __lasx_xvpickev_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvpickev_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvpickev.w"] - fn __lasx_xvpickev_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvpickev_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpickev.d"] - fn __lasx_xvpickev_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvpickev_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpickod.b"] - fn __lasx_xvpickod_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvpickod_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvpickod.h"] - fn __lasx_xvpickod_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvpickod_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvpickod.w"] - fn __lasx_xvpickod_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvpickod_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpickod.d"] - fn __lasx_xvpickod_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvpickod_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvilvh.b"] - fn __lasx_xvilvh_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvilvh_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvilvh.h"] - fn __lasx_xvilvh_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvilvh_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvilvh.w"] - fn __lasx_xvilvh_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvilvh_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvilvh.d"] - fn __lasx_xvilvh_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvilvh_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvilvl.b"] - fn __lasx_xvilvl_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvilvl_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvilvl.h"] - fn __lasx_xvilvl_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvilvl_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvilvl.w"] - fn __lasx_xvilvl_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvilvl_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvilvl.d"] - fn __lasx_xvilvl_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvilvl_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpackev.b"] - fn __lasx_xvpackev_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvpackev_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvpackev.h"] - fn __lasx_xvpackev_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvpackev_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvpackev.w"] - fn __lasx_xvpackev_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvpackev_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpackev.d"] - fn __lasx_xvpackev_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvpackev_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpackod.b"] - fn __lasx_xvpackod_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvpackod_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvpackod.h"] - fn __lasx_xvpackod_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvpackod_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvpackod.w"] - fn __lasx_xvpackod_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvpackod_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpackod.d"] - fn __lasx_xvpackod_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvpackod_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvshuf.b"] - fn __lasx_xvshuf_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8; + fn __lasx_xvshuf_b(a: __v32i8, b: __v32i8, c: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvshuf.h"] - fn __lasx_xvshuf_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16; + fn __lasx_xvshuf_h(a: __v16i16, b: __v16i16, c: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvshuf.w"] - fn __lasx_xvshuf_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32; + fn __lasx_xvshuf_w(a: __v8i32, b: __v8i32, c: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvshuf.d"] - fn __lasx_xvshuf_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64; + fn __lasx_xvshuf_d(a: __v4i64, b: __v4i64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvand.v"] - fn __lasx_xvand_v(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvand_v(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvandi.b"] - fn __lasx_xvandi_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvandi_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvor.v"] - fn __lasx_xvor_v(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvor_v(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvori.b"] - fn __lasx_xvori_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvori_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvnor.v"] - fn __lasx_xvnor_v(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvnor_v(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvnori.b"] - fn __lasx_xvnori_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvnori_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvxor.v"] - fn __lasx_xvxor_v(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvxor_v(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvxori.b"] - fn __lasx_xvxori_b(a: v32u8, b: u32) -> v32u8; + fn __lasx_xvxori_b(a: __v32u8, b: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitsel.v"] - fn __lasx_xvbitsel_v(a: v32u8, b: v32u8, c: v32u8) -> v32u8; + fn __lasx_xvbitsel_v(a: __v32u8, b: __v32u8, c: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvbitseli.b"] - fn __lasx_xvbitseli_b(a: v32u8, b: v32u8, c: u32) -> v32u8; + fn __lasx_xvbitseli_b(a: __v32u8, b: __v32u8, c: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvshuf4i.b"] - fn __lasx_xvshuf4i_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvshuf4i_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvshuf4i.h"] - fn __lasx_xvshuf4i_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvshuf4i_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvshuf4i.w"] - fn __lasx_xvshuf4i_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvshuf4i_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvreplgr2vr.b"] - fn __lasx_xvreplgr2vr_b(a: i32) -> v32i8; + fn __lasx_xvreplgr2vr_b(a: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvreplgr2vr.h"] - fn __lasx_xvreplgr2vr_h(a: i32) -> v16i16; + fn __lasx_xvreplgr2vr_h(a: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvreplgr2vr.w"] - fn __lasx_xvreplgr2vr_w(a: i32) -> v8i32; + fn __lasx_xvreplgr2vr_w(a: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvreplgr2vr.d"] - fn __lasx_xvreplgr2vr_d(a: i64) -> v4i64; + fn __lasx_xvreplgr2vr_d(a: i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpcnt.b"] - fn __lasx_xvpcnt_b(a: v32i8) -> v32i8; + fn __lasx_xvpcnt_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvpcnt.h"] - fn __lasx_xvpcnt_h(a: v16i16) -> v16i16; + fn __lasx_xvpcnt_h(a: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvpcnt.w"] - fn __lasx_xvpcnt_w(a: v8i32) -> v8i32; + fn __lasx_xvpcnt_w(a: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpcnt.d"] - fn __lasx_xvpcnt_d(a: v4i64) -> v4i64; + fn __lasx_xvpcnt_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvclo.b"] - fn __lasx_xvclo_b(a: v32i8) -> v32i8; + fn __lasx_xvclo_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvclo.h"] - fn __lasx_xvclo_h(a: v16i16) -> v16i16; + fn __lasx_xvclo_h(a: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvclo.w"] - fn __lasx_xvclo_w(a: v8i32) -> v8i32; + fn __lasx_xvclo_w(a: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvclo.d"] - fn __lasx_xvclo_d(a: v4i64) -> v4i64; + fn __lasx_xvclo_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvclz.b"] - fn __lasx_xvclz_b(a: v32i8) -> v32i8; + fn __lasx_xvclz_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvclz.h"] - fn __lasx_xvclz_h(a: v16i16) -> v16i16; + fn __lasx_xvclz_h(a: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvclz.w"] - fn __lasx_xvclz_w(a: v8i32) -> v8i32; + fn __lasx_xvclz_w(a: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvclz.d"] - fn __lasx_xvclz_d(a: v4i64) -> v4i64; + fn __lasx_xvclz_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfadd.s"] - fn __lasx_xvfadd_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfadd_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfadd.d"] - fn __lasx_xvfadd_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfadd_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfsub.s"] - fn __lasx_xvfsub_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfsub_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfsub.d"] - fn __lasx_xvfsub_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfsub_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfmul.s"] - fn __lasx_xvfmul_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfmul_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmul.d"] - fn __lasx_xvfmul_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfmul_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfdiv.s"] - fn __lasx_xvfdiv_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfdiv_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfdiv.d"] - fn __lasx_xvfdiv_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfdiv_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfcvt.h.s"] - fn __lasx_xvfcvt_h_s(a: v8f32, b: v8f32) -> v16i16; + fn __lasx_xvfcvt_h_s(a: __v8f32, b: __v8f32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvfcvt.s.d"] - fn __lasx_xvfcvt_s_d(a: v4f64, b: v4f64) -> v8f32; + fn __lasx_xvfcvt_s_d(a: __v4f64, b: __v4f64) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmin.s"] - fn __lasx_xvfmin_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfmin_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmin.d"] - fn __lasx_xvfmin_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfmin_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfmina.s"] - fn __lasx_xvfmina_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfmina_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmina.d"] - fn __lasx_xvfmina_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfmina_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfmax.s"] - fn __lasx_xvfmax_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfmax_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmax.d"] - fn __lasx_xvfmax_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfmax_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfmaxa.s"] - fn __lasx_xvfmaxa_s(a: v8f32, b: v8f32) -> v8f32; + fn __lasx_xvfmaxa_s(a: __v8f32, b: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmaxa.d"] - fn __lasx_xvfmaxa_d(a: v4f64, b: v4f64) -> v4f64; + fn __lasx_xvfmaxa_d(a: __v4f64, b: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfclass.s"] - fn __lasx_xvfclass_s(a: v8f32) -> v8i32; + fn __lasx_xvfclass_s(a: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfclass.d"] - fn __lasx_xvfclass_d(a: v4f64) -> v4i64; + fn __lasx_xvfclass_d(a: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfsqrt.s"] - fn __lasx_xvfsqrt_s(a: v8f32) -> v8f32; + fn __lasx_xvfsqrt_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfsqrt.d"] - fn __lasx_xvfsqrt_d(a: v4f64) -> v4f64; + fn __lasx_xvfsqrt_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrecip.s"] - fn __lasx_xvfrecip_s(a: v8f32) -> v8f32; + fn __lasx_xvfrecip_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrecip.d"] - fn __lasx_xvfrecip_d(a: v4f64) -> v4f64; + fn __lasx_xvfrecip_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrecipe.s"] - fn __lasx_xvfrecipe_s(a: v8f32) -> v8f32; + fn __lasx_xvfrecipe_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrecipe.d"] - fn __lasx_xvfrecipe_d(a: v4f64) -> v4f64; + fn __lasx_xvfrecipe_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrsqrte.s"] - fn __lasx_xvfrsqrte_s(a: v8f32) -> v8f32; + fn __lasx_xvfrsqrte_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrsqrte.d"] - fn __lasx_xvfrsqrte_d(a: v4f64) -> v4f64; + fn __lasx_xvfrsqrte_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrint.s"] - fn __lasx_xvfrint_s(a: v8f32) -> v8f32; + fn __lasx_xvfrint_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrint.d"] - fn __lasx_xvfrint_d(a: v4f64) -> v4f64; + fn __lasx_xvfrint_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrsqrt.s"] - fn __lasx_xvfrsqrt_s(a: v8f32) -> v8f32; + fn __lasx_xvfrsqrt_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrsqrt.d"] - fn __lasx_xvfrsqrt_d(a: v4f64) -> v4f64; + fn __lasx_xvfrsqrt_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvflogb.s"] - fn __lasx_xvflogb_s(a: v8f32) -> v8f32; + fn __lasx_xvflogb_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvflogb.d"] - fn __lasx_xvflogb_d(a: v4f64) -> v4f64; + fn __lasx_xvflogb_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfcvth.s.h"] - fn __lasx_xvfcvth_s_h(a: v16i16) -> v8f32; + fn __lasx_xvfcvth_s_h(a: __v16i16) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfcvth.d.s"] - fn __lasx_xvfcvth_d_s(a: v8f32) -> v4f64; + fn __lasx_xvfcvth_d_s(a: __v8f32) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfcvtl.s.h"] - fn __lasx_xvfcvtl_s_h(a: v16i16) -> v8f32; + fn __lasx_xvfcvtl_s_h(a: __v16i16) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfcvtl.d.s"] - fn __lasx_xvfcvtl_d_s(a: v8f32) -> v4f64; + fn __lasx_xvfcvtl_d_s(a: __v8f32) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvftint.w.s"] - fn __lasx_xvftint_w_s(a: v8f32) -> v8i32; + fn __lasx_xvftint_w_s(a: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftint.l.d"] - fn __lasx_xvftint_l_d(a: v4f64) -> v4i64; + fn __lasx_xvftint_l_d(a: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftint.wu.s"] - fn __lasx_xvftint_wu_s(a: v8f32) -> v8u32; + fn __lasx_xvftint_wu_s(a: __v8f32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvftint.lu.d"] - fn __lasx_xvftint_lu_d(a: v4f64) -> v4u64; + fn __lasx_xvftint_lu_d(a: __v4f64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvftintrz.w.s"] - fn __lasx_xvftintrz_w_s(a: v8f32) -> v8i32; + fn __lasx_xvftintrz_w_s(a: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrz.l.d"] - fn __lasx_xvftintrz_l_d(a: v4f64) -> v4i64; + fn __lasx_xvftintrz_l_d(a: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrz.wu.s"] - fn __lasx_xvftintrz_wu_s(a: v8f32) -> v8u32; + fn __lasx_xvftintrz_wu_s(a: __v8f32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvftintrz.lu.d"] - fn __lasx_xvftintrz_lu_d(a: v4f64) -> v4u64; + fn __lasx_xvftintrz_lu_d(a: __v4f64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvffint.s.w"] - fn __lasx_xvffint_s_w(a: v8i32) -> v8f32; + fn __lasx_xvffint_s_w(a: __v8i32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvffint.d.l"] - fn __lasx_xvffint_d_l(a: v4i64) -> v4f64; + fn __lasx_xvffint_d_l(a: __v4i64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvffint.s.wu"] - fn __lasx_xvffint_s_wu(a: v8u32) -> v8f32; + fn __lasx_xvffint_s_wu(a: __v8u32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvffint.d.lu"] - fn __lasx_xvffint_d_lu(a: v4u64) -> v4f64; + fn __lasx_xvffint_d_lu(a: __v4u64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvreplve.b"] - fn __lasx_xvreplve_b(a: v32i8, b: i32) -> v32i8; + fn __lasx_xvreplve_b(a: __v32i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvreplve.h"] - fn __lasx_xvreplve_h(a: v16i16, b: i32) -> v16i16; + fn __lasx_xvreplve_h(a: __v16i16, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvreplve.w"] - fn __lasx_xvreplve_w(a: v8i32, b: i32) -> v8i32; + fn __lasx_xvreplve_w(a: __v8i32, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvreplve.d"] - fn __lasx_xvreplve_d(a: v4i64, b: i32) -> v4i64; + fn __lasx_xvreplve_d(a: __v4i64, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpermi.w"] - fn __lasx_xvpermi_w(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvpermi_w(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvandn.v"] - fn __lasx_xvandn_v(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvandn_v(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvneg.b"] - fn __lasx_xvneg_b(a: v32i8) -> v32i8; + fn __lasx_xvneg_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvneg.h"] - fn __lasx_xvneg_h(a: v16i16) -> v16i16; + fn __lasx_xvneg_h(a: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvneg.w"] - fn __lasx_xvneg_w(a: v8i32) -> v8i32; + fn __lasx_xvneg_w(a: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvneg.d"] - fn __lasx_xvneg_d(a: v4i64) -> v4i64; + fn __lasx_xvneg_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmuh.b"] - fn __lasx_xvmuh_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvmuh_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmuh.h"] - fn __lasx_xvmuh_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvmuh_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmuh.w"] - fn __lasx_xvmuh_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvmuh_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmuh.d"] - fn __lasx_xvmuh_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmuh_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmuh.bu"] - fn __lasx_xvmuh_bu(a: v32u8, b: v32u8) -> v32u8; + fn __lasx_xvmuh_bu(a: __v32u8, b: __v32u8) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvmuh.hu"] - fn __lasx_xvmuh_hu(a: v16u16, b: v16u16) -> v16u16; + fn __lasx_xvmuh_hu(a: __v16u16, b: __v16u16) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmuh.wu"] - fn __lasx_xvmuh_wu(a: v8u32, b: v8u32) -> v8u32; + fn __lasx_xvmuh_wu(a: __v8u32, b: __v8u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmuh.du"] - fn __lasx_xvmuh_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvmuh_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvsllwil.h.b"] - fn __lasx_xvsllwil_h_b(a: v32i8, b: u32) -> v16i16; + fn __lasx_xvsllwil_h_b(a: __v32i8, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsllwil.w.h"] - fn __lasx_xvsllwil_w_h(a: v16i16, b: u32) -> v8i32; + fn __lasx_xvsllwil_w_h(a: __v16i16, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsllwil.d.w"] - fn __lasx_xvsllwil_d_w(a: v8i32, b: u32) -> v4i64; + fn __lasx_xvsllwil_d_w(a: __v8i32, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsllwil.hu.bu"] - fn __lasx_xvsllwil_hu_bu(a: v32u8, b: u32) -> v16u16; + fn __lasx_xvsllwil_hu_bu(a: __v32u8, b: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvsllwil.wu.hu"] - fn __lasx_xvsllwil_wu_hu(a: v16u16, b: u32) -> v8u32; + fn __lasx_xvsllwil_wu_hu(a: __v16u16, b: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvsllwil.du.wu"] - fn __lasx_xvsllwil_du_wu(a: v8u32, b: u32) -> v4u64; + fn __lasx_xvsllwil_du_wu(a: __v8u32, b: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvsran.b.h"] - fn __lasx_xvsran_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvsran_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsran.h.w"] - fn __lasx_xvsran_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvsran_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsran.w.d"] - fn __lasx_xvsran_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvsran_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssran.b.h"] - fn __lasx_xvssran_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvssran_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssran.h.w"] - fn __lasx_xvssran_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvssran_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssran.w.d"] - fn __lasx_xvssran_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvssran_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssran.bu.h"] - fn __lasx_xvssran_bu_h(a: v16u16, b: v16u16) -> v32u8; + fn __lasx_xvssran_bu_h(a: __v16u16, b: __v16u16) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssran.hu.w"] - fn __lasx_xvssran_hu_w(a: v8u32, b: v8u32) -> v16u16; + fn __lasx_xvssran_hu_w(a: __v8u32, b: __v8u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssran.wu.d"] - fn __lasx_xvssran_wu_d(a: v4u64, b: v4u64) -> v8u32; + fn __lasx_xvssran_wu_d(a: __v4u64, b: __v4u64) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvsrarn.b.h"] - fn __lasx_xvsrarn_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvsrarn_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrarn.h.w"] - fn __lasx_xvsrarn_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvsrarn_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrarn.w.d"] - fn __lasx_xvsrarn_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvsrarn_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrarn.b.h"] - fn __lasx_xvssrarn_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvssrarn_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrarn.h.w"] - fn __lasx_xvssrarn_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvssrarn_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrarn.w.d"] - fn __lasx_xvssrarn_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvssrarn_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrarn.bu.h"] - fn __lasx_xvssrarn_bu_h(a: v16u16, b: v16u16) -> v32u8; + fn __lasx_xvssrarn_bu_h(a: __v16u16, b: __v16u16) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrarn.hu.w"] - fn __lasx_xvssrarn_hu_w(a: v8u32, b: v8u32) -> v16u16; + fn __lasx_xvssrarn_hu_w(a: __v8u32, b: __v8u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrarn.wu.d"] - fn __lasx_xvssrarn_wu_d(a: v4u64, b: v4u64) -> v8u32; + fn __lasx_xvssrarn_wu_d(a: __v4u64, b: __v4u64) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvsrln.b.h"] - fn __lasx_xvsrln_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvsrln_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrln.h.w"] - fn __lasx_xvsrln_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvsrln_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrln.w.d"] - fn __lasx_xvsrln_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvsrln_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrln.bu.h"] - fn __lasx_xvssrln_bu_h(a: v16u16, b: v16u16) -> v32u8; + fn __lasx_xvssrln_bu_h(a: __v16u16, b: __v16u16) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrln.hu.w"] - fn __lasx_xvssrln_hu_w(a: v8u32, b: v8u32) -> v16u16; + fn __lasx_xvssrln_hu_w(a: __v8u32, b: __v8u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrln.wu.d"] - fn __lasx_xvssrln_wu_d(a: v4u64, b: v4u64) -> v8u32; + fn __lasx_xvssrln_wu_d(a: __v4u64, b: __v4u64) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvsrlrn.b.h"] - fn __lasx_xvsrlrn_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvsrlrn_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrlrn.h.w"] - fn __lasx_xvsrlrn_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvsrlrn_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrlrn.w.d"] - fn __lasx_xvsrlrn_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvsrlrn_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrlrn.bu.h"] - fn __lasx_xvssrlrn_bu_h(a: v16u16, b: v16u16) -> v32u8; + fn __lasx_xvssrlrn_bu_h(a: __v16u16, b: __v16u16) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrlrn.hu.w"] - fn __lasx_xvssrlrn_hu_w(a: v8u32, b: v8u32) -> v16u16; + fn __lasx_xvssrlrn_hu_w(a: __v8u32, b: __v8u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrlrn.wu.d"] - fn __lasx_xvssrlrn_wu_d(a: v4u64, b: v4u64) -> v8u32; + fn __lasx_xvssrlrn_wu_d(a: __v4u64, b: __v4u64) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvfrstpi.b"] - fn __lasx_xvfrstpi_b(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvfrstpi_b(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvfrstpi.h"] - fn __lasx_xvfrstpi_h(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvfrstpi_h(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvfrstp.b"] - fn __lasx_xvfrstp_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8; + fn __lasx_xvfrstp_b(a: __v32i8, b: __v32i8, c: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvfrstp.h"] - fn __lasx_xvfrstp_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16; + fn __lasx_xvfrstp_h(a: __v16i16, b: __v16i16, c: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvshuf4i.d"] - fn __lasx_xvshuf4i_d(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvshuf4i_d(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvbsrl.v"] - fn __lasx_xvbsrl_v(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvbsrl_v(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvbsll.v"] - fn __lasx_xvbsll_v(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvbsll_v(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvextrins.b"] - fn __lasx_xvextrins_b(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvextrins_b(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvextrins.h"] - fn __lasx_xvextrins_h(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvextrins_h(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvextrins.w"] - fn __lasx_xvextrins_w(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvextrins_w(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvextrins.d"] - fn __lasx_xvextrins_d(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvextrins_d(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmskltz.b"] - fn __lasx_xvmskltz_b(a: v32i8) -> v32i8; + fn __lasx_xvmskltz_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmskltz.h"] - fn __lasx_xvmskltz_h(a: v16i16) -> v16i16; + fn __lasx_xvmskltz_h(a: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmskltz.w"] - fn __lasx_xvmskltz_w(a: v8i32) -> v8i32; + fn __lasx_xvmskltz_w(a: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmskltz.d"] - fn __lasx_xvmskltz_d(a: v4i64) -> v4i64; + fn __lasx_xvmskltz_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsigncov.b"] - fn __lasx_xvsigncov_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvsigncov_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsigncov.h"] - fn __lasx_xvsigncov_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvsigncov_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsigncov.w"] - fn __lasx_xvsigncov_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvsigncov_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsigncov.d"] - fn __lasx_xvsigncov_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsigncov_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfmadd.s"] - fn __lasx_xvfmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32; + fn __lasx_xvfmadd_s(a: __v8f32, b: __v8f32, c: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmadd.d"] - fn __lasx_xvfmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64; + fn __lasx_xvfmadd_d(a: __v4f64, b: __v4f64, c: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfmsub.s"] - fn __lasx_xvfmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32; + fn __lasx_xvfmsub_s(a: __v8f32, b: __v8f32, c: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfmsub.d"] - fn __lasx_xvfmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64; + fn __lasx_xvfmsub_d(a: __v4f64, b: __v4f64, c: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfnmadd.s"] - fn __lasx_xvfnmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32; + fn __lasx_xvfnmadd_s(a: __v8f32, b: __v8f32, c: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfnmadd.d"] - fn __lasx_xvfnmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64; + fn __lasx_xvfnmadd_d(a: __v4f64, b: __v4f64, c: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfnmsub.s"] - fn __lasx_xvfnmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32; + fn __lasx_xvfnmsub_s(a: __v8f32, b: __v8f32, c: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfnmsub.d"] - fn __lasx_xvfnmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64; + fn __lasx_xvfnmsub_d(a: __v4f64, b: __v4f64, c: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvftintrne.w.s"] - fn __lasx_xvftintrne_w_s(a: v8f32) -> v8i32; + fn __lasx_xvftintrne_w_s(a: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrne.l.d"] - fn __lasx_xvftintrne_l_d(a: v4f64) -> v4i64; + fn __lasx_xvftintrne_l_d(a: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrp.w.s"] - fn __lasx_xvftintrp_w_s(a: v8f32) -> v8i32; + fn __lasx_xvftintrp_w_s(a: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrp.l.d"] - fn __lasx_xvftintrp_l_d(a: v4f64) -> v4i64; + fn __lasx_xvftintrp_l_d(a: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrm.w.s"] - fn __lasx_xvftintrm_w_s(a: v8f32) -> v8i32; + fn __lasx_xvftintrm_w_s(a: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrm.l.d"] - fn __lasx_xvftintrm_l_d(a: v4f64) -> v4i64; + fn __lasx_xvftintrm_l_d(a: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftint.w.d"] - fn __lasx_xvftint_w_d(a: v4f64, b: v4f64) -> v8i32; + fn __lasx_xvftint_w_d(a: __v4f64, b: __v4f64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvffint.s.l"] - fn __lasx_xvffint_s_l(a: v4i64, b: v4i64) -> v8f32; + fn __lasx_xvffint_s_l(a: __v4i64, b: __v4i64) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvftintrz.w.d"] - fn __lasx_xvftintrz_w_d(a: v4f64, b: v4f64) -> v8i32; + fn __lasx_xvftintrz_w_d(a: __v4f64, b: __v4f64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrp.w.d"] - fn __lasx_xvftintrp_w_d(a: v4f64, b: v4f64) -> v8i32; + fn __lasx_xvftintrp_w_d(a: __v4f64, b: __v4f64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrm.w.d"] - fn __lasx_xvftintrm_w_d(a: v4f64, b: v4f64) -> v8i32; + fn __lasx_xvftintrm_w_d(a: __v4f64, b: __v4f64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftintrne.w.d"] - fn __lasx_xvftintrne_w_d(a: v4f64, b: v4f64) -> v8i32; + fn __lasx_xvftintrne_w_d(a: __v4f64, b: __v4f64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvftinth.l.s"] - fn __lasx_xvftinth_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftinth_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintl.l.s"] - fn __lasx_xvftintl_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintl_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvffinth.d.w"] - fn __lasx_xvffinth_d_w(a: v8i32) -> v4f64; + fn __lasx_xvffinth_d_w(a: __v8i32) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvffintl.d.w"] - fn __lasx_xvffintl_d_w(a: v8i32) -> v4f64; + fn __lasx_xvffintl_d_w(a: __v8i32) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvftintrzh.l.s"] - fn __lasx_xvftintrzh_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrzh_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrzl.l.s"] - fn __lasx_xvftintrzl_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrzl_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrph.l.s"] - fn __lasx_xvftintrph_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrph_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrpl.l.s"] - fn __lasx_xvftintrpl_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrpl_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrmh.l.s"] - fn __lasx_xvftintrmh_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrmh_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrml.l.s"] - fn __lasx_xvftintrml_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrml_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrneh.l.s"] - fn __lasx_xvftintrneh_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrneh_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvftintrnel.l.s"] - fn __lasx_xvftintrnel_l_s(a: v8f32) -> v4i64; + fn __lasx_xvftintrnel_l_s(a: __v8f32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfrintrne.s"] - fn __lasx_xvfrintrne_s(a: v8f32) -> v8f32; + fn __lasx_xvfrintrne_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrintrne.d"] - fn __lasx_xvfrintrne_d(a: v4f64) -> v4f64; + fn __lasx_xvfrintrne_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrintrz.s"] - fn __lasx_xvfrintrz_s(a: v8f32) -> v8f32; + fn __lasx_xvfrintrz_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrintrz.d"] - fn __lasx_xvfrintrz_d(a: v4f64) -> v4f64; + fn __lasx_xvfrintrz_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrintrp.s"] - fn __lasx_xvfrintrp_s(a: v8f32) -> v8f32; + fn __lasx_xvfrintrp_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrintrp.d"] - fn __lasx_xvfrintrp_d(a: v4f64) -> v4f64; + fn __lasx_xvfrintrp_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvfrintrm.s"] - fn __lasx_xvfrintrm_s(a: v8f32) -> v8f32; + fn __lasx_xvfrintrm_s(a: __v8f32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvfrintrm.d"] - fn __lasx_xvfrintrm_d(a: v4f64) -> v4f64; + fn __lasx_xvfrintrm_d(a: __v4f64) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvld"] - fn __lasx_xvld(a: *const i8, b: i32) -> v32i8; + fn __lasx_xvld(a: *const i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvst"] - fn __lasx_xvst(a: v32i8, b: *mut i8, c: i32); + fn __lasx_xvst(a: __v32i8, b: *mut i8, c: i32); #[link_name = "llvm.loongarch.lasx.xvstelm.b"] - fn __lasx_xvstelm_b(a: v32i8, b: *mut i8, c: i32, d: u32); + fn __lasx_xvstelm_b(a: __v32i8, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lasx.xvstelm.h"] - fn __lasx_xvstelm_h(a: v16i16, b: *mut i8, c: i32, d: u32); + fn __lasx_xvstelm_h(a: __v16i16, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lasx.xvstelm.w"] - fn __lasx_xvstelm_w(a: v8i32, b: *mut i8, c: i32, d: u32); + fn __lasx_xvstelm_w(a: __v8i32, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lasx.xvstelm.d"] - fn __lasx_xvstelm_d(a: v4i64, b: *mut i8, c: i32, d: u32); + fn __lasx_xvstelm_d(a: __v4i64, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lasx.xvinsve0.w"] - fn __lasx_xvinsve0_w(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvinsve0_w(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvinsve0.d"] - fn __lasx_xvinsve0_d(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvinsve0_d(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpickve.w"] - fn __lasx_xvpickve_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvpickve_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpickve.d"] - fn __lasx_xvpickve_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvpickve_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrlrn.b.h"] - fn __lasx_xvssrlrn_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvssrlrn_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrlrn.h.w"] - fn __lasx_xvssrlrn_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvssrlrn_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrlrn.w.d"] - fn __lasx_xvssrlrn_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvssrlrn_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrln.b.h"] - fn __lasx_xvssrln_b_h(a: v16i16, b: v16i16) -> v32i8; + fn __lasx_xvssrln_b_h(a: __v16i16, b: __v16i16) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrln.h.w"] - fn __lasx_xvssrln_h_w(a: v8i32, b: v8i32) -> v16i16; + fn __lasx_xvssrln_h_w(a: __v8i32, b: __v8i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrln.w.d"] - fn __lasx_xvssrln_w_d(a: v4i64, b: v4i64) -> v8i32; + fn __lasx_xvssrln_w_d(a: __v4i64, b: __v4i64) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvorn.v"] - fn __lasx_xvorn_v(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvorn_v(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvldi"] - fn __lasx_xvldi(a: i32) -> v4i64; + fn __lasx_xvldi(a: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvldx"] - fn __lasx_xvldx(a: *const i8, b: i64) -> v32i8; + fn __lasx_xvldx(a: *const i8, b: i64) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvstx"] - fn __lasx_xvstx(a: v32i8, b: *mut i8, c: i64); + fn __lasx_xvstx(a: __v32i8, b: *mut i8, c: i64); #[link_name = "llvm.loongarch.lasx.xvextl.qu.du"] - fn __lasx_xvextl_qu_du(a: v4u64) -> v4u64; + fn __lasx_xvextl_qu_du(a: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvinsgr2vr.w"] - fn __lasx_xvinsgr2vr_w(a: v8i32, b: i32, c: u32) -> v8i32; + fn __lasx_xvinsgr2vr_w(a: __v8i32, b: i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvinsgr2vr.d"] - fn __lasx_xvinsgr2vr_d(a: v4i64, b: i64, c: u32) -> v4i64; + fn __lasx_xvinsgr2vr_d(a: __v4i64, b: i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvreplve0.b"] - fn __lasx_xvreplve0_b(a: v32i8) -> v32i8; + fn __lasx_xvreplve0_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvreplve0.h"] - fn __lasx_xvreplve0_h(a: v16i16) -> v16i16; + fn __lasx_xvreplve0_h(a: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvreplve0.w"] - fn __lasx_xvreplve0_w(a: v8i32) -> v8i32; + fn __lasx_xvreplve0_w(a: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvreplve0.d"] - fn __lasx_xvreplve0_d(a: v4i64) -> v4i64; + fn __lasx_xvreplve0_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvreplve0.q"] - fn __lasx_xvreplve0_q(a: v32i8) -> v32i8; + fn __lasx_xvreplve0_q(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.vext2xv.h.b"] - fn __lasx_vext2xv_h_b(a: v32i8) -> v16i16; + fn __lasx_vext2xv_h_b(a: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.vext2xv.w.h"] - fn __lasx_vext2xv_w_h(a: v16i16) -> v8i32; + fn __lasx_vext2xv_w_h(a: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.vext2xv.d.w"] - fn __lasx_vext2xv_d_w(a: v8i32) -> v4i64; + fn __lasx_vext2xv_d_w(a: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.vext2xv.w.b"] - fn __lasx_vext2xv_w_b(a: v32i8) -> v8i32; + fn __lasx_vext2xv_w_b(a: __v32i8) -> __v8i32; #[link_name = "llvm.loongarch.lasx.vext2xv.d.h"] - fn __lasx_vext2xv_d_h(a: v16i16) -> v4i64; + fn __lasx_vext2xv_d_h(a: __v16i16) -> __v4i64; #[link_name = "llvm.loongarch.lasx.vext2xv.d.b"] - fn __lasx_vext2xv_d_b(a: v32i8) -> v4i64; + fn __lasx_vext2xv_d_b(a: __v32i8) -> __v4i64; #[link_name = "llvm.loongarch.lasx.vext2xv.hu.bu"] - fn __lasx_vext2xv_hu_bu(a: v32i8) -> v16i16; + fn __lasx_vext2xv_hu_bu(a: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.vext2xv.wu.hu"] - fn __lasx_vext2xv_wu_hu(a: v16i16) -> v8i32; + fn __lasx_vext2xv_wu_hu(a: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.vext2xv.du.wu"] - fn __lasx_vext2xv_du_wu(a: v8i32) -> v4i64; + fn __lasx_vext2xv_du_wu(a: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.vext2xv.wu.bu"] - fn __lasx_vext2xv_wu_bu(a: v32i8) -> v8i32; + fn __lasx_vext2xv_wu_bu(a: __v32i8) -> __v8i32; #[link_name = "llvm.loongarch.lasx.vext2xv.du.hu"] - fn __lasx_vext2xv_du_hu(a: v16i16) -> v4i64; + fn __lasx_vext2xv_du_hu(a: __v16i16) -> __v4i64; #[link_name = "llvm.loongarch.lasx.vext2xv.du.bu"] - fn __lasx_vext2xv_du_bu(a: v32i8) -> v4i64; + fn __lasx_vext2xv_du_bu(a: __v32i8) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpermi.q"] - fn __lasx_xvpermi_q(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvpermi_q(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvpermi.d"] - fn __lasx_xvpermi_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvpermi_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvperm.w"] - fn __lasx_xvperm_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvperm_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvldrepl.b"] - fn __lasx_xvldrepl_b(a: *const i8, b: i32) -> v32i8; + fn __lasx_xvldrepl_b(a: *const i8, b: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvldrepl.h"] - fn __lasx_xvldrepl_h(a: *const i8, b: i32) -> v16i16; + fn __lasx_xvldrepl_h(a: *const i8, b: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvldrepl.w"] - fn __lasx_xvldrepl_w(a: *const i8, b: i32) -> v8i32; + fn __lasx_xvldrepl_w(a: *const i8, b: i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvldrepl.d"] - fn __lasx_xvldrepl_d(a: *const i8, b: i32) -> v4i64; + fn __lasx_xvldrepl_d(a: *const i8, b: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvpickve2gr.w"] - fn __lasx_xvpickve2gr_w(a: v8i32, b: u32) -> i32; + fn __lasx_xvpickve2gr_w(a: __v8i32, b: u32) -> i32; #[link_name = "llvm.loongarch.lasx.xvpickve2gr.wu"] - fn __lasx_xvpickve2gr_wu(a: v8i32, b: u32) -> u32; + fn __lasx_xvpickve2gr_wu(a: __v8i32, b: u32) -> u32; #[link_name = "llvm.loongarch.lasx.xvpickve2gr.d"] - fn __lasx_xvpickve2gr_d(a: v4i64, b: u32) -> i64; + fn __lasx_xvpickve2gr_d(a: __v4i64, b: u32) -> i64; #[link_name = "llvm.loongarch.lasx.xvpickve2gr.du"] - fn __lasx_xvpickve2gr_du(a: v4i64, b: u32) -> u64; + fn __lasx_xvpickve2gr_du(a: __v4i64, b: u32) -> u64; #[link_name = "llvm.loongarch.lasx.xvaddwev.q.d"] - fn __lasx_xvaddwev_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvaddwev_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwev.d.w"] - fn __lasx_xvaddwev_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvaddwev_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwev.w.h"] - fn __lasx_xvaddwev_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvaddwev_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddwev.h.b"] - fn __lasx_xvaddwev_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvaddwev_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvaddwev.q.du"] - fn __lasx_xvaddwev_q_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvaddwev_q_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwev.d.wu"] - fn __lasx_xvaddwev_d_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvaddwev_d_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwev.w.hu"] - fn __lasx_xvaddwev_w_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvaddwev_w_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddwev.h.bu"] - fn __lasx_xvaddwev_h_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvaddwev_h_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsubwev.q.d"] - fn __lasx_xvsubwev_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsubwev_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwev.d.w"] - fn __lasx_xvsubwev_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvsubwev_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwev.w.h"] - fn __lasx_xvsubwev_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvsubwev_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsubwev.h.b"] - fn __lasx_xvsubwev_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvsubwev_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsubwev.q.du"] - fn __lasx_xvsubwev_q_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvsubwev_q_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwev.d.wu"] - fn __lasx_xvsubwev_d_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvsubwev_d_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwev.w.hu"] - fn __lasx_xvsubwev_w_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvsubwev_w_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsubwev.h.bu"] - fn __lasx_xvsubwev_h_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvsubwev_h_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmulwev.q.d"] - fn __lasx_xvmulwev_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmulwev_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwev.d.w"] - fn __lasx_xvmulwev_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvmulwev_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwev.w.h"] - fn __lasx_xvmulwev_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvmulwev_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmulwev.h.b"] - fn __lasx_xvmulwev_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvmulwev_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmulwev.q.du"] - fn __lasx_xvmulwev_q_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvmulwev_q_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwev.d.wu"] - fn __lasx_xvmulwev_d_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvmulwev_d_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwev.w.hu"] - fn __lasx_xvmulwev_w_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvmulwev_w_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmulwev.h.bu"] - fn __lasx_xvmulwev_h_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvmulwev_h_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvaddwod.q.d"] - fn __lasx_xvaddwod_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvaddwod_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwod.d.w"] - fn __lasx_xvaddwod_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvaddwod_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwod.w.h"] - fn __lasx_xvaddwod_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvaddwod_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddwod.h.b"] - fn __lasx_xvaddwod_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvaddwod_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvaddwod.q.du"] - fn __lasx_xvaddwod_q_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvaddwod_q_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwod.d.wu"] - fn __lasx_xvaddwod_d_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvaddwod_d_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwod.w.hu"] - fn __lasx_xvaddwod_w_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvaddwod_w_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddwod.h.bu"] - fn __lasx_xvaddwod_h_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvaddwod_h_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsubwod.q.d"] - fn __lasx_xvsubwod_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsubwod_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwod.d.w"] - fn __lasx_xvsubwod_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvsubwod_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwod.w.h"] - fn __lasx_xvsubwod_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvsubwod_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsubwod.h.b"] - fn __lasx_xvsubwod_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvsubwod_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsubwod.q.du"] - fn __lasx_xvsubwod_q_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvsubwod_q_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwod.d.wu"] - fn __lasx_xvsubwod_d_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvsubwod_d_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsubwod.w.hu"] - fn __lasx_xvsubwod_w_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvsubwod_w_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsubwod.h.bu"] - fn __lasx_xvsubwod_h_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvsubwod_h_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmulwod.q.d"] - fn __lasx_xvmulwod_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvmulwod_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwod.d.w"] - fn __lasx_xvmulwod_d_w(a: v8i32, b: v8i32) -> v4i64; + fn __lasx_xvmulwod_d_w(a: __v8i32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwod.w.h"] - fn __lasx_xvmulwod_w_h(a: v16i16, b: v16i16) -> v8i32; + fn __lasx_xvmulwod_w_h(a: __v16i16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmulwod.h.b"] - fn __lasx_xvmulwod_h_b(a: v32i8, b: v32i8) -> v16i16; + fn __lasx_xvmulwod_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmulwod.q.du"] - fn __lasx_xvmulwod_q_du(a: v4u64, b: v4u64) -> v4i64; + fn __lasx_xvmulwod_q_du(a: __v4u64, b: __v4u64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwod.d.wu"] - fn __lasx_xvmulwod_d_wu(a: v8u32, b: v8u32) -> v4i64; + fn __lasx_xvmulwod_d_wu(a: __v8u32, b: __v8u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwod.w.hu"] - fn __lasx_xvmulwod_w_hu(a: v16u16, b: v16u16) -> v8i32; + fn __lasx_xvmulwod_w_hu(a: __v16u16, b: __v16u16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmulwod.h.bu"] - fn __lasx_xvmulwod_h_bu(a: v32u8, b: v32u8) -> v16i16; + fn __lasx_xvmulwod_h_bu(a: __v32u8, b: __v32u8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvaddwev.d.wu.w"] - fn __lasx_xvaddwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64; + fn __lasx_xvaddwev_d_wu_w(a: __v8u32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwev.w.hu.h"] - fn __lasx_xvaddwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32; + fn __lasx_xvaddwev_w_hu_h(a: __v16u16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddwev.h.bu.b"] - fn __lasx_xvaddwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16; + fn __lasx_xvaddwev_h_bu_b(a: __v32u8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmulwev.d.wu.w"] - fn __lasx_xvmulwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64; + fn __lasx_xvmulwev_d_wu_w(a: __v8u32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwev.w.hu.h"] - fn __lasx_xvmulwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32; + fn __lasx_xvmulwev_w_hu_h(a: __v16u16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmulwev.h.bu.b"] - fn __lasx_xvmulwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16; + fn __lasx_xvmulwev_h_bu_b(a: __v32u8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvaddwod.d.wu.w"] - fn __lasx_xvaddwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64; + fn __lasx_xvaddwod_d_wu_w(a: __v8u32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwod.w.hu.h"] - fn __lasx_xvaddwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32; + fn __lasx_xvaddwod_w_hu_h(a: __v16u16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvaddwod.h.bu.b"] - fn __lasx_xvaddwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16; + fn __lasx_xvaddwod_h_bu_b(a: __v32u8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmulwod.d.wu.w"] - fn __lasx_xvmulwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64; + fn __lasx_xvmulwod_d_wu_w(a: __v8u32, b: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwod.w.hu.h"] - fn __lasx_xvmulwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32; + fn __lasx_xvmulwod_w_hu_h(a: __v16u16, b: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmulwod.h.bu.b"] - fn __lasx_xvmulwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16; + fn __lasx_xvmulwod_h_bu_b(a: __v32u8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvhaddw.q.d"] - fn __lasx_xvhaddw_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvhaddw_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvhaddw.qu.du"] - fn __lasx_xvhaddw_qu_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvhaddw_qu_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvhsubw.q.d"] - fn __lasx_xvhsubw_q_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvhsubw_q_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvhsubw.qu.du"] - fn __lasx_xvhsubw_qu_du(a: v4u64, b: v4u64) -> v4u64; + fn __lasx_xvhsubw_qu_du(a: __v4u64, b: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.q.d"] - fn __lasx_xvmaddwev_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64; + fn __lasx_xvmaddwev_q_d(a: __v4i64, b: __v4i64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.d.w"] - fn __lasx_xvmaddwev_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64; + fn __lasx_xvmaddwev_d_w(a: __v4i64, b: __v8i32, c: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.w.h"] - fn __lasx_xvmaddwev_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32; + fn __lasx_xvmaddwev_w_h(a: __v8i32, b: __v16i16, c: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmaddwev.h.b"] - fn __lasx_xvmaddwev_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16; + fn __lasx_xvmaddwev_h_b(a: __v16i16, b: __v32i8, c: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmaddwev.q.du"] - fn __lasx_xvmaddwev_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64; + fn __lasx_xvmaddwev_q_du(a: __v4u64, b: __v4u64, c: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.d.wu"] - fn __lasx_xvmaddwev_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64; + fn __lasx_xvmaddwev_d_wu(a: __v4u64, b: __v8u32, c: __v8u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.w.hu"] - fn __lasx_xvmaddwev_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32; + fn __lasx_xvmaddwev_w_hu(a: __v8u32, b: __v16u16, c: __v16u16) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmaddwev.h.bu"] - fn __lasx_xvmaddwev_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16; + fn __lasx_xvmaddwev_h_bu(a: __v16u16, b: __v32u8, c: __v32u8) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmaddwod.q.d"] - fn __lasx_xvmaddwod_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64; + fn __lasx_xvmaddwod_q_d(a: __v4i64, b: __v4i64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwod.d.w"] - fn __lasx_xvmaddwod_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64; + fn __lasx_xvmaddwod_d_w(a: __v4i64, b: __v8i32, c: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwod.w.h"] - fn __lasx_xvmaddwod_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32; + fn __lasx_xvmaddwod_w_h(a: __v8i32, b: __v16i16, c: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmaddwod.h.b"] - fn __lasx_xvmaddwod_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16; + fn __lasx_xvmaddwod_h_b(a: __v16i16, b: __v32i8, c: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmaddwod.q.du"] - fn __lasx_xvmaddwod_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64; + fn __lasx_xvmaddwod_q_du(a: __v4u64, b: __v4u64, c: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmaddwod.d.wu"] - fn __lasx_xvmaddwod_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64; + fn __lasx_xvmaddwod_d_wu(a: __v4u64, b: __v8u32, c: __v8u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvmaddwod.w.hu"] - fn __lasx_xvmaddwod_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32; + fn __lasx_xvmaddwod_w_hu(a: __v8u32, b: __v16u16, c: __v16u16) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvmaddwod.h.bu"] - fn __lasx_xvmaddwod_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16; + fn __lasx_xvmaddwod_h_bu(a: __v16u16, b: __v32u8, c: __v32u8) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvmaddwev.q.du.d"] - fn __lasx_xvmaddwev_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64; + fn __lasx_xvmaddwev_q_du_d(a: __v4i64, b: __v4u64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.d.wu.w"] - fn __lasx_xvmaddwev_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64; + fn __lasx_xvmaddwev_d_wu_w(a: __v4i64, b: __v8u32, c: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwev.w.hu.h"] - fn __lasx_xvmaddwev_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32; + fn __lasx_xvmaddwev_w_hu_h(a: __v8i32, b: __v16u16, c: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmaddwev.h.bu.b"] - fn __lasx_xvmaddwev_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16; + fn __lasx_xvmaddwev_h_bu_b(a: __v16i16, b: __v32u8, c: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvmaddwod.q.du.d"] - fn __lasx_xvmaddwod_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64; + fn __lasx_xvmaddwod_q_du_d(a: __v4i64, b: __v4u64, c: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwod.d.wu.w"] - fn __lasx_xvmaddwod_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64; + fn __lasx_xvmaddwod_d_wu_w(a: __v4i64, b: __v8u32, c: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmaddwod.w.hu.h"] - fn __lasx_xvmaddwod_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32; + fn __lasx_xvmaddwod_w_hu_h(a: __v8i32, b: __v16u16, c: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvmaddwod.h.bu.b"] - fn __lasx_xvmaddwod_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16; + fn __lasx_xvmaddwod_h_bu_b(a: __v16i16, b: __v32u8, c: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvrotr.b"] - fn __lasx_xvrotr_b(a: v32i8, b: v32i8) -> v32i8; + fn __lasx_xvrotr_b(a: __v32i8, b: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvrotr.h"] - fn __lasx_xvrotr_h(a: v16i16, b: v16i16) -> v16i16; + fn __lasx_xvrotr_h(a: __v16i16, b: __v16i16) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvrotr.w"] - fn __lasx_xvrotr_w(a: v8i32, b: v8i32) -> v8i32; + fn __lasx_xvrotr_w(a: __v8i32, b: __v8i32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvrotr.d"] - fn __lasx_xvrotr_d(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvrotr_d(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvadd.q"] - fn __lasx_xvadd_q(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvadd_q(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsub.q"] - fn __lasx_xvsub_q(a: v4i64, b: v4i64) -> v4i64; + fn __lasx_xvsub_q(a: __v4i64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwev.q.du.d"] - fn __lasx_xvaddwev_q_du_d(a: v4u64, b: v4i64) -> v4i64; + fn __lasx_xvaddwev_q_du_d(a: __v4u64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvaddwod.q.du.d"] - fn __lasx_xvaddwod_q_du_d(a: v4u64, b: v4i64) -> v4i64; + fn __lasx_xvaddwod_q_du_d(a: __v4u64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwev.q.du.d"] - fn __lasx_xvmulwev_q_du_d(a: v4u64, b: v4i64) -> v4i64; + fn __lasx_xvmulwev_q_du_d(a: __v4u64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmulwod.q.du.d"] - fn __lasx_xvmulwod_q_du_d(a: v4u64, b: v4i64) -> v4i64; + fn __lasx_xvmulwod_q_du_d(a: __v4u64, b: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvmskgez.b"] - fn __lasx_xvmskgez_b(a: v32i8) -> v32i8; + fn __lasx_xvmskgez_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvmsknz.b"] - fn __lasx_xvmsknz_b(a: v32i8) -> v32i8; + fn __lasx_xvmsknz_b(a: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvexth.h.b"] - fn __lasx_xvexth_h_b(a: v32i8) -> v16i16; + fn __lasx_xvexth_h_b(a: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvexth.w.h"] - fn __lasx_xvexth_w_h(a: v16i16) -> v8i32; + fn __lasx_xvexth_w_h(a: __v16i16) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvexth.d.w"] - fn __lasx_xvexth_d_w(a: v8i32) -> v4i64; + fn __lasx_xvexth_d_w(a: __v8i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvexth.q.d"] - fn __lasx_xvexth_q_d(a: v4i64) -> v4i64; + fn __lasx_xvexth_q_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvexth.hu.bu"] - fn __lasx_xvexth_hu_bu(a: v32u8) -> v16u16; + fn __lasx_xvexth_hu_bu(a: __v32u8) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvexth.wu.hu"] - fn __lasx_xvexth_wu_hu(a: v16u16) -> v8u32; + fn __lasx_xvexth_wu_hu(a: __v16u16) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvexth.du.wu"] - fn __lasx_xvexth_du_wu(a: v8u32) -> v4u64; + fn __lasx_xvexth_du_wu(a: __v8u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvexth.qu.du"] - fn __lasx_xvexth_qu_du(a: v4u64) -> v4u64; + fn __lasx_xvexth_qu_du(a: __v4u64) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvrotri.b"] - fn __lasx_xvrotri_b(a: v32i8, b: u32) -> v32i8; + fn __lasx_xvrotri_b(a: __v32i8, b: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvrotri.h"] - fn __lasx_xvrotri_h(a: v16i16, b: u32) -> v16i16; + fn __lasx_xvrotri_h(a: __v16i16, b: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvrotri.w"] - fn __lasx_xvrotri_w(a: v8i32, b: u32) -> v8i32; + fn __lasx_xvrotri_w(a: __v8i32, b: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvrotri.d"] - fn __lasx_xvrotri_d(a: v4i64, b: u32) -> v4i64; + fn __lasx_xvrotri_d(a: __v4i64, b: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvextl.q.d"] - fn __lasx_xvextl_q_d(a: v4i64) -> v4i64; + fn __lasx_xvextl_q_d(a: __v4i64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrlni.b.h"] - fn __lasx_xvsrlni_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvsrlni_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrlni.h.w"] - fn __lasx_xvsrlni_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvsrlni_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrlni.w.d"] - fn __lasx_xvsrlni_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvsrlni_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrlni.d.q"] - fn __lasx_xvsrlni_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvsrlni_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrlrni.b.h"] - fn __lasx_xvsrlrni_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvsrlrni_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrlrni.h.w"] - fn __lasx_xvsrlrni_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvsrlrni_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrlrni.w.d"] - fn __lasx_xvsrlrni_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvsrlrni_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrlrni.d.q"] - fn __lasx_xvsrlrni_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvsrlrni_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrlni.b.h"] - fn __lasx_xvssrlni_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvssrlni_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrlni.h.w"] - fn __lasx_xvssrlni_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvssrlni_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrlni.w.d"] - fn __lasx_xvssrlni_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvssrlni_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrlni.d.q"] - fn __lasx_xvssrlni_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvssrlni_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrlni.bu.h"] - fn __lasx_xvssrlni_bu_h(a: v32u8, b: v32i8, c: u32) -> v32u8; + fn __lasx_xvssrlni_bu_h(a: __v32u8, b: __v32i8, c: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrlni.hu.w"] - fn __lasx_xvssrlni_hu_w(a: v16u16, b: v16i16, c: u32) -> v16u16; + fn __lasx_xvssrlni_hu_w(a: __v16u16, b: __v16i16, c: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrlni.wu.d"] - fn __lasx_xvssrlni_wu_d(a: v8u32, b: v8i32, c: u32) -> v8u32; + fn __lasx_xvssrlni_wu_d(a: __v8u32, b: __v8i32, c: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvssrlni.du.q"] - fn __lasx_xvssrlni_du_q(a: v4u64, b: v4i64, c: u32) -> v4u64; + fn __lasx_xvssrlni_du_q(a: __v4u64, b: __v4i64, c: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvssrlrni.b.h"] - fn __lasx_xvssrlrni_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvssrlrni_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrlrni.h.w"] - fn __lasx_xvssrlrni_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvssrlrni_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrlrni.w.d"] - fn __lasx_xvssrlrni_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvssrlrni_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrlrni.d.q"] - fn __lasx_xvssrlrni_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvssrlrni_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrlrni.bu.h"] - fn __lasx_xvssrlrni_bu_h(a: v32u8, b: v32i8, c: u32) -> v32u8; + fn __lasx_xvssrlrni_bu_h(a: __v32u8, b: __v32i8, c: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrlrni.hu.w"] - fn __lasx_xvssrlrni_hu_w(a: v16u16, b: v16i16, c: u32) -> v16u16; + fn __lasx_xvssrlrni_hu_w(a: __v16u16, b: __v16i16, c: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrlrni.wu.d"] - fn __lasx_xvssrlrni_wu_d(a: v8u32, b: v8i32, c: u32) -> v8u32; + fn __lasx_xvssrlrni_wu_d(a: __v8u32, b: __v8i32, c: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvssrlrni.du.q"] - fn __lasx_xvssrlrni_du_q(a: v4u64, b: v4i64, c: u32) -> v4u64; + fn __lasx_xvssrlrni_du_q(a: __v4u64, b: __v4i64, c: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvsrani.b.h"] - fn __lasx_xvsrani_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvsrani_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrani.h.w"] - fn __lasx_xvsrani_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvsrani_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrani.w.d"] - fn __lasx_xvsrani_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvsrani_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrani.d.q"] - fn __lasx_xvsrani_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvsrani_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvsrarni.b.h"] - fn __lasx_xvsrarni_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvsrarni_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvsrarni.h.w"] - fn __lasx_xvsrarni_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvsrarni_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvsrarni.w.d"] - fn __lasx_xvsrarni_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvsrarni_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvsrarni.d.q"] - fn __lasx_xvsrarni_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvsrarni_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrani.b.h"] - fn __lasx_xvssrani_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvssrani_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrani.h.w"] - fn __lasx_xvssrani_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvssrani_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrani.w.d"] - fn __lasx_xvssrani_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvssrani_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrani.d.q"] - fn __lasx_xvssrani_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvssrani_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrani.bu.h"] - fn __lasx_xvssrani_bu_h(a: v32u8, b: v32i8, c: u32) -> v32u8; + fn __lasx_xvssrani_bu_h(a: __v32u8, b: __v32i8, c: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrani.hu.w"] - fn __lasx_xvssrani_hu_w(a: v16u16, b: v16i16, c: u32) -> v16u16; + fn __lasx_xvssrani_hu_w(a: __v16u16, b: __v16i16, c: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrani.wu.d"] - fn __lasx_xvssrani_wu_d(a: v8u32, b: v8i32, c: u32) -> v8u32; + fn __lasx_xvssrani_wu_d(a: __v8u32, b: __v8i32, c: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvssrani.du.q"] - fn __lasx_xvssrani_du_q(a: v4u64, b: v4i64, c: u32) -> v4u64; + fn __lasx_xvssrani_du_q(a: __v4u64, b: __v4i64, c: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xvssrarni.b.h"] - fn __lasx_xvssrarni_b_h(a: v32i8, b: v32i8, c: u32) -> v32i8; + fn __lasx_xvssrarni_b_h(a: __v32i8, b: __v32i8, c: u32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvssrarni.h.w"] - fn __lasx_xvssrarni_h_w(a: v16i16, b: v16i16, c: u32) -> v16i16; + fn __lasx_xvssrarni_h_w(a: __v16i16, b: __v16i16, c: u32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvssrarni.w.d"] - fn __lasx_xvssrarni_w_d(a: v8i32, b: v8i32, c: u32) -> v8i32; + fn __lasx_xvssrarni_w_d(a: __v8i32, b: __v8i32, c: u32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvssrarni.d.q"] - fn __lasx_xvssrarni_d_q(a: v4i64, b: v4i64, c: u32) -> v4i64; + fn __lasx_xvssrarni_d_q(a: __v4i64, b: __v4i64, c: u32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvssrarni.bu.h"] - fn __lasx_xvssrarni_bu_h(a: v32u8, b: v32i8, c: u32) -> v32u8; + fn __lasx_xvssrarni_bu_h(a: __v32u8, b: __v32i8, c: u32) -> __v32u8; #[link_name = "llvm.loongarch.lasx.xvssrarni.hu.w"] - fn __lasx_xvssrarni_hu_w(a: v16u16, b: v16i16, c: u32) -> v16u16; + fn __lasx_xvssrarni_hu_w(a: __v16u16, b: __v16i16, c: u32) -> __v16u16; #[link_name = "llvm.loongarch.lasx.xvssrarni.wu.d"] - fn __lasx_xvssrarni_wu_d(a: v8u32, b: v8i32, c: u32) -> v8u32; + fn __lasx_xvssrarni_wu_d(a: __v8u32, b: __v8i32, c: u32) -> __v8u32; #[link_name = "llvm.loongarch.lasx.xvssrarni.du.q"] - fn __lasx_xvssrarni_du_q(a: v4u64, b: v4i64, c: u32) -> v4u64; + fn __lasx_xvssrarni_du_q(a: __v4u64, b: __v4i64, c: u32) -> __v4u64; #[link_name = "llvm.loongarch.lasx.xbnz.b"] - fn __lasx_xbnz_b(a: v32u8) -> i32; + fn __lasx_xbnz_b(a: __v32u8) -> i32; #[link_name = "llvm.loongarch.lasx.xbnz.d"] - fn __lasx_xbnz_d(a: v4u64) -> i32; + fn __lasx_xbnz_d(a: __v4u64) -> i32; #[link_name = "llvm.loongarch.lasx.xbnz.h"] - fn __lasx_xbnz_h(a: v16u16) -> i32; + fn __lasx_xbnz_h(a: __v16u16) -> i32; #[link_name = "llvm.loongarch.lasx.xbnz.v"] - fn __lasx_xbnz_v(a: v32u8) -> i32; + fn __lasx_xbnz_v(a: __v32u8) -> i32; #[link_name = "llvm.loongarch.lasx.xbnz.w"] - fn __lasx_xbnz_w(a: v8u32) -> i32; + fn __lasx_xbnz_w(a: __v8u32) -> i32; #[link_name = "llvm.loongarch.lasx.xbz.b"] - fn __lasx_xbz_b(a: v32u8) -> i32; + fn __lasx_xbz_b(a: __v32u8) -> i32; #[link_name = "llvm.loongarch.lasx.xbz.d"] - fn __lasx_xbz_d(a: v4u64) -> i32; + fn __lasx_xbz_d(a: __v4u64) -> i32; #[link_name = "llvm.loongarch.lasx.xbz.h"] - fn __lasx_xbz_h(a: v16u16) -> i32; + fn __lasx_xbz_h(a: __v16u16) -> i32; #[link_name = "llvm.loongarch.lasx.xbz.v"] - fn __lasx_xbz_v(a: v32u8) -> i32; + fn __lasx_xbz_v(a: __v32u8) -> i32; #[link_name = "llvm.loongarch.lasx.xbz.w"] - fn __lasx_xbz_w(a: v8u32) -> i32; + fn __lasx_xbz_w(a: __v8u32) -> i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.caf.d"] - fn __lasx_xvfcmp_caf_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_caf_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.caf.s"] - fn __lasx_xvfcmp_caf_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_caf_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.ceq.d"] - fn __lasx_xvfcmp_ceq_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_ceq_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.ceq.s"] - fn __lasx_xvfcmp_ceq_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_ceq_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cle.d"] - fn __lasx_xvfcmp_cle_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cle_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cle.s"] - fn __lasx_xvfcmp_cle_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cle_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.clt.d"] - fn __lasx_xvfcmp_clt_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_clt_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.clt.s"] - fn __lasx_xvfcmp_clt_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_clt_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cne.d"] - fn __lasx_xvfcmp_cne_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cne_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cne.s"] - fn __lasx_xvfcmp_cne_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cne_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cor.d"] - fn __lasx_xvfcmp_cor_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cor_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cor.s"] - fn __lasx_xvfcmp_cor_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cor_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cueq.d"] - fn __lasx_xvfcmp_cueq_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cueq_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cueq.s"] - fn __lasx_xvfcmp_cueq_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cueq_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cule.d"] - fn __lasx_xvfcmp_cule_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cule_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cule.s"] - fn __lasx_xvfcmp_cule_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cule_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cult.d"] - fn __lasx_xvfcmp_cult_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cult_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cult.s"] - fn __lasx_xvfcmp_cult_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cult_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cun.d"] - fn __lasx_xvfcmp_cun_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cun_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cune.d"] - fn __lasx_xvfcmp_cune_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_cune_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.cune.s"] - fn __lasx_xvfcmp_cune_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cune_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.cun.s"] - fn __lasx_xvfcmp_cun_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_cun_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.saf.d"] - fn __lasx_xvfcmp_saf_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_saf_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.saf.s"] - fn __lasx_xvfcmp_saf_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_saf_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.seq.d"] - fn __lasx_xvfcmp_seq_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_seq_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.seq.s"] - fn __lasx_xvfcmp_seq_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_seq_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sle.d"] - fn __lasx_xvfcmp_sle_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sle_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sle.s"] - fn __lasx_xvfcmp_sle_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sle_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.slt.d"] - fn __lasx_xvfcmp_slt_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_slt_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.slt.s"] - fn __lasx_xvfcmp_slt_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_slt_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sne.d"] - fn __lasx_xvfcmp_sne_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sne_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sne.s"] - fn __lasx_xvfcmp_sne_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sne_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sor.d"] - fn __lasx_xvfcmp_sor_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sor_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sor.s"] - fn __lasx_xvfcmp_sor_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sor_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sueq.d"] - fn __lasx_xvfcmp_sueq_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sueq_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sueq.s"] - fn __lasx_xvfcmp_sueq_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sueq_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sule.d"] - fn __lasx_xvfcmp_sule_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sule_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sule.s"] - fn __lasx_xvfcmp_sule_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sule_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sult.d"] - fn __lasx_xvfcmp_sult_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sult_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sult.s"] - fn __lasx_xvfcmp_sult_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sult_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sun.d"] - fn __lasx_xvfcmp_sun_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sun_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sune.d"] - fn __lasx_xvfcmp_sune_d(a: v4f64, b: v4f64) -> v4i64; + fn __lasx_xvfcmp_sune_d(a: __v4f64, b: __v4f64) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvfcmp.sune.s"] - fn __lasx_xvfcmp_sune_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sune_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvfcmp.sun.s"] - fn __lasx_xvfcmp_sun_s(a: v8f32, b: v8f32) -> v8i32; + fn __lasx_xvfcmp_sun_s(a: __v8f32, b: __v8f32) -> __v8i32; #[link_name = "llvm.loongarch.lasx.xvpickve.d.f"] - fn __lasx_xvpickve_d_f(a: v4f64, b: u32) -> v4f64; + fn __lasx_xvpickve_d_f(a: __v4f64, b: u32) -> __v4f64; #[link_name = "llvm.loongarch.lasx.xvpickve.w.f"] - fn __lasx_xvpickve_w_f(a: v8f32, b: u32) -> v8f32; + fn __lasx_xvpickve_w_f(a: __v8f32, b: u32) -> __v8f32; #[link_name = "llvm.loongarch.lasx.xvrepli.b"] - fn __lasx_xvrepli_b(a: i32) -> v32i8; + fn __lasx_xvrepli_b(a: i32) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvrepli.d"] - fn __lasx_xvrepli_d(a: i32) -> v4i64; + fn __lasx_xvrepli_d(a: i32) -> __v4i64; #[link_name = "llvm.loongarch.lasx.xvrepli.h"] - fn __lasx_xvrepli_h(a: i32) -> v16i16; + fn __lasx_xvrepli_h(a: i32) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvrepli.w"] - fn __lasx_xvrepli_w(a: i32) -> v8i32; + fn __lasx_xvrepli_w(a: i32) -> __v8i32; } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsll_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsll_b(a, b) } +pub fn lasx_xvsll_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsll_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsll_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsll_h(a, b) } +pub fn lasx_xvsll_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsll_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsll_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsll_w(a, b) } +pub fn lasx_xvsll_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsll_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsll_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsll_d(a, b) } +pub fn lasx_xvsll_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsll_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslli_b(a: v32i8) -> v32i8 { +pub fn lasx_xvslli_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvslli_b(a, IMM3) } + unsafe { transmute(__lasx_xvslli_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslli_h(a: v16i16) -> v16i16 { +pub fn lasx_xvslli_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvslli_h(a, IMM4) } + unsafe { transmute(__lasx_xvslli_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslli_w(a: v8i32) -> v8i32 { +pub fn lasx_xvslli_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslli_w(a, IMM5) } + unsafe { transmute(__lasx_xvslli_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslli_d(a: v4i64) -> v4i64 { +pub fn lasx_xvslli_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvslli_d(a, IMM6) } + unsafe { transmute(__lasx_xvslli_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsra_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsra_b(a, b) } +pub fn lasx_xvsra_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsra_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsra_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsra_h(a, b) } +pub fn lasx_xvsra_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsra_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsra_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsra_w(a, b) } +pub fn lasx_xvsra_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsra_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsra_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsra_d(a, b) } +pub fn lasx_xvsra_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsra_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrai_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrai_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsrai_b(a, IMM3) } + unsafe { transmute(__lasx_xvsrai_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrai_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrai_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrai_h(a, IMM4) } + unsafe { transmute(__lasx_xvsrai_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrai_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrai_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrai_w(a, IMM5) } + unsafe { transmute(__lasx_xvsrai_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrai_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrai_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrai_d(a, IMM6) } + unsafe { transmute(__lasx_xvsrai_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrar_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsrar_b(a, b) } +pub fn lasx_xvsrar_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrar_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrar_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsrar_h(a, b) } +pub fn lasx_xvsrar_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrar_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrar_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsrar_w(a, b) } +pub fn lasx_xvsrar_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrar_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrar_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsrar_d(a, b) } +pub fn lasx_xvsrar_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrar_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrari_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrari_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsrari_b(a, IMM3) } + unsafe { transmute(__lasx_xvsrari_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrari_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrari_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrari_h(a, IMM4) } + unsafe { transmute(__lasx_xvsrari_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrari_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrari_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrari_w(a, IMM5) } + unsafe { transmute(__lasx_xvsrari_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrari_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrari_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrari_d(a, IMM6) } + unsafe { transmute(__lasx_xvsrari_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrl_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsrl_b(a, b) } +pub fn lasx_xvsrl_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrl_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrl_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsrl_h(a, b) } +pub fn lasx_xvsrl_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrl_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrl_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsrl_w(a, b) } +pub fn lasx_xvsrl_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrl_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrl_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsrl_d(a, b) } +pub fn lasx_xvsrl_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrl_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrli_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrli_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsrli_b(a, IMM3) } + unsafe { transmute(__lasx_xvsrli_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrli_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrli_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrli_h(a, IMM4) } + unsafe { transmute(__lasx_xvsrli_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrli_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrli_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrli_w(a, IMM5) } + unsafe { transmute(__lasx_xvsrli_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrli_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrli_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrli_d(a, IMM6) } + unsafe { transmute(__lasx_xvsrli_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlr_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsrlr_b(a, b) } +pub fn lasx_xvsrlr_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlr_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsrlr_h(a, b) } +pub fn lasx_xvsrlr_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlr_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsrlr_w(a, b) } +pub fn lasx_xvsrlr_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlr_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsrlr_d(a, b) } +pub fn lasx_xvsrlr_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlri_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsrlri_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsrlri_b(a, IMM3) } + unsafe { transmute(__lasx_xvsrlri_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlri_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsrlri_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrlri_h(a, IMM4) } + unsafe { transmute(__lasx_xvsrlri_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlri_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsrlri_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrlri_w(a, IMM5) } + unsafe { transmute(__lasx_xvsrlri_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlri_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsrlri_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrlri_d(a, IMM6) } + unsafe { transmute(__lasx_xvsrlri_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclr_b(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvbitclr_b(a, b) } +pub fn lasx_xvbitclr_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitclr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclr_h(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvbitclr_h(a, b) } +pub fn lasx_xvbitclr_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitclr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclr_w(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvbitclr_w(a, b) } +pub fn lasx_xvbitclr_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitclr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclr_d(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvbitclr_d(a, b) } +pub fn lasx_xvbitclr_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitclr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclri_b(a: v32u8) -> v32u8 { +pub fn lasx_xvbitclri_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvbitclri_b(a, IMM3) } + unsafe { transmute(__lasx_xvbitclri_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclri_h(a: v16u16) -> v16u16 { +pub fn lasx_xvbitclri_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvbitclri_h(a, IMM4) } + unsafe { transmute(__lasx_xvbitclri_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclri_w(a: v8u32) -> v8u32 { +pub fn lasx_xvbitclri_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvbitclri_w(a, IMM5) } + unsafe { transmute(__lasx_xvbitclri_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitclri_d(a: v4u64) -> v4u64 { +pub fn lasx_xvbitclri_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvbitclri_d(a, IMM6) } + unsafe { transmute(__lasx_xvbitclri_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitset_b(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvbitset_b(a, b) } +pub fn lasx_xvbitset_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitset_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitset_h(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvbitset_h(a, b) } +pub fn lasx_xvbitset_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitset_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitset_w(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvbitset_w(a, b) } +pub fn lasx_xvbitset_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitset_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitset_d(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvbitset_d(a, b) } +pub fn lasx_xvbitset_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitset_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitseti_b(a: v32u8) -> v32u8 { +pub fn lasx_xvbitseti_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvbitseti_b(a, IMM3) } + unsafe { transmute(__lasx_xvbitseti_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitseti_h(a: v16u16) -> v16u16 { +pub fn lasx_xvbitseti_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvbitseti_h(a, IMM4) } + unsafe { transmute(__lasx_xvbitseti_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitseti_w(a: v8u32) -> v8u32 { +pub fn lasx_xvbitseti_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvbitseti_w(a, IMM5) } + unsafe { transmute(__lasx_xvbitseti_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitseti_d(a: v4u64) -> v4u64 { +pub fn lasx_xvbitseti_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvbitseti_d(a, IMM6) } + unsafe { transmute(__lasx_xvbitseti_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrev_b(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvbitrev_b(a, b) } +pub fn lasx_xvbitrev_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitrev_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrev_h(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvbitrev_h(a, b) } +pub fn lasx_xvbitrev_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitrev_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrev_w(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvbitrev_w(a, b) } +pub fn lasx_xvbitrev_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitrev_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrev_d(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvbitrev_d(a, b) } +pub fn lasx_xvbitrev_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitrev_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrevi_b(a: v32u8) -> v32u8 { +pub fn lasx_xvbitrevi_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvbitrevi_b(a, IMM3) } + unsafe { transmute(__lasx_xvbitrevi_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrevi_h(a: v16u16) -> v16u16 { +pub fn lasx_xvbitrevi_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvbitrevi_h(a, IMM4) } + unsafe { transmute(__lasx_xvbitrevi_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrevi_w(a: v8u32) -> v8u32 { +pub fn lasx_xvbitrevi_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvbitrevi_w(a, IMM5) } + unsafe { transmute(__lasx_xvbitrevi_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitrevi_d(a: v4u64) -> v4u64 { +pub fn lasx_xvbitrevi_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvbitrevi_d(a, IMM6) } + unsafe { transmute(__lasx_xvbitrevi_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadd_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvadd_b(a, b) } +pub fn lasx_xvadd_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadd_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadd_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvadd_h(a, b) } +pub fn lasx_xvadd_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadd_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadd_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvadd_w(a, b) } +pub fn lasx_xvadd_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadd_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadd_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvadd_d(a, b) } +pub fn lasx_xvadd_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddi_bu(a: v32i8) -> v32i8 { +pub fn lasx_xvaddi_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvaddi_bu(a, IMM5) } + unsafe { transmute(__lasx_xvaddi_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddi_hu(a: v16i16) -> v16i16 { +pub fn lasx_xvaddi_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvaddi_hu(a, IMM5) } + unsafe { transmute(__lasx_xvaddi_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddi_wu(a: v8i32) -> v8i32 { +pub fn lasx_xvaddi_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvaddi_wu(a, IMM5) } + unsafe { transmute(__lasx_xvaddi_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddi_du(a: v4i64) -> v4i64 { +pub fn lasx_xvaddi_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvaddi_du(a, IMM5) } + unsafe { transmute(__lasx_xvaddi_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsub_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsub_b(a, b) } +pub fn lasx_xvsub_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsub_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsub_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsub_h(a, b) } +pub fn lasx_xvsub_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsub_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsub_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsub_w(a, b) } +pub fn lasx_xvsub_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsub_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsub_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsub_d(a, b) } +pub fn lasx_xvsub_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsub_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubi_bu(a: v32i8) -> v32i8 { +pub fn lasx_xvsubi_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsubi_bu(a, IMM5) } + unsafe { transmute(__lasx_xvsubi_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubi_hu(a: v16i16) -> v16i16 { +pub fn lasx_xvsubi_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsubi_hu(a, IMM5) } + unsafe { transmute(__lasx_xvsubi_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubi_wu(a: v8i32) -> v8i32 { +pub fn lasx_xvsubi_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsubi_wu(a, IMM5) } + unsafe { transmute(__lasx_xvsubi_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubi_du(a: v4i64) -> v4i64 { +pub fn lasx_xvsubi_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsubi_du(a, IMM5) } + unsafe { transmute(__lasx_xvsubi_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvmax_b(a, b) } +pub fn lasx_xvmax_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvmax_h(a, b) } +pub fn lasx_xvmax_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvmax_w(a, b) } +pub fn lasx_xvmax_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmax_d(a, b) } +pub fn lasx_xvmax_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_b(a: v32i8) -> v32i8 { +pub fn lasx_xvmaxi_b(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmaxi_b(a, IMM_S5) } + unsafe { transmute(__lasx_xvmaxi_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_h(a: v16i16) -> v16i16 { +pub fn lasx_xvmaxi_h(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmaxi_h(a, IMM_S5) } + unsafe { transmute(__lasx_xvmaxi_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_w(a: v8i32) -> v8i32 { +pub fn lasx_xvmaxi_w(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmaxi_w(a, IMM_S5) } + unsafe { transmute(__lasx_xvmaxi_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_d(a: v4i64) -> v4i64 { +pub fn lasx_xvmaxi_d(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmaxi_d(a, IMM_S5) } + unsafe { transmute(__lasx_xvmaxi_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvmax_bu(a, b) } +pub fn lasx_xvmax_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvmax_hu(a, b) } +pub fn lasx_xvmax_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvmax_wu(a, b) } +pub fn lasx_xvmax_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmax_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvmax_du(a, b) } +pub fn lasx_xvmax_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmax_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_bu(a: v32u8) -> v32u8 { +pub fn lasx_xvmaxi_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmaxi_bu(a, IMM5) } + unsafe { transmute(__lasx_xvmaxi_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_hu(a: v16u16) -> v16u16 { +pub fn lasx_xvmaxi_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmaxi_hu(a, IMM5) } + unsafe { transmute(__lasx_xvmaxi_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_wu(a: v8u32) -> v8u32 { +pub fn lasx_xvmaxi_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmaxi_wu(a, IMM5) } + unsafe { transmute(__lasx_xvmaxi_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaxi_du(a: v4u64) -> v4u64 { +pub fn lasx_xvmaxi_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmaxi_du(a, IMM5) } + unsafe { transmute(__lasx_xvmaxi_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvmin_b(a, b) } +pub fn lasx_xvmin_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvmin_h(a, b) } +pub fn lasx_xvmin_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvmin_w(a, b) } +pub fn lasx_xvmin_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmin_d(a, b) } +pub fn lasx_xvmin_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_b(a: v32i8) -> v32i8 { +pub fn lasx_xvmini_b(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmini_b(a, IMM_S5) } + unsafe { transmute(__lasx_xvmini_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_h(a: v16i16) -> v16i16 { +pub fn lasx_xvmini_h(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmini_h(a, IMM_S5) } + unsafe { transmute(__lasx_xvmini_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_w(a: v8i32) -> v8i32 { +pub fn lasx_xvmini_w(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmini_w(a, IMM_S5) } + unsafe { transmute(__lasx_xvmini_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_d(a: v4i64) -> v4i64 { +pub fn lasx_xvmini_d(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvmini_d(a, IMM_S5) } + unsafe { transmute(__lasx_xvmini_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvmin_bu(a, b) } +pub fn lasx_xvmin_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvmin_hu(a, b) } +pub fn lasx_xvmin_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvmin_wu(a, b) } +pub fn lasx_xvmin_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmin_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvmin_du(a, b) } +pub fn lasx_xvmin_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmin_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_bu(a: v32u8) -> v32u8 { +pub fn lasx_xvmini_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmini_bu(a, IMM5) } + unsafe { transmute(__lasx_xvmini_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_hu(a: v16u16) -> v16u16 { +pub fn lasx_xvmini_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmini_hu(a, IMM5) } + unsafe { transmute(__lasx_xvmini_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_wu(a: v8u32) -> v8u32 { +pub fn lasx_xvmini_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmini_wu(a, IMM5) } + unsafe { transmute(__lasx_xvmini_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmini_du(a: v4u64) -> v4u64 { +pub fn lasx_xvmini_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvmini_du(a, IMM5) } + unsafe { transmute(__lasx_xvmini_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseq_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvseq_b(a, b) } +pub fn lasx_xvseq_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvseq_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseq_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvseq_h(a, b) } +pub fn lasx_xvseq_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvseq_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseq_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvseq_w(a, b) } +pub fn lasx_xvseq_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvseq_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseq_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvseq_d(a, b) } +pub fn lasx_xvseq_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvseq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseqi_b(a: v32i8) -> v32i8 { +pub fn lasx_xvseqi_b(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvseqi_b(a, IMM_S5) } + unsafe { transmute(__lasx_xvseqi_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseqi_h(a: v16i16) -> v16i16 { +pub fn lasx_xvseqi_h(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvseqi_h(a, IMM_S5) } + unsafe { transmute(__lasx_xvseqi_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseqi_w(a: v8i32) -> v8i32 { +pub fn lasx_xvseqi_w(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvseqi_w(a, IMM_S5) } + unsafe { transmute(__lasx_xvseqi_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvseqi_d(a: v4i64) -> v4i64 { +pub fn lasx_xvseqi_d(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvseqi_d(a, IMM_S5) } + unsafe { transmute(__lasx_xvseqi_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvslt_b(a, b) } +pub fn lasx_xvslt_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvslt_h(a, b) } +pub fn lasx_xvslt_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvslt_w(a, b) } +pub fn lasx_xvslt_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvslt_d(a, b) } +pub fn lasx_xvslt_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_b(a: v32i8) -> v32i8 { +pub fn lasx_xvslti_b(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslti_b(a, IMM_S5) } + unsafe { transmute(__lasx_xvslti_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_h(a: v16i16) -> v16i16 { +pub fn lasx_xvslti_h(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslti_h(a, IMM_S5) } + unsafe { transmute(__lasx_xvslti_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_w(a: v8i32) -> v8i32 { +pub fn lasx_xvslti_w(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslti_w(a, IMM_S5) } + unsafe { transmute(__lasx_xvslti_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_d(a: v4i64) -> v4i64 { +pub fn lasx_xvslti_d(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslti_d(a, IMM_S5) } + unsafe { transmute(__lasx_xvslti_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_bu(a: v32u8, b: v32u8) -> v32i8 { - unsafe { __lasx_xvslt_bu(a, b) } +pub fn lasx_xvslt_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_hu(a: v16u16, b: v16u16) -> v16i16 { - unsafe { __lasx_xvslt_hu(a, b) } +pub fn lasx_xvslt_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_wu(a: v8u32, b: v8u32) -> v8i32 { - unsafe { __lasx_xvslt_wu(a, b) } +pub fn lasx_xvslt_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslt_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvslt_du(a, b) } +pub fn lasx_xvslt_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvslt_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_bu(a: v32u8) -> v32i8 { +pub fn lasx_xvslti_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslti_bu(a, IMM5) } + unsafe { transmute(__lasx_xvslti_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_hu(a: v16u16) -> v16i16 { +pub fn lasx_xvslti_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslti_hu(a, IMM5) } + unsafe { transmute(__lasx_xvslti_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_wu(a: v8u32) -> v8i32 { +pub fn lasx_xvslti_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslti_wu(a, IMM5) } + unsafe { transmute(__lasx_xvslti_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslti_du(a: v4u64) -> v4i64 { +pub fn lasx_xvslti_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslti_du(a, IMM5) } + unsafe { transmute(__lasx_xvslti_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsle_b(a, b) } +pub fn lasx_xvsle_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsle_h(a, b) } +pub fn lasx_xvsle_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsle_w(a, b) } +pub fn lasx_xvsle_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsle_d(a, b) } +pub fn lasx_xvsle_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_b(a: v32i8) -> v32i8 { +pub fn lasx_xvslei_b(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslei_b(a, IMM_S5) } + unsafe { transmute(__lasx_xvslei_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_h(a: v16i16) -> v16i16 { +pub fn lasx_xvslei_h(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslei_h(a, IMM_S5) } + unsafe { transmute(__lasx_xvslei_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_w(a: v8i32) -> v8i32 { +pub fn lasx_xvslei_w(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslei_w(a, IMM_S5) } + unsafe { transmute(__lasx_xvslei_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_d(a: v4i64) -> v4i64 { +pub fn lasx_xvslei_d(a: m256i) -> m256i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lasx_xvslei_d(a, IMM_S5) } + unsafe { transmute(__lasx_xvslei_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_bu(a: v32u8, b: v32u8) -> v32i8 { - unsafe { __lasx_xvsle_bu(a, b) } +pub fn lasx_xvsle_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_hu(a: v16u16, b: v16u16) -> v16i16 { - unsafe { __lasx_xvsle_hu(a, b) } +pub fn lasx_xvsle_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_wu(a: v8u32, b: v8u32) -> v8i32 { - unsafe { __lasx_xvsle_wu(a, b) } +pub fn lasx_xvsle_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsle_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvsle_du(a, b) } +pub fn lasx_xvsle_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsle_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_bu(a: v32u8) -> v32i8 { +pub fn lasx_xvslei_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslei_bu(a, IMM5) } + unsafe { transmute(__lasx_xvslei_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_hu(a: v16u16) -> v16i16 { +pub fn lasx_xvslei_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslei_hu(a, IMM5) } + unsafe { transmute(__lasx_xvslei_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_wu(a: v8u32) -> v8i32 { +pub fn lasx_xvslei_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslei_wu(a, IMM5) } + unsafe { transmute(__lasx_xvslei_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvslei_du(a: v4u64) -> v4i64 { +pub fn lasx_xvslei_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvslei_du(a, IMM5) } + unsafe { transmute(__lasx_xvslei_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_b(a: v32i8) -> v32i8 { +pub fn lasx_xvsat_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsat_b(a, IMM3) } + unsafe { transmute(__lasx_xvsat_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_h(a: v16i16) -> v16i16 { +pub fn lasx_xvsat_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsat_h(a, IMM4) } + unsafe { transmute(__lasx_xvsat_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_w(a: v8i32) -> v8i32 { +pub fn lasx_xvsat_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsat_w(a, IMM5) } + unsafe { transmute(__lasx_xvsat_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_d(a: v4i64) -> v4i64 { +pub fn lasx_xvsat_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsat_d(a, IMM6) } + unsafe { transmute(__lasx_xvsat_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_bu(a: v32u8) -> v32u8 { +pub fn lasx_xvsat_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsat_bu(a, IMM3) } + unsafe { transmute(__lasx_xvsat_bu(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_hu(a: v16u16) -> v16u16 { +pub fn lasx_xvsat_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsat_hu(a, IMM4) } + unsafe { transmute(__lasx_xvsat_hu(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_wu(a: v8u32) -> v8u32 { +pub fn lasx_xvsat_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsat_wu(a, IMM5) } + unsafe { transmute(__lasx_xvsat_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsat_du(a: v4u64) -> v4u64 { +pub fn lasx_xvsat_du(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsat_du(a, IMM6) } + unsafe { transmute(__lasx_xvsat_du(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadda_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvadda_b(a, b) } +pub fn lasx_xvadda_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadda_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadda_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvadda_h(a, b) } +pub fn lasx_xvadda_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadda_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadda_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvadda_w(a, b) } +pub fn lasx_xvadda_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadda_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadda_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvadda_d(a, b) } +pub fn lasx_xvadda_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadda_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsadd_b(a, b) } +pub fn lasx_xvsadd_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsadd_h(a, b) } +pub fn lasx_xvsadd_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsadd_w(a, b) } +pub fn lasx_xvsadd_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsadd_d(a, b) } +pub fn lasx_xvsadd_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvsadd_bu(a, b) } +pub fn lasx_xvsadd_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvsadd_hu(a, b) } +pub fn lasx_xvsadd_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvsadd_wu(a, b) } +pub fn lasx_xvsadd_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsadd_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvsadd_du(a, b) } +pub fn lasx_xvsadd_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsadd_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvavg_b(a, b) } +pub fn lasx_xvavg_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvavg_h(a, b) } +pub fn lasx_xvavg_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvavg_w(a, b) } +pub fn lasx_xvavg_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvavg_d(a, b) } +pub fn lasx_xvavg_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvavg_bu(a, b) } +pub fn lasx_xvavg_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvavg_hu(a, b) } +pub fn lasx_xvavg_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvavg_wu(a, b) } +pub fn lasx_xvavg_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavg_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvavg_du(a, b) } +pub fn lasx_xvavg_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavg_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvavgr_b(a, b) } +pub fn lasx_xvavgr_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvavgr_h(a, b) } +pub fn lasx_xvavgr_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvavgr_w(a, b) } +pub fn lasx_xvavgr_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvavgr_d(a, b) } +pub fn lasx_xvavgr_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvavgr_bu(a, b) } +pub fn lasx_xvavgr_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvavgr_hu(a, b) } +pub fn lasx_xvavgr_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvavgr_wu(a, b) } +pub fn lasx_xvavgr_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvavgr_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvavgr_du(a, b) } +pub fn lasx_xvavgr_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvavgr_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvssub_b(a, b) } +pub fn lasx_xvssub_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvssub_h(a, b) } +pub fn lasx_xvssub_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvssub_w(a, b) } +pub fn lasx_xvssub_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvssub_d(a, b) } +pub fn lasx_xvssub_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvssub_bu(a, b) } +pub fn lasx_xvssub_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvssub_hu(a, b) } +pub fn lasx_xvssub_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvssub_wu(a, b) } +pub fn lasx_xvssub_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssub_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvssub_du(a, b) } +pub fn lasx_xvssub_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssub_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvabsd_b(a, b) } +pub fn lasx_xvabsd_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvabsd_h(a, b) } +pub fn lasx_xvabsd_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvabsd_w(a, b) } +pub fn lasx_xvabsd_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvabsd_d(a, b) } +pub fn lasx_xvabsd_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvabsd_bu(a, b) } +pub fn lasx_xvabsd_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvabsd_hu(a, b) } +pub fn lasx_xvabsd_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvabsd_wu(a, b) } +pub fn lasx_xvabsd_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvabsd_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvabsd_du(a, b) } +pub fn lasx_xvabsd_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvabsd_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmul_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvmul_b(a, b) } +pub fn lasx_xvmul_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmul_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmul_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvmul_h(a, b) } +pub fn lasx_xvmul_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmul_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmul_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvmul_w(a, b) } +pub fn lasx_xvmul_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmul_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmul_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmul_d(a, b) } +pub fn lasx_xvmul_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmul_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmadd_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - unsafe { __lasx_xvmadd_b(a, b, c) } +pub fn lasx_xvmadd_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmadd_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmadd_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - unsafe { __lasx_xvmadd_h(a, b, c) } +pub fn lasx_xvmadd_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmadd_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmadd_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { - unsafe { __lasx_xvmadd_w(a, b, c) } +pub fn lasx_xvmadd_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmadd_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmadd_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvmadd_d(a, b, c) } +pub fn lasx_xvmadd_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmadd_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmsub_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - unsafe { __lasx_xvmsub_b(a, b, c) } +pub fn lasx_xvmsub_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmsub_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmsub_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - unsafe { __lasx_xvmsub_h(a, b, c) } +pub fn lasx_xvmsub_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmsub_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmsub_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { - unsafe { __lasx_xvmsub_w(a, b, c) } +pub fn lasx_xvmsub_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmsub_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmsub_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvmsub_d(a, b, c) } +pub fn lasx_xvmsub_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmsub_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvdiv_b(a, b) } +pub fn lasx_xvdiv_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvdiv_h(a, b) } +pub fn lasx_xvdiv_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvdiv_w(a, b) } +pub fn lasx_xvdiv_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvdiv_d(a, b) } +pub fn lasx_xvdiv_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvdiv_bu(a, b) } +pub fn lasx_xvdiv_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvdiv_hu(a, b) } +pub fn lasx_xvdiv_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvdiv_wu(a, b) } +pub fn lasx_xvdiv_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvdiv_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvdiv_du(a, b) } +pub fn lasx_xvdiv_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvhaddw_h_b(a, b) } +pub fn lasx_xvhaddw_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvhaddw_w_h(a, b) } +pub fn lasx_xvhaddw_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvhaddw_d_w(a, b) } +pub fn lasx_xvhaddw_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_hu_bu(a: v32u8, b: v32u8) -> v16u16 { - unsafe { __lasx_xvhaddw_hu_bu(a, b) } +pub fn lasx_xvhaddw_hu_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_hu_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_wu_hu(a: v16u16, b: v16u16) -> v8u32 { - unsafe { __lasx_xvhaddw_wu_hu(a, b) } +pub fn lasx_xvhaddw_wu_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_wu_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_du_wu(a: v8u32, b: v8u32) -> v4u64 { - unsafe { __lasx_xvhaddw_du_wu(a, b) } +pub fn lasx_xvhaddw_du_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_du_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvhsubw_h_b(a, b) } +pub fn lasx_xvhsubw_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvhsubw_w_h(a, b) } +pub fn lasx_xvhsubw_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvhsubw_d_w(a, b) } +pub fn lasx_xvhsubw_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_hu_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvhsubw_hu_bu(a, b) } +pub fn lasx_xvhsubw_hu_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_hu_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_wu_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvhsubw_wu_hu(a, b) } +pub fn lasx_xvhsubw_wu_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_wu_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_du_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvhsubw_du_wu(a, b) } +pub fn lasx_xvhsubw_du_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_du_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvmod_b(a, b) } +pub fn lasx_xvmod_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvmod_h(a, b) } +pub fn lasx_xvmod_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvmod_w(a, b) } +pub fn lasx_xvmod_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmod_d(a, b) } +pub fn lasx_xvmod_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvmod_bu(a, b) } +pub fn lasx_xvmod_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvmod_hu(a, b) } +pub fn lasx_xvmod_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvmod_wu(a, b) } +pub fn lasx_xvmod_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmod_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvmod_du(a, b) } +pub fn lasx_xvmod_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepl128vei_b(a: v32i8) -> v32i8 { +pub fn lasx_xvrepl128vei_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvrepl128vei_b(a, IMM4) } + unsafe { transmute(__lasx_xvrepl128vei_b(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepl128vei_h(a: v16i16) -> v16i16 { +pub fn lasx_xvrepl128vei_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvrepl128vei_h(a, IMM3) } + unsafe { transmute(__lasx_xvrepl128vei_h(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepl128vei_w(a: v8i32) -> v8i32 { +pub fn lasx_xvrepl128vei_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvrepl128vei_w(a, IMM2) } + unsafe { transmute(__lasx_xvrepl128vei_w(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepl128vei_d(a: v4i64) -> v4i64 { +pub fn lasx_xvrepl128vei_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM1, 1); - unsafe { __lasx_xvrepl128vei_d(a, IMM1) } + unsafe { transmute(__lasx_xvrepl128vei_d(transmute(a), IMM1)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickev_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvpickev_b(a, b) } +pub fn lasx_xvpickev_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickev_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickev_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvpickev_h(a, b) } +pub fn lasx_xvpickev_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickev_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickev_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvpickev_w(a, b) } +pub fn lasx_xvpickev_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickev_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickev_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvpickev_d(a, b) } +pub fn lasx_xvpickev_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickev_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickod_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvpickod_b(a, b) } +pub fn lasx_xvpickod_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickod_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickod_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvpickod_h(a, b) } +pub fn lasx_xvpickod_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickod_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickod_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvpickod_w(a, b) } +pub fn lasx_xvpickod_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickod_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickod_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvpickod_d(a, b) } +pub fn lasx_xvpickod_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpickod_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvh_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvilvh_b(a, b) } +pub fn lasx_xvilvh_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvh_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvh_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvilvh_h(a, b) } +pub fn lasx_xvilvh_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvh_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvh_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvilvh_w(a, b) } +pub fn lasx_xvilvh_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvh_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvh_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvilvh_d(a, b) } +pub fn lasx_xvilvh_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvh_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvl_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvilvl_b(a, b) } +pub fn lasx_xvilvl_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvl_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvl_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvilvl_h(a, b) } +pub fn lasx_xvilvl_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvl_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvl_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvilvl_w(a, b) } +pub fn lasx_xvilvl_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvl_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvilvl_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvilvl_d(a, b) } +pub fn lasx_xvilvl_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvilvl_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackev_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvpackev_b(a, b) } +pub fn lasx_xvpackev_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackev_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackev_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvpackev_h(a, b) } +pub fn lasx_xvpackev_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackev_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackev_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvpackev_w(a, b) } +pub fn lasx_xvpackev_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackev_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackev_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvpackev_d(a, b) } +pub fn lasx_xvpackev_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackev_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackod_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvpackod_b(a, b) } +pub fn lasx_xvpackod_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackod_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackod_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvpackod_h(a, b) } +pub fn lasx_xvpackod_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackod_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackod_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvpackod_w(a, b) } +pub fn lasx_xvpackod_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackod_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpackod_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvpackod_d(a, b) } +pub fn lasx_xvpackod_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvpackod_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - unsafe { __lasx_xvshuf_b(a, b, c) } +pub fn lasx_xvshuf_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvshuf_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - unsafe { __lasx_xvshuf_h(a, b, c) } +pub fn lasx_xvshuf_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvshuf_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf_w(a: v8i32, b: v8i32, c: v8i32) -> v8i32 { - unsafe { __lasx_xvshuf_w(a, b, c) } +pub fn lasx_xvshuf_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvshuf_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvshuf_d(a, b, c) } +pub fn lasx_xvshuf_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvshuf_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvand_v(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvand_v(a, b) } +pub fn lasx_xvand_v(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvand_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvandi_b(a: v32u8) -> v32u8 { +pub fn lasx_xvandi_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvandi_b(a, IMM8) } + unsafe { transmute(__lasx_xvandi_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvor_v(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvor_v(a, b) } +pub fn lasx_xvor_v(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvor_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvori_b(a: v32u8) -> v32u8 { +pub fn lasx_xvori_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvori_b(a, IMM8) } + unsafe { transmute(__lasx_xvori_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvnor_v(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvnor_v(a, b) } +pub fn lasx_xvnor_v(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvnor_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvnori_b(a: v32u8) -> v32u8 { +pub fn lasx_xvnori_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvnori_b(a, IMM8) } + unsafe { transmute(__lasx_xvnori_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvxor_v(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvxor_v(a, b) } +pub fn lasx_xvxor_v(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvxor_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvxori_b(a: v32u8) -> v32u8 { +pub fn lasx_xvxori_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvxori_b(a, IMM8) } + unsafe { transmute(__lasx_xvxori_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitsel_v(a: v32u8, b: v32u8, c: v32u8) -> v32u8 { - unsafe { __lasx_xvbitsel_v(a, b, c) } +pub fn lasx_xvbitsel_v(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvbitsel_v(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbitseli_b(a: v32u8, b: v32u8) -> v32u8 { +pub fn lasx_xvbitseli_b(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvbitseli_b(a, b, IMM8) } + unsafe { transmute(__lasx_xvbitseli_b(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf4i_b(a: v32i8) -> v32i8 { +pub fn lasx_xvshuf4i_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvshuf4i_b(a, IMM8) } + unsafe { transmute(__lasx_xvshuf4i_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf4i_h(a: v16i16) -> v16i16 { +pub fn lasx_xvshuf4i_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvshuf4i_h(a, IMM8) } + unsafe { transmute(__lasx_xvshuf4i_h(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf4i_w(a: v8i32) -> v8i32 { +pub fn lasx_xvshuf4i_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvshuf4i_w(a, IMM8) } + unsafe { transmute(__lasx_xvshuf4i_w(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplgr2vr_b(a: i32) -> v32i8 { - unsafe { __lasx_xvreplgr2vr_b(a) } +pub fn lasx_xvreplgr2vr_b(a: i32) -> m256i { + unsafe { transmute(__lasx_xvreplgr2vr_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplgr2vr_h(a: i32) -> v16i16 { - unsafe { __lasx_xvreplgr2vr_h(a) } +pub fn lasx_xvreplgr2vr_h(a: i32) -> m256i { + unsafe { transmute(__lasx_xvreplgr2vr_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplgr2vr_w(a: i32) -> v8i32 { - unsafe { __lasx_xvreplgr2vr_w(a) } +pub fn lasx_xvreplgr2vr_w(a: i32) -> m256i { + unsafe { transmute(__lasx_xvreplgr2vr_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplgr2vr_d(a: i64) -> v4i64 { - unsafe { __lasx_xvreplgr2vr_d(a) } +pub fn lasx_xvreplgr2vr_d(a: i64) -> m256i { + unsafe { transmute(__lasx_xvreplgr2vr_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpcnt_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvpcnt_b(a) } +pub fn lasx_xvpcnt_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvpcnt_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpcnt_h(a: v16i16) -> v16i16 { - unsafe { __lasx_xvpcnt_h(a) } +pub fn lasx_xvpcnt_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvpcnt_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpcnt_w(a: v8i32) -> v8i32 { - unsafe { __lasx_xvpcnt_w(a) } +pub fn lasx_xvpcnt_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvpcnt_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpcnt_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvpcnt_d(a) } +pub fn lasx_xvpcnt_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvpcnt_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclo_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvclo_b(a) } +pub fn lasx_xvclo_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclo_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclo_h(a: v16i16) -> v16i16 { - unsafe { __lasx_xvclo_h(a) } +pub fn lasx_xvclo_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclo_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclo_w(a: v8i32) -> v8i32 { - unsafe { __lasx_xvclo_w(a) } +pub fn lasx_xvclo_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclo_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclo_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvclo_d(a) } +pub fn lasx_xvclo_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclo_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclz_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvclz_b(a) } +pub fn lasx_xvclz_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclz_h(a: v16i16) -> v16i16 { - unsafe { __lasx_xvclz_h(a) } +pub fn lasx_xvclz_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclz_w(a: v8i32) -> v8i32 { - unsafe { __lasx_xvclz_w(a) } +pub fn lasx_xvclz_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvclz_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvclz_d(a) } +pub fn lasx_xvclz_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvclz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfadd_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfadd_s(a, b) } +pub fn lasx_xvfadd_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfadd_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfadd_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfadd_d(a, b) } +pub fn lasx_xvfadd_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfadd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfsub_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfsub_s(a, b) } +pub fn lasx_xvfsub_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfsub_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfsub_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfsub_d(a, b) } +pub fn lasx_xvfsub_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfsub_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmul_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfmul_s(a, b) } +pub fn lasx_xvfmul_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfmul_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmul_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfmul_d(a, b) } +pub fn lasx_xvfmul_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmul_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfdiv_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfdiv_s(a, b) } +pub fn lasx_xvfdiv_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfdiv_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfdiv_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfdiv_d(a, b) } +pub fn lasx_xvfdiv_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfdiv_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcvt_h_s(a: v8f32, b: v8f32) -> v16i16 { - unsafe { __lasx_xvfcvt_h_s(a, b) } +pub fn lasx_xvfcvt_h_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcvt_h_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcvt_s_d(a: v4f64, b: v4f64) -> v8f32 { - unsafe { __lasx_xvfcvt_s_d(a, b) } +pub fn lasx_xvfcvt_s_d(a: m256d, b: m256d) -> m256 { + unsafe { transmute(__lasx_xvfcvt_s_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmin_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfmin_s(a, b) } +pub fn lasx_xvfmin_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfmin_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmin_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfmin_d(a, b) } +pub fn lasx_xvfmin_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmin_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmina_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfmina_s(a, b) } +pub fn lasx_xvfmina_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfmina_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmina_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfmina_d(a, b) } +pub fn lasx_xvfmina_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmina_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmax_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfmax_s(a, b) } +pub fn lasx_xvfmax_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfmax_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmax_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfmax_d(a, b) } +pub fn lasx_xvfmax_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmax_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmaxa_s(a: v8f32, b: v8f32) -> v8f32 { - unsafe { __lasx_xvfmaxa_s(a, b) } +pub fn lasx_xvfmaxa_s(a: m256, b: m256) -> m256 { + unsafe { transmute(__lasx_xvfmaxa_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmaxa_d(a: v4f64, b: v4f64) -> v4f64 { - unsafe { __lasx_xvfmaxa_d(a, b) } +pub fn lasx_xvfmaxa_d(a: m256d, b: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmaxa_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfclass_s(a: v8f32) -> v8i32 { - unsafe { __lasx_xvfclass_s(a) } +pub fn lasx_xvfclass_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvfclass_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfclass_d(a: v4f64) -> v4i64 { - unsafe { __lasx_xvfclass_d(a) } +pub fn lasx_xvfclass_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvfclass_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfsqrt_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfsqrt_s(a) } +pub fn lasx_xvfsqrt_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfsqrt_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfsqrt_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfsqrt_d(a) } +pub fn lasx_xvfsqrt_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfsqrt_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrecip_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrecip_s(a) } +pub fn lasx_xvfrecip_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrecip_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrecip_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrecip_d(a) } +pub fn lasx_xvfrecip_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrecip_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrecipe_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrecipe_s(a) } +pub fn lasx_xvfrecipe_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrecipe_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrecipe_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrecipe_d(a) } +pub fn lasx_xvfrecipe_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrecipe_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrsqrte_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrsqrte_s(a) } +pub fn lasx_xvfrsqrte_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrsqrte_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrsqrte_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrsqrte_d(a) } +pub fn lasx_xvfrsqrte_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrsqrte_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrint_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrint_s(a) } +pub fn lasx_xvfrint_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrint_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrint_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrint_d(a) } +pub fn lasx_xvfrint_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrint_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrsqrt_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrsqrt_s(a) } +pub fn lasx_xvfrsqrt_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrsqrt_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrsqrt_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrsqrt_d(a) } +pub fn lasx_xvfrsqrt_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrsqrt_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvflogb_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvflogb_s(a) } +pub fn lasx_xvflogb_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvflogb_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvflogb_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvflogb_d(a) } +pub fn lasx_xvflogb_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvflogb_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcvth_s_h(a: v16i16) -> v8f32 { - unsafe { __lasx_xvfcvth_s_h(a) } +pub fn lasx_xvfcvth_s_h(a: m256i) -> m256 { + unsafe { transmute(__lasx_xvfcvth_s_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcvth_d_s(a: v8f32) -> v4f64 { - unsafe { __lasx_xvfcvth_d_s(a) } +pub fn lasx_xvfcvth_d_s(a: m256) -> m256d { + unsafe { transmute(__lasx_xvfcvth_d_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcvtl_s_h(a: v16i16) -> v8f32 { - unsafe { __lasx_xvfcvtl_s_h(a) } +pub fn lasx_xvfcvtl_s_h(a: m256i) -> m256 { + unsafe { transmute(__lasx_xvfcvtl_s_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcvtl_d_s(a: v8f32) -> v4f64 { - unsafe { __lasx_xvfcvtl_d_s(a) } +pub fn lasx_xvfcvtl_d_s(a: m256) -> m256d { + unsafe { transmute(__lasx_xvfcvtl_d_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftint_w_s(a: v8f32) -> v8i32 { - unsafe { __lasx_xvftint_w_s(a) } +pub fn lasx_xvftint_w_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftint_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftint_l_d(a: v4f64) -> v4i64 { - unsafe { __lasx_xvftint_l_d(a) } +pub fn lasx_xvftint_l_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftint_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftint_wu_s(a: v8f32) -> v8u32 { - unsafe { __lasx_xvftint_wu_s(a) } +pub fn lasx_xvftint_wu_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftint_wu_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftint_lu_d(a: v4f64) -> v4u64 { - unsafe { __lasx_xvftint_lu_d(a) } +pub fn lasx_xvftint_lu_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftint_lu_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrz_w_s(a: v8f32) -> v8i32 { - unsafe { __lasx_xvftintrz_w_s(a) } +pub fn lasx_xvftintrz_w_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrz_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrz_l_d(a: v4f64) -> v4i64 { - unsafe { __lasx_xvftintrz_l_d(a) } +pub fn lasx_xvftintrz_l_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrz_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrz_wu_s(a: v8f32) -> v8u32 { - unsafe { __lasx_xvftintrz_wu_s(a) } +pub fn lasx_xvftintrz_wu_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrz_wu_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrz_lu_d(a: v4f64) -> v4u64 { - unsafe { __lasx_xvftintrz_lu_d(a) } +pub fn lasx_xvftintrz_lu_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrz_lu_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffint_s_w(a: v8i32) -> v8f32 { - unsafe { __lasx_xvffint_s_w(a) } +pub fn lasx_xvffint_s_w(a: m256i) -> m256 { + unsafe { transmute(__lasx_xvffint_s_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffint_d_l(a: v4i64) -> v4f64 { - unsafe { __lasx_xvffint_d_l(a) } +pub fn lasx_xvffint_d_l(a: m256i) -> m256d { + unsafe { transmute(__lasx_xvffint_d_l(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffint_s_wu(a: v8u32) -> v8f32 { - unsafe { __lasx_xvffint_s_wu(a) } +pub fn lasx_xvffint_s_wu(a: m256i) -> m256 { + unsafe { transmute(__lasx_xvffint_s_wu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffint_d_lu(a: v4u64) -> v4f64 { - unsafe { __lasx_xvffint_d_lu(a) } +pub fn lasx_xvffint_d_lu(a: m256i) -> m256d { + unsafe { transmute(__lasx_xvffint_d_lu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve_b(a: v32i8, b: i32) -> v32i8 { - unsafe { __lasx_xvreplve_b(a, b) } +pub fn lasx_xvreplve_b(a: m256i, b: i32) -> m256i { + unsafe { transmute(__lasx_xvreplve_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve_h(a: v16i16, b: i32) -> v16i16 { - unsafe { __lasx_xvreplve_h(a, b) } +pub fn lasx_xvreplve_h(a: m256i, b: i32) -> m256i { + unsafe { transmute(__lasx_xvreplve_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve_w(a: v8i32, b: i32) -> v8i32 { - unsafe { __lasx_xvreplve_w(a, b) } +pub fn lasx_xvreplve_w(a: m256i, b: i32) -> m256i { + unsafe { transmute(__lasx_xvreplve_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve_d(a: v4i64, b: i32) -> v4i64 { - unsafe { __lasx_xvreplve_d(a, b) } +pub fn lasx_xvreplve_d(a: m256i, b: i32) -> m256i { + unsafe { transmute(__lasx_xvreplve_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpermi_w(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvpermi_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvpermi_w(a, b, IMM8) } + unsafe { transmute(__lasx_xvpermi_w(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvandn_v(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvandn_v(a, b) } +pub fn lasx_xvandn_v(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvandn_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvneg_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvneg_b(a) } +pub fn lasx_xvneg_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvneg_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvneg_h(a: v16i16) -> v16i16 { - unsafe { __lasx_xvneg_h(a) } +pub fn lasx_xvneg_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvneg_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvneg_w(a: v8i32) -> v8i32 { - unsafe { __lasx_xvneg_w(a) } +pub fn lasx_xvneg_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvneg_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvneg_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvneg_d(a) } +pub fn lasx_xvneg_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvneg_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvmuh_b(a, b) } +pub fn lasx_xvmuh_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvmuh_h(a, b) } +pub fn lasx_xvmuh_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvmuh_w(a, b) } +pub fn lasx_xvmuh_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmuh_d(a, b) } +pub fn lasx_xvmuh_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_bu(a: v32u8, b: v32u8) -> v32u8 { - unsafe { __lasx_xvmuh_bu(a, b) } +pub fn lasx_xvmuh_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_hu(a: v16u16, b: v16u16) -> v16u16 { - unsafe { __lasx_xvmuh_hu(a, b) } +pub fn lasx_xvmuh_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_wu(a: v8u32, b: v8u32) -> v8u32 { - unsafe { __lasx_xvmuh_wu(a, b) } +pub fn lasx_xvmuh_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmuh_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvmuh_du(a, b) } +pub fn lasx_xvmuh_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmuh_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsllwil_h_b(a: v32i8) -> v16i16 { +pub fn lasx_xvsllwil_h_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsllwil_h_b(a, IMM3) } + unsafe { transmute(__lasx_xvsllwil_h_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsllwil_w_h(a: v16i16) -> v8i32 { +pub fn lasx_xvsllwil_w_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsllwil_w_h(a, IMM4) } + unsafe { transmute(__lasx_xvsllwil_w_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsllwil_d_w(a: v8i32) -> v4i64 { +pub fn lasx_xvsllwil_d_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsllwil_d_w(a, IMM5) } + unsafe { transmute(__lasx_xvsllwil_d_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsllwil_hu_bu(a: v32u8) -> v16u16 { +pub fn lasx_xvsllwil_hu_bu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvsllwil_hu_bu(a, IMM3) } + unsafe { transmute(__lasx_xvsllwil_hu_bu(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsllwil_wu_hu(a: v16u16) -> v8u32 { +pub fn lasx_xvsllwil_wu_hu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsllwil_wu_hu(a, IMM4) } + unsafe { transmute(__lasx_xvsllwil_wu_hu(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsllwil_du_wu(a: v8u32) -> v4u64 { +pub fn lasx_xvsllwil_du_wu(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsllwil_du_wu(a, IMM5) } + unsafe { transmute(__lasx_xvsllwil_du_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsran_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvsran_b_h(a, b) } +pub fn lasx_xvsran_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsran_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsran_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvsran_h_w(a, b) } +pub fn lasx_xvsran_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsran_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsran_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvsran_w_d(a, b) } +pub fn lasx_xvsran_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsran_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssran_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvssran_b_h(a, b) } +pub fn lasx_xvssran_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssran_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssran_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvssran_h_w(a, b) } +pub fn lasx_xvssran_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssran_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssran_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvssran_w_d(a, b) } +pub fn lasx_xvssran_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssran_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssran_bu_h(a: v16u16, b: v16u16) -> v32u8 { - unsafe { __lasx_xvssran_bu_h(a, b) } +pub fn lasx_xvssran_bu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssran_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssran_hu_w(a: v8u32, b: v8u32) -> v16u16 { - unsafe { __lasx_xvssran_hu_w(a, b) } +pub fn lasx_xvssran_hu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssran_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssran_wu_d(a: v4u64, b: v4u64) -> v8u32 { - unsafe { __lasx_xvssran_wu_d(a, b) } +pub fn lasx_xvssran_wu_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssran_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarn_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvsrarn_b_h(a, b) } +pub fn lasx_xvsrarn_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrarn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarn_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvsrarn_h_w(a, b) } +pub fn lasx_xvsrarn_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrarn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarn_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvsrarn_w_d(a, b) } +pub fn lasx_xvsrarn_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrarn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarn_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvssrarn_b_h(a, b) } +pub fn lasx_xvssrarn_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrarn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarn_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvssrarn_h_w(a, b) } +pub fn lasx_xvssrarn_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrarn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarn_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvssrarn_w_d(a, b) } +pub fn lasx_xvssrarn_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrarn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarn_bu_h(a: v16u16, b: v16u16) -> v32u8 { - unsafe { __lasx_xvssrarn_bu_h(a, b) } +pub fn lasx_xvssrarn_bu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrarn_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarn_hu_w(a: v8u32, b: v8u32) -> v16u16 { - unsafe { __lasx_xvssrarn_hu_w(a, b) } +pub fn lasx_xvssrarn_hu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrarn_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarn_wu_d(a: v4u64, b: v4u64) -> v8u32 { - unsafe { __lasx_xvssrarn_wu_d(a, b) } +pub fn lasx_xvssrarn_wu_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrarn_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrln_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvsrln_b_h(a, b) } +pub fn lasx_xvsrln_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrln_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrln_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvsrln_h_w(a, b) } +pub fn lasx_xvsrln_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrln_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrln_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvsrln_w_d(a, b) } +pub fn lasx_xvsrln_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrln_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrln_bu_h(a: v16u16, b: v16u16) -> v32u8 { - unsafe { __lasx_xvssrln_bu_h(a, b) } +pub fn lasx_xvssrln_bu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrln_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrln_hu_w(a: v8u32, b: v8u32) -> v16u16 { - unsafe { __lasx_xvssrln_hu_w(a, b) } +pub fn lasx_xvssrln_hu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrln_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrln_wu_d(a: v4u64, b: v4u64) -> v8u32 { - unsafe { __lasx_xvssrln_wu_d(a, b) } +pub fn lasx_xvssrln_wu_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrln_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrn_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvsrlrn_b_h(a, b) } +pub fn lasx_xvsrlrn_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlrn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrn_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvsrlrn_h_w(a, b) } +pub fn lasx_xvsrlrn_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlrn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrn_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvsrlrn_w_d(a, b) } +pub fn lasx_xvsrlrn_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsrlrn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrn_bu_h(a: v16u16, b: v16u16) -> v32u8 { - unsafe { __lasx_xvssrlrn_bu_h(a, b) } +pub fn lasx_xvssrlrn_bu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrlrn_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrn_hu_w(a: v8u32, b: v8u32) -> v16u16 { - unsafe { __lasx_xvssrlrn_hu_w(a, b) } +pub fn lasx_xvssrlrn_hu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrlrn_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrn_wu_d(a: v4u64, b: v4u64) -> v8u32 { - unsafe { __lasx_xvssrlrn_wu_d(a, b) } +pub fn lasx_xvssrlrn_wu_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrlrn_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrstpi_b(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvfrstpi_b(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvfrstpi_b(a, b, IMM5) } + unsafe { transmute(__lasx_xvfrstpi_b(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrstpi_h(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvfrstpi_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvfrstpi_h(a, b, IMM5) } + unsafe { transmute(__lasx_xvfrstpi_h(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrstp_b(a: v32i8, b: v32i8, c: v32i8) -> v32i8 { - unsafe { __lasx_xvfrstp_b(a, b, c) } +pub fn lasx_xvfrstp_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvfrstp_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrstp_h(a: v16i16, b: v16i16, c: v16i16) -> v16i16 { - unsafe { __lasx_xvfrstp_h(a, b, c) } +pub fn lasx_xvfrstp_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvfrstp_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvshuf4i_d(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvshuf4i_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvshuf4i_d(a, b, IMM8) } + unsafe { transmute(__lasx_xvshuf4i_d(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbsrl_v(a: v32i8) -> v32i8 { +pub fn lasx_xvbsrl_v(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvbsrl_v(a, IMM5) } + unsafe { transmute(__lasx_xvbsrl_v(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvbsll_v(a: v32i8) -> v32i8 { +pub fn lasx_xvbsll_v(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvbsll_v(a, IMM5) } + unsafe { transmute(__lasx_xvbsll_v(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvextrins_b(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvextrins_b(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvextrins_b(a, b, IMM8) } + unsafe { transmute(__lasx_xvextrins_b(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvextrins_h(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvextrins_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvextrins_h(a, b, IMM8) } + unsafe { transmute(__lasx_xvextrins_h(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvextrins_w(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvextrins_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvextrins_w(a, b, IMM8) } + unsafe { transmute(__lasx_xvextrins_w(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvextrins_d(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvextrins_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvextrins_d(a, b, IMM8) } + unsafe { transmute(__lasx_xvextrins_d(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmskltz_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvmskltz_b(a) } +pub fn lasx_xvmskltz_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvmskltz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmskltz_h(a: v16i16) -> v16i16 { - unsafe { __lasx_xvmskltz_h(a) } +pub fn lasx_xvmskltz_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvmskltz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmskltz_w(a: v8i32) -> v8i32 { - unsafe { __lasx_xvmskltz_w(a) } +pub fn lasx_xvmskltz_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvmskltz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmskltz_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvmskltz_d(a) } +pub fn lasx_xvmskltz_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvmskltz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsigncov_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvsigncov_b(a, b) } +pub fn lasx_xvsigncov_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsigncov_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsigncov_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvsigncov_h(a, b) } +pub fn lasx_xvsigncov_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsigncov_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsigncov_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvsigncov_w(a, b) } +pub fn lasx_xvsigncov_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsigncov_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsigncov_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsigncov_d(a, b) } +pub fn lasx_xvsigncov_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsigncov_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - unsafe { __lasx_xvfmadd_s(a, b, c) } +pub fn lasx_xvfmadd_s(a: m256, b: m256, c: m256) -> m256 { + unsafe { transmute(__lasx_xvfmadd_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - unsafe { __lasx_xvfmadd_d(a, b, c) } +pub fn lasx_xvfmadd_d(a: m256d, b: m256d, c: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmadd_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - unsafe { __lasx_xvfmsub_s(a, b, c) } +pub fn lasx_xvfmsub_s(a: m256, b: m256, c: m256) -> m256 { + unsafe { transmute(__lasx_xvfmsub_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - unsafe { __lasx_xvfmsub_d(a, b, c) } +pub fn lasx_xvfmsub_d(a: m256d, b: m256d, c: m256d) -> m256d { + unsafe { transmute(__lasx_xvfmsub_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfnmadd_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - unsafe { __lasx_xvfnmadd_s(a, b, c) } +pub fn lasx_xvfnmadd_s(a: m256, b: m256, c: m256) -> m256 { + unsafe { transmute(__lasx_xvfnmadd_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfnmadd_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - unsafe { __lasx_xvfnmadd_d(a, b, c) } +pub fn lasx_xvfnmadd_d(a: m256d, b: m256d, c: m256d) -> m256d { + unsafe { transmute(__lasx_xvfnmadd_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfnmsub_s(a: v8f32, b: v8f32, c: v8f32) -> v8f32 { - unsafe { __lasx_xvfnmsub_s(a, b, c) } +pub fn lasx_xvfnmsub_s(a: m256, b: m256, c: m256) -> m256 { + unsafe { transmute(__lasx_xvfnmsub_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfnmsub_d(a: v4f64, b: v4f64, c: v4f64) -> v4f64 { - unsafe { __lasx_xvfnmsub_d(a, b, c) } +pub fn lasx_xvfnmsub_d(a: m256d, b: m256d, c: m256d) -> m256d { + unsafe { transmute(__lasx_xvfnmsub_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrne_w_s(a: v8f32) -> v8i32 { - unsafe { __lasx_xvftintrne_w_s(a) } +pub fn lasx_xvftintrne_w_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrne_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrne_l_d(a: v4f64) -> v4i64 { - unsafe { __lasx_xvftintrne_l_d(a) } +pub fn lasx_xvftintrne_l_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrne_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrp_w_s(a: v8f32) -> v8i32 { - unsafe { __lasx_xvftintrp_w_s(a) } +pub fn lasx_xvftintrp_w_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrp_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrp_l_d(a: v4f64) -> v4i64 { - unsafe { __lasx_xvftintrp_l_d(a) } +pub fn lasx_xvftintrp_l_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrp_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrm_w_s(a: v8f32) -> v8i32 { - unsafe { __lasx_xvftintrm_w_s(a) } +pub fn lasx_xvftintrm_w_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrm_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrm_l_d(a: v4f64) -> v4i64 { - unsafe { __lasx_xvftintrm_l_d(a) } +pub fn lasx_xvftintrm_l_d(a: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrm_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftint_w_d(a: v4f64, b: v4f64) -> v8i32 { - unsafe { __lasx_xvftint_w_d(a, b) } +pub fn lasx_xvftint_w_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvftint_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffint_s_l(a: v4i64, b: v4i64) -> v8f32 { - unsafe { __lasx_xvffint_s_l(a, b) } +pub fn lasx_xvffint_s_l(a: m256i, b: m256i) -> m256 { + unsafe { transmute(__lasx_xvffint_s_l(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrz_w_d(a: v4f64, b: v4f64) -> v8i32 { - unsafe { __lasx_xvftintrz_w_d(a, b) } +pub fn lasx_xvftintrz_w_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrz_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrp_w_d(a: v4f64, b: v4f64) -> v8i32 { - unsafe { __lasx_xvftintrp_w_d(a, b) } +pub fn lasx_xvftintrp_w_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrp_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrm_w_d(a: v4f64, b: v4f64) -> v8i32 { - unsafe { __lasx_xvftintrm_w_d(a, b) } +pub fn lasx_xvftintrm_w_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrm_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrne_w_d(a: v4f64, b: v4f64) -> v8i32 { - unsafe { __lasx_xvftintrne_w_d(a, b) } +pub fn lasx_xvftintrne_w_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvftintrne_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftinth_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftinth_l_s(a) } +pub fn lasx_xvftinth_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftinth_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintl_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintl_l_s(a) } +pub fn lasx_xvftintl_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintl_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffinth_d_w(a: v8i32) -> v4f64 { - unsafe { __lasx_xvffinth_d_w(a) } +pub fn lasx_xvffinth_d_w(a: m256i) -> m256d { + unsafe { transmute(__lasx_xvffinth_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvffintl_d_w(a: v8i32) -> v4f64 { - unsafe { __lasx_xvffintl_d_w(a) } +pub fn lasx_xvffintl_d_w(a: m256i) -> m256d { + unsafe { transmute(__lasx_xvffintl_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrzh_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrzh_l_s(a) } +pub fn lasx_xvftintrzh_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrzh_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrzl_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrzl_l_s(a) } +pub fn lasx_xvftintrzl_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrzl_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrph_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrph_l_s(a) } +pub fn lasx_xvftintrph_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrph_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrpl_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrpl_l_s(a) } +pub fn lasx_xvftintrpl_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrpl_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrmh_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrmh_l_s(a) } +pub fn lasx_xvftintrmh_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrmh_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrml_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrml_l_s(a) } +pub fn lasx_xvftintrml_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrml_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrneh_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrneh_l_s(a) } +pub fn lasx_xvftintrneh_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrneh_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvftintrnel_l_s(a: v8f32) -> v4i64 { - unsafe { __lasx_xvftintrnel_l_s(a) } +pub fn lasx_xvftintrnel_l_s(a: m256) -> m256i { + unsafe { transmute(__lasx_xvftintrnel_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrne_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrintrne_s(a) } +pub fn lasx_xvfrintrne_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrintrne_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrne_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrintrne_d(a) } +pub fn lasx_xvfrintrne_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrintrne_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrz_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrintrz_s(a) } +pub fn lasx_xvfrintrz_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrintrz_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrz_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrintrz_d(a) } +pub fn lasx_xvfrintrz_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrintrz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrp_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrintrp_s(a) } +pub fn lasx_xvfrintrp_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrintrp_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrp_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrintrp_d(a) } +pub fn lasx_xvfrintrp_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrintrp_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrm_s(a: v8f32) -> v8f32 { - unsafe { __lasx_xvfrintrm_s(a) } +pub fn lasx_xvfrintrm_s(a: m256) -> m256 { + unsafe { transmute(__lasx_xvfrintrm_s(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfrintrm_d(a: v4f64) -> v4f64 { - unsafe { __lasx_xvfrintrm_d(a) } +pub fn lasx_xvfrintrm_d(a: m256d) -> m256d { + unsafe { transmute(__lasx_xvfrintrm_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvld(mem_addr: *const i8) -> v32i8 { +pub unsafe fn lasx_xvld(mem_addr: *const i8) -> m256i { static_assert_simm_bits!(IMM_S12, 12); - __lasx_xvld(mem_addr, IMM_S12) + transmute(__lasx_xvld(mem_addr, IMM_S12)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvst(a: v32i8, mem_addr: *mut i8) { +pub unsafe fn lasx_xvst(a: m256i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S12, 12); - __lasx_xvst(a, mem_addr, IMM_S12) + transmute(__lasx_xvst(transmute(a), mem_addr, IMM_S12)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvstelm_b(a: v32i8, mem_addr: *mut i8) { +pub unsafe fn lasx_xvstelm_b(a: m256i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM4, 4); - __lasx_xvstelm_b(a, mem_addr, IMM_S8, IMM4) + transmute(__lasx_xvstelm_b(transmute(a), mem_addr, IMM_S8, IMM4)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvstelm_h(a: v16i16, mem_addr: *mut i8) { +pub unsafe fn lasx_xvstelm_h(a: m256i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM3, 3); - __lasx_xvstelm_h(a, mem_addr, IMM_S8, IMM3) + transmute(__lasx_xvstelm_h(transmute(a), mem_addr, IMM_S8, IMM3)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvstelm_w(a: v8i32, mem_addr: *mut i8) { +pub unsafe fn lasx_xvstelm_w(a: m256i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM2, 2); - __lasx_xvstelm_w(a, mem_addr, IMM_S8, IMM2) + transmute(__lasx_xvstelm_w(transmute(a), mem_addr, IMM_S8, IMM2)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvstelm_d(a: v4i64, mem_addr: *mut i8) { +pub unsafe fn lasx_xvstelm_d(a: m256i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM1, 1); - __lasx_xvstelm_d(a, mem_addr, IMM_S8, IMM1) + transmute(__lasx_xvstelm_d(transmute(a), mem_addr, IMM_S8, IMM1)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvinsve0_w(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvinsve0_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvinsve0_w(a, b, IMM3) } + unsafe { transmute(__lasx_xvinsve0_w(transmute(a), transmute(b), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvinsve0_d(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvinsve0_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvinsve0_d(a, b, IMM2) } + unsafe { transmute(__lasx_xvinsve0_d(transmute(a), transmute(b), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve_w(a: v8i32) -> v8i32 { +pub fn lasx_xvpickve_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvpickve_w(a, IMM3) } + unsafe { transmute(__lasx_xvpickve_w(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve_d(a: v4i64) -> v4i64 { +pub fn lasx_xvpickve_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvpickve_d(a, IMM2) } + unsafe { transmute(__lasx_xvpickve_d(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrn_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvssrlrn_b_h(a, b) } +pub fn lasx_xvssrlrn_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrlrn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrn_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvssrlrn_h_w(a, b) } +pub fn lasx_xvssrlrn_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrlrn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrn_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvssrlrn_w_d(a, b) } +pub fn lasx_xvssrlrn_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrlrn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrln_b_h(a: v16i16, b: v16i16) -> v32i8 { - unsafe { __lasx_xvssrln_b_h(a, b) } +pub fn lasx_xvssrln_b_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrln_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrln_h_w(a: v8i32, b: v8i32) -> v16i16 { - unsafe { __lasx_xvssrln_h_w(a, b) } +pub fn lasx_xvssrln_h_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrln_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrln_w_d(a: v4i64, b: v4i64) -> v8i32 { - unsafe { __lasx_xvssrln_w_d(a, b) } +pub fn lasx_xvssrln_w_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvssrln_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvorn_v(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvorn_v(a, b) } +pub fn lasx_xvorn_v(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvorn_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvldi() -> v4i64 { +pub fn lasx_xvldi() -> m256i { static_assert_simm_bits!(IMM_S13, 13); - unsafe { __lasx_xvldi(IMM_S13) } + unsafe { transmute(__lasx_xvldi(IMM_S13)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvldx(mem_addr: *const i8, b: i64) -> v32i8 { - __lasx_xvldx(mem_addr, b) +pub unsafe fn lasx_xvldx(mem_addr: *const i8, b: i64) -> m256i { + transmute(__lasx_xvldx(mem_addr, transmute(b))) } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvstx(a: v32i8, mem_addr: *mut i8, b: i64) { - __lasx_xvstx(a, mem_addr, b) +pub unsafe fn lasx_xvstx(a: m256i, mem_addr: *mut i8, b: i64) { + transmute(__lasx_xvstx(transmute(a), mem_addr, transmute(b))) } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvextl_qu_du(a: v4u64) -> v4u64 { - unsafe { __lasx_xvextl_qu_du(a) } +pub fn lasx_xvextl_qu_du(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvextl_qu_du(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvinsgr2vr_w(a: v8i32, b: i32) -> v8i32 { +pub fn lasx_xvinsgr2vr_w(a: m256i, b: i32) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvinsgr2vr_w(a, b, IMM3) } + unsafe { transmute(__lasx_xvinsgr2vr_w(transmute(a), transmute(b), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvinsgr2vr_d(a: v4i64, b: i64) -> v4i64 { +pub fn lasx_xvinsgr2vr_d(a: m256i, b: i64) -> m256i { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvinsgr2vr_d(a, b, IMM2) } + unsafe { transmute(__lasx_xvinsgr2vr_d(transmute(a), transmute(b), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve0_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvreplve0_b(a) } +pub fn lasx_xvreplve0_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvreplve0_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve0_h(a: v16i16) -> v16i16 { - unsafe { __lasx_xvreplve0_h(a) } +pub fn lasx_xvreplve0_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvreplve0_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve0_w(a: v8i32) -> v8i32 { - unsafe { __lasx_xvreplve0_w(a) } +pub fn lasx_xvreplve0_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvreplve0_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve0_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvreplve0_d(a) } +pub fn lasx_xvreplve0_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvreplve0_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvreplve0_q(a: v32i8) -> v32i8 { - unsafe { __lasx_xvreplve0_q(a) } +pub fn lasx_xvreplve0_q(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvreplve0_q(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_h_b(a: v32i8) -> v16i16 { - unsafe { __lasx_vext2xv_h_b(a) } +pub fn lasx_vext2xv_h_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_h_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_w_h(a: v16i16) -> v8i32 { - unsafe { __lasx_vext2xv_w_h(a) } +pub fn lasx_vext2xv_w_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_w_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_d_w(a: v8i32) -> v4i64 { - unsafe { __lasx_vext2xv_d_w(a) } +pub fn lasx_vext2xv_d_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_w_b(a: v32i8) -> v8i32 { - unsafe { __lasx_vext2xv_w_b(a) } +pub fn lasx_vext2xv_w_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_w_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_d_h(a: v16i16) -> v4i64 { - unsafe { __lasx_vext2xv_d_h(a) } +pub fn lasx_vext2xv_d_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_d_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_d_b(a: v32i8) -> v4i64 { - unsafe { __lasx_vext2xv_d_b(a) } +pub fn lasx_vext2xv_d_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_d_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_hu_bu(a: v32i8) -> v16i16 { - unsafe { __lasx_vext2xv_hu_bu(a) } +pub fn lasx_vext2xv_hu_bu(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_hu_bu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_wu_hu(a: v16i16) -> v8i32 { - unsafe { __lasx_vext2xv_wu_hu(a) } +pub fn lasx_vext2xv_wu_hu(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_wu_hu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_du_wu(a: v8i32) -> v4i64 { - unsafe { __lasx_vext2xv_du_wu(a) } +pub fn lasx_vext2xv_du_wu(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_du_wu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_wu_bu(a: v32i8) -> v8i32 { - unsafe { __lasx_vext2xv_wu_bu(a) } +pub fn lasx_vext2xv_wu_bu(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_wu_bu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_du_hu(a: v16i16) -> v4i64 { - unsafe { __lasx_vext2xv_du_hu(a) } +pub fn lasx_vext2xv_du_hu(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_du_hu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_vext2xv_du_bu(a: v32i8) -> v4i64 { - unsafe { __lasx_vext2xv_du_bu(a) } +pub fn lasx_vext2xv_du_bu(a: m256i) -> m256i { + unsafe { transmute(__lasx_vext2xv_du_bu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpermi_q(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvpermi_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvpermi_q(a, b, IMM8) } + unsafe { transmute(__lasx_xvpermi_q(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpermi_d(a: v4i64) -> v4i64 { +pub fn lasx_xvpermi_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lasx_xvpermi_d(a, IMM8) } + unsafe { transmute(__lasx_xvpermi_d(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvperm_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvperm_w(a, b) } +pub fn lasx_xvperm_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvperm_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvldrepl_b(mem_addr: *const i8) -> v32i8 { +pub unsafe fn lasx_xvldrepl_b(mem_addr: *const i8) -> m256i { static_assert_simm_bits!(IMM_S12, 12); - __lasx_xvldrepl_b(mem_addr, IMM_S12) + transmute(__lasx_xvldrepl_b(mem_addr, IMM_S12)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvldrepl_h(mem_addr: *const i8) -> v16i16 { +pub unsafe fn lasx_xvldrepl_h(mem_addr: *const i8) -> m256i { static_assert_simm_bits!(IMM_S11, 11); - __lasx_xvldrepl_h(mem_addr, IMM_S11) + transmute(__lasx_xvldrepl_h(mem_addr, IMM_S11)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvldrepl_w(mem_addr: *const i8) -> v8i32 { +pub unsafe fn lasx_xvldrepl_w(mem_addr: *const i8) -> m256i { static_assert_simm_bits!(IMM_S10, 10); - __lasx_xvldrepl_w(mem_addr, IMM_S10) + transmute(__lasx_xvldrepl_w(mem_addr, IMM_S10)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lasx_xvldrepl_d(mem_addr: *const i8) -> v4i64 { +pub unsafe fn lasx_xvldrepl_d(mem_addr: *const i8) -> m256i { static_assert_simm_bits!(IMM_S9, 9); - __lasx_xvldrepl_d(mem_addr, IMM_S9) + transmute(__lasx_xvldrepl_d(mem_addr, IMM_S9)) } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve2gr_w(a: v8i32) -> i32 { +pub fn lasx_xvpickve2gr_w(a: m256i) -> i32 { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvpickve2gr_w(a, IMM3) } + unsafe { transmute(__lasx_xvpickve2gr_w(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve2gr_wu(a: v8i32) -> u32 { +pub fn lasx_xvpickve2gr_wu(a: m256i) -> u32 { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvpickve2gr_wu(a, IMM3) } + unsafe { transmute(__lasx_xvpickve2gr_wu(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve2gr_d(a: v4i64) -> i64 { +pub fn lasx_xvpickve2gr_d(a: m256i) -> i64 { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvpickve2gr_d(a, IMM2) } + unsafe { transmute(__lasx_xvpickve2gr_d(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve2gr_du(a: v4i64) -> u64 { +pub fn lasx_xvpickve2gr_du(a: m256i) -> u64 { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvpickve2gr_du(a, IMM2) } + unsafe { transmute(__lasx_xvpickve2gr_du(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvaddwev_q_d(a, b) } +pub fn lasx_xvaddwev_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvaddwev_d_w(a, b) } +pub fn lasx_xvaddwev_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvaddwev_w_h(a, b) } +pub fn lasx_xvaddwev_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvaddwev_h_b(a, b) } +pub fn lasx_xvaddwev_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_q_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvaddwev_q_du(a, b) } +pub fn lasx_xvaddwev_q_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvaddwev_d_wu(a, b) } +pub fn lasx_xvaddwev_d_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvaddwev_w_hu(a, b) } +pub fn lasx_xvaddwev_w_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvaddwev_h_bu(a, b) } +pub fn lasx_xvaddwev_h_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsubwev_q_d(a, b) } +pub fn lasx_xvsubwev_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvsubwev_d_w(a, b) } +pub fn lasx_xvsubwev_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvsubwev_w_h(a, b) } +pub fn lasx_xvsubwev_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvsubwev_h_b(a, b) } +pub fn lasx_xvsubwev_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_q_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvsubwev_q_du(a, b) } +pub fn lasx_xvsubwev_q_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvsubwev_d_wu(a, b) } +pub fn lasx_xvsubwev_d_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvsubwev_w_hu(a, b) } +pub fn lasx_xvsubwev_w_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvsubwev_h_bu(a, b) } +pub fn lasx_xvsubwev_h_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwev_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmulwev_q_d(a, b) } +pub fn lasx_xvmulwev_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvmulwev_d_w(a, b) } +pub fn lasx_xvmulwev_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvmulwev_w_h(a, b) } +pub fn lasx_xvmulwev_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvmulwev_h_b(a, b) } +pub fn lasx_xvmulwev_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_q_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvmulwev_q_du(a, b) } +pub fn lasx_xvmulwev_q_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_d_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvmulwev_d_wu(a, b) } +pub fn lasx_xvmulwev_d_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_w_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvmulwev_w_hu(a, b) } +pub fn lasx_xvmulwev_w_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_h_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvmulwev_h_bu(a, b) } +pub fn lasx_xvmulwev_h_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvaddwod_q_d(a, b) } +pub fn lasx_xvaddwod_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvaddwod_d_w(a, b) } +pub fn lasx_xvaddwod_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvaddwod_w_h(a, b) } +pub fn lasx_xvaddwod_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvaddwod_h_b(a, b) } +pub fn lasx_xvaddwod_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_q_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvaddwod_q_du(a, b) } +pub fn lasx_xvaddwod_q_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvaddwod_d_wu(a, b) } +pub fn lasx_xvaddwod_d_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvaddwod_w_hu(a, b) } +pub fn lasx_xvaddwod_w_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvaddwod_h_bu(a, b) } +pub fn lasx_xvaddwod_h_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsubwod_q_d(a, b) } +pub fn lasx_xvsubwod_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvsubwod_d_w(a, b) } +pub fn lasx_xvsubwod_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvsubwod_w_h(a, b) } +pub fn lasx_xvsubwod_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvsubwod_h_b(a, b) } +pub fn lasx_xvsubwod_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_q_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvsubwod_q_du(a, b) } +pub fn lasx_xvsubwod_q_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvsubwod_d_wu(a, b) } +pub fn lasx_xvsubwod_d_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvsubwod_w_hu(a, b) } +pub fn lasx_xvsubwod_w_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsubwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvsubwod_h_bu(a, b) } +pub fn lasx_xvsubwod_h_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsubwod_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmulwod_q_d(a, b) } +pub fn lasx_xvmulwod_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_d_w(a: v8i32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvmulwod_d_w(a, b) } +pub fn lasx_xvmulwod_d_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_w_h(a: v16i16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvmulwod_w_h(a, b) } +pub fn lasx_xvmulwod_w_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_h_b(a: v32i8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvmulwod_h_b(a, b) } +pub fn lasx_xvmulwod_h_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_q_du(a: v4u64, b: v4u64) -> v4i64 { - unsafe { __lasx_xvmulwod_q_du(a, b) } +pub fn lasx_xvmulwod_q_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_d_wu(a: v8u32, b: v8u32) -> v4i64 { - unsafe { __lasx_xvmulwod_d_wu(a, b) } +pub fn lasx_xvmulwod_d_wu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_w_hu(a: v16u16, b: v16u16) -> v8i32 { - unsafe { __lasx_xvmulwod_w_hu(a, b) } +pub fn lasx_xvmulwod_w_hu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_h_bu(a: v32u8, b: v32u8) -> v16i16 { - unsafe { __lasx_xvmulwod_h_bu(a, b) } +pub fn lasx_xvmulwod_h_bu(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvaddwev_d_wu_w(a, b) } +pub fn lasx_xvaddwev_d_wu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvaddwev_w_hu_h(a, b) } +pub fn lasx_xvaddwev_w_hu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvaddwev_h_bu_b(a, b) } +pub fn lasx_xvaddwev_h_bu_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvmulwev_d_wu_w(a, b) } +pub fn lasx_xvmulwev_d_wu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvmulwev_w_hu_h(a, b) } +pub fn lasx_xvmulwev_w_hu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvmulwev_h_bu_b(a, b) } +pub fn lasx_xvmulwev_h_bu_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvaddwod_d_wu_w(a, b) } +pub fn lasx_xvaddwod_d_wu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvaddwod_w_hu_h(a, b) } +pub fn lasx_xvaddwod_w_hu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvaddwod_h_bu_b(a, b) } +pub fn lasx_xvaddwod_h_bu_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_d_wu_w(a: v8u32, b: v8i32) -> v4i64 { - unsafe { __lasx_xvmulwod_d_wu_w(a, b) } +pub fn lasx_xvmulwod_d_wu_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_w_hu_h(a: v16u16, b: v16i16) -> v8i32 { - unsafe { __lasx_xvmulwod_w_hu_h(a, b) } +pub fn lasx_xvmulwod_w_hu_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_h_bu_b(a: v32u8, b: v32i8) -> v16i16 { - unsafe { __lasx_xvmulwod_h_bu_b(a, b) } +pub fn lasx_xvmulwod_h_bu_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvhaddw_q_d(a, b) } +pub fn lasx_xvhaddw_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhaddw_qu_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvhaddw_qu_du(a, b) } +pub fn lasx_xvhaddw_qu_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhaddw_qu_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_q_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvhsubw_q_d(a, b) } +pub fn lasx_xvhsubw_q_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvhsubw_qu_du(a: v4u64, b: v4u64) -> v4u64 { - unsafe { __lasx_xvhsubw_qu_du(a, b) } +pub fn lasx_xvhsubw_qu_du(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvhsubw_qu_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvmaddwev_q_d(a, b, c) } +pub fn lasx_xvmaddwev_q_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_q_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64 { - unsafe { __lasx_xvmaddwev_d_w(a, b, c) } +pub fn lasx_xvmaddwev_d_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_d_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32 { - unsafe { __lasx_xvmaddwev_w_h(a, b, c) } +pub fn lasx_xvmaddwev_w_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_w_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16 { - unsafe { __lasx_xvmaddwev_h_b(a, b, c) } +pub fn lasx_xvmaddwev_h_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_h_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64 { - unsafe { __lasx_xvmaddwev_q_du(a, b, c) } +pub fn lasx_xvmaddwev_q_du(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_q_du(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64 { - unsafe { __lasx_xvmaddwev_d_wu(a, b, c) } +pub fn lasx_xvmaddwev_d_wu(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_d_wu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32 { - unsafe { __lasx_xvmaddwev_w_hu(a, b, c) } +pub fn lasx_xvmaddwev_w_hu(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_w_hu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16 { - unsafe { __lasx_xvmaddwev_h_bu(a, b, c) } +pub fn lasx_xvmaddwev_h_bu(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_h_bu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_q_d(a: v4i64, b: v4i64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvmaddwod_q_d(a, b, c) } +pub fn lasx_xvmaddwod_q_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_q_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_d_w(a: v4i64, b: v8i32, c: v8i32) -> v4i64 { - unsafe { __lasx_xvmaddwod_d_w(a, b, c) } +pub fn lasx_xvmaddwod_d_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_d_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_w_h(a: v8i32, b: v16i16, c: v16i16) -> v8i32 { - unsafe { __lasx_xvmaddwod_w_h(a, b, c) } +pub fn lasx_xvmaddwod_w_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_w_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_h_b(a: v16i16, b: v32i8, c: v32i8) -> v16i16 { - unsafe { __lasx_xvmaddwod_h_b(a, b, c) } +pub fn lasx_xvmaddwod_h_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_h_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_q_du(a: v4u64, b: v4u64, c: v4u64) -> v4u64 { - unsafe { __lasx_xvmaddwod_q_du(a, b, c) } +pub fn lasx_xvmaddwod_q_du(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_q_du(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_d_wu(a: v4u64, b: v8u32, c: v8u32) -> v4u64 { - unsafe { __lasx_xvmaddwod_d_wu(a, b, c) } +pub fn lasx_xvmaddwod_d_wu(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_d_wu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_w_hu(a: v8u32, b: v16u16, c: v16u16) -> v8u32 { - unsafe { __lasx_xvmaddwod_w_hu(a, b, c) } +pub fn lasx_xvmaddwod_w_hu(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_w_hu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_h_bu(a: v16u16, b: v32u8, c: v32u8) -> v16u16 { - unsafe { __lasx_xvmaddwod_h_bu(a, b, c) } +pub fn lasx_xvmaddwod_h_bu(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_h_bu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvmaddwev_q_du_d(a, b, c) } +pub fn lasx_xvmaddwev_q_du_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_q_du_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64 { - unsafe { __lasx_xvmaddwev_d_wu_w(a, b, c) } +pub fn lasx_xvmaddwev_d_wu_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_d_wu_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32 { - unsafe { __lasx_xvmaddwev_w_hu_h(a, b, c) } +pub fn lasx_xvmaddwev_w_hu_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_w_hu_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwev_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16 { - unsafe { __lasx_xvmaddwev_h_bu_b(a, b, c) } +pub fn lasx_xvmaddwev_h_bu_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwev_h_bu_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_q_du_d(a: v4i64, b: v4u64, c: v4i64) -> v4i64 { - unsafe { __lasx_xvmaddwod_q_du_d(a, b, c) } +pub fn lasx_xvmaddwod_q_du_d(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_q_du_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_d_wu_w(a: v4i64, b: v8u32, c: v8i32) -> v4i64 { - unsafe { __lasx_xvmaddwod_d_wu_w(a, b, c) } +pub fn lasx_xvmaddwod_d_wu_w(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_d_wu_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_w_hu_h(a: v8i32, b: v16u16, c: v16i16) -> v8i32 { - unsafe { __lasx_xvmaddwod_w_hu_h(a, b, c) } +pub fn lasx_xvmaddwod_w_hu_h(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_w_hu_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmaddwod_h_bu_b(a: v16i16, b: v32u8, c: v32i8) -> v16i16 { - unsafe { __lasx_xvmaddwod_h_bu_b(a, b, c) } +pub fn lasx_xvmaddwod_h_bu_b(a: m256i, b: m256i, c: m256i) -> m256i { + unsafe { transmute(__lasx_xvmaddwod_h_bu_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotr_b(a: v32i8, b: v32i8) -> v32i8 { - unsafe { __lasx_xvrotr_b(a, b) } +pub fn lasx_xvrotr_b(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvrotr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotr_h(a: v16i16, b: v16i16) -> v16i16 { - unsafe { __lasx_xvrotr_h(a, b) } +pub fn lasx_xvrotr_h(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvrotr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotr_w(a: v8i32, b: v8i32) -> v8i32 { - unsafe { __lasx_xvrotr_w(a, b) } +pub fn lasx_xvrotr_w(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvrotr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotr_d(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvrotr_d(a, b) } +pub fn lasx_xvrotr_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvrotr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvadd_q(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvadd_q(a, b) } +pub fn lasx_xvadd_q(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvadd_q(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsub_q(a: v4i64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvsub_q(a, b) } +pub fn lasx_xvsub_q(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvsub_q(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwev_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvaddwev_q_du_d(a, b) } +pub fn lasx_xvaddwev_q_du_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwev_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvaddwod_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvaddwod_q_du_d(a, b) } +pub fn lasx_xvaddwod_q_du_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvaddwod_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwev_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmulwev_q_du_d(a, b) } +pub fn lasx_xvmulwev_q_du_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwev_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmulwod_q_du_d(a: v4u64, b: v4i64) -> v4i64 { - unsafe { __lasx_xvmulwod_q_du_d(a, b) } +pub fn lasx_xvmulwod_q_du_d(a: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmulwod_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmskgez_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvmskgez_b(a) } +pub fn lasx_xvmskgez_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvmskgez_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvmsknz_b(a: v32i8) -> v32i8 { - unsafe { __lasx_xvmsknz_b(a) } +pub fn lasx_xvmsknz_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvmsknz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_h_b(a: v32i8) -> v16i16 { - unsafe { __lasx_xvexth_h_b(a) } +pub fn lasx_xvexth_h_b(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_h_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_w_h(a: v16i16) -> v8i32 { - unsafe { __lasx_xvexth_w_h(a) } +pub fn lasx_xvexth_w_h(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_w_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_d_w(a: v8i32) -> v4i64 { - unsafe { __lasx_xvexth_d_w(a) } +pub fn lasx_xvexth_d_w(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_q_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvexth_q_d(a) } +pub fn lasx_xvexth_q_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_q_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_hu_bu(a: v32u8) -> v16u16 { - unsafe { __lasx_xvexth_hu_bu(a) } +pub fn lasx_xvexth_hu_bu(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_hu_bu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_wu_hu(a: v16u16) -> v8u32 { - unsafe { __lasx_xvexth_wu_hu(a) } +pub fn lasx_xvexth_wu_hu(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_wu_hu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_du_wu(a: v8u32) -> v4u64 { - unsafe { __lasx_xvexth_du_wu(a) } +pub fn lasx_xvexth_du_wu(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_du_wu(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvexth_qu_du(a: v4u64) -> v4u64 { - unsafe { __lasx_xvexth_qu_du(a) } +pub fn lasx_xvexth_qu_du(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvexth_qu_du(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotri_b(a: v32i8) -> v32i8 { +pub fn lasx_xvrotri_b(a: m256i) -> m256i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvrotri_b(a, IMM3) } + unsafe { transmute(__lasx_xvrotri_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotri_h(a: v16i16) -> v16i16 { +pub fn lasx_xvrotri_h(a: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvrotri_h(a, IMM4) } + unsafe { transmute(__lasx_xvrotri_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotri_w(a: v8i32) -> v8i32 { +pub fn lasx_xvrotri_w(a: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvrotri_w(a, IMM5) } + unsafe { transmute(__lasx_xvrotri_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrotri_d(a: v4i64) -> v4i64 { +pub fn lasx_xvrotri_d(a: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvrotri_d(a, IMM6) } + unsafe { transmute(__lasx_xvrotri_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvextl_q_d(a: v4i64) -> v4i64 { - unsafe { __lasx_xvextl_q_d(a) } +pub fn lasx_xvextl_q_d(a: m256i) -> m256i { + unsafe { transmute(__lasx_xvextl_q_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrlni_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrlni_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvsrlni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrlni_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrlni_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvsrlni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrlni_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrlni_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvsrlni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrlni_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvsrlni_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvsrlni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrlrni_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrlrni_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvsrlrni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrlrni_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrlrni_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvsrlrni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrlrni_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrlrni_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvsrlrni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrlrni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrlrni_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvsrlrni_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvsrlrni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrlni_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrlni_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrlni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrlni_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrlni_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrlni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrlni_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrlni_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrlni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrlni_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrlni_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrlni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrlni_bu_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrlni_bu_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrlni_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrlni_hu_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrlni_hu_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrlni_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrlni_wu_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrlni_wu_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrlni_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlni_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrlni_du_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrlni_du_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrlni_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrlrni_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrlrni_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrlrni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrlrni_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrlrni_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrlrni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrlrni_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrlrni_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrlrni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrlrni_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrlrni_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrlrni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrlrni_bu_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrlrni_bu_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrlrni_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrlrni_hu_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrlrni_hu_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrlrni_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrlrni_wu_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrlrni_wu_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrlrni_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrlrni_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrlrni_du_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrlrni_du_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrlrni_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrani_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrani_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrani_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvsrani_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrani_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrani_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrani_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvsrani_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrani_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrani_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrani_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvsrani_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrani_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrani_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvsrani_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvsrani_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvsrarni_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvsrarni_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvsrarni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvsrarni_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvsrarni_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvsrarni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvsrarni_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvsrarni_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvsrarni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvsrarni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvsrarni_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvsrarni_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvsrarni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrani_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrani_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrani_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrani_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrani_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrani_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrani_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrani_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrani_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrani_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrani_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrani_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrani_bu_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrani_bu_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrani_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrani_hu_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrani_hu_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrani_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrani_wu_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrani_wu_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrani_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrani_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrani_du_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrani_du_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrani_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_b_h(a: v32i8, b: v32i8) -> v32i8 { +pub fn lasx_xvssrarni_b_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrarni_b_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrarni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_h_w(a: v16i16, b: v16i16) -> v16i16 { +pub fn lasx_xvssrarni_h_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrarni_h_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrarni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_w_d(a: v8i32, b: v8i32) -> v8i32 { +pub fn lasx_xvssrarni_w_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrarni_w_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrarni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_d_q(a: v4i64, b: v4i64) -> v4i64 { +pub fn lasx_xvssrarni_d_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrarni_d_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrarni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_bu_h(a: v32u8, b: v32i8) -> v32u8 { +pub fn lasx_xvssrarni_bu_h(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lasx_xvssrarni_bu_h(a, b, IMM4) } + unsafe { transmute(__lasx_xvssrarni_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_hu_w(a: v16u16, b: v16i16) -> v16u16 { +pub fn lasx_xvssrarni_hu_w(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lasx_xvssrarni_hu_w(a, b, IMM5) } + unsafe { transmute(__lasx_xvssrarni_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_wu_d(a: v8u32, b: v8i32) -> v8u32 { +pub fn lasx_xvssrarni_wu_d(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lasx_xvssrarni_wu_d(a, b, IMM6) } + unsafe { transmute(__lasx_xvssrarni_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvssrarni_du_q(a: v4u64, b: v4i64) -> v4u64 { +pub fn lasx_xvssrarni_du_q(a: m256i, b: m256i) -> m256i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lasx_xvssrarni_du_q(a, b, IMM7) } + unsafe { transmute(__lasx_xvssrarni_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbnz_b(a: v32u8) -> i32 { - unsafe { __lasx_xbnz_b(a) } +pub fn lasx_xbnz_b(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbnz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbnz_d(a: v4u64) -> i32 { - unsafe { __lasx_xbnz_d(a) } +pub fn lasx_xbnz_d(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbnz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbnz_h(a: v16u16) -> i32 { - unsafe { __lasx_xbnz_h(a) } +pub fn lasx_xbnz_h(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbnz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbnz_v(a: v32u8) -> i32 { - unsafe { __lasx_xbnz_v(a) } +pub fn lasx_xbnz_v(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbnz_v(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbnz_w(a: v8u32) -> i32 { - unsafe { __lasx_xbnz_w(a) } +pub fn lasx_xbnz_w(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbnz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbz_b(a: v32u8) -> i32 { - unsafe { __lasx_xbz_b(a) } +pub fn lasx_xbz_b(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbz_d(a: v4u64) -> i32 { - unsafe { __lasx_xbz_d(a) } +pub fn lasx_xbz_d(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbz_h(a: v16u16) -> i32 { - unsafe { __lasx_xbz_h(a) } +pub fn lasx_xbz_h(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbz_v(a: v32u8) -> i32 { - unsafe { __lasx_xbz_v(a) } +pub fn lasx_xbz_v(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbz_v(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xbz_w(a: v8u32) -> i32 { - unsafe { __lasx_xbz_w(a) } +pub fn lasx_xbz_w(a: m256i) -> i32 { + unsafe { transmute(__lasx_xbz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_caf_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_caf_d(a, b) } +pub fn lasx_xvfcmp_caf_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_caf_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_caf_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_caf_s(a, b) } +pub fn lasx_xvfcmp_caf_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_caf_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_ceq_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_ceq_d(a, b) } +pub fn lasx_xvfcmp_ceq_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_ceq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_ceq_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_ceq_s(a, b) } +pub fn lasx_xvfcmp_ceq_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_ceq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cle_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cle_d(a, b) } +pub fn lasx_xvfcmp_cle_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cle_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cle_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cle_s(a, b) } +pub fn lasx_xvfcmp_cle_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cle_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_clt_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_clt_d(a, b) } +pub fn lasx_xvfcmp_clt_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_clt_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_clt_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_clt_s(a, b) } +pub fn lasx_xvfcmp_clt_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_clt_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cne_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cne_d(a, b) } +pub fn lasx_xvfcmp_cne_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cne_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cne_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cne_s(a, b) } +pub fn lasx_xvfcmp_cne_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cne_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cor_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cor_d(a, b) } +pub fn lasx_xvfcmp_cor_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cor_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cor_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cor_s(a, b) } +pub fn lasx_xvfcmp_cor_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cor_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cueq_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cueq_d(a, b) } +pub fn lasx_xvfcmp_cueq_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cueq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cueq_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cueq_s(a, b) } +pub fn lasx_xvfcmp_cueq_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cueq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cule_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cule_d(a, b) } +pub fn lasx_xvfcmp_cule_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cule_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cule_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cule_s(a, b) } +pub fn lasx_xvfcmp_cule_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cule_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cult_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cult_d(a, b) } +pub fn lasx_xvfcmp_cult_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cult_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cult_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cult_s(a, b) } +pub fn lasx_xvfcmp_cult_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cult_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cun_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cun_d(a, b) } +pub fn lasx_xvfcmp_cun_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cun_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cune_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_cune_d(a, b) } +pub fn lasx_xvfcmp_cune_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cune_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cune_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cune_s(a, b) } +pub fn lasx_xvfcmp_cune_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cune_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_cun_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_cun_s(a, b) } +pub fn lasx_xvfcmp_cun_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_cun_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_saf_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_saf_d(a, b) } +pub fn lasx_xvfcmp_saf_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_saf_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_saf_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_saf_s(a, b) } +pub fn lasx_xvfcmp_saf_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_saf_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_seq_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_seq_d(a, b) } +pub fn lasx_xvfcmp_seq_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_seq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_seq_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_seq_s(a, b) } +pub fn lasx_xvfcmp_seq_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_seq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sle_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sle_d(a, b) } +pub fn lasx_xvfcmp_sle_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sle_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sle_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sle_s(a, b) } +pub fn lasx_xvfcmp_sle_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sle_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_slt_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_slt_d(a, b) } +pub fn lasx_xvfcmp_slt_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_slt_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_slt_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_slt_s(a, b) } +pub fn lasx_xvfcmp_slt_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_slt_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sne_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sne_d(a, b) } +pub fn lasx_xvfcmp_sne_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sne_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sne_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sne_s(a, b) } +pub fn lasx_xvfcmp_sne_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sne_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sor_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sor_d(a, b) } +pub fn lasx_xvfcmp_sor_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sor_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sor_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sor_s(a, b) } +pub fn lasx_xvfcmp_sor_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sor_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sueq_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sueq_d(a, b) } +pub fn lasx_xvfcmp_sueq_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sueq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sueq_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sueq_s(a, b) } +pub fn lasx_xvfcmp_sueq_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sueq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sule_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sule_d(a, b) } +pub fn lasx_xvfcmp_sule_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sule_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sule_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sule_s(a, b) } +pub fn lasx_xvfcmp_sule_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sule_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sult_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sult_d(a, b) } +pub fn lasx_xvfcmp_sult_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sult_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sult_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sult_s(a, b) } +pub fn lasx_xvfcmp_sult_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sult_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sun_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sun_d(a, b) } +pub fn lasx_xvfcmp_sun_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sun_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sune_d(a: v4f64, b: v4f64) -> v4i64 { - unsafe { __lasx_xvfcmp_sune_d(a, b) } +pub fn lasx_xvfcmp_sune_d(a: m256d, b: m256d) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sune_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sune_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sune_s(a, b) } +pub fn lasx_xvfcmp_sune_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sune_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvfcmp_sun_s(a: v8f32, b: v8f32) -> v8i32 { - unsafe { __lasx_xvfcmp_sun_s(a, b) } +pub fn lasx_xvfcmp_sun_s(a: m256, b: m256) -> m256i { + unsafe { transmute(__lasx_xvfcmp_sun_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve_d_f(a: v4f64) -> v4f64 { +pub fn lasx_xvpickve_d_f(a: m256d) -> m256d { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lasx_xvpickve_d_f(a, IMM2) } + unsafe { transmute(__lasx_xvpickve_d_f(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvpickve_w_f(a: v8f32) -> v8f32 { +pub fn lasx_xvpickve_w_f(a: m256) -> m256 { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lasx_xvpickve_w_f(a, IMM3) } + unsafe { transmute(__lasx_xvpickve_w_f(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepli_b() -> v32i8 { +pub fn lasx_xvrepli_b() -> m256i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lasx_xvrepli_b(IMM_S10) } + unsafe { transmute(__lasx_xvrepli_b(IMM_S10)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepli_d() -> v4i64 { +pub fn lasx_xvrepli_d() -> m256i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lasx_xvrepli_d(IMM_S10) } + unsafe { transmute(__lasx_xvrepli_d(IMM_S10)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepli_h() -> v16i16 { +pub fn lasx_xvrepli_h() -> m256i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lasx_xvrepli_h(IMM_S10) } + unsafe { transmute(__lasx_xvrepli_h(IMM_S10)) } } #[inline] #[target_feature(enable = "lasx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lasx_xvrepli_w() -> v8i32 { +pub fn lasx_xvrepli_w() -> m256i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lasx_xvrepli_w(IMM_S10) } + unsafe { transmute(__lasx_xvrepli_w(IMM_S10)) } } diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lasx/types.rs b/library/stdarch/crates/core_arch/src/loongarch64/lasx/types.rs index 9611517e6370..a8ceede87390 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/types.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/types.rs @@ -1,33 +1,140 @@ types! { #![unstable(feature = "stdarch_loongarch", issue = "117427")] - /// LOONGARCH-specific 256-bit wide vector of 32 packed `i8`. - pub struct v32i8(32 x pub(crate) i8); + /// 256-bit wide integer vector type, LoongArch-specific + /// + /// This type is the same as the `__m256i` type defined in `lasxintrin.h`, + /// representing a 256-bit SIMD register. Usage of this type typically + /// occurs in conjunction with the `lasx` target features for LoongArch. + /// + /// Internally this type may be viewed as: + /// + /// * `i8x32` - thirty two `i8` values packed together + /// * `i16x16` - sixteen `i16` values packed together + /// * `i32x8` - eight `i32` values packed together + /// * `i64x4` - four `i64` values packed together + /// + /// (as well as unsigned versions). Each intrinsic may interpret the + /// internal bits differently, check the documentation of the intrinsic + /// to see how it's being used. + /// + /// The in-memory representation of this type is the same as the one of an + /// equivalent array (i.e. the in-memory order of elements is the same, and + /// there is no padding); however, the alignment is different and equal to + /// the size of the type. Note that the ABI for function calls may *not* be + /// the same. + /// + /// Note that this means that an instance of `m256i` typically just means + /// a "bag of bits" which is left up to interpretation at the point of use. + /// + /// Most intrinsics using `m256i` are prefixed with `lasx_` and the integer + /// types tend to correspond to suffixes like "b", "h", "w" or "d". + pub struct m256i(4 x i64); - /// LOONGARCH-specific 256-bit wide vector of 16 packed `i16`. - pub struct v16i16(16 x pub(crate) i16); + /// 256-bit wide set of eight `f32` values, LoongArch-specific + /// + /// This type is the same as the `__m256` type defined in `lasxintrin.h`, + /// representing a 256-bit SIMD register which internally consists of + /// eight packed `f32` instances. Usage of this type typically occurs in + /// conjunction with the `lasx` target features for LoongArch. + /// + /// Note that unlike `m256i`, the integer version of the 256-bit registers, + /// this `m256` type has *one* interpretation. Each instance of `m256` + /// always corresponds to `f32x8`, or eight `f32` values packed together. + /// + /// The in-memory representation of this type is the same as the one of an + /// equivalent array (i.e. the in-memory order of elements is the same, and + /// there is no padding between two consecutive elements); however, the + /// alignment is different and equal to the size of the type. Note that the + /// ABI for function calls may *not* be the same. + /// + /// Most intrinsics using `m256` are prefixed with `lasx_` and are + /// suffixed with "s". + pub struct m256(8 x f32); - /// LOONGARCH-specific 256-bit wide vector of 8 packed `i32`. - pub struct v8i32(8 x pub(crate) i32); + /// 256-bit wide set of four `f64` values, LoongArch-specific + /// + /// This type is the same as the `__m256d` type defined in `lasxintrin.h`, + /// representing a 256-bit SIMD register which internally consists of + /// four packed `f64` instances. Usage of this type typically occurs in + /// conjunction with the `lasx` target features for LoongArch. + /// + /// Note that unlike `m256i`, the integer version of the 256-bit registers, + /// this `m256d` type has *one* interpretation. Each instance of `m256d` + /// always corresponds to `f64x4`, or four `f64` values packed together. + /// + /// The in-memory representation of this type is the same as the one of an + /// equivalent array (i.e. the in-memory order of elements is the same, and + /// there is no padding); however, the alignment is different and equal to + /// the size of the type. Note that the ABI for function calls may *not* be + /// the same. + /// + /// Most intrinsics using `m256d` are prefixed with `lasx_` and are suffixed + /// with "d". Not to be confused with "d" which is used for `m256i`. + pub struct m256d(4 x f64); - /// LOONGARCH-specific 256-bit wide vector of 4 packed `i64`. - pub struct v4i64(4 x pub(crate) i64); - - /// LOONGARCH-specific 256-bit wide vector of 32 packed `u8`. - pub struct v32u8(32 x pub(crate) u8); - - /// LOONGARCH-specific 256-bit wide vector of 16 packed `u16`. - pub struct v16u16(16 x pub(crate) u16); - - /// LOONGARCH-specific 256-bit wide vector of 8 packed `u32`. - pub struct v8u32(8 x pub(crate) u32); - - /// LOONGARCH-specific 256-bit wide vector of 4 packed `u64`. - pub struct v4u64(4 x pub(crate) u64); - - /// LOONGARCH-specific 128-bit wide vector of 8 packed `f32`. - pub struct v8f32(8 x pub(crate) f32); - - /// LOONGARCH-specific 256-bit wide vector of 4 packed `f64`. - pub struct v4f64(4 x pub(crate) f64); } + +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v32i8([i8; 32]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v16i16([i16; 16]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v8i32([i32; 8]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v4i64([i64; 4]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v32u8([u8; 32]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v16u16([u16; 16]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v8u32([u32; 8]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v4u64([u64; 4]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v8f32([f32; 8]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v4f64([f64; 4]); + +// These type aliases are provided solely for transitional compatibility. +// They are temporary and will be removed when appropriate. +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v32i8 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v16i16 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v8i32 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v4i64 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v32u8 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v16u16 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v8u32 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v4u64 = m256i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v8f32 = m256; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v4f64 = m256d; diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs index ba821a3e3dc6..764e69ca0544 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs @@ -6,6874 +6,6875 @@ // OUT_DIR=`pwd`/crates/core_arch cargo run -p stdarch-gen-loongarch -- crates/stdarch-gen-loongarch/lsx.spec // ``` +use crate::mem::transmute; use super::types::*; #[allow(improper_ctypes)] unsafe extern "unadjusted" { #[link_name = "llvm.loongarch.lsx.vsll.b"] - fn __lsx_vsll_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsll_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsll.h"] - fn __lsx_vsll_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsll_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsll.w"] - fn __lsx_vsll_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsll_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsll.d"] - fn __lsx_vsll_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsll_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslli.b"] - fn __lsx_vslli_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vslli_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslli.h"] - fn __lsx_vslli_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vslli_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslli.w"] - fn __lsx_vslli_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vslli_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslli.d"] - fn __lsx_vslli_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vslli_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsra.b"] - fn __lsx_vsra_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsra_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsra.h"] - fn __lsx_vsra_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsra_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsra.w"] - fn __lsx_vsra_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsra_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsra.d"] - fn __lsx_vsra_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsra_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrai.b"] - fn __lsx_vsrai_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vsrai_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrai.h"] - fn __lsx_vsrai_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vsrai_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrai.w"] - fn __lsx_vsrai_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vsrai_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrai.d"] - fn __lsx_vsrai_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vsrai_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrar.b"] - fn __lsx_vsrar_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsrar_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrar.h"] - fn __lsx_vsrar_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsrar_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrar.w"] - fn __lsx_vsrar_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsrar_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrar.d"] - fn __lsx_vsrar_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsrar_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrari.b"] - fn __lsx_vsrari_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vsrari_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrari.h"] - fn __lsx_vsrari_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vsrari_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrari.w"] - fn __lsx_vsrari_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vsrari_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrari.d"] - fn __lsx_vsrari_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vsrari_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrl.b"] - fn __lsx_vsrl_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsrl_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrl.h"] - fn __lsx_vsrl_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsrl_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrl.w"] - fn __lsx_vsrl_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsrl_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrl.d"] - fn __lsx_vsrl_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsrl_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrli.b"] - fn __lsx_vsrli_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vsrli_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrli.h"] - fn __lsx_vsrli_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vsrli_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrli.w"] - fn __lsx_vsrli_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vsrli_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrli.d"] - fn __lsx_vsrli_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vsrli_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrlr.b"] - fn __lsx_vsrlr_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsrlr_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrlr.h"] - fn __lsx_vsrlr_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsrlr_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrlr.w"] - fn __lsx_vsrlr_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsrlr_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrlr.d"] - fn __lsx_vsrlr_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsrlr_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrlri.b"] - fn __lsx_vsrlri_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vsrlri_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrlri.h"] - fn __lsx_vsrlri_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vsrlri_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrlri.w"] - fn __lsx_vsrlri_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vsrlri_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrlri.d"] - fn __lsx_vsrlri_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vsrlri_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vbitclr.b"] - fn __lsx_vbitclr_b(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vbitclr_b(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitclr.h"] - fn __lsx_vbitclr_h(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vbitclr_h(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vbitclr.w"] - fn __lsx_vbitclr_w(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vbitclr_w(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vbitclr.d"] - fn __lsx_vbitclr_d(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vbitclr_d(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vbitclri.b"] - fn __lsx_vbitclri_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vbitclri_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitclri.h"] - fn __lsx_vbitclri_h(a: v8u16, b: u32) -> v8u16; + fn __lsx_vbitclri_h(a: __v8u16, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vbitclri.w"] - fn __lsx_vbitclri_w(a: v4u32, b: u32) -> v4u32; + fn __lsx_vbitclri_w(a: __v4u32, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vbitclri.d"] - fn __lsx_vbitclri_d(a: v2u64, b: u32) -> v2u64; + fn __lsx_vbitclri_d(a: __v2u64, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vbitset.b"] - fn __lsx_vbitset_b(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vbitset_b(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitset.h"] - fn __lsx_vbitset_h(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vbitset_h(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vbitset.w"] - fn __lsx_vbitset_w(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vbitset_w(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vbitset.d"] - fn __lsx_vbitset_d(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vbitset_d(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vbitseti.b"] - fn __lsx_vbitseti_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vbitseti_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitseti.h"] - fn __lsx_vbitseti_h(a: v8u16, b: u32) -> v8u16; + fn __lsx_vbitseti_h(a: __v8u16, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vbitseti.w"] - fn __lsx_vbitseti_w(a: v4u32, b: u32) -> v4u32; + fn __lsx_vbitseti_w(a: __v4u32, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vbitseti.d"] - fn __lsx_vbitseti_d(a: v2u64, b: u32) -> v2u64; + fn __lsx_vbitseti_d(a: __v2u64, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vbitrev.b"] - fn __lsx_vbitrev_b(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vbitrev_b(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitrev.h"] - fn __lsx_vbitrev_h(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vbitrev_h(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vbitrev.w"] - fn __lsx_vbitrev_w(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vbitrev_w(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vbitrev.d"] - fn __lsx_vbitrev_d(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vbitrev_d(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vbitrevi.b"] - fn __lsx_vbitrevi_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vbitrevi_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitrevi.h"] - fn __lsx_vbitrevi_h(a: v8u16, b: u32) -> v8u16; + fn __lsx_vbitrevi_h(a: __v8u16, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vbitrevi.w"] - fn __lsx_vbitrevi_w(a: v4u32, b: u32) -> v4u32; + fn __lsx_vbitrevi_w(a: __v4u32, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vbitrevi.d"] - fn __lsx_vbitrevi_d(a: v2u64, b: u32) -> v2u64; + fn __lsx_vbitrevi_d(a: __v2u64, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vadd.b"] - fn __lsx_vadd_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vadd_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vadd.h"] - fn __lsx_vadd_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vadd_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vadd.w"] - fn __lsx_vadd_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vadd_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vadd.d"] - fn __lsx_vadd_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vadd_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddi.bu"] - fn __lsx_vaddi_bu(a: v16i8, b: u32) -> v16i8; + fn __lsx_vaddi_bu(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vaddi.hu"] - fn __lsx_vaddi_hu(a: v8i16, b: u32) -> v8i16; + fn __lsx_vaddi_hu(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddi.wu"] - fn __lsx_vaddi_wu(a: v4i32, b: u32) -> v4i32; + fn __lsx_vaddi_wu(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddi.du"] - fn __lsx_vaddi_du(a: v2i64, b: u32) -> v2i64; + fn __lsx_vaddi_du(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsub.b"] - fn __lsx_vsub_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsub_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsub.h"] - fn __lsx_vsub_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsub_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsub.w"] - fn __lsx_vsub_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsub_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsub.d"] - fn __lsx_vsub_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsub_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubi.bu"] - fn __lsx_vsubi_bu(a: v16i8, b: u32) -> v16i8; + fn __lsx_vsubi_bu(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsubi.hu"] - fn __lsx_vsubi_hu(a: v8i16, b: u32) -> v8i16; + fn __lsx_vsubi_hu(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsubi.wu"] - fn __lsx_vsubi_wu(a: v4i32, b: u32) -> v4i32; + fn __lsx_vsubi_wu(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsubi.du"] - fn __lsx_vsubi_du(a: v2i64, b: u32) -> v2i64; + fn __lsx_vsubi_du(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmax.b"] - fn __lsx_vmax_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vmax_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmax.h"] - fn __lsx_vmax_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vmax_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmax.w"] - fn __lsx_vmax_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vmax_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmax.d"] - fn __lsx_vmax_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmax_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaxi.b"] - fn __lsx_vmaxi_b(a: v16i8, b: i32) -> v16i8; + fn __lsx_vmaxi_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmaxi.h"] - fn __lsx_vmaxi_h(a: v8i16, b: i32) -> v8i16; + fn __lsx_vmaxi_h(a: __v8i16, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmaxi.w"] - fn __lsx_vmaxi_w(a: v4i32, b: i32) -> v4i32; + fn __lsx_vmaxi_w(a: __v4i32, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmaxi.d"] - fn __lsx_vmaxi_d(a: v2i64, b: i32) -> v2i64; + fn __lsx_vmaxi_d(a: __v2i64, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmax.bu"] - fn __lsx_vmax_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vmax_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vmax.hu"] - fn __lsx_vmax_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vmax_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmax.wu"] - fn __lsx_vmax_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vmax_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmax.du"] - fn __lsx_vmax_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vmax_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmaxi.bu"] - fn __lsx_vmaxi_bu(a: v16u8, b: u32) -> v16u8; + fn __lsx_vmaxi_bu(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vmaxi.hu"] - fn __lsx_vmaxi_hu(a: v8u16, b: u32) -> v8u16; + fn __lsx_vmaxi_hu(a: __v8u16, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmaxi.wu"] - fn __lsx_vmaxi_wu(a: v4u32, b: u32) -> v4u32; + fn __lsx_vmaxi_wu(a: __v4u32, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmaxi.du"] - fn __lsx_vmaxi_du(a: v2u64, b: u32) -> v2u64; + fn __lsx_vmaxi_du(a: __v2u64, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmin.b"] - fn __lsx_vmin_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vmin_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmin.h"] - fn __lsx_vmin_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vmin_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmin.w"] - fn __lsx_vmin_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vmin_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmin.d"] - fn __lsx_vmin_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmin_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmini.b"] - fn __lsx_vmini_b(a: v16i8, b: i32) -> v16i8; + fn __lsx_vmini_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmini.h"] - fn __lsx_vmini_h(a: v8i16, b: i32) -> v8i16; + fn __lsx_vmini_h(a: __v8i16, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmini.w"] - fn __lsx_vmini_w(a: v4i32, b: i32) -> v4i32; + fn __lsx_vmini_w(a: __v4i32, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmini.d"] - fn __lsx_vmini_d(a: v2i64, b: i32) -> v2i64; + fn __lsx_vmini_d(a: __v2i64, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmin.bu"] - fn __lsx_vmin_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vmin_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vmin.hu"] - fn __lsx_vmin_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vmin_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmin.wu"] - fn __lsx_vmin_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vmin_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmin.du"] - fn __lsx_vmin_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vmin_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmini.bu"] - fn __lsx_vmini_bu(a: v16u8, b: u32) -> v16u8; + fn __lsx_vmini_bu(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vmini.hu"] - fn __lsx_vmini_hu(a: v8u16, b: u32) -> v8u16; + fn __lsx_vmini_hu(a: __v8u16, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmini.wu"] - fn __lsx_vmini_wu(a: v4u32, b: u32) -> v4u32; + fn __lsx_vmini_wu(a: __v4u32, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmini.du"] - fn __lsx_vmini_du(a: v2u64, b: u32) -> v2u64; + fn __lsx_vmini_du(a: __v2u64, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vseq.b"] - fn __lsx_vseq_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vseq_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vseq.h"] - fn __lsx_vseq_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vseq_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vseq.w"] - fn __lsx_vseq_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vseq_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vseq.d"] - fn __lsx_vseq_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vseq_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vseqi.b"] - fn __lsx_vseqi_b(a: v16i8, b: i32) -> v16i8; + fn __lsx_vseqi_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vseqi.h"] - fn __lsx_vseqi_h(a: v8i16, b: i32) -> v8i16; + fn __lsx_vseqi_h(a: __v8i16, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vseqi.w"] - fn __lsx_vseqi_w(a: v4i32, b: i32) -> v4i32; + fn __lsx_vseqi_w(a: __v4i32, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vseqi.d"] - fn __lsx_vseqi_d(a: v2i64, b: i32) -> v2i64; + fn __lsx_vseqi_d(a: __v2i64, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslti.b"] - fn __lsx_vslti_b(a: v16i8, b: i32) -> v16i8; + fn __lsx_vslti_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslt.b"] - fn __lsx_vslt_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vslt_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslt.h"] - fn __lsx_vslt_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vslt_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslt.w"] - fn __lsx_vslt_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vslt_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslt.d"] - fn __lsx_vslt_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vslt_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslti.h"] - fn __lsx_vslti_h(a: v8i16, b: i32) -> v8i16; + fn __lsx_vslti_h(a: __v8i16, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslti.w"] - fn __lsx_vslti_w(a: v4i32, b: i32) -> v4i32; + fn __lsx_vslti_w(a: __v4i32, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslti.d"] - fn __lsx_vslti_d(a: v2i64, b: i32) -> v2i64; + fn __lsx_vslti_d(a: __v2i64, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslt.bu"] - fn __lsx_vslt_bu(a: v16u8, b: v16u8) -> v16i8; + fn __lsx_vslt_bu(a: __v16u8, b: __v16u8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslt.hu"] - fn __lsx_vslt_hu(a: v8u16, b: v8u16) -> v8i16; + fn __lsx_vslt_hu(a: __v8u16, b: __v8u16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslt.wu"] - fn __lsx_vslt_wu(a: v4u32, b: v4u32) -> v4i32; + fn __lsx_vslt_wu(a: __v4u32, b: __v4u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslt.du"] - fn __lsx_vslt_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vslt_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslti.bu"] - fn __lsx_vslti_bu(a: v16u8, b: u32) -> v16i8; + fn __lsx_vslti_bu(a: __v16u8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslti.hu"] - fn __lsx_vslti_hu(a: v8u16, b: u32) -> v8i16; + fn __lsx_vslti_hu(a: __v8u16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslti.wu"] - fn __lsx_vslti_wu(a: v4u32, b: u32) -> v4i32; + fn __lsx_vslti_wu(a: __v4u32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslti.du"] - fn __lsx_vslti_du(a: v2u64, b: u32) -> v2i64; + fn __lsx_vslti_du(a: __v2u64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsle.b"] - fn __lsx_vsle_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsle_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsle.h"] - fn __lsx_vsle_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsle_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsle.w"] - fn __lsx_vsle_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsle_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsle.d"] - fn __lsx_vsle_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsle_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslei.b"] - fn __lsx_vslei_b(a: v16i8, b: i32) -> v16i8; + fn __lsx_vslei_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslei.h"] - fn __lsx_vslei_h(a: v8i16, b: i32) -> v8i16; + fn __lsx_vslei_h(a: __v8i16, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslei.w"] - fn __lsx_vslei_w(a: v4i32, b: i32) -> v4i32; + fn __lsx_vslei_w(a: __v4i32, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslei.d"] - fn __lsx_vslei_d(a: v2i64, b: i32) -> v2i64; + fn __lsx_vslei_d(a: __v2i64, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsle.bu"] - fn __lsx_vsle_bu(a: v16u8, b: v16u8) -> v16i8; + fn __lsx_vsle_bu(a: __v16u8, b: __v16u8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsle.hu"] - fn __lsx_vsle_hu(a: v8u16, b: v8u16) -> v8i16; + fn __lsx_vsle_hu(a: __v8u16, b: __v8u16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsle.wu"] - fn __lsx_vsle_wu(a: v4u32, b: v4u32) -> v4i32; + fn __lsx_vsle_wu(a: __v4u32, b: __v4u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsle.du"] - fn __lsx_vsle_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vsle_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vslei.bu"] - fn __lsx_vslei_bu(a: v16u8, b: u32) -> v16i8; + fn __lsx_vslei_bu(a: __v16u8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vslei.hu"] - fn __lsx_vslei_hu(a: v8u16, b: u32) -> v8i16; + fn __lsx_vslei_hu(a: __v8u16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vslei.wu"] - fn __lsx_vslei_wu(a: v4u32, b: u32) -> v4i32; + fn __lsx_vslei_wu(a: __v4u32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vslei.du"] - fn __lsx_vslei_du(a: v2u64, b: u32) -> v2i64; + fn __lsx_vslei_du(a: __v2u64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsat.b"] - fn __lsx_vsat_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vsat_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsat.h"] - fn __lsx_vsat_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vsat_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsat.w"] - fn __lsx_vsat_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vsat_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsat.d"] - fn __lsx_vsat_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vsat_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsat.bu"] - fn __lsx_vsat_bu(a: v16u8, b: u32) -> v16u8; + fn __lsx_vsat_bu(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vsat.hu"] - fn __lsx_vsat_hu(a: v8u16, b: u32) -> v8u16; + fn __lsx_vsat_hu(a: __v8u16, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vsat.wu"] - fn __lsx_vsat_wu(a: v4u32, b: u32) -> v4u32; + fn __lsx_vsat_wu(a: __v4u32, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vsat.du"] - fn __lsx_vsat_du(a: v2u64, b: u32) -> v2u64; + fn __lsx_vsat_du(a: __v2u64, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vadda.b"] - fn __lsx_vadda_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vadda_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vadda.h"] - fn __lsx_vadda_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vadda_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vadda.w"] - fn __lsx_vadda_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vadda_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vadda.d"] - fn __lsx_vadda_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vadda_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsadd.b"] - fn __lsx_vsadd_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsadd_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsadd.h"] - fn __lsx_vsadd_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsadd_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsadd.w"] - fn __lsx_vsadd_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsadd_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsadd.d"] - fn __lsx_vsadd_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsadd_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsadd.bu"] - fn __lsx_vsadd_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vsadd_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vsadd.hu"] - fn __lsx_vsadd_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vsadd_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vsadd.wu"] - fn __lsx_vsadd_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vsadd_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vsadd.du"] - fn __lsx_vsadd_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vsadd_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vavg.b"] - fn __lsx_vavg_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vavg_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vavg.h"] - fn __lsx_vavg_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vavg_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vavg.w"] - fn __lsx_vavg_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vavg_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vavg.d"] - fn __lsx_vavg_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vavg_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vavg.bu"] - fn __lsx_vavg_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vavg_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vavg.hu"] - fn __lsx_vavg_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vavg_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vavg.wu"] - fn __lsx_vavg_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vavg_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vavg.du"] - fn __lsx_vavg_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vavg_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vavgr.b"] - fn __lsx_vavgr_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vavgr_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vavgr.h"] - fn __lsx_vavgr_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vavgr_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vavgr.w"] - fn __lsx_vavgr_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vavgr_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vavgr.d"] - fn __lsx_vavgr_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vavgr_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vavgr.bu"] - fn __lsx_vavgr_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vavgr_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vavgr.hu"] - fn __lsx_vavgr_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vavgr_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vavgr.wu"] - fn __lsx_vavgr_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vavgr_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vavgr.du"] - fn __lsx_vavgr_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vavgr_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vssub.b"] - fn __lsx_vssub_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vssub_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssub.h"] - fn __lsx_vssub_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vssub_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssub.w"] - fn __lsx_vssub_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vssub_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssub.d"] - fn __lsx_vssub_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vssub_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssub.bu"] - fn __lsx_vssub_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vssub_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssub.hu"] - fn __lsx_vssub_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vssub_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssub.wu"] - fn __lsx_vssub_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vssub_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vssub.du"] - fn __lsx_vssub_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vssub_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vabsd.b"] - fn __lsx_vabsd_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vabsd_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vabsd.h"] - fn __lsx_vabsd_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vabsd_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vabsd.w"] - fn __lsx_vabsd_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vabsd_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vabsd.d"] - fn __lsx_vabsd_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vabsd_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vabsd.bu"] - fn __lsx_vabsd_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vabsd_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vabsd.hu"] - fn __lsx_vabsd_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vabsd_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vabsd.wu"] - fn __lsx_vabsd_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vabsd_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vabsd.du"] - fn __lsx_vabsd_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vabsd_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmul.b"] - fn __lsx_vmul_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vmul_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmul.h"] - fn __lsx_vmul_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vmul_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmul.w"] - fn __lsx_vmul_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vmul_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmul.d"] - fn __lsx_vmul_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmul_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmadd.b"] - fn __lsx_vmadd_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8; + fn __lsx_vmadd_b(a: __v16i8, b: __v16i8, c: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmadd.h"] - fn __lsx_vmadd_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16; + fn __lsx_vmadd_h(a: __v8i16, b: __v8i16, c: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmadd.w"] - fn __lsx_vmadd_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32; + fn __lsx_vmadd_w(a: __v4i32, b: __v4i32, c: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmadd.d"] - fn __lsx_vmadd_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64; + fn __lsx_vmadd_d(a: __v2i64, b: __v2i64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmsub.b"] - fn __lsx_vmsub_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8; + fn __lsx_vmsub_b(a: __v16i8, b: __v16i8, c: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmsub.h"] - fn __lsx_vmsub_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16; + fn __lsx_vmsub_h(a: __v8i16, b: __v8i16, c: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmsub.w"] - fn __lsx_vmsub_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32; + fn __lsx_vmsub_w(a: __v4i32, b: __v4i32, c: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmsub.d"] - fn __lsx_vmsub_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64; + fn __lsx_vmsub_d(a: __v2i64, b: __v2i64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vdiv.b"] - fn __lsx_vdiv_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vdiv_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vdiv.h"] - fn __lsx_vdiv_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vdiv_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vdiv.w"] - fn __lsx_vdiv_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vdiv_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vdiv.d"] - fn __lsx_vdiv_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vdiv_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vdiv.bu"] - fn __lsx_vdiv_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vdiv_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vdiv.hu"] - fn __lsx_vdiv_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vdiv_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vdiv.wu"] - fn __lsx_vdiv_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vdiv_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vdiv.du"] - fn __lsx_vdiv_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vdiv_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vhaddw.h.b"] - fn __lsx_vhaddw_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vhaddw_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vhaddw.w.h"] - fn __lsx_vhaddw_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vhaddw_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vhaddw.d.w"] - fn __lsx_vhaddw_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vhaddw_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vhaddw.hu.bu"] - fn __lsx_vhaddw_hu_bu(a: v16u8, b: v16u8) -> v8u16; + fn __lsx_vhaddw_hu_bu(a: __v16u8, b: __v16u8) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vhaddw.wu.hu"] - fn __lsx_vhaddw_wu_hu(a: v8u16, b: v8u16) -> v4u32; + fn __lsx_vhaddw_wu_hu(a: __v8u16, b: __v8u16) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vhaddw.du.wu"] - fn __lsx_vhaddw_du_wu(a: v4u32, b: v4u32) -> v2u64; + fn __lsx_vhaddw_du_wu(a: __v4u32, b: __v4u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vhsubw.h.b"] - fn __lsx_vhsubw_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vhsubw_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vhsubw.w.h"] - fn __lsx_vhsubw_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vhsubw_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vhsubw.d.w"] - fn __lsx_vhsubw_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vhsubw_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vhsubw.hu.bu"] - fn __lsx_vhsubw_hu_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vhsubw_hu_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vhsubw.wu.hu"] - fn __lsx_vhsubw_wu_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vhsubw_wu_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vhsubw.du.wu"] - fn __lsx_vhsubw_du_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vhsubw_du_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmod.b"] - fn __lsx_vmod_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vmod_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmod.h"] - fn __lsx_vmod_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vmod_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmod.w"] - fn __lsx_vmod_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vmod_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmod.d"] - fn __lsx_vmod_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmod_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmod.bu"] - fn __lsx_vmod_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vmod_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vmod.hu"] - fn __lsx_vmod_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vmod_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmod.wu"] - fn __lsx_vmod_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vmod_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmod.du"] - fn __lsx_vmod_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vmod_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vreplve.b"] - fn __lsx_vreplve_b(a: v16i8, b: i32) -> v16i8; + fn __lsx_vreplve_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vreplve.h"] - fn __lsx_vreplve_h(a: v8i16, b: i32) -> v8i16; + fn __lsx_vreplve_h(a: __v8i16, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vreplve.w"] - fn __lsx_vreplve_w(a: v4i32, b: i32) -> v4i32; + fn __lsx_vreplve_w(a: __v4i32, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vreplve.d"] - fn __lsx_vreplve_d(a: v2i64, b: i32) -> v2i64; + fn __lsx_vreplve_d(a: __v2i64, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vreplvei.b"] - fn __lsx_vreplvei_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vreplvei_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vreplvei.h"] - fn __lsx_vreplvei_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vreplvei_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vreplvei.w"] - fn __lsx_vreplvei_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vreplvei_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vreplvei.d"] - fn __lsx_vreplvei_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vreplvei_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vpickev.b"] - fn __lsx_vpickev_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vpickev_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vpickev.h"] - fn __lsx_vpickev_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vpickev_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vpickev.w"] - fn __lsx_vpickev_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vpickev_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vpickev.d"] - fn __lsx_vpickev_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vpickev_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vpickod.b"] - fn __lsx_vpickod_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vpickod_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vpickod.h"] - fn __lsx_vpickod_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vpickod_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vpickod.w"] - fn __lsx_vpickod_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vpickod_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vpickod.d"] - fn __lsx_vpickod_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vpickod_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vilvh.b"] - fn __lsx_vilvh_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vilvh_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vilvh.h"] - fn __lsx_vilvh_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vilvh_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vilvh.w"] - fn __lsx_vilvh_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vilvh_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vilvh.d"] - fn __lsx_vilvh_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vilvh_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vilvl.b"] - fn __lsx_vilvl_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vilvl_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vilvl.h"] - fn __lsx_vilvl_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vilvl_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vilvl.w"] - fn __lsx_vilvl_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vilvl_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vilvl.d"] - fn __lsx_vilvl_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vilvl_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vpackev.b"] - fn __lsx_vpackev_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vpackev_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vpackev.h"] - fn __lsx_vpackev_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vpackev_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vpackev.w"] - fn __lsx_vpackev_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vpackev_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vpackev.d"] - fn __lsx_vpackev_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vpackev_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vpackod.b"] - fn __lsx_vpackod_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vpackod_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vpackod.h"] - fn __lsx_vpackod_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vpackod_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vpackod.w"] - fn __lsx_vpackod_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vpackod_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vpackod.d"] - fn __lsx_vpackod_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vpackod_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vshuf.h"] - fn __lsx_vshuf_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16; + fn __lsx_vshuf_h(a: __v8i16, b: __v8i16, c: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vshuf.w"] - fn __lsx_vshuf_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32; + fn __lsx_vshuf_w(a: __v4i32, b: __v4i32, c: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vshuf.d"] - fn __lsx_vshuf_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64; + fn __lsx_vshuf_d(a: __v2i64, b: __v2i64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vand.v"] - fn __lsx_vand_v(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vand_v(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vandi.b"] - fn __lsx_vandi_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vandi_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vor.v"] - fn __lsx_vor_v(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vor_v(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vori.b"] - fn __lsx_vori_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vori_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vnor.v"] - fn __lsx_vnor_v(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vnor_v(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vnori.b"] - fn __lsx_vnori_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vnori_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vxor.v"] - fn __lsx_vxor_v(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vxor_v(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vxori.b"] - fn __lsx_vxori_b(a: v16u8, b: u32) -> v16u8; + fn __lsx_vxori_b(a: __v16u8, b: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitsel.v"] - fn __lsx_vbitsel_v(a: v16u8, b: v16u8, c: v16u8) -> v16u8; + fn __lsx_vbitsel_v(a: __v16u8, b: __v16u8, c: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vbitseli.b"] - fn __lsx_vbitseli_b(a: v16u8, b: v16u8, c: u32) -> v16u8; + fn __lsx_vbitseli_b(a: __v16u8, b: __v16u8, c: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vshuf4i.b"] - fn __lsx_vshuf4i_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vshuf4i_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vshuf4i.h"] - fn __lsx_vshuf4i_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vshuf4i_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vshuf4i.w"] - fn __lsx_vshuf4i_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vshuf4i_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vreplgr2vr.b"] - fn __lsx_vreplgr2vr_b(a: i32) -> v16i8; + fn __lsx_vreplgr2vr_b(a: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vreplgr2vr.h"] - fn __lsx_vreplgr2vr_h(a: i32) -> v8i16; + fn __lsx_vreplgr2vr_h(a: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vreplgr2vr.w"] - fn __lsx_vreplgr2vr_w(a: i32) -> v4i32; + fn __lsx_vreplgr2vr_w(a: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vreplgr2vr.d"] - fn __lsx_vreplgr2vr_d(a: i64) -> v2i64; + fn __lsx_vreplgr2vr_d(a: i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vpcnt.b"] - fn __lsx_vpcnt_b(a: v16i8) -> v16i8; + fn __lsx_vpcnt_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vpcnt.h"] - fn __lsx_vpcnt_h(a: v8i16) -> v8i16; + fn __lsx_vpcnt_h(a: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vpcnt.w"] - fn __lsx_vpcnt_w(a: v4i32) -> v4i32; + fn __lsx_vpcnt_w(a: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vpcnt.d"] - fn __lsx_vpcnt_d(a: v2i64) -> v2i64; + fn __lsx_vpcnt_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vclo.b"] - fn __lsx_vclo_b(a: v16i8) -> v16i8; + fn __lsx_vclo_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vclo.h"] - fn __lsx_vclo_h(a: v8i16) -> v8i16; + fn __lsx_vclo_h(a: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vclo.w"] - fn __lsx_vclo_w(a: v4i32) -> v4i32; + fn __lsx_vclo_w(a: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vclo.d"] - fn __lsx_vclo_d(a: v2i64) -> v2i64; + fn __lsx_vclo_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vclz.b"] - fn __lsx_vclz_b(a: v16i8) -> v16i8; + fn __lsx_vclz_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vclz.h"] - fn __lsx_vclz_h(a: v8i16) -> v8i16; + fn __lsx_vclz_h(a: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vclz.w"] - fn __lsx_vclz_w(a: v4i32) -> v4i32; + fn __lsx_vclz_w(a: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vclz.d"] - fn __lsx_vclz_d(a: v2i64) -> v2i64; + fn __lsx_vclz_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vpickve2gr.b"] - fn __lsx_vpickve2gr_b(a: v16i8, b: u32) -> i32; + fn __lsx_vpickve2gr_b(a: __v16i8, b: u32) -> i32; #[link_name = "llvm.loongarch.lsx.vpickve2gr.h"] - fn __lsx_vpickve2gr_h(a: v8i16, b: u32) -> i32; + fn __lsx_vpickve2gr_h(a: __v8i16, b: u32) -> i32; #[link_name = "llvm.loongarch.lsx.vpickve2gr.w"] - fn __lsx_vpickve2gr_w(a: v4i32, b: u32) -> i32; + fn __lsx_vpickve2gr_w(a: __v4i32, b: u32) -> i32; #[link_name = "llvm.loongarch.lsx.vpickve2gr.d"] - fn __lsx_vpickve2gr_d(a: v2i64, b: u32) -> i64; + fn __lsx_vpickve2gr_d(a: __v2i64, b: u32) -> i64; #[link_name = "llvm.loongarch.lsx.vpickve2gr.bu"] - fn __lsx_vpickve2gr_bu(a: v16i8, b: u32) -> u32; + fn __lsx_vpickve2gr_bu(a: __v16i8, b: u32) -> u32; #[link_name = "llvm.loongarch.lsx.vpickve2gr.hu"] - fn __lsx_vpickve2gr_hu(a: v8i16, b: u32) -> u32; + fn __lsx_vpickve2gr_hu(a: __v8i16, b: u32) -> u32; #[link_name = "llvm.loongarch.lsx.vpickve2gr.wu"] - fn __lsx_vpickve2gr_wu(a: v4i32, b: u32) -> u32; + fn __lsx_vpickve2gr_wu(a: __v4i32, b: u32) -> u32; #[link_name = "llvm.loongarch.lsx.vpickve2gr.du"] - fn __lsx_vpickve2gr_du(a: v2i64, b: u32) -> u64; + fn __lsx_vpickve2gr_du(a: __v2i64, b: u32) -> u64; #[link_name = "llvm.loongarch.lsx.vinsgr2vr.b"] - fn __lsx_vinsgr2vr_b(a: v16i8, b: i32, c: u32) -> v16i8; + fn __lsx_vinsgr2vr_b(a: __v16i8, b: i32, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vinsgr2vr.h"] - fn __lsx_vinsgr2vr_h(a: v8i16, b: i32, c: u32) -> v8i16; + fn __lsx_vinsgr2vr_h(a: __v8i16, b: i32, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vinsgr2vr.w"] - fn __lsx_vinsgr2vr_w(a: v4i32, b: i32, c: u32) -> v4i32; + fn __lsx_vinsgr2vr_w(a: __v4i32, b: i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vinsgr2vr.d"] - fn __lsx_vinsgr2vr_d(a: v2i64, b: i64, c: u32) -> v2i64; + fn __lsx_vinsgr2vr_d(a: __v2i64, b: i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfadd.s"] - fn __lsx_vfadd_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfadd_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfadd.d"] - fn __lsx_vfadd_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfadd_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfsub.s"] - fn __lsx_vfsub_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfsub_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfsub.d"] - fn __lsx_vfsub_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfsub_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfmul.s"] - fn __lsx_vfmul_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfmul_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmul.d"] - fn __lsx_vfmul_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfmul_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfdiv.s"] - fn __lsx_vfdiv_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfdiv_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfdiv.d"] - fn __lsx_vfdiv_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfdiv_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfcvt.h.s"] - fn __lsx_vfcvt_h_s(a: v4f32, b: v4f32) -> v8i16; + fn __lsx_vfcvt_h_s(a: __v4f32, b: __v4f32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vfcvt.s.d"] - fn __lsx_vfcvt_s_d(a: v2f64, b: v2f64) -> v4f32; + fn __lsx_vfcvt_s_d(a: __v2f64, b: __v2f64) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmin.s"] - fn __lsx_vfmin_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfmin_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmin.d"] - fn __lsx_vfmin_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfmin_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfmina.s"] - fn __lsx_vfmina_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfmina_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmina.d"] - fn __lsx_vfmina_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfmina_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfmax.s"] - fn __lsx_vfmax_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfmax_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmax.d"] - fn __lsx_vfmax_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfmax_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfmaxa.s"] - fn __lsx_vfmaxa_s(a: v4f32, b: v4f32) -> v4f32; + fn __lsx_vfmaxa_s(a: __v4f32, b: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmaxa.d"] - fn __lsx_vfmaxa_d(a: v2f64, b: v2f64) -> v2f64; + fn __lsx_vfmaxa_d(a: __v2f64, b: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfclass.s"] - fn __lsx_vfclass_s(a: v4f32) -> v4i32; + fn __lsx_vfclass_s(a: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfclass.d"] - fn __lsx_vfclass_d(a: v2f64) -> v2i64; + fn __lsx_vfclass_d(a: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfsqrt.s"] - fn __lsx_vfsqrt_s(a: v4f32) -> v4f32; + fn __lsx_vfsqrt_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfsqrt.d"] - fn __lsx_vfsqrt_d(a: v2f64) -> v2f64; + fn __lsx_vfsqrt_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrecip.s"] - fn __lsx_vfrecip_s(a: v4f32) -> v4f32; + fn __lsx_vfrecip_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrecip.d"] - fn __lsx_vfrecip_d(a: v2f64) -> v2f64; + fn __lsx_vfrecip_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrecipe.s"] - fn __lsx_vfrecipe_s(a: v4f32) -> v4f32; + fn __lsx_vfrecipe_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrecipe.d"] - fn __lsx_vfrecipe_d(a: v2f64) -> v2f64; + fn __lsx_vfrecipe_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrsqrte.s"] - fn __lsx_vfrsqrte_s(a: v4f32) -> v4f32; + fn __lsx_vfrsqrte_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrsqrte.d"] - fn __lsx_vfrsqrte_d(a: v2f64) -> v2f64; + fn __lsx_vfrsqrte_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrint.s"] - fn __lsx_vfrint_s(a: v4f32) -> v4f32; + fn __lsx_vfrint_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrint.d"] - fn __lsx_vfrint_d(a: v2f64) -> v2f64; + fn __lsx_vfrint_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrsqrt.s"] - fn __lsx_vfrsqrt_s(a: v4f32) -> v4f32; + fn __lsx_vfrsqrt_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrsqrt.d"] - fn __lsx_vfrsqrt_d(a: v2f64) -> v2f64; + fn __lsx_vfrsqrt_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vflogb.s"] - fn __lsx_vflogb_s(a: v4f32) -> v4f32; + fn __lsx_vflogb_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vflogb.d"] - fn __lsx_vflogb_d(a: v2f64) -> v2f64; + fn __lsx_vflogb_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfcvth.s.h"] - fn __lsx_vfcvth_s_h(a: v8i16) -> v4f32; + fn __lsx_vfcvth_s_h(a: __v8i16) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfcvth.d.s"] - fn __lsx_vfcvth_d_s(a: v4f32) -> v2f64; + fn __lsx_vfcvth_d_s(a: __v4f32) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfcvtl.s.h"] - fn __lsx_vfcvtl_s_h(a: v8i16) -> v4f32; + fn __lsx_vfcvtl_s_h(a: __v8i16) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfcvtl.d.s"] - fn __lsx_vfcvtl_d_s(a: v4f32) -> v2f64; + fn __lsx_vfcvtl_d_s(a: __v4f32) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vftint.w.s"] - fn __lsx_vftint_w_s(a: v4f32) -> v4i32; + fn __lsx_vftint_w_s(a: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftint.l.d"] - fn __lsx_vftint_l_d(a: v2f64) -> v2i64; + fn __lsx_vftint_l_d(a: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftint.wu.s"] - fn __lsx_vftint_wu_s(a: v4f32) -> v4u32; + fn __lsx_vftint_wu_s(a: __v4f32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vftint.lu.d"] - fn __lsx_vftint_lu_d(a: v2f64) -> v2u64; + fn __lsx_vftint_lu_d(a: __v2f64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vftintrz.w.s"] - fn __lsx_vftintrz_w_s(a: v4f32) -> v4i32; + fn __lsx_vftintrz_w_s(a: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrz.l.d"] - fn __lsx_vftintrz_l_d(a: v2f64) -> v2i64; + fn __lsx_vftintrz_l_d(a: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrz.wu.s"] - fn __lsx_vftintrz_wu_s(a: v4f32) -> v4u32; + fn __lsx_vftintrz_wu_s(a: __v4f32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vftintrz.lu.d"] - fn __lsx_vftintrz_lu_d(a: v2f64) -> v2u64; + fn __lsx_vftintrz_lu_d(a: __v2f64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vffint.s.w"] - fn __lsx_vffint_s_w(a: v4i32) -> v4f32; + fn __lsx_vffint_s_w(a: __v4i32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vffint.d.l"] - fn __lsx_vffint_d_l(a: v2i64) -> v2f64; + fn __lsx_vffint_d_l(a: __v2i64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vffint.s.wu"] - fn __lsx_vffint_s_wu(a: v4u32) -> v4f32; + fn __lsx_vffint_s_wu(a: __v4u32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vffint.d.lu"] - fn __lsx_vffint_d_lu(a: v2u64) -> v2f64; + fn __lsx_vffint_d_lu(a: __v2u64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vandn.v"] - fn __lsx_vandn_v(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vandn_v(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vneg.b"] - fn __lsx_vneg_b(a: v16i8) -> v16i8; + fn __lsx_vneg_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vneg.h"] - fn __lsx_vneg_h(a: v8i16) -> v8i16; + fn __lsx_vneg_h(a: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vneg.w"] - fn __lsx_vneg_w(a: v4i32) -> v4i32; + fn __lsx_vneg_w(a: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vneg.d"] - fn __lsx_vneg_d(a: v2i64) -> v2i64; + fn __lsx_vneg_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmuh.b"] - fn __lsx_vmuh_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vmuh_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmuh.h"] - fn __lsx_vmuh_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vmuh_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmuh.w"] - fn __lsx_vmuh_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vmuh_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmuh.d"] - fn __lsx_vmuh_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmuh_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmuh.bu"] - fn __lsx_vmuh_bu(a: v16u8, b: v16u8) -> v16u8; + fn __lsx_vmuh_bu(a: __v16u8, b: __v16u8) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vmuh.hu"] - fn __lsx_vmuh_hu(a: v8u16, b: v8u16) -> v8u16; + fn __lsx_vmuh_hu(a: __v8u16, b: __v8u16) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmuh.wu"] - fn __lsx_vmuh_wu(a: v4u32, b: v4u32) -> v4u32; + fn __lsx_vmuh_wu(a: __v4u32, b: __v4u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmuh.du"] - fn __lsx_vmuh_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vmuh_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vsllwil.h.b"] - fn __lsx_vsllwil_h_b(a: v16i8, b: u32) -> v8i16; + fn __lsx_vsllwil_h_b(a: __v16i8, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsllwil.w.h"] - fn __lsx_vsllwil_w_h(a: v8i16, b: u32) -> v4i32; + fn __lsx_vsllwil_w_h(a: __v8i16, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsllwil.d.w"] - fn __lsx_vsllwil_d_w(a: v4i32, b: u32) -> v2i64; + fn __lsx_vsllwil_d_w(a: __v4i32, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsllwil.hu.bu"] - fn __lsx_vsllwil_hu_bu(a: v16u8, b: u32) -> v8u16; + fn __lsx_vsllwil_hu_bu(a: __v16u8, b: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vsllwil.wu.hu"] - fn __lsx_vsllwil_wu_hu(a: v8u16, b: u32) -> v4u32; + fn __lsx_vsllwil_wu_hu(a: __v8u16, b: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vsllwil.du.wu"] - fn __lsx_vsllwil_du_wu(a: v4u32, b: u32) -> v2u64; + fn __lsx_vsllwil_du_wu(a: __v4u32, b: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vsran.b.h"] - fn __lsx_vsran_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vsran_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsran.h.w"] - fn __lsx_vsran_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vsran_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsran.w.d"] - fn __lsx_vsran_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vsran_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssran.b.h"] - fn __lsx_vssran_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vssran_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssran.h.w"] - fn __lsx_vssran_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vssran_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssran.w.d"] - fn __lsx_vssran_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vssran_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssran.bu.h"] - fn __lsx_vssran_bu_h(a: v8u16, b: v8u16) -> v16u8; + fn __lsx_vssran_bu_h(a: __v8u16, b: __v8u16) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssran.hu.w"] - fn __lsx_vssran_hu_w(a: v4u32, b: v4u32) -> v8u16; + fn __lsx_vssran_hu_w(a: __v4u32, b: __v4u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssran.wu.d"] - fn __lsx_vssran_wu_d(a: v2u64, b: v2u64) -> v4u32; + fn __lsx_vssran_wu_d(a: __v2u64, b: __v2u64) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vsrarn.b.h"] - fn __lsx_vsrarn_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vsrarn_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrarn.h.w"] - fn __lsx_vsrarn_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vsrarn_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrarn.w.d"] - fn __lsx_vsrarn_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vsrarn_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrarn.b.h"] - fn __lsx_vssrarn_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vssrarn_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrarn.h.w"] - fn __lsx_vssrarn_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vssrarn_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrarn.w.d"] - fn __lsx_vssrarn_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vssrarn_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrarn.bu.h"] - fn __lsx_vssrarn_bu_h(a: v8u16, b: v8u16) -> v16u8; + fn __lsx_vssrarn_bu_h(a: __v8u16, b: __v8u16) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrarn.hu.w"] - fn __lsx_vssrarn_hu_w(a: v4u32, b: v4u32) -> v8u16; + fn __lsx_vssrarn_hu_w(a: __v4u32, b: __v4u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrarn.wu.d"] - fn __lsx_vssrarn_wu_d(a: v2u64, b: v2u64) -> v4u32; + fn __lsx_vssrarn_wu_d(a: __v2u64, b: __v2u64) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vsrln.b.h"] - fn __lsx_vsrln_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vsrln_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrln.h.w"] - fn __lsx_vsrln_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vsrln_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrln.w.d"] - fn __lsx_vsrln_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vsrln_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrln.bu.h"] - fn __lsx_vssrln_bu_h(a: v8u16, b: v8u16) -> v16u8; + fn __lsx_vssrln_bu_h(a: __v8u16, b: __v8u16) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrln.hu.w"] - fn __lsx_vssrln_hu_w(a: v4u32, b: v4u32) -> v8u16; + fn __lsx_vssrln_hu_w(a: __v4u32, b: __v4u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrln.wu.d"] - fn __lsx_vssrln_wu_d(a: v2u64, b: v2u64) -> v4u32; + fn __lsx_vssrln_wu_d(a: __v2u64, b: __v2u64) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vsrlrn.b.h"] - fn __lsx_vsrlrn_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vsrlrn_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrlrn.h.w"] - fn __lsx_vsrlrn_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vsrlrn_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrlrn.w.d"] - fn __lsx_vsrlrn_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vsrlrn_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrlrn.bu.h"] - fn __lsx_vssrlrn_bu_h(a: v8u16, b: v8u16) -> v16u8; + fn __lsx_vssrlrn_bu_h(a: __v8u16, b: __v8u16) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrlrn.hu.w"] - fn __lsx_vssrlrn_hu_w(a: v4u32, b: v4u32) -> v8u16; + fn __lsx_vssrlrn_hu_w(a: __v4u32, b: __v4u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrlrn.wu.d"] - fn __lsx_vssrlrn_wu_d(a: v2u64, b: v2u64) -> v4u32; + fn __lsx_vssrlrn_wu_d(a: __v2u64, b: __v2u64) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vfrstpi.b"] - fn __lsx_vfrstpi_b(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vfrstpi_b(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vfrstpi.h"] - fn __lsx_vfrstpi_h(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vfrstpi_h(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vfrstp.b"] - fn __lsx_vfrstp_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8; + fn __lsx_vfrstp_b(a: __v16i8, b: __v16i8, c: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vfrstp.h"] - fn __lsx_vfrstp_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16; + fn __lsx_vfrstp_h(a: __v8i16, b: __v8i16, c: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vshuf4i.d"] - fn __lsx_vshuf4i_d(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vshuf4i_d(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vbsrl.v"] - fn __lsx_vbsrl_v(a: v16i8, b: u32) -> v16i8; + fn __lsx_vbsrl_v(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vbsll.v"] - fn __lsx_vbsll_v(a: v16i8, b: u32) -> v16i8; + fn __lsx_vbsll_v(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vextrins.b"] - fn __lsx_vextrins_b(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vextrins_b(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vextrins.h"] - fn __lsx_vextrins_h(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vextrins_h(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vextrins.w"] - fn __lsx_vextrins_w(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vextrins_w(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vextrins.d"] - fn __lsx_vextrins_d(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vextrins_d(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmskltz.b"] - fn __lsx_vmskltz_b(a: v16i8) -> v16i8; + fn __lsx_vmskltz_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmskltz.h"] - fn __lsx_vmskltz_h(a: v8i16) -> v8i16; + fn __lsx_vmskltz_h(a: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmskltz.w"] - fn __lsx_vmskltz_w(a: v4i32) -> v4i32; + fn __lsx_vmskltz_w(a: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmskltz.d"] - fn __lsx_vmskltz_d(a: v2i64) -> v2i64; + fn __lsx_vmskltz_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsigncov.b"] - fn __lsx_vsigncov_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vsigncov_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsigncov.h"] - fn __lsx_vsigncov_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vsigncov_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsigncov.w"] - fn __lsx_vsigncov_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vsigncov_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsigncov.d"] - fn __lsx_vsigncov_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsigncov_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfmadd.s"] - fn __lsx_vfmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32; + fn __lsx_vfmadd_s(a: __v4f32, b: __v4f32, c: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmadd.d"] - fn __lsx_vfmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64; + fn __lsx_vfmadd_d(a: __v2f64, b: __v2f64, c: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfmsub.s"] - fn __lsx_vfmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32; + fn __lsx_vfmsub_s(a: __v4f32, b: __v4f32, c: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfmsub.d"] - fn __lsx_vfmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64; + fn __lsx_vfmsub_d(a: __v2f64, b: __v2f64, c: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfnmadd.s"] - fn __lsx_vfnmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32; + fn __lsx_vfnmadd_s(a: __v4f32, b: __v4f32, c: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfnmadd.d"] - fn __lsx_vfnmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64; + fn __lsx_vfnmadd_d(a: __v2f64, b: __v2f64, c: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfnmsub.s"] - fn __lsx_vfnmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32; + fn __lsx_vfnmsub_s(a: __v4f32, b: __v4f32, c: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfnmsub.d"] - fn __lsx_vfnmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64; + fn __lsx_vfnmsub_d(a: __v2f64, b: __v2f64, c: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vftintrne.w.s"] - fn __lsx_vftintrne_w_s(a: v4f32) -> v4i32; + fn __lsx_vftintrne_w_s(a: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrne.l.d"] - fn __lsx_vftintrne_l_d(a: v2f64) -> v2i64; + fn __lsx_vftintrne_l_d(a: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrp.w.s"] - fn __lsx_vftintrp_w_s(a: v4f32) -> v4i32; + fn __lsx_vftintrp_w_s(a: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrp.l.d"] - fn __lsx_vftintrp_l_d(a: v2f64) -> v2i64; + fn __lsx_vftintrp_l_d(a: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrm.w.s"] - fn __lsx_vftintrm_w_s(a: v4f32) -> v4i32; + fn __lsx_vftintrm_w_s(a: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrm.l.d"] - fn __lsx_vftintrm_l_d(a: v2f64) -> v2i64; + fn __lsx_vftintrm_l_d(a: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftint.w.d"] - fn __lsx_vftint_w_d(a: v2f64, b: v2f64) -> v4i32; + fn __lsx_vftint_w_d(a: __v2f64, b: __v2f64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vffint.s.l"] - fn __lsx_vffint_s_l(a: v2i64, b: v2i64) -> v4f32; + fn __lsx_vffint_s_l(a: __v2i64, b: __v2i64) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vftintrz.w.d"] - fn __lsx_vftintrz_w_d(a: v2f64, b: v2f64) -> v4i32; + fn __lsx_vftintrz_w_d(a: __v2f64, b: __v2f64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrp.w.d"] - fn __lsx_vftintrp_w_d(a: v2f64, b: v2f64) -> v4i32; + fn __lsx_vftintrp_w_d(a: __v2f64, b: __v2f64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrm.w.d"] - fn __lsx_vftintrm_w_d(a: v2f64, b: v2f64) -> v4i32; + fn __lsx_vftintrm_w_d(a: __v2f64, b: __v2f64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintrne.w.d"] - fn __lsx_vftintrne_w_d(a: v2f64, b: v2f64) -> v4i32; + fn __lsx_vftintrne_w_d(a: __v2f64, b: __v2f64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vftintl.l.s"] - fn __lsx_vftintl_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintl_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftinth.l.s"] - fn __lsx_vftinth_l_s(a: v4f32) -> v2i64; + fn __lsx_vftinth_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vffinth.d.w"] - fn __lsx_vffinth_d_w(a: v4i32) -> v2f64; + fn __lsx_vffinth_d_w(a: __v4i32) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vffintl.d.w"] - fn __lsx_vffintl_d_w(a: v4i32) -> v2f64; + fn __lsx_vffintl_d_w(a: __v4i32) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vftintrzl.l.s"] - fn __lsx_vftintrzl_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrzl_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrzh.l.s"] - fn __lsx_vftintrzh_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrzh_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrpl.l.s"] - fn __lsx_vftintrpl_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrpl_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrph.l.s"] - fn __lsx_vftintrph_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrph_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrml.l.s"] - fn __lsx_vftintrml_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrml_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrmh.l.s"] - fn __lsx_vftintrmh_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrmh_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrnel.l.s"] - fn __lsx_vftintrnel_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrnel_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vftintrneh.l.s"] - fn __lsx_vftintrneh_l_s(a: v4f32) -> v2i64; + fn __lsx_vftintrneh_l_s(a: __v4f32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfrintrne.s"] - fn __lsx_vfrintrne_s(a: v4f32) -> v4f32; + fn __lsx_vfrintrne_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrintrne.d"] - fn __lsx_vfrintrne_d(a: v2f64) -> v2f64; + fn __lsx_vfrintrne_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrintrz.s"] - fn __lsx_vfrintrz_s(a: v4f32) -> v4f32; + fn __lsx_vfrintrz_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrintrz.d"] - fn __lsx_vfrintrz_d(a: v2f64) -> v2f64; + fn __lsx_vfrintrz_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrintrp.s"] - fn __lsx_vfrintrp_s(a: v4f32) -> v4f32; + fn __lsx_vfrintrp_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrintrp.d"] - fn __lsx_vfrintrp_d(a: v2f64) -> v2f64; + fn __lsx_vfrintrp_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vfrintrm.s"] - fn __lsx_vfrintrm_s(a: v4f32) -> v4f32; + fn __lsx_vfrintrm_s(a: __v4f32) -> __v4f32; #[link_name = "llvm.loongarch.lsx.vfrintrm.d"] - fn __lsx_vfrintrm_d(a: v2f64) -> v2f64; + fn __lsx_vfrintrm_d(a: __v2f64) -> __v2f64; #[link_name = "llvm.loongarch.lsx.vstelm.b"] - fn __lsx_vstelm_b(a: v16i8, b: *mut i8, c: i32, d: u32); + fn __lsx_vstelm_b(a: __v16i8, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lsx.vstelm.h"] - fn __lsx_vstelm_h(a: v8i16, b: *mut i8, c: i32, d: u32); + fn __lsx_vstelm_h(a: __v8i16, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lsx.vstelm.w"] - fn __lsx_vstelm_w(a: v4i32, b: *mut i8, c: i32, d: u32); + fn __lsx_vstelm_w(a: __v4i32, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lsx.vstelm.d"] - fn __lsx_vstelm_d(a: v2i64, b: *mut i8, c: i32, d: u32); + fn __lsx_vstelm_d(a: __v2i64, b: *mut i8, c: i32, d: u32); #[link_name = "llvm.loongarch.lsx.vaddwev.d.w"] - fn __lsx_vaddwev_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vaddwev_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwev.w.h"] - fn __lsx_vaddwev_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vaddwev_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddwev.h.b"] - fn __lsx_vaddwev_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vaddwev_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddwod.d.w"] - fn __lsx_vaddwod_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vaddwod_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwod.w.h"] - fn __lsx_vaddwod_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vaddwod_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddwod.h.b"] - fn __lsx_vaddwod_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vaddwod_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddwev.d.wu"] - fn __lsx_vaddwev_d_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vaddwev_d_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwev.w.hu"] - fn __lsx_vaddwev_w_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vaddwev_w_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddwev.h.bu"] - fn __lsx_vaddwev_h_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vaddwev_h_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddwod.d.wu"] - fn __lsx_vaddwod_d_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vaddwod_d_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwod.w.hu"] - fn __lsx_vaddwod_w_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vaddwod_w_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddwod.h.bu"] - fn __lsx_vaddwod_h_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vaddwod_h_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddwev.d.wu.w"] - fn __lsx_vaddwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64; + fn __lsx_vaddwev_d_wu_w(a: __v4u32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwev.w.hu.h"] - fn __lsx_vaddwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32; + fn __lsx_vaddwev_w_hu_h(a: __v8u16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddwev.h.bu.b"] - fn __lsx_vaddwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16; + fn __lsx_vaddwev_h_bu_b(a: __v16u8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddwod.d.wu.w"] - fn __lsx_vaddwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64; + fn __lsx_vaddwod_d_wu_w(a: __v4u32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwod.w.hu.h"] - fn __lsx_vaddwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32; + fn __lsx_vaddwod_w_hu_h(a: __v8u16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vaddwod.h.bu.b"] - fn __lsx_vaddwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16; + fn __lsx_vaddwod_h_bu_b(a: __v16u8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsubwev.d.w"] - fn __lsx_vsubwev_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vsubwev_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwev.w.h"] - fn __lsx_vsubwev_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vsubwev_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsubwev.h.b"] - fn __lsx_vsubwev_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vsubwev_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsubwod.d.w"] - fn __lsx_vsubwod_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vsubwod_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwod.w.h"] - fn __lsx_vsubwod_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vsubwod_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsubwod.h.b"] - fn __lsx_vsubwod_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vsubwod_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsubwev.d.wu"] - fn __lsx_vsubwev_d_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vsubwev_d_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwev.w.hu"] - fn __lsx_vsubwev_w_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vsubwev_w_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsubwev.h.bu"] - fn __lsx_vsubwev_h_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vsubwev_h_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsubwod.d.wu"] - fn __lsx_vsubwod_d_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vsubwod_d_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwod.w.hu"] - fn __lsx_vsubwod_w_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vsubwod_w_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsubwod.h.bu"] - fn __lsx_vsubwod_h_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vsubwod_h_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vaddwev.q.d"] - fn __lsx_vaddwev_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vaddwev_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwod.q.d"] - fn __lsx_vaddwod_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vaddwod_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwev.q.du"] - fn __lsx_vaddwev_q_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vaddwev_q_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwod.q.du"] - fn __lsx_vaddwod_q_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vaddwod_q_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwev.q.d"] - fn __lsx_vsubwev_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsubwev_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwod.q.d"] - fn __lsx_vsubwod_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsubwod_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwev.q.du"] - fn __lsx_vsubwev_q_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vsubwev_q_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsubwod.q.du"] - fn __lsx_vsubwod_q_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vsubwod_q_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwev.q.du.d"] - fn __lsx_vaddwev_q_du_d(a: v2u64, b: v2i64) -> v2i64; + fn __lsx_vaddwev_q_du_d(a: __v2u64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vaddwod.q.du.d"] - fn __lsx_vaddwod_q_du_d(a: v2u64, b: v2i64) -> v2i64; + fn __lsx_vaddwod_q_du_d(a: __v2u64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwev.d.w"] - fn __lsx_vmulwev_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vmulwev_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwev.w.h"] - fn __lsx_vmulwev_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vmulwev_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmulwev.h.b"] - fn __lsx_vmulwev_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vmulwev_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmulwod.d.w"] - fn __lsx_vmulwod_d_w(a: v4i32, b: v4i32) -> v2i64; + fn __lsx_vmulwod_d_w(a: __v4i32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwod.w.h"] - fn __lsx_vmulwod_w_h(a: v8i16, b: v8i16) -> v4i32; + fn __lsx_vmulwod_w_h(a: __v8i16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmulwod.h.b"] - fn __lsx_vmulwod_h_b(a: v16i8, b: v16i8) -> v8i16; + fn __lsx_vmulwod_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmulwev.d.wu"] - fn __lsx_vmulwev_d_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vmulwev_d_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwev.w.hu"] - fn __lsx_vmulwev_w_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vmulwev_w_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmulwev.h.bu"] - fn __lsx_vmulwev_h_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vmulwev_h_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmulwod.d.wu"] - fn __lsx_vmulwod_d_wu(a: v4u32, b: v4u32) -> v2i64; + fn __lsx_vmulwod_d_wu(a: __v4u32, b: __v4u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwod.w.hu"] - fn __lsx_vmulwod_w_hu(a: v8u16, b: v8u16) -> v4i32; + fn __lsx_vmulwod_w_hu(a: __v8u16, b: __v8u16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmulwod.h.bu"] - fn __lsx_vmulwod_h_bu(a: v16u8, b: v16u8) -> v8i16; + fn __lsx_vmulwod_h_bu(a: __v16u8, b: __v16u8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmulwev.d.wu.w"] - fn __lsx_vmulwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64; + fn __lsx_vmulwev_d_wu_w(a: __v4u32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwev.w.hu.h"] - fn __lsx_vmulwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32; + fn __lsx_vmulwev_w_hu_h(a: __v8u16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmulwev.h.bu.b"] - fn __lsx_vmulwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16; + fn __lsx_vmulwev_h_bu_b(a: __v16u8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmulwod.d.wu.w"] - fn __lsx_vmulwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64; + fn __lsx_vmulwod_d_wu_w(a: __v4u32, b: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwod.w.hu.h"] - fn __lsx_vmulwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32; + fn __lsx_vmulwod_w_hu_h(a: __v8u16, b: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmulwod.h.bu.b"] - fn __lsx_vmulwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16; + fn __lsx_vmulwod_h_bu_b(a: __v16u8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmulwev.q.d"] - fn __lsx_vmulwev_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmulwev_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwod.q.d"] - fn __lsx_vmulwod_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vmulwod_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwev.q.du"] - fn __lsx_vmulwev_q_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vmulwev_q_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwod.q.du"] - fn __lsx_vmulwod_q_du(a: v2u64, b: v2u64) -> v2i64; + fn __lsx_vmulwod_q_du(a: __v2u64, b: __v2u64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwev.q.du.d"] - fn __lsx_vmulwev_q_du_d(a: v2u64, b: v2i64) -> v2i64; + fn __lsx_vmulwev_q_du_d(a: __v2u64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmulwod.q.du.d"] - fn __lsx_vmulwod_q_du_d(a: v2u64, b: v2i64) -> v2i64; + fn __lsx_vmulwod_q_du_d(a: __v2u64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vhaddw.q.d"] - fn __lsx_vhaddw_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vhaddw_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vhaddw.qu.du"] - fn __lsx_vhaddw_qu_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vhaddw_qu_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vhsubw.q.d"] - fn __lsx_vhsubw_q_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vhsubw_q_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vhsubw.qu.du"] - fn __lsx_vhsubw_qu_du(a: v2u64, b: v2u64) -> v2u64; + fn __lsx_vhsubw_qu_du(a: __v2u64, b: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmaddwev.d.w"] - fn __lsx_vmaddwev_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64; + fn __lsx_vmaddwev_d_w(a: __v2i64, b: __v4i32, c: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwev.w.h"] - fn __lsx_vmaddwev_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32; + fn __lsx_vmaddwev_w_h(a: __v4i32, b: __v8i16, c: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmaddwev.h.b"] - fn __lsx_vmaddwev_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16; + fn __lsx_vmaddwev_h_b(a: __v8i16, b: __v16i8, c: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmaddwev.d.wu"] - fn __lsx_vmaddwev_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64; + fn __lsx_vmaddwev_d_wu(a: __v2u64, b: __v4u32, c: __v4u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmaddwev.w.hu"] - fn __lsx_vmaddwev_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32; + fn __lsx_vmaddwev_w_hu(a: __v4u32, b: __v8u16, c: __v8u16) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmaddwev.h.bu"] - fn __lsx_vmaddwev_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16; + fn __lsx_vmaddwev_h_bu(a: __v8u16, b: __v16u8, c: __v16u8) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmaddwod.d.w"] - fn __lsx_vmaddwod_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64; + fn __lsx_vmaddwod_d_w(a: __v2i64, b: __v4i32, c: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwod.w.h"] - fn __lsx_vmaddwod_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32; + fn __lsx_vmaddwod_w_h(a: __v4i32, b: __v8i16, c: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmaddwod.h.b"] - fn __lsx_vmaddwod_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16; + fn __lsx_vmaddwod_h_b(a: __v8i16, b: __v16i8, c: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmaddwod.d.wu"] - fn __lsx_vmaddwod_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64; + fn __lsx_vmaddwod_d_wu(a: __v2u64, b: __v4u32, c: __v4u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmaddwod.w.hu"] - fn __lsx_vmaddwod_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32; + fn __lsx_vmaddwod_w_hu(a: __v4u32, b: __v8u16, c: __v8u16) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vmaddwod.h.bu"] - fn __lsx_vmaddwod_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16; + fn __lsx_vmaddwod_h_bu(a: __v8u16, b: __v16u8, c: __v16u8) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vmaddwev.d.wu.w"] - fn __lsx_vmaddwev_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64; + fn __lsx_vmaddwev_d_wu_w(a: __v2i64, b: __v4u32, c: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwev.w.hu.h"] - fn __lsx_vmaddwev_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32; + fn __lsx_vmaddwev_w_hu_h(a: __v4i32, b: __v8u16, c: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmaddwev.h.bu.b"] - fn __lsx_vmaddwev_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16; + fn __lsx_vmaddwev_h_bu_b(a: __v8i16, b: __v16u8, c: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmaddwod.d.wu.w"] - fn __lsx_vmaddwod_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64; + fn __lsx_vmaddwod_d_wu_w(a: __v2i64, b: __v4u32, c: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwod.w.hu.h"] - fn __lsx_vmaddwod_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32; + fn __lsx_vmaddwod_w_hu_h(a: __v4i32, b: __v8u16, c: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vmaddwod.h.bu.b"] - fn __lsx_vmaddwod_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16; + fn __lsx_vmaddwod_h_bu_b(a: __v8i16, b: __v16u8, c: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vmaddwev.q.d"] - fn __lsx_vmaddwev_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64; + fn __lsx_vmaddwev_q_d(a: __v2i64, b: __v2i64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwod.q.d"] - fn __lsx_vmaddwod_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64; + fn __lsx_vmaddwod_q_d(a: __v2i64, b: __v2i64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwev.q.du"] - fn __lsx_vmaddwev_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64; + fn __lsx_vmaddwev_q_du(a: __v2u64, b: __v2u64, c: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmaddwod.q.du"] - fn __lsx_vmaddwod_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64; + fn __lsx_vmaddwod_q_du(a: __v2u64, b: __v2u64, c: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vmaddwev.q.du.d"] - fn __lsx_vmaddwev_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64; + fn __lsx_vmaddwev_q_du_d(a: __v2i64, b: __v2u64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmaddwod.q.du.d"] - fn __lsx_vmaddwod_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64; + fn __lsx_vmaddwod_q_du_d(a: __v2i64, b: __v2u64, c: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vrotr.b"] - fn __lsx_vrotr_b(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vrotr_b(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vrotr.h"] - fn __lsx_vrotr_h(a: v8i16, b: v8i16) -> v8i16; + fn __lsx_vrotr_h(a: __v8i16, b: __v8i16) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vrotr.w"] - fn __lsx_vrotr_w(a: v4i32, b: v4i32) -> v4i32; + fn __lsx_vrotr_w(a: __v4i32, b: __v4i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vrotr.d"] - fn __lsx_vrotr_d(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vrotr_d(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vadd.q"] - fn __lsx_vadd_q(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vadd_q(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsub.q"] - fn __lsx_vsub_q(a: v2i64, b: v2i64) -> v2i64; + fn __lsx_vsub_q(a: __v2i64, b: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vldrepl.b"] - fn __lsx_vldrepl_b(a: *const i8, b: i32) -> v16i8; + fn __lsx_vldrepl_b(a: *const i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vldrepl.h"] - fn __lsx_vldrepl_h(a: *const i8, b: i32) -> v8i16; + fn __lsx_vldrepl_h(a: *const i8, b: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vldrepl.w"] - fn __lsx_vldrepl_w(a: *const i8, b: i32) -> v4i32; + fn __lsx_vldrepl_w(a: *const i8, b: i32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vldrepl.d"] - fn __lsx_vldrepl_d(a: *const i8, b: i32) -> v2i64; + fn __lsx_vldrepl_d(a: *const i8, b: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vmskgez.b"] - fn __lsx_vmskgez_b(a: v16i8) -> v16i8; + fn __lsx_vmskgez_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vmsknz.b"] - fn __lsx_vmsknz_b(a: v16i8) -> v16i8; + fn __lsx_vmsknz_b(a: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vexth.h.b"] - fn __lsx_vexth_h_b(a: v16i8) -> v8i16; + fn __lsx_vexth_h_b(a: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vexth.w.h"] - fn __lsx_vexth_w_h(a: v8i16) -> v4i32; + fn __lsx_vexth_w_h(a: __v8i16) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vexth.d.w"] - fn __lsx_vexth_d_w(a: v4i32) -> v2i64; + fn __lsx_vexth_d_w(a: __v4i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vexth.q.d"] - fn __lsx_vexth_q_d(a: v2i64) -> v2i64; + fn __lsx_vexth_q_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vexth.hu.bu"] - fn __lsx_vexth_hu_bu(a: v16u8) -> v8u16; + fn __lsx_vexth_hu_bu(a: __v16u8) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vexth.wu.hu"] - fn __lsx_vexth_wu_hu(a: v8u16) -> v4u32; + fn __lsx_vexth_wu_hu(a: __v8u16) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vexth.du.wu"] - fn __lsx_vexth_du_wu(a: v4u32) -> v2u64; + fn __lsx_vexth_du_wu(a: __v4u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vexth.qu.du"] - fn __lsx_vexth_qu_du(a: v2u64) -> v2u64; + fn __lsx_vexth_qu_du(a: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vrotri.b"] - fn __lsx_vrotri_b(a: v16i8, b: u32) -> v16i8; + fn __lsx_vrotri_b(a: __v16i8, b: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vrotri.h"] - fn __lsx_vrotri_h(a: v8i16, b: u32) -> v8i16; + fn __lsx_vrotri_h(a: __v8i16, b: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vrotri.w"] - fn __lsx_vrotri_w(a: v4i32, b: u32) -> v4i32; + fn __lsx_vrotri_w(a: __v4i32, b: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vrotri.d"] - fn __lsx_vrotri_d(a: v2i64, b: u32) -> v2i64; + fn __lsx_vrotri_d(a: __v2i64, b: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vextl.q.d"] - fn __lsx_vextl_q_d(a: v2i64) -> v2i64; + fn __lsx_vextl_q_d(a: __v2i64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrlni.b.h"] - fn __lsx_vsrlni_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vsrlni_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrlni.h.w"] - fn __lsx_vsrlni_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vsrlni_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrlni.w.d"] - fn __lsx_vsrlni_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vsrlni_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrlni.d.q"] - fn __lsx_vsrlni_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vsrlni_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrlrni.b.h"] - fn __lsx_vsrlrni_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vsrlrni_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrlrni.h.w"] - fn __lsx_vsrlrni_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vsrlrni_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrlrni.w.d"] - fn __lsx_vsrlrni_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vsrlrni_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrlrni.d.q"] - fn __lsx_vsrlrni_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vsrlrni_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssrlni.b.h"] - fn __lsx_vssrlni_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vssrlni_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrlni.h.w"] - fn __lsx_vssrlni_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vssrlni_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrlni.w.d"] - fn __lsx_vssrlni_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vssrlni_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrlni.d.q"] - fn __lsx_vssrlni_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vssrlni_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssrlni.bu.h"] - fn __lsx_vssrlni_bu_h(a: v16u8, b: v16i8, c: u32) -> v16u8; + fn __lsx_vssrlni_bu_h(a: __v16u8, b: __v16i8, c: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrlni.hu.w"] - fn __lsx_vssrlni_hu_w(a: v8u16, b: v8i16, c: u32) -> v8u16; + fn __lsx_vssrlni_hu_w(a: __v8u16, b: __v8i16, c: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrlni.wu.d"] - fn __lsx_vssrlni_wu_d(a: v4u32, b: v4i32, c: u32) -> v4u32; + fn __lsx_vssrlni_wu_d(a: __v4u32, b: __v4i32, c: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vssrlni.du.q"] - fn __lsx_vssrlni_du_q(a: v2u64, b: v2i64, c: u32) -> v2u64; + fn __lsx_vssrlni_du_q(a: __v2u64, b: __v2i64, c: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vssrlrni.b.h"] - fn __lsx_vssrlrni_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vssrlrni_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrlrni.h.w"] - fn __lsx_vssrlrni_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vssrlrni_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrlrni.w.d"] - fn __lsx_vssrlrni_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vssrlrni_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrlrni.d.q"] - fn __lsx_vssrlrni_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vssrlrni_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssrlrni.bu.h"] - fn __lsx_vssrlrni_bu_h(a: v16u8, b: v16i8, c: u32) -> v16u8; + fn __lsx_vssrlrni_bu_h(a: __v16u8, b: __v16i8, c: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrlrni.hu.w"] - fn __lsx_vssrlrni_hu_w(a: v8u16, b: v8i16, c: u32) -> v8u16; + fn __lsx_vssrlrni_hu_w(a: __v8u16, b: __v8i16, c: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrlrni.wu.d"] - fn __lsx_vssrlrni_wu_d(a: v4u32, b: v4i32, c: u32) -> v4u32; + fn __lsx_vssrlrni_wu_d(a: __v4u32, b: __v4i32, c: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vssrlrni.du.q"] - fn __lsx_vssrlrni_du_q(a: v2u64, b: v2i64, c: u32) -> v2u64; + fn __lsx_vssrlrni_du_q(a: __v2u64, b: __v2i64, c: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vsrani.b.h"] - fn __lsx_vsrani_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vsrani_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrani.h.w"] - fn __lsx_vsrani_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vsrani_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrani.w.d"] - fn __lsx_vsrani_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vsrani_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrani.d.q"] - fn __lsx_vsrani_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vsrani_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vsrarni.b.h"] - fn __lsx_vsrarni_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vsrarni_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vsrarni.h.w"] - fn __lsx_vsrarni_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vsrarni_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vsrarni.w.d"] - fn __lsx_vsrarni_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vsrarni_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vsrarni.d.q"] - fn __lsx_vsrarni_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vsrarni_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssrani.b.h"] - fn __lsx_vssrani_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vssrani_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrani.h.w"] - fn __lsx_vssrani_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vssrani_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrani.w.d"] - fn __lsx_vssrani_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vssrani_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrani.d.q"] - fn __lsx_vssrani_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vssrani_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssrani.bu.h"] - fn __lsx_vssrani_bu_h(a: v16u8, b: v16i8, c: u32) -> v16u8; + fn __lsx_vssrani_bu_h(a: __v16u8, b: __v16i8, c: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrani.hu.w"] - fn __lsx_vssrani_hu_w(a: v8u16, b: v8i16, c: u32) -> v8u16; + fn __lsx_vssrani_hu_w(a: __v8u16, b: __v8i16, c: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrani.wu.d"] - fn __lsx_vssrani_wu_d(a: v4u32, b: v4i32, c: u32) -> v4u32; + fn __lsx_vssrani_wu_d(a: __v4u32, b: __v4i32, c: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vssrani.du.q"] - fn __lsx_vssrani_du_q(a: v2u64, b: v2i64, c: u32) -> v2u64; + fn __lsx_vssrani_du_q(a: __v2u64, b: __v2i64, c: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vssrarni.b.h"] - fn __lsx_vssrarni_b_h(a: v16i8, b: v16i8, c: u32) -> v16i8; + fn __lsx_vssrarni_b_h(a: __v16i8, b: __v16i8, c: u32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrarni.h.w"] - fn __lsx_vssrarni_h_w(a: v8i16, b: v8i16, c: u32) -> v8i16; + fn __lsx_vssrarni_h_w(a: __v8i16, b: __v8i16, c: u32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrarni.w.d"] - fn __lsx_vssrarni_w_d(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vssrarni_w_d(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrarni.d.q"] - fn __lsx_vssrarni_d_q(a: v2i64, b: v2i64, c: u32) -> v2i64; + fn __lsx_vssrarni_d_q(a: __v2i64, b: __v2i64, c: u32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vssrarni.bu.h"] - fn __lsx_vssrarni_bu_h(a: v16u8, b: v16i8, c: u32) -> v16u8; + fn __lsx_vssrarni_bu_h(a: __v16u8, b: __v16i8, c: u32) -> __v16u8; #[link_name = "llvm.loongarch.lsx.vssrarni.hu.w"] - fn __lsx_vssrarni_hu_w(a: v8u16, b: v8i16, c: u32) -> v8u16; + fn __lsx_vssrarni_hu_w(a: __v8u16, b: __v8i16, c: u32) -> __v8u16; #[link_name = "llvm.loongarch.lsx.vssrarni.wu.d"] - fn __lsx_vssrarni_wu_d(a: v4u32, b: v4i32, c: u32) -> v4u32; + fn __lsx_vssrarni_wu_d(a: __v4u32, b: __v4i32, c: u32) -> __v4u32; #[link_name = "llvm.loongarch.lsx.vssrarni.du.q"] - fn __lsx_vssrarni_du_q(a: v2u64, b: v2i64, c: u32) -> v2u64; + fn __lsx_vssrarni_du_q(a: __v2u64, b: __v2i64, c: u32) -> __v2u64; #[link_name = "llvm.loongarch.lsx.vpermi.w"] - fn __lsx_vpermi_w(a: v4i32, b: v4i32, c: u32) -> v4i32; + fn __lsx_vpermi_w(a: __v4i32, b: __v4i32, c: u32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vld"] - fn __lsx_vld(a: *const i8, b: i32) -> v16i8; + fn __lsx_vld(a: *const i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vst"] - fn __lsx_vst(a: v16i8, b: *mut i8, c: i32); + fn __lsx_vst(a: __v16i8, b: *mut i8, c: i32); #[link_name = "llvm.loongarch.lsx.vssrlrn.b.h"] - fn __lsx_vssrlrn_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vssrlrn_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrlrn.h.w"] - fn __lsx_vssrlrn_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vssrlrn_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrlrn.w.d"] - fn __lsx_vssrlrn_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vssrlrn_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vssrln.b.h"] - fn __lsx_vssrln_b_h(a: v8i16, b: v8i16) -> v16i8; + fn __lsx_vssrln_b_h(a: __v8i16, b: __v8i16) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vssrln.h.w"] - fn __lsx_vssrln_h_w(a: v4i32, b: v4i32) -> v8i16; + fn __lsx_vssrln_h_w(a: __v4i32, b: __v4i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vssrln.w.d"] - fn __lsx_vssrln_w_d(a: v2i64, b: v2i64) -> v4i32; + fn __lsx_vssrln_w_d(a: __v2i64, b: __v2i64) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vorn.v"] - fn __lsx_vorn_v(a: v16i8, b: v16i8) -> v16i8; + fn __lsx_vorn_v(a: __v16i8, b: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vldi"] - fn __lsx_vldi(a: i32) -> v2i64; + fn __lsx_vldi(a: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vshuf.b"] - fn __lsx_vshuf_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8; + fn __lsx_vshuf_b(a: __v16i8, b: __v16i8, c: __v16i8) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vldx"] - fn __lsx_vldx(a: *const i8, b: i64) -> v16i8; + fn __lsx_vldx(a: *const i8, b: i64) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vstx"] - fn __lsx_vstx(a: v16i8, b: *mut i8, c: i64); + fn __lsx_vstx(a: __v16i8, b: *mut i8, c: i64); #[link_name = "llvm.loongarch.lsx.vextl.qu.du"] - fn __lsx_vextl_qu_du(a: v2u64) -> v2u64; + fn __lsx_vextl_qu_du(a: __v2u64) -> __v2u64; #[link_name = "llvm.loongarch.lsx.bnz.b"] - fn __lsx_bnz_b(a: v16u8) -> i32; + fn __lsx_bnz_b(a: __v16u8) -> i32; #[link_name = "llvm.loongarch.lsx.bnz.d"] - fn __lsx_bnz_d(a: v2u64) -> i32; + fn __lsx_bnz_d(a: __v2u64) -> i32; #[link_name = "llvm.loongarch.lsx.bnz.h"] - fn __lsx_bnz_h(a: v8u16) -> i32; + fn __lsx_bnz_h(a: __v8u16) -> i32; #[link_name = "llvm.loongarch.lsx.bnz.v"] - fn __lsx_bnz_v(a: v16u8) -> i32; + fn __lsx_bnz_v(a: __v16u8) -> i32; #[link_name = "llvm.loongarch.lsx.bnz.w"] - fn __lsx_bnz_w(a: v4u32) -> i32; + fn __lsx_bnz_w(a: __v4u32) -> i32; #[link_name = "llvm.loongarch.lsx.bz.b"] - fn __lsx_bz_b(a: v16u8) -> i32; + fn __lsx_bz_b(a: __v16u8) -> i32; #[link_name = "llvm.loongarch.lsx.bz.d"] - fn __lsx_bz_d(a: v2u64) -> i32; + fn __lsx_bz_d(a: __v2u64) -> i32; #[link_name = "llvm.loongarch.lsx.bz.h"] - fn __lsx_bz_h(a: v8u16) -> i32; + fn __lsx_bz_h(a: __v8u16) -> i32; #[link_name = "llvm.loongarch.lsx.bz.v"] - fn __lsx_bz_v(a: v16u8) -> i32; + fn __lsx_bz_v(a: __v16u8) -> i32; #[link_name = "llvm.loongarch.lsx.bz.w"] - fn __lsx_bz_w(a: v4u32) -> i32; + fn __lsx_bz_w(a: __v4u32) -> i32; #[link_name = "llvm.loongarch.lsx.vfcmp.caf.d"] - fn __lsx_vfcmp_caf_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_caf_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.caf.s"] - fn __lsx_vfcmp_caf_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_caf_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.ceq.d"] - fn __lsx_vfcmp_ceq_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_ceq_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.ceq.s"] - fn __lsx_vfcmp_ceq_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_ceq_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cle.d"] - fn __lsx_vfcmp_cle_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cle_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cle.s"] - fn __lsx_vfcmp_cle_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cle_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.clt.d"] - fn __lsx_vfcmp_clt_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_clt_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.clt.s"] - fn __lsx_vfcmp_clt_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_clt_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cne.d"] - fn __lsx_vfcmp_cne_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cne_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cne.s"] - fn __lsx_vfcmp_cne_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cne_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cor.d"] - fn __lsx_vfcmp_cor_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cor_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cor.s"] - fn __lsx_vfcmp_cor_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cor_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cueq.d"] - fn __lsx_vfcmp_cueq_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cueq_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cueq.s"] - fn __lsx_vfcmp_cueq_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cueq_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cule.d"] - fn __lsx_vfcmp_cule_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cule_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cule.s"] - fn __lsx_vfcmp_cule_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cule_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cult.d"] - fn __lsx_vfcmp_cult_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cult_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cult.s"] - fn __lsx_vfcmp_cult_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cult_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cun.d"] - fn __lsx_vfcmp_cun_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cun_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cune.d"] - fn __lsx_vfcmp_cune_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_cune_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.cune.s"] - fn __lsx_vfcmp_cune_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cune_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.cun.s"] - fn __lsx_vfcmp_cun_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_cun_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.saf.d"] - fn __lsx_vfcmp_saf_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_saf_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.saf.s"] - fn __lsx_vfcmp_saf_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_saf_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.seq.d"] - fn __lsx_vfcmp_seq_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_seq_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.seq.s"] - fn __lsx_vfcmp_seq_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_seq_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sle.d"] - fn __lsx_vfcmp_sle_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sle_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sle.s"] - fn __lsx_vfcmp_sle_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sle_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.slt.d"] - fn __lsx_vfcmp_slt_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_slt_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.slt.s"] - fn __lsx_vfcmp_slt_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_slt_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sne.d"] - fn __lsx_vfcmp_sne_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sne_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sne.s"] - fn __lsx_vfcmp_sne_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sne_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sor.d"] - fn __lsx_vfcmp_sor_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sor_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sor.s"] - fn __lsx_vfcmp_sor_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sor_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sueq.d"] - fn __lsx_vfcmp_sueq_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sueq_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sueq.s"] - fn __lsx_vfcmp_sueq_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sueq_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sule.d"] - fn __lsx_vfcmp_sule_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sule_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sule.s"] - fn __lsx_vfcmp_sule_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sule_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sult.d"] - fn __lsx_vfcmp_sult_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sult_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sult.s"] - fn __lsx_vfcmp_sult_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sult_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sun.d"] - fn __lsx_vfcmp_sun_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sun_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sune.d"] - fn __lsx_vfcmp_sune_d(a: v2f64, b: v2f64) -> v2i64; + fn __lsx_vfcmp_sune_d(a: __v2f64, b: __v2f64) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vfcmp.sune.s"] - fn __lsx_vfcmp_sune_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sune_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vfcmp.sun.s"] - fn __lsx_vfcmp_sun_s(a: v4f32, b: v4f32) -> v4i32; + fn __lsx_vfcmp_sun_s(a: __v4f32, b: __v4f32) -> __v4i32; #[link_name = "llvm.loongarch.lsx.vrepli.b"] - fn __lsx_vrepli_b(a: i32) -> v16i8; + fn __lsx_vrepli_b(a: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vrepli.d"] - fn __lsx_vrepli_d(a: i32) -> v2i64; + fn __lsx_vrepli_d(a: i32) -> __v2i64; #[link_name = "llvm.loongarch.lsx.vrepli.h"] - fn __lsx_vrepli_h(a: i32) -> v8i16; + fn __lsx_vrepli_h(a: i32) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vrepli.w"] - fn __lsx_vrepli_w(a: i32) -> v4i32; + fn __lsx_vrepli_w(a: i32) -> __v4i32; } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsll_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsll_b(a, b) } +pub fn lsx_vsll_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsll_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsll_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsll_h(a, b) } +pub fn lsx_vsll_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsll_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsll_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsll_w(a, b) } +pub fn lsx_vsll_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsll_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsll_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsll_d(a, b) } +pub fn lsx_vsll_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsll_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslli_b(a: v16i8) -> v16i8 { +pub fn lsx_vslli_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vslli_b(a, IMM3) } + unsafe { transmute(__lsx_vslli_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslli_h(a: v8i16) -> v8i16 { +pub fn lsx_vslli_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vslli_h(a, IMM4) } + unsafe { transmute(__lsx_vslli_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslli_w(a: v4i32) -> v4i32 { +pub fn lsx_vslli_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslli_w(a, IMM5) } + unsafe { transmute(__lsx_vslli_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslli_d(a: v2i64) -> v2i64 { +pub fn lsx_vslli_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vslli_d(a, IMM6) } + unsafe { transmute(__lsx_vslli_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsra_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsra_b(a, b) } +pub fn lsx_vsra_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsra_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsra_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsra_h(a, b) } +pub fn lsx_vsra_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsra_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsra_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsra_w(a, b) } +pub fn lsx_vsra_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsra_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsra_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsra_d(a, b) } +pub fn lsx_vsra_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsra_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrai_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrai_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsrai_b(a, IMM3) } + unsafe { transmute(__lsx_vsrai_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrai_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrai_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrai_h(a, IMM4) } + unsafe { transmute(__lsx_vsrai_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrai_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrai_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrai_w(a, IMM5) } + unsafe { transmute(__lsx_vsrai_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrai_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrai_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrai_d(a, IMM6) } + unsafe { transmute(__lsx_vsrai_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrar_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsrar_b(a, b) } +pub fn lsx_vsrar_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrar_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrar_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsrar_h(a, b) } +pub fn lsx_vsrar_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrar_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrar_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsrar_w(a, b) } +pub fn lsx_vsrar_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrar_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrar_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsrar_d(a, b) } +pub fn lsx_vsrar_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrar_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrari_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrari_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsrari_b(a, IMM3) } + unsafe { transmute(__lsx_vsrari_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrari_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrari_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrari_h(a, IMM4) } + unsafe { transmute(__lsx_vsrari_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrari_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrari_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrari_w(a, IMM5) } + unsafe { transmute(__lsx_vsrari_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrari_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrari_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrari_d(a, IMM6) } + unsafe { transmute(__lsx_vsrari_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrl_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsrl_b(a, b) } +pub fn lsx_vsrl_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrl_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrl_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsrl_h(a, b) } +pub fn lsx_vsrl_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrl_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrl_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsrl_w(a, b) } +pub fn lsx_vsrl_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrl_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrl_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsrl_d(a, b) } +pub fn lsx_vsrl_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrl_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrli_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrli_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsrli_b(a, IMM3) } + unsafe { transmute(__lsx_vsrli_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrli_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrli_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrli_h(a, IMM4) } + unsafe { transmute(__lsx_vsrli_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrli_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrli_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrli_w(a, IMM5) } + unsafe { transmute(__lsx_vsrli_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrli_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrli_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrli_d(a, IMM6) } + unsafe { transmute(__lsx_vsrli_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlr_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsrlr_b(a, b) } +pub fn lsx_vsrlr_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlr_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsrlr_h(a, b) } +pub fn lsx_vsrlr_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlr_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsrlr_w(a, b) } +pub fn lsx_vsrlr_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlr_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsrlr_d(a, b) } +pub fn lsx_vsrlr_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlri_b(a: v16i8) -> v16i8 { +pub fn lsx_vsrlri_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsrlri_b(a, IMM3) } + unsafe { transmute(__lsx_vsrlri_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlri_h(a: v8i16) -> v8i16 { +pub fn lsx_vsrlri_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrlri_h(a, IMM4) } + unsafe { transmute(__lsx_vsrlri_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlri_w(a: v4i32) -> v4i32 { +pub fn lsx_vsrlri_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrlri_w(a, IMM5) } + unsafe { transmute(__lsx_vsrlri_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlri_d(a: v2i64) -> v2i64 { +pub fn lsx_vsrlri_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrlri_d(a, IMM6) } + unsafe { transmute(__lsx_vsrlri_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclr_b(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vbitclr_b(a, b) } +pub fn lsx_vbitclr_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitclr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclr_h(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vbitclr_h(a, b) } +pub fn lsx_vbitclr_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitclr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclr_w(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vbitclr_w(a, b) } +pub fn lsx_vbitclr_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitclr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclr_d(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vbitclr_d(a, b) } +pub fn lsx_vbitclr_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitclr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclri_b(a: v16u8) -> v16u8 { +pub fn lsx_vbitclri_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vbitclri_b(a, IMM3) } + unsafe { transmute(__lsx_vbitclri_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclri_h(a: v8u16) -> v8u16 { +pub fn lsx_vbitclri_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vbitclri_h(a, IMM4) } + unsafe { transmute(__lsx_vbitclri_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclri_w(a: v4u32) -> v4u32 { +pub fn lsx_vbitclri_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vbitclri_w(a, IMM5) } + unsafe { transmute(__lsx_vbitclri_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitclri_d(a: v2u64) -> v2u64 { +pub fn lsx_vbitclri_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vbitclri_d(a, IMM6) } + unsafe { transmute(__lsx_vbitclri_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitset_b(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vbitset_b(a, b) } +pub fn lsx_vbitset_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitset_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitset_h(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vbitset_h(a, b) } +pub fn lsx_vbitset_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitset_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitset_w(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vbitset_w(a, b) } +pub fn lsx_vbitset_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitset_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitset_d(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vbitset_d(a, b) } +pub fn lsx_vbitset_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitset_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitseti_b(a: v16u8) -> v16u8 { +pub fn lsx_vbitseti_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vbitseti_b(a, IMM3) } + unsafe { transmute(__lsx_vbitseti_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitseti_h(a: v8u16) -> v8u16 { +pub fn lsx_vbitseti_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vbitseti_h(a, IMM4) } + unsafe { transmute(__lsx_vbitseti_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitseti_w(a: v4u32) -> v4u32 { +pub fn lsx_vbitseti_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vbitseti_w(a, IMM5) } + unsafe { transmute(__lsx_vbitseti_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitseti_d(a: v2u64) -> v2u64 { +pub fn lsx_vbitseti_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vbitseti_d(a, IMM6) } + unsafe { transmute(__lsx_vbitseti_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrev_b(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vbitrev_b(a, b) } +pub fn lsx_vbitrev_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitrev_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrev_h(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vbitrev_h(a, b) } +pub fn lsx_vbitrev_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitrev_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrev_w(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vbitrev_w(a, b) } +pub fn lsx_vbitrev_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitrev_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrev_d(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vbitrev_d(a, b) } +pub fn lsx_vbitrev_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vbitrev_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrevi_b(a: v16u8) -> v16u8 { +pub fn lsx_vbitrevi_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vbitrevi_b(a, IMM3) } + unsafe { transmute(__lsx_vbitrevi_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrevi_h(a: v8u16) -> v8u16 { +pub fn lsx_vbitrevi_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vbitrevi_h(a, IMM4) } + unsafe { transmute(__lsx_vbitrevi_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrevi_w(a: v4u32) -> v4u32 { +pub fn lsx_vbitrevi_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vbitrevi_w(a, IMM5) } + unsafe { transmute(__lsx_vbitrevi_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitrevi_d(a: v2u64) -> v2u64 { +pub fn lsx_vbitrevi_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vbitrevi_d(a, IMM6) } + unsafe { transmute(__lsx_vbitrevi_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadd_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vadd_b(a, b) } +pub fn lsx_vadd_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadd_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadd_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vadd_h(a, b) } +pub fn lsx_vadd_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadd_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadd_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vadd_w(a, b) } +pub fn lsx_vadd_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadd_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadd_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vadd_d(a, b) } +pub fn lsx_vadd_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddi_bu(a: v16i8) -> v16i8 { +pub fn lsx_vaddi_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vaddi_bu(a, IMM5) } + unsafe { transmute(__lsx_vaddi_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddi_hu(a: v8i16) -> v8i16 { +pub fn lsx_vaddi_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vaddi_hu(a, IMM5) } + unsafe { transmute(__lsx_vaddi_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddi_wu(a: v4i32) -> v4i32 { +pub fn lsx_vaddi_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vaddi_wu(a, IMM5) } + unsafe { transmute(__lsx_vaddi_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddi_du(a: v2i64) -> v2i64 { +pub fn lsx_vaddi_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vaddi_du(a, IMM5) } + unsafe { transmute(__lsx_vaddi_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsub_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsub_b(a, b) } +pub fn lsx_vsub_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsub_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsub_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsub_h(a, b) } +pub fn lsx_vsub_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsub_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsub_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsub_w(a, b) } +pub fn lsx_vsub_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsub_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsub_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsub_d(a, b) } +pub fn lsx_vsub_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsub_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubi_bu(a: v16i8) -> v16i8 { +pub fn lsx_vsubi_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsubi_bu(a, IMM5) } + unsafe { transmute(__lsx_vsubi_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubi_hu(a: v8i16) -> v8i16 { +pub fn lsx_vsubi_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsubi_hu(a, IMM5) } + unsafe { transmute(__lsx_vsubi_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubi_wu(a: v4i32) -> v4i32 { +pub fn lsx_vsubi_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsubi_wu(a, IMM5) } + unsafe { transmute(__lsx_vsubi_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubi_du(a: v2i64) -> v2i64 { +pub fn lsx_vsubi_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsubi_du(a, IMM5) } + unsafe { transmute(__lsx_vsubi_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vmax_b(a, b) } +pub fn lsx_vmax_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vmax_h(a, b) } +pub fn lsx_vmax_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vmax_w(a, b) } +pub fn lsx_vmax_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmax_d(a, b) } +pub fn lsx_vmax_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_b(a: v16i8) -> v16i8 { +pub fn lsx_vmaxi_b(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmaxi_b(a, IMM_S5) } + unsafe { transmute(__lsx_vmaxi_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_h(a: v8i16) -> v8i16 { +pub fn lsx_vmaxi_h(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmaxi_h(a, IMM_S5) } + unsafe { transmute(__lsx_vmaxi_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_w(a: v4i32) -> v4i32 { +pub fn lsx_vmaxi_w(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmaxi_w(a, IMM_S5) } + unsafe { transmute(__lsx_vmaxi_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_d(a: v2i64) -> v2i64 { +pub fn lsx_vmaxi_d(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmaxi_d(a, IMM_S5) } + unsafe { transmute(__lsx_vmaxi_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vmax_bu(a, b) } +pub fn lsx_vmax_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vmax_hu(a, b) } +pub fn lsx_vmax_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vmax_wu(a, b) } +pub fn lsx_vmax_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmax_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vmax_du(a, b) } +pub fn lsx_vmax_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmax_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_bu(a: v16u8) -> v16u8 { +pub fn lsx_vmaxi_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmaxi_bu(a, IMM5) } + unsafe { transmute(__lsx_vmaxi_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_hu(a: v8u16) -> v8u16 { +pub fn lsx_vmaxi_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmaxi_hu(a, IMM5) } + unsafe { transmute(__lsx_vmaxi_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_wu(a: v4u32) -> v4u32 { +pub fn lsx_vmaxi_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmaxi_wu(a, IMM5) } + unsafe { transmute(__lsx_vmaxi_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaxi_du(a: v2u64) -> v2u64 { +pub fn lsx_vmaxi_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmaxi_du(a, IMM5) } + unsafe { transmute(__lsx_vmaxi_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vmin_b(a, b) } +pub fn lsx_vmin_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vmin_h(a, b) } +pub fn lsx_vmin_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vmin_w(a, b) } +pub fn lsx_vmin_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmin_d(a, b) } +pub fn lsx_vmin_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_b(a: v16i8) -> v16i8 { +pub fn lsx_vmini_b(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmini_b(a, IMM_S5) } + unsafe { transmute(__lsx_vmini_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_h(a: v8i16) -> v8i16 { +pub fn lsx_vmini_h(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmini_h(a, IMM_S5) } + unsafe { transmute(__lsx_vmini_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_w(a: v4i32) -> v4i32 { +pub fn lsx_vmini_w(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmini_w(a, IMM_S5) } + unsafe { transmute(__lsx_vmini_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_d(a: v2i64) -> v2i64 { +pub fn lsx_vmini_d(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vmini_d(a, IMM_S5) } + unsafe { transmute(__lsx_vmini_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vmin_bu(a, b) } +pub fn lsx_vmin_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vmin_hu(a, b) } +pub fn lsx_vmin_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vmin_wu(a, b) } +pub fn lsx_vmin_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmin_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vmin_du(a, b) } +pub fn lsx_vmin_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmin_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_bu(a: v16u8) -> v16u8 { +pub fn lsx_vmini_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmini_bu(a, IMM5) } + unsafe { transmute(__lsx_vmini_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_hu(a: v8u16) -> v8u16 { +pub fn lsx_vmini_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmini_hu(a, IMM5) } + unsafe { transmute(__lsx_vmini_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_wu(a: v4u32) -> v4u32 { +pub fn lsx_vmini_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmini_wu(a, IMM5) } + unsafe { transmute(__lsx_vmini_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmini_du(a: v2u64) -> v2u64 { +pub fn lsx_vmini_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vmini_du(a, IMM5) } + unsafe { transmute(__lsx_vmini_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseq_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vseq_b(a, b) } +pub fn lsx_vseq_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vseq_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseq_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vseq_h(a, b) } +pub fn lsx_vseq_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vseq_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseq_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vseq_w(a, b) } +pub fn lsx_vseq_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vseq_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseq_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vseq_d(a, b) } +pub fn lsx_vseq_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vseq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseqi_b(a: v16i8) -> v16i8 { +pub fn lsx_vseqi_b(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vseqi_b(a, IMM_S5) } + unsafe { transmute(__lsx_vseqi_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseqi_h(a: v8i16) -> v8i16 { +pub fn lsx_vseqi_h(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vseqi_h(a, IMM_S5) } + unsafe { transmute(__lsx_vseqi_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseqi_w(a: v4i32) -> v4i32 { +pub fn lsx_vseqi_w(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vseqi_w(a, IMM_S5) } + unsafe { transmute(__lsx_vseqi_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vseqi_d(a: v2i64) -> v2i64 { +pub fn lsx_vseqi_d(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vseqi_d(a, IMM_S5) } + unsafe { transmute(__lsx_vseqi_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_b(a: v16i8) -> v16i8 { +pub fn lsx_vslti_b(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslti_b(a, IMM_S5) } + unsafe { transmute(__lsx_vslti_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vslt_b(a, b) } +pub fn lsx_vslt_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vslt_h(a, b) } +pub fn lsx_vslt_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vslt_w(a, b) } +pub fn lsx_vslt_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vslt_d(a, b) } +pub fn lsx_vslt_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_h(a: v8i16) -> v8i16 { +pub fn lsx_vslti_h(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslti_h(a, IMM_S5) } + unsafe { transmute(__lsx_vslti_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_w(a: v4i32) -> v4i32 { +pub fn lsx_vslti_w(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslti_w(a, IMM_S5) } + unsafe { transmute(__lsx_vslti_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_d(a: v2i64) -> v2i64 { +pub fn lsx_vslti_d(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslti_d(a, IMM_S5) } + unsafe { transmute(__lsx_vslti_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_bu(a: v16u8, b: v16u8) -> v16i8 { - unsafe { __lsx_vslt_bu(a, b) } +pub fn lsx_vslt_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_hu(a: v8u16, b: v8u16) -> v8i16 { - unsafe { __lsx_vslt_hu(a, b) } +pub fn lsx_vslt_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_wu(a: v4u32, b: v4u32) -> v4i32 { - unsafe { __lsx_vslt_wu(a, b) } +pub fn lsx_vslt_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslt_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vslt_du(a, b) } +pub fn lsx_vslt_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vslt_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_bu(a: v16u8) -> v16i8 { +pub fn lsx_vslti_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslti_bu(a, IMM5) } + unsafe { transmute(__lsx_vslti_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_hu(a: v8u16) -> v8i16 { +pub fn lsx_vslti_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslti_hu(a, IMM5) } + unsafe { transmute(__lsx_vslti_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_wu(a: v4u32) -> v4i32 { +pub fn lsx_vslti_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslti_wu(a, IMM5) } + unsafe { transmute(__lsx_vslti_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslti_du(a: v2u64) -> v2i64 { +pub fn lsx_vslti_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslti_du(a, IMM5) } + unsafe { transmute(__lsx_vslti_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsle_b(a, b) } +pub fn lsx_vsle_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsle_h(a, b) } +pub fn lsx_vsle_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsle_w(a, b) } +pub fn lsx_vsle_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsle_d(a, b) } +pub fn lsx_vsle_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_b(a: v16i8) -> v16i8 { +pub fn lsx_vslei_b(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslei_b(a, IMM_S5) } + unsafe { transmute(__lsx_vslei_b(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_h(a: v8i16) -> v8i16 { +pub fn lsx_vslei_h(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslei_h(a, IMM_S5) } + unsafe { transmute(__lsx_vslei_h(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_w(a: v4i32) -> v4i32 { +pub fn lsx_vslei_w(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslei_w(a, IMM_S5) } + unsafe { transmute(__lsx_vslei_w(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_d(a: v2i64) -> v2i64 { +pub fn lsx_vslei_d(a: m128i) -> m128i { static_assert_simm_bits!(IMM_S5, 5); - unsafe { __lsx_vslei_d(a, IMM_S5) } + unsafe { transmute(__lsx_vslei_d(transmute(a), IMM_S5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_bu(a: v16u8, b: v16u8) -> v16i8 { - unsafe { __lsx_vsle_bu(a, b) } +pub fn lsx_vsle_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_hu(a: v8u16, b: v8u16) -> v8i16 { - unsafe { __lsx_vsle_hu(a, b) } +pub fn lsx_vsle_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_wu(a: v4u32, b: v4u32) -> v4i32 { - unsafe { __lsx_vsle_wu(a, b) } +pub fn lsx_vsle_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsle_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vsle_du(a, b) } +pub fn lsx_vsle_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsle_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_bu(a: v16u8) -> v16i8 { +pub fn lsx_vslei_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslei_bu(a, IMM5) } + unsafe { transmute(__lsx_vslei_bu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_hu(a: v8u16) -> v8i16 { +pub fn lsx_vslei_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslei_hu(a, IMM5) } + unsafe { transmute(__lsx_vslei_hu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_wu(a: v4u32) -> v4i32 { +pub fn lsx_vslei_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslei_wu(a, IMM5) } + unsafe { transmute(__lsx_vslei_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vslei_du(a: v2u64) -> v2i64 { +pub fn lsx_vslei_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vslei_du(a, IMM5) } + unsafe { transmute(__lsx_vslei_du(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_b(a: v16i8) -> v16i8 { +pub fn lsx_vsat_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsat_b(a, IMM3) } + unsafe { transmute(__lsx_vsat_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_h(a: v8i16) -> v8i16 { +pub fn lsx_vsat_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsat_h(a, IMM4) } + unsafe { transmute(__lsx_vsat_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_w(a: v4i32) -> v4i32 { +pub fn lsx_vsat_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsat_w(a, IMM5) } + unsafe { transmute(__lsx_vsat_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_d(a: v2i64) -> v2i64 { +pub fn lsx_vsat_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsat_d(a, IMM6) } + unsafe { transmute(__lsx_vsat_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_bu(a: v16u8) -> v16u8 { +pub fn lsx_vsat_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsat_bu(a, IMM3) } + unsafe { transmute(__lsx_vsat_bu(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_hu(a: v8u16) -> v8u16 { +pub fn lsx_vsat_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsat_hu(a, IMM4) } + unsafe { transmute(__lsx_vsat_hu(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_wu(a: v4u32) -> v4u32 { +pub fn lsx_vsat_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsat_wu(a, IMM5) } + unsafe { transmute(__lsx_vsat_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsat_du(a: v2u64) -> v2u64 { +pub fn lsx_vsat_du(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsat_du(a, IMM6) } + unsafe { transmute(__lsx_vsat_du(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadda_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vadda_b(a, b) } +pub fn lsx_vadda_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadda_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadda_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vadda_h(a, b) } +pub fn lsx_vadda_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadda_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadda_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vadda_w(a, b) } +pub fn lsx_vadda_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadda_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadda_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vadda_d(a, b) } +pub fn lsx_vadda_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadda_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsadd_b(a, b) } +pub fn lsx_vsadd_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsadd_h(a, b) } +pub fn lsx_vsadd_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsadd_w(a, b) } +pub fn lsx_vsadd_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsadd_d(a, b) } +pub fn lsx_vsadd_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vsadd_bu(a, b) } +pub fn lsx_vsadd_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vsadd_hu(a, b) } +pub fn lsx_vsadd_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vsadd_wu(a, b) } +pub fn lsx_vsadd_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsadd_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vsadd_du(a, b) } +pub fn lsx_vsadd_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsadd_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vavg_b(a, b) } +pub fn lsx_vavg_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vavg_h(a, b) } +pub fn lsx_vavg_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vavg_w(a, b) } +pub fn lsx_vavg_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vavg_d(a, b) } +pub fn lsx_vavg_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vavg_bu(a, b) } +pub fn lsx_vavg_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vavg_hu(a, b) } +pub fn lsx_vavg_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vavg_wu(a, b) } +pub fn lsx_vavg_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavg_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vavg_du(a, b) } +pub fn lsx_vavg_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavg_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vavgr_b(a, b) } +pub fn lsx_vavgr_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vavgr_h(a, b) } +pub fn lsx_vavgr_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vavgr_w(a, b) } +pub fn lsx_vavgr_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vavgr_d(a, b) } +pub fn lsx_vavgr_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vavgr_bu(a, b) } +pub fn lsx_vavgr_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vavgr_hu(a, b) } +pub fn lsx_vavgr_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vavgr_wu(a, b) } +pub fn lsx_vavgr_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vavgr_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vavgr_du(a, b) } +pub fn lsx_vavgr_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vavgr_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vssub_b(a, b) } +pub fn lsx_vssub_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vssub_h(a, b) } +pub fn lsx_vssub_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vssub_w(a, b) } +pub fn lsx_vssub_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vssub_d(a, b) } +pub fn lsx_vssub_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vssub_bu(a, b) } +pub fn lsx_vssub_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vssub_hu(a, b) } +pub fn lsx_vssub_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vssub_wu(a, b) } +pub fn lsx_vssub_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssub_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vssub_du(a, b) } +pub fn lsx_vssub_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssub_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vabsd_b(a, b) } +pub fn lsx_vabsd_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vabsd_h(a, b) } +pub fn lsx_vabsd_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vabsd_w(a, b) } +pub fn lsx_vabsd_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vabsd_d(a, b) } +pub fn lsx_vabsd_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vabsd_bu(a, b) } +pub fn lsx_vabsd_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vabsd_hu(a, b) } +pub fn lsx_vabsd_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vabsd_wu(a, b) } +pub fn lsx_vabsd_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vabsd_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vabsd_du(a, b) } +pub fn lsx_vabsd_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vabsd_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmul_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vmul_b(a, b) } +pub fn lsx_vmul_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmul_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmul_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vmul_h(a, b) } +pub fn lsx_vmul_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmul_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmul_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vmul_w(a, b) } +pub fn lsx_vmul_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmul_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmul_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmul_d(a, b) } +pub fn lsx_vmul_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmul_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmadd_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - unsafe { __lsx_vmadd_b(a, b, c) } +pub fn lsx_vmadd_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmadd_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmadd_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - unsafe { __lsx_vmadd_h(a, b, c) } +pub fn lsx_vmadd_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmadd_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmadd_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { - unsafe { __lsx_vmadd_w(a, b, c) } +pub fn lsx_vmadd_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmadd_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmadd_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - unsafe { __lsx_vmadd_d(a, b, c) } +pub fn lsx_vmadd_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmadd_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmsub_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - unsafe { __lsx_vmsub_b(a, b, c) } +pub fn lsx_vmsub_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmsub_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmsub_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - unsafe { __lsx_vmsub_h(a, b, c) } +pub fn lsx_vmsub_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmsub_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmsub_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { - unsafe { __lsx_vmsub_w(a, b, c) } +pub fn lsx_vmsub_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmsub_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmsub_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - unsafe { __lsx_vmsub_d(a, b, c) } +pub fn lsx_vmsub_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmsub_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vdiv_b(a, b) } +pub fn lsx_vdiv_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vdiv_h(a, b) } +pub fn lsx_vdiv_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vdiv_w(a, b) } +pub fn lsx_vdiv_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vdiv_d(a, b) } +pub fn lsx_vdiv_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vdiv_bu(a, b) } +pub fn lsx_vdiv_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vdiv_hu(a, b) } +pub fn lsx_vdiv_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vdiv_wu(a, b) } +pub fn lsx_vdiv_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vdiv_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vdiv_du(a, b) } +pub fn lsx_vdiv_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vhaddw_h_b(a, b) } +pub fn lsx_vhaddw_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vhaddw_w_h(a, b) } +pub fn lsx_vhaddw_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vhaddw_d_w(a, b) } +pub fn lsx_vhaddw_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_hu_bu(a: v16u8, b: v16u8) -> v8u16 { - unsafe { __lsx_vhaddw_hu_bu(a, b) } +pub fn lsx_vhaddw_hu_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_hu_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_wu_hu(a: v8u16, b: v8u16) -> v4u32 { - unsafe { __lsx_vhaddw_wu_hu(a, b) } +pub fn lsx_vhaddw_wu_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_wu_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_du_wu(a: v4u32, b: v4u32) -> v2u64 { - unsafe { __lsx_vhaddw_du_wu(a, b) } +pub fn lsx_vhaddw_du_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_du_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vhsubw_h_b(a, b) } +pub fn lsx_vhsubw_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vhsubw_w_h(a, b) } +pub fn lsx_vhsubw_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vhsubw_d_w(a, b) } +pub fn lsx_vhsubw_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_hu_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vhsubw_hu_bu(a, b) } +pub fn lsx_vhsubw_hu_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_hu_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_wu_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vhsubw_wu_hu(a, b) } +pub fn lsx_vhsubw_wu_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_wu_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_du_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vhsubw_du_wu(a, b) } +pub fn lsx_vhsubw_du_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_du_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vmod_b(a, b) } +pub fn lsx_vmod_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vmod_h(a, b) } +pub fn lsx_vmod_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vmod_w(a, b) } +pub fn lsx_vmod_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmod_d(a, b) } +pub fn lsx_vmod_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vmod_bu(a, b) } +pub fn lsx_vmod_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vmod_hu(a, b) } +pub fn lsx_vmod_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vmod_wu(a, b) } +pub fn lsx_vmod_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmod_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vmod_du(a, b) } +pub fn lsx_vmod_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplve_b(a: v16i8, b: i32) -> v16i8 { - unsafe { __lsx_vreplve_b(a, b) } +pub fn lsx_vreplve_b(a: m128i, b: i32) -> m128i { + unsafe { transmute(__lsx_vreplve_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplve_h(a: v8i16, b: i32) -> v8i16 { - unsafe { __lsx_vreplve_h(a, b) } +pub fn lsx_vreplve_h(a: m128i, b: i32) -> m128i { + unsafe { transmute(__lsx_vreplve_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplve_w(a: v4i32, b: i32) -> v4i32 { - unsafe { __lsx_vreplve_w(a, b) } +pub fn lsx_vreplve_w(a: m128i, b: i32) -> m128i { + unsafe { transmute(__lsx_vreplve_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplve_d(a: v2i64, b: i32) -> v2i64 { - unsafe { __lsx_vreplve_d(a, b) } +pub fn lsx_vreplve_d(a: m128i, b: i32) -> m128i { + unsafe { transmute(__lsx_vreplve_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplvei_b(a: v16i8) -> v16i8 { +pub fn lsx_vreplvei_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vreplvei_b(a, IMM4) } + unsafe { transmute(__lsx_vreplvei_b(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplvei_h(a: v8i16) -> v8i16 { +pub fn lsx_vreplvei_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vreplvei_h(a, IMM3) } + unsafe { transmute(__lsx_vreplvei_h(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplvei_w(a: v4i32) -> v4i32 { +pub fn lsx_vreplvei_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lsx_vreplvei_w(a, IMM2) } + unsafe { transmute(__lsx_vreplvei_w(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplvei_d(a: v2i64) -> v2i64 { +pub fn lsx_vreplvei_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM1, 1); - unsafe { __lsx_vreplvei_d(a, IMM1) } + unsafe { transmute(__lsx_vreplvei_d(transmute(a), IMM1)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickev_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vpickev_b(a, b) } +pub fn lsx_vpickev_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickev_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickev_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vpickev_h(a, b) } +pub fn lsx_vpickev_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickev_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickev_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vpickev_w(a, b) } +pub fn lsx_vpickev_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickev_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickev_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vpickev_d(a, b) } +pub fn lsx_vpickev_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickev_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickod_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vpickod_b(a, b) } +pub fn lsx_vpickod_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickod_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickod_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vpickod_h(a, b) } +pub fn lsx_vpickod_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickod_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickod_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vpickod_w(a, b) } +pub fn lsx_vpickod_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickod_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickod_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vpickod_d(a, b) } +pub fn lsx_vpickod_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpickod_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvh_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vilvh_b(a, b) } +pub fn lsx_vilvh_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvh_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvh_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vilvh_h(a, b) } +pub fn lsx_vilvh_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvh_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvh_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vilvh_w(a, b) } +pub fn lsx_vilvh_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvh_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvh_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vilvh_d(a, b) } +pub fn lsx_vilvh_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvh_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvl_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vilvl_b(a, b) } +pub fn lsx_vilvl_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvl_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvl_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vilvl_h(a, b) } +pub fn lsx_vilvl_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvl_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvl_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vilvl_w(a, b) } +pub fn lsx_vilvl_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvl_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vilvl_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vilvl_d(a, b) } +pub fn lsx_vilvl_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vilvl_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackev_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vpackev_b(a, b) } +pub fn lsx_vpackev_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackev_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackev_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vpackev_h(a, b) } +pub fn lsx_vpackev_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackev_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackev_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vpackev_w(a, b) } +pub fn lsx_vpackev_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackev_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackev_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vpackev_d(a, b) } +pub fn lsx_vpackev_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackev_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackod_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vpackod_b(a, b) } +pub fn lsx_vpackod_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackod_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackod_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vpackod_h(a, b) } +pub fn lsx_vpackod_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackod_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackod_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vpackod_w(a, b) } +pub fn lsx_vpackod_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackod_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpackod_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vpackod_d(a, b) } +pub fn lsx_vpackod_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vpackod_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - unsafe { __lsx_vshuf_h(a, b, c) } +pub fn lsx_vshuf_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vshuf_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf_w(a: v4i32, b: v4i32, c: v4i32) -> v4i32 { - unsafe { __lsx_vshuf_w(a, b, c) } +pub fn lsx_vshuf_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vshuf_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - unsafe { __lsx_vshuf_d(a, b, c) } +pub fn lsx_vshuf_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vshuf_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vand_v(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vand_v(a, b) } +pub fn lsx_vand_v(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vand_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vandi_b(a: v16u8) -> v16u8 { +pub fn lsx_vandi_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vandi_b(a, IMM8) } + unsafe { transmute(__lsx_vandi_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vor_v(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vor_v(a, b) } +pub fn lsx_vor_v(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vor_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vori_b(a: v16u8) -> v16u8 { +pub fn lsx_vori_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vori_b(a, IMM8) } + unsafe { transmute(__lsx_vori_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vnor_v(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vnor_v(a, b) } +pub fn lsx_vnor_v(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vnor_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vnori_b(a: v16u8) -> v16u8 { +pub fn lsx_vnori_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vnori_b(a, IMM8) } + unsafe { transmute(__lsx_vnori_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vxor_v(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vxor_v(a, b) } +pub fn lsx_vxor_v(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vxor_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vxori_b(a: v16u8) -> v16u8 { +pub fn lsx_vxori_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vxori_b(a, IMM8) } + unsafe { transmute(__lsx_vxori_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitsel_v(a: v16u8, b: v16u8, c: v16u8) -> v16u8 { - unsafe { __lsx_vbitsel_v(a, b, c) } +pub fn lsx_vbitsel_v(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vbitsel_v(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbitseli_b(a: v16u8, b: v16u8) -> v16u8 { +pub fn lsx_vbitseli_b(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vbitseli_b(a, b, IMM8) } + unsafe { transmute(__lsx_vbitseli_b(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf4i_b(a: v16i8) -> v16i8 { +pub fn lsx_vshuf4i_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vshuf4i_b(a, IMM8) } + unsafe { transmute(__lsx_vshuf4i_b(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf4i_h(a: v8i16) -> v8i16 { +pub fn lsx_vshuf4i_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vshuf4i_h(a, IMM8) } + unsafe { transmute(__lsx_vshuf4i_h(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf4i_w(a: v4i32) -> v4i32 { +pub fn lsx_vshuf4i_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vshuf4i_w(a, IMM8) } + unsafe { transmute(__lsx_vshuf4i_w(transmute(a), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplgr2vr_b(a: i32) -> v16i8 { - unsafe { __lsx_vreplgr2vr_b(a) } +pub fn lsx_vreplgr2vr_b(a: i32) -> m128i { + unsafe { transmute(__lsx_vreplgr2vr_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplgr2vr_h(a: i32) -> v8i16 { - unsafe { __lsx_vreplgr2vr_h(a) } +pub fn lsx_vreplgr2vr_h(a: i32) -> m128i { + unsafe { transmute(__lsx_vreplgr2vr_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplgr2vr_w(a: i32) -> v4i32 { - unsafe { __lsx_vreplgr2vr_w(a) } +pub fn lsx_vreplgr2vr_w(a: i32) -> m128i { + unsafe { transmute(__lsx_vreplgr2vr_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vreplgr2vr_d(a: i64) -> v2i64 { - unsafe { __lsx_vreplgr2vr_d(a) } +pub fn lsx_vreplgr2vr_d(a: i64) -> m128i { + unsafe { transmute(__lsx_vreplgr2vr_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpcnt_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vpcnt_b(a) } +pub fn lsx_vpcnt_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vpcnt_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpcnt_h(a: v8i16) -> v8i16 { - unsafe { __lsx_vpcnt_h(a) } +pub fn lsx_vpcnt_h(a: m128i) -> m128i { + unsafe { transmute(__lsx_vpcnt_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpcnt_w(a: v4i32) -> v4i32 { - unsafe { __lsx_vpcnt_w(a) } +pub fn lsx_vpcnt_w(a: m128i) -> m128i { + unsafe { transmute(__lsx_vpcnt_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpcnt_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vpcnt_d(a) } +pub fn lsx_vpcnt_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vpcnt_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclo_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vclo_b(a) } +pub fn lsx_vclo_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclo_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclo_h(a: v8i16) -> v8i16 { - unsafe { __lsx_vclo_h(a) } +pub fn lsx_vclo_h(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclo_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclo_w(a: v4i32) -> v4i32 { - unsafe { __lsx_vclo_w(a) } +pub fn lsx_vclo_w(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclo_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclo_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vclo_d(a) } +pub fn lsx_vclo_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclo_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclz_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vclz_b(a) } +pub fn lsx_vclz_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclz_h(a: v8i16) -> v8i16 { - unsafe { __lsx_vclz_h(a) } +pub fn lsx_vclz_h(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclz_w(a: v4i32) -> v4i32 { - unsafe { __lsx_vclz_w(a) } +pub fn lsx_vclz_w(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vclz_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vclz_d(a) } +pub fn lsx_vclz_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vclz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_b(a: v16i8) -> i32 { +pub fn lsx_vpickve2gr_b(a: m128i) -> i32 { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vpickve2gr_b(a, IMM4) } + unsafe { transmute(__lsx_vpickve2gr_b(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_h(a: v8i16) -> i32 { +pub fn lsx_vpickve2gr_h(a: m128i) -> i32 { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vpickve2gr_h(a, IMM3) } + unsafe { transmute(__lsx_vpickve2gr_h(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_w(a: v4i32) -> i32 { +pub fn lsx_vpickve2gr_w(a: m128i) -> i32 { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lsx_vpickve2gr_w(a, IMM2) } + unsafe { transmute(__lsx_vpickve2gr_w(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_d(a: v2i64) -> i64 { +pub fn lsx_vpickve2gr_d(a: m128i) -> i64 { static_assert_uimm_bits!(IMM1, 1); - unsafe { __lsx_vpickve2gr_d(a, IMM1) } + unsafe { transmute(__lsx_vpickve2gr_d(transmute(a), IMM1)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_bu(a: v16i8) -> u32 { +pub fn lsx_vpickve2gr_bu(a: m128i) -> u32 { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vpickve2gr_bu(a, IMM4) } + unsafe { transmute(__lsx_vpickve2gr_bu(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_hu(a: v8i16) -> u32 { +pub fn lsx_vpickve2gr_hu(a: m128i) -> u32 { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vpickve2gr_hu(a, IMM3) } + unsafe { transmute(__lsx_vpickve2gr_hu(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_wu(a: v4i32) -> u32 { +pub fn lsx_vpickve2gr_wu(a: m128i) -> u32 { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lsx_vpickve2gr_wu(a, IMM2) } + unsafe { transmute(__lsx_vpickve2gr_wu(transmute(a), IMM2)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpickve2gr_du(a: v2i64) -> u64 { +pub fn lsx_vpickve2gr_du(a: m128i) -> u64 { static_assert_uimm_bits!(IMM1, 1); - unsafe { __lsx_vpickve2gr_du(a, IMM1) } + unsafe { transmute(__lsx_vpickve2gr_du(transmute(a), IMM1)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vinsgr2vr_b(a: v16i8, b: i32) -> v16i8 { +pub fn lsx_vinsgr2vr_b(a: m128i, b: i32) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vinsgr2vr_b(a, b, IMM4) } + unsafe { transmute(__lsx_vinsgr2vr_b(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vinsgr2vr_h(a: v8i16, b: i32) -> v8i16 { +pub fn lsx_vinsgr2vr_h(a: m128i, b: i32) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vinsgr2vr_h(a, b, IMM3) } + unsafe { transmute(__lsx_vinsgr2vr_h(transmute(a), transmute(b), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vinsgr2vr_w(a: v4i32, b: i32) -> v4i32 { +pub fn lsx_vinsgr2vr_w(a: m128i, b: i32) -> m128i { static_assert_uimm_bits!(IMM2, 2); - unsafe { __lsx_vinsgr2vr_w(a, b, IMM2) } + unsafe { transmute(__lsx_vinsgr2vr_w(transmute(a), transmute(b), IMM2)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vinsgr2vr_d(a: v2i64, b: i64) -> v2i64 { +pub fn lsx_vinsgr2vr_d(a: m128i, b: i64) -> m128i { static_assert_uimm_bits!(IMM1, 1); - unsafe { __lsx_vinsgr2vr_d(a, b, IMM1) } + unsafe { transmute(__lsx_vinsgr2vr_d(transmute(a), transmute(b), IMM1)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfadd_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfadd_s(a, b) } +pub fn lsx_vfadd_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfadd_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfadd_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfadd_d(a, b) } +pub fn lsx_vfadd_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfadd_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfsub_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfsub_s(a, b) } +pub fn lsx_vfsub_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfsub_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfsub_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfsub_d(a, b) } +pub fn lsx_vfsub_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfsub_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmul_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfmul_s(a, b) } +pub fn lsx_vfmul_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfmul_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmul_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfmul_d(a, b) } +pub fn lsx_vfmul_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfmul_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfdiv_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfdiv_s(a, b) } +pub fn lsx_vfdiv_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfdiv_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfdiv_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfdiv_d(a, b) } +pub fn lsx_vfdiv_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfdiv_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcvt_h_s(a: v4f32, b: v4f32) -> v8i16 { - unsafe { __lsx_vfcvt_h_s(a, b) } +pub fn lsx_vfcvt_h_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcvt_h_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcvt_s_d(a: v2f64, b: v2f64) -> v4f32 { - unsafe { __lsx_vfcvt_s_d(a, b) } +pub fn lsx_vfcvt_s_d(a: m128d, b: m128d) -> m128 { + unsafe { transmute(__lsx_vfcvt_s_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmin_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfmin_s(a, b) } +pub fn lsx_vfmin_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfmin_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmin_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfmin_d(a, b) } +pub fn lsx_vfmin_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfmin_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmina_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfmina_s(a, b) } +pub fn lsx_vfmina_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfmina_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmina_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfmina_d(a, b) } +pub fn lsx_vfmina_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfmina_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmax_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfmax_s(a, b) } +pub fn lsx_vfmax_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfmax_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmax_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfmax_d(a, b) } +pub fn lsx_vfmax_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfmax_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmaxa_s(a: v4f32, b: v4f32) -> v4f32 { - unsafe { __lsx_vfmaxa_s(a, b) } +pub fn lsx_vfmaxa_s(a: m128, b: m128) -> m128 { + unsafe { transmute(__lsx_vfmaxa_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmaxa_d(a: v2f64, b: v2f64) -> v2f64 { - unsafe { __lsx_vfmaxa_d(a, b) } +pub fn lsx_vfmaxa_d(a: m128d, b: m128d) -> m128d { + unsafe { transmute(__lsx_vfmaxa_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfclass_s(a: v4f32) -> v4i32 { - unsafe { __lsx_vfclass_s(a) } +pub fn lsx_vfclass_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vfclass_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfclass_d(a: v2f64) -> v2i64 { - unsafe { __lsx_vfclass_d(a) } +pub fn lsx_vfclass_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vfclass_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfsqrt_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfsqrt_s(a) } +pub fn lsx_vfsqrt_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfsqrt_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfsqrt_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfsqrt_d(a) } +pub fn lsx_vfsqrt_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfsqrt_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrecip_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrecip_s(a) } +pub fn lsx_vfrecip_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrecip_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrecip_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrecip_d(a) } +pub fn lsx_vfrecip_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrecip_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrecipe_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrecipe_s(a) } +pub fn lsx_vfrecipe_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrecipe_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrecipe_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrecipe_d(a) } +pub fn lsx_vfrecipe_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrecipe_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrsqrte_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrsqrte_s(a) } +pub fn lsx_vfrsqrte_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrsqrte_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx,frecipe")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrsqrte_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrsqrte_d(a) } +pub fn lsx_vfrsqrte_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrsqrte_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrint_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrint_s(a) } +pub fn lsx_vfrint_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrint_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrint_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrint_d(a) } +pub fn lsx_vfrint_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrint_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrsqrt_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrsqrt_s(a) } +pub fn lsx_vfrsqrt_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrsqrt_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrsqrt_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrsqrt_d(a) } +pub fn lsx_vfrsqrt_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrsqrt_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vflogb_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vflogb_s(a) } +pub fn lsx_vflogb_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vflogb_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vflogb_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vflogb_d(a) } +pub fn lsx_vflogb_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vflogb_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcvth_s_h(a: v8i16) -> v4f32 { - unsafe { __lsx_vfcvth_s_h(a) } +pub fn lsx_vfcvth_s_h(a: m128i) -> m128 { + unsafe { transmute(__lsx_vfcvth_s_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcvth_d_s(a: v4f32) -> v2f64 { - unsafe { __lsx_vfcvth_d_s(a) } +pub fn lsx_vfcvth_d_s(a: m128) -> m128d { + unsafe { transmute(__lsx_vfcvth_d_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcvtl_s_h(a: v8i16) -> v4f32 { - unsafe { __lsx_vfcvtl_s_h(a) } +pub fn lsx_vfcvtl_s_h(a: m128i) -> m128 { + unsafe { transmute(__lsx_vfcvtl_s_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcvtl_d_s(a: v4f32) -> v2f64 { - unsafe { __lsx_vfcvtl_d_s(a) } +pub fn lsx_vfcvtl_d_s(a: m128) -> m128d { + unsafe { transmute(__lsx_vfcvtl_d_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftint_w_s(a: v4f32) -> v4i32 { - unsafe { __lsx_vftint_w_s(a) } +pub fn lsx_vftint_w_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftint_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftint_l_d(a: v2f64) -> v2i64 { - unsafe { __lsx_vftint_l_d(a) } +pub fn lsx_vftint_l_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftint_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftint_wu_s(a: v4f32) -> v4u32 { - unsafe { __lsx_vftint_wu_s(a) } +pub fn lsx_vftint_wu_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftint_wu_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftint_lu_d(a: v2f64) -> v2u64 { - unsafe { __lsx_vftint_lu_d(a) } +pub fn lsx_vftint_lu_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftint_lu_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrz_w_s(a: v4f32) -> v4i32 { - unsafe { __lsx_vftintrz_w_s(a) } +pub fn lsx_vftintrz_w_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrz_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrz_l_d(a: v2f64) -> v2i64 { - unsafe { __lsx_vftintrz_l_d(a) } +pub fn lsx_vftintrz_l_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrz_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrz_wu_s(a: v4f32) -> v4u32 { - unsafe { __lsx_vftintrz_wu_s(a) } +pub fn lsx_vftintrz_wu_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrz_wu_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrz_lu_d(a: v2f64) -> v2u64 { - unsafe { __lsx_vftintrz_lu_d(a) } +pub fn lsx_vftintrz_lu_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrz_lu_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffint_s_w(a: v4i32) -> v4f32 { - unsafe { __lsx_vffint_s_w(a) } +pub fn lsx_vffint_s_w(a: m128i) -> m128 { + unsafe { transmute(__lsx_vffint_s_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffint_d_l(a: v2i64) -> v2f64 { - unsafe { __lsx_vffint_d_l(a) } +pub fn lsx_vffint_d_l(a: m128i) -> m128d { + unsafe { transmute(__lsx_vffint_d_l(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffint_s_wu(a: v4u32) -> v4f32 { - unsafe { __lsx_vffint_s_wu(a) } +pub fn lsx_vffint_s_wu(a: m128i) -> m128 { + unsafe { transmute(__lsx_vffint_s_wu(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffint_d_lu(a: v2u64) -> v2f64 { - unsafe { __lsx_vffint_d_lu(a) } +pub fn lsx_vffint_d_lu(a: m128i) -> m128d { + unsafe { transmute(__lsx_vffint_d_lu(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vandn_v(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vandn_v(a, b) } +pub fn lsx_vandn_v(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vandn_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vneg_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vneg_b(a) } +pub fn lsx_vneg_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vneg_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vneg_h(a: v8i16) -> v8i16 { - unsafe { __lsx_vneg_h(a) } +pub fn lsx_vneg_h(a: m128i) -> m128i { + unsafe { transmute(__lsx_vneg_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vneg_w(a: v4i32) -> v4i32 { - unsafe { __lsx_vneg_w(a) } +pub fn lsx_vneg_w(a: m128i) -> m128i { + unsafe { transmute(__lsx_vneg_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vneg_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vneg_d(a) } +pub fn lsx_vneg_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vneg_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vmuh_b(a, b) } +pub fn lsx_vmuh_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vmuh_h(a, b) } +pub fn lsx_vmuh_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vmuh_w(a, b) } +pub fn lsx_vmuh_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmuh_d(a, b) } +pub fn lsx_vmuh_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_bu(a: v16u8, b: v16u8) -> v16u8 { - unsafe { __lsx_vmuh_bu(a, b) } +pub fn lsx_vmuh_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_hu(a: v8u16, b: v8u16) -> v8u16 { - unsafe { __lsx_vmuh_hu(a, b) } +pub fn lsx_vmuh_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_wu(a: v4u32, b: v4u32) -> v4u32 { - unsafe { __lsx_vmuh_wu(a, b) } +pub fn lsx_vmuh_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmuh_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vmuh_du(a, b) } +pub fn lsx_vmuh_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmuh_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsllwil_h_b(a: v16i8) -> v8i16 { +pub fn lsx_vsllwil_h_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsllwil_h_b(a, IMM3) } + unsafe { transmute(__lsx_vsllwil_h_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsllwil_w_h(a: v8i16) -> v4i32 { +pub fn lsx_vsllwil_w_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsllwil_w_h(a, IMM4) } + unsafe { transmute(__lsx_vsllwil_w_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsllwil_d_w(a: v4i32) -> v2i64 { +pub fn lsx_vsllwil_d_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsllwil_d_w(a, IMM5) } + unsafe { transmute(__lsx_vsllwil_d_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsllwil_hu_bu(a: v16u8) -> v8u16 { +pub fn lsx_vsllwil_hu_bu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vsllwil_hu_bu(a, IMM3) } + unsafe { transmute(__lsx_vsllwil_hu_bu(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsllwil_wu_hu(a: v8u16) -> v4u32 { +pub fn lsx_vsllwil_wu_hu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsllwil_wu_hu(a, IMM4) } + unsafe { transmute(__lsx_vsllwil_wu_hu(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsllwil_du_wu(a: v4u32) -> v2u64 { +pub fn lsx_vsllwil_du_wu(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsllwil_du_wu(a, IMM5) } + unsafe { transmute(__lsx_vsllwil_du_wu(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsran_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vsran_b_h(a, b) } +pub fn lsx_vsran_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsran_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsran_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vsran_h_w(a, b) } +pub fn lsx_vsran_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsran_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsran_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vsran_w_d(a, b) } +pub fn lsx_vsran_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsran_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssran_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vssran_b_h(a, b) } +pub fn lsx_vssran_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssran_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssran_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vssran_h_w(a, b) } +pub fn lsx_vssran_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssran_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssran_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vssran_w_d(a, b) } +pub fn lsx_vssran_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssran_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssran_bu_h(a: v8u16, b: v8u16) -> v16u8 { - unsafe { __lsx_vssran_bu_h(a, b) } +pub fn lsx_vssran_bu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssran_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssran_hu_w(a: v4u32, b: v4u32) -> v8u16 { - unsafe { __lsx_vssran_hu_w(a, b) } +pub fn lsx_vssran_hu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssran_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssran_wu_d(a: v2u64, b: v2u64) -> v4u32 { - unsafe { __lsx_vssran_wu_d(a, b) } +pub fn lsx_vssran_wu_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssran_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarn_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vsrarn_b_h(a, b) } +pub fn lsx_vsrarn_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrarn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarn_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vsrarn_h_w(a, b) } +pub fn lsx_vsrarn_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrarn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarn_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vsrarn_w_d(a, b) } +pub fn lsx_vsrarn_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrarn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarn_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vssrarn_b_h(a, b) } +pub fn lsx_vssrarn_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrarn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarn_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vssrarn_h_w(a, b) } +pub fn lsx_vssrarn_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrarn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarn_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vssrarn_w_d(a, b) } +pub fn lsx_vssrarn_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrarn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarn_bu_h(a: v8u16, b: v8u16) -> v16u8 { - unsafe { __lsx_vssrarn_bu_h(a, b) } +pub fn lsx_vssrarn_bu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrarn_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarn_hu_w(a: v4u32, b: v4u32) -> v8u16 { - unsafe { __lsx_vssrarn_hu_w(a, b) } +pub fn lsx_vssrarn_hu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrarn_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarn_wu_d(a: v2u64, b: v2u64) -> v4u32 { - unsafe { __lsx_vssrarn_wu_d(a, b) } +pub fn lsx_vssrarn_wu_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrarn_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrln_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vsrln_b_h(a, b) } +pub fn lsx_vsrln_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrln_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrln_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vsrln_h_w(a, b) } +pub fn lsx_vsrln_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrln_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrln_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vsrln_w_d(a, b) } +pub fn lsx_vsrln_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrln_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrln_bu_h(a: v8u16, b: v8u16) -> v16u8 { - unsafe { __lsx_vssrln_bu_h(a, b) } +pub fn lsx_vssrln_bu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrln_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrln_hu_w(a: v4u32, b: v4u32) -> v8u16 { - unsafe { __lsx_vssrln_hu_w(a, b) } +pub fn lsx_vssrln_hu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrln_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrln_wu_d(a: v2u64, b: v2u64) -> v4u32 { - unsafe { __lsx_vssrln_wu_d(a, b) } +pub fn lsx_vssrln_wu_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrln_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrn_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vsrlrn_b_h(a, b) } +pub fn lsx_vsrlrn_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlrn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrn_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vsrlrn_h_w(a, b) } +pub fn lsx_vsrlrn_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlrn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrn_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vsrlrn_w_d(a, b) } +pub fn lsx_vsrlrn_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsrlrn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrn_bu_h(a: v8u16, b: v8u16) -> v16u8 { - unsafe { __lsx_vssrlrn_bu_h(a, b) } +pub fn lsx_vssrlrn_bu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrlrn_bu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrn_hu_w(a: v4u32, b: v4u32) -> v8u16 { - unsafe { __lsx_vssrlrn_hu_w(a, b) } +pub fn lsx_vssrlrn_hu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrlrn_hu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrn_wu_d(a: v2u64, b: v2u64) -> v4u32 { - unsafe { __lsx_vssrlrn_wu_d(a, b) } +pub fn lsx_vssrlrn_wu_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrlrn_wu_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrstpi_b(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vfrstpi_b(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vfrstpi_b(a, b, IMM5) } + unsafe { transmute(__lsx_vfrstpi_b(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrstpi_h(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vfrstpi_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vfrstpi_h(a, b, IMM5) } + unsafe { transmute(__lsx_vfrstpi_h(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrstp_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - unsafe { __lsx_vfrstp_b(a, b, c) } +pub fn lsx_vfrstp_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vfrstp_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrstp_h(a: v8i16, b: v8i16, c: v8i16) -> v8i16 { - unsafe { __lsx_vfrstp_h(a, b, c) } +pub fn lsx_vfrstp_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vfrstp_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf4i_d(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vshuf4i_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vshuf4i_d(a, b, IMM8) } + unsafe { transmute(__lsx_vshuf4i_d(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbsrl_v(a: v16i8) -> v16i8 { +pub fn lsx_vbsrl_v(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vbsrl_v(a, IMM5) } + unsafe { transmute(__lsx_vbsrl_v(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vbsll_v(a: v16i8) -> v16i8 { +pub fn lsx_vbsll_v(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vbsll_v(a, IMM5) } + unsafe { transmute(__lsx_vbsll_v(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vextrins_b(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vextrins_b(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vextrins_b(a, b, IMM8) } + unsafe { transmute(__lsx_vextrins_b(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vextrins_h(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vextrins_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vextrins_h(a, b, IMM8) } + unsafe { transmute(__lsx_vextrins_h(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vextrins_w(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vextrins_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vextrins_w(a, b, IMM8) } + unsafe { transmute(__lsx_vextrins_w(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vextrins_d(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vextrins_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vextrins_d(a, b, IMM8) } + unsafe { transmute(__lsx_vextrins_d(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmskltz_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vmskltz_b(a) } +pub fn lsx_vmskltz_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vmskltz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmskltz_h(a: v8i16) -> v8i16 { - unsafe { __lsx_vmskltz_h(a) } +pub fn lsx_vmskltz_h(a: m128i) -> m128i { + unsafe { transmute(__lsx_vmskltz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmskltz_w(a: v4i32) -> v4i32 { - unsafe { __lsx_vmskltz_w(a) } +pub fn lsx_vmskltz_w(a: m128i) -> m128i { + unsafe { transmute(__lsx_vmskltz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmskltz_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vmskltz_d(a) } +pub fn lsx_vmskltz_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vmskltz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsigncov_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vsigncov_b(a, b) } +pub fn lsx_vsigncov_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsigncov_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsigncov_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vsigncov_h(a, b) } +pub fn lsx_vsigncov_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsigncov_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsigncov_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vsigncov_w(a, b) } +pub fn lsx_vsigncov_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsigncov_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsigncov_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsigncov_d(a, b) } +pub fn lsx_vsigncov_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsigncov_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - unsafe { __lsx_vfmadd_s(a, b, c) } +pub fn lsx_vfmadd_s(a: m128, b: m128, c: m128) -> m128 { + unsafe { transmute(__lsx_vfmadd_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - unsafe { __lsx_vfmadd_d(a, b, c) } +pub fn lsx_vfmadd_d(a: m128d, b: m128d, c: m128d) -> m128d { + unsafe { transmute(__lsx_vfmadd_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - unsafe { __lsx_vfmsub_s(a, b, c) } +pub fn lsx_vfmsub_s(a: m128, b: m128, c: m128) -> m128 { + unsafe { transmute(__lsx_vfmsub_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - unsafe { __lsx_vfmsub_d(a, b, c) } +pub fn lsx_vfmsub_d(a: m128d, b: m128d, c: m128d) -> m128d { + unsafe { transmute(__lsx_vfmsub_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfnmadd_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - unsafe { __lsx_vfnmadd_s(a, b, c) } +pub fn lsx_vfnmadd_s(a: m128, b: m128, c: m128) -> m128 { + unsafe { transmute(__lsx_vfnmadd_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfnmadd_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - unsafe { __lsx_vfnmadd_d(a, b, c) } +pub fn lsx_vfnmadd_d(a: m128d, b: m128d, c: m128d) -> m128d { + unsafe { transmute(__lsx_vfnmadd_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfnmsub_s(a: v4f32, b: v4f32, c: v4f32) -> v4f32 { - unsafe { __lsx_vfnmsub_s(a, b, c) } +pub fn lsx_vfnmsub_s(a: m128, b: m128, c: m128) -> m128 { + unsafe { transmute(__lsx_vfnmsub_s(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfnmsub_d(a: v2f64, b: v2f64, c: v2f64) -> v2f64 { - unsafe { __lsx_vfnmsub_d(a, b, c) } +pub fn lsx_vfnmsub_d(a: m128d, b: m128d, c: m128d) -> m128d { + unsafe { transmute(__lsx_vfnmsub_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrne_w_s(a: v4f32) -> v4i32 { - unsafe { __lsx_vftintrne_w_s(a) } +pub fn lsx_vftintrne_w_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrne_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrne_l_d(a: v2f64) -> v2i64 { - unsafe { __lsx_vftintrne_l_d(a) } +pub fn lsx_vftintrne_l_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrne_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrp_w_s(a: v4f32) -> v4i32 { - unsafe { __lsx_vftintrp_w_s(a) } +pub fn lsx_vftintrp_w_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrp_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrp_l_d(a: v2f64) -> v2i64 { - unsafe { __lsx_vftintrp_l_d(a) } +pub fn lsx_vftintrp_l_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrp_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrm_w_s(a: v4f32) -> v4i32 { - unsafe { __lsx_vftintrm_w_s(a) } +pub fn lsx_vftintrm_w_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrm_w_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrm_l_d(a: v2f64) -> v2i64 { - unsafe { __lsx_vftintrm_l_d(a) } +pub fn lsx_vftintrm_l_d(a: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrm_l_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftint_w_d(a: v2f64, b: v2f64) -> v4i32 { - unsafe { __lsx_vftint_w_d(a, b) } +pub fn lsx_vftint_w_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vftint_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffint_s_l(a: v2i64, b: v2i64) -> v4f32 { - unsafe { __lsx_vffint_s_l(a, b) } +pub fn lsx_vffint_s_l(a: m128i, b: m128i) -> m128 { + unsafe { transmute(__lsx_vffint_s_l(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrz_w_d(a: v2f64, b: v2f64) -> v4i32 { - unsafe { __lsx_vftintrz_w_d(a, b) } +pub fn lsx_vftintrz_w_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrz_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrp_w_d(a: v2f64, b: v2f64) -> v4i32 { - unsafe { __lsx_vftintrp_w_d(a, b) } +pub fn lsx_vftintrp_w_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrp_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrm_w_d(a: v2f64, b: v2f64) -> v4i32 { - unsafe { __lsx_vftintrm_w_d(a, b) } +pub fn lsx_vftintrm_w_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrm_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrne_w_d(a: v2f64, b: v2f64) -> v4i32 { - unsafe { __lsx_vftintrne_w_d(a, b) } +pub fn lsx_vftintrne_w_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vftintrne_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintl_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintl_l_s(a) } +pub fn lsx_vftintl_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintl_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftinth_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftinth_l_s(a) } +pub fn lsx_vftinth_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftinth_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffinth_d_w(a: v4i32) -> v2f64 { - unsafe { __lsx_vffinth_d_w(a) } +pub fn lsx_vffinth_d_w(a: m128i) -> m128d { + unsafe { transmute(__lsx_vffinth_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vffintl_d_w(a: v4i32) -> v2f64 { - unsafe { __lsx_vffintl_d_w(a) } +pub fn lsx_vffintl_d_w(a: m128i) -> m128d { + unsafe { transmute(__lsx_vffintl_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrzl_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrzl_l_s(a) } +pub fn lsx_vftintrzl_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrzl_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrzh_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrzh_l_s(a) } +pub fn lsx_vftintrzh_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrzh_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrpl_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrpl_l_s(a) } +pub fn lsx_vftintrpl_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrpl_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrph_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrph_l_s(a) } +pub fn lsx_vftintrph_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrph_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrml_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrml_l_s(a) } +pub fn lsx_vftintrml_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrml_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrmh_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrmh_l_s(a) } +pub fn lsx_vftintrmh_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrmh_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrnel_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrnel_l_s(a) } +pub fn lsx_vftintrnel_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrnel_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vftintrneh_l_s(a: v4f32) -> v2i64 { - unsafe { __lsx_vftintrneh_l_s(a) } +pub fn lsx_vftintrneh_l_s(a: m128) -> m128i { + unsafe { transmute(__lsx_vftintrneh_l_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrne_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrintrne_s(a) } +pub fn lsx_vfrintrne_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrintrne_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrne_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrintrne_d(a) } +pub fn lsx_vfrintrne_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrintrne_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrz_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrintrz_s(a) } +pub fn lsx_vfrintrz_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrintrz_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrz_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrintrz_d(a) } +pub fn lsx_vfrintrz_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrintrz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrp_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrintrp_s(a) } +pub fn lsx_vfrintrp_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrintrp_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrp_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrintrp_d(a) } +pub fn lsx_vfrintrp_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrintrp_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrm_s(a: v4f32) -> v4f32 { - unsafe { __lsx_vfrintrm_s(a) } +pub fn lsx_vfrintrm_s(a: m128) -> m128 { + unsafe { transmute(__lsx_vfrintrm_s(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfrintrm_d(a: v2f64) -> v2f64 { - unsafe { __lsx_vfrintrm_d(a) } +pub fn lsx_vfrintrm_d(a: m128d) -> m128d { + unsafe { transmute(__lsx_vfrintrm_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vstelm_b(a: v16i8, mem_addr: *mut i8) { +pub unsafe fn lsx_vstelm_b(a: m128i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM4, 4); - __lsx_vstelm_b(a, mem_addr, IMM_S8, IMM4) + transmute(__lsx_vstelm_b(transmute(a), mem_addr, IMM_S8, IMM4)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vstelm_h(a: v8i16, mem_addr: *mut i8) { +pub unsafe fn lsx_vstelm_h(a: m128i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM3, 3); - __lsx_vstelm_h(a, mem_addr, IMM_S8, IMM3) + transmute(__lsx_vstelm_h(transmute(a), mem_addr, IMM_S8, IMM3)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vstelm_w(a: v4i32, mem_addr: *mut i8) { +pub unsafe fn lsx_vstelm_w(a: m128i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM2, 2); - __lsx_vstelm_w(a, mem_addr, IMM_S8, IMM2) + transmute(__lsx_vstelm_w(transmute(a), mem_addr, IMM_S8, IMM2)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2, 3)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vstelm_d(a: v2i64, mem_addr: *mut i8) { +pub unsafe fn lsx_vstelm_d(a: m128i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S8, 8); static_assert_uimm_bits!(IMM1, 1); - __lsx_vstelm_d(a, mem_addr, IMM_S8, IMM1) + transmute(__lsx_vstelm_d(transmute(a), mem_addr, IMM_S8, IMM1)) } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vaddwev_d_w(a, b) } +pub fn lsx_vaddwev_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vaddwev_w_h(a, b) } +pub fn lsx_vaddwev_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vaddwev_h_b(a, b) } +pub fn lsx_vaddwev_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vaddwod_d_w(a, b) } +pub fn lsx_vaddwod_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vaddwod_w_h(a, b) } +pub fn lsx_vaddwod_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vaddwod_h_b(a, b) } +pub fn lsx_vaddwod_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vaddwev_d_wu(a, b) } +pub fn lsx_vaddwev_d_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vaddwev_w_hu(a, b) } +pub fn lsx_vaddwev_w_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vaddwev_h_bu(a, b) } +pub fn lsx_vaddwev_h_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vaddwod_d_wu(a, b) } +pub fn lsx_vaddwod_d_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vaddwod_w_hu(a, b) } +pub fn lsx_vaddwod_w_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vaddwod_h_bu(a, b) } +pub fn lsx_vaddwod_h_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - unsafe { __lsx_vaddwev_d_wu_w(a, b) } +pub fn lsx_vaddwev_d_wu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - unsafe { __lsx_vaddwev_w_hu_h(a, b) } +pub fn lsx_vaddwev_w_hu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - unsafe { __lsx_vaddwev_h_bu_b(a, b) } +pub fn lsx_vaddwev_h_bu_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - unsafe { __lsx_vaddwod_d_wu_w(a, b) } +pub fn lsx_vaddwod_d_wu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - unsafe { __lsx_vaddwod_w_hu_h(a, b) } +pub fn lsx_vaddwod_w_hu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - unsafe { __lsx_vaddwod_h_bu_b(a, b) } +pub fn lsx_vaddwod_h_bu_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vsubwev_d_w(a, b) } +pub fn lsx_vsubwev_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vsubwev_w_h(a, b) } +pub fn lsx_vsubwev_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vsubwev_h_b(a, b) } +pub fn lsx_vsubwev_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vsubwod_d_w(a, b) } +pub fn lsx_vsubwod_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vsubwod_w_h(a, b) } +pub fn lsx_vsubwod_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vsubwod_h_b(a, b) } +pub fn lsx_vsubwod_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vsubwev_d_wu(a, b) } +pub fn lsx_vsubwev_d_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vsubwev_w_hu(a, b) } +pub fn lsx_vsubwev_w_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vsubwev_h_bu(a, b) } +pub fn lsx_vsubwev_h_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vsubwod_d_wu(a, b) } +pub fn lsx_vsubwod_d_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vsubwod_w_hu(a, b) } +pub fn lsx_vsubwod_w_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vsubwod_h_bu(a, b) } +pub fn lsx_vsubwod_h_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vaddwev_q_d(a, b) } +pub fn lsx_vaddwev_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vaddwod_q_d(a, b) } +pub fn lsx_vaddwod_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_q_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vaddwev_q_du(a, b) } +pub fn lsx_vaddwev_q_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_q_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vaddwod_q_du(a, b) } +pub fn lsx_vaddwod_q_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsubwev_q_d(a, b) } +pub fn lsx_vsubwev_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsubwod_q_d(a, b) } +pub fn lsx_vsubwod_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwev_q_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vsubwev_q_du(a, b) } +pub fn lsx_vsubwev_q_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwev_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsubwod_q_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vsubwod_q_du(a, b) } +pub fn lsx_vsubwod_q_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsubwod_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwev_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - unsafe { __lsx_vaddwev_q_du_d(a, b) } +pub fn lsx_vaddwev_q_du_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwev_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vaddwod_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - unsafe { __lsx_vaddwod_q_du_d(a, b) } +pub fn lsx_vaddwod_q_du_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vaddwod_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vmulwev_d_w(a, b) } +pub fn lsx_vmulwev_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vmulwev_w_h(a, b) } +pub fn lsx_vmulwev_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vmulwev_h_b(a, b) } +pub fn lsx_vmulwev_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_d_w(a: v4i32, b: v4i32) -> v2i64 { - unsafe { __lsx_vmulwod_d_w(a, b) } +pub fn lsx_vmulwod_d_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_d_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_w_h(a: v8i16, b: v8i16) -> v4i32 { - unsafe { __lsx_vmulwod_w_h(a, b) } +pub fn lsx_vmulwod_w_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_w_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_h_b(a: v16i8, b: v16i8) -> v8i16 { - unsafe { __lsx_vmulwod_h_b(a, b) } +pub fn lsx_vmulwod_h_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_h_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_d_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vmulwev_d_wu(a, b) } +pub fn lsx_vmulwev_d_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_w_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vmulwev_w_hu(a, b) } +pub fn lsx_vmulwev_w_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_h_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vmulwev_h_bu(a, b) } +pub fn lsx_vmulwev_h_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_d_wu(a: v4u32, b: v4u32) -> v2i64 { - unsafe { __lsx_vmulwod_d_wu(a, b) } +pub fn lsx_vmulwod_d_wu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_d_wu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_w_hu(a: v8u16, b: v8u16) -> v4i32 { - unsafe { __lsx_vmulwod_w_hu(a, b) } +pub fn lsx_vmulwod_w_hu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_w_hu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_h_bu(a: v16u8, b: v16u8) -> v8i16 { - unsafe { __lsx_vmulwod_h_bu(a, b) } +pub fn lsx_vmulwod_h_bu(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_h_bu(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - unsafe { __lsx_vmulwev_d_wu_w(a, b) } +pub fn lsx_vmulwev_d_wu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - unsafe { __lsx_vmulwev_w_hu_h(a, b) } +pub fn lsx_vmulwev_w_hu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - unsafe { __lsx_vmulwev_h_bu_b(a, b) } +pub fn lsx_vmulwev_h_bu_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_d_wu_w(a: v4u32, b: v4i32) -> v2i64 { - unsafe { __lsx_vmulwod_d_wu_w(a, b) } +pub fn lsx_vmulwod_d_wu_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_d_wu_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_w_hu_h(a: v8u16, b: v8i16) -> v4i32 { - unsafe { __lsx_vmulwod_w_hu_h(a, b) } +pub fn lsx_vmulwod_w_hu_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_w_hu_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_h_bu_b(a: v16u8, b: v16i8) -> v8i16 { - unsafe { __lsx_vmulwod_h_bu_b(a, b) } +pub fn lsx_vmulwod_h_bu_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_h_bu_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmulwev_q_d(a, b) } +pub fn lsx_vmulwev_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmulwod_q_d(a, b) } +pub fn lsx_vmulwod_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_q_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vmulwev_q_du(a, b) } +pub fn lsx_vmulwev_q_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_q_du(a: v2u64, b: v2u64) -> v2i64 { - unsafe { __lsx_vmulwod_q_du(a, b) } +pub fn lsx_vmulwod_q_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_q_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwev_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmulwev_q_du_d(a, b) } +pub fn lsx_vmulwev_q_du_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwev_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmulwod_q_du_d(a: v2u64, b: v2i64) -> v2i64 { - unsafe { __lsx_vmulwod_q_du_d(a, b) } +pub fn lsx_vmulwod_q_du_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmulwod_q_du_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vhaddw_q_d(a, b) } +pub fn lsx_vhaddw_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhaddw_qu_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vhaddw_qu_du(a, b) } +pub fn lsx_vhaddw_qu_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhaddw_qu_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_q_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vhsubw_q_d(a, b) } +pub fn lsx_vhsubw_q_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_q_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vhsubw_qu_du(a: v2u64, b: v2u64) -> v2u64 { - unsafe { __lsx_vhsubw_qu_du(a, b) } +pub fn lsx_vhsubw_qu_du(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vhsubw_qu_du(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64 { - unsafe { __lsx_vmaddwev_d_w(a, b, c) } +pub fn lsx_vmaddwev_d_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_d_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32 { - unsafe { __lsx_vmaddwev_w_h(a, b, c) } +pub fn lsx_vmaddwev_w_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_w_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16 { - unsafe { __lsx_vmaddwev_h_b(a, b, c) } +pub fn lsx_vmaddwev_h_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_h_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64 { - unsafe { __lsx_vmaddwev_d_wu(a, b, c) } +pub fn lsx_vmaddwev_d_wu(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_d_wu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32 { - unsafe { __lsx_vmaddwev_w_hu(a, b, c) } +pub fn lsx_vmaddwev_w_hu(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_w_hu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16 { - unsafe { __lsx_vmaddwev_h_bu(a, b, c) } +pub fn lsx_vmaddwev_h_bu(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_h_bu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_d_w(a: v2i64, b: v4i32, c: v4i32) -> v2i64 { - unsafe { __lsx_vmaddwod_d_w(a, b, c) } +pub fn lsx_vmaddwod_d_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_d_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_w_h(a: v4i32, b: v8i16, c: v8i16) -> v4i32 { - unsafe { __lsx_vmaddwod_w_h(a, b, c) } +pub fn lsx_vmaddwod_w_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_w_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_h_b(a: v8i16, b: v16i8, c: v16i8) -> v8i16 { - unsafe { __lsx_vmaddwod_h_b(a, b, c) } +pub fn lsx_vmaddwod_h_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_h_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_d_wu(a: v2u64, b: v4u32, c: v4u32) -> v2u64 { - unsafe { __lsx_vmaddwod_d_wu(a, b, c) } +pub fn lsx_vmaddwod_d_wu(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_d_wu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_w_hu(a: v4u32, b: v8u16, c: v8u16) -> v4u32 { - unsafe { __lsx_vmaddwod_w_hu(a, b, c) } +pub fn lsx_vmaddwod_w_hu(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_w_hu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_h_bu(a: v8u16, b: v16u8, c: v16u8) -> v8u16 { - unsafe { __lsx_vmaddwod_h_bu(a, b, c) } +pub fn lsx_vmaddwod_h_bu(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_h_bu(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64 { - unsafe { __lsx_vmaddwev_d_wu_w(a, b, c) } +pub fn lsx_vmaddwev_d_wu_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_d_wu_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32 { - unsafe { __lsx_vmaddwev_w_hu_h(a, b, c) } +pub fn lsx_vmaddwev_w_hu_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_w_hu_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16 { - unsafe { __lsx_vmaddwev_h_bu_b(a, b, c) } +pub fn lsx_vmaddwev_h_bu_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_h_bu_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_d_wu_w(a: v2i64, b: v4u32, c: v4i32) -> v2i64 { - unsafe { __lsx_vmaddwod_d_wu_w(a, b, c) } +pub fn lsx_vmaddwod_d_wu_w(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_d_wu_w(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_w_hu_h(a: v4i32, b: v8u16, c: v8i16) -> v4i32 { - unsafe { __lsx_vmaddwod_w_hu_h(a, b, c) } +pub fn lsx_vmaddwod_w_hu_h(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_w_hu_h(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_h_bu_b(a: v8i16, b: v16u8, c: v16i8) -> v8i16 { - unsafe { __lsx_vmaddwod_h_bu_b(a, b, c) } +pub fn lsx_vmaddwod_h_bu_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_h_bu_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - unsafe { __lsx_vmaddwev_q_d(a, b, c) } +pub fn lsx_vmaddwev_q_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_q_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_q_d(a: v2i64, b: v2i64, c: v2i64) -> v2i64 { - unsafe { __lsx_vmaddwod_q_d(a, b, c) } +pub fn lsx_vmaddwod_q_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_q_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64 { - unsafe { __lsx_vmaddwev_q_du(a, b, c) } +pub fn lsx_vmaddwev_q_du(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_q_du(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_q_du(a: v2u64, b: v2u64, c: v2u64) -> v2u64 { - unsafe { __lsx_vmaddwod_q_du(a, b, c) } +pub fn lsx_vmaddwod_q_du(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_q_du(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwev_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64 { - unsafe { __lsx_vmaddwev_q_du_d(a, b, c) } +pub fn lsx_vmaddwev_q_du_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwev_q_du_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmaddwod_q_du_d(a: v2i64, b: v2u64, c: v2i64) -> v2i64 { - unsafe { __lsx_vmaddwod_q_du_d(a, b, c) } +pub fn lsx_vmaddwod_q_du_d(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vmaddwod_q_du_d(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotr_b(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vrotr_b(a, b) } +pub fn lsx_vrotr_b(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vrotr_b(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotr_h(a: v8i16, b: v8i16) -> v8i16 { - unsafe { __lsx_vrotr_h(a, b) } +pub fn lsx_vrotr_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vrotr_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotr_w(a: v4i32, b: v4i32) -> v4i32 { - unsafe { __lsx_vrotr_w(a, b) } +pub fn lsx_vrotr_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vrotr_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotr_d(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vrotr_d(a, b) } +pub fn lsx_vrotr_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vrotr_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vadd_q(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vadd_q(a, b) } +pub fn lsx_vadd_q(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vadd_q(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsub_q(a: v2i64, b: v2i64) -> v2i64 { - unsafe { __lsx_vsub_q(a, b) } +pub fn lsx_vsub_q(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vsub_q(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vldrepl_b(mem_addr: *const i8) -> v16i8 { +pub unsafe fn lsx_vldrepl_b(mem_addr: *const i8) -> m128i { static_assert_simm_bits!(IMM_S12, 12); - __lsx_vldrepl_b(mem_addr, IMM_S12) + transmute(__lsx_vldrepl_b(mem_addr, IMM_S12)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vldrepl_h(mem_addr: *const i8) -> v8i16 { +pub unsafe fn lsx_vldrepl_h(mem_addr: *const i8) -> m128i { static_assert_simm_bits!(IMM_S11, 11); - __lsx_vldrepl_h(mem_addr, IMM_S11) + transmute(__lsx_vldrepl_h(mem_addr, IMM_S11)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vldrepl_w(mem_addr: *const i8) -> v4i32 { +pub unsafe fn lsx_vldrepl_w(mem_addr: *const i8) -> m128i { static_assert_simm_bits!(IMM_S10, 10); - __lsx_vldrepl_w(mem_addr, IMM_S10) + transmute(__lsx_vldrepl_w(mem_addr, IMM_S10)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vldrepl_d(mem_addr: *const i8) -> v2i64 { +pub unsafe fn lsx_vldrepl_d(mem_addr: *const i8) -> m128i { static_assert_simm_bits!(IMM_S9, 9); - __lsx_vldrepl_d(mem_addr, IMM_S9) + transmute(__lsx_vldrepl_d(mem_addr, IMM_S9)) } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmskgez_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vmskgez_b(a) } +pub fn lsx_vmskgez_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vmskgez_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vmsknz_b(a: v16i8) -> v16i8 { - unsafe { __lsx_vmsknz_b(a) } +pub fn lsx_vmsknz_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vmsknz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_h_b(a: v16i8) -> v8i16 { - unsafe { __lsx_vexth_h_b(a) } +pub fn lsx_vexth_h_b(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_h_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_w_h(a: v8i16) -> v4i32 { - unsafe { __lsx_vexth_w_h(a) } +pub fn lsx_vexth_w_h(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_w_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_d_w(a: v4i32) -> v2i64 { - unsafe { __lsx_vexth_d_w(a) } +pub fn lsx_vexth_d_w(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_d_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_q_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vexth_q_d(a) } +pub fn lsx_vexth_q_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_q_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_hu_bu(a: v16u8) -> v8u16 { - unsafe { __lsx_vexth_hu_bu(a) } +pub fn lsx_vexth_hu_bu(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_hu_bu(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_wu_hu(a: v8u16) -> v4u32 { - unsafe { __lsx_vexth_wu_hu(a) } +pub fn lsx_vexth_wu_hu(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_wu_hu(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_du_wu(a: v4u32) -> v2u64 { - unsafe { __lsx_vexth_du_wu(a) } +pub fn lsx_vexth_du_wu(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_du_wu(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vexth_qu_du(a: v2u64) -> v2u64 { - unsafe { __lsx_vexth_qu_du(a) } +pub fn lsx_vexth_qu_du(a: m128i) -> m128i { + unsafe { transmute(__lsx_vexth_qu_du(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotri_b(a: v16i8) -> v16i8 { +pub fn lsx_vrotri_b(a: m128i) -> m128i { static_assert_uimm_bits!(IMM3, 3); - unsafe { __lsx_vrotri_b(a, IMM3) } + unsafe { transmute(__lsx_vrotri_b(transmute(a), IMM3)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotri_h(a: v8i16) -> v8i16 { +pub fn lsx_vrotri_h(a: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vrotri_h(a, IMM4) } + unsafe { transmute(__lsx_vrotri_h(transmute(a), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotri_w(a: v4i32) -> v4i32 { +pub fn lsx_vrotri_w(a: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vrotri_w(a, IMM5) } + unsafe { transmute(__lsx_vrotri_w(transmute(a), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrotri_d(a: v2i64) -> v2i64 { +pub fn lsx_vrotri_d(a: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vrotri_d(a, IMM6) } + unsafe { transmute(__lsx_vrotri_d(transmute(a), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vextl_q_d(a: v2i64) -> v2i64 { - unsafe { __lsx_vextl_q_d(a) } +pub fn lsx_vextl_q_d(a: m128i) -> m128i { + unsafe { transmute(__lsx_vextl_q_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrlni_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrlni_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vsrlni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrlni_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrlni_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vsrlni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrlni_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrlni_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vsrlni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrlni_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vsrlni_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vsrlni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrlrni_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrlrni_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vsrlrni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrlrni_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrlrni_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vsrlrni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrlrni_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrlrni_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vsrlrni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrlrni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrlrni_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vsrlrni_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vsrlrni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrlni_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrlni_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrlni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrlni_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrlni_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrlni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrlni_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrlni_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrlni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrlni_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrlni_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrlni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrlni_bu_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrlni_bu_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrlni_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrlni_hu_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrlni_hu_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrlni_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrlni_wu_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrlni_wu_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrlni_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlni_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrlni_du_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrlni_du_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrlni_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrlrni_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrlrni_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrlrni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrlrni_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrlrni_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrlrni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrlrni_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrlrni_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrlrni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrlrni_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrlrni_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrlrni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrlrni_bu_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrlrni_bu_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrlrni_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrlrni_hu_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrlrni_hu_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrlrni_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrlrni_wu_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrlrni_wu_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrlrni_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrni_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrlrni_du_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrlrni_du_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrlrni_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrani_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrani_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrani_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vsrani_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrani_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrani_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrani_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vsrani_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrani_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrani_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrani_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vsrani_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrani_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrani_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vsrani_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vsrani_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vsrarni_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vsrarni_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vsrarni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vsrarni_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vsrarni_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vsrarni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vsrarni_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vsrarni_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vsrarni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vsrarni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vsrarni_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vsrarni_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vsrarni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrani_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrani_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrani_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrani_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrani_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrani_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrani_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrani_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrani_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrani_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrani_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrani_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrani_bu_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrani_bu_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrani_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrani_hu_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrani_hu_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrani_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrani_wu_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrani_wu_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrani_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrani_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrani_du_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrani_du_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrani_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_b_h(a: v16i8, b: v16i8) -> v16i8 { +pub fn lsx_vssrarni_b_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrarni_b_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrarni_b_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_h_w(a: v8i16, b: v8i16) -> v8i16 { +pub fn lsx_vssrarni_h_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrarni_h_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrarni_h_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_w_d(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vssrarni_w_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrarni_w_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrarni_w_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_d_q(a: v2i64, b: v2i64) -> v2i64 { +pub fn lsx_vssrarni_d_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrarni_d_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrarni_d_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_bu_h(a: v16u8, b: v16i8) -> v16u8 { +pub fn lsx_vssrarni_bu_h(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM4, 4); - unsafe { __lsx_vssrarni_bu_h(a, b, IMM4) } + unsafe { transmute(__lsx_vssrarni_bu_h(transmute(a), transmute(b), IMM4)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_hu_w(a: v8u16, b: v8i16) -> v8u16 { +pub fn lsx_vssrarni_hu_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM5, 5); - unsafe { __lsx_vssrarni_hu_w(a, b, IMM5) } + unsafe { transmute(__lsx_vssrarni_hu_w(transmute(a), transmute(b), IMM5)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_wu_d(a: v4u32, b: v4i32) -> v4u32 { +pub fn lsx_vssrarni_wu_d(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM6, 6); - unsafe { __lsx_vssrarni_wu_d(a, b, IMM6) } + unsafe { transmute(__lsx_vssrarni_wu_d(transmute(a), transmute(b), IMM6)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrarni_du_q(a: v2u64, b: v2i64) -> v2u64 { +pub fn lsx_vssrarni_du_q(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM7, 7); - unsafe { __lsx_vssrarni_du_q(a, b, IMM7) } + unsafe { transmute(__lsx_vssrarni_du_q(transmute(a), transmute(b), IMM7)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vpermi_w(a: v4i32, b: v4i32) -> v4i32 { +pub fn lsx_vpermi_w(a: m128i, b: m128i) -> m128i { static_assert_uimm_bits!(IMM8, 8); - unsafe { __lsx_vpermi_w(a, b, IMM8) } + unsafe { transmute(__lsx_vpermi_w(transmute(a), transmute(b), IMM8)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(1)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vld(mem_addr: *const i8) -> v16i8 { +pub unsafe fn lsx_vld(mem_addr: *const i8) -> m128i { static_assert_simm_bits!(IMM_S12, 12); - __lsx_vld(mem_addr, IMM_S12) + transmute(__lsx_vld(mem_addr, IMM_S12)) } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(2)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vst(a: v16i8, mem_addr: *mut i8) { +pub unsafe fn lsx_vst(a: m128i, mem_addr: *mut i8) { static_assert_simm_bits!(IMM_S12, 12); - __lsx_vst(a, mem_addr, IMM_S12) + transmute(__lsx_vst(transmute(a), mem_addr, IMM_S12)) } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrn_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vssrlrn_b_h(a, b) } +pub fn lsx_vssrlrn_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrlrn_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrn_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vssrlrn_h_w(a, b) } +pub fn lsx_vssrlrn_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrlrn_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrlrn_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vssrlrn_w_d(a, b) } +pub fn lsx_vssrlrn_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrlrn_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrln_b_h(a: v8i16, b: v8i16) -> v16i8 { - unsafe { __lsx_vssrln_b_h(a, b) } +pub fn lsx_vssrln_b_h(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrln_b_h(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrln_h_w(a: v4i32, b: v4i32) -> v8i16 { - unsafe { __lsx_vssrln_h_w(a, b) } +pub fn lsx_vssrln_h_w(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrln_h_w(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vssrln_w_d(a: v2i64, b: v2i64) -> v4i32 { - unsafe { __lsx_vssrln_w_d(a, b) } +pub fn lsx_vssrln_w_d(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vssrln_w_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vorn_v(a: v16i8, b: v16i8) -> v16i8 { - unsafe { __lsx_vorn_v(a, b) } +pub fn lsx_vorn_v(a: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vorn_v(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vldi() -> v2i64 { +pub fn lsx_vldi() -> m128i { static_assert_simm_bits!(IMM_S13, 13); - unsafe { __lsx_vldi(IMM_S13) } + unsafe { transmute(__lsx_vldi(IMM_S13)) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vshuf_b(a: v16i8, b: v16i8, c: v16i8) -> v16i8 { - unsafe { __lsx_vshuf_b(a, b, c) } +pub fn lsx_vshuf_b(a: m128i, b: m128i, c: m128i) -> m128i { + unsafe { transmute(__lsx_vshuf_b(transmute(a), transmute(b), transmute(c))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vldx(mem_addr: *const i8, b: i64) -> v16i8 { - __lsx_vldx(mem_addr, b) +pub unsafe fn lsx_vldx(mem_addr: *const i8, b: i64) -> m128i { + transmute(__lsx_vldx(mem_addr, transmute(b))) } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub unsafe fn lsx_vstx(a: v16i8, mem_addr: *mut i8, b: i64) { - __lsx_vstx(a, mem_addr, b) +pub unsafe fn lsx_vstx(a: m128i, mem_addr: *mut i8, b: i64) { + transmute(__lsx_vstx(transmute(a), mem_addr, transmute(b))) } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vextl_qu_du(a: v2u64) -> v2u64 { - unsafe { __lsx_vextl_qu_du(a) } +pub fn lsx_vextl_qu_du(a: m128i) -> m128i { + unsafe { transmute(__lsx_vextl_qu_du(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bnz_b(a: v16u8) -> i32 { - unsafe { __lsx_bnz_b(a) } +pub fn lsx_bnz_b(a: m128i) -> i32 { + unsafe { transmute(__lsx_bnz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bnz_d(a: v2u64) -> i32 { - unsafe { __lsx_bnz_d(a) } +pub fn lsx_bnz_d(a: m128i) -> i32 { + unsafe { transmute(__lsx_bnz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bnz_h(a: v8u16) -> i32 { - unsafe { __lsx_bnz_h(a) } +pub fn lsx_bnz_h(a: m128i) -> i32 { + unsafe { transmute(__lsx_bnz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bnz_v(a: v16u8) -> i32 { - unsafe { __lsx_bnz_v(a) } +pub fn lsx_bnz_v(a: m128i) -> i32 { + unsafe { transmute(__lsx_bnz_v(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bnz_w(a: v4u32) -> i32 { - unsafe { __lsx_bnz_w(a) } +pub fn lsx_bnz_w(a: m128i) -> i32 { + unsafe { transmute(__lsx_bnz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bz_b(a: v16u8) -> i32 { - unsafe { __lsx_bz_b(a) } +pub fn lsx_bz_b(a: m128i) -> i32 { + unsafe { transmute(__lsx_bz_b(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bz_d(a: v2u64) -> i32 { - unsafe { __lsx_bz_d(a) } +pub fn lsx_bz_d(a: m128i) -> i32 { + unsafe { transmute(__lsx_bz_d(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bz_h(a: v8u16) -> i32 { - unsafe { __lsx_bz_h(a) } +pub fn lsx_bz_h(a: m128i) -> i32 { + unsafe { transmute(__lsx_bz_h(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bz_v(a: v16u8) -> i32 { - unsafe { __lsx_bz_v(a) } +pub fn lsx_bz_v(a: m128i) -> i32 { + unsafe { transmute(__lsx_bz_v(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_bz_w(a: v4u32) -> i32 { - unsafe { __lsx_bz_w(a) } +pub fn lsx_bz_w(a: m128i) -> i32 { + unsafe { transmute(__lsx_bz_w(transmute(a))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_caf_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_caf_d(a, b) } +pub fn lsx_vfcmp_caf_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_caf_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_caf_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_caf_s(a, b) } +pub fn lsx_vfcmp_caf_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_caf_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_ceq_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_ceq_d(a, b) } +pub fn lsx_vfcmp_ceq_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_ceq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_ceq_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_ceq_s(a, b) } +pub fn lsx_vfcmp_ceq_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_ceq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cle_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cle_d(a, b) } +pub fn lsx_vfcmp_cle_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cle_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cle_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cle_s(a, b) } +pub fn lsx_vfcmp_cle_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cle_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_clt_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_clt_d(a, b) } +pub fn lsx_vfcmp_clt_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_clt_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_clt_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_clt_s(a, b) } +pub fn lsx_vfcmp_clt_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_clt_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cne_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cne_d(a, b) } +pub fn lsx_vfcmp_cne_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cne_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cne_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cne_s(a, b) } +pub fn lsx_vfcmp_cne_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cne_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cor_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cor_d(a, b) } +pub fn lsx_vfcmp_cor_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cor_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cor_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cor_s(a, b) } +pub fn lsx_vfcmp_cor_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cor_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cueq_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cueq_d(a, b) } +pub fn lsx_vfcmp_cueq_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cueq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cueq_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cueq_s(a, b) } +pub fn lsx_vfcmp_cueq_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cueq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cule_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cule_d(a, b) } +pub fn lsx_vfcmp_cule_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cule_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cule_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cule_s(a, b) } +pub fn lsx_vfcmp_cule_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cule_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cult_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cult_d(a, b) } +pub fn lsx_vfcmp_cult_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cult_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cult_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cult_s(a, b) } +pub fn lsx_vfcmp_cult_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cult_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cun_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cun_d(a, b) } +pub fn lsx_vfcmp_cun_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cun_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cune_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_cune_d(a, b) } +pub fn lsx_vfcmp_cune_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_cune_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cune_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cune_s(a, b) } +pub fn lsx_vfcmp_cune_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cune_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_cun_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_cun_s(a, b) } +pub fn lsx_vfcmp_cun_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_cun_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_saf_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_saf_d(a, b) } +pub fn lsx_vfcmp_saf_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_saf_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_saf_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_saf_s(a, b) } +pub fn lsx_vfcmp_saf_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_saf_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_seq_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_seq_d(a, b) } +pub fn lsx_vfcmp_seq_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_seq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_seq_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_seq_s(a, b) } +pub fn lsx_vfcmp_seq_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_seq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sle_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sle_d(a, b) } +pub fn lsx_vfcmp_sle_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sle_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sle_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sle_s(a, b) } +pub fn lsx_vfcmp_sle_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sle_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_slt_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_slt_d(a, b) } +pub fn lsx_vfcmp_slt_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_slt_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_slt_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_slt_s(a, b) } +pub fn lsx_vfcmp_slt_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_slt_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sne_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sne_d(a, b) } +pub fn lsx_vfcmp_sne_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sne_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sne_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sne_s(a, b) } +pub fn lsx_vfcmp_sne_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sne_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sor_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sor_d(a, b) } +pub fn lsx_vfcmp_sor_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sor_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sor_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sor_s(a, b) } +pub fn lsx_vfcmp_sor_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sor_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sueq_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sueq_d(a, b) } +pub fn lsx_vfcmp_sueq_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sueq_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sueq_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sueq_s(a, b) } +pub fn lsx_vfcmp_sueq_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sueq_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sule_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sule_d(a, b) } +pub fn lsx_vfcmp_sule_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sule_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sule_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sule_s(a, b) } +pub fn lsx_vfcmp_sule_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sule_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sult_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sult_d(a, b) } +pub fn lsx_vfcmp_sult_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sult_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sult_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sult_s(a, b) } +pub fn lsx_vfcmp_sult_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sult_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sun_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sun_d(a, b) } +pub fn lsx_vfcmp_sun_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sun_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sune_d(a: v2f64, b: v2f64) -> v2i64 { - unsafe { __lsx_vfcmp_sune_d(a, b) } +pub fn lsx_vfcmp_sune_d(a: m128d, b: m128d) -> m128i { + unsafe { transmute(__lsx_vfcmp_sune_d(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sune_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sune_s(a, b) } +pub fn lsx_vfcmp_sune_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sune_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vfcmp_sun_s(a: v4f32, b: v4f32) -> v4i32 { - unsafe { __lsx_vfcmp_sun_s(a, b) } +pub fn lsx_vfcmp_sun_s(a: m128, b: m128) -> m128i { + unsafe { transmute(__lsx_vfcmp_sun_s(transmute(a), transmute(b))) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrepli_b() -> v16i8 { +pub fn lsx_vrepli_b() -> m128i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lsx_vrepli_b(IMM_S10) } + unsafe { transmute(__lsx_vrepli_b(IMM_S10)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrepli_d() -> v2i64 { +pub fn lsx_vrepli_d() -> m128i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lsx_vrepli_d(IMM_S10) } + unsafe { transmute(__lsx_vrepli_d(IMM_S10)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrepli_h() -> v8i16 { +pub fn lsx_vrepli_h() -> m128i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lsx_vrepli_h(IMM_S10) } + unsafe { transmute(__lsx_vrepli_h(IMM_S10)) } } #[inline] #[target_feature(enable = "lsx")] #[rustc_legacy_const_generics(0)] #[unstable(feature = "stdarch_loongarch", issue = "117427")] -pub fn lsx_vrepli_w() -> v4i32 { +pub fn lsx_vrepli_w() -> m128i { static_assert_simm_bits!(IMM_S10, 10); - unsafe { __lsx_vrepli_w(IMM_S10) } + unsafe { transmute(__lsx_vrepli_w(IMM_S10)) } } diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lsx/types.rs b/library/stdarch/crates/core_arch/src/loongarch64/lsx/types.rs index 4097164c2fae..4fb694571747 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/types.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/types.rs @@ -1,33 +1,140 @@ types! { #![unstable(feature = "stdarch_loongarch", issue = "117427")] - /// LOONGARCH-specific 128-bit wide vector of 16 packed `i8`. - pub struct v16i8(16 x pub(crate) i8); + /// 128-bit wide integer vector type, LoongArch-specific + /// + /// This type is the same as the `__m128i` type defined in `lsxintrin.h`, + /// representing a 128-bit SIMD register. Usage of this type typically + /// occurs in conjunction with the `lsx` and higher target features for + /// LoongArch. + /// + /// Internally this type may be viewed as: + /// + /// * `i8x16` - sixteen `i8` values packed together + /// * `i16x8` - eight `i16` values packed together + /// * `i32x4` - four `i32` values packed together + /// * `i64x2` - two `i64` values packed together + /// + /// (as well as unsigned versions). Each intrinsic may interpret the + /// internal bits differently, check the documentation of the intrinsic + /// to see how it's being used. + /// + /// The in-memory representation of this type is the same as the one of an + /// equivalent array (i.e. the in-memory order of elements is the same, and + /// there is no padding); however, the alignment is different and equal to + /// the size of the type. Note that the ABI for function calls may *not* be + /// the same. + /// + /// Note that this means that an instance of `m128i` typically just means + /// a "bag of bits" which is left up to interpretation at the point of use. + /// + /// Most intrinsics using `m128i` are prefixed with `lsx_` and the integer + /// types tend to correspond to suffixes like "b", "h", "w" or "d". + pub struct m128i(2 x i64); - /// LOONGARCH-specific 128-bit wide vector of 8 packed `i16`. - pub struct v8i16(8 x pub(crate) i16); + /// 128-bit wide set of four `f32` values, LoongArch-specific + /// + /// This type is the same as the `__m128` type defined in `lsxintrin.h`, + /// representing a 128-bit SIMD register which internally consists of + /// four packed `f32` instances. Usage of this type typically occurs in + /// conjunction with the `lsx` and higher target features for LoongArch. + /// + /// Note that unlike `m128i`, the integer version of the 128-bit registers, + /// this `m128` type has *one* interpretation. Each instance of `m128` + /// corresponds to `f32x4`, or four `f32` values packed together. + /// + /// The in-memory representation of this type is the same as the one of an + /// equivalent array (i.e. the in-memory order of elements is the same, and + /// there is no padding); however, the alignment is different and equal to + /// the size of the type. Note that the ABI for function calls may *not* be + /// the same. + /// + /// Most intrinsics using `m128` are prefixed with `lsx_` and are suffixed + /// with "s". + pub struct m128(4 x f32); - /// LOONGARCH-specific 128-bit wide vector of 4 packed `i32`. - pub struct v4i32(4 x pub(crate) i32); - - /// LOONGARCH-specific 128-bit wide vector of 2 packed `i64`. - pub struct v2i64(2 x pub(crate) i64); - - /// LOONGARCH-specific 128-bit wide vector of 16 packed `u8`. - pub struct v16u8(16 x pub(crate) u8); - - /// LOONGARCH-specific 128-bit wide vector of 8 packed `u16`. - pub struct v8u16(8 x pub(crate) u16); - - /// LOONGARCH-specific 128-bit wide vector of 4 packed `u32`. - pub struct v4u32(4 x pub(crate) u32); - - /// LOONGARCH-specific 128-bit wide vector of 2 packed `u64`. - pub struct v2u64(2 x pub(crate) u64); - - /// LOONGARCH-specific 128-bit wide vector of 4 packed `f32`. - pub struct v4f32(4 x pub(crate) f32); - - /// LOONGARCH-specific 128-bit wide vector of 2 packed `f64`. - pub struct v2f64(2 x pub(crate) f64); + /// 128-bit wide set of two `f64` values, LoongArch-specific + /// + /// This type is the same as the `__m128d` type defined in `lsxintrin.h`, + /// representing a 128-bit SIMD register which internally consists of + /// two packed `f64` instances. Usage of this type typically occurs in + /// conjunction with the `lsx` and higher target features for LoongArch. + /// + /// Note that unlike `m128i`, the integer version of the 128-bit registers, + /// this `m128d` type has *one* interpretation. Each instance of `m128d` + /// always corresponds to `f64x2`, or two `f64` values packed together. + /// + /// The in-memory representation of this type is the same as the one of an + /// equivalent array (i.e. the in-memory order of elements is the same, and + /// there is no padding); however, the alignment is different and equal to + /// the size of the type. Note that the ABI for function calls may *not* be + /// the same. + /// + /// Most intrinsics using `m128d` are prefixed with `lsx_` and are suffixed + /// with "d". Not to be confused with "d" which is used for `m128i`. + pub struct m128d(2 x f64); } + +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v16i8([i8; 16]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v8i16([i16; 8]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v4i32([i32; 4]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v2i64([i64; 2]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v16u8([u8; 16]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v8u16([u16; 8]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v4u32([u32; 4]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v2u64([u64; 2]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v4f32([f32; 4]); +#[allow(non_camel_case_types)] +#[repr(simd)] +pub(crate) struct __v2f64([f64; 2]); + +// These type aliases are provided solely for transitional compatibility. +// They are temporary and will be removed when appropriate. +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v16i8 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v8i16 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v4i32 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v2i64 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v16u8 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v8u16 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v4u32 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v2u64 = m128i; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v4f32 = m128; +#[allow(non_camel_case_types)] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +pub type v2f64 = m128d; diff --git a/library/stdarch/crates/core_arch/src/s390x/vector.rs b/library/stdarch/crates/core_arch/src/s390x/vector.rs index a09a27a029c1..0ce720a9244c 100644 --- a/library/stdarch/crates/core_arch/src/s390x/vector.rs +++ b/library/stdarch/crates/core_arch/src/s390x/vector.rs @@ -5831,24 +5831,30 @@ mod tests { use crate::core_arch::simd::*; use stdarch_test::simd_test; + impl ShuffleMask { + fn as_array(&self) -> &[u32; N] { + unsafe { std::mem::transmute(self) } + } + } + #[test] fn reverse_mask() { - assert_eq!(ShuffleMask::<4>::reverse().0, [3, 2, 1, 0]); + assert_eq!(ShuffleMask::<4>::reverse().as_array(), &[3, 2, 1, 0]); } #[test] fn mergel_mask() { - assert_eq!(ShuffleMask::<4>::merge_low().0, [2, 6, 3, 7]); + assert_eq!(ShuffleMask::<4>::merge_low().as_array(), &[2, 6, 3, 7]); } #[test] fn mergeh_mask() { - assert_eq!(ShuffleMask::<4>::merge_high().0, [0, 4, 1, 5]); + assert_eq!(ShuffleMask::<4>::merge_high().as_array(), &[0, 4, 1, 5]); } #[test] fn pack_mask() { - assert_eq!(ShuffleMask::<4>::pack().0, [1, 3, 5, 7]); + assert_eq!(ShuffleMask::<4>::pack().as_array(), &[1, 3, 5, 7]); } #[test] diff --git a/library/stdarch/crates/core_arch/src/x86/sse2.rs b/library/stdarch/crates/core_arch/src/x86/sse2.rs index 3dabcde18ce9..1eaa89663b2c 100644 --- a/library/stdarch/crates/core_arch/src/x86/sse2.rs +++ b/library/stdarch/crates/core_arch/src/x86/sse2.rs @@ -1272,7 +1272,7 @@ pub unsafe fn _mm_loadu_si128(mem_addr: *const __m128i) -> __m128i { } /// Conditionally store 8-bit integer elements from `a` into memory using -/// `mask`. +/// `mask` flagged as non-temporal (unlikely to be used again soon). /// /// Elements are not stored when the highest bit is not set in the /// corresponding element. @@ -1281,6 +1281,15 @@ pub unsafe fn _mm_loadu_si128(mem_addr: *const __m128i) -> __m128i { /// to be aligned on any particular boundary. /// /// [Intel's documentation](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maskmoveu_si128) +/// +/// # Safety of non-temporal stores +/// +/// After using this intrinsic, but before any other access to the memory that this intrinsic +/// mutates, a call to [`_mm_sfence`] must be performed by the thread that used the intrinsic. In +/// particular, functions that call this intrinsic should generally call `_mm_sfence` before they +/// return. +/// +/// See [`_mm_sfence`] for details. #[inline] #[target_feature(enable = "sse2")] #[cfg_attr(test, assert_instr(maskmovdqu))] diff --git a/library/stdarch/crates/intrinsic-test/Cargo.toml b/library/stdarch/crates/intrinsic-test/Cargo.toml index 06051abc8d0d..fbbf90e1400a 100644 --- a/library/stdarch/crates/intrinsic-test/Cargo.toml +++ b/library/stdarch/crates/intrinsic-test/Cargo.toml @@ -11,12 +11,9 @@ license = "MIT OR Apache-2.0" edition = "2024" [dependencies] -lazy_static = "1.4.0" serde = { version = "1", features = ["derive"] } serde_json = "1.0" -csv = "1.1" clap = { version = "4.4", features = ["derive"] } -regex = "1.4.2" log = "0.4.11" pretty_env_logger = "0.5.0" rayon = "1.5.0" diff --git a/library/stdarch/crates/intrinsic-test/src/arm/argument.rs b/library/stdarch/crates/intrinsic-test/src/arm/argument.rs new file mode 100644 index 000000000000..c43609bb2db0 --- /dev/null +++ b/library/stdarch/crates/intrinsic-test/src/arm/argument.rs @@ -0,0 +1,15 @@ +use crate::arm::intrinsic::ArmIntrinsicType; +use crate::common::argument::Argument; + +// This functionality is present due to the nature +// of how intrinsics are defined in the JSON source +// of ARM intrinsics. +impl Argument { + pub fn type_and_name_from_c(arg: &str) -> (&str, &str) { + let split_index = arg + .rfind([' ', '*']) + .expect("Couldn't split type and argname"); + + (arg[..split_index + 1].trim_end(), &arg[split_index + 1..]) + } +} diff --git a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs index 48a8ed950e3d..7da35f9a1114 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/compile.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/compile.rs @@ -6,16 +6,16 @@ pub fn build_cpp_compilation(config: &ProcessedCli) -> Option { // -ffp-contract=off emulates Rust's approach of not fusing separate mul-add operations let mut command = CompilationCommandBuilder::new() - .add_arch_flags(vec!["armv8.6-a", "crypto", "crc", "dotprod", "fp16"]) + .add_arch_flags(["armv8.6-a", "crypto", "crc", "dotprod", "fp16"]) .set_compiler(cpp_compiler) .set_target(&config.target) .set_opt_level("2") .set_cxx_toolchain_dir(config.cxx_toolchain_dir.as_deref()) .set_project_root("c_programs") - .add_extra_flags(vec!["-ffp-contract=off", "-Wno-narrowing"]); + .add_extra_flags(["-ffp-contract=off", "-Wno-narrowing"]); if !config.target.contains("v7") { - command = command.add_arch_flags(vec!["faminmax", "lut", "sha3"]); + command = command.add_arch_flags(["faminmax", "lut", "sha3"]); } if !cpp_compiler.contains("clang") { diff --git a/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs b/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs index 16572b2c03f1..fd93eff76e09 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/intrinsic.rs @@ -5,19 +5,22 @@ use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, S use std::ops::{Deref, DerefMut}; #[derive(Debug, Clone, PartialEq)] -pub struct ArmIntrinsicType(pub IntrinsicType); +pub struct ArmIntrinsicType { + pub data: IntrinsicType, + pub target: String, +} impl Deref for ArmIntrinsicType { type Target = IntrinsicType; fn deref(&self) -> &Self::Target { - &self.0 + &self.data } } impl DerefMut for ArmIntrinsicType { fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 + &mut self.data } } diff --git a/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs b/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs index 58d366c86a93..b019abab2134 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/json_parser.rs @@ -2,7 +2,7 @@ use super::intrinsic::ArmIntrinsicType; use crate::common::argument::{Argument, ArgumentList}; use crate::common::constraint::Constraint; use crate::common::intrinsic::Intrinsic; -use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition}; +use crate::common::intrinsic_helpers::IntrinsicType; use serde::Deserialize; use serde_json::Value; use std::collections::HashMap; @@ -86,18 +86,21 @@ fn json_to_intrinsic( .into_iter() .enumerate() .map(|(i, arg)| { - let arg_name = Argument::::type_and_name_from_c(&arg).1; + let (type_name, arg_name) = Argument::::type_and_name_from_c(&arg); let metadata = intr.args_prep.as_mut(); let metadata = metadata.and_then(|a| a.remove(arg_name)); let arg_prep: Option = metadata.and_then(|a| a.try_into().ok()); let constraint: Option = arg_prep.and_then(|a| a.try_into().ok()); + let ty = ArmIntrinsicType::from_c(type_name, target) + .unwrap_or_else(|_| panic!("Failed to parse argument '{arg}'")); - let mut arg = Argument::::from_c(i, &arg, target, constraint); + let mut arg = + Argument::::new(i, String::from(arg_name), ty, constraint); // The JSON doesn't list immediates as const let IntrinsicType { ref mut constant, .. - } = arg.ty.0; + } = arg.ty.data; if arg.name.starts_with("imm") { *constant = true } diff --git a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs index 0a64a24e7313..51f5ac428378 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/mod.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/mod.rs @@ -1,23 +1,24 @@ +mod argument; mod compile; mod config; mod intrinsic; mod json_parser; mod types; -use std::fs::File; +use std::fs::{self, File}; use rayon::prelude::*; -use crate::arm::config::POLY128_OSTREAM_DEF; -use crate::common::SupportedArchitectureTest; use crate::common::cli::ProcessedCli; use crate::common::compare::compare_outputs; use crate::common::gen_c::{write_main_cpp, write_mod_cpp}; -use crate::common::gen_rust::compile_rust_programs; -use crate::common::intrinsic::{Intrinsic, IntrinsicDefinition}; +use crate::common::gen_rust::{ + compile_rust_programs, write_bin_cargo_toml, write_lib_cargo_toml, write_lib_rs, write_main_rs, +}; +use crate::common::intrinsic::Intrinsic; use crate::common::intrinsic_helpers::TypeKind; -use crate::common::write_file::write_rust_testfiles; -use config::{AARCH_CONFIGURATIONS, F16_FORMATTING_DEF, build_notices}; +use crate::common::{SupportedArchitectureTest, chunk_info}; +use config::{AARCH_CONFIGURATIONS, F16_FORMATTING_DEF, POLY128_OSTREAM_DEF, build_notices}; use intrinsic::ArmIntrinsicType; use json_parser::get_neon_intrinsics; @@ -26,13 +27,6 @@ pub struct ArmArchitectureTest { cli_options: ProcessedCli, } -fn chunk_info(intrinsic_count: usize) -> (usize, usize) { - let available_parallelism = std::thread::available_parallelism().unwrap().get(); - let chunk_size = intrinsic_count.div_ceil(Ord::min(available_parallelism, intrinsic_count)); - - (chunk_size, intrinsic_count.div_ceil(chunk_size)) -} - impl SupportedArchitectureTest for ArmArchitectureTest { fn create(cli_options: ProcessedCli) -> Box { let a32 = cli_options.target.contains("v7"); @@ -68,9 +62,10 @@ impl SupportedArchitectureTest for ArmArchitectureTest { let (chunk_size, chunk_count) = chunk_info(self.intrinsics.len()); - let cpp_compiler = compile::build_cpp_compilation(&self.cli_options).unwrap(); + let cpp_compiler_wrapped = compile::build_cpp_compilation(&self.cli_options); let notice = &build_notices("// "); + fs::create_dir_all("c_programs").unwrap(); self.intrinsics .par_chunks(chunk_size) .enumerate() @@ -79,10 +74,15 @@ impl SupportedArchitectureTest for ArmArchitectureTest { let mut file = File::create(&c_filename).unwrap(); write_mod_cpp(&mut file, notice, c_target, platform_headers, chunk).unwrap(); - // compile this cpp file into a .o file - let output = cpp_compiler - .compile_object_file(&format!("mod_{i}.cpp"), &format!("mod_{i}.o"))?; - assert!(output.status.success(), "{output:?}"); + // compile this cpp file into a .o file. + // + // This is done because `cpp_compiler_wrapped` is None when + // the --generate-only flag is passed + if let Some(cpp_compiler) = cpp_compiler_wrapped.as_ref() { + let output = cpp_compiler + .compile_object_file(&format!("mod_{i}.cpp"), &format!("mod_{i}.o"))?; + assert!(output.status.success(), "{output:?}"); + } Ok(()) }) @@ -98,46 +98,84 @@ impl SupportedArchitectureTest for ArmArchitectureTest { ) .unwrap(); - // compile this cpp file into a .o file - info!("compiling main.cpp"); - let output = cpp_compiler - .compile_object_file("main.cpp", "intrinsic-test-programs.o") - .unwrap(); - assert!(output.status.success(), "{output:?}"); + // This is done because `cpp_compiler_wrapped` is None when + // the --generate-only flag is passed + if let Some(cpp_compiler) = cpp_compiler_wrapped.as_ref() { + // compile this cpp file into a .o file + info!("compiling main.cpp"); + let output = cpp_compiler + .compile_object_file("main.cpp", "intrinsic-test-programs.o") + .unwrap(); + assert!(output.status.success(), "{output:?}"); - let object_files = (0..chunk_count) - .map(|i| format!("mod_{i}.o")) - .chain(["intrinsic-test-programs.o".to_owned()]); + let object_files = (0..chunk_count) + .map(|i| format!("mod_{i}.o")) + .chain(["intrinsic-test-programs.o".to_owned()]); - let output = cpp_compiler - .link_executable(object_files, "intrinsic-test-programs") - .unwrap(); - assert!(output.status.success(), "{output:?}"); + let output = cpp_compiler + .link_executable(object_files, "intrinsic-test-programs") + .unwrap(); + assert!(output.status.success(), "{output:?}"); + } true } fn build_rust_file(&self) -> bool { - let rust_target = if self.cli_options.target.contains("v7") { + std::fs::create_dir_all("rust_programs/src").unwrap(); + + let architecture = if self.cli_options.target.contains("v7") { "arm" } else { "aarch64" }; + + let (chunk_size, chunk_count) = chunk_info(self.intrinsics.len()); + + let mut cargo = File::create("rust_programs/Cargo.toml").unwrap(); + write_bin_cargo_toml(&mut cargo, chunk_count).unwrap(); + + let mut main_rs = File::create("rust_programs/src/main.rs").unwrap(); + write_main_rs( + &mut main_rs, + chunk_count, + AARCH_CONFIGURATIONS, + "", + self.intrinsics.iter().map(|i| i.name.as_str()), + ) + .unwrap(); + let target = &self.cli_options.target; let toolchain = self.cli_options.toolchain.as_deref(); let linker = self.cli_options.linker.as_deref(); - let intrinsics_name_list = write_rust_testfiles( - self.intrinsics - .iter() - .map(|i| i as &dyn IntrinsicDefinition<_>) - .collect::>(), - rust_target, - &build_notices("// "), - F16_FORMATTING_DEF, - AARCH_CONFIGURATIONS, - ); - compile_rust_programs(intrinsics_name_list, toolchain, target, linker) + let notice = &build_notices("// "); + self.intrinsics + .par_chunks(chunk_size) + .enumerate() + .map(|(i, chunk)| { + std::fs::create_dir_all(format!("rust_programs/mod_{i}/src"))?; + + let rust_filename = format!("rust_programs/mod_{i}/src/lib.rs"); + trace!("generating `{rust_filename}`"); + let mut file = File::create(rust_filename)?; + + let cfg = AARCH_CONFIGURATIONS; + let definitions = F16_FORMATTING_DEF; + write_lib_rs(&mut file, architecture, notice, cfg, definitions, chunk)?; + + let toml_filename = format!("rust_programs/mod_{i}/Cargo.toml"); + trace!("generating `{toml_filename}`"); + let mut file = File::create(toml_filename).unwrap(); + + write_lib_cargo_toml(&mut file, &format!("mod_{i}"))?; + + Ok(()) + }) + .collect::>() + .unwrap(); + + compile_rust_programs(toolchain, target, linker) } fn compare_outputs(&self) -> bool { diff --git a/library/stdarch/crates/intrinsic-test/src/arm/types.rs b/library/stdarch/crates/intrinsic-test/src/arm/types.rs index 77f5e8d0e560..32f8f106ce26 100644 --- a/library/stdarch/crates/intrinsic-test/src/arm/types.rs +++ b/library/stdarch/crates/intrinsic-test/src/arm/types.rs @@ -5,12 +5,10 @@ use crate::common::intrinsic_helpers::{IntrinsicType, IntrinsicTypeDefinition, S impl IntrinsicTypeDefinition for ArmIntrinsicType { /// Gets a string containing the typename for this type in C format. fn c_type(&self) -> String { - let prefix = self.0.kind.c_prefix(); - let const_prefix = if self.0.constant { "const " } else { "" }; + let prefix = self.kind.c_prefix(); + let const_prefix = if self.constant { "const " } else { "" }; - if let (Some(bit_len), simd_len, vec_len) = - (self.0.bit_len, self.0.simd_len, self.0.vec_len) - { + if let (Some(bit_len), simd_len, vec_len) = (self.bit_len, self.simd_len, self.vec_len) { match (simd_len, vec_len) { (None, None) => format!("{const_prefix}{prefix}{bit_len}_t"), (Some(simd), None) => format!("{prefix}{bit_len}x{simd}_t"), @@ -23,35 +21,16 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { } fn c_single_vector_type(&self) -> String { - if let (Some(bit_len), Some(simd_len)) = (self.0.bit_len, self.0.simd_len) { + if let (Some(bit_len), Some(simd_len)) = (self.bit_len, self.simd_len) { format!( "{prefix}{bit_len}x{simd_len}_t", - prefix = self.0.kind.c_prefix() + prefix = self.kind.c_prefix() ) } else { unreachable!("Shouldn't be called on this type") } } - fn rust_type(&self) -> String { - let rust_prefix = self.0.kind.rust_prefix(); - let c_prefix = self.0.kind.c_prefix(); - if self.0.ptr_constant { - self.c_type() - } else if let (Some(bit_len), simd_len, vec_len) = - (self.0.bit_len, self.0.simd_len, self.0.vec_len) - { - match (simd_len, vec_len) { - (None, None) => format!("{rust_prefix}{bit_len}"), - (Some(simd), None) => format!("{c_prefix}{bit_len}x{simd}_t"), - (Some(simd), Some(vec)) => format!("{c_prefix}{bit_len}x{simd}x{vec}_t"), - (None, Some(_)) => todo!("{:#?}", self), // Likely an invalid case - } - } else { - todo!("{:#?}", self) - } - } - /// Determines the load function for this type. fn get_load_function(&self, language: Language) -> String { if let IntrinsicType { @@ -59,9 +38,8 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { bit_len: Some(bl), simd_len, vec_len, - target, .. - } = &self.0 + } = &self.data { let quad = if simd_len.unwrap_or(1) * bl > 64 { "q" @@ -69,7 +47,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { "" }; - let choose_workaround = language == Language::C && target.contains("v7"); + let choose_workaround = language == Language::C && self.target.contains("v7"); format!( "vld{len}{quad}_{type}{size}", type = match k { @@ -97,7 +75,7 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { bit_len: Some(bl), simd_len, .. - } = &self.0 + } = &self.data { let quad = if (simd_len.unwrap_or(1) * bl) > 64 { "q" @@ -120,8 +98,10 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { todo!("get_lane_function IntrinsicType: {:#?}", self) } } +} - fn from_c(s: &str, target: &str) -> Result { +impl ArmIntrinsicType { + pub fn from_c(s: &str, target: &str) -> Result { const CONST_STR: &str = "const"; if let Some(s) = s.strip_suffix('*') { let (s, constant) = match s.trim().strip_suffix(CONST_STR) { @@ -162,32 +142,36 @@ impl IntrinsicTypeDefinition for ArmIntrinsicType { ), None => None, }; - Ok(ArmIntrinsicType(IntrinsicType { - ptr: false, - ptr_constant: false, - constant, - kind: arg_kind, - bit_len: Some(bit_len), - simd_len, - vec_len, + Ok(ArmIntrinsicType { + data: IntrinsicType { + ptr: false, + ptr_constant: false, + constant, + kind: arg_kind, + bit_len: Some(bit_len), + simd_len, + vec_len, + }, target: target.to_string(), - })) + }) } else { let kind = start.parse::()?; let bit_len = match kind { TypeKind::Int(_) => Some(32), _ => None, }; - Ok(ArmIntrinsicType(IntrinsicType { - ptr: false, - ptr_constant: false, - constant, - kind: start.parse::()?, - bit_len, - simd_len: None, - vec_len: None, + Ok(ArmIntrinsicType { + data: IntrinsicType { + ptr: false, + ptr_constant: false, + constant, + kind: start.parse::()?, + bit_len, + simd_len: None, + vec_len: None, + }, target: target.to_string(), - })) + }) } } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/argument.rs b/library/stdarch/crates/intrinsic-test/src/common/argument.rs index 1df4f55995e4..f38515e40a9d 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/argument.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/argument.rs @@ -20,6 +20,15 @@ impl Argument where T: IntrinsicTypeDefinition, { + pub fn new(pos: usize, name: String, ty: T, constraint: Option) -> Self { + Argument { + pos, + name, + ty, + constraint, + } + } + pub fn to_c_type(&self) -> String { self.ty.c_type() } @@ -36,14 +45,6 @@ where self.constraint.is_some() } - pub fn type_and_name_from_c(arg: &str) -> (&str, &str) { - let split_index = arg - .rfind([' ', '*']) - .expect("Couldn't split type and argname"); - - (arg[..split_index + 1].trim_end(), &arg[split_index + 1..]) - } - /// The binding keyword (e.g. "const" or "let") for the array of possible test inputs. fn rust_vals_array_binding(&self) -> impl std::fmt::Display { if self.ty.is_rust_vals_array_const() { @@ -62,25 +63,6 @@ where } } - pub fn from_c( - pos: usize, - arg: &str, - target: &str, - constraint: Option, - ) -> Argument { - let (ty, var_name) = Self::type_and_name_from_c(arg); - - let ty = - T::from_c(ty, target).unwrap_or_else(|_| panic!("Failed to parse argument '{arg}'")); - - Argument { - pos, - name: String::from(var_name), - ty: ty, - constraint, - } - } - fn as_call_param_c(&self) -> String { self.ty.as_call_param_c(&self.name) } @@ -114,14 +96,6 @@ where .join(", ") } - pub fn as_constraint_parameters_rust(&self) -> String { - self.iter() - .filter(|a| a.has_constraint()) - .map(|arg| arg.name.clone()) - .collect::>() - .join(", ") - } - /// Creates a line for each argument that initializes an array for C from which `loads` argument /// values can be loaded as a sliding window. /// e.g `const int32x2_t a_vals = {0x3effffff, 0x3effffff, 0x3f7fffff}`, if loads=2. @@ -146,21 +120,25 @@ where /// Creates a line for each argument that initializes an array for Rust from which `loads` argument /// values can be loaded as a sliding window, e.g `const A_VALS: [u32; 20] = [...];` - pub fn gen_arglists_rust(&self, indentation: Indentation, loads: u32) -> String { - self.iter() - .filter(|&arg| !arg.has_constraint()) - .map(|arg| { - format!( - "{indentation}{bind} {name}: [{ty}; {load_size}] = {values};", - bind = arg.rust_vals_array_binding(), - name = arg.rust_vals_array_name(), - ty = arg.ty.rust_scalar_type(), - load_size = arg.ty.num_lanes() * arg.ty.num_vectors() + loads - 1, - values = arg.ty.populate_random(indentation, loads, &Language::Rust) - ) - }) - .collect::>() - .join("\n") + pub fn gen_arglists_rust( + &self, + w: &mut impl std::io::Write, + indentation: Indentation, + loads: u32, + ) -> std::io::Result<()> { + for arg in self.iter().filter(|&arg| !arg.has_constraint()) { + writeln!( + w, + "{indentation}{bind} {name}: [{ty}; {load_size}] = {values};", + bind = arg.rust_vals_array_binding(), + name = arg.rust_vals_array_name(), + ty = arg.ty.rust_scalar_type(), + load_size = arg.ty.num_lanes() * arg.ty.num_vectors() + loads - 1, + values = arg.ty.populate_random(indentation, loads, &Language::Rust) + )? + } + + Ok(()) } /// Creates a line for each argument that initializes the argument from an array `[arg]_vals` at diff --git a/library/stdarch/crates/intrinsic-test/src/common/compare.rs b/library/stdarch/crates/intrinsic-test/src/common/compare.rs index cb55922eb199..1ad00839ef02 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/compare.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/compare.rs @@ -2,25 +2,29 @@ use super::cli::FailureReason; use rayon::prelude::*; use std::process::Command; +fn runner_command(runner: &str) -> Command { + let mut it = runner.split_whitespace(); + let mut cmd = Command::new(it.next().unwrap()); + cmd.args(it); + + cmd +} + pub fn compare_outputs(intrinsic_name_list: &Vec, runner: &str, target: &str) -> bool { - fn runner_command(runner: &str) -> Command { - let mut it = runner.split_whitespace(); - let mut cmd = Command::new(it.next().unwrap()); - cmd.args(it); - - cmd - } - let intrinsics = intrinsic_name_list .par_iter() .filter_map(|intrinsic_name| { + let c = runner_command(runner) - .arg("./c_programs/intrinsic-test-programs") + .arg("intrinsic-test-programs") .arg(intrinsic_name) + .current_dir("c_programs") .output(); let rust = runner_command(runner) - .arg(format!("target/{target}/release/{intrinsic_name}")) + .arg(format!("target/{target}/release/intrinsic-test-programs")) + .arg(intrinsic_name) + .current_dir("rust_programs") .output(); let (c, rust) = match (c, rust) { @@ -30,7 +34,7 @@ pub fn compare_outputs(intrinsic_name_list: &Vec, runner: &str, target: if !c.status.success() { error!( - "Failed to run C program for intrinsic {intrinsic_name}\nstdout: {stdout}\nstderr: {stderr}", + "Failed to run C program for intrinsic `{intrinsic_name}`\nstdout: {stdout}\nstderr: {stderr}", stdout = std::str::from_utf8(&c.stdout).unwrap_or(""), stderr = std::str::from_utf8(&c.stderr).unwrap_or(""), ); @@ -39,9 +43,9 @@ pub fn compare_outputs(intrinsic_name_list: &Vec, runner: &str, target: if !rust.status.success() { error!( - "Failed to run Rust program for intrinsic {intrinsic_name}\nstdout: {stdout}\nstderr: {stderr}", - stdout = String::from_utf8_lossy(&rust.stdout), - stderr = String::from_utf8_lossy(&rust.stderr), + "Failed to run Rust program for intrinsic `{intrinsic_name}`\nstdout: {stdout}\nstderr: {stderr}", + stdout = std::str::from_utf8(&rust.stdout).unwrap_or(""), + stderr = std::str::from_utf8(&rust.stderr).unwrap_or(""), ); return Some(FailureReason::RunRust(intrinsic_name.clone())); } diff --git a/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs b/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs index 0c905a149e48..258e41816583 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/compile_c.rs @@ -37,9 +37,9 @@ impl CompilationCommandBuilder { self } - pub fn add_arch_flags(mut self, flags: Vec<&str>) -> Self { - let mut new_arch_flags = flags.into_iter().map(|v| v.to_string()).collect(); - self.arch_flags.append(&mut new_arch_flags); + pub fn add_arch_flags<'a>(mut self, flags: impl IntoIterator) -> Self { + self.arch_flags + .extend(flags.into_iter().map(|s| s.to_owned())); self } @@ -55,14 +55,15 @@ impl CompilationCommandBuilder { self } - pub fn add_extra_flags(mut self, flags: Vec<&str>) -> Self { - let mut flags: Vec = flags.into_iter().map(|f| f.to_string()).collect(); - self.extra_flags.append(&mut flags); + pub fn add_extra_flags<'a>(mut self, flags: impl IntoIterator) -> Self { + self.extra_flags + .extend(flags.into_iter().map(|s| s.to_owned())); + self } pub fn add_extra_flag(self, flag: &str) -> Self { - self.add_extra_flags(vec![flag]) + self.add_extra_flags([flag]) } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/constraint.rs b/library/stdarch/crates/intrinsic-test/src/common/constraint.rs index 269fb7f90cb7..5984e0fcc22f 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/constraint.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/constraint.rs @@ -1,17 +1,24 @@ use serde::Deserialize; use std::ops::Range; +/// Describes the values to test for a const generic parameter. #[derive(Debug, PartialEq, Clone, Deserialize)] pub enum Constraint { + /// Test a single value. Equal(i64), + /// Test a range of values, e.g. `0..16`. Range(Range), + /// Test discrete values, e.g. `vec![1, 2, 4, 8]`. + Set(Vec), } impl Constraint { - pub fn to_range(&self) -> Range { + /// Iterate over the values of this constraint. + pub fn iter<'a>(&'a self) -> impl Iterator + 'a { match self { - Constraint::Equal(eq) => *eq..*eq + 1, - Constraint::Range(range) => range.clone(), + Constraint::Equal(i) => std::slice::Iter::default().copied().chain(*i..*i + 1), + Constraint::Range(range) => std::slice::Iter::default().copied().chain(range.clone()), + Constraint::Set(items) => items.iter().copied().chain(std::ops::Range::default()), } } } diff --git a/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs b/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs index 905efb6d8909..84755ce52505 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/gen_c.rs @@ -40,7 +40,7 @@ pub fn generate_c_constraint_blocks<'a, T: IntrinsicTypeDefinition + 'a>( }; let body_indentation = indentation.nested(); - for i in current.constraint.iter().flat_map(|c| c.to_range()) { + for i in current.constraint.iter().flat_map(|c| c.iter()) { let ty = current.ty.c_type(); writeln!(w, "{indentation}{{")?; diff --git a/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs b/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs index 0e4a95ab528a..2a02b8fdff1d 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/gen_rust.rs @@ -1,10 +1,6 @@ use itertools::Itertools; -use rayon::prelude::*; -use std::collections::BTreeMap; -use std::fs::File; use std::process::Command; -use super::argument::Argument; use super::indentation::Indentation; use super::intrinsic::{IntrinsicDefinition, format_f16_return_value}; use super::intrinsic_helpers::IntrinsicTypeDefinition; @@ -12,86 +8,144 @@ use super::intrinsic_helpers::IntrinsicTypeDefinition; // The number of times each intrinsic will be called. const PASSES: u32 = 20; -pub fn format_rust_main_template( - notices: &str, - definitions: &str, - configurations: &str, - arch_definition: &str, - arglists: &str, - passes: &str, -) -> String { - format!( - r#"{notices}#![feature(simd_ffi)] -#![feature(f16)] -#![allow(unused)] -{configurations} -{definitions} - -use core_arch::arch::{arch_definition}::*; - -fn main() {{ -{arglists} -{passes} -}} -"#, - ) -} - -fn write_cargo_toml(w: &mut impl std::io::Write, binaries: &[String]) -> std::io::Result<()> { +fn write_cargo_toml_header(w: &mut impl std::io::Write, name: &str) -> std::io::Result<()> { writeln!( w, concat!( "[package]\n", - "name = \"intrinsic-test-programs\"\n", + "name = \"{name}\"\n", "version = \"{version}\"\n", "authors = [{authors}]\n", "license = \"{license}\"\n", "edition = \"2018\"\n", - "[workspace]\n", - "[dependencies]\n", - "core_arch = {{ path = \"../crates/core_arch\" }}", ), + name = name, version = env!("CARGO_PKG_VERSION"), authors = env!("CARGO_PKG_AUTHORS") .split(":") .format_with(", ", |author, fmt| fmt(&format_args!("\"{author}\""))), license = env!("CARGO_PKG_LICENSE"), - )?; + ) +} - for binary in binaries { - writeln!( - w, - concat!( - "[[bin]]\n", - "name = \"{binary}\"\n", - "path = \"{binary}/main.rs\"\n", - ), - binary = binary, - )?; +pub fn write_bin_cargo_toml( + w: &mut impl std::io::Write, + module_count: usize, +) -> std::io::Result<()> { + write_cargo_toml_header(w, "intrinsic-test-programs")?; + + writeln!(w, "[dependencies]")?; + + for i in 0..module_count { + writeln!(w, "mod_{i} = {{ path = \"mod_{i}/\" }}")?; } Ok(()) } -pub fn compile_rust_programs( - binaries: Vec, - toolchain: Option<&str>, - target: &str, - linker: Option<&str>, -) -> bool { - let mut cargo = File::create("rust_programs/Cargo.toml").unwrap(); - write_cargo_toml(&mut cargo, &binaries).unwrap(); +pub fn write_lib_cargo_toml(w: &mut impl std::io::Write, name: &str) -> std::io::Result<()> { + write_cargo_toml_header(w, name)?; + writeln!(w, "[dependencies]")?; + writeln!(w, "core_arch = {{ path = \"../../crates/core_arch\" }}")?; + + Ok(()) +} + +pub fn write_main_rs<'a>( + w: &mut impl std::io::Write, + chunk_count: usize, + cfg: &str, + definitions: &str, + intrinsics: impl Iterator + Clone, +) -> std::io::Result<()> { + writeln!(w, "#![feature(simd_ffi)]")?; + writeln!(w, "#![feature(f16)]")?; + writeln!(w, "#![allow(unused)]")?; + + // Cargo will spam the logs if these warnings are not silenced. + writeln!(w, "#![allow(non_upper_case_globals)]")?; + writeln!(w, "#![allow(non_camel_case_types)]")?; + writeln!(w, "#![allow(non_snake_case)]")?; + + writeln!(w, "{cfg}")?; + writeln!(w, "{definitions}")?; + + for module in 0..chunk_count { + writeln!(w, "use mod_{module}::*;")?; + } + + writeln!(w, "fn main() {{")?; + + writeln!(w, " match std::env::args().nth(1).unwrap().as_str() {{")?; + + for binary in intrinsics { + writeln!(w, " \"{binary}\" => run_{binary}(),")?; + } + + writeln!( + w, + " other => panic!(\"unknown intrinsic `{{}}`\", other)," + )?; + + writeln!(w, " }}")?; + writeln!(w, "}}")?; + + Ok(()) +} + +pub fn write_lib_rs( + w: &mut impl std::io::Write, + architecture: &str, + notice: &str, + cfg: &str, + definitions: &str, + intrinsics: &[impl IntrinsicDefinition], +) -> std::io::Result<()> { + write!(w, "{notice}")?; + + writeln!(w, "#![feature(simd_ffi)]")?; + writeln!(w, "#![feature(f16)]")?; + writeln!(w, "#![allow(unused)]")?; + + // Cargo will spam the logs if these warnings are not silenced. + writeln!(w, "#![allow(non_upper_case_globals)]")?; + writeln!(w, "#![allow(non_camel_case_types)]")?; + writeln!(w, "#![allow(non_snake_case)]")?; + + writeln!(w, "{cfg}")?; + + writeln!(w, "use core_arch::arch::{architecture}::*;")?; + + writeln!(w, "{definitions}")?; + + for intrinsic in intrinsics { + crate::common::gen_rust::create_rust_test_module(w, intrinsic)?; + } + + Ok(()) +} + +pub fn compile_rust_programs(toolchain: Option<&str>, target: &str, linker: Option<&str>) -> bool { /* If there has been a linker explicitly set from the command line then * we want to set it via setting it in the RUSTFLAGS*/ + // This is done because `toolchain` is None when + // the --generate-only flag is passed + if toolchain.is_none() { + return true; + } + + trace!("Building cargo command"); + let mut cargo_command = Command::new("cargo"); cargo_command.current_dir("rust_programs"); - if let Some(toolchain) = toolchain { - if !toolchain.is_empty() { - cargo_command.arg(toolchain); - } + // Do not use the target directory of the workspace please. + cargo_command.env("CARGO_TARGET_DIR", "target"); + + if toolchain.is_some_and(|val| !val.is_empty()) { + cargo_command.arg(toolchain.unwrap()); } cargo_command.args(["build", "--target", target, "--release"]); @@ -105,7 +159,16 @@ pub fn compile_rust_programs( } cargo_command.env("RUSTFLAGS", rust_flags); + + trace!("running cargo"); + + if log::log_enabled!(log::Level::Trace) { + cargo_command.stdout(std::process::Stdio::inherit()); + cargo_command.stderr(std::process::Stdio::inherit()); + } + let output = cargo_command.output(); + trace!("cargo is done"); if let Ok(output) = output { if output.status.success() { @@ -124,119 +187,117 @@ pub fn compile_rust_programs( } } -// Creates directory structure and file path mappings -pub fn setup_rust_file_paths(identifiers: &Vec) -> BTreeMap<&String, String> { - identifiers - .par_iter() - .map(|identifier| { - let rust_dir = format!("rust_programs/{identifier}"); - let _ = std::fs::create_dir_all(&rust_dir); - let rust_filename = format!("{rust_dir}/main.rs"); - - (identifier, rust_filename) - }) - .collect::>() -} - pub fn generate_rust_test_loop( + w: &mut impl std::io::Write, intrinsic: &dyn IntrinsicDefinition, indentation: Indentation, - additional: &str, + specializations: &[Vec], passes: u32, -) -> String { - let constraints = intrinsic.arguments().as_constraint_parameters_rust(); - let constraints = if !constraints.is_empty() { - format!("::<{constraints}>") - } else { - constraints - }; +) -> std::io::Result<()> { + let intrinsic_name = intrinsic.name(); + + // Each function (and each specialization) has its own type. Erase that type with a cast. + let mut coerce = String::from("unsafe fn("); + for _ in intrinsic.arguments().iter().filter(|a| !a.has_constraint()) { + coerce += "_, "; + } + coerce += ") -> _"; + + match specializations { + [] => { + writeln!(w, " let specializations = [(\"\", {intrinsic_name})];")?; + } + [const_args] if const_args.is_empty() => { + writeln!(w, " let specializations = [(\"\", {intrinsic_name})];")?; + } + _ => { + writeln!(w, " let specializations = [")?; + + for specialization in specializations { + let mut specialization: Vec<_> = + specialization.iter().map(|d| d.to_string()).collect(); + + let const_args = specialization.join(","); + + // The identifier is reversed. + specialization.reverse(); + let id = specialization.join("-"); + + writeln!( + w, + " (\"-{id}\", {intrinsic_name}::<{const_args}> as {coerce})," + )?; + } + + writeln!(w, " ];")?; + } + } let return_value = format_f16_return_value(intrinsic); let indentation2 = indentation.nested(); let indentation3 = indentation2.nested(); - format!( - "{indentation}for i in 0..{passes} {{\n\ - {indentation2}unsafe {{\n\ - {loaded_args}\ - {indentation3}let __return_value = {intrinsic_call}{const}({args});\n\ - {indentation3}println!(\"Result {additional}-{{}}: {{:?}}\", i + 1, {return_value});\n\ - {indentation2}}}\n\ - {indentation}}}", + writeln!( + w, + "\ + for (id, f) in specializations {{\n\ + for i in 0..{passes} {{\n\ + unsafe {{\n\ + {loaded_args}\ + let __return_value = f({args});\n\ + println!(\"Result {{id}}-{{}}: {{:?}}\", i + 1, {return_value});\n\ + }}\n\ + }}\n\ + }}", loaded_args = intrinsic.arguments().load_values_rust(indentation3), - intrinsic_call = intrinsic.name(), - const = constraints, args = intrinsic.arguments().as_call_param_rust(), ) } -pub fn generate_rust_constraint_blocks( - intrinsic: &dyn IntrinsicDefinition, - indentation: Indentation, - constraints: &[&Argument], - name: String, -) -> String { - if let Some((current, constraints)) = constraints.split_last() { - let range = current - .constraint - .iter() - .map(|c| c.to_range()) - .flat_map(|r| r.into_iter()); +/// Generate the specializations (unique sequences of const-generic arguments) for this intrinsic. +fn generate_rust_specializations<'a>( + constraints: &mut impl Iterator>, +) -> Vec> { + let mut specializations = vec![vec![]]; - let body_indentation = indentation.nested(); - range - .map(|i| { - format!( - "{indentation}{{\n\ - {body_indentation}const {name}: {ty} = {val};\n\ - {pass}\n\ - {indentation}}}", - name = current.name, - ty = current.ty.rust_type(), - val = i, - pass = generate_rust_constraint_blocks( - intrinsic, - body_indentation, - constraints, - format!("{name}-{i}") - ) - ) + for constraint in constraints { + specializations = constraint + .flat_map(|right| { + specializations.iter().map(move |left| { + let mut left = left.clone(); + left.push(u8::try_from(right).unwrap()); + left + }) }) - .join("\n") - } else { - generate_rust_test_loop(intrinsic, indentation, &name, PASSES) + .collect(); } + + specializations } // Top-level function to create complete test program -pub fn create_rust_test_program( +pub fn create_rust_test_module( + w: &mut impl std::io::Write, intrinsic: &dyn IntrinsicDefinition, - target: &str, - notice: &str, - definitions: &str, - cfg: &str, -) -> String { - let arguments = intrinsic.arguments(); - let constraints = arguments - .iter() - .filter(|i| i.has_constraint()) - .collect_vec(); - +) -> std::io::Result<()> { + trace!("generating `{}`", intrinsic.name()); let indentation = Indentation::default(); - format_rust_main_template( - notice, - definitions, - cfg, - target, - intrinsic - .arguments() - .gen_arglists_rust(indentation.nested(), PASSES) - .as_str(), - generate_rust_constraint_blocks( - intrinsic, - indentation.nested(), - &constraints, - Default::default(), - ) - .as_str(), - ) + + writeln!(w, "pub fn run_{}() {{", intrinsic.name())?; + + // Define the arrays of arguments. + let arguments = intrinsic.arguments(); + arguments.gen_arglists_rust(w, indentation.nested(), PASSES)?; + + // Define any const generics as `const` items, then generate the actual test loop. + let specializations = generate_rust_specializations( + &mut arguments + .iter() + .filter_map(|i| i.constraint.as_ref().map(|v| v.iter())), + ); + + generate_rust_test_loop(w, intrinsic, indentation, &specializations, PASSES)?; + + writeln!(w, "}}")?; + + Ok(()) } diff --git a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs index 697f9c8754da..f5e84ca97af2 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/intrinsic_helpers.rs @@ -120,8 +120,6 @@ pub struct IntrinsicType { /// rows encoded in the type (e.g. uint8x8_t). /// A value of `None` can be assumed to be 1 though. pub vec_len: Option, - - pub target: String, } impl IntrinsicType { @@ -321,18 +319,10 @@ pub trait IntrinsicTypeDefinition: Deref { /// can be implemented in an `impl` block fn get_lane_function(&self) -> String; - /// can be implemented in an `impl` block - fn from_c(_s: &str, _target: &str) -> Result - where - Self: Sized; - /// Gets a string containing the typename for this type in C format. /// can be directly defined in `impl` blocks fn c_type(&self) -> String; /// can be directly defined in `impl` blocks fn c_single_vector_type(&self) -> String; - - /// can be defined in `impl` blocks - fn rust_type(&self) -> String; } diff --git a/library/stdarch/crates/intrinsic-test/src/common/mod.rs b/library/stdarch/crates/intrinsic-test/src/common/mod.rs index 5d51d3460ecf..5a57c8027db9 100644 --- a/library/stdarch/crates/intrinsic-test/src/common/mod.rs +++ b/library/stdarch/crates/intrinsic-test/src/common/mod.rs @@ -11,7 +11,6 @@ pub mod indentation; pub mod intrinsic; pub mod intrinsic_helpers; pub mod values; -pub mod write_file; /// Architectures must support this trait /// to be successfully tested. @@ -23,3 +22,10 @@ pub trait SupportedArchitectureTest { fn build_rust_file(&self) -> bool; fn compare_outputs(&self) -> bool; } + +pub fn chunk_info(intrinsic_count: usize) -> (usize, usize) { + let available_parallelism = std::thread::available_parallelism().unwrap().get(); + let chunk_size = intrinsic_count.div_ceil(Ord::min(available_parallelism, intrinsic_count)); + + (chunk_size, intrinsic_count.div_ceil(chunk_size)) +} diff --git a/library/stdarch/crates/intrinsic-test/src/common/write_file.rs b/library/stdarch/crates/intrinsic-test/src/common/write_file.rs deleted file mode 100644 index 92dd70b7c578..000000000000 --- a/library/stdarch/crates/intrinsic-test/src/common/write_file.rs +++ /dev/null @@ -1,33 +0,0 @@ -use super::gen_rust::{create_rust_test_program, setup_rust_file_paths}; -use super::intrinsic::IntrinsicDefinition; -use super::intrinsic_helpers::IntrinsicTypeDefinition; -use std::fs::File; -use std::io::Write; - -pub fn write_file(filename: &String, code: String) { - let mut file = File::create(filename).unwrap(); - file.write_all(code.into_bytes().as_slice()).unwrap(); -} - -pub fn write_rust_testfiles( - intrinsics: Vec<&dyn IntrinsicDefinition>, - rust_target: &str, - notice: &str, - definitions: &str, - cfg: &str, -) -> Vec { - let intrinsics_name_list = intrinsics - .iter() - .map(|i| i.name().clone()) - .collect::>(); - let filename_mapping = setup_rust_file_paths(&intrinsics_name_list); - - intrinsics.iter().for_each(|&i| { - let rust_code = create_rust_test_program(i, rust_target, notice, definitions, cfg); - if let Some(filename) = filename_mapping.get(&i.name()) { - write_file(filename, rust_code) - } - }); - - intrinsics_name_list -} diff --git a/library/stdarch/crates/stdarch-gen-arm/Cargo.toml b/library/stdarch/crates/stdarch-gen-arm/Cargo.toml index 312019f454cb..de24335a52e8 100644 --- a/library/stdarch/crates/stdarch-gen-arm/Cargo.toml +++ b/library/stdarch/crates/stdarch-gen-arm/Cargo.toml @@ -17,6 +17,6 @@ proc-macro2 = "1.0" quote = "1.0" regex = "1.5" serde = { version = "1.0", features = ["derive"] } -serde_with = "1.14" +serde_with = { version = "3.2.0", default-features = false, features = ["macros"] } serde_yaml = "0.8" walkdir = "2.3.2" diff --git a/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs b/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs index 40132097f5de..5076064ffcdd 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs +++ b/library/stdarch/crates/stdarch-gen-loongarch/src/main.rs @@ -156,6 +156,7 @@ fn gen_bind(in_file: String, ext_name: &str) -> io::Result<()> { // OUT_DIR=`pwd`/crates/core_arch cargo run -p stdarch-gen-loongarch -- {in_file} // ``` +use crate::mem::transmute; use super::types::*; "# )); @@ -239,38 +240,63 @@ fn gen_bind_body( para_num: i32, target: TargetFeature, ) -> (String, String) { - let type_to_rst = |t: &str, s: bool| -> &str { - match (t, s) { - ("V16QI", _) => "v16i8", - ("V32QI", _) => "v32i8", - ("V8HI", _) => "v8i16", - ("V16HI", _) => "v16i16", - ("V4SI", _) => "v4i32", - ("V8SI", _) => "v8i32", - ("V2DI", _) => "v2i64", - ("V4DI", _) => "v4i64", - ("UV16QI", _) => "v16u8", - ("UV32QI", _) => "v32u8", - ("UV8HI", _) => "v8u16", - ("UV16HI", _) => "v16u16", - ("UV4SI", _) => "v4u32", - ("UV8SI", _) => "v8u32", - ("UV2DI", _) => "v2u64", - ("UV4DI", _) => "v4u64", - ("SI", _) => "i32", - ("DI", _) => "i64", - ("USI", _) => "u32", - ("UDI", _) => "u64", - ("V4SF", _) => "v4f32", - ("V8SF", _) => "v8f32", - ("V2DF", _) => "v2f64", - ("V4DF", _) => "v4f64", - ("UQI", _) => "u32", - ("QI", _) => "i32", - ("CVPOINTER", false) => "*const i8", - ("CVPOINTER", true) => "*mut i8", - ("HI", _) => "i32", - (_, _) => panic!("unknown type: {t}"), + enum TypeKind { + Vector, + Intrinsic, + } + use TypeKind::*; + let type_to_rst = |t: &str, s: bool, k: TypeKind| -> &str { + match (t, s, k) { + ("V16QI", _, Vector) => "__v16i8", + ("V16QI", _, Intrinsic) => "m128i", + ("V32QI", _, Vector) => "__v32i8", + ("V32QI", _, Intrinsic) => "m256i", + ("V8HI", _, Vector) => "__v8i16", + ("V8HI", _, Intrinsic) => "m128i", + ("V16HI", _, Vector) => "__v16i16", + ("V16HI", _, Intrinsic) => "m256i", + ("V4SI", _, Vector) => "__v4i32", + ("V4SI", _, Intrinsic) => "m128i", + ("V8SI", _, Vector) => "__v8i32", + ("V8SI", _, Intrinsic) => "m256i", + ("V2DI", _, Vector) => "__v2i64", + ("V2DI", _, Intrinsic) => "m128i", + ("V4DI", _, Vector) => "__v4i64", + ("V4DI", _, Intrinsic) => "m256i", + ("UV16QI", _, Vector) => "__v16u8", + ("UV16QI", _, Intrinsic) => "m128i", + ("UV32QI", _, Vector) => "__v32u8", + ("UV32QI", _, Intrinsic) => "m256i", + ("UV8HI", _, Vector) => "__v8u16", + ("UV8HI", _, Intrinsic) => "m128i", + ("UV16HI", _, Vector) => "__v16u16", + ("UV16HI", _, Intrinsic) => "m256i", + ("UV4SI", _, Vector) => "__v4u32", + ("UV4SI", _, Intrinsic) => "m128i", + ("UV8SI", _, Vector) => "__v8u32", + ("UV8SI", _, Intrinsic) => "m256i", + ("UV2DI", _, Vector) => "__v2u64", + ("UV2DI", _, Intrinsic) => "m128i", + ("UV4DI", _, Vector) => "__v4u64", + ("UV4DI", _, Intrinsic) => "m256i", + ("SI", _, _) => "i32", + ("DI", _, _) => "i64", + ("USI", _, _) => "u32", + ("UDI", _, _) => "u64", + ("V4SF", _, Vector) => "__v4f32", + ("V4SF", _, Intrinsic) => "m128", + ("V8SF", _, Vector) => "__v8f32", + ("V8SF", _, Intrinsic) => "m256", + ("V2DF", _, Vector) => "__v2f64", + ("V2DF", _, Intrinsic) => "m128d", + ("V4DF", _, Vector) => "__v4f64", + ("V4DF", _, Intrinsic) => "m256d", + ("UQI", _, _) => "u32", + ("QI", _, _) => "i32", + ("CVPOINTER", false, _) => "*const i8", + ("CVPOINTER", true, _) => "*mut i8", + ("HI", _, _) => "i32", + (_, _, _) => panic!("unknown type: {t}"), } }; @@ -281,27 +307,27 @@ fn gen_bind_body( let fn_output = if out_t.to_lowercase() == "void" { String::new() } else { - format!(" -> {}", type_to_rst(out_t, is_store)) + format!(" -> {}", type_to_rst(out_t, is_store, Vector)) }; let fn_inputs = match para_num { - 1 => format!("(a: {})", type_to_rst(in_t[0], is_store)), + 1 => format!("(a: {})", type_to_rst(in_t[0], is_store, Vector)), 2 => format!( "(a: {}, b: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store) + type_to_rst(in_t[0], is_store, Vector), + type_to_rst(in_t[1], is_store, Vector) ), 3 => format!( "(a: {}, b: {}, c: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store) + type_to_rst(in_t[0], is_store, Vector), + type_to_rst(in_t[1], is_store, Vector), + type_to_rst(in_t[2], is_store, Vector) ), 4 => format!( "(a: {}, b: {}, c: {}, d: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store), - type_to_rst(in_t[3], is_store) + type_to_rst(in_t[0], is_store, Vector), + type_to_rst(in_t[1], is_store, Vector), + type_to_rst(in_t[2], is_store, Vector), + type_to_rst(in_t[3], is_store, Vector) ), _ => panic!("unsupported parameter number"), }; @@ -330,34 +356,40 @@ fn gen_bind_body( let fn_output = if out_t.to_lowercase() == "void" { String::new() } else { - format!("-> {} ", type_to_rst(out_t, is_store)) + format!("-> {} ", type_to_rst(out_t, is_store, Intrinsic)) }; let mut fn_inputs = match para_num { - 1 => format!("(a: {})", type_to_rst(in_t[0], is_store)), + 1 => format!("(a: {})", type_to_rst(in_t[0], is_store, Intrinsic)), 2 => format!( "(a: {}, b: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store) + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic) ), 3 => format!( "(a: {}, b: {}, c: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store) + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), + type_to_rst(in_t[2], is_store, Intrinsic) ), 4 => format!( "(a: {}, b: {}, c: {}, d: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store), - type_to_rst(in_t[3], is_store) + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), + type_to_rst(in_t[2], is_store, Intrinsic), + type_to_rst(in_t[3], is_store, Intrinsic) ), _ => panic!("unsupported parameter number"), }; if para_num == 1 && in_t[0] == "HI" { fn_inputs = match asm_fmts[1].as_str() { - "si13" | "i13" => format!("()", type_to_rst(in_t[0], is_store)), - "si10" => format!("()", type_to_rst(in_t[0], is_store)), + "si13" | "i13" => format!( + "()", + type_to_rst(in_t[0], is_store, Intrinsic) + ), + "si10" => format!( + "()", + type_to_rst(in_t[0], is_store, Intrinsic) + ), _ => panic!("unsupported assembly format: {}", asm_fmts[1]), }; rustc_legacy_const_generics = "rustc_legacy_const_generics(0)"; @@ -365,8 +397,8 @@ fn gen_bind_body( fn_inputs = if asm_fmts[2].starts_with("ui") { format!( "(a: {0})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), asm_fmts[2].get(2..).unwrap() ) } else { @@ -377,8 +409,8 @@ fn gen_bind_body( fn_inputs = if asm_fmts[2].starts_with("si") { format!( "(a: {0})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), asm_fmts[2].get(2..).unwrap() ) } else { @@ -389,8 +421,8 @@ fn gen_bind_body( fn_inputs = if asm_fmts[2].starts_with("si") { format!( "(mem_addr: {0})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), asm_fmts[2].get(2..).unwrap() ) } else { @@ -401,8 +433,8 @@ fn gen_bind_body( fn_inputs = match asm_fmts[2].as_str() { "rk" => format!( "(mem_addr: {}, b: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store) + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic) ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; @@ -410,9 +442,9 @@ fn gen_bind_body( fn_inputs = if asm_fmts[2].starts_with("ui") { format!( "(a: {0}, b: {1})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store), + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), + type_to_rst(in_t[2], is_store, Intrinsic), asm_fmts[2].get(2..).unwrap() ) } else { @@ -423,9 +455,9 @@ fn gen_bind_body( fn_inputs = match asm_fmts[2].as_str() { "si12" => format!( "(a: {0}, mem_addr: {1})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store) + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), + type_to_rst(in_t[2], is_store, Intrinsic) ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; @@ -434,9 +466,9 @@ fn gen_bind_body( fn_inputs = match asm_fmts[2].as_str() { "rk" => format!( "(a: {}, mem_addr: {}, b: {})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store) + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), + type_to_rst(in_t[2], is_store, Intrinsic) ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; @@ -444,10 +476,10 @@ fn gen_bind_body( fn_inputs = match (asm_fmts[2].as_str(), current_name.chars().last().unwrap()) { ("si8", t) => format!( "(a: {0}, mem_addr: {1})", - type_to_rst(in_t[0], is_store), - type_to_rst(in_t[1], is_store), - type_to_rst(in_t[2], is_store), - type_to_rst(in_t[3], is_store), + type_to_rst(in_t[0], is_store, Intrinsic), + type_to_rst(in_t[1], is_store, Intrinsic), + type_to_rst(in_t[2], is_store, Intrinsic), + type_to_rst(in_t[3], is_store, Intrinsic), type_to_imm(t), ), (_, _) => panic!( @@ -466,10 +498,16 @@ fn gen_bind_body( let unsafe_end = if !is_mem { " }" } else { "" }; let mut call_params = { match para_num { - 1 => format!("{unsafe_start}__{current_name}(a){unsafe_end}"), - 2 => format!("{unsafe_start}__{current_name}(a, b){unsafe_end}"), - 3 => format!("{unsafe_start}__{current_name}(a, b, c){unsafe_end}"), - 4 => format!("{unsafe_start}__{current_name}(a, b, c, d){unsafe_end}"), + 1 => format!("{unsafe_start}transmute(__{current_name}(transmute(a))){unsafe_end}"), + 2 => format!( + "{unsafe_start}transmute(__{current_name}(transmute(a), transmute(b))){unsafe_end}" + ), + 3 => format!( + "{unsafe_start}transmute(__{current_name}(transmute(a), transmute(b), transmute(c))){unsafe_end}" + ), + 4 => format!( + "{unsafe_start}transmute(__{current_name}(transmute(a), transmute(b), transmute(c), transmute(d))){unsafe_end}" + ), _ => panic!("unsupported parameter number"), } }; @@ -477,12 +515,12 @@ fn gen_bind_body( call_params = match asm_fmts[1].as_str() { "si10" => { format!( - "static_assert_simm_bits!(IMM_S10, 10);\n {unsafe_start}__{current_name}(IMM_S10){unsafe_end}" + "static_assert_simm_bits!(IMM_S10, 10);\n {unsafe_start}transmute(__{current_name}(IMM_S10)){unsafe_end}" ) } "i13" => { format!( - "static_assert_simm_bits!(IMM_S13, 13);\n {unsafe_start}__{current_name}(IMM_S13){unsafe_end}" + "static_assert_simm_bits!(IMM_S13, 13);\n {unsafe_start}transmute(__{current_name}(IMM_S13)){unsafe_end}" ) } _ => panic!("unsupported assembly format: {}", asm_fmts[2]), @@ -490,7 +528,7 @@ fn gen_bind_body( } else if para_num == 2 && (in_t[1] == "UQI" || in_t[1] == "USI") { call_params = if asm_fmts[2].starts_with("ui") { format!( - "static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(a, IMM{0}){unsafe_end}", + "static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}transmute(__{current_name}(transmute(a), IMM{0})){unsafe_end}", asm_fmts[2].get(2..).unwrap() ) } else { @@ -500,7 +538,7 @@ fn gen_bind_body( call_params = match asm_fmts[2].as_str() { "si5" => { format!( - "static_assert_simm_bits!(IMM_S5, 5);\n {unsafe_start}__{current_name}(a, IMM_S5){unsafe_end}" + "static_assert_simm_bits!(IMM_S5, 5);\n {unsafe_start}transmute(__{current_name}(transmute(a), IMM_S5)){unsafe_end}" ) } _ => panic!("unsupported assembly format: {}", asm_fmts[2]), @@ -508,7 +546,7 @@ fn gen_bind_body( } else if para_num == 2 && in_t[0] == "CVPOINTER" && in_t[1] == "SI" { call_params = if asm_fmts[2].starts_with("si") { format!( - "static_assert_simm_bits!(IMM_S{0}, {0});\n {unsafe_start}__{current_name}(mem_addr, IMM_S{0}){unsafe_end}", + "static_assert_simm_bits!(IMM_S{0}, {0});\n {unsafe_start}transmute(__{current_name}(mem_addr, IMM_S{0})){unsafe_end}", asm_fmts[2].get(2..).unwrap() ) } else { @@ -516,13 +554,15 @@ fn gen_bind_body( } } else if para_num == 2 && in_t[0] == "CVPOINTER" && in_t[1] == "DI" { call_params = match asm_fmts[2].as_str() { - "rk" => format!("{unsafe_start}__{current_name}(mem_addr, b){unsafe_end}"), + "rk" => format!( + "{unsafe_start}transmute(__{current_name}(mem_addr, transmute(b))){unsafe_end}" + ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 3 && (in_t[2] == "USI" || in_t[2] == "UQI") { call_params = if asm_fmts[2].starts_with("ui") { format!( - "static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(a, b, IMM{0}){unsafe_end}", + "static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}transmute(__{current_name}(transmute(a), transmute(b), IMM{0})){unsafe_end}", asm_fmts[2].get(2..).unwrap() ) } else { @@ -531,19 +571,21 @@ fn gen_bind_body( } else if para_num == 3 && in_t[1] == "CVPOINTER" && in_t[2] == "SI" { call_params = match asm_fmts[2].as_str() { "si12" => format!( - "static_assert_simm_bits!(IMM_S12, 12);\n {unsafe_start}__{current_name}(a, mem_addr, IMM_S12){unsafe_end}" + "static_assert_simm_bits!(IMM_S12, 12);\n {unsafe_start}transmute(__{current_name}(transmute(a), mem_addr, IMM_S12)){unsafe_end}" ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 3 && in_t[1] == "CVPOINTER" && in_t[2] == "DI" { call_params = match asm_fmts[2].as_str() { - "rk" => format!("{unsafe_start}__{current_name}(a, mem_addr, b){unsafe_end}"), + "rk" => format!( + "{unsafe_start}transmute(__{current_name}(transmute(a), mem_addr, transmute(b))){unsafe_end}" + ), _ => panic!("unsupported assembly format: {}", asm_fmts[2]), }; } else if para_num == 4 { call_params = match (asm_fmts[2].as_str(), current_name.chars().last().unwrap()) { ("si8", t) => format!( - "static_assert_simm_bits!(IMM_S8, 8);\n static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}__{current_name}(a, mem_addr, IMM_S8, IMM{0}){unsafe_end}", + "static_assert_simm_bits!(IMM_S8, 8);\n static_assert_uimm_bits!(IMM{0}, {0});\n {unsafe_start}transmute(__{current_name}(transmute(a), mem_addr, IMM_S8, IMM{0})){unsafe_end}", type_to_imm(t) ), (_, _) => panic!( diff --git a/library/stdarch/examples/connect5.rs b/library/stdarch/examples/connect5.rs index 371b28552b32..f24657b14839 100644 --- a/library/stdarch/examples/connect5.rs +++ b/library/stdarch/examples/connect5.rs @@ -563,11 +563,7 @@ fn search(pos: &Pos, alpha: i32, beta: i32, depth: i32, _ply: i32) -> i32 { assert!(bs >= -EVAL_INF && bs <= EVAL_INF); //best move at the root node, best score elsewhere - if _ply == 0 { - bm - } else { - bs - } + if _ply == 0 { bm } else { bs } } /// Evaluation function: give different scores to different patterns after a fixed depth. diff --git a/library/stdarch/rust-version b/library/stdarch/rust-version index 5102178848e7..1ced6098acf4 100644 --- a/library/stdarch/rust-version +++ b/library/stdarch/rust-version @@ -1 +1 @@ -040e2f8b9ff2d76fbe2146d6003e297ed4532088 +32e7a4b92b109c24e9822c862a7c74436b50e564 diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml index 82b93682c610..7b4aeed94e98 100644 --- a/library/sysroot/Cargo.toml +++ b/library/sysroot/Cargo.toml @@ -6,6 +6,8 @@ version = "0.0.0" edition = "2024" [lib] +test = false +bench = false # make sure this crate isn't included in public standard library docs doc = false diff --git a/library/test/src/console.rs b/library/test/src/console.rs index 8f29f1dada52..13b2b3d502c8 100644 --- a/library/test/src/console.rs +++ b/library/test/src/console.rs @@ -281,23 +281,15 @@ fn on_test_event( Ok(()) } -/// A simple console test runner. -/// Runs provided tests reporting process and results to the stdout. -pub fn run_tests_console(opts: &TestOpts, tests: Vec) -> io::Result { +pub(crate) fn get_formatter(opts: &TestOpts, max_name_len: usize) -> Box { let output = match term::stdout() { None => OutputLocation::Raw(io::stdout()), Some(t) => OutputLocation::Pretty(t), }; - let max_name_len = tests - .iter() - .max_by_key(|t| len_if_padded(t)) - .map(|t| t.desc.name.as_slice().len()) - .unwrap_or(0); - let is_multithreaded = opts.test_threads.unwrap_or_else(get_concurrency) > 1; - let mut out: Box = match opts.format { + match opts.format { OutputFormat::Pretty => Box::new(PrettyFormatter::new( output, opts.use_color(), @@ -310,7 +302,19 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec) -> io::Resu } OutputFormat::Json => Box::new(JsonFormatter::new(output)), OutputFormat::Junit => Box::new(JunitFormatter::new(output)), - }; + } +} + +/// A simple console test runner. +/// Runs provided tests reporting process and results to the stdout. +pub fn run_tests_console(opts: &TestOpts, tests: Vec) -> io::Result { + let max_name_len = tests + .iter() + .max_by_key(|t| len_if_padded(t)) + .map(|t| t.desc.name.as_slice().len()) + .unwrap_or(0); + + let mut out = get_formatter(opts, max_name_len); let mut st = ConsoleTestState::new(opts)?; // Prevent the usage of `Instant` in some cases: diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs index 92c1c0716f1f..4a101f00d74b 100644 --- a/library/test/src/formatters/json.rs +++ b/library/test/src/formatters/json.rs @@ -215,6 +215,17 @@ impl OutputFormatter for JsonFormatter { Ok(state.failed == 0) } + + fn write_merged_doctests_times( + &mut self, + total_time: f64, + compilation_time: f64, + ) -> io::Result<()> { + let newline = "\n"; + self.writeln_message(&format!( + r#"{{ "type": "report", "total_time": {total_time}, "compilation_time": {compilation_time} }}{newline}"#, + )) + } } /// A formatting utility used to print strings with characters in need of escaping. diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs index 84153a9d05b5..1566f1cb1dac 100644 --- a/library/test/src/formatters/junit.rs +++ b/library/test/src/formatters/junit.rs @@ -182,6 +182,16 @@ impl OutputFormatter for JunitFormatter { Ok(state.failed == 0) } + + fn write_merged_doctests_times( + &mut self, + total_time: f64, + compilation_time: f64, + ) -> io::Result<()> { + self.write_message(&format!( + "\n", + )) + } } fn parse_class_name(desc: &TestDesc) -> (String, String) { diff --git a/library/test/src/formatters/mod.rs b/library/test/src/formatters/mod.rs index f1225fecfef1..c97cdb16a507 100644 --- a/library/test/src/formatters/mod.rs +++ b/library/test/src/formatters/mod.rs @@ -33,6 +33,11 @@ pub(crate) trait OutputFormatter { state: &ConsoleTestState, ) -> io::Result<()>; fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result; + fn write_merged_doctests_times( + &mut self, + total_time: f64, + compilation_time: f64, + ) -> io::Result<()>; } pub(crate) fn write_stderr_delimiter(test_output: &mut Vec, test_name: &TestName) { diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index bf3fc40db411..5836138644aa 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -303,4 +303,14 @@ impl OutputFormatter for PrettyFormatter { Ok(success) } + + fn write_merged_doctests_times( + &mut self, + total_time: f64, + compilation_time: f64, + ) -> io::Result<()> { + self.write_plain(format!( + "all doctests ran in {total_time:.2}s; merged doctests compilation took {compilation_time:.2}s\n", + )) + } } diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index b28120ab56e6..0720f06e174f 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -295,4 +295,14 @@ impl OutputFormatter for TerseFormatter { Ok(success) } + + fn write_merged_doctests_times( + &mut self, + total_time: f64, + compilation_time: f64, + ) -> io::Result<()> { + self.write_plain(format!( + "all doctests ran in {total_time:.2}s; merged doctests compilation took {compilation_time:.2}s\n", + )) + } } diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index 7f56d1e36269..d554807bbde7 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -89,8 +89,8 @@ use options::RunStrategy; use test_result::*; use time::TestExecTime; -// Process exit code to be used to indicate test failures. -const ERROR_EXIT_CODE: i32 = 101; +/// Process exit code to be used to indicate test failures. +pub const ERROR_EXIT_CODE: i32 = 101; const SECONDARY_TEST_INVOKER_VAR: &str = "__RUST_TEST_INVOKE"; const SECONDARY_TEST_BENCH_BENCHMARKS_VAR: &str = "__RUST_TEST_BENCH_BENCHMARKS"; @@ -244,6 +244,21 @@ fn make_owned_test(test: &&TestDescAndFn) -> TestDescAndFn { } } +/// Public API used by rustdoc to display the `total` and `compilation` times in the expected +/// format. +pub fn print_merged_doctests_times(args: &[String], total_time: f64, compilation_time: f64) { + let opts = match cli::parse_opts(args) { + Some(Ok(o)) => o, + Some(Err(msg)) => { + eprintln!("error: {msg}"); + process::exit(ERROR_EXIT_CODE); + } + None => return, + }; + let mut formatter = console::get_formatter(&opts, 0); + formatter.write_merged_doctests_times(total_time, compilation_time).unwrap(); +} + /// Invoked when unit tests terminate. Returns `Result::Err` if the test is /// considered a failure. By default, invokes `report()` and checks for a `0` /// result. diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml index f8da09f71931..b9ce676eb3ff 100644 --- a/library/unwind/Cargo.toml +++ b/library/unwind/Cargo.toml @@ -14,9 +14,8 @@ bench = false doc = false [dependencies] -core = { path = "../core" } -compiler_builtins = { path = "../compiler-builtins/compiler-builtins" } cfg-if = "1.0" +core = { path = "../rustc-std-workspace-core", package = "rustc-std-workspace-core" } [target.'cfg(not(all(windows, target_env = "msvc")))'.dependencies] libc = { version = "0.2.140", features = ['rustc-dep-of-std'], default-features = false } diff --git a/library/windows_targets/Cargo.toml b/library/windows_targets/Cargo.toml index 705c9e043811..1c804a0ab391 100644 --- a/library/windows_targets/Cargo.toml +++ b/library/windows_targets/Cargo.toml @@ -4,6 +4,11 @@ description = "A drop-in replacement for the real windows-targets crate for use version = "0.0.0" edition = "2024" +[lib] +test = false +bench = false +doc = false + [features] # Enable using raw-dylib for Windows imports. # This will eventually be the default. diff --git a/src/bootstrap/defaults/bootstrap.tools.toml b/src/bootstrap/defaults/bootstrap.tools.toml index 57c2706f60a5..5abe636bd968 100644 --- a/src/bootstrap/defaults/bootstrap.tools.toml +++ b/src/bootstrap/defaults/bootstrap.tools.toml @@ -14,6 +14,8 @@ test-stage = 2 doc-stage = 2 # Contributors working on tools will probably expect compiler docs to be generated, so they can figure out how to use the API. compiler-docs = true +# Contributors working on tools are the most likely to change non-rust programs. +tidy-extra-checks = "auto:js,auto:py,auto:cpp,auto:spellcheck" [llvm] # Will download LLVM from CI if available on your platform. diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index 181d71f63c2f..cf24fedaebb1 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -159,6 +159,9 @@ fn main() { if is_bootstrap_profiling_enabled() { build.report_summary(start_time); } + + #[cfg(feature = "tracing")] + build.report_step_graph(); } fn check_version(config: &Config) -> Option { diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index cfe090b22dc3..f931aae3c2e0 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -13,7 +13,7 @@ use crate::core::builder::{ }; use crate::core::config::TargetSelection; use crate::utils::build_stamp::{self, BuildStamp}; -use crate::{Compiler, Mode, Subcommand}; +use crate::{CodegenBackendKind, Compiler, Mode, Subcommand}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Std { @@ -84,7 +84,7 @@ impl Step for Std { Kind::Check, ); - std_cargo(builder, target, stage, &mut cargo); + std_cargo(builder, target, &mut cargo); if matches!(builder.config.cmd, Subcommand::Fix) { // By default, cargo tries to fix all targets. Tell it not to fix tests until we've added `test` to the sysroot. cargo.arg("--lib"); @@ -125,7 +125,7 @@ impl Step for Std { Kind::Check, ); - std_cargo(builder, target, build_compiler.stage, &mut cargo); + std_cargo(builder, target, &mut cargo); // Explicitly pass -p for all dependencies krates -- this will force cargo // to also check the tests/benches/examples for these crates, rather @@ -312,7 +312,7 @@ fn prepare_compiler_for_check( pub struct CodegenBackend { pub build_compiler: Compiler, pub target: TargetSelection, - pub backend: &'static str, + pub backend: CodegenBackendKind, } impl Step for CodegenBackend { @@ -327,14 +327,14 @@ impl Step for CodegenBackend { fn make_run(run: RunConfig<'_>) { // FIXME: only check the backend(s) that were actually selected in run.paths let build_compiler = prepare_compiler_for_check(run.builder, run.target, Mode::Codegen); - for &backend in &["cranelift", "gcc"] { + for backend in [CodegenBackendKind::Cranelift, CodegenBackendKind::Gcc] { run.builder.ensure(CodegenBackend { build_compiler, target: run.target, backend }); } } fn run(self, builder: &Builder<'_>) { // FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved - if builder.build.config.vendor && self.backend == "gcc" { + if builder.build.config.vendor && self.backend.is_gcc() { println!("Skipping checking of `rustc_codegen_gcc` with vendoring enabled."); return; } @@ -354,19 +354,22 @@ impl Step for CodegenBackend { cargo .arg("--manifest-path") - .arg(builder.src.join(format!("compiler/rustc_codegen_{backend}/Cargo.toml"))); + .arg(builder.src.join(format!("compiler/{}/Cargo.toml", backend.crate_name()))); rustc_cargo_env(builder, &mut cargo, target); - let _guard = builder.msg_check(format!("rustc_codegen_{backend}"), target, None); + let _guard = builder.msg_check(backend.crate_name(), target, None); - let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, backend) + let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, &backend) .with_prefix("check"); run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false); } fn metadata(&self) -> Option { - Some(StepMetadata::check(self.backend, self.target).built_by(self.build_compiler)) + Some( + StepMetadata::check(&self.backend.crate_name(), self.target) + .built_by(self.build_compiler), + ) } } @@ -556,3 +559,9 @@ tool_check_step!(Compiletest { allow_features: COMPILETEST_ALLOW_FEATURES, default: false, }); + +tool_check_step!(Linkchecker { + path: "src/tools/linkchecker", + mode: |_builder| Mode::ToolBootstrap, + default: false +}); diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs index b119f2dc3ce8..93c767bdd253 100644 --- a/src/bootstrap/src/core/build_steps/clippy.rs +++ b/src/bootstrap/src/core/build_steps/clippy.rs @@ -154,7 +154,7 @@ impl Step for Std { Kind::Clippy, ); - std_cargo(builder, target, compiler.stage, &mut cargo); + std_cargo(builder, target, &mut cargo); for krate in &*self.crates { cargo.arg("-p").arg(krate); diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 4abfe1843ebe..79174eb281f6 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -19,12 +19,11 @@ use serde_derive::Deserialize; use tracing::{instrument, span}; use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags}; -use crate::core::build_steps::tool::{SourceType, copy_lld_artifacts}; +use crate::core::build_steps::tool::{RustcPrivateCompilers, SourceType, copy_lld_artifacts}; use crate::core::build_steps::{dist, llvm}; use crate::core::builder; use crate::core::builder::{ - Builder, Cargo, Kind, PathSet, RunConfig, ShouldRun, Step, StepMetadata, TaskPath, - crate_description, + Builder, Cargo, Kind, RunConfig, ShouldRun, Step, StepMetadata, crate_description, }; use crate::core::config::{DebuginfoLevel, LlvmLibunwind, RustcLto, TargetSelection}; use crate::utils::build_stamp; @@ -33,7 +32,10 @@ use crate::utils::exec::command; use crate::utils::helpers::{ exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date, }; -use crate::{CLang, Compiler, DependencyType, FileType, GitRepo, LLVM_TOOLS, Mode, debug, trace}; +use crate::{ + CLang, CodegenBackendKind, Compiler, DependencyType, FileType, GitRepo, LLVM_TOOLS, Mode, + debug, trace, +}; /// Build a standard library for the given `target` using the given `compiler`. #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -266,7 +268,7 @@ impl Step for Std { target, Kind::Build, ); - std_cargo(builder, target, compiler.stage, &mut cargo); + std_cargo(builder, target, &mut cargo); for krate in &*self.crates { cargo.arg("-p").arg(krate); } @@ -494,7 +496,7 @@ fn compiler_rt_for_profiler(builder: &Builder<'_>) -> PathBuf { /// Configure cargo to compile the standard library, adding appropriate env vars /// and such. -pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, cargo: &mut Cargo) { +pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, cargo: &mut Cargo) { // rustc already ensures that it builds with the minimum deployment // target, so ideally we shouldn't need to do anything here. // @@ -642,12 +644,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car // built with bitcode so that the produced rlibs can be used for both LTO // builds (which use bitcode) and non-LTO builds (which use object code). // So we override the override here! - // - // But we don't bother for the stage 0 compiler because it's never used - // with LTO. - if stage >= 1 { - cargo.rustflag("-Cembed-bitcode=yes"); - } + cargo.rustflag("-Cembed-bitcode=yes"); + if builder.config.rust_lto == RustcLto::Off { cargo.rustflag("-Clto=off"); } @@ -1128,7 +1126,7 @@ impl Step for Rustc { cargo.env("RUSTC_BOLT_LINK_FLAGS", "1"); } - let _guard = builder.msg_sysroot_tool( + let _guard = builder.msg_rustc_tool( Kind::Build, build_compiler.stage, format_args!("compiler artifacts{}", crate_description(&self.crates)), @@ -1330,7 +1328,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS } if let Some(backend) = builder.config.default_codegen_backend(target) { - cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend); + cargo.env("CFG_DEFAULT_CODEGEN_BACKEND", backend.name()); } let libdir_relative = builder.config.libdir_relative().unwrap_or_else(|| Path::new("lib")); @@ -1540,101 +1538,47 @@ impl Step for RustcLink { } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct CodegenBackend { - pub target: TargetSelection, - pub compiler: Compiler, - pub backend: String, +pub struct GccCodegenBackend { + compilers: RustcPrivateCompilers, } -fn needs_codegen_config(run: &RunConfig<'_>) -> bool { - let mut needs_codegen_cfg = false; - for path_set in &run.paths { - needs_codegen_cfg = match path_set { - PathSet::Set(set) => set.iter().any(|p| is_codegen_cfg_needed(p, run)), - PathSet::Suite(suite) => is_codegen_cfg_needed(suite, run), - } - } - needs_codegen_cfg -} - -pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; - -fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool { - let path = path.path.to_str().unwrap(); - - let is_explicitly_called = |p| -> bool { run.builder.paths.contains(p) }; - let should_enforce = run.builder.kind == Kind::Dist || run.builder.kind == Kind::Install; - - if path.contains(CODEGEN_BACKEND_PREFIX) { - let mut needs_codegen_backend_config = true; - for backend in run.builder.config.codegen_backends(run.target) { - if path.ends_with(&(CODEGEN_BACKEND_PREFIX.to_owned() + backend)) { - needs_codegen_backend_config = false; - } - } - if (is_explicitly_called(&PathBuf::from(path)) || should_enforce) - && needs_codegen_backend_config - { - run.builder.info( - "WARNING: no codegen-backends config matched the requested path to build a codegen backend. \ - HELP: add backend to codegen-backends in bootstrap.toml.", - ); - return true; - } - } - - false -} - -impl Step for CodegenBackend { - type Output = (); +impl Step for GccCodegenBackend { + type Output = BuildStamp; const ONLY_HOSTS: bool = true; - /// Only the backends specified in the `codegen-backends` entry of `bootstrap.toml` are built. - const DEFAULT: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.paths(&["compiler/rustc_codegen_cranelift", "compiler/rustc_codegen_gcc"]) + run.alias("rustc_codegen_gcc").alias("cg_gcc") } fn make_run(run: RunConfig<'_>) { - if needs_codegen_config(&run) { - return; - } - - for backend in run.builder.config.codegen_backends(run.target) { - if backend == "llvm" { - continue; // Already built as part of rustc - } - - run.builder.ensure(CodegenBackend { - target: run.target, - compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()), - backend: backend.clone(), - }); - } + run.builder.ensure(GccCodegenBackend { + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), + }); } #[cfg_attr( feature = "tracing", instrument( level = "debug", - name = "CodegenBackend::run", + name = "GccCodegenBackend::run", skip_all, fields( - compiler = ?self.compiler, - target = ?self.target, - backend = ?self.target, + compilers = ?self.compilers, ), ), )] - fn run(self, builder: &Builder<'_>) { - let compiler = self.compiler; - let target = self.target; - let backend = self.backend; + fn run(self, builder: &Builder<'_>) -> Self::Output { + let target = self.compilers.target(); + let build_compiler = self.compilers.build_compiler(); - builder.ensure(Rustc::new(compiler, target)); + let stamp = build_stamp::codegen_backend_stamp( + builder, + build_compiler, + target, + &CodegenBackendKind::Gcc, + ); - if builder.config.keep_stage.contains(&compiler.stage) { + if builder.config.keep_stage.contains(&build_compiler.stage) { trace!("`keep-stage` requested"); builder.info( "WARNING: Using a potentially old codegen backend. \ @@ -1642,20 +1586,97 @@ impl Step for CodegenBackend { ); // Codegen backends are linked separately from this step today, so we don't do // anything here. - return; + return stamp; } - let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); - if compiler_to_use != compiler { - builder.ensure(CodegenBackend { compiler: compiler_to_use, target, backend }); - return; - } - - let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); - let mut cargo = builder::Cargo::new( builder, - compiler, + build_compiler, + Mode::Codegen, + SourceType::InTree, + target, + Kind::Build, + ); + cargo.arg("--manifest-path").arg(builder.src.join("compiler/rustc_codegen_gcc/Cargo.toml")); + rustc_cargo_env(builder, &mut cargo, target); + + let gcc = builder.ensure(Gcc { target }); + add_cg_gcc_cargo_flags(&mut cargo, &gcc); + + let _guard = builder.msg_rustc_tool( + Kind::Build, + build_compiler.stage, + "codegen backend gcc", + build_compiler.host, + target, + ); + let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false); + write_codegen_backend_stamp(stamp, files, builder.config.dry_run()) + } + + fn metadata(&self) -> Option { + Some( + StepMetadata::build("rustc_codegen_gcc", self.compilers.target()) + .built_by(self.compilers.build_compiler()), + ) + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct CraneliftCodegenBackend { + pub compilers: RustcPrivateCompilers, +} + +impl Step for CraneliftCodegenBackend { + type Output = BuildStamp; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.alias("rustc_codegen_cranelift").alias("cg_clif") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(CraneliftCodegenBackend { + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), + }); + } + + #[cfg_attr( + feature = "tracing", + instrument( + level = "debug", + name = "CraneliftCodegenBackend::run", + skip_all, + fields( + compilers = ?self.compilers, + ), + ), + )] + fn run(self, builder: &Builder<'_>) -> Self::Output { + let target = self.compilers.target(); + let build_compiler = self.compilers.build_compiler(); + + let stamp = build_stamp::codegen_backend_stamp( + builder, + build_compiler, + target, + &CodegenBackendKind::Cranelift, + ); + + if builder.config.keep_stage.contains(&build_compiler.stage) { + trace!("`keep-stage` requested"); + builder.info( + "WARNING: Using a potentially old codegen backend. \ + This may not behave well.", + ); + // Codegen backends are linked separately from this step today, so we don't do + // anything here. + return stamp; + } + + let mut cargo = builder::Cargo::new( + builder, + build_compiler, Mode::Codegen, SourceType::InTree, target, @@ -1663,58 +1684,67 @@ impl Step for CodegenBackend { ); cargo .arg("--manifest-path") - .arg(builder.src.join(format!("compiler/rustc_codegen_{backend}/Cargo.toml"))); + .arg(builder.src.join("compiler/rustc_codegen_cranelift/Cargo.toml")); rustc_cargo_env(builder, &mut cargo, target); - // Ideally, we'd have a separate step for the individual codegen backends, - // like we have in tests (test::CodegenGCC) but that would require a lot of restructuring. - // If the logic gets more complicated, it should probably be done. - if backend == "gcc" { - let gcc = builder.ensure(Gcc { target }); - add_cg_gcc_cargo_flags(&mut cargo, &gcc); - } - - let tmp_stamp = BuildStamp::new(&out_dir).with_prefix("tmp"); - - let _guard = builder.msg_build(compiler, format_args!("codegen backend {backend}"), target); - let files = run_cargo(builder, cargo, vec![], &tmp_stamp, vec![], false, false); - if builder.config.dry_run() { - return; - } - let mut files = files.into_iter().filter(|f| { - let filename = f.file_name().unwrap().to_str().unwrap(); - is_dylib(f) && filename.contains("rustc_codegen_") - }); - let codegen_backend = match files.next() { - Some(f) => f, - None => panic!("no dylibs built for codegen backend?"), - }; - if let Some(f) = files.next() { - panic!( - "codegen backend built two dylibs:\n{}\n{}", - codegen_backend.display(), - f.display() - ); - } - let stamp = build_stamp::codegen_backend_stamp(builder, compiler, target, &backend); - let codegen_backend = codegen_backend.to_str().unwrap(); - t!(stamp.add_stamp(codegen_backend).write()); + let _guard = builder.msg_rustc_tool( + Kind::Build, + build_compiler.stage, + "codegen backend cranelift", + build_compiler.host, + target, + ); + let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false); + write_codegen_backend_stamp(stamp, files, builder.config.dry_run()) } + + fn metadata(&self) -> Option { + Some( + StepMetadata::build("rustc_codegen_cranelift", self.compilers.target()) + .built_by(self.compilers.build_compiler()), + ) + } +} + +/// Write filtered `files` into the passed build stamp and returns it. +fn write_codegen_backend_stamp( + mut stamp: BuildStamp, + files: Vec, + dry_run: bool, +) -> BuildStamp { + if dry_run { + return stamp; + } + + let mut files = files.into_iter().filter(|f| { + let filename = f.file_name().unwrap().to_str().unwrap(); + is_dylib(f) && filename.contains("rustc_codegen_") + }); + let codegen_backend = match files.next() { + Some(f) => f, + None => panic!("no dylibs built for codegen backend?"), + }; + if let Some(f) = files.next() { + panic!("codegen backend built two dylibs:\n{}\n{}", codegen_backend.display(), f.display()); + } + + let codegen_backend = codegen_backend.to_str().unwrap(); + stamp = stamp.add_stamp(codegen_backend); + t!(stamp.write()); + stamp } /// Creates the `codegen-backends` folder for a compiler that's about to be /// assembled as a complete compiler. /// -/// This will take the codegen artifacts produced by `compiler` and link them +/// This will take the codegen artifacts recorded in the given `stamp` and link them /// into an appropriate location for `target_compiler` to be a functional /// compiler. fn copy_codegen_backends_to_sysroot( builder: &Builder<'_>, - compiler: Compiler, + stamp: BuildStamp, target_compiler: Compiler, ) { - let target = target_compiler.host; - // Note that this step is different than all the other `*Link` steps in // that it's not assembling a bunch of libraries but rather is primarily // moving the codegen backend into place. The codegen backend of rustc is @@ -1730,25 +1760,18 @@ fn copy_codegen_backends_to_sysroot( return; } - for backend in builder.config.codegen_backends(target) { - if backend == "llvm" { - continue; // Already built as part of rustc - } - - let stamp = build_stamp::codegen_backend_stamp(builder, compiler, target, backend); - if stamp.path().exists() { - let dylib = t!(fs::read_to_string(stamp.path())); - let file = Path::new(&dylib); - let filename = file.file_name().unwrap().to_str().unwrap(); - // change `librustc_codegen_cranelift-xxxxxx.so` to - // `librustc_codegen_cranelift-release.so` - let target_filename = { - let dash = filename.find('-').unwrap(); - let dot = filename.find('.').unwrap(); - format!("{}-{}{}", &filename[..dash], builder.rust_release(), &filename[dot..]) - }; - builder.copy_link(file, &dst.join(target_filename), FileType::NativeLibrary); - } + if stamp.path().exists() { + let dylib = t!(fs::read_to_string(stamp.path())); + let file = Path::new(&dylib); + let filename = file.file_name().unwrap().to_str().unwrap(); + // change `librustc_codegen_cranelift-xxxxxx.so` to + // `librustc_codegen_cranelift-release.so` + let target_filename = { + let dash = filename.find('-').unwrap(); + let dot = filename.find('.').unwrap(); + format!("{}-{}{}", &filename[..dash], builder.rust_release(), &filename[dot..]) + }; + builder.copy_link(file, &dst.join(target_filename), FileType::NativeLibrary); } } @@ -2157,42 +2180,52 @@ impl Step for Assemble { ); build_compiler.stage = actual_stage; - #[cfg(feature = "tracing")] - let _codegen_backend_span = - span!(tracing::Level::DEBUG, "building requested codegen backends").entered(); - for backend in builder.config.codegen_backends(target_compiler.host) { - if backend == "llvm" { - debug!("llvm codegen backend is already built as part of rustc"); - continue; // Already built as part of rustc - } + let mut codegen_backend_stamps = vec![]; + { + #[cfg(feature = "tracing")] + let _codegen_backend_span = + span!(tracing::Level::DEBUG, "building requested codegen backends").entered(); - // FIXME: this is a horrible hack used to make `x check` work when other codegen - // backends are enabled. - // `x check` will check stage 1 rustc, which copies its rmetas to the stage0 sysroot. - // Then it checks codegen backends, which correctly use these rmetas. - // Then it needs to check std, but for that it needs to build stage 1 rustc. - // This copies the build rmetas into the stage0 sysroot, effectively poisoning it, - // because we then have both check and build rmetas in the same sysroot. - // That would be fine on its own. However, when another codegen backend is enabled, - // then building stage 1 rustc implies also building stage 1 codegen backend (even if - // it isn't used for anything). And since that tries to use the poisoned - // rmetas, it fails to build. - // We don't actually need to build rustc-private codegen backends for checking std, - // so instead we skip that. - // Note: this would be also an issue for other rustc-private tools, but that is "solved" - // by check::Std being last in the list of checked things (see - // `Builder::get_step_descriptions`). - if builder.kind == Kind::Check && builder.top_stage == 1 { - continue; + for backend in builder.config.enabled_codegen_backends(target_compiler.host) { + // FIXME: this is a horrible hack used to make `x check` work when other codegen + // backends are enabled. + // `x check` will check stage 1 rustc, which copies its rmetas to the stage0 sysroot. + // Then it checks codegen backends, which correctly use these rmetas. + // Then it needs to check std, but for that it needs to build stage 1 rustc. + // This copies the build rmetas into the stage0 sysroot, effectively poisoning it, + // because we then have both check and build rmetas in the same sysroot. + // That would be fine on its own. However, when another codegen backend is enabled, + // then building stage 1 rustc implies also building stage 1 codegen backend (even if + // it isn't used for anything). And since that tries to use the poisoned + // rmetas, it fails to build. + // We don't actually need to build rustc-private codegen backends for checking std, + // so instead we skip that. + // Note: this would be also an issue for other rustc-private tools, but that is "solved" + // by check::Std being last in the list of checked things (see + // `Builder::get_step_descriptions`). + if builder.kind == Kind::Check && builder.top_stage == 1 { + continue; + } + + let prepare_compilers = || { + RustcPrivateCompilers::from_build_and_target_compiler( + build_compiler, + target_compiler, + ) + }; + + let stamp = match backend { + CodegenBackendKind::Cranelift => { + builder.ensure(CraneliftCodegenBackend { compilers: prepare_compilers() }) + } + CodegenBackendKind::Gcc => { + builder.ensure(GccCodegenBackend { compilers: prepare_compilers() }) + } + CodegenBackendKind::Llvm | CodegenBackendKind::Custom(_) => continue, + }; + codegen_backend_stamps.push(stamp); } - builder.ensure(CodegenBackend { - compiler: build_compiler, - target: target_compiler.host, - backend: backend.clone(), - }); } - #[cfg(feature = "tracing")] - drop(_codegen_backend_span); let stage = target_compiler.stage; let host = target_compiler.host; @@ -2253,7 +2286,9 @@ impl Step for Assemble { } debug!("copying codegen backends to sysroot"); - copy_codegen_backends_to_sysroot(builder, build_compiler, target_compiler); + for stamp in codegen_backend_stamps { + copy_codegen_backends_to_sysroot(builder, stamp, target_compiler); + } if builder.config.lld_enabled { let lld_wrapper = @@ -2377,15 +2412,19 @@ pub fn run_cargo( let mut deps = Vec::new(); let mut toplevel = Vec::new(); let ok = stream_cargo(builder, cargo, tail_args, &mut |msg| { - let (filenames, crate_types) = match msg { + let (filenames_vec, crate_types) = match msg { CargoMessage::CompilerArtifact { filenames, target: CargoTarget { crate_types }, .. - } => (filenames, crate_types), + } => { + let mut f: Vec = filenames.into_iter().map(|s| s.into_owned()).collect(); + f.sort(); // Sort the filenames + (f, crate_types) + } _ => return, }; - for filename in filenames { + for filename in filenames_vec { // Skip files like executables let mut keep = false; if filename.ends_with(".lib") diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index c8a54ad250cb..2c3fb9458eff 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -20,7 +20,7 @@ use object::read::archive::ArchiveFile; use tracing::instrument; use crate::core::build_steps::doc::DocumentationFormat; -use crate::core::build_steps::tool::{self, Tool}; +use crate::core::build_steps::tool::{self, RustcPrivateCompilers, Tool}; use crate::core::build_steps::vendor::{VENDOR_DIR, Vendor}; use crate::core::build_steps::{compile, llvm}; use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step, StepMetadata}; @@ -32,7 +32,7 @@ use crate::utils::helpers::{ exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit, }; use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball}; -use crate::{Compiler, DependencyType, FileType, LLVM_TOOLS, Mode, trace}; +use crate::{CodegenBackendKind, Compiler, DependencyType, FileType, LLVM_TOOLS, Mode, trace}; pub fn pkgname(builder: &Builder<'_>, component: &str) -> String { format!("{}-{}", component, builder.rust_package_vers()) @@ -174,36 +174,12 @@ fn find_files(files: &[&str], path: &[PathBuf]) -> Vec { found } -fn make_win_dist( - rust_root: &Path, - plat_root: &Path, - target: TargetSelection, - builder: &Builder<'_>, -) { +fn make_win_dist(plat_root: &Path, target: TargetSelection, builder: &Builder<'_>) { if builder.config.dry_run() { return; } - //Ask gcc where it keeps its stuff - let mut cmd = command(builder.cc(target)); - cmd.arg("-print-search-dirs"); - let gcc_out = cmd.run_capture_stdout(builder).stdout(); - - let mut bin_path: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap_or_default()).collect(); - let mut lib_path = Vec::new(); - - for line in gcc_out.lines() { - let idx = line.find(':').unwrap(); - let key = &line[..idx]; - let trim_chars: &[_] = &[' ', '=']; - let value = env::split_paths(line[(idx + 1)..].trim_start_matches(trim_chars)); - - if key == "programs" { - bin_path.extend(value); - } else if key == "libraries" { - lib_path.extend(value); - } - } + let (bin_path, lib_path) = get_cc_search_dirs(target, builder); let compiler = if target == "i686-pc-windows-gnu" { "i686-w64-mingw32-gcc.exe" @@ -213,12 +189,6 @@ fn make_win_dist( "gcc.exe" }; let target_tools = [compiler, "ld.exe", "dlltool.exe", "libwinpthread-1.dll"]; - let mut rustc_dlls = vec!["libwinpthread-1.dll"]; - if target.starts_with("i686-") { - rustc_dlls.push("libgcc_s_dw2-1.dll"); - } else { - rustc_dlls.push("libgcc_s_seh-1.dll"); - } // Libraries necessary to link the windows-gnu toolchains. // System libraries will be preferred if they are available (see #67429). @@ -274,25 +244,8 @@ fn make_win_dist( //Find mingw artifacts we want to bundle let target_tools = find_files(&target_tools, &bin_path); - let rustc_dlls = find_files(&rustc_dlls, &bin_path); let target_libs = find_files(&target_libs, &lib_path); - // Copy runtime dlls next to rustc.exe - let rust_bin_dir = rust_root.join("bin/"); - fs::create_dir_all(&rust_bin_dir).expect("creating rust_bin_dir failed"); - for src in &rustc_dlls { - builder.copy_link_to_folder(src, &rust_bin_dir); - } - - if builder.config.lld_enabled { - // rust-lld.exe also needs runtime dlls - let rust_target_bin_dir = rust_root.join("lib/rustlib").join(target).join("bin"); - fs::create_dir_all(&rust_target_bin_dir).expect("creating rust_target_bin_dir failed"); - for src in &rustc_dlls { - builder.copy_link_to_folder(src, &rust_target_bin_dir); - } - } - //Copy platform tools to platform-specific bin directory let plat_target_bin_self_contained_dir = plat_root.join("lib/rustlib").join(target).join("bin/self-contained"); @@ -320,6 +273,82 @@ fn make_win_dist( } } +fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder<'_>) { + if builder.config.dry_run() { + return; + } + + let (bin_path, libs_path) = get_cc_search_dirs(target, builder); + + let mut rustc_dlls = vec![]; + // windows-gnu and windows-gnullvm require different runtime libs + if target.ends_with("windows-gnu") { + rustc_dlls.push("libwinpthread-1.dll"); + if target.starts_with("i686-") { + rustc_dlls.push("libgcc_s_dw2-1.dll"); + } else { + rustc_dlls.push("libgcc_s_seh-1.dll"); + } + } else if target.ends_with("windows-gnullvm") { + rustc_dlls.push("libunwind.dll"); + } else { + panic!("Vendoring of runtime DLLs for `{target}` is not supported`"); + } + // FIXME(#144656): Remove this whole `let ...` + let bin_path = if target.ends_with("windows-gnullvm") && builder.host_target != target { + bin_path + .into_iter() + .chain(libs_path.iter().map(|path| path.with_file_name("bin"))) + .collect() + } else { + bin_path + }; + let rustc_dlls = find_files(&rustc_dlls, &bin_path); + + // Copy runtime dlls next to rustc.exe + let rust_bin_dir = rust_root.join("bin/"); + fs::create_dir_all(&rust_bin_dir).expect("creating rust_bin_dir failed"); + for src in &rustc_dlls { + builder.copy_link_to_folder(src, &rust_bin_dir); + } + + if builder.config.lld_enabled { + // rust-lld.exe also needs runtime dlls + let rust_target_bin_dir = rust_root.join("lib/rustlib").join(target).join("bin"); + fs::create_dir_all(&rust_target_bin_dir).expect("creating rust_target_bin_dir failed"); + for src in &rustc_dlls { + builder.copy_link_to_folder(src, &rust_target_bin_dir); + } + } +} + +fn get_cc_search_dirs( + target: TargetSelection, + builder: &Builder<'_>, +) -> (Vec, Vec) { + //Ask gcc where it keeps its stuff + let mut cmd = command(builder.cc(target)); + cmd.arg("-print-search-dirs"); + let gcc_out = cmd.run_capture_stdout(builder).stdout(); + + let mut bin_path: Vec<_> = env::split_paths(&env::var_os("PATH").unwrap_or_default()).collect(); + let mut lib_path = Vec::new(); + + for line in gcc_out.lines() { + let idx = line.find(':').unwrap(); + let key = &line[..idx]; + let trim_chars: &[_] = &[' ', '=']; + let value = env::split_paths(line[(idx + 1)..].trim_start_matches(trim_chars)); + + if key == "programs" { + bin_path.extend(value); + } else if key == "libraries" { + lib_path.extend(value); + } + } + (bin_path, lib_path) +} + #[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] pub struct Mingw { pub host: TargetSelection, @@ -350,11 +379,7 @@ impl Step for Mingw { let mut tarball = Tarball::new(builder, "rust-mingw", &host.triple); tarball.set_product_name("Rust MinGW"); - // The first argument is a "temporary directory" which is just - // thrown away (this contains the runtime DLLs included in the rustc package - // above) and the second argument is where to place all the MinGW components - // (which is what we want). - make_win_dist(&tmpdir(builder), tarball.image_dir(), host, builder); + make_win_dist(tarball.image_dir(), host, builder); Some(tarball.generate()) } @@ -394,17 +419,14 @@ impl Step for Rustc { prepare_image(builder, compiler, tarball.image_dir()); // On MinGW we've got a few runtime DLL dependencies that we need to - // include. The first argument to this script is where to put these DLLs - // (the image we're creating), and the second argument is a junk directory - // to ignore all other MinGW stuff the script creates. - // + // include. // On 32-bit MinGW we're always including a DLL which needs some extra // licenses to distribute. On 64-bit MinGW we don't actually distribute // anything requiring us to distribute a license, but it's likely the // install will *also* include the rust-mingw package, which also needs // licenses, so to be safe we just include it here in all MinGW packages. - if host.ends_with("pc-windows-gnu") && builder.config.dist_include_mingw_linker { - make_win_dist(tarball.image_dir(), &tmpdir(builder), host, builder); + if host.contains("pc-windows-gnu") && builder.config.dist_include_mingw_linker { + runtime_dll_dist(tarball.image_dir(), host, builder); tarball.add_dir(builder.src.join("src/etc/third-party"), "share/doc"); } @@ -425,19 +447,20 @@ impl Step for Rustc { .as_ref() .is_none_or(|tools| tools.iter().any(|tool| tool == "rustdoc")) { - let rustdoc = builder.rustdoc(compiler); + let rustdoc = builder.rustdoc_for_compiler(compiler); builder.install(&rustdoc, &image.join("bin"), FileType::Executable); } let ra_proc_macro_srv_compiler = builder.compiler_for(compiler.stage, builder.config.host_target, compiler.host); - builder.ensure(compile::Rustc::new(ra_proc_macro_srv_compiler, compiler.host)); + let compilers = RustcPrivateCompilers::from_build_compiler( + builder, + ra_proc_macro_srv_compiler, + compiler.host, + ); if let Some(ra_proc_macro_srv) = builder.ensure_if_default( - tool::RustAnalyzerProcMacroSrv { - compiler: ra_proc_macro_srv_compiler, - target: compiler.host, - }, + tool::RustAnalyzerProcMacroSrv::from_compilers(compilers), builder.kind, ) { let dst = image.join("libexec"); @@ -902,6 +925,8 @@ fn copy_src_dirs( "llvm-project\\cmake", "llvm-project/runtimes", "llvm-project\\runtimes", + "llvm-project/third-party", + "llvm-project\\third-party", ]; if spath.contains("llvm-project") && !spath.ends_with("llvm-project") @@ -910,6 +935,18 @@ fn copy_src_dirs( return false; } + // Keep only these third party libraries + const LLVM_THIRD_PARTY: &[&str] = + &["llvm-project/third-party/siphash", "llvm-project\\third-party\\siphash"]; + if (spath.starts_with("llvm-project/third-party") + || spath.starts_with("llvm-project\\third-party")) + && !(spath.ends_with("llvm-project/third-party") + || spath.ends_with("llvm-project\\third-party")) + && !LLVM_THIRD_PARTY.iter().any(|path| spath.contains(path)) + { + return false; + } + const LLVM_TEST: &[&str] = &["llvm-project/llvm/test", "llvm-project\\llvm\\test"]; if LLVM_TEST.iter().any(|path| spath.contains(path)) && (spath.ends_with(".ll") || spath.ends_with(".td") || spath.ends_with(".s")) @@ -1172,7 +1209,7 @@ impl Step for PlainSourceTarball { #[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] pub struct Cargo { - pub compiler: Compiler, + pub build_compiler: Compiler, pub target: TargetSelection, } @@ -1188,7 +1225,7 @@ impl Step for Cargo { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Cargo { - compiler: run.builder.compiler_for( + build_compiler: run.builder.compiler_for( run.builder.top_stage, run.builder.config.host_target, run.target, @@ -1198,12 +1235,10 @@ impl Step for Cargo { } fn run(self, builder: &Builder<'_>) -> Option { - let compiler = self.compiler; + let build_compiler = self.build_compiler; let target = self.target; - builder.ensure(compile::Rustc::new(compiler, target)); - - let cargo = builder.ensure(tool::Cargo { compiler, target }); + let cargo = builder.ensure(tool::Cargo::from_build_compiler(build_compiler, target)); let src = builder.src.join("src/tools/cargo"); let etc = src.join("src/etc"); @@ -1228,7 +1263,7 @@ impl Step for Cargo { #[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] pub struct RustAnalyzer { - pub compiler: Compiler, + pub build_compiler: Compiler, pub target: TargetSelection, } @@ -1244,7 +1279,7 @@ impl Step for RustAnalyzer { fn make_run(run: RunConfig<'_>) { run.builder.ensure(RustAnalyzer { - compiler: run.builder.compiler_for( + build_compiler: run.builder.compiler_for( run.builder.top_stage, run.builder.config.host_target, run.target, @@ -1254,12 +1289,11 @@ impl Step for RustAnalyzer { } fn run(self, builder: &Builder<'_>) -> Option { - let compiler = self.compiler; let target = self.target; + let compilers = + RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target); - builder.ensure(compile::Rustc::new(compiler, target)); - - let rust_analyzer = builder.ensure(tool::RustAnalyzer { compiler, target }); + let rust_analyzer = builder.ensure(tool::RustAnalyzer::from_compilers(compilers)); let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple); tarball.set_overlay(OverlayKind::RustAnalyzer); @@ -1270,9 +1304,9 @@ impl Step for RustAnalyzer { } } -#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Clippy { - pub compiler: Compiler, + pub build_compiler: Compiler, pub target: TargetSelection, } @@ -1288,7 +1322,7 @@ impl Step for Clippy { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Clippy { - compiler: run.builder.compiler_for( + build_compiler: run.builder.compiler_for( run.builder.top_stage, run.builder.config.host_target, run.target, @@ -1298,16 +1332,15 @@ impl Step for Clippy { } fn run(self, builder: &Builder<'_>) -> Option { - let compiler = self.compiler; let target = self.target; - - builder.ensure(compile::Rustc::new(compiler, target)); + let compilers = + RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, target); // Prepare the image directory // We expect clippy to build, because we've exited this step above if tool // state for clippy isn't testing. - let clippy = builder.ensure(tool::Clippy { compiler, target }); - let cargoclippy = builder.ensure(tool::CargoClippy { compiler, target }); + let clippy = builder.ensure(tool::Clippy::from_compilers(compilers)); + let cargoclippy = builder.ensure(tool::CargoClippy::from_compilers(compilers)); let mut tarball = Tarball::new(builder, "clippy", &target.triple); tarball.set_overlay(OverlayKind::Clippy); @@ -1319,9 +1352,9 @@ impl Step for Clippy { } } -#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Miri { - pub compiler: Compiler, + pub build_compiler: Compiler, pub target: TargetSelection, } @@ -1337,7 +1370,7 @@ impl Step for Miri { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Miri { - compiler: run.builder.compiler_for( + build_compiler: run.builder.compiler_for( run.builder.top_stage, run.builder.config.host_target, run.target, @@ -1354,15 +1387,12 @@ impl Step for Miri { return None; } - let compiler = self.compiler; - let target = self.target; + let compilers = + RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target); + let miri = builder.ensure(tool::Miri::from_compilers(compilers)); + let cargomiri = builder.ensure(tool::CargoMiri::from_compilers(compilers)); - builder.ensure(compile::Rustc::new(compiler, target)); - - let miri = builder.ensure(tool::Miri { compiler, target }); - let cargomiri = builder.ensure(tool::CargoMiri { compiler, target }); - - let mut tarball = Tarball::new(builder, "miri", &target.triple); + let mut tarball = Tarball::new(builder, "miri", &self.target.triple); tarball.set_overlay(OverlayKind::Miri); tarball.is_preview(true); tarball.add_file(&miri.tool_path, "bin", FileType::Executable); @@ -1372,39 +1402,40 @@ impl Step for Miri { } } -#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] -pub struct CodegenBackend { - pub compiler: Compiler, - pub backend: String, +#[derive(Debug, Clone, Hash, PartialEq, Eq)] +pub struct CraneliftCodegenBackend { + pub build_compiler: Compiler, } -impl Step for CodegenBackend { +impl Step for CraneliftCodegenBackend { type Output = Option; const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("compiler/rustc_codegen_cranelift") + // We only want to build the cranelift backend in `x dist` if the backend was enabled + // in rust.codegen-backends. + // Sadly, we don't have access to the actual target for which we're disting clif here.. + // So we just use the host target. + let clif_enabled_by_default = run + .builder + .config + .enabled_codegen_backends(run.builder.host_target) + .contains(&CodegenBackendKind::Cranelift); + run.alias("rustc_codegen_cranelift").default_condition(clif_enabled_by_default) } fn make_run(run: RunConfig<'_>) { - for backend in run.builder.config.codegen_backends(run.target) { - if backend == "llvm" { - continue; // Already built as part of rustc - } - - run.builder.ensure(CodegenBackend { - compiler: run.builder.compiler(run.builder.top_stage, run.target), - backend: backend.clone(), - }); - } + run.builder.ensure(CraneliftCodegenBackend { + build_compiler: run.builder.compiler_for( + run.builder.top_stage, + run.builder.config.host_target, + run.target, + ), + }); } fn run(self, builder: &Builder<'_>) -> Option { - if builder.config.dry_run() { - return None; - } - // This prevents rustc_codegen_cranelift from being built for "dist" // or "install" on the stable/beta channels. It is not yet stable and // should not be included. @@ -1412,44 +1443,39 @@ impl Step for CodegenBackend { return None; } - if !builder.config.codegen_backends(self.compiler.host).contains(&self.backend.to_string()) - { - return None; - } - - if self.backend == "cranelift" && !target_supports_cranelift_backend(self.compiler.host) { + let target = self.build_compiler.host; + let compilers = + RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, target); + if !target_supports_cranelift_backend(target) { builder.info("target not supported by rustc_codegen_cranelift. skipping"); return None; } - let compiler = self.compiler; - let backend = self.backend; - - let mut tarball = - Tarball::new(builder, &format!("rustc-codegen-{backend}"), &compiler.host.triple); - if backend == "cranelift" { - tarball.set_overlay(OverlayKind::RustcCodegenCranelift); - } else { - panic!("Unknown backend rustc_codegen_{backend}"); - } + let mut tarball = Tarball::new(builder, "rustc-codegen-cranelift", &target.triple); + tarball.set_overlay(OverlayKind::RustcCodegenCranelift); tarball.is_preview(true); - tarball.add_legal_and_readme_to(format!("share/doc/rustc_codegen_{backend}")); + tarball.add_legal_and_readme_to("share/doc/rustc_codegen_cranelift"); - let src = builder.sysroot(compiler); - let backends_src = builder.sysroot_codegen_backends(compiler); + builder.ensure(compile::CraneliftCodegenBackend { compilers }); + + if builder.config.dry_run() { + return None; + } + + let src = builder.sysroot(self.build_compiler); + let backends_src = builder.sysroot_codegen_backends(self.build_compiler); let backends_rel = backends_src .strip_prefix(src) .unwrap() - .strip_prefix(builder.sysroot_libdir_relative(compiler)) + .strip_prefix(builder.sysroot_libdir_relative(self.build_compiler)) .unwrap(); // Don't use custom libdir here because ^lib/ will be resolved again with installer let backends_dst = PathBuf::from("lib").join(backends_rel); - let backend_name = format!("rustc_codegen_{backend}"); let mut found_backend = false; for backend in fs::read_dir(&backends_src).unwrap() { let file_name = backend.unwrap().file_name(); - if file_name.to_str().unwrap().contains(&backend_name) { + if file_name.to_str().unwrap().contains("rustc_codegen_cranelift") { tarball.add_file( backends_src.join(file_name), &backends_dst, @@ -1462,11 +1488,18 @@ impl Step for CodegenBackend { Some(tarball.generate()) } + + fn metadata(&self) -> Option { + Some( + StepMetadata::dist("rustc_codegen_cranelift", self.build_compiler.host) + .built_by(self.build_compiler), + ) + } } -#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Rustfmt { - pub compiler: Compiler, + pub build_compiler: Compiler, pub target: TargetSelection, } @@ -1482,7 +1515,7 @@ impl Step for Rustfmt { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Rustfmt { - compiler: run.builder.compiler_for( + build_compiler: run.builder.compiler_for( run.builder.top_stage, run.builder.config.host_target, run.target, @@ -1492,14 +1525,13 @@ impl Step for Rustfmt { } fn run(self, builder: &Builder<'_>) -> Option { - let compiler = self.compiler; - let target = self.target; + let compilers = + RustcPrivateCompilers::from_build_compiler(builder, self.build_compiler, self.target); - builder.ensure(compile::Rustc::new(compiler, target)); + let rustfmt = builder.ensure(tool::Rustfmt::from_compilers(compilers)); + let cargofmt = builder.ensure(tool::Cargofmt::from_compilers(compilers)); - let rustfmt = builder.ensure(tool::Rustfmt { compiler, target }); - let cargofmt = builder.ensure(tool::Cargofmt { compiler, target }); - let mut tarball = Tarball::new(builder, "rustfmt", &target.triple); + let mut tarball = Tarball::new(builder, "rustfmt", &self.target.triple); tarball.set_overlay(OverlayKind::Rustfmt); tarball.is_preview(true); tarball.add_file(&rustfmt.tool_path, "bin", FileType::Executable); @@ -1546,7 +1578,7 @@ impl Step for Extended { let mut built_tools = HashSet::new(); macro_rules! add_component { ($name:expr => $step:expr) => { - if let Some(tarball) = builder.ensure_if_default($step, Kind::Dist) { + if let Some(Some(tarball)) = builder.ensure_if_default($step, Kind::Dist) { tarballs.push(tarball); built_tools.insert($name); } @@ -1566,16 +1598,15 @@ impl Step for Extended { add_component!("rust-docs" => Docs { host: target }); add_component!("rust-json-docs" => JsonDocs { host: target }); - add_component!("cargo" => Cargo { compiler, target }); - add_component!("rustfmt" => Rustfmt { compiler, target }); - add_component!("rust-analyzer" => RustAnalyzer { compiler, target }); + add_component!("cargo" => Cargo { build_compiler: compiler, target }); + add_component!("rustfmt" => Rustfmt { build_compiler: compiler, target }); + add_component!("rust-analyzer" => RustAnalyzer { build_compiler: compiler, target }); add_component!("llvm-components" => LlvmTools { target }); - add_component!("clippy" => Clippy { compiler, target }); - add_component!("miri" => Miri { compiler, target }); + add_component!("clippy" => Clippy { build_compiler: compiler, target }); + add_component!("miri" => Miri { build_compiler: compiler, target }); add_component!("analysis" => Analysis { compiler, target }); - add_component!("rustc-codegen-cranelift" => CodegenBackend { - compiler: builder.compiler(stage, target), - backend: "cranelift".to_string(), + add_component!("rustc-codegen-cranelift" => CraneliftCodegenBackend { + build_compiler: compiler, }); add_component!("llvm-bitcode-linker" => LlvmBitcodeLinker { build_compiler: compiler, diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index 37418f640aca..434e9c0977d2 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -12,7 +12,9 @@ use std::path::{Path, PathBuf}; use std::{env, fs, mem}; use crate::core::build_steps::compile; -use crate::core::build_steps::tool::{self, SourceType, Tool, prepare_tool_cargo}; +use crate::core::build_steps::tool::{ + self, RustcPrivateCompilers, SourceType, Tool, prepare_tool_cargo, +}; use crate::core::builder::{ self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, StepMetadata, crate_description, @@ -149,7 +151,7 @@ impl Step for RustbookSrc

{ let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); if let Some(compiler) = self.rustdoc_compiler { - let mut rustdoc = builder.rustdoc(compiler); + let mut rustdoc = builder.rustdoc_for_compiler(compiler); rustdoc.pop(); let old_path = env::var_os("PATH").unwrap_or_default(); let new_path = @@ -365,7 +367,7 @@ impl Step for Standalone { } let html = out.join(filename).with_extension("html"); - let rustdoc = builder.rustdoc(compiler); + let rustdoc = builder.rustdoc_for_compiler(compiler); if up_to_date(&path, &html) && up_to_date(&footer, &html) && up_to_date(&favicon, &html) @@ -463,7 +465,7 @@ impl Step for Releases { let html = out.join("releases.html"); let tmppath = out.join("releases.md"); let inpath = builder.src.join("RELEASES.md"); - let rustdoc = builder.rustdoc(compiler); + let rustdoc = builder.rustdoc_for_compiler(compiler); if !up_to_date(&inpath, &html) || !up_to_date(&footer, &html) || !up_to_date(&favicon, &html) @@ -722,7 +724,7 @@ fn doc_std( let mut cargo = builder::Cargo::new(builder, compiler, Mode::Std, SourceType::InTree, target, Kind::Doc); - compile::std_cargo(builder, target, compiler.stage, &mut cargo); + compile::std_cargo(builder, target, &mut cargo); cargo .arg("--no-deps") .arg("--target-dir") @@ -811,7 +813,7 @@ impl Step for Rustc { let compiler = builder.compiler(stage, builder.config.host_target); builder.std(compiler, builder.config.host_target); - let _guard = builder.msg_sysroot_tool( + let _guard = builder.msg_rustc_tool( Kind::Doc, stage, format!("compiler{}", crate_description(&self.crates)), @@ -901,6 +903,10 @@ impl Step for Rustc { builder.open_in_browser(index); } } + + fn metadata(&self) -> Option { + Some(StepMetadata::doc("rustc", self.target).stage(self.stage)) + } } macro_rules! tool_doc { @@ -1018,6 +1024,10 @@ macro_rules! tool_doc { })? } } + + fn metadata(&self) -> Option { + Some(StepMetadata::doc(stringify!($tool), self.target)) + } } } } @@ -1074,9 +1084,9 @@ tool_doc!( crates = ["compiletest"] ); -#[derive(Ord, PartialOrd, Debug, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct ErrorIndex { - pub target: TargetSelection, + compilers: RustcPrivateCompilers, } impl Step for ErrorIndex { @@ -1090,17 +1100,29 @@ impl Step for ErrorIndex { } fn make_run(run: RunConfig<'_>) { - let target = run.target; - run.builder.ensure(ErrorIndex { target }); + run.builder.ensure(ErrorIndex { + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), + }); } /// Generates the HTML rendered error-index by running the /// `error_index_generator` tool. fn run(self, builder: &Builder<'_>) { - builder.info(&format!("Documenting error index ({})", self.target)); - let out = builder.doc_out(self.target); + builder.info(&format!("Documenting error index ({})", self.compilers.target())); + let out = builder.doc_out(self.compilers.target()); t!(fs::create_dir_all(&out)); - tool::ErrorIndex::command(builder).arg("html").arg(out).arg(&builder.version).run(builder); + tool::ErrorIndex::command(builder, self.compilers) + .arg("html") + .arg(out) + .arg(&builder.version) + .run(builder); + } + + fn metadata(&self) -> Option { + Some( + StepMetadata::doc("error-index", self.compilers.target()) + .built_by(self.compilers.build_compiler()), + ) } } diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index 4156b49a8b33..acee78dcf59b 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -215,13 +215,13 @@ install!((self, builder, _config), }; Cargo, alias = "cargo", Self::should_build(_config), only_hosts: true, { let tarball = builder - .ensure(dist::Cargo { compiler: self.compiler, target: self.target }) + .ensure(dist::Cargo { build_compiler: self.compiler, target: self.target }) .expect("missing cargo"); install_sh(builder, "cargo", self.compiler.stage, Some(self.target), &tarball); }; RustAnalyzer, alias = "rust-analyzer", Self::should_build(_config), only_hosts: true, { if let Some(tarball) = - builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target }) + builder.ensure(dist::RustAnalyzer { build_compiler: self.compiler, target: self.target }) { install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball); } else { @@ -232,12 +232,12 @@ install!((self, builder, _config), }; Clippy, alias = "clippy", Self::should_build(_config), only_hosts: true, { let tarball = builder - .ensure(dist::Clippy { compiler: self.compiler, target: self.target }) + .ensure(dist::Clippy { build_compiler: self.compiler, target: self.target }) .expect("missing clippy"); install_sh(builder, "clippy", self.compiler.stage, Some(self.target), &tarball); }; Miri, alias = "miri", Self::should_build(_config), only_hosts: true, { - if let Some(tarball) = builder.ensure(dist::Miri { compiler: self.compiler, target: self.target }) { + if let Some(tarball) = builder.ensure(dist::Miri { build_compiler: self.compiler, target: self.target }) { install_sh(builder, "miri", self.compiler.stage, Some(self.target), &tarball); } else { // Miri is only available on nightly @@ -257,7 +257,7 @@ install!((self, builder, _config), }; Rustfmt, alias = "rustfmt", Self::should_build(_config), only_hosts: true, { if let Some(tarball) = builder.ensure(dist::Rustfmt { - compiler: self.compiler, + build_compiler: self.compiler, target: self.target }) { install_sh(builder, "rustfmt", self.compiler.stage, Some(self.target), &tarball); @@ -274,9 +274,8 @@ install!((self, builder, _config), install_sh(builder, "rustc", self.compiler.stage, Some(self.target), &tarball); }; RustcCodegenCranelift, alias = "rustc-codegen-cranelift", Self::should_build(_config), only_hosts: true, { - if let Some(tarball) = builder.ensure(dist::CodegenBackend { - compiler: self.compiler, - backend: "cranelift".to_string(), + if let Some(tarball) = builder.ensure(dist::CraneliftCodegenBackend { + build_compiler: self.compiler, }) { install_sh(builder, "rustc-codegen-cranelift", self.compiler.stage, Some(self.target), &tarball); } else { diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index b2056f5cf378..79244827059d 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -421,6 +421,13 @@ impl Step for Llvm { ldflags.shared.push(" -latomic"); } + if target.starts_with("arm64ec") { + // MSVC linker requires the -machine:arm64ec flag to be passed to + // know it's linking as Arm64EC (vs Arm64X). + ldflags.exe.push(" -machine:arm64ec"); + ldflags.shared.push(" -machine:arm64ec"); + } + if target.is_msvc() { cfg.define("CMAKE_MSVC_RUNTIME_LIBRARY", "MultiThreaded"); cfg.static_crt(true); @@ -986,6 +993,7 @@ impl Step for Enzyme { .env("LLVM_CONFIG_REAL", &llvm_config) .define("LLVM_ENABLE_ASSERTIONS", "ON") .define("ENZYME_EXTERNAL_SHARED_LIB", "ON") + .define("ENZYME_BC_LOADER", "OFF") .define("LLVM_DIR", builder.llvm_out(target)); cfg.build(); @@ -1528,8 +1536,12 @@ impl Step for Libunwind { // FIXME: https://github.com/alexcrichton/cc-rs/issues/545#issuecomment-679242845 let mut count = 0; - for entry in fs::read_dir(&out_dir).unwrap() { - let file = entry.unwrap().path().canonicalize().unwrap(); + let mut files = fs::read_dir(&out_dir) + .unwrap() + .map(|entry| entry.unwrap().path().canonicalize().unwrap()) + .collect::>(); + files.sort(); + for file in files { if file.is_file() && file.extension() == Some(OsStr::new("o")) { // Object file name without the hash prefix is "Unwind-EHABI", "Unwind-seh" or "libunwind". let base_name = unhashed_basename(&file); diff --git a/src/bootstrap/src/core/build_steps/perf.rs b/src/bootstrap/src/core/build_steps/perf.rs index 4d61b38c876d..108b7f90c149 100644 --- a/src/bootstrap/src/core/build_steps/perf.rs +++ b/src/bootstrap/src/core/build_steps/perf.rs @@ -157,7 +157,7 @@ Consider setting `rust.debuginfo-level = 1` in `bootstrap.toml`."#); if let Some(opts) = args.cmd.shared_opts() && opts.profiles.contains(&Profile::Doc) { - builder.ensure(Rustdoc { compiler }); + builder.ensure(Rustdoc { target_compiler: compiler }); } let sysroot = builder.ensure(Sysroot::new(compiler)); diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs index b2293fdd9b52..962dd372849d 100644 --- a/src/bootstrap/src/core/build_steps/run.rs +++ b/src/bootstrap/src/core/build_steps/run.rs @@ -9,7 +9,7 @@ use clap_complete::{Generator, shells}; use crate::core::build_steps::dist::distdir; use crate::core::build_steps::test; -use crate::core::build_steps::tool::{self, SourceType, Tool}; +use crate::core::build_steps::tool::{self, RustcPrivateCompilers, SourceType, Tool}; use crate::core::build_steps::vendor::{Vendor, default_paths_to_vendor}; use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step}; use crate::core::config::TargetSelection; @@ -135,13 +135,13 @@ impl Step for Miri { } // This compiler runs on the host, we'll just use it for the target. - let target_compiler = builder.compiler(stage, target); - let miri_build = builder.ensure(tool::Miri { compiler: target_compiler, target }); - // Rustc tools are off by one stage, so use the build compiler to run miri. + let compilers = RustcPrivateCompilers::new(builder, stage, target); + let miri_build = builder.ensure(tool::Miri::from_compilers(compilers)); let host_compiler = miri_build.build_compiler; // Get a target sysroot for Miri. - let miri_sysroot = test::Miri::build_miri_sysroot(builder, target_compiler, target); + let miri_sysroot = + test::Miri::build_miri_sysroot(builder, compilers.target_compiler(), target); // # Run miri. // Running it via `cargo run` as that figures out the right dylib path. @@ -465,8 +465,8 @@ impl Step for Rustfmt { std::process::exit(1); } - let compiler = builder.compiler(stage, host); - let rustfmt_build = builder.ensure(tool::Rustfmt { compiler, target: host }); + let compilers = RustcPrivateCompilers::new(builder, stage, host); + let rustfmt_build = builder.ensure(tool::Rustfmt::from_compilers(compilers)); let mut rustfmt = tool::prepare_tool_cargo( builder, diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 0f9268097d7b..32c3ef53e128 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -4,17 +4,25 @@ //! However, this contains ~all test parts we expect people to be able to build and run locally. use std::collections::HashSet; +use std::env::split_paths; use std::ffi::{OsStr, OsString}; use std::path::{Path, PathBuf}; use std::{env, fs, iter}; +use build_helper::exit; +#[cfg(feature = "tracing")] +use tracing::instrument; + use crate::core::build_steps::compile::{Std, run_cargo}; use crate::core::build_steps::doc::DocumentationFormat; use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags}; use crate::core::build_steps::llvm::get_llvm_version; use crate::core::build_steps::run::get_completion_paths; use crate::core::build_steps::synthetic_targets::MirOptPanicAbortSyntheticTarget; -use crate::core::build_steps::tool::{self, COMPILETEST_ALLOW_FEATURES, SourceType, Tool}; +use crate::core::build_steps::tool::{ + self, COMPILETEST_ALLOW_FEATURES, RustcPrivateCompilers, SourceType, Tool, ToolTargetBuildMode, + get_tool_target_compiler, +}; use crate::core::build_steps::toolstate::ToolState; use crate::core::build_steps::{compile, dist, llvm}; use crate::core::builder::{ @@ -26,11 +34,11 @@ use crate::core::config::flags::{Subcommand, get_completion}; use crate::utils::build_stamp::{self, BuildStamp}; use crate::utils::exec::{BootstrapCommand, command}; use crate::utils::helpers::{ - self, LldThreads, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var, linker_args, - linker_flags, t, target_supports_cranelift_backend, up_to_date, + self, LldThreads, add_dylib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var, + linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date, }; use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests}; -use crate::{CLang, DocTests, GitRepo, Mode, PathSet, envify}; +use crate::{CLang, CodegenBackendKind, DocTests, GitRepo, Mode, PathSet, debug, envify}; const ADB_TEST_DIR: &str = "/data/local/tmp/work"; @@ -223,7 +231,7 @@ impl Step for HtmlCheck { /// order to test cargo. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Cargotest { - stage: u32, + build_compiler: Compiler, host: TargetSelection, } @@ -236,7 +244,19 @@ impl Step for Cargotest { } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Cargotest { stage: run.builder.top_stage, host: run.target }); + if run.builder.top_stage == 0 { + eprintln!( + "ERROR: running cargotest with stage 0 is currently unsupported. Use at least stage 1." + ); + exit!(1); + } + // We want to build cargo stage N (where N == top_stage), and rustc stage N, + // and test both of these together. + // So we need to get a build compiler stage N-1 to build the stage N components. + run.builder.ensure(Cargotest { + build_compiler: run.builder.compiler(run.builder.top_stage - 1, run.target), + host: run.target, + }); } /// Runs the `cargotest` tool as compiled in `stage` by the `host` compiler. @@ -244,9 +264,19 @@ impl Step for Cargotest { /// This tool in `src/tools` will check out a few Rust projects and run `cargo /// test` to ensure that we don't regress the test suites there. fn run(self, builder: &Builder<'_>) { - let compiler = builder.compiler(self.stage, self.host); - builder.ensure(compile::Rustc::new(compiler, compiler.host)); - let cargo = builder.ensure(tool::Cargo { compiler, target: compiler.host }); + // cargotest's staging has several pieces: + // consider ./x test cargotest --stage=2. + // + // The test goal is to exercise a (stage 2 cargo, stage 2 rustc) pair through a stage 2 + // cargotest tool. + // To produce the stage 2 cargo and cargotest, we need to do so with the stage 1 rustc and std. + // Importantly, the stage 2 rustc being tested (`tested_compiler`) via stage 2 cargotest is + // the rustc built by an earlier stage 1 rustc (the build_compiler). These are two different + // compilers! + let cargo = + builder.ensure(tool::Cargo::from_build_compiler(self.build_compiler, self.host)); + let tested_compiler = builder.compiler(self.build_compiler.stage + 1, self.host); + builder.std(tested_compiler, self.host); // Note that this is a short, cryptic, and not scoped directory name. This // is currently to minimize the length of path on Windows where we otherwise @@ -259,23 +289,22 @@ impl Step for Cargotest { cmd.arg(&cargo.tool_path) .arg(&out_dir) .args(builder.config.test_args()) - .env("RUSTC", builder.rustc(compiler)) - .env("RUSTDOC", builder.rustdoc(compiler)); - add_rustdoc_cargo_linker_args( - &mut cmd, - builder, - compiler.host, - LldThreads::No, - compiler.stage, - ); + .env("RUSTC", builder.rustc(tested_compiler)) + .env("RUSTDOC", builder.rustdoc_for_compiler(tested_compiler)); + add_rustdoc_cargo_linker_args(&mut cmd, builder, tested_compiler.host, LldThreads::No); cmd.delay_failure().run(builder); } + + fn metadata(&self) -> Option { + Some(StepMetadata::test("cargotest", self.host).stage(self.build_compiler.stage + 1)) + } } /// Runs `cargo test` for cargo itself. +/// We label these tests as "cargo self-tests". #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Cargo { - stage: u32, + build_compiler: Compiler, host: TargetSelection, } @@ -292,35 +321,33 @@ impl Step for Cargo { } fn make_run(run: RunConfig<'_>) { - // If stage is explicitly set or not lower than 2, keep it. Otherwise, make sure it's at least 2 - // as tests for this step don't work with a lower stage. - let stage = if run.builder.config.is_explicit_stage() || run.builder.top_stage >= 2 { - run.builder.top_stage - } else { - 2 - }; - - run.builder.ensure(Cargo { stage, host: run.target }); + run.builder.ensure(Cargo { + build_compiler: get_tool_target_compiler( + run.builder, + ToolTargetBuildMode::Build(run.target), + ), + host: run.target, + }); } /// Runs `cargo test` for `cargo` packaged with Rust. fn run(self, builder: &Builder<'_>) { - let stage = self.stage; + // When we do a "stage 1 cargo self-test", it means that we test the stage 1 rustc + // using stage 1 cargo. So we actually build cargo using the stage 0 compiler, and then + // run its tests against the stage 1 compiler (called `tested_compiler` below). + builder.ensure(tool::Cargo::from_build_compiler(self.build_compiler, self.host)); - if stage < 2 { - eprintln!("WARNING: cargo tests on stage {stage} may not behave well."); - eprintln!("HELP: consider using stage 2"); - } - - let compiler = builder.compiler(stage, self.host); - - let cargo = builder.ensure(tool::Cargo { compiler, target: self.host }); - let compiler = cargo.build_compiler; + let tested_compiler = builder.compiler(self.build_compiler.stage + 1, self.host); + builder.std(tested_compiler, self.host); + // We also need to build rustdoc for cargo tests + // It will be located in the bindir of `tested_compiler`, so we don't need to explicitly + // pass its path to Cargo. + builder.rustdoc_for_compiler(tested_compiler); let cargo = tool::prepare_tool_cargo( builder, - compiler, - Mode::ToolRustc, + self.build_compiler, + Mode::ToolTarget, self.host, Kind::Test, Self::CRATE_PATH, @@ -337,7 +364,25 @@ impl Step for Cargo { // Forcibly disable tests using nightly features since any changes to // those features won't be able to land. cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1"); - cargo.env("PATH", path_for_cargo(builder, compiler)); + + // Configure PATH to find the right rustc. NB. we have to use PATH + // and not RUSTC because the Cargo test suite has tests that will + // fail if rustc is not spelled `rustc`. + cargo.env("PATH", bin_path_for_cargo(builder, tested_compiler)); + + // The `cargo` command configured above has dylib dir path set to the `build_compiler`'s + // libdir. That causes issues in cargo test, because the programs that cargo compiles are + // incorrectly picking that libdir, even though they should be picking the + // `tested_compiler`'s libdir. We thus have to override the precedence here. + let mut existing_dylib_paths = cargo + .get_envs() + .find(|(k, _)| *k == OsStr::new(dylib_path_var())) + .and_then(|(_, v)| v) + .map(|value| split_paths(value).collect::>()) + .unwrap_or_default(); + existing_dylib_paths.insert(0, builder.rustc_libdir(tested_compiler)); + add_dylib_path(existing_dylib_paths, &mut cargo); + // Cargo's test suite uses `CARGO_RUSTC_CURRENT_DIR` to determine the path that `file!` is // relative to. Cargo no longer sets this env var, so we have to do that. This has to be the // same value as `-Zroot-dir`. @@ -349,7 +394,7 @@ impl Step for Cargo { crates: vec!["cargo".into()], target: self.host.triple.to_string(), host: self.host.triple.to_string(), - stage, + stage: self.build_compiler.stage + 1, }, builder, ); @@ -361,8 +406,7 @@ impl Step for Cargo { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RustAnalyzer { - stage: u32, - host: TargetSelection, + compilers: RustcPrivateCompilers, } impl Step for RustAnalyzer { @@ -375,19 +419,18 @@ impl Step for RustAnalyzer { } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Self { stage: run.builder.top_stage, host: run.target }); + run.builder.ensure(Self { + compilers: RustcPrivateCompilers::new( + run.builder, + run.builder.top_stage, + run.builder.host_target, + ), + }); } /// Runs `cargo test` for rust-analyzer fn run(self, builder: &Builder<'_>) { - let stage = self.stage; - let host = self.host; - let compiler = builder.compiler(stage, host); - let compiler = tool::get_tool_rustc_compiler(builder, compiler); - - // We don't need to build the whole Rust Analyzer for the proc-macro-srv test suite, - // but we do need the standard library to be present. - builder.ensure(compile::Rustc::new(compiler, host)); + let host = self.compilers.target(); let workspace_path = "src/tools/rust-analyzer"; // until the whole RA test suite runs on `i686`, we only run @@ -395,7 +438,7 @@ impl Step for RustAnalyzer { let crate_path = "src/tools/rust-analyzer/crates/proc-macro-srv"; let mut cargo = tool::prepare_tool_cargo( builder, - compiler, + self.compilers.build_compiler(), Mode::ToolRustc, host, Kind::Test, @@ -422,8 +465,7 @@ impl Step for RustAnalyzer { /// Runs `cargo test` for rustfmt. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Rustfmt { - stage: u32, - host: TargetSelection, + compilers: RustcPrivateCompilers, } impl Step for Rustfmt { @@ -435,36 +477,39 @@ impl Step for Rustfmt { } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Rustfmt { stage: run.builder.top_stage, host: run.target }); + run.builder.ensure(Rustfmt { + compilers: RustcPrivateCompilers::new( + run.builder, + run.builder.top_stage, + run.builder.host_target, + ), + }); } /// Runs `cargo test` for rustfmt. fn run(self, builder: &Builder<'_>) { - let stage = self.stage; - let host = self.host; - let compiler = builder.compiler(stage, host); - - let tool_result = builder.ensure(tool::Rustfmt { compiler, target: self.host }); - let compiler = tool_result.build_compiler; + let tool_result = builder.ensure(tool::Rustfmt::from_compilers(self.compilers)); + let build_compiler = tool_result.build_compiler; + let target = self.compilers.target(); let mut cargo = tool::prepare_tool_cargo( builder, - compiler, + build_compiler, Mode::ToolRustc, - host, + target, Kind::Test, "src/tools/rustfmt", SourceType::InTree, &[], ); - let dir = testdir(builder, compiler.host); + let dir = testdir(builder, target); t!(fs::create_dir_all(&dir)); cargo.env("RUSTFMT_TEST_DIR", dir); cargo.add_rustc_lib_path(builder); - run_cargo_test(cargo, &[], &[], "rustfmt", host, builder); + run_cargo_test(cargo, &[], &[], "rustfmt", target, builder); } } @@ -539,12 +584,14 @@ impl Step for Miri { } // This compiler runs on the host, we'll just use it for the target. - let target_compiler = builder.compiler(stage, host); + let compilers = RustcPrivateCompilers::new(builder, stage, host); // Build our tools. - let miri = builder.ensure(tool::Miri { compiler: target_compiler, target: host }); + let miri = builder.ensure(tool::Miri::from_compilers(compilers)); // the ui tests also assume cargo-miri has been built - builder.ensure(tool::CargoMiri { compiler: target_compiler, target: host }); + builder.ensure(tool::CargoMiri::from_compilers(compilers)); + + let target_compiler = compilers.target_compiler(); // We also need sysroots, for Miri and for the host (the latter for build scripts). // This is for the tests so everything is done with the target compiler. @@ -596,7 +643,7 @@ impl Step for Miri { cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg()); { - let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "miri", host, target); + let _guard = builder.msg_rustc_tool(Kind::Test, stage, "miri", host, target); let _time = helpers::timeit(builder); cargo.run(builder); } @@ -612,7 +659,7 @@ impl Step for Miri { cargo.args(["tests/pass", "tests/panic"]); { - let _guard = builder.msg_sysroot_tool( + let _guard = builder.msg_rustc_tool( Kind::Test, stage, "miri (mir-opt-level 4)", @@ -689,7 +736,7 @@ impl Step for CargoMiri { // Finally, run everything. let mut cargo = BootstrapCommand::from(cargo); { - let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "cargo-miri", host, target); + let _guard = builder.msg_rustc_tool(Kind::Test, stage, "cargo-miri", host, target); let _time = helpers::timeit(builder); cargo.run(builder); } @@ -713,9 +760,23 @@ impl Step for CompiletestTest { } /// Runs `cargo test` for compiletest. + #[cfg_attr( + feature = "tracing", + instrument(level = "debug", name = "CompiletestTest::run", skip_all) + )] fn run(self, builder: &Builder<'_>) { let host = self.host; + + if builder.top_stage == 0 && !builder.config.compiletest_allow_stage0 { + eprintln!("\ +ERROR: `--stage 0` runs compiletest self-tests against the stage0 (precompiled) compiler, not the in-tree compiler, and will almost always cause tests to fail +NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-allow-stage0=true`." + ); + crate::exit!(1); + } + let compiler = builder.compiler(builder.top_stage, host); + debug!(?compiler); // We need `ToolStd` for the locally-built sysroot because // compiletest uses unstable features of the `test` crate. @@ -723,8 +784,8 @@ impl Step for CompiletestTest { let mut cargo = tool::prepare_tool_cargo( builder, compiler, - // compiletest uses libtest internals; make it use the in-tree std to make sure it never breaks - // when std sources change. + // compiletest uses libtest internals; make it use the in-tree std to make sure it never + // breaks when std sources change. Mode::ToolStd, host, Kind::Test, @@ -732,6 +793,12 @@ impl Step for CompiletestTest { SourceType::InTree, &[], ); + + // Used for `compiletest` self-tests to have the path to the *staged* compiler. Getting this + // right is important, as `compiletest` is intended to only support one target spec JSON + // format, namely that of the staged compiler. + cargo.env("TEST_RUSTC", builder.rustc(compiler)); + cargo.allow_features(COMPILETEST_ALLOW_FEATURES); run_cargo_test(cargo, &[], &[], "compiletest self test", host, builder); } @@ -739,7 +806,7 @@ impl Step for CompiletestTest { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Clippy { - host: TargetSelection, + compilers: RustcPrivateCompilers, } impl Step for Clippy { @@ -752,23 +819,30 @@ impl Step for Clippy { } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Clippy { host: run.target }); + run.builder.ensure(Clippy { + compilers: RustcPrivateCompilers::new( + run.builder, + run.builder.top_stage, + run.builder.host_target, + ), + }); } /// Runs `cargo test` for clippy. fn run(self, builder: &Builder<'_>) { - let stage = builder.top_stage; - let host = self.host; + let host = self.compilers.target(); + // We need to carefully distinguish the compiler that builds clippy, and the compiler // that is linked into the clippy being tested. `target_compiler` is the latter, // and it must also be used by clippy's test runner to build tests and their dependencies. - let target_compiler = builder.compiler(stage, host); + let compilers = self.compilers; + let target_compiler = compilers.target_compiler(); - let tool_result = builder.ensure(tool::Clippy { compiler: target_compiler, target: host }); - let tool_compiler = tool_result.build_compiler; + let tool_result = builder.ensure(tool::Clippy::from_compilers(compilers)); + let build_compiler = tool_result.build_compiler; let mut cargo = tool::prepare_tool_cargo( builder, - tool_compiler, + build_compiler, Mode::ToolRustc, host, Kind::Test, @@ -777,9 +851,10 @@ impl Step for Clippy { &[], ); - cargo.env("RUSTC_TEST_SUITE", builder.rustc(tool_compiler)); - cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(tool_compiler)); - let host_libs = builder.stage_out(tool_compiler, Mode::ToolRustc).join(builder.cargo_dir()); + cargo.env("RUSTC_TEST_SUITE", builder.rustc(build_compiler)); + cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(build_compiler)); + let host_libs = + builder.stage_out(build_compiler, Mode::ToolRustc).join(builder.cargo_dir()); cargo.env("HOST_LIBS", host_libs); // Build the standard library that the tests can use. @@ -808,8 +883,7 @@ impl Step for Clippy { cargo.add_rustc_lib_path(builder); let cargo = prepare_cargo_test(cargo, &[], &[], host, builder); - let _guard = - builder.msg_sysroot_tool(Kind::Test, tool_compiler.stage, "clippy", host, host); + let _guard = builder.msg_rustc_tool(Kind::Test, build_compiler.stage, "clippy", host, host); // Clippy reports errors if it blessed the outputs if cargo.allow_failure().run(builder) { @@ -823,10 +897,7 @@ impl Step for Clippy { } } -fn path_for_cargo(builder: &Builder<'_>, compiler: Compiler) -> OsString { - // Configure PATH to find the right rustc. NB. we have to use PATH - // and not RUSTC because the Cargo test suite has tests that will - // fail if rustc is not spelled `rustc`. +fn bin_path_for_cargo(builder: &Builder<'_>, compiler: Compiler) -> OsString { let path = builder.sysroot(compiler).join("bin"); let old_path = env::var_os("PATH").unwrap_or_default(); env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("") @@ -861,9 +932,9 @@ impl Step for RustdocTheme { .env("RUSTC_SYSROOT", builder.sysroot(self.compiler)) .env("RUSTDOC_LIBDIR", builder.sysroot_target_libdir(self.compiler, self.compiler.host)) .env("CFG_RELEASE_CHANNEL", &builder.config.channel) - .env("RUSTDOC_REAL", builder.rustdoc(self.compiler)) + .env("RUSTDOC_REAL", builder.rustdoc_for_compiler(self.compiler)) .env("RUSTC_BOOTSTRAP", "1"); - cmd.args(linker_args(builder, self.compiler.host, LldThreads::No, self.compiler.stage)); + cmd.args(linker_args(builder, self.compiler.host, LldThreads::No)); cmd.delay_failure().run(builder); } @@ -1020,7 +1091,11 @@ impl Step for RustdocGUI { let mut cmd = builder.tool_cmd(Tool::RustdocGUITest); let out_dir = builder.test_out(self.target).join("rustdoc-gui"); - build_stamp::clear_if_dirty(builder, &out_dir, &builder.rustdoc(self.compiler)); + build_stamp::clear_if_dirty( + builder, + &out_dir, + &builder.rustdoc_for_compiler(self.compiler), + ); if let Some(src) = builder.config.src.to_str() { cmd.arg("--rust-src").arg(src); @@ -1036,16 +1111,10 @@ impl Step for RustdocGUI { cmd.arg("--jobs").arg(builder.jobs().to_string()); - cmd.env("RUSTDOC", builder.rustdoc(self.compiler)) + cmd.env("RUSTDOC", builder.rustdoc_for_compiler(self.compiler)) .env("RUSTC", builder.rustc(self.compiler)); - add_rustdoc_cargo_linker_args( - &mut cmd, - builder, - self.compiler.host, - LldThreads::No, - self.compiler.stage, - ); + add_rustdoc_cargo_linker_args(&mut cmd, builder, self.compiler.host, LldThreads::No); for path in &builder.paths { if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) { @@ -1072,7 +1141,7 @@ impl Step for RustdocGUI { } let _time = helpers::timeit(builder); - let _guard = builder.msg_sysroot_tool( + let _guard = builder.msg_rustc_tool( Kind::Test, self.compiler.stage, "rustdoc-gui", @@ -1612,12 +1681,11 @@ impl Step for Compiletest { return; } - if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() { + if builder.top_stage == 0 && !builder.config.compiletest_allow_stage0 { eprintln!("\ ERROR: `--stage 0` runs compiletest on the stage0 (precompiled) compiler, not your local changes, and will almost always cause tests to fail -HELP: to test the compiler, use `--stage 1` instead -HELP: to test the standard library, use `--stage 0 library/std` instead -NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`." +HELP: to test the compiler or standard library, omit the stage or explicitly use `--stage 1` instead +NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-allow-stage0=true`." ); crate::exit!(1); } @@ -1641,7 +1709,11 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the // bootstrap compiler. // NOTE: Only stage 1 is special cased because we need the rustc_private artifacts to match the // running compiler in stage 2 when plugins run. + let query_compiler; let (stage, stage_id) = if suite == "ui-fulldeps" && compiler.stage == 1 { + // Even when using the stage 0 compiler, we also need to provide the stage 1 compiler + // so that compiletest can query it for target information. + query_compiler = Some(compiler); // At stage 0 (stage - 1) we are using the stage0 compiler. Using `self.target` can lead // finding an incorrect compiler path on cross-targets, as the stage 0 is always equal to // `build.build` in the configuration. @@ -1650,6 +1722,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let test_stage = compiler.stage + 1; (test_stage, format!("stage{test_stage}-{build}")) } else { + query_compiler = None; let stage = compiler.stage; (stage, format!("stage{stage}-{target}")) }; @@ -1694,6 +1767,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler)); cmd.arg("--run-lib-path").arg(builder.sysroot_target_libdir(compiler, target)); cmd.arg("--rustc-path").arg(builder.rustc(compiler)); + if let Some(query_compiler) = query_compiler { + cmd.arg("--query-rustc-path").arg(builder.rustc(query_compiler)); + } // Minicore auxiliary lib for `no_core` tests that need `core` stubs in cross-compilation // scenarios. @@ -1707,7 +1783,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the // If we're using `--stage 0`, we should provide the bootstrap cargo. builder.initial_cargo.clone() } else { - builder.ensure(tool::Cargo { compiler, target: compiler.host }).tool_path + builder.ensure(tool::Cargo::from_build_compiler(compiler, compiler.host)).tool_path }; cmd.arg("--cargo-path").arg(cargo_path); @@ -1726,7 +1802,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the || mode == "rustdoc-json" || suite == "coverage-run-rustdoc" { - cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler)); + cmd.arg("--rustdoc-path").arg(builder.rustdoc_for_compiler(compiler)); } if mode == "rustdoc-json" { @@ -1770,7 +1846,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.host_target)); if let Some(codegen_backend) = builder.config.default_codegen_backend(compiler.host) { - cmd.arg("--codegen-backend").arg(&codegen_backend); + // Tells compiletest which codegen backend is used by default by the compiler. + // It is used to e.g. ignore tests that don't support that codegen backend. + cmd.arg("--codegen-backend").arg(codegen_backend.name()); } if builder.build.config.llvm_enzyme { @@ -1861,7 +1939,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the } let mut hostflags = flags.clone(); - hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No, compiler.stage)); + hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No)); let mut targetflags = flags; @@ -2240,7 +2318,7 @@ impl BookTest { // mdbook just executes a binary named "rustdoc", so we need to update // PATH so that it points to our rustdoc. - let mut rustdoc_path = builder.rustdoc(compiler); + let mut rustdoc_path = builder.rustdoc_for_compiler(compiler); rustdoc_path.pop(); let old_path = env::var_os("PATH").unwrap_or_default(); let new_path = env::join_paths(iter::once(rustdoc_path).chain(env::split_paths(&old_path))) @@ -2424,7 +2502,7 @@ test_book!( #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ErrorIndex { - compiler: Compiler, + compilers: RustcPrivateCompilers, } impl Step for ErrorIndex { @@ -2442,8 +2520,12 @@ impl Step for ErrorIndex { // error_index_generator depends on librustdoc. Use the compiler that // is normally used to build rustdoc for other tests (like compiletest // tests in tests/rustdoc) so that it shares the same artifacts. - let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.host_target); - run.builder.ensure(ErrorIndex { compiler }); + let compilers = RustcPrivateCompilers::new( + run.builder, + run.builder.top_stage, + run.builder.config.host_target, + ); + run.builder.ensure(ErrorIndex { compilers }); } /// Runs the error index generator tool to execute the tests located in the error @@ -2453,24 +2535,30 @@ impl Step for ErrorIndex { /// generate a markdown file from the error indexes of the code base which is /// then passed to `rustdoc --test`. fn run(self, builder: &Builder<'_>) { - let compiler = self.compiler; + // The compiler that we are testing + let target_compiler = self.compilers.target_compiler(); - let dir = testdir(builder, compiler.host); + let dir = testdir(builder, target_compiler.host); t!(fs::create_dir_all(&dir)); let output = dir.join("error-index.md"); - let mut tool = tool::ErrorIndex::command(builder); + let mut tool = tool::ErrorIndex::command(builder, self.compilers); tool.arg("markdown").arg(&output); - let guard = - builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host); + let guard = builder.msg( + Kind::Test, + target_compiler.stage, + "error-index", + target_compiler.host, + target_compiler.host, + ); let _time = helpers::timeit(builder); tool.run_capture(builder); drop(guard); // The tests themselves need to link to std, so make sure it is // available. - builder.std(compiler, compiler.host); - markdown_test(builder, compiler, &output); + builder.std(target_compiler, target_compiler.host); + markdown_test(builder, target_compiler, &output); } } @@ -2563,7 +2651,7 @@ fn run_cargo_test<'a>( let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder); let _time = helpers::timeit(builder); let _group = description.into().and_then(|what| { - builder.msg_sysroot_tool(Kind::Test, compiler.stage, what, compiler.host, target) + builder.msg_rustc_tool(Kind::Test, compiler.stage, what, compiler.host, target) }); #[cfg(feature = "build-metrics")] @@ -2768,7 +2856,7 @@ impl Step for Crate { .arg("--manifest-path") .arg(builder.src.join("library/sysroot/Cargo.toml")); } else { - compile::std_cargo(builder, target, compiler.stage, &mut cargo); + compile::std_cargo(builder, target, &mut cargo); } } Mode::Rustc => { @@ -3390,7 +3478,11 @@ impl Step for CodegenCranelift { return; } - if !builder.config.codegen_backends(run.target).contains(&"cranelift".to_owned()) { + if !builder + .config + .enabled_codegen_backends(run.target) + .contains(&CodegenBackendKind::Cranelift) + { builder.info("cranelift not in rust.codegen-backends. skipping"); return; } @@ -3517,7 +3609,7 @@ impl Step for CodegenGCC { return; } - if !builder.config.codegen_backends(run.target).contains(&"gcc".to_owned()) { + if !builder.config.enabled_codegen_backends(run.target).contains(&CodegenBackendKind::Gcc) { builder.info("gcc not in rust.codegen-backends. skipping"); return; } diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index f5fa33b98f3b..aa00cd03c5bb 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -71,13 +71,9 @@ impl Builder<'_> { ) -> Option { match mode { // depends on compiler stage, different to host compiler - Mode::ToolRustc => self.msg_sysroot_tool( - kind, - build_stage, - format_args!("tool {tool}"), - *host, - *target, - ), + Mode::ToolRustc => { + self.msg_rustc_tool(kind, build_stage, format_args!("tool {tool}"), *host, *target) + } // doesn't depend on compiler, same as host compiler _ => self.msg(kind, build_stage, format_args!("tool {tool}"), *host, *target), } @@ -90,11 +86,8 @@ impl Builder<'_> { pub struct ToolBuildResult { /// Artifact path of the corresponding tool that was built. pub tool_path: PathBuf, - /// Compiler used to build the tool. For non-`ToolRustc` tools this is equal to `target_compiler`. - /// For `ToolRustc` this is one stage before of the `target_compiler`. + /// Compiler used to build the tool. pub build_compiler: Compiler, - /// Target compiler passed to `Step`. - pub target_compiler: Compiler, } impl Step for ToolBuild { @@ -108,22 +101,15 @@ impl Step for ToolBuild { /// /// This will build the specified tool with the specified `host` compiler in /// `stage` into the normal cargo output directory. - fn run(mut self, builder: &Builder<'_>) -> ToolBuildResult { + fn run(self, builder: &Builder<'_>) -> ToolBuildResult { let target = self.target; let mut tool = self.tool; let path = self.path; - let target_compiler = self.build_compiler; - self.build_compiler = if self.mode == Mode::ToolRustc { - get_tool_rustc_compiler(builder, self.build_compiler) - } else { - self.build_compiler - }; - match self.mode { Mode::ToolRustc => { - // If compiler was forced, its artifacts should have been prepared earlier. - if !self.build_compiler.is_forced_compiler() { + // FIXME: remove this, it's only needed for download-rustc... + if !self.build_compiler.is_forced_compiler() && builder.download_rustc() { builder.std(self.build_compiler, self.build_compiler.host); builder.ensure(compile::Rustc::new(self.build_compiler, target)); } @@ -184,8 +170,7 @@ impl Step for ToolBuild { Kind::Build, self.mode, self.tool, - // A stage N tool is built with the stage N-1 compiler. - self.build_compiler.stage + 1, + self.build_compiler.stage, &self.build_compiler.host, &self.target, ); @@ -216,7 +201,7 @@ impl Step for ToolBuild { .join(format!("lib{tool}.rlib")), }; - ToolBuildResult { tool_path, build_compiler: self.build_compiler, target_compiler } + ToolBuildResult { tool_path, build_compiler: self.build_compiler } } } } @@ -346,31 +331,11 @@ pub fn prepare_tool_cargo( cargo } -/// Handle stage-off logic for `ToolRustc` tools when necessary. -pub(crate) fn get_tool_rustc_compiler( - builder: &Builder<'_>, - target_compiler: Compiler, -) -> Compiler { - if target_compiler.is_forced_compiler() { - return target_compiler; - } - - if builder.download_rustc() && target_compiler.stage == 1 { - // We shouldn't drop to stage0 compiler when using CI rustc. - return builder.compiler(1, builder.config.host_target); - } - - // Similar to `compile::Assemble`, build with the previous stage's compiler. Otherwise - // we'd have stageN/bin/rustc and stageN/bin/$rustc_tool be effectively different stage - // compilers, which isn't what we want. Rustc tools should be linked in the same way as the - // compiler it's paired with, so it must be built with the previous stage compiler. - builder.compiler(target_compiler.stage.saturating_sub(1), builder.config.host_target) -} - /// Determines how to build a `ToolTarget`, i.e. which compiler should be used to compile it. /// The compiler stage is automatically bumped if we need to cross-compile a stage 1 tool. pub enum ToolTargetBuildMode { - /// Build the tool using rustc that corresponds to the selected CLI stage. + /// Build the tool for the given `target` using rustc that corresponds to the top CLI + /// stage. Build(TargetSelection), /// Build the tool so that it can be attached to the sysroot of the passed compiler. /// Since we always dist stage 2+, the compiler that builds the tool in this case has to be @@ -402,7 +367,10 @@ pub(crate) fn get_tool_target_compiler( } else { // If we are cross-compiling a stage 1 tool, we cannot do that with a stage 0 compiler, // so we auto-bump the tool's stage to 2, which means we need a stage 1 compiler. - builder.compiler(build_compiler_stage.max(1), builder.host_target) + let build_compiler = builder.compiler(build_compiler_stage.max(1), builder.host_target); + // We also need the host stdlib to compile host code (proc macros/build scripts) + builder.std(build_compiler, builder.host_target); + build_compiler }; builder.std(compiler, target); compiler @@ -624,20 +592,20 @@ impl Step for RustcPerf { } } -#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] +#[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct ErrorIndex { - pub compiler: Compiler, + compilers: RustcPrivateCompilers, } impl ErrorIndex { - pub fn command(builder: &Builder<'_>) -> BootstrapCommand { + pub fn command(builder: &Builder<'_>, compilers: RustcPrivateCompilers) -> BootstrapCommand { // Error-index-generator links with the rustdoc library, so we need to add `rustc_lib_paths` // for rustc_private and libLLVM.so, and `sysroot_lib` for libstd, etc. - let host = builder.config.host_target; - let compiler = builder.compiler_for(builder.top_stage, host, host); - let mut cmd = command(builder.ensure(ErrorIndex { compiler }).tool_path); - let mut dylib_paths = builder.rustc_lib_paths(compiler); - dylib_paths.push(builder.sysroot_target_libdir(compiler, compiler.host)); + let mut cmd = command(builder.ensure(ErrorIndex { compilers }).tool_path); + + let target_compiler = compilers.target_compiler(); + let mut dylib_paths = builder.rustc_lib_paths(target_compiler); + dylib_paths.push(builder.sysroot_target_libdir(target_compiler, target_compiler.host)); add_dylib_path(dylib_paths, &mut cmd); cmd } @@ -656,14 +624,19 @@ impl Step for ErrorIndex { // src/tools/error-index-generator` which almost nobody does. // Normally, `x.py test` or `x.py doc` will use the // `ErrorIndex::command` function instead. - let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.host_target); - run.builder.ensure(ErrorIndex { compiler }); + run.builder.ensure(ErrorIndex { + compilers: RustcPrivateCompilers::new( + run.builder, + run.builder.top_stage, + run.builder.host_target, + ), + }); } fn run(self, builder: &Builder<'_>) -> ToolBuildResult { builder.ensure(ToolBuild { - build_compiler: self.compiler, - target: self.compiler.host, + build_compiler: self.compilers.build_compiler, + target: self.compilers.target(), tool: "error_index_generator", mode: Mode::ToolRustc, path: "src/tools/error_index_generator", @@ -674,6 +647,13 @@ impl Step for ErrorIndex { artifact_kind: ToolArtifactKind::Binary, }) } + + fn metadata(&self) -> Option { + Some( + StepMetadata::build("error-index", self.compilers.target()) + .built_by(self.compilers.build_compiler), + ) + } } #[derive(Debug, Clone, Hash, PartialEq, Eq)] @@ -719,15 +699,21 @@ impl Step for RemoteTestServer { } } -#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] +/// Represents `Rustdoc` that either comes from the external stage0 sysroot or that is built +/// locally. +/// Rustdoc is special, because it both essentially corresponds to a `Compiler` (that can be +/// externally provided), but also to a `ToolRustc` tool. +#[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Rustdoc { - /// This should only ever be 0 or 2. - /// We sometimes want to reference the "bootstrap" rustdoc, which is why this option is here. - pub compiler: Compiler, + /// If the stage of `target_compiler` is `0`, then rustdoc is externally provided. + /// Otherwise it is built locally. + pub target_compiler: Compiler, } impl Step for Rustdoc { - type Output = ToolBuildResult; + /// Path to the built rustdoc binary. + type Output = PathBuf; + const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -736,26 +722,25 @@ impl Step for Rustdoc { } fn make_run(run: RunConfig<'_>) { - run.builder - .ensure(Rustdoc { compiler: run.builder.compiler(run.builder.top_stage, run.target) }); + run.builder.ensure(Rustdoc { + target_compiler: run.builder.compiler(run.builder.top_stage, run.target), + }); } - fn run(self, builder: &Builder<'_>) -> ToolBuildResult { - let target_compiler = self.compiler; + fn run(self, builder: &Builder<'_>) -> Self::Output { + let target_compiler = self.target_compiler; let target = target_compiler.host; + // If stage is 0, we use a prebuilt rustdoc from stage0 if target_compiler.stage == 0 { if !target_compiler.is_snapshot(builder) { panic!("rustdoc in stage 0 must be snapshot rustdoc"); } - return ToolBuildResult { - tool_path: builder.initial_rustdoc.clone(), - build_compiler: target_compiler, - target_compiler, - }; + return builder.initial_rustdoc.clone(); } + // If stage is higher, we build rustdoc instead let bin_rustdoc = || { let sysroot = builder.sysroot(target_compiler); let bindir = sysroot.join("bin"); @@ -767,10 +752,7 @@ impl Step for Rustdoc { // If CI rustc is enabled and we haven't modified the rustdoc sources, // use the precompiled rustdoc from CI rustc's sysroot to speed up bootstrapping. - if builder.download_rustc() - && target_compiler.stage > 0 - && builder.rust_info().is_managed_git_subrepository() - { + if builder.download_rustc() && builder.rust_info().is_managed_git_subrepository() { let files_to_track = &["src/librustdoc", "src/tools/rustdoc", "src/rustdoc-json-types"]; // Check if unchanged @@ -783,12 +765,7 @@ impl Step for Rustdoc { let bin_rustdoc = bin_rustdoc(); builder.copy_link(&precompiled_rustdoc, &bin_rustdoc, FileType::Executable); - - return ToolBuildResult { - tool_path: bin_rustdoc, - build_compiler: target_compiler, - target_compiler, - }; + return bin_rustdoc; } } @@ -804,9 +781,10 @@ impl Step for Rustdoc { extra_features.push("jemalloc".to_string()); } - let ToolBuildResult { tool_path, build_compiler, target_compiler } = - builder.ensure(ToolBuild { - build_compiler: target_compiler, + let compilers = RustcPrivateCompilers::from_target_compiler(builder, target_compiler); + let tool_path = builder + .ensure(ToolBuild { + build_compiler: compilers.build_compiler, target, // Cargo adds a number of paths to the dylib search path on windows, which results in // the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool" @@ -819,38 +797,41 @@ impl Step for Rustdoc { allow_features: "", cargo_args: Vec::new(), artifact_kind: ToolArtifactKind::Binary, - }); + }) + .tool_path; - // don't create a stage0-sysroot/bin directory. - if target_compiler.stage > 0 { - if builder.config.rust_debuginfo_level_tools == DebuginfoLevel::None { - // Due to LTO a lot of debug info from C++ dependencies such as jemalloc can make it into - // our final binaries - compile::strip_debug(builder, target, &tool_path); - } - let bin_rustdoc = bin_rustdoc(); - builder.copy_link(&tool_path, &bin_rustdoc, FileType::Executable); - ToolBuildResult { tool_path: bin_rustdoc, build_compiler, target_compiler } - } else { - ToolBuildResult { tool_path, build_compiler, target_compiler } + if builder.config.rust_debuginfo_level_tools == DebuginfoLevel::None { + // Due to LTO a lot of debug info from C++ dependencies such as jemalloc can make it into + // our final binaries + compile::strip_debug(builder, target, &tool_path); } + let bin_rustdoc = bin_rustdoc(); + builder.copy_link(&tool_path, &bin_rustdoc, FileType::Executable); + bin_rustdoc } fn metadata(&self) -> Option { Some( - StepMetadata::build("rustdoc", self.compiler.host) - // rustdoc is ToolRustc, so stage N rustdoc is built by stage N-1 rustc - // FIXME: make this stage deduction automatic somehow - // FIXME: log the compiler that actually built ToolRustc steps - .stage(self.compiler.stage.saturating_sub(1)), + StepMetadata::build("rustdoc", self.target_compiler.host) + .stage(self.target_compiler.stage), ) } } +/// Builds the cargo tool. +/// Note that it can be built using a stable compiler. #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct Cargo { - pub compiler: Compiler, - pub target: TargetSelection, + build_compiler: Compiler, + target: TargetSelection, +} + +impl Cargo { + /// Returns `Cargo` that will be **compiled** by the passed compiler, for the given + /// `target`. + pub fn from_build_compiler(build_compiler: Compiler, target: TargetSelection) -> Self { + Self { build_compiler, target } + } } impl Step for Cargo { @@ -865,7 +846,10 @@ impl Step for Cargo { fn make_run(run: RunConfig<'_>) { run.builder.ensure(Cargo { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target), + build_compiler: get_tool_target_compiler( + run.builder, + ToolTargetBuildMode::Build(run.target), + ), target: run.target, }); } @@ -873,19 +857,28 @@ impl Step for Cargo { fn run(self, builder: &Builder<'_>) -> ToolBuildResult { builder.build.require_submodule("src/tools/cargo", None); + builder.std(self.build_compiler, self.target); builder.ensure(ToolBuild { - build_compiler: self.compiler, + build_compiler: self.build_compiler, target: self.target, tool: "cargo", - mode: Mode::ToolRustc, + mode: Mode::ToolTarget, path: "src/tools/cargo", source_type: SourceType::Submodule, extra_features: Vec::new(), - allow_features: "", + // Cargo is compilable with a stable compiler, but since we run in bootstrap, + // with RUSTC_BOOTSTRAP being set, some "clever" build scripts enable specialization + // based on this, which breaks stuff. We thus have to explicitly allow these features + // here. + allow_features: "min_specialization,specialization", cargo_args: Vec::new(), artifact_kind: ToolArtifactKind::Binary, }) } + + fn metadata(&self) -> Option { + Some(StepMetadata::build("cargo", self.target).built_by(self.build_compiler)) + } } /// Represents a built LldWrapper, the `lld-wrapper` tool itself, and a directory @@ -1066,8 +1059,13 @@ impl Step for WasmComponentLd { #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct RustAnalyzer { - pub compiler: Compiler, - pub target: TargetSelection, + compilers: RustcPrivateCompilers, +} + +impl RustAnalyzer { + pub fn from_compilers(compilers: RustcPrivateCompilers) -> Self { + Self { compilers } + } } impl RustAnalyzer { @@ -1086,15 +1084,16 @@ impl Step for RustAnalyzer { fn make_run(run: RunConfig<'_>) { run.builder.ensure(RustAnalyzer { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target), - target: run.target, + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), }); } fn run(self, builder: &Builder<'_>) -> ToolBuildResult { + let build_compiler = self.compilers.build_compiler; + let target = self.compilers.target(); builder.ensure(ToolBuild { - build_compiler: self.compiler, - target: self.target, + build_compiler, + target, tool: "rust-analyzer", mode: Mode::ToolRustc, path: "src/tools/rust-analyzer", @@ -1105,16 +1104,29 @@ impl Step for RustAnalyzer { artifact_kind: ToolArtifactKind::Binary, }) } + + fn metadata(&self) -> Option { + Some( + StepMetadata::build("rust-analyzer", self.compilers.target()) + .built_by(self.compilers.build_compiler), + ) + } } #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct RustAnalyzerProcMacroSrv { - pub compiler: Compiler, - pub target: TargetSelection, + compilers: RustcPrivateCompilers, +} + +impl RustAnalyzerProcMacroSrv { + pub fn from_compilers(compilers: RustcPrivateCompilers) -> Self { + Self { compilers } + } } impl Step for RustAnalyzerProcMacroSrv { - type Output = Option; + type Output = ToolBuildResult; + const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -1131,15 +1143,14 @@ impl Step for RustAnalyzerProcMacroSrv { fn make_run(run: RunConfig<'_>) { run.builder.ensure(RustAnalyzerProcMacroSrv { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target), - target: run.target, + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), }); } - fn run(self, builder: &Builder<'_>) -> Option { + fn run(self, builder: &Builder<'_>) -> Self::Output { let tool_result = builder.ensure(ToolBuild { - build_compiler: self.compiler, - target: self.target, + build_compiler: self.compilers.build_compiler, + target: self.compilers.target(), tool: "rust-analyzer-proc-macro-srv", mode: Mode::ToolRustc, path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli", @@ -1152,7 +1163,7 @@ impl Step for RustAnalyzerProcMacroSrv { // Copy `rust-analyzer-proc-macro-srv` to `/libexec/` // so that r-a can use it. - let libexec_path = builder.sysroot(self.compiler).join("libexec"); + let libexec_path = builder.sysroot(self.compilers.target_compiler).join("libexec"); t!(fs::create_dir_all(&libexec_path)); builder.copy_link( &tool_result.tool_path, @@ -1160,7 +1171,14 @@ impl Step for RustAnalyzerProcMacroSrv { FileType::Executable, ); - Some(tool_result) + tool_result + } + + fn metadata(&self) -> Option { + Some( + StepMetadata::build("rust-analyzer-proc-macro-srv", self.compilers.target()) + .built_by(self.compilers.build_compiler), + ) } } @@ -1302,7 +1320,92 @@ impl Step for LibcxxVersionTool { } } -macro_rules! tool_extended { +/// Represents which compilers are involved in the compilation of a tool +/// that depends on compiler internals (`rustc_private`). +/// Their compilation looks like this: +/// +/// - `build_compiler` (stage N-1) builds `target_compiler` (stage N) to produce .rlibs +/// - These .rlibs are copied into the sysroot of `build_compiler` +/// - `build_compiler` (stage N-1) builds `` (stage N) +/// - `` links to .rlibs from `target_compiler` +/// +/// Eventually, this could also be used for .rmetas and check builds, but so far we only deal with +/// normal builds here. +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] +pub struct RustcPrivateCompilers { + /// Compiler that builds the tool and that builds `target_compiler`. + build_compiler: Compiler, + /// Compiler to which .rlib artifacts the tool links to. + /// The host target of this compiler corresponds to the target of the tool. + target_compiler: Compiler, +} + +impl RustcPrivateCompilers { + /// Create compilers for a `rustc_private` tool with the given `stage` and for the given + /// `target`. + pub fn new(builder: &Builder<'_>, stage: u32, target: TargetSelection) -> Self { + let build_compiler = Self::build_compiler_from_stage(builder, stage); + + // This is the compiler we'll link to + // FIXME: make 100% sure that `target_compiler` was indeed built with `build_compiler`... + let target_compiler = builder.compiler(build_compiler.stage + 1, target); + + Self { build_compiler, target_compiler } + } + + pub fn from_build_and_target_compiler( + build_compiler: Compiler, + target_compiler: Compiler, + ) -> Self { + Self { build_compiler, target_compiler } + } + + /// Create rustc tool compilers from the build compiler. + pub fn from_build_compiler( + builder: &Builder<'_>, + build_compiler: Compiler, + target: TargetSelection, + ) -> Self { + let target_compiler = builder.compiler(build_compiler.stage + 1, target); + Self { build_compiler, target_compiler } + } + + /// Create rustc tool compilers from the target compiler. + pub fn from_target_compiler(builder: &Builder<'_>, target_compiler: Compiler) -> Self { + Self { + build_compiler: Self::build_compiler_from_stage(builder, target_compiler.stage), + target_compiler, + } + } + + fn build_compiler_from_stage(builder: &Builder<'_>, stage: u32) -> Compiler { + assert!(stage > 0); + + if builder.download_rustc() && stage == 1 { + // We shouldn't drop to stage0 compiler when using CI rustc. + builder.compiler(1, builder.config.host_target) + } else { + builder.compiler(stage - 1, builder.config.host_target) + } + } + + pub fn build_compiler(&self) -> Compiler { + self.build_compiler + } + + pub fn target_compiler(&self) -> Compiler { + self.target_compiler + } + + /// Target of the tool being compiled + pub fn target(&self) -> TargetSelection { + self.target_compiler.host + } +} + +/// Creates a step that builds an extended `Mode::ToolRustc` tool +/// and installs it into the sysroot of a corresponding compiler. +macro_rules! tool_rustc_extended { ( $name:ident { path: $path:expr, @@ -1316,8 +1419,15 @@ macro_rules! tool_extended { ) => { #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct $name { - pub compiler: Compiler, - pub target: TargetSelection, + compilers: RustcPrivateCompilers, + } + + impl $name { + pub fn from_compilers(compilers: RustcPrivateCompilers) -> Self { + Self { + compilers, + } + } } impl Step for $name { @@ -1326,7 +1436,7 @@ macro_rules! tool_extended { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - should_run_tool_build_step( + should_run_extended_rustc_tool( run, $tool_name, $path, @@ -1336,17 +1446,15 @@ macro_rules! tool_extended { fn make_run(run: RunConfig<'_>) { run.builder.ensure($name { - compiler: run.builder.compiler(run.builder.top_stage, run.builder.config.host_target), - target: run.target, + compilers: RustcPrivateCompilers::new(run.builder, run.builder.top_stage, run.target), }); } fn run(self, builder: &Builder<'_>) -> ToolBuildResult { - let Self { compiler, target } = self; - run_tool_build_step( + let Self { compilers } = self; + build_extended_rustc_tool( builder, - compiler, - target, + compilers, $tool_name, $path, None $( .or(Some(&$add_bins_to_sysroot)) )?, @@ -1356,18 +1464,16 @@ macro_rules! tool_extended { } fn metadata(&self) -> Option { - // FIXME: refactor extended tool steps to make the build_compiler explicit, - // it is offset by one now for rustc tools Some( - StepMetadata::build($tool_name, self.target) - .built_by(self.compiler.with_stage(self.compiler.stage.saturating_sub(1))) + StepMetadata::build($tool_name, self.compilers.target()) + .built_by(self.compilers.build_compiler) ) } } } } -fn should_run_tool_build_step<'a>( +fn should_run_extended_rustc_tool<'a>( run: ShouldRun<'a>, tool_name: &'static str, path: &'static str, @@ -1391,39 +1497,38 @@ fn should_run_tool_build_step<'a>( ) } -#[expect(clippy::too_many_arguments)] // silence overeager clippy lint -fn run_tool_build_step( +fn build_extended_rustc_tool( builder: &Builder<'_>, - compiler: Compiler, - target: TargetSelection, + compilers: RustcPrivateCompilers, tool_name: &'static str, path: &'static str, add_bins_to_sysroot: Option<&[&str]>, add_features: Option, TargetSelection, &mut Vec)>, cargo_args: Option<&[&'static str]>, ) -> ToolBuildResult { + let target = compilers.target(); let mut extra_features = Vec::new(); if let Some(func) = add_features { func(builder, target, &mut extra_features); } - let ToolBuildResult { tool_path, build_compiler, target_compiler } = - builder.ensure(ToolBuild { - build_compiler: compiler, - target, - tool: tool_name, - mode: Mode::ToolRustc, - path, - extra_features, - source_type: SourceType::InTree, - allow_features: "", - cargo_args: cargo_args.unwrap_or_default().iter().map(|s| String::from(*s)).collect(), - artifact_kind: ToolArtifactKind::Binary, - }); + let build_compiler = compilers.build_compiler; + let ToolBuildResult { tool_path, .. } = builder.ensure(ToolBuild { + build_compiler, + target, + tool: tool_name, + mode: Mode::ToolRustc, + path, + extra_features, + source_type: SourceType::InTree, + allow_features: "", + cargo_args: cargo_args.unwrap_or_default().iter().map(|s| String::from(*s)).collect(), + artifact_kind: ToolArtifactKind::Binary, + }); + let target_compiler = compilers.target_compiler; if let Some(add_bins_to_sysroot) = add_bins_to_sysroot && !add_bins_to_sysroot.is_empty() - && target_compiler.stage > 0 { let bindir = builder.sysroot(target_compiler).join("bin"); t!(fs::create_dir_all(&bindir)); @@ -1435,25 +1540,25 @@ fn run_tool_build_step( // Return a path into the bin dir. let path = bindir.join(exe(tool_name, target_compiler.host)); - ToolBuildResult { tool_path: path, build_compiler, target_compiler } + ToolBuildResult { tool_path: path, build_compiler } } else { - ToolBuildResult { tool_path, build_compiler, target_compiler } + ToolBuildResult { tool_path, build_compiler } } } -tool_extended!(Cargofmt { +tool_rustc_extended!(Cargofmt { path: "src/tools/rustfmt", tool_name: "cargo-fmt", stable: true, add_bins_to_sysroot: ["cargo-fmt"] }); -tool_extended!(CargoClippy { +tool_rustc_extended!(CargoClippy { path: "src/tools/clippy", tool_name: "cargo-clippy", stable: true, add_bins_to_sysroot: ["cargo-clippy"] }); -tool_extended!(Clippy { +tool_rustc_extended!(Clippy { path: "src/tools/clippy", tool_name: "clippy-driver", stable: true, @@ -1464,7 +1569,7 @@ tool_extended!(Clippy { } } }); -tool_extended!(Miri { +tool_rustc_extended!(Miri { path: "src/tools/miri", tool_name: "miri", stable: false, @@ -1472,13 +1577,13 @@ tool_extended!(Miri { // Always compile also tests when building miri. Otherwise feature unification can cause rebuilds between building and testing miri. cargo_args: &["--all-targets"], }); -tool_extended!(CargoMiri { +tool_rustc_extended!(CargoMiri { path: "src/tools/miri/cargo-miri", tool_name: "cargo-miri", stable: false, add_bins_to_sysroot: ["cargo-miri"] }); -tool_extended!(Rustfmt { +tool_rustc_extended!(Rustfmt { path: "src/tools/rustfmt", tool_name: "rustfmt", stable: true, diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index badd5f24dba7..39f46bf43afc 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -115,7 +115,7 @@ impl Cargo { // No need to configure the target linker for these command types. Kind::Clean | Kind::Check | Kind::Format | Kind::Setup => {} _ => { - cargo.configure_linker(builder, mode); + cargo.configure_linker(builder); } } @@ -209,7 +209,7 @@ impl Cargo { // FIXME(onur-ozkan): Add coverage to make sure modifications to this function // doesn't cause cache invalidations (e.g., #130108). - fn configure_linker(&mut self, builder: &Builder<'_>, mode: Mode) -> &mut Cargo { + fn configure_linker(&mut self, builder: &Builder<'_>) -> &mut Cargo { let target = self.target; let compiler = self.compiler; @@ -264,12 +264,7 @@ impl Cargo { } } - // We use the snapshot compiler when building host code (build scripts/proc macros) of - // `Mode::Std` tools, so we need to determine the current stage here to pass the proper - // linker args (e.g. -C vs -Z). - // This should stay synchronized with the [cargo] function. - let host_stage = if mode == Mode::Std { 0 } else { compiler.stage }; - for arg in linker_args(builder, compiler.host, LldThreads::Yes, host_stage) { + for arg in linker_args(builder, compiler.host, LldThreads::Yes) { self.hostflags.arg(&arg); } @@ -279,10 +274,10 @@ impl Cargo { } // We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not // `linker_args` here. - for flag in linker_flags(builder, target, LldThreads::Yes, compiler.stage) { + for flag in linker_flags(builder, target, LldThreads::Yes) { self.rustflags.arg(&flag); } - for arg in linker_args(builder, target, LldThreads::Yes, compiler.stage) { + for arg in linker_args(builder, target, LldThreads::Yes) { self.rustdocflags.arg(&arg); } @@ -438,6 +433,15 @@ impl Builder<'_> { let out_dir = self.stage_out(compiler, mode); cargo.env("CARGO_TARGET_DIR", &out_dir); + // Bootstrap makes a lot of assumptions about the artifacts produced in the target + // directory. If users override the "build directory" using `build-dir` + // (https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-dir), then + // bootstrap couldn't find these artifacts. So we forcefully override that option to our + // target directory here. + // In the future, we could attempt to read the build-dir location from Cargo and actually + // respect it. + cargo.env("CARGO_BUILD_BUILD_DIR", &out_dir); + // Found with `rg "init_env_logger\("`. If anyone uses `init_env_logger` // from out of tree it shouldn't matter, since x.py is only used for // building in-tree. @@ -508,7 +512,7 @@ impl Builder<'_> { } _ => panic!("doc mode {mode:?} not expected"), }; - let rustdoc = self.rustdoc(compiler); + let rustdoc = self.rustdoc_for_compiler(compiler); build_stamp::clear_if_dirty(self, &my_out, &rustdoc); } @@ -822,7 +826,7 @@ impl Builder<'_> { } let rustdoc_path = match cmd_kind { - Kind::Doc | Kind::Test | Kind::MiriTest => self.rustdoc(compiler), + Kind::Doc | Kind::Test | Kind::MiriTest => self.rustdoc_for_compiler(compiler), _ => PathBuf::from("/path/to/nowhere/rustdoc/not/required"), }; @@ -1286,7 +1290,7 @@ impl Builder<'_> { if let Some(limit) = limit && (build_compiler_stage == 0 - || self.config.default_codegen_backend(target).unwrap_or_default() == "llvm") + || self.config.default_codegen_backend(target).unwrap_or_default().is_llvm()) { rustflags.arg(&format!("-Cllvm-args=-import-instr-limit={limit}")); } diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 923c3a9a9350..163a498d4b48 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -16,6 +16,7 @@ use tracing::instrument; pub use self::cargo::{Cargo, cargo_profile_var}; pub use crate::Compiler; use crate::core::build_steps::compile::{Std, StdLink}; +use crate::core::build_steps::tool::RustcPrivateCompilers; use crate::core::build_steps::{ check, clean, clippy, compile, dist, doc, gcc, install, llvm, run, setup, test, tool, vendor, }; @@ -77,7 +78,7 @@ impl Deref for Builder<'_> { /// type's [`Debug`] implementation. /// /// (Trying to debug-print `dyn Any` results in the unhelpful `"Any { .. }"`.) -trait AnyDebug: Any + Debug {} +pub trait AnyDebug: Any + Debug {} impl AnyDebug for T {} impl dyn AnyDebug { /// Equivalent to `::downcast_ref`. @@ -141,7 +142,7 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash { #[allow(unused)] #[derive(Debug, PartialEq, Eq)] pub struct StepMetadata { - name: &'static str, + name: String, kind: Kind, target: TargetSelection, built_by: Option, @@ -151,28 +152,28 @@ pub struct StepMetadata { } impl StepMetadata { - pub fn build(name: &'static str, target: TargetSelection) -> Self { + pub fn build(name: &str, target: TargetSelection) -> Self { Self::new(name, target, Kind::Build) } - pub fn check(name: &'static str, target: TargetSelection) -> Self { + pub fn check(name: &str, target: TargetSelection) -> Self { Self::new(name, target, Kind::Check) } - pub fn doc(name: &'static str, target: TargetSelection) -> Self { + pub fn doc(name: &str, target: TargetSelection) -> Self { Self::new(name, target, Kind::Doc) } - pub fn dist(name: &'static str, target: TargetSelection) -> Self { + pub fn dist(name: &str, target: TargetSelection) -> Self { Self::new(name, target, Kind::Dist) } - pub fn test(name: &'static str, target: TargetSelection) -> Self { + pub fn test(name: &str, target: TargetSelection) -> Self { Self::new(name, target, Kind::Test) } - fn new(name: &'static str, target: TargetSelection, kind: Kind) -> Self { - Self { name, kind, target, built_by: None, stage: None, metadata: None } + fn new(name: &str, target: TargetSelection, kind: Kind) -> Self { + Self { name: name.to_string(), kind, target, built_by: None, stage: None, metadata: None } } pub fn built_by(mut self, compiler: Compiler) -> Self { @@ -197,6 +198,14 @@ impl StepMetadata { // For everything else, a stage N things gets built by a stage N-1 compiler. .map(|compiler| if self.name == "std" { compiler.stage } else { compiler.stage + 1 })) } + + pub fn get_name(&self) -> &str { + &self.name + } + + pub fn get_target(&self) -> TargetSelection { + self.target + } } pub struct RunConfig<'a> { @@ -950,7 +959,8 @@ impl<'a> Builder<'a> { compile::Std, compile::Rustc, compile::Assemble, - compile::CodegenBackend, + compile::CraneliftCodegenBackend, + compile::GccCodegenBackend, compile::StartupObjects, tool::BuildManifest, tool::Rustbook, @@ -1033,6 +1043,7 @@ impl<'a> Builder<'a> { check::Compiletest, check::FeaturesStatusDump, check::CoverageDump, + check::Linkchecker, // This has special staging logic, it may run on stage 1 while others run on stage 0. // It takes quite some time to build stage 1, so put this at the end. // @@ -1140,7 +1151,7 @@ impl<'a> Builder<'a> { dist::JsonDocs, dist::Mingw, dist::Rustc, - dist::CodegenBackend, + dist::CraneliftCodegenBackend, dist::Std, dist::RustcDev, dist::Analysis, @@ -1534,8 +1545,11 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s .map(|entry| entry.path()) } - pub fn rustdoc(&self, compiler: Compiler) -> PathBuf { - self.ensure(tool::Rustdoc { compiler }).tool_path + /// Returns a path to `Rustdoc` that "belongs" to the `target_compiler`. + /// It can be either a stage0 rustdoc or a locally built rustdoc that *links* to + /// `target_compiler`. + pub fn rustdoc_for_compiler(&self, target_compiler: Compiler) -> PathBuf { + self.ensure(tool::Rustdoc { target_compiler }) } pub fn cargo_clippy_cmd(&self, run_compiler: Compiler) -> BootstrapCommand { @@ -1551,10 +1565,13 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s return cmd; } - let _ = - self.ensure(tool::Clippy { compiler: run_compiler, target: self.build.host_target }); - let cargo_clippy = self - .ensure(tool::CargoClippy { compiler: run_compiler, target: self.build.host_target }); + // FIXME: double check that `run_compiler`'s stage is what we want to use + let compilers = + RustcPrivateCompilers::new(self, run_compiler.stage, self.build.host_target); + assert_eq!(run_compiler, compilers.target_compiler()); + + let _ = self.ensure(tool::Clippy::from_compilers(compilers)); + let cargo_clippy = self.ensure(tool::CargoClippy::from_compilers(compilers)); let mut dylib_path = helpers::dylib_path(); dylib_path.insert(0, self.sysroot(run_compiler).join("lib")); @@ -1566,11 +1583,14 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s pub fn cargo_miri_cmd(&self, run_compiler: Compiler) -> BootstrapCommand { assert!(run_compiler.stage > 0, "miri can not be invoked at stage 0"); + + let compilers = + RustcPrivateCompilers::new(self, run_compiler.stage, self.build.host_target); + assert_eq!(run_compiler, compilers.target_compiler()); + // Prepare the tools - let miri = - self.ensure(tool::Miri { compiler: run_compiler, target: self.build.host_target }); - let cargo_miri = - self.ensure(tool::CargoMiri { compiler: run_compiler, target: self.build.host_target }); + let miri = self.ensure(tool::Miri::from_compilers(compilers)); + let cargo_miri = self.ensure(tool::CargoMiri::from_compilers(compilers)); // Invoke cargo-miri, make sure it can find miri and cargo. let mut cmd = command(cargo_miri.tool_path); cmd.env("MIRI", &miri.tool_path); @@ -1595,7 +1615,7 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s // equivalently to rustc. .env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler)) .env("CFG_RELEASE_CHANNEL", &self.config.channel) - .env("RUSTDOC_REAL", self.rustdoc(compiler)) + .env("RUSTDOC_REAL", self.rustdoc_for_compiler(compiler)) .env("RUSTC_BOOTSTRAP", "1"); cmd.arg("-Wrustdoc::invalid_codeblock_attributes"); @@ -1604,7 +1624,7 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s cmd.arg("-Dwarnings"); } cmd.arg("-Znormalize-docs"); - cmd.args(linker_args(self, compiler.host, LldThreads::Yes, compiler.stage)); + cmd.args(linker_args(self, compiler.host, LldThreads::Yes)); cmd } @@ -1656,9 +1676,24 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s if let Some(out) = self.cache.get(&step) { self.verbose_than(1, || println!("{}c {:?}", " ".repeat(stack.len()), step)); + #[cfg(feature = "tracing")] + { + if let Some(parent) = stack.last() { + let mut graph = self.build.step_graph.borrow_mut(); + graph.register_cached_step(&step, parent, self.config.dry_run()); + } + } return out; } self.verbose_than(1, || println!("{}> {:?}", " ".repeat(stack.len()), step)); + + #[cfg(feature = "tracing")] + { + let parent = stack.last(); + let mut graph = self.build.step_graph.borrow_mut(); + graph.register_step_execution(&step, parent, self.config.dry_run()); + } + stack.push(Box::new(step.clone())); } @@ -1704,11 +1739,11 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s /// Ensure that a given step is built *only if it's supposed to be built by default*, returning /// its output. This will cache the step, so it's safe (and good!) to call this as often as /// needed to ensure that all dependencies are build. - pub(crate) fn ensure_if_default>>( + pub(crate) fn ensure_if_default>( &'a self, step: S, kind: Kind, - ) -> S::Output { + ) -> Option { let desc = StepDescription::from::(kind); let should_run = (desc.should_run)(ShouldRun::new(self, desc.kind)); @@ -1720,7 +1755,7 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s } // Only execute if it's supposed to run as default - if desc.default && should_run.is_really_default() { self.ensure(step) } else { None } + if desc.default && should_run.is_really_default() { Some(self.ensure(step)) } else { None } } /// Checks if any of the "should_run" paths is in the `Builder` paths. diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 6ea5d4e65532..4c7766e58c1c 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -257,38 +257,6 @@ fn parse_config_download_rustc_at(path: &Path, download_rustc: &str, ci: bool) - ) } -mod defaults { - use pretty_assertions::assert_eq; - - use super::{TEST_TRIPLE_1, TEST_TRIPLE_2, configure, first, run_build}; - use crate::Config; - use crate::core::builder::*; - - #[test] - fn doc_default() { - let mut config = configure("doc", &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]); - config.compiler_docs = true; - config.cmd = Subcommand::Doc { open: false, json: false }; - let mut cache = run_build(&[], config); - let a = TargetSelection::from_user(TEST_TRIPLE_1); - - // error_index_generator uses stage 0 to share rustdoc artifacts with the - // rustdoc tool. - assert_eq!(first(cache.all::()), &[doc::ErrorIndex { target: a },]); - assert_eq!( - first(cache.all::()), - &[tool::ErrorIndex { compiler: Compiler::new(1, a) }] - ); - // docs should be built with the stage0 compiler, not with the stage0 artifacts. - // recall that rustdoc is off-by-one: `stage` is the compiler rustdoc is _linked_ to, - // not the one it was built by. - assert_eq!( - first(cache.all::()), - &[tool::Rustdoc { compiler: Compiler::new(1, a) },] - ); - } -} - mod dist { use pretty_assertions::assert_eq; @@ -316,34 +284,6 @@ mod dist { let target = TargetSelection::from_user(TEST_TRIPLE_1); assert!(build.llvm_out(target).ends_with("llvm")); } - - #[test] - fn doc_ci() { - let mut config = configure(&[TEST_TRIPLE_1], &[TEST_TRIPLE_1]); - config.compiler_docs = true; - config.cmd = Subcommand::Doc { open: false, json: false }; - let build = Build::new(config); - let mut builder = Builder::new(&build); - builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &[]); - let a = TargetSelection::from_user(TEST_TRIPLE_1); - - // error_index_generator uses stage 1 to share rustdoc artifacts with the - // rustdoc tool. - assert_eq!( - first(builder.cache.all::()), - &[doc::ErrorIndex { target: a },] - ); - assert_eq!( - first(builder.cache.all::()), - &[tool::ErrorIndex { compiler: Compiler::new(1, a) }] - ); - // This is actually stage 1, but Rustdoc::run swaps out the compiler with - // stage minus 1 if --stage is not 0. Very confusing! - assert_eq!( - first(builder.cache.all::()), - &[tool::Rustdoc { compiler: Compiler::new(2, a) },] - ); - } } mod sysroot_target_dirs { @@ -569,36 +509,6 @@ fn test_is_builder_target() { } } -#[test] -fn test_get_tool_rustc_compiler() { - let mut config = configure("build", &[], &[]); - config.download_rustc_commit = None; - let build = Build::new(config); - let builder = Builder::new(&build); - - let target_triple_1 = TargetSelection::from_user(TEST_TRIPLE_1); - - let compiler = Compiler::new(2, target_triple_1); - let expected = Compiler::new(1, target_triple_1); - let actual = tool::get_tool_rustc_compiler(&builder, compiler); - assert_eq!(expected, actual); - - let compiler = Compiler::new(1, target_triple_1); - let expected = Compiler::new(0, target_triple_1); - let actual = tool::get_tool_rustc_compiler(&builder, compiler); - assert_eq!(expected, actual); - - let mut config = configure("build", &[], &[]); - config.download_rustc_commit = Some("".to_owned()); - let build = Build::new(config); - let builder = Builder::new(&build); - - let compiler = Compiler::new(1, target_triple_1); - let expected = Compiler::new(1, target_triple_1); - let actual = tool::get_tool_rustc_compiler(&builder, compiler); - assert_eq!(expected, actual); -} - /// When bootstrap detects a step dependency cycle (which is a bug), its panic /// message should show the actual steps on the stack, not just several copies /// of `Any { .. }`. @@ -657,7 +567,7 @@ mod snapshot { [build] llvm [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 - [build] rustdoc 0 + [build] rustdoc 1 "); } @@ -680,10 +590,10 @@ mod snapshot { [build] rustc 2 -> std 2 [build] rustc 1 -> std 1 [build] rustc 2 -> std 2 - [build] rustdoc 1 + [build] rustdoc 2 [build] llvm [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [build] rustdoc 2 "); } @@ -762,6 +672,23 @@ mod snapshot { "); } + #[test] + fn build_compiler_codegen_backend() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx + .config("build") + .args(&["--set", "rust.codegen-backends=['llvm', 'cranelift']"]) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> rustc_codegen_cranelift 1 + [build] rustc 1 -> std 1 + [build] rustdoc 1 + " + ); + } + #[test] fn build_compiler_tools() { let ctx = TestCtx::new(); @@ -780,7 +707,7 @@ mod snapshot { [build] rustc 1 -> LldWrapper 2 [build] rustc 1 -> LlvmBitcodeLinker 2 [build] rustc 2 -> std 2 - [build] rustdoc 1 + [build] rustdoc 2 " ); } @@ -809,7 +736,7 @@ mod snapshot { [build] rustc 1 -> rustc 2 [build] rustc 1 -> LldWrapper 2 [build] rustc 1 -> LlvmBitcodeLinker 2 - [build] rustdoc 1 + [build] rustdoc 2 " ); } @@ -914,6 +841,19 @@ mod snapshot { "); } + #[test] + fn build_error_index() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("build") + .path("error_index_generator") + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> error-index 1 + "); + } + #[test] fn build_bootstrap_tool_no_explicit_stage() { let ctx = TestCtx::new(); @@ -998,8 +938,8 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 - [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 1 + [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] "); } @@ -1026,6 +966,31 @@ mod snapshot { "); } + #[test] + fn build_cargo() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("build") + .paths(&["cargo"]) + .render_steps(), @"[build] rustc 0 -> cargo 1 "); + } + + #[test] + fn build_cargo_cross() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("build") + .paths(&["cargo"]) + .hosts(&[TEST_TRIPLE_1]) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustc 1 -> std 1 + [build] rustc 1 -> cargo 2 + "); + } + #[test] fn dist_default_stage() { let ctx = TestCtx::new(); @@ -1047,8 +1012,10 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 @@ -1089,24 +1056,29 @@ mod snapshot { [build] rustc 1 -> LldWrapper 2 [build] rustc 1 -> WasmComponentLd 2 [build] rustc 1 -> LlvmBitcodeLinker 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 [dist] docs [doc] std 2 crates=[] [dist] mingw + [build] rustc 1 -> rust-analyzer-proc-macro-srv 2 [build] rustc 0 -> GenerateCopyright 1 [dist] rustc [dist] rustc 1 -> std 1 [dist] src <> - [build] rustc 0 -> rustfmt 1 - [build] rustc 0 -> cargo-fmt 1 - [build] rustc 0 -> clippy-driver 1 - [build] rustc 0 -> cargo-clippy 1 - [build] rustc 0 -> miri 1 - [build] rustc 0 -> cargo-miri 1 + [build] rustc 1 -> cargo 2 + [build] rustc 1 -> rust-analyzer 2 + [build] rustc 1 -> rustfmt 2 + [build] rustc 1 -> cargo-fmt 2 + [build] rustc 1 -> clippy-driver 2 + [build] rustc 1 -> cargo-clippy 2 + [build] rustc 1 -> miri 2 + [build] rustc 1 -> cargo-miri 2 "); } @@ -1125,9 +1097,11 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 @@ -1162,11 +1136,17 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 + [build] llvm + [build] rustc 1 -> std 1 + [build] rustc 1 -> rustc 2 + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 - [build] rustc 1 -> std 1 [build] rustc 2 -> std 2 [build] rustc 0 -> RustInstaller 1 [dist] docs @@ -1174,9 +1154,7 @@ mod snapshot { [dist] mingw [build] rustc 0 -> GenerateCopyright 1 [dist] rustc - [build] llvm - [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [build] rustdoc 2 [dist] rustc [dist] rustc 1 -> std 1 [dist] src <> @@ -1199,12 +1177,18 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 + [build] llvm + [build] rustc 1 -> std 1 + [build] rustc 1 -> rustc 2 + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 - [build] rustc 1 -> std 1 [build] rustc 2 -> std 2 [build] rustc 0 -> RustInstaller 1 [dist] docs @@ -1215,9 +1199,7 @@ mod snapshot { [dist] mingw [build] rustc 0 -> GenerateCopyright 1 [dist] rustc - [build] llvm - [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [build] rustdoc 2 [dist] rustc [dist] rustc 1 -> std 1 [dist] rustc 1 -> std 1 @@ -1241,8 +1223,8 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] [build] rustc 2 -> std 2 [build] rustc 0 -> RustInstaller 1 [dist] docs @@ -1273,34 +1255,75 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustc 1 -> WasmComponentLd 2 - [build] rustdoc 1 - [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] - [build] rustc 2 -> std 2 + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] llvm [build] rustc 1 -> std 1 + [build] rustc 1 -> rustc 2 + [build] rustc 1 -> WasmComponentLd 2 + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 + [build] rustc 2 -> std 2 [build] rustc 2 -> std 2 [build] rustc 0 -> LintDocs 1 [build] rustc 0 -> RustInstaller 1 [dist] docs [doc] std 2 crates=[] [dist] mingw - [build] llvm - [build] rustc 1 -> rustc 2 - [build] rustc 1 -> WasmComponentLd 2 - [build] rustdoc 1 + [build] rustdoc 2 + [build] rustc 1 -> rust-analyzer-proc-macro-srv 2 [build] rustc 0 -> GenerateCopyright 1 [dist] rustc [dist] rustc 1 -> std 1 [dist] src <> - [build] rustc 0 -> rustfmt 1 - [build] rustc 0 -> cargo-fmt 1 - [build] rustc 0 -> clippy-driver 1 - [build] rustc 0 -> cargo-clippy 1 - [build] rustc 0 -> miri 1 - [build] rustc 0 -> cargo-miri 1 + [build] rustc 1 -> cargo 2 + [build] rustc 1 -> rust-analyzer 2 + [build] rustc 1 -> rustfmt 2 + [build] rustc 1 -> cargo-fmt 2 + [build] rustc 1 -> clippy-driver 2 + [build] rustc 1 -> cargo-clippy 2 + [build] rustc 1 -> miri 2 + [build] rustc 1 -> cargo-miri 2 [build] rustc 1 -> LlvmBitcodeLinker 2 "); } + // Enable dist cranelift tarball by default with `x dist` if cranelift is enabled in + // `rust.codegen-backends`. + #[test] + fn dist_cranelift_by_default() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx + .config("dist") + .args(&["--set", "rust.codegen-backends=['llvm', 'cranelift']"]) + .render_steps(), @r" + [build] rustc 0 -> UnstableBookGen 1 + [build] rustc 0 -> Rustbook 1 + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> rustc_codegen_cranelift 1 + [build] rustc 1 -> std 1 + [build] rustc 1 -> rustc 2 + [build] rustc 1 -> rustc_codegen_cranelift 2 + [build] rustdoc 2 + [doc] std 2 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 1 -> error-index 2 + [doc] rustc 1 -> error-index 2 + [build] rustc 2 -> std 2 + [build] rustc 0 -> LintDocs 1 + [build] rustc 0 -> RustInstaller 1 + [dist] docs + [doc] std 2 crates=[] + [dist] mingw + [build] rustc 0 -> GenerateCopyright 1 + [dist] rustc + [dist] rustc 1 -> rustc_codegen_cranelift 2 + [dist] rustc 1 -> std 1 + [dist] src <> + "); + } + #[test] fn check_compiler_no_explicit_stage() { let ctx = TestCtx::new(); @@ -1309,8 +1332,8 @@ mod snapshot { .path("compiler") .render_steps(), @r" [check] rustc 0 -> rustc 1 - [check] rustc 0 -> cranelift 1 - [check] rustc 0 -> gcc 1 + [check] rustc 0 -> rustc_codegen_cranelift 1 + [check] rustc 0 -> rustc_codegen_gcc 1 "); } @@ -1341,8 +1364,8 @@ mod snapshot { .stage(1) .render_steps(), @r" [check] rustc 0 -> rustc 1 - [check] rustc 0 -> cranelift 1 - [check] rustc 0 -> gcc 1 + [check] rustc 0 -> rustc_codegen_cranelift 1 + [check] rustc 0 -> rustc_codegen_gcc 1 "); } @@ -1358,8 +1381,8 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [check] rustc 1 -> rustc 2 - [check] rustc 1 -> cranelift 2 - [check] rustc 1 -> gcc 2 + [check] rustc 1 -> rustc_codegen_cranelift 2 + [check] rustc 1 -> rustc_codegen_gcc 2 "); } @@ -1377,8 +1400,8 @@ mod snapshot { [build] rustc 1 -> std 1 [check] rustc 1 -> rustc 2 [check] rustc 1 -> Rustdoc 2 - [check] rustc 1 -> cranelift 2 - [check] rustc 1 -> gcc 2 + [check] rustc 1 -> rustc_codegen_cranelift 2 + [check] rustc 1 -> rustc_codegen_gcc 2 [check] rustc 1 -> Clippy 2 [check] rustc 1 -> Miri 2 [check] rustc 1 -> CargoMiri 2 @@ -1472,8 +1495,8 @@ mod snapshot { .args(&args) .render_steps(), @r" [check] rustc 0 -> rustc 1 - [check] rustc 0 -> cranelift 1 - [check] rustc 0 -> gcc 1 + [check] rustc 0 -> rustc_codegen_cranelift 1 + [check] rustc 0 -> rustc_codegen_gcc 1 "); } @@ -1557,8 +1580,8 @@ mod snapshot { .path("rustc_codegen_cranelift") .render_steps(), @r" [check] rustc 0 -> rustc 1 - [check] rustc 0 -> cranelift 1 - [check] rustc 0 -> gcc 1 + [check] rustc 0 -> rustc_codegen_cranelift 1 + [check] rustc 0 -> rustc_codegen_gcc 1 "); } @@ -1610,6 +1633,77 @@ mod snapshot { steps.assert_contains_fuzzy(StepMetadata::build("rustc", host)); } + #[test] + fn test_cargo_stage_1() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("cargo") + .render_steps(), @r" + [build] rustc 0 -> cargo 1 + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustdoc 1 + [build] rustdoc 0 + "); + } + + #[test] + fn test_cargo_stage_2() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("cargo") + .stage(2) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustc 1 -> cargo 2 + [build] rustc 1 -> rustc 2 + [build] rustc 2 -> std 2 + [build] rustdoc 2 + [build] rustdoc 1 + "); + } + + #[test] + fn test_cargotest() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("cargotest") + .render_steps(), @r" + [build] rustc 0 -> cargo 1 + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustc 0 -> CargoTest 1 + [build] rustdoc 1 + [test] cargotest 1 + "); + } + + #[test] + fn doc_all() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .render_steps(), @r" + [build] rustc 0 -> UnstableBookGen 1 + [build] rustc 0 -> Rustbook 1 + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustdoc 1 + [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] + [build] rustc 0 -> error-index 1 + [doc] rustc 0 -> error-index 1 + [build] rustc 1 -> std 1 + [build] rustc 0 -> LintDocs 1 + "); + } + #[test] fn doc_library() { let ctx = TestCtx::new(); @@ -1619,8 +1713,8 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 - [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,std,std_detect,sysroot,test,unwind] + [build] rustdoc 1 + [doc] std 1 crates=[alloc,compiler_builtins,core,panic_abort,panic_unwind,proc_macro,rustc-std-workspace-core,std,std_detect,sysroot,test,unwind] "); } @@ -1633,7 +1727,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 + [build] rustdoc 1 [doc] std 1 crates=[core] "); } @@ -1648,7 +1742,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 + [build] rustdoc 1 [doc] std 1 crates=[core] "); } @@ -1678,7 +1772,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 + [build] rustdoc 1 [doc] std 1 crates=[alloc,core] "); } @@ -1694,10 +1788,105 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 + [build] rustdoc 1 [doc] std 1 crates=[alloc,core] "); } + + #[test] + fn doc_compiler_stage_0() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .path("compiler") + .stage(0) + .render_steps(), @r" + [build] rustdoc 0 + [build] llvm + [doc] rustc 0 + "); + } + + #[test] + fn doc_compiler_stage_1() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .path("compiler") + .stage(1) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustdoc 1 + [doc] rustc 1 + "); + } + + #[test] + fn doc_compiler_stage_2() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .path("compiler") + .stage(2) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustc 1 -> rustc 2 + [build] rustc 2 -> std 2 + [build] rustdoc 2 + [doc] rustc 2 + "); + } + + #[test] + fn doc_compiletest_stage_0() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .path("src/tools/compiletest") + .stage(0) + .render_steps(), @r" + [build] rustdoc 0 + [doc] Compiletest + "); + } + + #[test] + fn doc_compiletest_stage_1() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .path("src/tools/compiletest") + .stage(1) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustdoc 1 + [doc] Compiletest + "); + } + + #[test] + fn doc_compiletest_stage_2() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("doc") + .path("src/tools/compiletest") + .stage(2) + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 1 -> std 1 + [build] rustc 1 -> rustc 2 + [build] rustc 2 -> std 2 + [build] rustdoc 2 + [doc] Compiletest + "); + } } struct ExecutedSteps { diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 6e04f1154243..eb1ac8c637ff 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -32,24 +32,31 @@ use tracing::{instrument, span}; use crate::core::build_steps::llvm; use crate::core::build_steps::llvm::LLVM_INVALIDATION_PATHS; pub use crate::core::config::flags::Subcommand; -use crate::core::config::flags::{Color, Flags}; +use crate::core::config::flags::{Color, Flags, Warnings}; use crate::core::config::target_selection::TargetSelectionList; use crate::core::config::toml::TomlConfig; use crate::core::config::toml::build::{Build, Tool}; use crate::core::config::toml::change_id::ChangeId; +use crate::core::config::toml::dist::Dist; +use crate::core::config::toml::gcc::Gcc; +use crate::core::config::toml::install::Install; +use crate::core::config::toml::llvm::Llvm; use crate::core::config::toml::rust::{ - LldMode, RustOptimize, check_incompatible_options_for_ci_rustc, + LldMode, Rust, RustOptimize, check_incompatible_options_for_ci_rustc, + default_lld_opt_in_targets, parse_codegen_backends, }; use crate::core::config::toml::target::Target; use crate::core::config::{ DebuginfoLevel, DryRun, GccCiMode, LlvmLibunwind, Merge, ReplaceOpt, RustcLto, SplitDebuginfo, StringOrBool, set, threads_from_config, }; -use crate::core::download::is_download_ci_available; +use crate::core::download::{ + DownloadContext, download_beta_toolchain, is_download_ci_available, maybe_download_rustfmt, +}; use crate::utils::channel; use crate::utils::exec::{ExecutionContext, command}; use crate::utils::helpers::{exe, get_host_target}; -use crate::{GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t}; +use crate::{CodegenBackendKind, GitInfo, OnceLock, TargetSelection, check_ci_llvm, helpers, t}; /// Each path in this list is considered "allowed" in the `download-rustc="if-unchanged"` logic. /// This means they can be modified and changes to these paths should never trigger a compiler build @@ -87,7 +94,6 @@ pub struct Config { pub ccache: Option, /// Call Build::ninja() instead of this. pub ninja_in_file: bool, - pub verbose: usize, pub submodules: Option, pub compiler_docs: bool, pub library_docs_private_items: bool, @@ -206,7 +212,7 @@ pub struct Config { pub rustc_default_linker: Option, pub rust_optimize_tests: bool, pub rust_dist_src: bool, - pub rust_codegen_backends: Vec, + pub rust_codegen_backends: Vec, pub rust_verify_llvm_ir: bool, pub rust_thin_lto_import_instr_limit: Option, pub rust_randomize_layout: bool, @@ -296,8 +302,16 @@ pub struct Config { /// Command for visual diff display, e.g. `diff-tool --color=always`. pub compiletest_diff_tool: Option, + /// Whether to allow running both `compiletest` self-tests and `compiletest`-managed test suites + /// against the stage 0 (rustc, std). + /// + /// This is only intended to be used when the stage 0 compiler is actually built from in-tree + /// sources. + pub compiletest_allow_stage0: bool, + /// Whether to use the precompiled stage0 libtest with compiletest. pub compiletest_use_stage0_libtest: bool, + /// Default value for `--extra-checks` pub tidy_extra_checks: Option, pub is_running_on_ci: bool, @@ -340,7 +354,7 @@ impl Config { channel: "dev".to_string(), codegen_tests: true, rust_dist_src: true, - rust_codegen_backends: vec!["llvm".to_owned()], + rust_codegen_backends: vec![CodegenBackendKind::Llvm], deny_warnings: true, bindir: "bin".into(), dist_include_mingw_linker: true, @@ -432,23 +446,13 @@ impl Config { enable_bolt_settings: flags_enable_bolt_settings, skip_stage0_validation: flags_skip_stage0_validation, reproducible_artifact: flags_reproducible_artifact, - paths: mut flags_paths, + paths: flags_paths, set: flags_set, - free_args: mut flags_free_args, + free_args: flags_free_args, ci: flags_ci, skip_std_check_if_no_download_rustc: flags_skip_std_check_if_no_download_rustc, } = flags; - let mut config = Config::default_opts(); - let mut exec_ctx = ExecutionContext::new(); - exec_ctx.set_verbose(flags_verbose); - exec_ctx.set_fail_fast(flags_cmd.fail_fast()); - - config.exec_ctx = exec_ctx; - - // Set flags. - config.paths = std::mem::take(&mut flags_paths); - #[cfg(feature = "tracing")] span!( target: "CONFIG_HANDLING", @@ -459,14 +463,251 @@ impl Config { "flags.exclude" = ?flags_exclude ); - #[cfg(feature = "tracing")] - span!( - target: "CONFIG_HANDLING", - tracing::Level::TRACE, - "normalizing and combining `flag.skip`/`flag.exclude` paths", - "config.skip" = ?config.skip, + // First initialize the bare minimum that we need for further operation - source directory + // and execution context. + let mut config = Config::default_opts(); + let exec_ctx = ExecutionContext::new(flags_verbose, flags_cmd.fail_fast()); + + config.exec_ctx = exec_ctx; + + if let Some(src) = compute_src_directory(flags_src, &config.exec_ctx) { + config.src = src; + } + + // Now load the TOML config, as soon as possible + let (mut toml, toml_path) = load_toml_config(&config.src, flags_config, &get_toml); + config.config = toml_path.clone(); + + postprocess_toml( + &mut toml, + &config.src, + toml_path, + config.exec_ctx(), + &flags_set, + &get_toml, ); + // Now override TOML values with flags, to make sure that we won't later override flags with + // TOML values by accident instead, because flags have higher priority. + let Build { + description: build_description, + build: mut build_build, + host: build_host, + target: build_target, + build_dir: build_build_dir, + cargo: mut build_cargo, + rustc: mut build_rustc, + rustfmt: build_rustfmt, + cargo_clippy: build_cargo_clippy, + docs: build_docs, + compiler_docs: build_compiler_docs, + library_docs_private_items: build_library_docs_private_items, + docs_minification: build_docs_minification, + submodules: build_submodules, + gdb: build_gdb, + lldb: build_lldb, + nodejs: build_nodejs, + npm: build_npm, + python: build_python, + reuse: build_reuse, + locked_deps: build_locked_deps, + vendor: build_vendor, + full_bootstrap: build_full_bootstrap, + bootstrap_cache_path: build_bootstrap_cache_path, + extended: build_extended, + tools: build_tools, + tool: build_tool, + verbose: build_verbose, + sanitizers: build_sanitizers, + profiler: build_profiler, + cargo_native_static: build_cargo_native_static, + low_priority: build_low_priority, + configure_args: build_configure_args, + local_rebuild: build_local_rebuild, + print_step_timings: build_print_step_timings, + print_step_rusage: build_print_step_rusage, + check_stage: build_check_stage, + doc_stage: build_doc_stage, + build_stage: build_build_stage, + test_stage: build_test_stage, + install_stage: build_install_stage, + dist_stage: build_dist_stage, + bench_stage: build_bench_stage, + patch_binaries_for_nix: build_patch_binaries_for_nix, + // This field is only used by bootstrap.py + metrics: _, + android_ndk: build_android_ndk, + optimized_compiler_builtins: build_optimized_compiler_builtins, + jobs: mut build_jobs, + compiletest_diff_tool: build_compiletest_diff_tool, + compiletest_use_stage0_libtest: build_compiletest_use_stage0_libtest, + tidy_extra_checks: build_tidy_extra_checks, + ccache: build_ccache, + exclude: build_exclude, + compiletest_allow_stage0: build_compiletest_allow_stage0, + } = toml.build.unwrap_or_default(); + + let Install { + prefix: install_prefix, + sysconfdir: install_sysconfdir, + docdir: install_docdir, + bindir: install_bindir, + libdir: install_libdir, + mandir: install_mandir, + datadir: install_datadir, + } = toml.install.unwrap_or_default(); + + let Rust { + optimize: rust_optimize, + debug: rust_debug, + codegen_units: rust_codegen_units, + codegen_units_std: rust_codegen_units_std, + rustc_debug_assertions: rust_rustc_debug_assertions, + std_debug_assertions: rust_std_debug_assertions, + tools_debug_assertions: rust_tools_debug_assertions, + overflow_checks: rust_overflow_checks, + overflow_checks_std: rust_overflow_checks_std, + debug_logging: rust_debug_logging, + debuginfo_level: rust_debuginfo_level, + debuginfo_level_rustc: rust_debuginfo_level_rustc, + debuginfo_level_std: rust_debuginfo_level_std, + debuginfo_level_tools: rust_debuginfo_level_tools, + debuginfo_level_tests: rust_debuginfo_level_tests, + backtrace: rust_backtrace, + incremental: rust_incremental, + randomize_layout: rust_randomize_layout, + default_linker: rust_default_linker, + channel: rust_channel, + musl_root: rust_musl_root, + rpath: rust_rpath, + verbose_tests: rust_verbose_tests, + optimize_tests: rust_optimize_tests, + codegen_tests: rust_codegen_tests, + omit_git_hash: rust_omit_git_hash, + dist_src: rust_dist_src, + save_toolstates: rust_save_toolstates, + codegen_backends: rust_codegen_backends, + lld: rust_lld_enabled, + llvm_tools: rust_llvm_tools, + llvm_bitcode_linker: rust_llvm_bitcode_linker, + deny_warnings: rust_deny_warnings, + backtrace_on_ice: rust_backtrace_on_ice, + verify_llvm_ir: rust_verify_llvm_ir, + thin_lto_import_instr_limit: rust_thin_lto_import_instr_limit, + remap_debuginfo: rust_remap_debuginfo, + jemalloc: rust_jemalloc, + test_compare_mode: rust_test_compare_mode, + llvm_libunwind: rust_llvm_libunwind, + control_flow_guard: rust_control_flow_guard, + ehcont_guard: rust_ehcont_guard, + new_symbol_mangling: rust_new_symbol_mangling, + profile_generate: rust_profile_generate, + profile_use: rust_profile_use, + download_rustc: rust_download_rustc, + lto: rust_lto, + validate_mir_opts: rust_validate_mir_opts, + frame_pointers: rust_frame_pointers, + stack_protector: rust_stack_protector, + strip: rust_strip, + lld_mode: rust_lld_mode, + std_features: rust_std_features, + } = toml.rust.unwrap_or_default(); + + let Llvm { + optimize: llvm_optimize, + thin_lto: llvm_thin_lto, + release_debuginfo: llvm_release_debuginfo, + assertions: llvm_assertions, + tests: llvm_tests, + enzyme: llvm_enzyme, + plugins: llvm_plugin, + static_libstdcpp: llvm_static_libstdcpp, + libzstd: llvm_libzstd, + ninja: llvm_ninja, + targets: llvm_targets, + experimental_targets: llvm_experimental_targets, + link_jobs: llvm_link_jobs, + link_shared: llvm_link_shared, + version_suffix: llvm_version_suffix, + clang_cl: llvm_clang_cl, + cflags: llvm_cflags, + cxxflags: llvm_cxxflags, + ldflags: llvm_ldflags, + use_libcxx: llvm_use_libcxx, + use_linker: llvm_use_linker, + allow_old_toolchain: llvm_allow_old_toolchain, + offload: llvm_offload, + polly: llvm_polly, + clang: llvm_clang, + enable_warnings: llvm_enable_warnings, + download_ci_llvm: llvm_download_ci_llvm, + build_config: llvm_build_config, + } = toml.llvm.unwrap_or_default(); + + let Dist { + sign_folder: dist_sign_folder, + upload_addr: dist_upload_addr, + src_tarball: dist_src_tarball, + compression_formats: dist_compression_formats, + compression_profile: dist_compression_profile, + include_mingw_linker: dist_include_mingw_linker, + vendor: dist_vendor, + } = toml.dist.unwrap_or_default(); + + let Gcc { download_ci_gcc: gcc_download_ci_gcc } = toml.gcc.unwrap_or_default(); + + if cfg!(test) { + // When configuring bootstrap for tests, make sure to set the rustc and Cargo to the + // same ones used to call the tests (if custom ones are not defined in the toml). If we + // don't do that, bootstrap will use its own detection logic to find a suitable rustc + // and Cargo, which doesn't work when the caller is specìfying a custom local rustc or + // Cargo in their bootstrap.toml. + build_rustc = build_rustc.take().or(std::env::var_os("RUSTC").map(|p| p.into())); + build_cargo = build_cargo.take().or(std::env::var_os("CARGO").map(|p| p.into())); + } + + build_jobs = flags_jobs.or(build_jobs); + build_build = flags_build.or(build_build); + + let build_dir = flags_build_dir.or(build_build_dir.map(PathBuf::from)); + let host = if let Some(TargetSelectionList(hosts)) = flags_host { + Some(hosts) + } else { + build_host + .map(|file_host| file_host.iter().map(|h| TargetSelection::from_user(h)).collect()) + }; + let target = if let Some(TargetSelectionList(targets)) = flags_target { + Some(targets) + } else { + build_target.map(|file_target| { + file_target.iter().map(|h| TargetSelection::from_user(h)).collect() + }) + }; + + if let Some(rustc) = &build_rustc + && !flags_skip_stage0_validation + { + check_stage0_version(rustc, "rustc", &config.src, config.exec_ctx()); + } + if let Some(cargo) = &build_cargo + && !flags_skip_stage0_validation + { + check_stage0_version(cargo, "cargo", &config.src, config.exec_ctx()); + } + + // Prefer CLI verbosity flags if set (`flags_verbose` > 0), otherwise take the value from + // TOML. + config + .exec_ctx + .set_verbosity(cmp::max(build_verbose.unwrap_or_default() as u8, flags_verbose)); + + let mut paths: Vec = flags_skip.into_iter().chain(flags_exclude).collect(); + if let Some(exclude) = build_exclude { + paths.extend(exclude); + } + + // Set config values based on flags. + config.paths = flags_paths; config.include_default_paths = flags_include_default_paths; config.rustc_error_format = flags_rustc_error_format; config.json_output = flags_json_output; @@ -479,7 +720,7 @@ impl Config { config.keep_stage = flags_keep_stage; config.keep_stage_std = flags_keep_stage_std; config.color = flags_color; - config.free_args = std::mem::take(&mut flags_free_args); + config.free_args = flags_free_args; config.llvm_profile_use = flags_llvm_profile_use; config.llvm_profile_generate = flags_llvm_profile_generate; config.enable_bolt_settings = flags_enable_bolt_settings; @@ -489,53 +730,6 @@ impl Config { // Infer the rest of the configuration. - if let Some(src) = flags_src { - config.src = src - } else { - // Infer the source directory. This is non-trivial because we want to support a downloaded bootstrap binary, - // running on a completely different machine from where it was compiled. - let mut cmd = helpers::git(None); - // NOTE: we cannot support running from outside the repository because the only other path we have available - // is set at compile time, which can be wrong if bootstrap was downloaded rather than compiled locally. - // We still support running outside the repository if we find we aren't in a git directory. - - // NOTE: We get a relative path from git to work around an issue on MSYS/mingw. If we used an absolute path, - // and end up using MSYS's git rather than git-for-windows, we would get a unix-y MSYS path. But as bootstrap - // has already been (kinda-cross-)compiled to Windows land, we require a normal Windows path. - cmd.arg("rev-parse").arg("--show-cdup"); - // Discard stderr because we expect this to fail when building from a tarball. - let output = cmd.allow_failure().run_capture_stdout(&config); - if output.is_success() { - let git_root_relative = output.stdout(); - // We need to canonicalize this path to make sure it uses backslashes instead of forward slashes, - // and to resolve any relative components. - let git_root = env::current_dir() - .unwrap() - .join(PathBuf::from(git_root_relative.trim())) - .canonicalize() - .unwrap(); - let s = git_root.to_str().unwrap(); - - // Bootstrap is quite bad at handling /? in front of paths - let git_root = match s.strip_prefix("\\\\?\\") { - Some(p) => PathBuf::from(p), - None => git_root, - }; - // If this doesn't have at least `stage0`, we guessed wrong. This can happen when, - // for example, the build directory is inside of another unrelated git directory. - // In that case keep the original `CARGO_MANIFEST_DIR` handling. - // - // NOTE: this implies that downloadable bootstrap isn't supported when the build directory is outside - // the source directory. We could fix that by setting a variable from all three of python, ./x, and x.ps1. - if git_root.join("src").join("stage0").exists() { - config.src = git_root; - } - } else { - // We're building from a tarball, not git sources. - // We don't support pre-downloaded bootstrap in this case. - } - } - if cfg!(test) { // Use the build directory of the original x.py invocation, so that we can set `initial_rustc` properly. config.out = Path::new( @@ -546,219 +740,11 @@ impl Config { .to_path_buf(); } + config.compiletest_allow_stage0 = build_compiletest_allow_stage0.unwrap_or(false); config.stage0_metadata = build_helper::stage0_parser::parse_stage0_file(); - // Locate the configuration file using the following priority (first match wins): - // 1. `--config ` (explicit flag) - // 2. `RUST_BOOTSTRAP_CONFIG` environment variable - // 3. `./bootstrap.toml` (local file) - // 4. `/bootstrap.toml` - // 5. `./config.toml` (fallback for backward compatibility) - // 6. `/config.toml` - let toml_path = flags_config - .clone() - .or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from)); - let using_default_path = toml_path.is_none(); - let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml")); - - if using_default_path && !toml_path.exists() { - toml_path = config.src.join(PathBuf::from("bootstrap.toml")); - if !toml_path.exists() { - toml_path = PathBuf::from("config.toml"); - if !toml_path.exists() { - toml_path = config.src.join(PathBuf::from("config.toml")); - } - } - } - - // Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path, - // but not if `bootstrap.toml` hasn't been created. - let mut toml = if !using_default_path || toml_path.exists() { - config.config = Some(if cfg!(not(test)) { - toml_path = toml_path.canonicalize().unwrap(); - toml_path.clone() - } else { - toml_path.clone() - }); - get_toml(&toml_path).unwrap_or_else(|e| { - eprintln!("ERROR: Failed to parse '{}': {e}", toml_path.display()); - exit!(2); - }) - } else { - config.config = None; - TomlConfig::default() - }; - - if cfg!(test) { - // When configuring bootstrap for tests, make sure to set the rustc and Cargo to the - // same ones used to call the tests (if custom ones are not defined in the toml). If we - // don't do that, bootstrap will use its own detection logic to find a suitable rustc - // and Cargo, which doesn't work when the caller is specìfying a custom local rustc or - // Cargo in their bootstrap.toml. - let build = toml.build.get_or_insert_with(Default::default); - build.rustc = build.rustc.take().or(std::env::var_os("RUSTC").map(|p| p.into())); - build.cargo = build.cargo.take().or(std::env::var_os("CARGO").map(|p| p.into())); - } - - if config.git_info(false, &config.src).is_from_tarball() && toml.profile.is_none() { - toml.profile = Some("dist".into()); - } - - // Reverse the list to ensure the last added config extension remains the most dominant. - // For example, given ["a.toml", "b.toml"], "b.toml" should take precedence over "a.toml". - // - // This must be handled before applying the `profile` since `include`s should always take - // precedence over `profile`s. - for include_path in toml.include.clone().unwrap_or_default().iter().rev() { - let include_path = toml_path.parent().unwrap().join(include_path); - - let included_toml = get_toml(&include_path).unwrap_or_else(|e| { - eprintln!("ERROR: Failed to parse '{}': {e}", include_path.display()); - exit!(2); - }); - toml.merge( - Some(include_path), - &mut Default::default(), - included_toml, - ReplaceOpt::IgnoreDuplicate, - ); - } - - if let Some(include) = &toml.profile { - // Allows creating alias for profile names, allowing - // profiles to be renamed while maintaining back compatibility - // Keep in sync with `profile_aliases` in bootstrap.py - let profile_aliases = HashMap::from([("user", "dist")]); - let include = match profile_aliases.get(include.as_str()) { - Some(alias) => alias, - None => include.as_str(), - }; - let mut include_path = config.src.clone(); - include_path.push("src"); - include_path.push("bootstrap"); - include_path.push("defaults"); - include_path.push(format!("bootstrap.{include}.toml")); - let included_toml = get_toml(&include_path).unwrap_or_else(|e| { - eprintln!( - "ERROR: Failed to parse default config profile at '{}': {e}", - include_path.display() - ); - exit!(2); - }); - toml.merge( - Some(include_path), - &mut Default::default(), - included_toml, - ReplaceOpt::IgnoreDuplicate, - ); - } - - let mut override_toml = TomlConfig::default(); - for option in flags_set.iter() { - fn get_table(option: &str) -> Result { - toml::from_str(option).and_then(|table: toml::Value| TomlConfig::deserialize(table)) - } - - let mut err = match get_table(option) { - Ok(v) => { - override_toml.merge( - None, - &mut Default::default(), - v, - ReplaceOpt::ErrorOnDuplicate, - ); - continue; - } - Err(e) => e, - }; - // We want to be able to set string values without quotes, - // like in `configure.py`. Try adding quotes around the right hand side - if let Some((key, value)) = option.split_once('=') - && !value.contains('"') - { - match get_table(&format!(r#"{key}="{value}""#)) { - Ok(v) => { - override_toml.merge( - None, - &mut Default::default(), - v, - ReplaceOpt::ErrorOnDuplicate, - ); - continue; - } - Err(e) => err = e, - } - } - eprintln!("failed to parse override `{option}`: `{err}"); - exit!(2) - } - toml.merge(None, &mut Default::default(), override_toml, ReplaceOpt::Override); - config.change_id = toml.change_id.inner; - let Build { - description, - build, - host, - target, - build_dir, - cargo, - rustc, - rustfmt, - cargo_clippy, - docs, - compiler_docs, - library_docs_private_items, - docs_minification, - submodules, - gdb, - lldb, - nodejs, - npm, - python, - reuse, - locked_deps, - vendor, - full_bootstrap, - bootstrap_cache_path, - extended, - tools, - tool, - verbose, - sanitizers, - profiler, - cargo_native_static, - low_priority, - configure_args, - local_rebuild, - print_step_timings, - print_step_rusage, - check_stage, - doc_stage, - build_stage, - test_stage, - install_stage, - dist_stage, - bench_stage, - patch_binaries_for_nix, - // This field is only used by bootstrap.py - metrics: _, - android_ndk, - optimized_compiler_builtins, - jobs, - compiletest_diff_tool, - compiletest_use_stage0_libtest, - tidy_extra_checks, - ccache, - exclude, - } = toml.build.unwrap_or_default(); - - let mut paths: Vec = flags_skip.into_iter().chain(flags_exclude).collect(); - - if let Some(exclude) = exclude { - paths.extend(exclude); - } - config.skip = paths .into_iter() .map(|p| { @@ -773,15 +759,20 @@ impl Config { }) .collect(); - config.jobs = Some(threads_from_config(flags_jobs.unwrap_or(jobs.unwrap_or(0)))); + #[cfg(feature = "tracing")] + span!( + target: "CONFIG_HANDLING", + tracing::Level::TRACE, + "normalizing and combining `flag.skip`/`flag.exclude` paths", + "config.skip" = ?config.skip, + ); - if let Some(flags_build) = flags_build { - config.host_target = TargetSelection::from_user(&flags_build); - } else if let Some(file_build) = build { - config.host_target = TargetSelection::from_user(&file_build); - }; + config.jobs = Some(threads_from_config(build_jobs.unwrap_or(0))); + if let Some(build) = build_build { + config.host_target = TargetSelection::from_user(&build); + } - set(&mut config.out, flags_build_dir.or_else(|| build_dir.map(PathBuf::from))); + set(&mut config.out, build_dir); // NOTE: Bootstrap spawns various commands with different working directories. // To avoid writing to random places on the file system, `config.out` needs to be an absolute path. if !config.out.is_absolute() { @@ -789,19 +780,17 @@ impl Config { config.out = absolute(&config.out).expect("can't make empty path absolute"); } - if cargo_clippy.is_some() && rustc.is_none() { + if build_cargo_clippy.is_some() && build_rustc.is_none() { println!( "WARNING: Using `build.cargo-clippy` without `build.rustc` usually fails due to toolchain conflict." ); } - config.initial_rustc = if let Some(rustc) = rustc { - if !flags_skip_stage0_validation { - config.check_stage0_version(&rustc, "rustc"); - } + config.initial_rustc = if let Some(rustc) = build_rustc { rustc } else { - config.download_beta_toolchain(); + let dwn_ctx = DownloadContext::from(&config); + download_beta_toolchain(dwn_ctx); config .out .join(config.host_target) @@ -819,15 +808,13 @@ impl Config { .trim() )); - config.initial_cargo_clippy = cargo_clippy; + config.initial_cargo_clippy = build_cargo_clippy; - config.initial_cargo = if let Some(cargo) = cargo { - if !flags_skip_stage0_validation { - config.check_stage0_version(&cargo, "cargo"); - } + config.initial_cargo = if let Some(cargo) = build_cargo { cargo } else { - config.download_beta_toolchain(); + let dwn_ctx = DownloadContext::from(&config); + download_beta_toolchain(dwn_ctx); config.initial_sysroot.join("bin").join(exe("cargo", config.host_target)) }; @@ -838,67 +825,60 @@ impl Config { config.out = dir; } - config.hosts = if let Some(TargetSelectionList(arg_host)) = flags_host { - arg_host - } else if let Some(file_host) = host { - file_host.iter().map(|h| TargetSelection::from_user(h)).collect() - } else { - vec![config.host_target] - }; - config.targets = if let Some(TargetSelectionList(arg_target)) = flags_target { - arg_target - } else if let Some(file_target) = target { - file_target.iter().map(|h| TargetSelection::from_user(h)).collect() + config.hosts = if let Some(hosts) = host { hosts } else { vec![config.host_target] }; + config.targets = if let Some(targets) = target { + targets } else { // If target is *not* configured, then default to the host // toolchains. config.hosts.clone() }; - config.nodejs = nodejs.map(PathBuf::from); - config.npm = npm.map(PathBuf::from); - config.gdb = gdb.map(PathBuf::from); - config.lldb = lldb.map(PathBuf::from); - config.python = python.map(PathBuf::from); - config.reuse = reuse.map(PathBuf::from); - config.submodules = submodules; - config.android_ndk = android_ndk; - config.bootstrap_cache_path = bootstrap_cache_path; - set(&mut config.low_priority, low_priority); - set(&mut config.compiler_docs, compiler_docs); - set(&mut config.library_docs_private_items, library_docs_private_items); - set(&mut config.docs_minification, docs_minification); - set(&mut config.docs, docs); - set(&mut config.locked_deps, locked_deps); - set(&mut config.full_bootstrap, full_bootstrap); - set(&mut config.extended, extended); - config.tools = tools; - set(&mut config.tool, tool); - set(&mut config.verbose, verbose); - set(&mut config.sanitizers, sanitizers); - set(&mut config.profiler, profiler); - set(&mut config.cargo_native_static, cargo_native_static); - set(&mut config.configure_args, configure_args); - set(&mut config.local_rebuild, local_rebuild); - set(&mut config.print_step_timings, print_step_timings); - set(&mut config.print_step_rusage, print_step_rusage); - config.patch_binaries_for_nix = patch_binaries_for_nix; - - config.verbose = cmp::max(config.verbose, flags_verbose as usize); + config.nodejs = build_nodejs.map(PathBuf::from); + config.npm = build_npm.map(PathBuf::from); + config.gdb = build_gdb.map(PathBuf::from); + config.lldb = build_lldb.map(PathBuf::from); + config.python = build_python.map(PathBuf::from); + config.reuse = build_reuse.map(PathBuf::from); + config.submodules = build_submodules; + config.android_ndk = build_android_ndk; + config.bootstrap_cache_path = build_bootstrap_cache_path; + set(&mut config.low_priority, build_low_priority); + set(&mut config.compiler_docs, build_compiler_docs); + set(&mut config.library_docs_private_items, build_library_docs_private_items); + set(&mut config.docs_minification, build_docs_minification); + set(&mut config.docs, build_docs); + set(&mut config.locked_deps, build_locked_deps); + set(&mut config.full_bootstrap, build_full_bootstrap); + set(&mut config.extended, build_extended); + config.tools = build_tools; + set(&mut config.tool, build_tool); + set(&mut config.sanitizers, build_sanitizers); + set(&mut config.profiler, build_profiler); + set(&mut config.cargo_native_static, build_cargo_native_static); + set(&mut config.configure_args, build_configure_args); + set(&mut config.local_rebuild, build_local_rebuild); + set(&mut config.print_step_timings, build_print_step_timings); + set(&mut config.print_step_rusage, build_print_step_rusage); + config.patch_binaries_for_nix = build_patch_binaries_for_nix; // Verbose flag is a good default for `rust.verbose-tests`. config.verbose_tests = config.is_verbose(); - config.apply_install_config(toml.install); + config.prefix = install_prefix.map(PathBuf::from); + config.sysconfdir = install_sysconfdir.map(PathBuf::from); + config.datadir = install_datadir.map(PathBuf::from); + config.docdir = install_docdir.map(PathBuf::from); + set(&mut config.bindir, install_bindir.map(PathBuf::from)); + config.libdir = install_libdir.map(PathBuf::from); + config.mandir = install_mandir.map(PathBuf::from); - config.llvm_assertions = - toml.llvm.as_ref().is_some_and(|llvm| llvm.assertions.unwrap_or(false)); + config.llvm_assertions = llvm_assertions.unwrap_or(false); let file_content = t!(fs::read_to_string(config.src.join("src/ci/channel"))); let ci_channel = file_content.trim_end(); - let toml_channel = toml.rust.as_ref().and_then(|r| r.channel.clone()); - let is_user_configured_rust_channel = match toml_channel { + let is_user_configured_rust_channel = match rust_channel { Some(channel) if channel == "auto-detect" => { config.channel = ci_channel.into(); true @@ -911,7 +891,7 @@ impl Config { }; let default = config.channel == "dev"; - config.omit_git_hash = toml.rust.as_ref().and_then(|r| r.omit_git_hash).unwrap_or(default); + config.omit_git_hash = rust_omit_git_hash.unwrap_or(default); config.rust_info = config.git_info(config.omit_git_hash, &config.src); config.cargo_info = @@ -929,7 +909,7 @@ impl Config { config.in_tree_llvm_info = config.git_info(false, &config.src.join("src/llvm-project")); config.in_tree_gcc_info = config.git_info(false, &config.src.join("src/gcc")); - config.vendor = vendor.unwrap_or( + config.vendor = build_vendor.unwrap_or( config.rust_info.is_from_tarball() && config.src.join("vendor").exists() && config.src.join(".cargo/config.toml").exists(), @@ -942,11 +922,230 @@ impl Config { config.rust_profile_use = flags_rust_profile_use; config.rust_profile_generate = flags_rust_profile_generate; - config.apply_target_config(toml.target); - config.apply_rust_config(toml.rust, flags_warnings); + // FIXME(#133381): alt rustc builds currently do *not* have rustc debug assertions + // enabled. We should not download a CI alt rustc if we need rustc to have debug + // assertions (e.g. for crashes test suite). This can be changed once something like + // [Enable debug assertions on alt + // builds](https://github.com/rust-lang/rust/pull/131077) lands. + // + // Note that `rust.debug = true` currently implies `rust.debug-assertions = true`! + // + // This relies also on the fact that the global default for `download-rustc` will be + // `false` if it's not explicitly set. + let debug_assertions_requested = matches!(rust_rustc_debug_assertions, Some(true)) + || (matches!(rust_debug, Some(true)) + && !matches!(rust_rustc_debug_assertions, Some(false))); + + if debug_assertions_requested + && let Some(ref opt) = rust_download_rustc + && opt.is_string_or_true() + { + eprintln!( + "WARN: currently no CI rustc builds have rustc debug assertions \ + enabled. Please either set `rust.debug-assertions` to `false` if you \ + want to use download CI rustc or set `rust.download-rustc` to `false`." + ); + } + + config.download_rustc_commit = config.download_ci_rustc_commit( + rust_download_rustc, + debug_assertions_requested, + config.llvm_assertions, + ); + + if let Some(t) = toml.target { + for (triple, cfg) in t { + let mut target = Target::from_triple(&triple); + + if let Some(ref s) = cfg.llvm_config { + if config.download_rustc_commit.is_some() + && triple == *config.host_target.triple + { + panic!( + "setting llvm_config for the host is incompatible with download-rustc" + ); + } + target.llvm_config = Some(config.src.join(s)); + } + if let Some(patches) = cfg.llvm_has_rust_patches { + assert!( + config.submodules == Some(false) || cfg.llvm_config.is_some(), + "use of `llvm-has-rust-patches` is restricted to cases where either submodules are disabled or llvm-config been provided" + ); + target.llvm_has_rust_patches = Some(patches); + } + if let Some(ref s) = cfg.llvm_filecheck { + target.llvm_filecheck = Some(config.src.join(s)); + } + target.llvm_libunwind = cfg.llvm_libunwind.as_ref().map(|v| { + v.parse().unwrap_or_else(|_| { + panic!("failed to parse target.{triple}.llvm-libunwind") + }) + }); + if let Some(s) = cfg.no_std { + target.no_std = s; + } + target.cc = cfg.cc.map(PathBuf::from); + target.cxx = cfg.cxx.map(PathBuf::from); + target.ar = cfg.ar.map(PathBuf::from); + target.ranlib = cfg.ranlib.map(PathBuf::from); + target.linker = cfg.linker.map(PathBuf::from); + target.crt_static = cfg.crt_static; + target.musl_root = cfg.musl_root.map(PathBuf::from); + target.musl_libdir = cfg.musl_libdir.map(PathBuf::from); + target.wasi_root = cfg.wasi_root.map(PathBuf::from); + target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from); + target.runner = cfg.runner; + target.sanitizers = cfg.sanitizers; + target.profiler = cfg.profiler; + target.rpath = cfg.rpath; + target.optimized_compiler_builtins = cfg.optimized_compiler_builtins; + target.jemalloc = cfg.jemalloc; + if let Some(backends) = cfg.codegen_backends { + target.codegen_backends = + Some(parse_codegen_backends(backends, &format!("target.{triple}"))) + } + + target.split_debuginfo = cfg.split_debuginfo.as_ref().map(|v| { + v.parse().unwrap_or_else(|_| { + panic!("invalid value for target.{triple}.split-debuginfo") + }) + }); + + config.target_config.insert(TargetSelection::from_user(&triple), target); + } + } + + if rust_optimize.as_ref().is_some_and(|v| matches!(v, RustOptimize::Bool(false))) { + eprintln!( + "WARNING: setting `optimize` to `false` is known to cause errors and \ + should be considered unsupported. Refer to `bootstrap.example.toml` \ + for more details." + ); + } + + config.rust_new_symbol_mangling = rust_new_symbol_mangling; + set(&mut config.rust_optimize_tests, rust_optimize_tests); + set(&mut config.codegen_tests, rust_codegen_tests); + set(&mut config.rust_rpath, rust_rpath); + set(&mut config.rust_strip, rust_strip); + set(&mut config.rust_frame_pointers, rust_frame_pointers); + config.rust_stack_protector = rust_stack_protector; + set(&mut config.jemalloc, rust_jemalloc); + set(&mut config.test_compare_mode, rust_test_compare_mode); + set(&mut config.backtrace, rust_backtrace); + set(&mut config.rust_dist_src, rust_dist_src); + set(&mut config.verbose_tests, rust_verbose_tests); + // in the case "false" is set explicitly, do not overwrite the command line args + if let Some(true) = rust_incremental { + config.incremental = true; + } + set(&mut config.lld_mode, rust_lld_mode); + set(&mut config.llvm_bitcode_linker_enabled, rust_llvm_bitcode_linker); + + config.rust_randomize_layout = rust_randomize_layout.unwrap_or_default(); + config.llvm_tools_enabled = rust_llvm_tools.unwrap_or(true); + + config.llvm_enzyme = config.channel == "dev" || config.channel == "nightly"; + config.rustc_default_linker = rust_default_linker; + config.musl_root = rust_musl_root.map(PathBuf::from); + config.save_toolstates = rust_save_toolstates.map(PathBuf::from); + set( + &mut config.deny_warnings, + match flags_warnings { + Warnings::Deny => Some(true), + Warnings::Warn => Some(false), + Warnings::Default => rust_deny_warnings, + }, + ); + set(&mut config.backtrace_on_ice, rust_backtrace_on_ice); + set(&mut config.rust_verify_llvm_ir, rust_verify_llvm_ir); + config.rust_thin_lto_import_instr_limit = rust_thin_lto_import_instr_limit; + set(&mut config.rust_remap_debuginfo, rust_remap_debuginfo); + set(&mut config.control_flow_guard, rust_control_flow_guard); + set(&mut config.ehcont_guard, rust_ehcont_guard); + config.llvm_libunwind_default = + rust_llvm_libunwind.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind")); + set( + &mut config.rust_codegen_backends, + rust_codegen_backends.map(|backends| parse_codegen_backends(backends, "rust")), + ); + + config.rust_codegen_units = rust_codegen_units.map(threads_from_config); + config.rust_codegen_units_std = rust_codegen_units_std.map(threads_from_config); + + if config.rust_profile_use.is_none() { + config.rust_profile_use = rust_profile_use; + } + + if config.rust_profile_generate.is_none() { + config.rust_profile_generate = rust_profile_generate; + } + + config.rust_lto = + rust_lto.as_deref().map(|value| RustcLto::from_str(value).unwrap()).unwrap_or_default(); + config.rust_validate_mir_opts = rust_validate_mir_opts; + + config.rust_optimize = rust_optimize.unwrap_or(RustOptimize::Bool(true)); + + // We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will + // build our internal lld and use it as the default linker, by setting the `rust.lld` config + // to true by default: + // - on the `x86_64-unknown-linux-gnu` target + // - when building our in-tree llvm (i.e. the target has not set an `llvm-config`), so that + // we're also able to build the corresponding lld + // - or when using an external llvm that's downloaded from CI, which also contains our prebuilt + // lld + // - otherwise, we'd be using an external llvm, and lld would not necessarily available and + // thus, disabled + // - similarly, lld will not be built nor used by default when explicitly asked not to, e.g. + // when the config sets `rust.lld = false` + if default_lld_opt_in_targets().contains(&config.host_target.triple.to_string()) + && config.hosts == [config.host_target] + { + let no_llvm_config = config + .target_config + .get(&config.host_target) + .is_none_or(|target_config| target_config.llvm_config.is_none()); + let enable_lld = config.llvm_from_ci || no_llvm_config; + // Prefer the config setting in case an explicit opt-out is needed. + config.lld_enabled = rust_lld_enabled.unwrap_or(enable_lld); + } else { + set(&mut config.lld_enabled, rust_lld_enabled); + } + + let default_std_features = BTreeSet::from([String::from("panic-unwind")]); + config.rust_std_features = rust_std_features.unwrap_or(default_std_features); + + let default = rust_debug == Some(true); + config.rustc_debug_assertions = rust_rustc_debug_assertions.unwrap_or(default); + config.std_debug_assertions = + rust_std_debug_assertions.unwrap_or(config.rustc_debug_assertions); + config.tools_debug_assertions = + rust_tools_debug_assertions.unwrap_or(config.rustc_debug_assertions); + config.rust_overflow_checks = rust_overflow_checks.unwrap_or(default); + config.rust_overflow_checks_std = + rust_overflow_checks_std.unwrap_or(config.rust_overflow_checks); + + config.rust_debug_logging = rust_debug_logging.unwrap_or(config.rustc_debug_assertions); + + let with_defaults = |debuginfo_level_specific: Option<_>| { + debuginfo_level_specific.or(rust_debuginfo_level).unwrap_or( + if rust_debug == Some(true) { + DebuginfoLevel::Limited + } else { + DebuginfoLevel::None + }, + ) + }; + config.rust_debuginfo_level_rustc = with_defaults(rust_debuginfo_level_rustc); + config.rust_debuginfo_level_std = with_defaults(rust_debuginfo_level_std); + config.rust_debuginfo_level_tools = with_defaults(rust_debuginfo_level_tools); + config.rust_debuginfo_level_tests = + rust_debuginfo_level_tests.unwrap_or(DebuginfoLevel::None); config.reproducible_artifacts = flags_reproducible_artifact; - config.description = description; + config.description = build_description; // We need to override `rust.channel` if it's manually specified when using the CI rustc. // This is because if the compiler uses a different channel than the one specified in bootstrap.toml, @@ -964,11 +1163,90 @@ impl Config { config.channel = channel; } - config.apply_llvm_config(toml.llvm); + set(&mut config.ninja_in_file, llvm_ninja); + set(&mut config.llvm_optimize, llvm_optimize); + set(&mut config.llvm_thin_lto, llvm_thin_lto); + set(&mut config.llvm_release_debuginfo, llvm_release_debuginfo); + set(&mut config.llvm_static_stdcpp, llvm_static_libstdcpp); + set(&mut config.llvm_libzstd, llvm_libzstd); + if let Some(v) = llvm_link_shared { + config.llvm_link_shared.set(Some(v)); + } + config.llvm_targets.clone_from(&llvm_targets); + config.llvm_experimental_targets.clone_from(&llvm_experimental_targets); + config.llvm_link_jobs = llvm_link_jobs; + config.llvm_version_suffix.clone_from(&llvm_version_suffix); + config.llvm_clang_cl.clone_from(&llvm_clang_cl); + config.llvm_tests = llvm_tests.unwrap_or_default(); + config.llvm_enzyme = llvm_enzyme.unwrap_or_default(); + config.llvm_plugins = llvm_plugin.unwrap_or_default(); - config.apply_gcc_config(toml.gcc); + config.llvm_cflags.clone_from(&llvm_cflags); + config.llvm_cxxflags.clone_from(&llvm_cxxflags); + config.llvm_ldflags.clone_from(&llvm_ldflags); + set(&mut config.llvm_use_libcxx, llvm_use_libcxx); + config.llvm_use_linker.clone_from(&llvm_use_linker); + config.llvm_allow_old_toolchain = llvm_allow_old_toolchain.unwrap_or(false); + config.llvm_offload = llvm_offload.unwrap_or(false); + config.llvm_polly = llvm_polly.unwrap_or(false); + config.llvm_clang = llvm_clang.unwrap_or(false); + config.llvm_enable_warnings = llvm_enable_warnings.unwrap_or(false); + config.llvm_build_config = llvm_build_config.clone().unwrap_or(Default::default()); - match ccache { + config.llvm_from_ci = + config.parse_download_ci_llvm(llvm_download_ci_llvm, config.llvm_assertions); + + if config.llvm_from_ci { + let warn = |option: &str| { + println!( + "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build." + ); + println!( + "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false." + ); + }; + + if llvm_static_libstdcpp.is_some() { + warn("static-libstdcpp"); + } + + if llvm_link_shared.is_some() { + warn("link-shared"); + } + + // FIXME(#129153): instead of all the ad-hoc `download-ci-llvm` checks that follow, + // use the `builder-config` present in tarballs since #128822 to compare the local + // config to the ones used to build the LLVM artifacts on CI, and only notify users + // if they've chosen a different value. + + if llvm_libzstd.is_some() { + println!( + "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \ + like almost all `llvm.*` options, will be ignored and set by the LLVM CI \ + artifacts builder config." + ); + println!( + "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false." + ); + } + } + + if !config.llvm_from_ci && config.llvm_thin_lto && llvm_link_shared.is_none() { + // If we're building with ThinLTO on, by default we want to link + // to LLVM shared, to avoid re-doing ThinLTO (which happens in + // the link step) with each stage. + config.llvm_link_shared.set(Some(true)); + } + + config.gcc_ci_mode = match gcc_download_ci_gcc { + Some(value) => match value { + true => GccCiMode::DownloadFromCi, + false => GccCiMode::BuildLocally, + }, + None => GccCiMode::default(), + }; + + match build_ccache { Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()), Some(StringOrBool::Bool(true)) => { config.ccache = Some("ccache".to_string()); @@ -992,10 +1270,23 @@ impl Config { Some(ci_llvm_bin.join(exe("FileCheck", config.host_target))); } - config.apply_dist_config(toml.dist); + config.dist_sign_folder = dist_sign_folder.map(PathBuf::from); + config.dist_upload_addr = dist_upload_addr; + config.dist_compression_formats = dist_compression_formats; + set(&mut config.dist_compression_profile, dist_compression_profile); + set(&mut config.rust_dist_src, dist_src_tarball); + set(&mut config.dist_include_mingw_linker, dist_include_mingw_linker); + config.dist_vendor = dist_vendor.unwrap_or_else(|| { + // If we're building from git or tarball sources, enable it by default. + config.rust_info.is_managed_git_subrepository() || config.rust_info.is_from_tarball() + }); - config.initial_rustfmt = - if let Some(r) = rustfmt { Some(r) } else { config.maybe_download_rustfmt() }; + config.initial_rustfmt = if let Some(r) = build_rustfmt { + Some(r) + } else { + let dwn_ctx = DownloadContext::from(&config); + maybe_download_rustfmt(dwn_ctx) + }; if matches!(config.lld_mode, LldMode::SelfContained) && !config.lld_enabled @@ -1011,37 +1302,40 @@ impl Config { } config.optimized_compiler_builtins = - optimized_compiler_builtins.unwrap_or(config.channel != "dev"); - config.compiletest_diff_tool = compiletest_diff_tool; - config.compiletest_use_stage0_libtest = compiletest_use_stage0_libtest.unwrap_or(true); - config.tidy_extra_checks = tidy_extra_checks; + build_optimized_compiler_builtins.unwrap_or(config.channel != "dev"); + config.compiletest_diff_tool = build_compiletest_diff_tool; + config.compiletest_use_stage0_libtest = + build_compiletest_use_stage0_libtest.unwrap_or(true); + config.tidy_extra_checks = build_tidy_extra_checks; let download_rustc = config.download_rustc_commit.is_some(); config.explicit_stage_from_cli = flags_stage.is_some(); - config.explicit_stage_from_config = test_stage.is_some() - || build_stage.is_some() - || doc_stage.is_some() - || dist_stage.is_some() - || install_stage.is_some() - || check_stage.is_some() - || bench_stage.is_some(); + config.explicit_stage_from_config = build_test_stage.is_some() + || build_build_stage.is_some() + || build_doc_stage.is_some() + || build_dist_stage.is_some() + || build_install_stage.is_some() + || build_check_stage.is_some() + || build_bench_stage.is_some(); config.stage = match config.cmd { - Subcommand::Check { .. } => flags_stage.or(check_stage).unwrap_or(1), - Subcommand::Clippy { .. } | Subcommand::Fix => flags_stage.or(check_stage).unwrap_or(1), + Subcommand::Check { .. } => flags_stage.or(build_check_stage).unwrap_or(1), + Subcommand::Clippy { .. } | Subcommand::Fix => { + flags_stage.or(build_check_stage).unwrap_or(1) + } // `download-rustc` only has a speed-up for stage2 builds. Default to stage2 unless explicitly overridden. Subcommand::Doc { .. } => { - flags_stage.or(doc_stage).unwrap_or(if download_rustc { 2 } else { 1 }) + flags_stage.or(build_doc_stage).unwrap_or(if download_rustc { 2 } else { 1 }) } Subcommand::Build => { - flags_stage.or(build_stage).unwrap_or(if download_rustc { 2 } else { 1 }) + flags_stage.or(build_build_stage).unwrap_or(if download_rustc { 2 } else { 1 }) } Subcommand::Test { .. } | Subcommand::Miri { .. } => { - flags_stage.or(test_stage).unwrap_or(if download_rustc { 2 } else { 1 }) + flags_stage.or(build_test_stage).unwrap_or(if download_rustc { 2 } else { 1 }) } - Subcommand::Bench { .. } => flags_stage.or(bench_stage).unwrap_or(2), - Subcommand::Dist => flags_stage.or(dist_stage).unwrap_or(2), - Subcommand::Install => flags_stage.or(install_stage).unwrap_or(2), + Subcommand::Bench { .. } => flags_stage.or(build_bench_stage).unwrap_or(2), + Subcommand::Dist => flags_stage.or(build_dist_stage).unwrap_or(2), + Subcommand::Install => flags_stage.or(build_install_stage).unwrap_or(2), Subcommand::Perf { .. } => flags_stage.unwrap_or(1), // These are all bootstrap tools, which don't depend on the compiler. // The stage we pass shouldn't matter, but use 0 just in case. @@ -1491,49 +1785,6 @@ impl Config { } } - #[cfg(test)] - pub fn check_stage0_version(&self, _program_path: &Path, _component_name: &'static str) {} - - /// check rustc/cargo version is same or lower with 1 apart from the building one - #[cfg(not(test))] - pub fn check_stage0_version(&self, program_path: &Path, component_name: &'static str) { - use build_helper::util::fail; - - if self.dry_run() { - return; - } - - let stage0_output = - command(program_path).arg("--version").run_capture_stdout(self).stdout(); - let mut stage0_output = stage0_output.lines().next().unwrap().split(' '); - - let stage0_name = stage0_output.next().unwrap(); - if stage0_name != component_name { - fail(&format!( - "Expected to find {component_name} at {} but it claims to be {stage0_name}", - program_path.display() - )); - } - - let stage0_version = - semver::Version::parse(stage0_output.next().unwrap().split('-').next().unwrap().trim()) - .unwrap(); - let source_version = semver::Version::parse( - fs::read_to_string(self.src.join("src/version")).unwrap().trim(), - ) - .unwrap(); - if !(source_version == stage0_version - || (source_version.major == stage0_version.major - && (source_version.minor == stage0_version.minor - || source_version.minor == stage0_version.minor + 1))) - { - let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); - fail(&format!( - "Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}" - )); - } - } - /// Returns the commit to download, or `None` if we shouldn't download CI artifacts. pub fn download_ci_rustc_commit( &self, @@ -1726,19 +1977,24 @@ impl Config { .unwrap_or(self.profiler) } - pub fn codegen_backends(&self, target: TargetSelection) -> &[String] { + /// Returns codegen backends that should be: + /// - Built and added to the sysroot when we build the compiler. + /// - Distributed when `x dist` is executed (if the codegen backend has a dist step). + pub fn enabled_codegen_backends(&self, target: TargetSelection) -> &[CodegenBackendKind] { self.target_config .get(&target) .and_then(|cfg| cfg.codegen_backends.as_deref()) .unwrap_or(&self.rust_codegen_backends) } - pub fn jemalloc(&self, target: TargetSelection) -> bool { - self.target_config.get(&target).and_then(|cfg| cfg.jemalloc).unwrap_or(self.jemalloc) + /// Returns the codegen backend that should be configured as the *default* codegen backend + /// for a rustc compiled by bootstrap. + pub fn default_codegen_backend(&self, target: TargetSelection) -> Option { + self.enabled_codegen_backends(target).first().cloned() } - pub fn default_codegen_backend(&self, target: TargetSelection) -> Option { - self.codegen_backends(target).first().cloned() + pub fn jemalloc(&self, target: TargetSelection) -> bool { + self.target_config.get(&target).and_then(|cfg| cfg.jemalloc).unwrap_or(self.jemalloc) } pub fn rpath_enabled(&self, target: TargetSelection) -> bool { @@ -1753,7 +2009,7 @@ impl Config { } pub fn llvm_enabled(&self, target: TargetSelection) -> bool { - self.codegen_backends(target).contains(&"llvm".to_owned()) + self.enabled_codegen_backends(target).contains(&CodegenBackendKind::Llvm) } pub fn llvm_libunwind(&self, target: TargetSelection) -> LlvmLibunwind { @@ -1825,3 +2081,262 @@ impl AsRef for Config { &self.exec_ctx } } + +fn compute_src_directory(src_dir: Option, exec_ctx: &ExecutionContext) -> Option { + if let Some(src) = src_dir { + return Some(src); + } else { + // Infer the source directory. This is non-trivial because we want to support a downloaded bootstrap binary, + // running on a completely different machine from where it was compiled. + let mut cmd = helpers::git(None); + // NOTE: we cannot support running from outside the repository because the only other path we have available + // is set at compile time, which can be wrong if bootstrap was downloaded rather than compiled locally. + // We still support running outside the repository if we find we aren't in a git directory. + + // NOTE: We get a relative path from git to work around an issue on MSYS/mingw. If we used an absolute path, + // and end up using MSYS's git rather than git-for-windows, we would get a unix-y MSYS path. But as bootstrap + // has already been (kinda-cross-)compiled to Windows land, we require a normal Windows path. + cmd.arg("rev-parse").arg("--show-cdup"); + // Discard stderr because we expect this to fail when building from a tarball. + let output = cmd.allow_failure().run_capture_stdout(exec_ctx); + if output.is_success() { + let git_root_relative = output.stdout(); + // We need to canonicalize this path to make sure it uses backslashes instead of forward slashes, + // and to resolve any relative components. + let git_root = env::current_dir() + .unwrap() + .join(PathBuf::from(git_root_relative.trim())) + .canonicalize() + .unwrap(); + let s = git_root.to_str().unwrap(); + + // Bootstrap is quite bad at handling /? in front of paths + let git_root = match s.strip_prefix("\\\\?\\") { + Some(p) => PathBuf::from(p), + None => git_root, + }; + // If this doesn't have at least `stage0`, we guessed wrong. This can happen when, + // for example, the build directory is inside of another unrelated git directory. + // In that case keep the original `CARGO_MANIFEST_DIR` handling. + // + // NOTE: this implies that downloadable bootstrap isn't supported when the build directory is outside + // the source directory. We could fix that by setting a variable from all three of python, ./x, and x.ps1. + if git_root.join("src").join("stage0").exists() { + return Some(git_root); + } + } else { + // We're building from a tarball, not git sources. + // We don't support pre-downloaded bootstrap in this case. + } + }; + None +} + +/// Loads bootstrap TOML config and returns the config together with a path from where +/// it was loaded. +/// `src` is the source root directory, and `config_path` is an optionally provided path to the +/// config. +fn load_toml_config( + src: &Path, + config_path: Option, + get_toml: &impl Fn(&Path) -> Result, +) -> (TomlConfig, Option) { + // Locate the configuration file using the following priority (first match wins): + // 1. `--config ` (explicit flag) + // 2. `RUST_BOOTSTRAP_CONFIG` environment variable + // 3. `./bootstrap.toml` (local file) + // 4. `/bootstrap.toml` + // 5. `./config.toml` (fallback for backward compatibility) + // 6. `/config.toml` + let toml_path = config_path.or_else(|| env::var_os("RUST_BOOTSTRAP_CONFIG").map(PathBuf::from)); + let using_default_path = toml_path.is_none(); + let mut toml_path = toml_path.unwrap_or_else(|| PathBuf::from("bootstrap.toml")); + + if using_default_path && !toml_path.exists() { + toml_path = src.join(PathBuf::from("bootstrap.toml")); + if !toml_path.exists() { + toml_path = PathBuf::from("config.toml"); + if !toml_path.exists() { + toml_path = src.join(PathBuf::from("config.toml")); + } + } + } + + // Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path, + // but not if `bootstrap.toml` hasn't been created. + if !using_default_path || toml_path.exists() { + let path = Some(if cfg!(not(test)) { + toml_path = toml_path.canonicalize().unwrap(); + toml_path.clone() + } else { + toml_path.clone() + }); + ( + get_toml(&toml_path).unwrap_or_else(|e| { + eprintln!("ERROR: Failed to parse '{}': {e}", toml_path.display()); + exit!(2); + }), + path, + ) + } else { + (TomlConfig::default(), None) + } +} + +fn postprocess_toml( + toml: &mut TomlConfig, + src_dir: &Path, + toml_path: Option, + exec_ctx: &ExecutionContext, + override_set: &[String], + get_toml: &impl Fn(&Path) -> Result, +) { + let git_info = GitInfo::new(false, src_dir, exec_ctx); + + if git_info.is_from_tarball() && toml.profile.is_none() { + toml.profile = Some("dist".into()); + } + + // Reverse the list to ensure the last added config extension remains the most dominant. + // For example, given ["a.toml", "b.toml"], "b.toml" should take precedence over "a.toml". + // + // This must be handled before applying the `profile` since `include`s should always take + // precedence over `profile`s. + for include_path in toml.include.clone().unwrap_or_default().iter().rev() { + let include_path = toml_path + .as_ref() + .expect("include found in default TOML config") + .parent() + .unwrap() + .join(include_path); + + let included_toml = get_toml(&include_path).unwrap_or_else(|e| { + eprintln!("ERROR: Failed to parse '{}': {e}", include_path.display()); + exit!(2); + }); + toml.merge( + Some(include_path), + &mut Default::default(), + included_toml, + ReplaceOpt::IgnoreDuplicate, + ); + } + + if let Some(include) = &toml.profile { + // Allows creating alias for profile names, allowing + // profiles to be renamed while maintaining back compatibility + // Keep in sync with `profile_aliases` in bootstrap.py + let profile_aliases = HashMap::from([("user", "dist")]); + let include = match profile_aliases.get(include.as_str()) { + Some(alias) => alias, + None => include.as_str(), + }; + let mut include_path = PathBuf::from(src_dir); + include_path.push("src"); + include_path.push("bootstrap"); + include_path.push("defaults"); + include_path.push(format!("bootstrap.{include}.toml")); + let included_toml = get_toml(&include_path).unwrap_or_else(|e| { + eprintln!( + "ERROR: Failed to parse default config profile at '{}': {e}", + include_path.display() + ); + exit!(2); + }); + toml.merge( + Some(include_path), + &mut Default::default(), + included_toml, + ReplaceOpt::IgnoreDuplicate, + ); + } + + let mut override_toml = TomlConfig::default(); + for option in override_set.iter() { + fn get_table(option: &str) -> Result { + toml::from_str(option).and_then(|table: toml::Value| TomlConfig::deserialize(table)) + } + + let mut err = match get_table(option) { + Ok(v) => { + override_toml.merge(None, &mut Default::default(), v, ReplaceOpt::ErrorOnDuplicate); + continue; + } + Err(e) => e, + }; + // We want to be able to set string values without quotes, + // like in `configure.py`. Try adding quotes around the right hand side + if let Some((key, value)) = option.split_once('=') + && !value.contains('"') + { + match get_table(&format!(r#"{key}="{value}""#)) { + Ok(v) => { + override_toml.merge( + None, + &mut Default::default(), + v, + ReplaceOpt::ErrorOnDuplicate, + ); + continue; + } + Err(e) => err = e, + } + } + eprintln!("failed to parse override `{option}`: `{err}"); + exit!(2) + } + toml.merge(None, &mut Default::default(), override_toml, ReplaceOpt::Override); +} + +#[cfg(test)] +pub fn check_stage0_version( + _program_path: &Path, + _component_name: &'static str, + _src_dir: &Path, + _exec_ctx: &ExecutionContext, +) { +} + +/// check rustc/cargo version is same or lower with 1 apart from the building one +#[cfg(not(test))] +pub fn check_stage0_version( + program_path: &Path, + component_name: &'static str, + src_dir: &Path, + exec_ctx: &ExecutionContext, +) { + use build_helper::util::fail; + + if exec_ctx.dry_run() { + return; + } + + let stage0_output = + command(program_path).arg("--version").run_capture_stdout(exec_ctx).stdout(); + let mut stage0_output = stage0_output.lines().next().unwrap().split(' '); + + let stage0_name = stage0_output.next().unwrap(); + if stage0_name != component_name { + fail(&format!( + "Expected to find {component_name} at {} but it claims to be {stage0_name}", + program_path.display() + )); + } + + let stage0_version = + semver::Version::parse(stage0_output.next().unwrap().split('-').next().unwrap().trim()) + .unwrap(); + let source_version = + semver::Version::parse(fs::read_to_string(src_dir.join("src/version")).unwrap().trim()) + .unwrap(); + if !(source_version == stage0_version + || (source_version.major == stage0_version.major + && (source_version.minor == stage0_version.minor + || source_version.minor == stage0_version.minor + 1))) + { + let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1); + fail(&format!( + "Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}" + )); + } +} diff --git a/src/bootstrap/src/core/config/toml/build.rs b/src/bootstrap/src/core/config/toml/build.rs index 4d29691f38b6..728367b39729 100644 --- a/src/bootstrap/src/core/config/toml/build.rs +++ b/src/bootstrap/src/core/config/toml/build.rs @@ -68,6 +68,7 @@ define_config! { optimized_compiler_builtins: Option = "optimized-compiler-builtins", jobs: Option = "jobs", compiletest_diff_tool: Option = "compiletest-diff-tool", + compiletest_allow_stage0: Option = "compiletest-allow-stage0", compiletest_use_stage0_libtest: Option = "compiletest-use-stage0-libtest", tidy_extra_checks: Option = "tidy-extra-checks", ccache: Option = "ccache", diff --git a/src/bootstrap/src/core/config/toml/dist.rs b/src/bootstrap/src/core/config/toml/dist.rs index b1429ef18617..934d64d88991 100644 --- a/src/bootstrap/src/core/config/toml/dist.rs +++ b/src/bootstrap/src/core/config/toml/dist.rs @@ -7,11 +7,12 @@ use serde::{Deserialize, Deserializer}; +use crate::core::config::Merge; use crate::core::config::toml::ReplaceOpt; -use crate::core::config::{Merge, set}; -use crate::{Config, HashSet, PathBuf, define_config, exit}; +use crate::{HashSet, PathBuf, define_config, exit}; define_config! { + #[derive(Default)] struct Dist { sign_folder: Option = "sign-folder", upload_addr: Option = "upload-addr", @@ -22,31 +23,3 @@ define_config! { vendor: Option = "vendor", } } - -impl Config { - /// Applies distribution-related configuration from the `Dist` struct - /// to the global `Config` structure. - pub fn apply_dist_config(&mut self, toml_dist: Option) { - if let Some(dist) = toml_dist { - let Dist { - sign_folder, - upload_addr, - src_tarball, - compression_formats, - compression_profile, - include_mingw_linker, - vendor, - } = dist; - self.dist_sign_folder = sign_folder.map(PathBuf::from); - self.dist_upload_addr = upload_addr; - self.dist_compression_formats = compression_formats; - set(&mut self.dist_compression_profile, compression_profile); - set(&mut self.rust_dist_src, src_tarball); - set(&mut self.dist_include_mingw_linker, include_mingw_linker); - self.dist_vendor = vendor.unwrap_or_else(|| { - // If we're building from git or tarball sources, enable it by default. - self.rust_info.is_managed_git_subrepository() || self.rust_info.is_from_tarball() - }); - } - } -} diff --git a/src/bootstrap/src/core/config/toml/gcc.rs b/src/bootstrap/src/core/config/toml/gcc.rs index bb817c2aaef8..9ea697edf159 100644 --- a/src/bootstrap/src/core/config/toml/gcc.rs +++ b/src/bootstrap/src/core/config/toml/gcc.rs @@ -6,29 +6,14 @@ use serde::{Deserialize, Deserializer}; +use crate::core::config::Merge; use crate::core::config::toml::ReplaceOpt; -use crate::core::config::{GccCiMode, Merge}; -use crate::{Config, HashSet, PathBuf, define_config, exit}; +use crate::{HashSet, PathBuf, define_config, exit}; define_config! { /// TOML representation of how the GCC build is configured. + #[derive(Default)] struct Gcc { download_ci_gcc: Option = "download-ci-gcc", } } - -impl Config { - /// Applies GCC-related configuration from the `TomlGcc` struct to the - /// global `Config` structure. - pub fn apply_gcc_config(&mut self, toml_gcc: Option) { - if let Some(gcc) = toml_gcc { - self.gcc_ci_mode = match gcc.download_ci_gcc { - Some(value) => match value { - true => GccCiMode::DownloadFromCi, - false => GccCiMode::BuildLocally, - }, - None => GccCiMode::default(), - }; - } - } -} diff --git a/src/bootstrap/src/core/config/toml/install.rs b/src/bootstrap/src/core/config/toml/install.rs index 6b9ab87a0b66..60fa958bd82f 100644 --- a/src/bootstrap/src/core/config/toml/install.rs +++ b/src/bootstrap/src/core/config/toml/install.rs @@ -8,12 +8,13 @@ use serde::{Deserialize, Deserializer}; +use crate::core::config::Merge; use crate::core::config::toml::ReplaceOpt; -use crate::core::config::{Merge, set}; -use crate::{Config, HashSet, PathBuf, define_config, exit}; +use crate::{HashSet, PathBuf, define_config, exit}; define_config! { /// TOML representation of various global install decisions. + #[derive(Default)] struct Install { prefix: Option = "prefix", sysconfdir: Option = "sysconfdir", @@ -24,20 +25,3 @@ define_config! { datadir: Option = "datadir", } } - -impl Config { - /// Applies installation-related configuration from the `Install` struct - /// to the global `Config` structure. - pub fn apply_install_config(&mut self, toml_install: Option) { - if let Some(install) = toml_install { - let Install { prefix, sysconfdir, docdir, bindir, libdir, mandir, datadir } = install; - self.prefix = prefix.map(PathBuf::from); - self.sysconfdir = sysconfdir.map(PathBuf::from); - self.datadir = datadir.map(PathBuf::from); - self.docdir = docdir.map(PathBuf::from); - set(&mut self.bindir, bindir.map(PathBuf::from)); - self.libdir = libdir.map(PathBuf::from); - self.mandir = mandir.map(PathBuf::from); - } - } -} diff --git a/src/bootstrap/src/core/config/toml/llvm.rs b/src/bootstrap/src/core/config/toml/llvm.rs index 1f0cecd145c7..9751837a8879 100644 --- a/src/bootstrap/src/core/config/toml/llvm.rs +++ b/src/bootstrap/src/core/config/toml/llvm.rs @@ -3,12 +3,13 @@ use serde::{Deserialize, Deserializer}; +use crate::core::config::StringOrBool; use crate::core::config::toml::{Merge, ReplaceOpt, TomlConfig}; -use crate::core::config::{StringOrBool, set}; -use crate::{Config, HashMap, HashSet, PathBuf, define_config, exit}; +use crate::{HashMap, HashSet, PathBuf, define_config, exit}; define_config! { /// TOML representation of how the LLVM build is configured. + #[derive(Default)] struct Llvm { optimize: Option = "optimize", thin_lto: Option = "thin-lto", @@ -144,127 +145,3 @@ pub fn check_incompatible_options_for_ci_llvm( Ok(()) } - -impl Config { - pub fn apply_llvm_config(&mut self, toml_llvm: Option) { - let mut llvm_tests = None; - let mut llvm_enzyme = None; - let mut llvm_offload = None; - let mut llvm_plugins = None; - - if let Some(llvm) = toml_llvm { - let Llvm { - optimize: optimize_toml, - thin_lto, - release_debuginfo, - assertions: _, - tests, - enzyme, - plugins, - static_libstdcpp, - libzstd, - ninja, - targets, - experimental_targets, - link_jobs, - link_shared, - version_suffix, - clang_cl, - cflags, - cxxflags, - ldflags, - use_libcxx, - use_linker, - allow_old_toolchain, - offload, - polly, - clang, - enable_warnings, - download_ci_llvm, - build_config, - } = llvm; - - set(&mut self.ninja_in_file, ninja); - llvm_tests = tests; - llvm_enzyme = enzyme; - llvm_offload = offload; - llvm_plugins = plugins; - set(&mut self.llvm_optimize, optimize_toml); - set(&mut self.llvm_thin_lto, thin_lto); - set(&mut self.llvm_release_debuginfo, release_debuginfo); - set(&mut self.llvm_static_stdcpp, static_libstdcpp); - set(&mut self.llvm_libzstd, libzstd); - if let Some(v) = link_shared { - self.llvm_link_shared.set(Some(v)); - } - self.llvm_targets.clone_from(&targets); - self.llvm_experimental_targets.clone_from(&experimental_targets); - self.llvm_link_jobs = link_jobs; - self.llvm_version_suffix.clone_from(&version_suffix); - self.llvm_clang_cl.clone_from(&clang_cl); - - self.llvm_cflags.clone_from(&cflags); - self.llvm_cxxflags.clone_from(&cxxflags); - self.llvm_ldflags.clone_from(&ldflags); - set(&mut self.llvm_use_libcxx, use_libcxx); - self.llvm_use_linker.clone_from(&use_linker); - self.llvm_allow_old_toolchain = allow_old_toolchain.unwrap_or(false); - self.llvm_offload = offload.unwrap_or(false); - self.llvm_polly = polly.unwrap_or(false); - self.llvm_clang = clang.unwrap_or(false); - self.llvm_enable_warnings = enable_warnings.unwrap_or(false); - self.llvm_build_config = build_config.clone().unwrap_or(Default::default()); - - self.llvm_from_ci = self.parse_download_ci_llvm(download_ci_llvm, self.llvm_assertions); - - if self.llvm_from_ci { - let warn = |option: &str| { - println!( - "WARNING: `{option}` will only be used on `compiler/rustc_llvm` build, not for the LLVM build." - ); - println!( - "HELP: To use `{option}` for LLVM builds, set `download-ci-llvm` option to false." - ); - }; - - if static_libstdcpp.is_some() { - warn("static-libstdcpp"); - } - - if link_shared.is_some() { - warn("link-shared"); - } - - // FIXME(#129153): instead of all the ad-hoc `download-ci-llvm` checks that follow, - // use the `builder-config` present in tarballs since #128822 to compare the local - // config to the ones used to build the LLVM artifacts on CI, and only notify users - // if they've chosen a different value. - - if libzstd.is_some() { - println!( - "WARNING: when using `download-ci-llvm`, the local `llvm.libzstd` option, \ - like almost all `llvm.*` options, will be ignored and set by the LLVM CI \ - artifacts builder config." - ); - println!( - "HELP: To use `llvm.libzstd` for LLVM/LLD builds, set `download-ci-llvm` option to false." - ); - } - } - - if !self.llvm_from_ci && self.llvm_thin_lto && link_shared.is_none() { - // If we're building with ThinLTO on, by default we want to link - // to LLVM shared, to avoid re-doing ThinLTO (which happens in - // the link step) with each stage. - self.llvm_link_shared.set(Some(true)); - } - } else { - self.llvm_from_ci = self.parse_download_ci_llvm(None, false); - } - - self.llvm_tests = llvm_tests.unwrap_or(false); - self.llvm_enzyme = llvm_enzyme.unwrap_or(false); - self.llvm_offload = llvm_offload.unwrap_or(false); - self.llvm_plugins = llvm_plugins.unwrap_or(false); - } -} diff --git a/src/bootstrap/src/core/config/toml/mod.rs b/src/bootstrap/src/core/config/toml/mod.rs index 01eb243159ce..7af22432ef8c 100644 --- a/src/bootstrap/src/core/config/toml/mod.rs +++ b/src/bootstrap/src/core/config/toml/mod.rs @@ -5,7 +5,7 @@ //! these raw TOML configurations from various sources (the main `bootstrap.toml`, //! included files, profile defaults, and command-line overrides). This processed //! TOML data then serves as an intermediate representation, which is further -//! transformed and applied to the final [`Config`] struct. +//! transformed and applied to the final `Config` struct. use serde::Deserialize; use serde_derive::Deserialize; diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index c136bd4a6f9b..3dab8d1d96d5 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -1,20 +1,15 @@ //! This module defines the `Rust` struct, which represents the `[rust]` table //! in the `bootstrap.toml` configuration file. -use std::str::FromStr; - use serde::{Deserialize, Deserializer}; -use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX; use crate::core::config::toml::TomlConfig; -use crate::core::config::{ - DebuginfoLevel, Merge, ReplaceOpt, RustcLto, StringOrBool, set, threads_from_config, -}; -use crate::flags::Warnings; -use crate::{BTreeSet, Config, HashSet, PathBuf, TargetSelection, define_config, exit}; +use crate::core::config::{DebuginfoLevel, Merge, ReplaceOpt, StringOrBool}; +use crate::{BTreeSet, CodegenBackendKind, HashSet, PathBuf, TargetSelection, define_config, exit}; define_config! { /// TOML representation of how the Rust build is configured. + #[derive(Default)] struct Rust { optimize: Option = "optimize", debug: Option = "debug", @@ -389,9 +384,15 @@ pub fn check_incompatible_options_for_ci_rustc( Ok(()) } -pub(crate) const VALID_CODEGEN_BACKENDS: &[&str] = &["llvm", "cranelift", "gcc"]; +pub(crate) const BUILTIN_CODEGEN_BACKENDS: &[&str] = &["llvm", "cranelift", "gcc"]; -pub(crate) fn validate_codegen_backends(backends: Vec, section: &str) -> Vec { +pub(crate) fn parse_codegen_backends( + backends: Vec, + section: &str, +) -> Vec { + const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; + + let mut found_backends = vec![]; for backend in &backends { if let Some(stripped) = backend.strip_prefix(CODEGEN_BACKEND_PREFIX) { panic!( @@ -400,18 +401,25 @@ pub(crate) fn validate_codegen_backends(backends: Vec, section: &str) -> Please, use '{stripped}' instead." ) } - if !VALID_CODEGEN_BACKENDS.contains(&backend.as_str()) { + if !BUILTIN_CODEGEN_BACKENDS.contains(&backend.as_str()) { println!( "HELP: '{backend}' for '{section}.codegen-backends' might fail. \ - List of known good values: {VALID_CODEGEN_BACKENDS:?}" + List of known codegen backends: {BUILTIN_CODEGEN_BACKENDS:?}" ); } + let backend = match backend.as_str() { + "llvm" => CodegenBackendKind::Llvm, + "cranelift" => CodegenBackendKind::Cranelift, + "gcc" => CodegenBackendKind::Gcc, + backend => CodegenBackendKind::Custom(backend.to_string()), + }; + found_backends.push(backend); } - backends + found_backends } #[cfg(not(test))] -fn default_lld_opt_in_targets() -> Vec { +pub fn default_lld_opt_in_targets() -> Vec { vec!["x86_64-unknown-linux-gnu".to_string()] } @@ -421,7 +429,7 @@ thread_local! { } #[cfg(test)] -fn default_lld_opt_in_targets() -> Vec { +pub fn default_lld_opt_in_targets() -> Vec { TEST_LLD_OPT_IN_TARGETS.with(|cell| cell.borrow().clone()).unwrap_or_default() } @@ -434,250 +442,3 @@ pub fn with_lld_opt_in_targets(targets: Vec, f: impl FnOnce() -> R) - result }) } - -impl Config { - pub fn apply_rust_config(&mut self, toml_rust: Option, warnings: Warnings) { - let mut debug = None; - let mut rustc_debug_assertions = None; - let mut std_debug_assertions = None; - let mut tools_debug_assertions = None; - let mut overflow_checks = None; - let mut overflow_checks_std = None; - let mut debug_logging = None; - let mut debuginfo_level = None; - let mut debuginfo_level_rustc = None; - let mut debuginfo_level_std = None; - let mut debuginfo_level_tools = None; - let mut debuginfo_level_tests = None; - let mut optimize = None; - let mut lld_enabled = None; - let mut std_features = None; - - if let Some(rust) = toml_rust { - let Rust { - optimize: optimize_toml, - debug: debug_toml, - codegen_units, - codegen_units_std, - rustc_debug_assertions: rustc_debug_assertions_toml, - std_debug_assertions: std_debug_assertions_toml, - tools_debug_assertions: tools_debug_assertions_toml, - overflow_checks: overflow_checks_toml, - overflow_checks_std: overflow_checks_std_toml, - debug_logging: debug_logging_toml, - debuginfo_level: debuginfo_level_toml, - debuginfo_level_rustc: debuginfo_level_rustc_toml, - debuginfo_level_std: debuginfo_level_std_toml, - debuginfo_level_tools: debuginfo_level_tools_toml, - debuginfo_level_tests: debuginfo_level_tests_toml, - backtrace, - incremental, - randomize_layout, - default_linker, - channel: _, // already handled above - musl_root, - rpath, - verbose_tests, - optimize_tests, - codegen_tests, - omit_git_hash: _, // already handled above - dist_src, - save_toolstates, - codegen_backends, - lld: lld_enabled_toml, - llvm_tools, - llvm_bitcode_linker, - deny_warnings, - backtrace_on_ice, - verify_llvm_ir, - thin_lto_import_instr_limit, - remap_debuginfo, - jemalloc, - test_compare_mode, - llvm_libunwind, - control_flow_guard, - ehcont_guard, - new_symbol_mangling, - profile_generate, - profile_use, - download_rustc, - lto, - validate_mir_opts, - frame_pointers, - stack_protector, - strip, - lld_mode, - std_features: std_features_toml, - } = rust; - - // FIXME(#133381): alt rustc builds currently do *not* have rustc debug assertions - // enabled. We should not download a CI alt rustc if we need rustc to have debug - // assertions (e.g. for crashes test suite). This can be changed once something like - // [Enable debug assertions on alt - // builds](https://github.com/rust-lang/rust/pull/131077) lands. - // - // Note that `rust.debug = true` currently implies `rust.debug-assertions = true`! - // - // This relies also on the fact that the global default for `download-rustc` will be - // `false` if it's not explicitly set. - let debug_assertions_requested = matches!(rustc_debug_assertions_toml, Some(true)) - || (matches!(debug_toml, Some(true)) - && !matches!(rustc_debug_assertions_toml, Some(false))); - - if debug_assertions_requested - && let Some(ref opt) = download_rustc - && opt.is_string_or_true() - { - eprintln!( - "WARN: currently no CI rustc builds have rustc debug assertions \ - enabled. Please either set `rust.debug-assertions` to `false` if you \ - want to use download CI rustc or set `rust.download-rustc` to `false`." - ); - } - - self.download_rustc_commit = self.download_ci_rustc_commit( - download_rustc, - debug_assertions_requested, - self.llvm_assertions, - ); - - debug = debug_toml; - rustc_debug_assertions = rustc_debug_assertions_toml; - std_debug_assertions = std_debug_assertions_toml; - tools_debug_assertions = tools_debug_assertions_toml; - overflow_checks = overflow_checks_toml; - overflow_checks_std = overflow_checks_std_toml; - debug_logging = debug_logging_toml; - debuginfo_level = debuginfo_level_toml; - debuginfo_level_rustc = debuginfo_level_rustc_toml; - debuginfo_level_std = debuginfo_level_std_toml; - debuginfo_level_tools = debuginfo_level_tools_toml; - debuginfo_level_tests = debuginfo_level_tests_toml; - lld_enabled = lld_enabled_toml; - std_features = std_features_toml; - - if optimize_toml.as_ref().is_some_and(|v| matches!(v, RustOptimize::Bool(false))) { - eprintln!( - "WARNING: setting `optimize` to `false` is known to cause errors and \ - should be considered unsupported. Refer to `bootstrap.example.toml` \ - for more details." - ); - } - - optimize = optimize_toml; - self.rust_new_symbol_mangling = new_symbol_mangling; - set(&mut self.rust_optimize_tests, optimize_tests); - set(&mut self.codegen_tests, codegen_tests); - set(&mut self.rust_rpath, rpath); - set(&mut self.rust_strip, strip); - set(&mut self.rust_frame_pointers, frame_pointers); - self.rust_stack_protector = stack_protector; - set(&mut self.jemalloc, jemalloc); - set(&mut self.test_compare_mode, test_compare_mode); - set(&mut self.backtrace, backtrace); - set(&mut self.rust_dist_src, dist_src); - set(&mut self.verbose_tests, verbose_tests); - // in the case "false" is set explicitly, do not overwrite the command line args - if let Some(true) = incremental { - self.incremental = true; - } - set(&mut self.lld_mode, lld_mode); - set(&mut self.llvm_bitcode_linker_enabled, llvm_bitcode_linker); - - self.rust_randomize_layout = randomize_layout.unwrap_or_default(); - self.llvm_tools_enabled = llvm_tools.unwrap_or(true); - - self.llvm_enzyme = self.channel == "dev" || self.channel == "nightly"; - self.rustc_default_linker = default_linker; - self.musl_root = musl_root.map(PathBuf::from); - self.save_toolstates = save_toolstates.map(PathBuf::from); - set( - &mut self.deny_warnings, - match warnings { - Warnings::Deny => Some(true), - Warnings::Warn => Some(false), - Warnings::Default => deny_warnings, - }, - ); - set(&mut self.backtrace_on_ice, backtrace_on_ice); - set(&mut self.rust_verify_llvm_ir, verify_llvm_ir); - self.rust_thin_lto_import_instr_limit = thin_lto_import_instr_limit; - set(&mut self.rust_remap_debuginfo, remap_debuginfo); - set(&mut self.control_flow_guard, control_flow_guard); - set(&mut self.ehcont_guard, ehcont_guard); - self.llvm_libunwind_default = - llvm_libunwind.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind")); - set( - &mut self.rust_codegen_backends, - codegen_backends.map(|backends| validate_codegen_backends(backends, "rust")), - ); - - self.rust_codegen_units = codegen_units.map(threads_from_config); - self.rust_codegen_units_std = codegen_units_std.map(threads_from_config); - - if self.rust_profile_use.is_none() { - self.rust_profile_use = profile_use; - } - - if self.rust_profile_generate.is_none() { - self.rust_profile_generate = profile_generate; - } - - self.rust_lto = - lto.as_deref().map(|value| RustcLto::from_str(value).unwrap()).unwrap_or_default(); - self.rust_validate_mir_opts = validate_mir_opts; - } - - self.rust_optimize = optimize.unwrap_or(RustOptimize::Bool(true)); - - // We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will - // build our internal lld and use it as the default linker, by setting the `rust.lld` config - // to true by default: - // - on the `x86_64-unknown-linux-gnu` target - // - when building our in-tree llvm (i.e. the target has not set an `llvm-config`), so that - // we're also able to build the corresponding lld - // - or when using an external llvm that's downloaded from CI, which also contains our prebuilt - // lld - // - otherwise, we'd be using an external llvm, and lld would not necessarily available and - // thus, disabled - // - similarly, lld will not be built nor used by default when explicitly asked not to, e.g. - // when the config sets `rust.lld = false` - if default_lld_opt_in_targets().contains(&self.host_target.triple.to_string()) - && self.hosts == [self.host_target] - { - let no_llvm_config = self - .target_config - .get(&self.host_target) - .is_none_or(|target_config| target_config.llvm_config.is_none()); - let enable_lld = self.llvm_from_ci || no_llvm_config; - // Prefer the config setting in case an explicit opt-out is needed. - self.lld_enabled = lld_enabled.unwrap_or(enable_lld); - } else { - set(&mut self.lld_enabled, lld_enabled); - } - - let default_std_features = BTreeSet::from([String::from("panic-unwind")]); - self.rust_std_features = std_features.unwrap_or(default_std_features); - - let default = debug == Some(true); - self.rustc_debug_assertions = rustc_debug_assertions.unwrap_or(default); - self.std_debug_assertions = std_debug_assertions.unwrap_or(self.rustc_debug_assertions); - self.tools_debug_assertions = tools_debug_assertions.unwrap_or(self.rustc_debug_assertions); - self.rust_overflow_checks = overflow_checks.unwrap_or(default); - self.rust_overflow_checks_std = overflow_checks_std.unwrap_or(self.rust_overflow_checks); - - self.rust_debug_logging = debug_logging.unwrap_or(self.rustc_debug_assertions); - - let with_defaults = |debuginfo_level_specific: Option<_>| { - debuginfo_level_specific.or(debuginfo_level).unwrap_or(if debug == Some(true) { - DebuginfoLevel::Limited - } else { - DebuginfoLevel::None - }) - }; - self.rust_debuginfo_level_rustc = with_defaults(debuginfo_level_rustc); - self.rust_debuginfo_level_std = with_defaults(debuginfo_level_std); - self.rust_debuginfo_level_tools = with_defaults(debuginfo_level_tools); - self.rust_debuginfo_level_tests = debuginfo_level_tests.unwrap_or(DebuginfoLevel::None); - } -} diff --git a/src/bootstrap/src/core/config/toml/target.rs b/src/bootstrap/src/core/config/toml/target.rs index 337276948b32..2c06fd083a81 100644 --- a/src/bootstrap/src/core/config/toml/target.rs +++ b/src/bootstrap/src/core/config/toml/target.rs @@ -7,18 +7,12 @@ //! * [`TomlTarget`]: This struct directly mirrors the `[target.]` sections in your //! `bootstrap.toml`. It's used for deserializing raw TOML data for a specific target. //! * [`Target`]: This struct represents the processed and validated configuration for a -//! build target, which is is stored in the main [`Config`] structure. -//! * [`Config::apply_target_config`]: This method processes the `TomlTarget` data and -//! applies it to the global [`Config`], ensuring proper path resolution, validation, -//! and integration with other build settings. - -use std::collections::HashMap; +//! build target, which is is stored in the main `Config` structure. use serde::{Deserialize, Deserializer}; -use crate::core::config::toml::rust::validate_codegen_backends; use crate::core::config::{LlvmLibunwind, Merge, ReplaceOpt, SplitDebuginfo, StringOrBool}; -use crate::{Config, HashSet, PathBuf, TargetSelection, define_config, exit}; +use crate::{CodegenBackendKind, HashSet, PathBuf, define_config, exit}; define_config! { /// TOML representation of how each build target is configured. @@ -76,7 +70,7 @@ pub struct Target { pub qemu_rootfs: Option, pub runner: Option, pub no_std: bool, - pub codegen_backends: Option>, + pub codegen_backends: Option>, pub optimized_compiler_builtins: Option, pub jemalloc: Option, } @@ -93,68 +87,3 @@ impl Target { target } } - -impl Config { - pub fn apply_target_config(&mut self, toml_target: Option>) { - if let Some(t) = toml_target { - for (triple, cfg) in t { - let mut target = Target::from_triple(&triple); - - if let Some(ref s) = cfg.llvm_config { - if self.download_rustc_commit.is_some() && triple == *self.host_target.triple { - panic!( - "setting llvm_config for the host is incompatible with download-rustc" - ); - } - target.llvm_config = Some(self.src.join(s)); - } - if let Some(patches) = cfg.llvm_has_rust_patches { - assert!( - self.submodules == Some(false) || cfg.llvm_config.is_some(), - "use of `llvm-has-rust-patches` is restricted to cases where either submodules are disabled or llvm-config been provided" - ); - target.llvm_has_rust_patches = Some(patches); - } - if let Some(ref s) = cfg.llvm_filecheck { - target.llvm_filecheck = Some(self.src.join(s)); - } - target.llvm_libunwind = cfg.llvm_libunwind.as_ref().map(|v| { - v.parse().unwrap_or_else(|_| { - panic!("failed to parse target.{triple}.llvm-libunwind") - }) - }); - if let Some(s) = cfg.no_std { - target.no_std = s; - } - target.cc = cfg.cc.map(PathBuf::from); - target.cxx = cfg.cxx.map(PathBuf::from); - target.ar = cfg.ar.map(PathBuf::from); - target.ranlib = cfg.ranlib.map(PathBuf::from); - target.linker = cfg.linker.map(PathBuf::from); - target.crt_static = cfg.crt_static; - target.musl_root = cfg.musl_root.map(PathBuf::from); - target.musl_libdir = cfg.musl_libdir.map(PathBuf::from); - target.wasi_root = cfg.wasi_root.map(PathBuf::from); - target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from); - target.runner = cfg.runner; - target.sanitizers = cfg.sanitizers; - target.profiler = cfg.profiler; - target.rpath = cfg.rpath; - target.optimized_compiler_builtins = cfg.optimized_compiler_builtins; - target.jemalloc = cfg.jemalloc; - if let Some(backends) = cfg.codegen_backends { - target.codegen_backends = - Some(validate_codegen_backends(backends, &format!("target.{triple}"))) - } - - target.split_debuginfo = cfg.split_debuginfo.as_ref().map(|v| { - v.parse().unwrap_or_else(|_| { - panic!("invalid value for target.{triple}.split-debuginfo") - }) - }); - - self.target_config.insert(TargetSelection::from_user(&triple), target); - } - } - } -} diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index 373fcd52052e..7ec6c62a07d0 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -7,9 +7,9 @@ use std::sync::OnceLock; use xz2::bufread::XzDecoder; -use crate::core::config::BUILDER_CONFIG_FILENAME; +use crate::core::config::{BUILDER_CONFIG_FILENAME, TargetSelection}; use crate::utils::build_stamp::BuildStamp; -use crate::utils::exec::command; +use crate::utils::exec::{ExecutionContext, command}; use crate::utils::helpers::{exe, hex_encode, move_file}; use crate::{Config, t}; @@ -24,17 +24,6 @@ fn extract_curl_version(out: String) -> semver::Version { .unwrap_or(semver::Version::new(1, 0, 0)) } -fn curl_version(config: &Config) -> semver::Version { - let mut curl = command("curl"); - curl.arg("-V"); - let curl = curl.run_capture_stdout(config); - if curl.is_failure() { - return semver::Version::new(1, 0, 0); - } - let output = curl.stdout(); - extract_curl_version(output) -} - /// Generic helpers that are useful anywhere in bootstrap. impl Config { pub fn is_verbose(&self) -> bool { @@ -49,10 +38,7 @@ impl Config { } pub(crate) fn remove(&self, f: &Path) { - if self.dry_run() { - return; - } - fs::remove_file(f).unwrap_or_else(|_| panic!("failed to remove {f:?}")); + remove(&self.exec_ctx, f); } /// Create a temporary directory in `out` and return its path. @@ -68,49 +54,7 @@ impl Config { /// Whether or not `fix_bin_or_dylib` needs to be run; can only be true /// on NixOS fn should_fix_bins_and_dylibs(&self) -> bool { - let val = *SHOULD_FIX_BINS_AND_DYLIBS.get_or_init(|| { - let uname = command("uname").allow_failure().arg("-s").run_capture_stdout(self); - if uname.is_failure() { - return false; - } - let output = uname.stdout(); - if !output.starts_with("Linux") { - return false; - } - // If the user has asked binaries to be patched for Nix, then - // don't check for NixOS or `/lib`. - // NOTE: this intentionally comes after the Linux check: - // - patchelf only works with ELF files, so no need to run it on Mac or Windows - // - On other Unix systems, there is no stable syscall interface, so Nix doesn't manage the global libc. - if let Some(explicit_value) = self.patch_binaries_for_nix { - return explicit_value; - } - - // Use `/etc/os-release` instead of `/etc/NIXOS`. - // The latter one does not exist on NixOS when using tmpfs as root. - let is_nixos = match File::open("/etc/os-release") { - Err(e) if e.kind() == ErrorKind::NotFound => false, - Err(e) => panic!("failed to access /etc/os-release: {e}"), - Ok(os_release) => BufReader::new(os_release).lines().any(|l| { - let l = l.expect("reading /etc/os-release"); - matches!(l.trim(), "ID=nixos" | "ID='nixos'" | "ID=\"nixos\"") - }), - }; - if !is_nixos { - let in_nix_shell = env::var("IN_NIX_SHELL"); - if let Ok(in_nix_shell) = in_nix_shell { - eprintln!( - "The IN_NIX_SHELL environment variable is `{in_nix_shell}`; \ - you may need to set `patch-binaries-for-nix=true` in bootstrap.toml" - ); - } - } - is_nixos - }); - if val { - eprintln!("INFO: You seem to be using Nix."); - } - val + should_fix_bins_and_dylibs(self.patch_binaries_for_nix, &self.exec_ctx) } /// Modifies the interpreter section of 'fname' to fix the dynamic linker, @@ -121,259 +65,22 @@ impl Config { /// /// Please see for more information fn fix_bin_or_dylib(&self, fname: &Path) { - assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true)); - println!("attempting to patch {}", fname.display()); - - // Only build `.nix-deps` once. - static NIX_DEPS_DIR: OnceLock = OnceLock::new(); - let mut nix_build_succeeded = true; - let nix_deps_dir = NIX_DEPS_DIR.get_or_init(|| { - // Run `nix-build` to "build" each dependency (which will likely reuse - // the existing `/nix/store` copy, or at most download a pre-built copy). - // - // Importantly, we create a gc-root called `.nix-deps` in the `build/` - // directory, but still reference the actual `/nix/store` path in the rpath - // as it makes it significantly more robust against changes to the location of - // the `.nix-deps` location. - // - // bintools: Needed for the path of `ld-linux.so` (via `nix-support/dynamic-linker`). - // zlib: Needed as a system dependency of `libLLVM-*.so`. - // patchelf: Needed for patching ELF binaries (see doc comment above). - let nix_deps_dir = self.out.join(".nix-deps"); - const NIX_EXPR: &str = " - with (import {}); - symlinkJoin { - name = \"rust-stage0-dependencies\"; - paths = [ - zlib - patchelf - stdenv.cc.bintools - ]; - } - "; - nix_build_succeeded = command("nix-build") - .allow_failure() - .args([Path::new("-E"), Path::new(NIX_EXPR), Path::new("-o"), &nix_deps_dir]) - .run_capture_stdout(self) - .is_success(); - nix_deps_dir - }); - if !nix_build_succeeded { - return; - } - - let mut patchelf = command(nix_deps_dir.join("bin/patchelf")); - patchelf.args(&[ - OsString::from("--add-rpath"), - OsString::from(t!(fs::canonicalize(nix_deps_dir)).join("lib")), - ]); - if !path_is_dylib(fname) { - // Finally, set the correct .interp for binaries - let dynamic_linker_path = nix_deps_dir.join("nix-support/dynamic-linker"); - let dynamic_linker = t!(fs::read_to_string(dynamic_linker_path)); - patchelf.args(["--set-interpreter", dynamic_linker.trim_end()]); - } - patchelf.arg(fname); - let _ = patchelf.allow_failure().run_capture_stdout(self); + fix_bin_or_dylib(&self.out, fname, &self.exec_ctx); } fn download_file(&self, url: &str, dest_path: &Path, help_on_error: &str) { - self.verbose(|| println!("download {url}")); - // Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/. - let tempfile = self.tempdir().join(dest_path.file_name().unwrap()); - // While bootstrap itself only supports http and https downloads, downstream forks might - // need to download components from other protocols. The match allows them adding more - // protocols without worrying about merge conflicts if we change the HTTP implementation. - match url.split_once("://").map(|(proto, _)| proto) { - Some("http") | Some("https") => { - self.download_http_with_retries(&tempfile, url, help_on_error) - } - Some(other) => panic!("unsupported protocol {other} in {url}"), - None => panic!("no protocol in {url}"), - } - t!( - move_file(&tempfile, dest_path), - format!("failed to rename {tempfile:?} to {dest_path:?}") - ); - } - - fn download_http_with_retries(&self, tempfile: &Path, url: &str, help_on_error: &str) { - println!("downloading {url}"); - // Try curl. If that fails and we are on windows, fallback to PowerShell. - // options should be kept in sync with - // src/bootstrap/src/core/download.rs - // for consistency - let mut curl = command("curl").allow_failure(); - curl.args([ - // follow redirect - "--location", - // timeout if speed is < 10 bytes/sec for > 30 seconds - "--speed-time", - "30", - "--speed-limit", - "10", - // timeout if cannot connect within 30 seconds - "--connect-timeout", - "30", - // output file - "--output", - tempfile.to_str().unwrap(), - // if there is an error, don't restart the download, - // instead continue where it left off. - "--continue-at", - "-", - // retry up to 3 times. note that this means a maximum of 4 - // attempts will be made, since the first attempt isn't a *re*try. - "--retry", - "3", - // show errors, even if --silent is specified - "--show-error", - // set timestamp of downloaded file to that of the server - "--remote-time", - // fail on non-ok http status - "--fail", - ]); - // Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful. - if self.is_running_on_ci { - curl.arg("--silent"); - } else { - curl.arg("--progress-bar"); - } - // --retry-all-errors was added in 7.71.0, don't use it if curl is old. - if curl_version(self) >= semver::Version::new(7, 71, 0) { - curl.arg("--retry-all-errors"); - } - curl.arg(url); - if !curl.run(self) { - if self.host_target.contains("windows-msvc") { - eprintln!("Fallback to PowerShell"); - for _ in 0..3 { - let powershell = command("PowerShell.exe").allow_failure().args([ - "/nologo", - "-Command", - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;", - &format!( - "(New-Object System.Net.WebClient).DownloadFile('{}', '{}')", - url, tempfile.to_str().expect("invalid UTF-8 not supported with powershell downloads"), - ), - ]).run_capture_stdout(self); - - if powershell.is_failure() { - return; - } - - eprintln!("\nspurious failure, trying again"); - } - } - if !help_on_error.is_empty() { - eprintln!("{help_on_error}"); - } - crate::exit!(1); - } + let dwn_ctx: DownloadContext<'_> = self.into(); + download_file(dwn_ctx, url, dest_path, help_on_error); } fn unpack(&self, tarball: &Path, dst: &Path, pattern: &str) { - eprintln!("extracting {} to {}", tarball.display(), dst.display()); - if !dst.exists() { - t!(fs::create_dir_all(dst)); - } - - // `tarball` ends with `.tar.xz`; strip that suffix - // example: `rust-dev-nightly-x86_64-unknown-linux-gnu` - let uncompressed_filename = - Path::new(tarball.file_name().expect("missing tarball filename")).file_stem().unwrap(); - let directory_prefix = Path::new(Path::new(uncompressed_filename).file_stem().unwrap()); - - // decompress the file - let data = t!(File::open(tarball), format!("file {} not found", tarball.display())); - let decompressor = XzDecoder::new(BufReader::new(data)); - - let mut tar = tar::Archive::new(decompressor); - - let is_ci_rustc = dst.ends_with("ci-rustc"); - let is_ci_llvm = dst.ends_with("ci-llvm"); - - // `compile::Sysroot` needs to know the contents of the `rustc-dev` tarball to avoid adding - // it to the sysroot unless it was explicitly requested. But parsing the 100 MB tarball is slow. - // Cache the entries when we extract it so we only have to read it once. - let mut recorded_entries = if is_ci_rustc { recorded_entries(dst, pattern) } else { None }; - - for member in t!(tar.entries()) { - let mut member = t!(member); - let original_path = t!(member.path()).into_owned(); - // skip the top-level directory - if original_path == directory_prefix { - continue; - } - let mut short_path = t!(original_path.strip_prefix(directory_prefix)); - let is_builder_config = short_path.to_str() == Some(BUILDER_CONFIG_FILENAME); - - if !(short_path.starts_with(pattern) - || ((is_ci_rustc || is_ci_llvm) && is_builder_config)) - { - continue; - } - short_path = short_path.strip_prefix(pattern).unwrap_or(short_path); - let dst_path = dst.join(short_path); - self.verbose(|| { - println!("extracting {} to {}", original_path.display(), dst.display()) - }); - if !t!(member.unpack_in(dst)) { - panic!("path traversal attack ??"); - } - if let Some(record) = &mut recorded_entries { - t!(writeln!(record, "{}", short_path.to_str().unwrap())); - } - let src_path = dst.join(original_path); - if src_path.is_dir() && dst_path.exists() { - continue; - } - t!(move_file(src_path, dst_path)); - } - let dst_dir = dst.join(directory_prefix); - if dst_dir.exists() { - t!(fs::remove_dir_all(&dst_dir), format!("failed to remove {}", dst_dir.display())); - } + unpack(&self.exec_ctx, tarball, dst, pattern); } /// Returns whether the SHA256 checksum of `path` matches `expected`. + #[cfg(test)] pub(crate) fn verify(&self, path: &Path, expected: &str) -> bool { - use sha2::Digest; - - self.verbose(|| println!("verifying {}", path.display())); - - if self.dry_run() { - return false; - } - - let mut hasher = sha2::Sha256::new(); - - let file = t!(File::open(path)); - let mut reader = BufReader::new(file); - - loop { - let buffer = t!(reader.fill_buf()); - let l = buffer.len(); - // break if EOF - if l == 0 { - break; - } - hasher.update(buffer); - reader.consume(l); - } - - let checksum = hex_encode(hasher.finalize().as_slice()); - let verified = checksum == expected; - - if !verified { - println!( - "invalid checksum: \n\ - found: {checksum}\n\ - expected: {expected}", - ); - } - - verified + verify(&self.exec_ctx, path, expected) } } @@ -388,6 +95,7 @@ fn recorded_entries(dst: &Path, pattern: &str) -> Option> { Some(BufWriter::new(t!(File::create(dst.join(name))))) } +#[derive(Clone)] enum DownloadSource { CI, Dist, @@ -420,63 +128,6 @@ impl Config { cargo_clippy } - #[cfg(test)] - pub(crate) fn maybe_download_rustfmt(&self) -> Option { - Some(PathBuf::new()) - } - - /// NOTE: rustfmt is a completely different toolchain than the bootstrap compiler, so it can't - /// reuse target directories or artifacts - #[cfg(not(test))] - pub(crate) fn maybe_download_rustfmt(&self) -> Option { - use build_helper::stage0_parser::VersionMetadata; - - if self.dry_run() { - return Some(PathBuf::new()); - } - - let VersionMetadata { date, version } = self.stage0_metadata.rustfmt.as_ref()?; - let channel = format!("{version}-{date}"); - - let host = self.host_target; - let bin_root = self.out.join(host).join("rustfmt"); - let rustfmt_path = bin_root.join("bin").join(exe("rustfmt", host)); - let rustfmt_stamp = BuildStamp::new(&bin_root).with_prefix("rustfmt").add_stamp(channel); - if rustfmt_path.exists() && rustfmt_stamp.is_up_to_date() { - return Some(rustfmt_path); - } - - self.download_component( - DownloadSource::Dist, - format!("rustfmt-{version}-{build}.tar.xz", build = host.triple), - "rustfmt-preview", - date, - "rustfmt", - ); - self.download_component( - DownloadSource::Dist, - format!("rustc-{version}-{build}.tar.xz", build = host.triple), - "rustc", - date, - "rustfmt", - ); - - if self.should_fix_bins_and_dylibs() { - self.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt")); - self.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt")); - let lib_dir = bin_root.join("lib"); - for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) { - let lib = t!(lib); - if path_is_dylib(&lib.path()) { - self.fix_bin_or_dylib(&lib.path()); - } - } - } - - t!(rustfmt_stamp.write()); - Some(rustfmt_path) - } - pub(crate) fn ci_rust_std_contents(&self) -> Vec { self.ci_component_contents(".rust-std-contents") } @@ -514,30 +165,6 @@ impl Config { ); } - #[cfg(test)] - pub(crate) fn download_beta_toolchain(&self) {} - - #[cfg(not(test))] - pub(crate) fn download_beta_toolchain(&self) { - self.verbose(|| println!("downloading stage0 beta artifacts")); - - let date = &self.stage0_metadata.compiler.date; - let version = &self.stage0_metadata.compiler.version; - let extra_components = ["cargo"]; - - let download_beta_component = |config: &Config, filename, prefix: &_, date: &_| { - config.download_component(DownloadSource::Dist, filename, prefix, date, "stage0") - }; - - self.download_toolchain( - version, - "stage0", - date, - &extra_components, - download_beta_component, - ); - } - fn download_toolchain( &self, version: &str, @@ -607,91 +234,8 @@ impl Config { key: &str, destination: &str, ) { - if self.dry_run() { - return; - } - - let cache_dst = - self.bootstrap_cache_path.as_ref().cloned().unwrap_or_else(|| self.out.join("cache")); - - let cache_dir = cache_dst.join(key); - if !cache_dir.exists() { - t!(fs::create_dir_all(&cache_dir)); - } - - let bin_root = self.out.join(self.host_target).join(destination); - let tarball = cache_dir.join(&filename); - let (base_url, url, should_verify) = match mode { - DownloadSource::CI => { - let dist_server = if self.llvm_assertions { - self.stage0_metadata.config.artifacts_with_llvm_assertions_server.clone() - } else { - self.stage0_metadata.config.artifacts_server.clone() - }; - let url = format!( - "{}/{filename}", - key.strip_suffix(&format!("-{}", self.llvm_assertions)).unwrap() - ); - (dist_server, url, false) - } - DownloadSource::Dist => { - let dist_server = env::var("RUSTUP_DIST_SERVER") - .unwrap_or(self.stage0_metadata.config.dist_server.to_string()); - // NOTE: make `dist` part of the URL because that's how it's stored in src/stage0 - (dist_server, format!("dist/{key}/{filename}"), true) - } - }; - - // For the stage0 compiler, put special effort into ensuring the checksums are valid. - let checksum = if should_verify { - let error = format!( - "src/stage0 doesn't contain a checksum for {url}. \ - Pre-built artifacts might not be available for this \ - target at this time, see https://doc.rust-lang.org/nightly\ - /rustc/platform-support.html for more information." - ); - let sha256 = self.stage0_metadata.checksums_sha256.get(&url).expect(&error); - if tarball.exists() { - if self.verify(&tarball, sha256) { - self.unpack(&tarball, &bin_root, prefix); - return; - } else { - self.verbose(|| { - println!( - "ignoring cached file {} due to failed verification", - tarball.display() - ) - }); - self.remove(&tarball); - } - } - Some(sha256) - } else if tarball.exists() { - self.unpack(&tarball, &bin_root, prefix); - return; - } else { - None - }; - - let mut help_on_error = ""; - if destination == "ci-rustc" { - help_on_error = "ERROR: failed to download pre-built rustc from CI - -NOTE: old builds get deleted after a certain time -HELP: if trying to compile an old commit of rustc, disable `download-rustc` in bootstrap.toml: - -[rust] -download-rustc = false -"; - } - self.download_file(&format!("{base_url}/{url}"), &tarball, help_on_error); - if let Some(sha256) = checksum - && !self.verify(&tarball, sha256) - { - panic!("failed to verify {}", tarball.display()); - } - - self.unpack(&tarball, &bin_root, prefix); + let dwn_ctx: DownloadContext<'_> = self.into(); + download_component(dwn_ctx, mode, filename, prefix, key, destination); } #[cfg(test)] @@ -852,6 +396,39 @@ download-rustc = false } } +/// Only should be used for pre config initialization downloads. +pub(crate) struct DownloadContext<'a> { + host_target: TargetSelection, + out: &'a Path, + patch_binaries_for_nix: Option, + exec_ctx: &'a ExecutionContext, + stage0_metadata: &'a build_helper::stage0_parser::Stage0, + llvm_assertions: bool, + bootstrap_cache_path: &'a Option, + is_running_on_ci: bool, +} + +impl<'a> AsRef> for DownloadContext<'a> { + fn as_ref(&self) -> &DownloadContext<'a> { + self + } +} + +impl<'a> From<&'a Config> for DownloadContext<'a> { + fn from(value: &'a Config) -> Self { + DownloadContext { + host_target: value.host_target, + out: &value.out, + patch_binaries_for_nix: value.patch_binaries_for_nix, + exec_ctx: &value.exec_ctx, + stage0_metadata: &value.stage0_metadata, + llvm_assertions: value.llvm_assertions, + bootstrap_cache_path: &value.bootstrap_cache_path, + is_running_on_ci: value.is_running_on_ci, + } + } +} + fn path_is_dylib(path: &Path) -> bool { // The .so is not necessarily the extension, it might be libLLVM.so.18.1 path.to_str().is_some_and(|path| path.contains(".so")) @@ -897,3 +474,596 @@ pub(crate) fn is_download_ci_available(target_triple: &str, llvm_assertions: boo SUPPORTED_PLATFORMS.contains(&target_triple) } } + +#[cfg(test)] +pub(crate) fn maybe_download_rustfmt<'a>( + dwn_ctx: impl AsRef>, +) -> Option { + Some(PathBuf::new()) +} + +/// NOTE: rustfmt is a completely different toolchain than the bootstrap compiler, so it can't +/// reuse target directories or artifacts +#[cfg(not(test))] +pub(crate) fn maybe_download_rustfmt<'a>( + dwn_ctx: impl AsRef>, +) -> Option { + use build_helper::stage0_parser::VersionMetadata; + + let dwn_ctx = dwn_ctx.as_ref(); + + if dwn_ctx.exec_ctx.dry_run() { + return Some(PathBuf::new()); + } + + let VersionMetadata { date, version } = dwn_ctx.stage0_metadata.rustfmt.as_ref()?; + let channel = format!("{version}-{date}"); + + let host = dwn_ctx.host_target; + let bin_root = dwn_ctx.out.join(host).join("rustfmt"); + let rustfmt_path = bin_root.join("bin").join(exe("rustfmt", host)); + let rustfmt_stamp = BuildStamp::new(&bin_root).with_prefix("rustfmt").add_stamp(channel); + if rustfmt_path.exists() && rustfmt_stamp.is_up_to_date() { + return Some(rustfmt_path); + } + + download_component( + dwn_ctx, + DownloadSource::Dist, + format!("rustfmt-{version}-{build}.tar.xz", build = host.triple), + "rustfmt-preview", + date, + "rustfmt", + ); + + download_component( + dwn_ctx, + DownloadSource::Dist, + format!("rustc-{version}-{build}.tar.xz", build = host.triple), + "rustc", + date, + "rustfmt", + ); + + if should_fix_bins_and_dylibs(dwn_ctx.patch_binaries_for_nix, dwn_ctx.exec_ctx) { + fix_bin_or_dylib(dwn_ctx.out, &bin_root.join("bin").join("rustfmt"), dwn_ctx.exec_ctx); + fix_bin_or_dylib(dwn_ctx.out, &bin_root.join("bin").join("cargo-fmt"), dwn_ctx.exec_ctx); + let lib_dir = bin_root.join("lib"); + for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) { + let lib = t!(lib); + if path_is_dylib(&lib.path()) { + fix_bin_or_dylib(dwn_ctx.out, &lib.path(), dwn_ctx.exec_ctx); + } + } + } + + t!(rustfmt_stamp.write()); + Some(rustfmt_path) +} + +#[cfg(test)] +pub(crate) fn download_beta_toolchain<'a>(dwn_ctx: impl AsRef>) {} + +#[cfg(not(test))] +pub(crate) fn download_beta_toolchain<'a>(dwn_ctx: impl AsRef>) { + let dwn_ctx = dwn_ctx.as_ref(); + dwn_ctx.exec_ctx.verbose(|| { + println!("downloading stage0 beta artifacts"); + }); + + let date = dwn_ctx.stage0_metadata.compiler.date.clone(); + let version = dwn_ctx.stage0_metadata.compiler.version.clone(); + let extra_components = ["cargo"]; + let sysroot = "stage0"; + download_toolchain( + dwn_ctx, + &version, + sysroot, + &date, + &extra_components, + "stage0", + DownloadSource::Dist, + ); +} + +fn download_toolchain<'a>( + dwn_ctx: impl AsRef>, + version: &str, + sysroot: &str, + stamp_key: &str, + extra_components: &[&str], + destination: &str, + mode: DownloadSource, +) { + let dwn_ctx = dwn_ctx.as_ref(); + let host = dwn_ctx.host_target.triple; + let bin_root = dwn_ctx.out.join(host).join(sysroot); + let rustc_stamp = BuildStamp::new(&bin_root).with_prefix("rustc").add_stamp(stamp_key); + + if !bin_root.join("bin").join(exe("rustc", dwn_ctx.host_target)).exists() + || !rustc_stamp.is_up_to_date() + { + if bin_root.exists() { + t!(fs::remove_dir_all(&bin_root)); + } + let filename = format!("rust-std-{version}-{host}.tar.xz"); + let pattern = format!("rust-std-{host}"); + download_component(dwn_ctx, mode.clone(), filename, &pattern, stamp_key, destination); + let filename = format!("rustc-{version}-{host}.tar.xz"); + download_component(dwn_ctx, mode.clone(), filename, "rustc", stamp_key, destination); + + for component in extra_components { + let filename = format!("{component}-{version}-{host}.tar.xz"); + download_component(dwn_ctx, mode.clone(), filename, component, stamp_key, destination); + } + + if should_fix_bins_and_dylibs(dwn_ctx.patch_binaries_for_nix, dwn_ctx.exec_ctx) { + fix_bin_or_dylib(dwn_ctx.out, &bin_root.join("bin").join("rustc"), dwn_ctx.exec_ctx); + fix_bin_or_dylib(dwn_ctx.out, &bin_root.join("bin").join("rustdoc"), dwn_ctx.exec_ctx); + fix_bin_or_dylib( + dwn_ctx.out, + &bin_root.join("libexec").join("rust-analyzer-proc-macro-srv"), + dwn_ctx.exec_ctx, + ); + let lib_dir = bin_root.join("lib"); + for lib in t!(fs::read_dir(&lib_dir), lib_dir.display().to_string()) { + let lib = t!(lib); + if path_is_dylib(&lib.path()) { + fix_bin_or_dylib(dwn_ctx.out, &lib.path(), dwn_ctx.exec_ctx); + } + } + } + + t!(rustc_stamp.write()); + } +} + +pub(crate) fn remove(exec_ctx: &ExecutionContext, f: &Path) { + if exec_ctx.dry_run() { + return; + } + fs::remove_file(f).unwrap_or_else(|_| panic!("failed to remove {f:?}")); +} + +fn fix_bin_or_dylib(out: &Path, fname: &Path, exec_ctx: &ExecutionContext) { + assert_eq!(SHOULD_FIX_BINS_AND_DYLIBS.get(), Some(&true)); + println!("attempting to patch {}", fname.display()); + + // Only build `.nix-deps` once. + static NIX_DEPS_DIR: OnceLock = OnceLock::new(); + let mut nix_build_succeeded = true; + let nix_deps_dir = NIX_DEPS_DIR.get_or_init(|| { + // Run `nix-build` to "build" each dependency (which will likely reuse + // the existing `/nix/store` copy, or at most download a pre-built copy). + // + // Importantly, we create a gc-root called `.nix-deps` in the `build/` + // directory, but still reference the actual `/nix/store` path in the rpath + // as it makes it significantly more robust against changes to the location of + // the `.nix-deps` location. + // + // bintools: Needed for the path of `ld-linux.so` (via `nix-support/dynamic-linker`). + // zlib: Needed as a system dependency of `libLLVM-*.so`. + // patchelf: Needed for patching ELF binaries (see doc comment above). + let nix_deps_dir = out.join(".nix-deps"); + const NIX_EXPR: &str = " + with (import {}); + symlinkJoin { + name = \"rust-stage0-dependencies\"; + paths = [ + zlib + patchelf + stdenv.cc.bintools + ]; + } + "; + nix_build_succeeded = command("nix-build") + .allow_failure() + .args([Path::new("-E"), Path::new(NIX_EXPR), Path::new("-o"), &nix_deps_dir]) + .run_capture_stdout(exec_ctx) + .is_success(); + nix_deps_dir + }); + if !nix_build_succeeded { + return; + } + + let mut patchelf = command(nix_deps_dir.join("bin/patchelf")); + patchelf.args(&[ + OsString::from("--add-rpath"), + OsString::from(t!(fs::canonicalize(nix_deps_dir)).join("lib")), + ]); + if !path_is_dylib(fname) { + // Finally, set the correct .interp for binaries + let dynamic_linker_path = nix_deps_dir.join("nix-support/dynamic-linker"); + let dynamic_linker = t!(fs::read_to_string(dynamic_linker_path)); + patchelf.args(["--set-interpreter", dynamic_linker.trim_end()]); + } + patchelf.arg(fname); + let _ = patchelf.allow_failure().run_capture_stdout(exec_ctx); +} + +fn should_fix_bins_and_dylibs( + patch_binaries_for_nix: Option, + exec_ctx: &ExecutionContext, +) -> bool { + let val = *SHOULD_FIX_BINS_AND_DYLIBS.get_or_init(|| { + let uname = command("uname").allow_failure().arg("-s").run_capture_stdout(exec_ctx); + if uname.is_failure() { + return false; + } + let output = uname.stdout(); + if !output.starts_with("Linux") { + return false; + } + // If the user has asked binaries to be patched for Nix, then + // don't check for NixOS or `/lib`. + // NOTE: this intentionally comes after the Linux check: + // - patchelf only works with ELF files, so no need to run it on Mac or Windows + // - On other Unix systems, there is no stable syscall interface, so Nix doesn't manage the global libc. + if let Some(explicit_value) = patch_binaries_for_nix { + return explicit_value; + } + + // Use `/etc/os-release` instead of `/etc/NIXOS`. + // The latter one does not exist on NixOS when using tmpfs as root. + let is_nixos = match File::open("/etc/os-release") { + Err(e) if e.kind() == ErrorKind::NotFound => false, + Err(e) => panic!("failed to access /etc/os-release: {e}"), + Ok(os_release) => BufReader::new(os_release).lines().any(|l| { + let l = l.expect("reading /etc/os-release"); + matches!(l.trim(), "ID=nixos" | "ID='nixos'" | "ID=\"nixos\"") + }), + }; + if !is_nixos { + let in_nix_shell = env::var("IN_NIX_SHELL"); + if let Ok(in_nix_shell) = in_nix_shell { + eprintln!( + "The IN_NIX_SHELL environment variable is `{in_nix_shell}`; \ + you may need to set `patch-binaries-for-nix=true` in bootstrap.toml" + ); + } + } + is_nixos + }); + if val { + eprintln!("INFO: You seem to be using Nix."); + } + val +} + +fn download_component<'a>( + dwn_ctx: impl AsRef>, + mode: DownloadSource, + filename: String, + prefix: &str, + key: &str, + destination: &str, +) { + let dwn_ctx = dwn_ctx.as_ref(); + + if dwn_ctx.exec_ctx.dry_run() { + return; + } + + let cache_dst = + dwn_ctx.bootstrap_cache_path.as_ref().cloned().unwrap_or_else(|| dwn_ctx.out.join("cache")); + + let cache_dir = cache_dst.join(key); + if !cache_dir.exists() { + t!(fs::create_dir_all(&cache_dir)); + } + + let bin_root = dwn_ctx.out.join(dwn_ctx.host_target).join(destination); + let tarball = cache_dir.join(&filename); + let (base_url, url, should_verify) = match mode { + DownloadSource::CI => { + let dist_server = if dwn_ctx.llvm_assertions { + dwn_ctx.stage0_metadata.config.artifacts_with_llvm_assertions_server.clone() + } else { + dwn_ctx.stage0_metadata.config.artifacts_server.clone() + }; + let url = format!( + "{}/{filename}", + key.strip_suffix(&format!("-{}", dwn_ctx.llvm_assertions)).unwrap() + ); + (dist_server, url, false) + } + DownloadSource::Dist => { + let dist_server = env::var("RUSTUP_DIST_SERVER") + .unwrap_or(dwn_ctx.stage0_metadata.config.dist_server.to_string()); + // NOTE: make `dist` part of the URL because that's how it's stored in src/stage0 + (dist_server, format!("dist/{key}/{filename}"), true) + } + }; + + // For the stage0 compiler, put special effort into ensuring the checksums are valid. + let checksum = if should_verify { + let error = format!( + "src/stage0 doesn't contain a checksum for {url}. \ + Pre-built artifacts might not be available for this \ + target at this time, see https://doc.rust-lang.org/nightly\ + /rustc/platform-support.html for more information." + ); + let sha256 = dwn_ctx.stage0_metadata.checksums_sha256.get(&url).expect(&error); + if tarball.exists() { + if verify(dwn_ctx.exec_ctx, &tarball, sha256) { + unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix); + return; + } else { + dwn_ctx.exec_ctx.verbose(|| { + println!( + "ignoring cached file {} due to failed verification", + tarball.display() + ) + }); + remove(dwn_ctx.exec_ctx, &tarball); + } + } + Some(sha256) + } else if tarball.exists() { + unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix); + return; + } else { + None + }; + + let mut help_on_error = ""; + if destination == "ci-rustc" { + help_on_error = "ERROR: failed to download pre-built rustc from CI + +NOTE: old builds get deleted after a certain time +HELP: if trying to compile an old commit of rustc, disable `download-rustc` in bootstrap.toml: + +[rust] +download-rustc = false +"; + } + download_file(dwn_ctx, &format!("{base_url}/{url}"), &tarball, help_on_error); + if let Some(sha256) = checksum + && !verify(dwn_ctx.exec_ctx, &tarball, sha256) + { + panic!("failed to verify {}", tarball.display()); + } + + unpack(dwn_ctx.exec_ctx, &tarball, &bin_root, prefix); +} + +pub(crate) fn verify(exec_ctx: &ExecutionContext, path: &Path, expected: &str) -> bool { + use sha2::Digest; + + exec_ctx.verbose(|| { + println!("verifying {}", path.display()); + }); + + if exec_ctx.dry_run() { + return false; + } + + let mut hasher = sha2::Sha256::new(); + + let file = t!(File::open(path)); + let mut reader = BufReader::new(file); + + loop { + let buffer = t!(reader.fill_buf()); + let l = buffer.len(); + // break if EOF + if l == 0 { + break; + } + hasher.update(buffer); + reader.consume(l); + } + + let checksum = hex_encode(hasher.finalize().as_slice()); + let verified = checksum == expected; + + if !verified { + println!( + "invalid checksum: \n\ + found: {checksum}\n\ + expected: {expected}", + ); + } + + verified +} + +fn unpack(exec_ctx: &ExecutionContext, tarball: &Path, dst: &Path, pattern: &str) { + eprintln!("extracting {} to {}", tarball.display(), dst.display()); + if !dst.exists() { + t!(fs::create_dir_all(dst)); + } + + // `tarball` ends with `.tar.xz`; strip that suffix + // example: `rust-dev-nightly-x86_64-unknown-linux-gnu` + let uncompressed_filename = + Path::new(tarball.file_name().expect("missing tarball filename")).file_stem().unwrap(); + let directory_prefix = Path::new(Path::new(uncompressed_filename).file_stem().unwrap()); + + // decompress the file + let data = t!(File::open(tarball), format!("file {} not found", tarball.display())); + let decompressor = XzDecoder::new(BufReader::new(data)); + + let mut tar = tar::Archive::new(decompressor); + + let is_ci_rustc = dst.ends_with("ci-rustc"); + let is_ci_llvm = dst.ends_with("ci-llvm"); + + // `compile::Sysroot` needs to know the contents of the `rustc-dev` tarball to avoid adding + // it to the sysroot unless it was explicitly requested. But parsing the 100 MB tarball is slow. + // Cache the entries when we extract it so we only have to read it once. + let mut recorded_entries = if is_ci_rustc { recorded_entries(dst, pattern) } else { None }; + + for member in t!(tar.entries()) { + let mut member = t!(member); + let original_path = t!(member.path()).into_owned(); + // skip the top-level directory + if original_path == directory_prefix { + continue; + } + let mut short_path = t!(original_path.strip_prefix(directory_prefix)); + let is_builder_config = short_path.to_str() == Some(BUILDER_CONFIG_FILENAME); + + if !(short_path.starts_with(pattern) || ((is_ci_rustc || is_ci_llvm) && is_builder_config)) + { + continue; + } + short_path = short_path.strip_prefix(pattern).unwrap_or(short_path); + let dst_path = dst.join(short_path); + + exec_ctx.verbose(|| { + println!("extracting {} to {}", original_path.display(), dst.display()); + }); + + if !t!(member.unpack_in(dst)) { + panic!("path traversal attack ??"); + } + if let Some(record) = &mut recorded_entries { + t!(writeln!(record, "{}", short_path.to_str().unwrap())); + } + let src_path = dst.join(original_path); + if src_path.is_dir() && dst_path.exists() { + continue; + } + t!(move_file(src_path, dst_path)); + } + let dst_dir = dst.join(directory_prefix); + if dst_dir.exists() { + t!(fs::remove_dir_all(&dst_dir), format!("failed to remove {}", dst_dir.display())); + } +} + +fn download_file<'a>( + dwn_ctx: impl AsRef>, + url: &str, + dest_path: &Path, + help_on_error: &str, +) { + let dwn_ctx = dwn_ctx.as_ref(); + + dwn_ctx.exec_ctx.verbose(|| { + println!("download {url}"); + }); + // Use a temporary file in case we crash while downloading, to avoid a corrupt download in cache/. + let tempfile = tempdir(dwn_ctx.out).join(dest_path.file_name().unwrap()); + // While bootstrap itself only supports http and https downloads, downstream forks might + // need to download components from other protocols. The match allows them adding more + // protocols without worrying about merge conflicts if we change the HTTP implementation. + match url.split_once("://").map(|(proto, _)| proto) { + Some("http") | Some("https") => download_http_with_retries( + dwn_ctx.host_target, + dwn_ctx.is_running_on_ci, + dwn_ctx.exec_ctx, + &tempfile, + url, + help_on_error, + ), + Some(other) => panic!("unsupported protocol {other} in {url}"), + None => panic!("no protocol in {url}"), + } + t!(move_file(&tempfile, dest_path), format!("failed to rename {tempfile:?} to {dest_path:?}")); +} + +/// Create a temporary directory in `out` and return its path. +/// +/// NOTE: this temporary directory is shared between all steps; +/// if you need an empty directory, create a new subdirectory inside it. +pub(crate) fn tempdir(out: &Path) -> PathBuf { + let tmp = out.join("tmp"); + t!(fs::create_dir_all(&tmp)); + tmp +} + +fn download_http_with_retries( + host_target: TargetSelection, + is_running_on_ci: bool, + exec_ctx: &ExecutionContext, + tempfile: &Path, + url: &str, + help_on_error: &str, +) { + println!("downloading {url}"); + // Try curl. If that fails and we are on windows, fallback to PowerShell. + // options should be kept in sync with + // src/bootstrap/src/core/download.rs + // for consistency + let mut curl = command("curl").allow_failure(); + curl.args([ + // follow redirect + "--location", + // timeout if speed is < 10 bytes/sec for > 30 seconds + "--speed-time", + "30", + "--speed-limit", + "10", + // timeout if cannot connect within 30 seconds + "--connect-timeout", + "30", + // output file + "--output", + tempfile.to_str().unwrap(), + // if there is an error, don't restart the download, + // instead continue where it left off. + "--continue-at", + "-", + // retry up to 3 times. note that this means a maximum of 4 + // attempts will be made, since the first attempt isn't a *re*try. + "--retry", + "3", + // show errors, even if --silent is specified + "--show-error", + // set timestamp of downloaded file to that of the server + "--remote-time", + // fail on non-ok http status + "--fail", + ]); + // Don't print progress in CI; the \r wrapping looks bad and downloads don't take long enough for progress to be useful. + if is_running_on_ci { + curl.arg("--silent"); + } else { + curl.arg("--progress-bar"); + } + // --retry-all-errors was added in 7.71.0, don't use it if curl is old. + if curl_version(exec_ctx) >= semver::Version::new(7, 71, 0) { + curl.arg("--retry-all-errors"); + } + curl.arg(url); + if !curl.run(exec_ctx) { + if host_target.contains("windows-msvc") { + eprintln!("Fallback to PowerShell"); + for _ in 0..3 { + let powershell = command("PowerShell.exe").allow_failure().args([ + "/nologo", + "-Command", + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;", + &format!( + "(New-Object System.Net.WebClient).DownloadFile('{}', '{}')", + url, tempfile.to_str().expect("invalid UTF-8 not supported with powershell downloads"), + ), + ]).run_capture_stdout(exec_ctx); + + if powershell.is_failure() { + return; + } + + eprintln!("\nspurious failure, trying again"); + } + } + if !help_on_error.is_empty() { + eprintln!("{help_on_error}"); + } + crate::exit!(1); + } +} + +fn curl_version(exec_ctx: &ExecutionContext) -> semver::Version { + let mut curl = command("curl"); + curl.arg("-V"); + let curl = curl.run_capture_stdout(exec_ctx); + if curl.is_failure() { + return semver::Version::new(1, 0, 0); + } + let output = curl.stdout(); + extract_curl_version(output) +} diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 15e04f591296..3080e641b5be 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -33,6 +33,7 @@ pub struct Finder { // // Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap). const STAGE0_MISSING_TARGETS: &[&str] = &[ + "armv7a-vex-v5", // just a dummy comment so the list doesn't get onelined ]; diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index 51a84ad5272c..4abf386e5de6 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -123,6 +123,46 @@ impl PartialEq for Compiler { } } +/// Represents a codegen backend. +#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] +pub enum CodegenBackendKind { + #[default] + Llvm, + Cranelift, + Gcc, + Custom(String), +} + +impl CodegenBackendKind { + /// Name of the codegen backend, as identified in the `compiler` directory + /// (`rustc_codegen_`). + pub fn name(&self) -> &str { + match self { + CodegenBackendKind::Llvm => "llvm", + CodegenBackendKind::Cranelift => "cranelift", + CodegenBackendKind::Gcc => "gcc", + CodegenBackendKind::Custom(name) => name, + } + } + + /// Name of the codegen backend's crate, e.g. `rustc_codegen_cranelift`. + pub fn crate_name(&self) -> String { + format!("rustc_codegen_{}", self.name()) + } + + pub fn is_llvm(&self) -> bool { + matches!(self, Self::Llvm) + } + + pub fn is_cranelift(&self) -> bool { + matches!(self, Self::Cranelift) + } + + pub fn is_gcc(&self) -> bool { + matches!(self, Self::Gcc) + } +} + #[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum DocTests { /// Run normal tests and doc tests (default). @@ -148,7 +188,6 @@ pub enum GitRepo { /// although most functions are implemented as free functions rather than /// methods specifically on this structure itself (to make it easier to /// organize). -#[derive(Clone)] pub struct Build { /// User-specified configuration from `bootstrap.toml`. config: Config, @@ -204,6 +243,9 @@ pub struct Build { #[cfg(feature = "build-metrics")] metrics: crate::utils::metrics::BuildMetrics, + + #[cfg(feature = "tracing")] + step_graph: std::cell::RefCell, } #[derive(Debug, Clone)] @@ -475,7 +517,7 @@ impl Build { local_rebuild: config.local_rebuild, fail_fast: config.cmd.fail_fast(), doc_tests: config.cmd.doc_tests(), - verbosity: config.verbose, + verbosity: config.exec_ctx.verbosity as usize, host_target: config.host_target, hosts: config.hosts.clone(), @@ -507,6 +549,9 @@ impl Build { #[cfg(feature = "build-metrics")] metrics: crate::utils::metrics::BuildMetrics::init(), + + #[cfg(feature = "tracing")] + step_graph: std::cell::RefCell::new(crate::utils::step_graph::StepGraph::default()), }; // If local-rust is the same major.minor as the current version, then force a @@ -1060,17 +1105,6 @@ impl Build { self.msg(Kind::Doc, compiler.stage, what, compiler.host, target.into()) } - #[must_use = "Groups should not be dropped until the Step finishes running"] - #[track_caller] - fn msg_build( - &self, - compiler: Compiler, - what: impl Display, - target: impl Into>, - ) -> Option { - self.msg(Kind::Build, compiler.stage, what, compiler.host, target) - } - /// Return a `Group` guard for a [`Step`] that is built for each `--stage`. /// /// [`Step`]: crate::core::builder::Step @@ -1117,20 +1151,21 @@ impl Build { #[must_use = "Groups should not be dropped until the Step finishes running"] #[track_caller] - fn msg_sysroot_tool( + fn msg_rustc_tool( &self, action: impl Into, - stage: u32, + build_stage: u32, what: impl Display, host: TargetSelection, target: TargetSelection, ) -> Option { let action = action.into().description(); let msg = |fmt| format!("{action} {what} {fmt}"); + let msg = if host == target { - msg(format_args!("(stage{stage} -> stage{}, {target})", stage + 1)) + msg(format_args!("(stage{build_stage} -> stage{}, {target})", build_stage + 1)) } else { - msg(format_args!("(stage{stage}:{host} -> stage{}:{target})", stage + 1)) + msg(format_args!("(stage{build_stage}:{host} -> stage{}:{target})", build_stage + 1)) }; self.group(&msg) } @@ -1984,6 +2019,11 @@ to download LLVM rather than building it. pub fn report_summary(&self, start_time: Instant) { self.config.exec_ctx.profiler().report_summary(start_time); } + + #[cfg(feature = "tracing")] + pub fn report_step_graph(self) { + self.step_graph.into_inner().store_to_dot_files(); + } } impl AsRef for Build { diff --git a/src/bootstrap/src/utils/build_stamp.rs b/src/bootstrap/src/utils/build_stamp.rs index f43d860893f6..bd4eb790ae50 100644 --- a/src/bootstrap/src/utils/build_stamp.rs +++ b/src/bootstrap/src/utils/build_stamp.rs @@ -10,7 +10,7 @@ use sha2::digest::Digest; use crate::core::builder::Builder; use crate::core::config::TargetSelection; use crate::utils::helpers::{hex_encode, mtime}; -use crate::{Compiler, Mode, helpers, t}; +use crate::{CodegenBackendKind, Compiler, Mode, helpers, t}; #[cfg(test)] mod tests; @@ -129,10 +129,10 @@ pub fn codegen_backend_stamp( builder: &Builder<'_>, compiler: Compiler, target: TargetSelection, - backend: &str, + backend: &CodegenBackendKind, ) -> BuildStamp { BuildStamp::new(&builder.cargo_out(compiler, Mode::Codegen, target)) - .with_prefix(&format!("librustc_codegen_{backend}")) + .with_prefix(&format!("lib{}", backend.crate_name())) } /// Cargo's output path for the standard library in a given stage, compiled diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 4b0c48213648..d3331b81587e 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -486,4 +486,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "Removed `rust.description` and `llvm.ccache` as it was deprecated in #137723 and #136941 long time ago.", }, + ChangeInfo { + change_id: 144675, + severity: ChangeSeverity::Warning, + summary: "Added `build.compiletest-allow-stage0` flag instead of `COMPILETEST_FORCE_STAGE0` env var, and reject running `compiletest` self tests against stage 0 rustc unless explicitly allowed.", + }, ]; diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs index 209ff3939731..03760faec690 100644 --- a/src/bootstrap/src/utils/exec.rs +++ b/src/bootstrap/src/utils/exec.rs @@ -80,11 +80,21 @@ impl CommandFingerprint { /// Helper method to format both Command and BootstrapCommand as a short execution line, /// without all the other details (e.g. environment variables). pub fn format_short_cmd(&self) -> String { - let program = Path::new(&self.program); - let mut line = vec![program.file_name().unwrap().to_str().unwrap().to_owned()]; - line.extend(self.args.iter().map(|arg| arg.to_string_lossy().into_owned())); - line.extend(self.cwd.iter().map(|p| p.to_string_lossy().into_owned())); - line.join(" ") + use std::fmt::Write; + + let mut cmd = self.program.to_string_lossy().to_string(); + for arg in &self.args { + let arg = arg.to_string_lossy(); + if arg.contains(' ') { + write!(cmd, " '{arg}'").unwrap(); + } else { + write!(cmd, " {arg}").unwrap(); + } + } + if let Some(cwd) = &self.cwd { + write!(cmd, " [workdir={}]", cwd.to_string_lossy()).unwrap(); + } + cmd } } @@ -434,8 +444,8 @@ impl From for BootstrapCommand { enum CommandStatus { /// The command has started and finished with some status. Finished(ExitStatus), - /// It was not even possible to start the command. - DidNotStart, + /// It was not even possible to start the command or wait for it to finish. + DidNotStartOrFinish, } /// Create a new BootstrapCommand. This is a helper function to make command creation @@ -456,9 +466,9 @@ pub struct CommandOutput { impl CommandOutput { #[must_use] - pub fn did_not_start(stdout: OutputMode, stderr: OutputMode) -> Self { + pub fn not_finished(stdout: OutputMode, stderr: OutputMode) -> Self { Self { - status: CommandStatus::DidNotStart, + status: CommandStatus::DidNotStartOrFinish, stdout: match stdout { OutputMode::Print => None, OutputMode::Capture => Some(vec![]), @@ -489,7 +499,7 @@ impl CommandOutput { pub fn is_success(&self) -> bool { match self.status { CommandStatus::Finished(status) => status.success(), - CommandStatus::DidNotStart => false, + CommandStatus::DidNotStartOrFinish => false, } } @@ -501,7 +511,7 @@ impl CommandOutput { pub fn status(&self) -> Option { match self.status { CommandStatus::Finished(status) => Some(status), - CommandStatus::DidNotStart => None, + CommandStatus::DidNotStartOrFinish => None, } } @@ -550,7 +560,7 @@ impl Default for CommandOutput { #[derive(Clone, Default)] pub struct ExecutionContext { dry_run: DryRun, - verbose: u8, + pub verbosity: u8, pub fail_fast: bool, delayed_failures: Arc>>, command_cache: Arc, @@ -603,8 +613,8 @@ impl CommandCache { } impl ExecutionContext { - pub fn new() -> Self { - ExecutionContext::default() + pub fn new(verbosity: u8, fail_fast: bool) -> Self { + Self { verbosity, fail_fast, ..Default::default() } } pub fn dry_run(&self) -> bool { @@ -629,7 +639,7 @@ impl ExecutionContext { } pub fn is_verbose(&self) -> bool { - self.verbose > 0 + self.verbosity > 0 } pub fn fail_fast(&self) -> bool { @@ -640,8 +650,8 @@ impl ExecutionContext { self.dry_run = value; } - pub fn set_verbose(&mut self, value: u8) { - self.verbose = value; + pub fn set_verbosity(&mut self, value: u8) { + self.verbosity = value; } pub fn set_fail_fast(&mut self, value: bool) { @@ -745,25 +755,11 @@ impl ExecutionContext { self.start(command, stdout, stderr).wait_for_output(self) } - fn fail(&self, message: &str, output: CommandOutput) -> ! { - if self.is_verbose() { - println!("{message}"); - } else { - let (stdout, stderr) = (output.stdout_if_present(), output.stderr_if_present()); - // If the command captures output, the user would not see any indication that - // it has failed. In this case, print a more verbose error, since to provide more - // context. - if stdout.is_some() || stderr.is_some() { - if let Some(stdout) = output.stdout_if_present().take_if(|s| !s.trim().is_empty()) { - println!("STDOUT:\n{stdout}\n"); - } - if let Some(stderr) = output.stderr_if_present().take_if(|s| !s.trim().is_empty()) { - println!("STDERR:\n{stderr}\n"); - } - println!("Command has failed. Rerun with -v to see more details."); - } else { - println!("Command has failed. Rerun with -v to see more details."); - } + fn fail(&self, message: &str) -> ! { + println!("{message}"); + + if !self.is_verbose() { + println!("Command has failed. Rerun with -v to see more details."); } exit!(1); } @@ -856,7 +852,7 @@ impl<'a> DeferredCommand<'a> { && command.should_cache { exec_ctx.command_cache.insert(fingerprint.clone(), output.clone()); - exec_ctx.profiler.record_execution(fingerprint.clone(), start_time); + exec_ctx.profiler.record_execution(fingerprint, start_time); } output @@ -872,6 +868,8 @@ impl<'a> DeferredCommand<'a> { executed_at: &'a std::panic::Location<'a>, exec_ctx: &ExecutionContext, ) -> CommandOutput { + use std::fmt::Write; + command.mark_as_executed(); let process = match process.take() { @@ -881,79 +879,82 @@ impl<'a> DeferredCommand<'a> { let created_at = command.get_created_location(); - let mut message = String::new(); + #[allow(clippy::enum_variant_names)] + enum FailureReason { + FailedAtRuntime(ExitStatus), + FailedToFinish(std::io::Error), + FailedToStart(std::io::Error), + } - let output = match process { + let (output, fail_reason) = match process { Ok(child) => match child.wait_with_output() { - Ok(result) if result.status.success() => { + Ok(output) if output.status.success() => { // Successful execution - CommandOutput::from_output(result, stdout, stderr) + (CommandOutput::from_output(output, stdout, stderr), None) } - Ok(result) => { - // Command ran but failed - use std::fmt::Write; - - writeln!( - message, - r#" -Command {command:?} did not execute successfully. -Expected success, got {} -Created at: {created_at} -Executed at: {executed_at}"#, - result.status, + Ok(output) => { + // Command started, but then it failed + let status = output.status; + ( + CommandOutput::from_output(output, stdout, stderr), + Some(FailureReason::FailedAtRuntime(status)), ) - .unwrap(); - - let output = CommandOutput::from_output(result, stdout, stderr); - - if stdout.captures() { - writeln!(message, "\nSTDOUT ----\n{}", output.stdout().trim()).unwrap(); - } - if stderr.captures() { - writeln!(message, "\nSTDERR ----\n{}", output.stderr().trim()).unwrap(); - } - - output } Err(e) => { // Failed to wait for output - use std::fmt::Write; - - writeln!( - message, - "\n\nCommand {command:?} did not execute successfully.\ - \nIt was not possible to execute the command: {e:?}" + ( + CommandOutput::not_finished(stdout, stderr), + Some(FailureReason::FailedToFinish(e)), ) - .unwrap(); - - CommandOutput::did_not_start(stdout, stderr) } }, Err(e) => { // Failed to spawn the command - use std::fmt::Write; - - writeln!( - message, - "\n\nCommand {command:?} did not execute successfully.\ - \nIt was not possible to execute the command: {e:?}" - ) - .unwrap(); - - CommandOutput::did_not_start(stdout, stderr) + (CommandOutput::not_finished(stdout, stderr), Some(FailureReason::FailedToStart(e))) } }; - if !output.is_success() { + if let Some(fail_reason) = fail_reason { + let mut error_message = String::new(); + let command_str = if exec_ctx.is_verbose() { + format!("{command:?}") + } else { + command.fingerprint().format_short_cmd() + }; + let action = match fail_reason { + FailureReason::FailedAtRuntime(e) => { + format!("failed with exit code {}", e.code().unwrap_or(1)) + } + FailureReason::FailedToFinish(e) => { + format!("failed to finish: {e:?}") + } + FailureReason::FailedToStart(e) => { + format!("failed to start: {e:?}") + } + }; + writeln!( + error_message, + r#"Command `{command_str}` {action} +Created at: {created_at} +Executed at: {executed_at}"#, + ) + .unwrap(); + if stdout.captures() { + writeln!(error_message, "\n--- STDOUT vvv\n{}", output.stdout().trim()).unwrap(); + } + if stderr.captures() { + writeln!(error_message, "\n--- STDERR vvv\n{}", output.stderr().trim()).unwrap(); + } + match command.failure_behavior { BehaviorOnFailure::DelayFail => { if exec_ctx.fail_fast { - exec_ctx.fail(&message, output); + exec_ctx.fail(&error_message); } - exec_ctx.add_to_delay_failure(message); + exec_ctx.add_to_delay_failure(error_message); } BehaviorOnFailure::Exit => { - exec_ctx.fail(&message, output); + exec_ctx.fail(&error_message); } BehaviorOnFailure::Ignore => { // If failures are allowed, either the error has been printed already diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index eb00ed566c2d..451482717b6c 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -404,9 +404,8 @@ pub fn linker_args( builder: &Builder<'_>, target: TargetSelection, lld_threads: LldThreads, - stage: u32, ) -> Vec { - let mut args = linker_flags(builder, target, lld_threads, stage); + let mut args = linker_flags(builder, target, lld_threads); if let Some(linker) = builder.linker(target) { args.push(format!("-Clinker={}", linker.display())); @@ -421,29 +420,16 @@ pub fn linker_flags( builder: &Builder<'_>, target: TargetSelection, lld_threads: LldThreads, - stage: u32, ) -> Vec { let mut args = vec![]; if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() { match builder.config.lld_mode { LldMode::External => { - // cfg(bootstrap) - remove the stage 0 check after updating the bootstrap compiler: - // `-Clinker-features` has been stabilized. - if stage == 0 { - args.push("-Zlinker-features=+lld".to_string()); - } else { - args.push("-Clinker-features=+lld".to_string()); - } + args.push("-Clinker-features=+lld".to_string()); args.push("-Zunstable-options".to_string()); } LldMode::SelfContained => { - // cfg(bootstrap) - remove the stage 0 check after updating the bootstrap compiler: - // `-Clinker-features` has been stabilized. - if stage == 0 { - args.push("-Zlinker-features=+lld".to_string()); - } else { - args.push("-Clinker-features=+lld".to_string()); - } + args.push("-Clinker-features=+lld".to_string()); args.push("-Clink-self-contained=+linker".to_string()); args.push("-Zunstable-options".to_string()); } @@ -465,9 +451,8 @@ pub fn add_rustdoc_cargo_linker_args( builder: &Builder<'_>, target: TargetSelection, lld_threads: LldThreads, - stage: u32, ) { - let args = linker_args(builder, target, lld_threads, stage); + let args = linker_args(builder, target, lld_threads); let mut flags = cmd .get_envs() .find_map(|(k, v)| if k == OsStr::new("RUSTDOCFLAGS") { v } else { None }) diff --git a/src/bootstrap/src/utils/mod.rs b/src/bootstrap/src/utils/mod.rs index 169fcec303e9..97d8d274e8fb 100644 --- a/src/bootstrap/src/utils/mod.rs +++ b/src/bootstrap/src/utils/mod.rs @@ -19,5 +19,8 @@ pub(crate) mod tracing; #[cfg(feature = "build-metrics")] pub(crate) mod metrics; +#[cfg(feature = "tracing")] +pub(crate) mod step_graph; + #[cfg(test)] pub(crate) mod tests; diff --git a/src/bootstrap/src/utils/proc_macro_deps.rs b/src/bootstrap/src/utils/proc_macro_deps.rs index 21c7fc89d7df..777c8601aa1d 100644 --- a/src/bootstrap/src/utils/proc_macro_deps.rs +++ b/src/bootstrap/src/utils/proc_macro_deps.rs @@ -3,6 +3,7 @@ /// See pub static CRATES: &[&str] = &[ // tidy-alphabetical-start + "allocator-api2", "annotate-snippets", "anstyle", "askama_parser", @@ -16,13 +17,17 @@ pub static CRATES: &[&str] = &[ "darling_core", "derive_builder_core", "digest", + "equivalent", "fluent-bundle", "fluent-langneg", "fluent-syntax", "fnv", + "foldhash", "generic-array", + "hashbrown", "heck", "ident_case", + "indexmap", "intl-memoizer", "intl_pluralrules", "libc", diff --git a/src/bootstrap/src/utils/step_graph.rs b/src/bootstrap/src/utils/step_graph.rs new file mode 100644 index 000000000000..c45825a42223 --- /dev/null +++ b/src/bootstrap/src/utils/step_graph.rs @@ -0,0 +1,182 @@ +use std::collections::{HashMap, HashSet}; +use std::fmt::Debug; +use std::io::BufWriter; + +use crate::core::builder::{AnyDebug, Step}; + +/// Records the executed steps and their dependencies in a directed graph, +/// which can then be rendered into a DOT file for visualization. +/// +/// The graph visualizes the first execution of a step with a solid edge, +/// and cached executions of steps with a dashed edge. +/// If you only want to see first executions, you can modify the code in `DotGraph` to +/// always set `cached: false`. +#[derive(Default)] +pub struct StepGraph { + /// We essentially store one graph per dry run mode. + graphs: HashMap, +} + +impl StepGraph { + pub fn register_step_execution( + &mut self, + step: &S, + parent: Option<&Box>, + dry_run: bool, + ) { + let key = get_graph_key(dry_run); + let graph = self.graphs.entry(key.to_string()).or_insert_with(|| DotGraph::default()); + + // The debug output of the step sort of serves as the unique identifier of it. + // We use it to access the node ID of parents to generate edges. + // We could probably also use addresses on the heap from the `Box`, but this seems less + // magical. + let node_key = render_step(step); + + let label = if let Some(metadata) = step.metadata() { + format!( + "{}{} [{}]", + metadata.get_name(), + metadata.get_stage().map(|s| format!(" stage {s}")).unwrap_or_default(), + metadata.get_target() + ) + } else { + let type_name = std::any::type_name::(); + type_name + .strip_prefix("bootstrap::core::") + .unwrap_or(type_name) + .strip_prefix("build_steps::") + .unwrap_or(type_name) + .to_string() + }; + + let node = Node { label, tooltip: node_key.clone() }; + let node_handle = graph.add_node(node_key, node); + + if let Some(parent) = parent { + let parent_key = render_step(parent); + if let Some(src_node_handle) = graph.get_handle_by_key(&parent_key) { + graph.add_edge(src_node_handle, node_handle); + } + } + } + + pub fn register_cached_step( + &mut self, + step: &S, + parent: &Box, + dry_run: bool, + ) { + let key = get_graph_key(dry_run); + let graph = self.graphs.get_mut(key).unwrap(); + + let node_key = render_step(step); + let parent_key = render_step(parent); + + if let Some(src_node_handle) = graph.get_handle_by_key(&parent_key) { + if let Some(dst_node_handle) = graph.get_handle_by_key(&node_key) { + graph.add_cached_edge(src_node_handle, dst_node_handle); + } + } + } + + pub fn store_to_dot_files(self) { + for (key, graph) in self.graphs.into_iter() { + let filename = format!("bootstrap-steps{key}.dot"); + graph.render(&filename).unwrap(); + } + } +} + +fn get_graph_key(dry_run: bool) -> &'static str { + if dry_run { ".dryrun" } else { "" } +} + +struct Node { + label: String, + tooltip: String, +} + +#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] +struct NodeHandle(usize); + +/// Represents a dependency between two bootstrap steps. +#[derive(PartialEq, Eq, Hash, PartialOrd, Ord)] +struct Edge { + src: NodeHandle, + dst: NodeHandle, + // Was the corresponding execution of a step cached, or was the step actually executed? + cached: bool, +} + +// We could use a library for this, but they either: +// - require lifetimes, which gets annoying (dot_writer) +// - don't support tooltips (dot_graph) +// - have a lot of dependencies (graphviz_rust) +// - only have SVG export (layout-rs) +// - use a builder pattern that is very annoying to use here (tabbycat) +#[derive(Default)] +struct DotGraph { + nodes: Vec, + /// The `NodeHandle` represents an index within `self.nodes` + edges: HashSet, + key_to_index: HashMap, +} + +impl DotGraph { + fn add_node(&mut self, key: String, node: Node) -> NodeHandle { + let handle = NodeHandle(self.nodes.len()); + self.nodes.push(node); + self.key_to_index.insert(key, handle); + handle + } + + fn add_edge(&mut self, src: NodeHandle, dst: NodeHandle) { + self.edges.insert(Edge { src, dst, cached: false }); + } + + fn add_cached_edge(&mut self, src: NodeHandle, dst: NodeHandle) { + // There's no point in rendering both cached and uncached edge + let uncached = Edge { src, dst, cached: false }; + if !self.edges.contains(&uncached) { + self.edges.insert(Edge { src, dst, cached: true }); + } + } + + fn get_handle_by_key(&self, key: &str) -> Option { + self.key_to_index.get(key).copied() + } + + fn render(&self, path: &str) -> std::io::Result<()> { + use std::io::Write; + + let mut file = BufWriter::new(std::fs::File::create(path)?); + writeln!(file, "digraph bootstrap_steps {{")?; + for (index, node) in self.nodes.iter().enumerate() { + writeln!( + file, + r#"{index} [label="{}", tooltip="{}"]"#, + escape(&node.label), + escape(&node.tooltip) + )?; + } + + let mut edges: Vec<&Edge> = self.edges.iter().collect(); + edges.sort(); + for edge in edges { + let style = if edge.cached { "dashed" } else { "solid" }; + writeln!(file, r#"{} -> {} [style="{style}"]"#, edge.src.0, edge.dst.0)?; + } + + writeln!(file, "}}") + } +} + +fn render_step(step: &dyn Debug) -> String { + format!("{step:?}") +} + +/// Normalizes the string so that it can be rendered into a DOT file. +fn escape(input: &str) -> String { + input.replace("\"", "\\\"") +} diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile index e1d83d360872..0855ea222a36 100644 --- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -81,9 +81,9 @@ RUN /tmp/build-fuchsia-toolchain.sh COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | \ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | \ tar -xz -ENV WASI_SDK_PATH=/tmp/wasi-sdk-25.0-x86_64-linux +ENV WASI_SDK_PATH=/tmp/wasi-sdk-27.0-x86_64-linux COPY scripts/freebsd-toolchain.sh /tmp/ RUN /tmp/freebsd-toolchain.sh i686 diff --git a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile index f7d51fba861e..04ac0f33daf0 100644 --- a/src/ci/docker/host-x86_64/pr-check-1/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-1/Dockerfile @@ -43,7 +43,6 @@ ENV SCRIPT \ python3 ../x.py check bootstrap && \ /scripts/check-default-config-profiles.sh && \ python3 ../x.py build src/tools/build-manifest && \ - python3 ../x.py test --stage 0 src/tools/compiletest && \ python3 ../x.py check compiletest --set build.compiletest-use-stage0-libtest=true && \ python3 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ python3 ../x.py check --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \ diff --git a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile index ce18a181d313..f82e19bcbb47 100644 --- a/src/ci/docker/host-x86_64/pr-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/pr-check-2/Dockerfile @@ -30,6 +30,7 @@ ENV SCRIPT \ python3 ../x.py check && \ python3 ../x.py clippy ci && \ python3 ../x.py test --stage 1 core alloc std test proc_macro && \ + python3 ../x.py test --stage 1 src/tools/compiletest && \ python3 ../x.py doc --stage 0 bootstrap && \ # Build both public and internal documentation. RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 0 compiler && \ @@ -37,6 +38,6 @@ ENV SCRIPT \ mkdir -p /checkout/obj/staging/doc && \ cp -r build/x86_64-unknown-linux-gnu/doc /checkout/obj/staging && \ RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library/test && \ - # The BOOTSTRAP_TRACING flag is added to verify whether the + # The BOOTSTRAP_TRACING flag is added to verify whether the # bootstrap process compiles successfully with this flag enabled. BOOTSTRAP_TRACING=1 python3 ../x.py --help diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 662a26400ce9..82a820c859dc 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -40,9 +40,9 @@ WORKDIR / COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | \ +RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-27/wasi-sdk-27.0-x86_64-linux.tar.gz | \ tar -xz -ENV WASI_SDK_PATH=/wasi-sdk-25.0-x86_64-linux +ENV WASI_SDK_PATH=/wasi-sdk-27.0-x86_64-linux ENV RUST_CONFIGURE_ARGS \ --musl-root-x86_64=/usr/local/x86_64-linux-musl \ diff --git a/src/ci/docker/scripts/build-clang.sh b/src/ci/docker/scripts/build-clang.sh index 536991cc06b7..905c40773042 100755 --- a/src/ci/docker/scripts/build-clang.sh +++ b/src/ci/docker/scripts/build-clang.sh @@ -5,7 +5,7 @@ set -ex source shared.sh # Try to keep the LLVM version here in sync with src/ci/scripts/install-clang.sh -LLVM=llvmorg-20.1.0-rc2 +LLVM=llvmorg-21.1.0-rc2 mkdir llvm-project cd llvm-project @@ -44,8 +44,10 @@ hide_output \ -DLLVM_INCLUDE_BENCHMARKS=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ -DLLVM_INCLUDE_EXAMPLES=OFF \ - -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt;bolt" \ + -DLLVM_ENABLE_PROJECTS="clang;lld;bolt" \ + -DLLVM_ENABLE_RUNTIMES="compiler-rt" \ -DLLVM_BINUTILS_INCDIR="/rustroot/lib/gcc/$GCC_PLUGIN_TARGET/$GCC_VERSION/plugin/include/" \ + -DRUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLAGS=\"--gcc-toolchain=/rustroot\"" \ -DC_INCLUDE_DIRS="$INC" hide_output make -j$(nproc) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 011688487b44..48c570bfa11a 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -31,20 +31,11 @@ runners: <<: *base-job - &job-windows - os: windows-2022 - <<: *base-job - - # NOTE: windows-2025 has less disk space available than windows-2022, - # because the D drive is missing. - - &job-windows-25 os: windows-2025 + free_disk: true <<: *base-job - &job-windows-8c - os: windows-2022-8core-32gb - <<: *base-job - - - &job-windows-25-8c os: windows-2025-8core-32gb <<: *base-job @@ -491,7 +482,7 @@ auto: NO_LLVM_ASSERTIONS: 1 NO_DEBUG_ASSERTIONS: 1 NO_OVERFLOW_CHECKS: 1 - <<: *job-macos + <<: *job-macos-m1 - name: x86_64-apple-1 env: @@ -668,7 +659,7 @@ auto: SCRIPT: python x.py build --set rust.debug=true opt-dist && PGO_HOST=x86_64-pc-windows-msvc ./build/x86_64-pc-windows-msvc/stage0-tools-bin/opt-dist windows-ci -- python x.py dist bootstrap --include-default-paths DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift - <<: *job-windows-25-8c + <<: *job-windows-8c - name: dist-i686-msvc env: diff --git a/src/ci/scripts/free-disk-space-linux.sh b/src/ci/scripts/free-disk-space-linux.sh new file mode 100755 index 000000000000..32649fe0d9b3 --- /dev/null +++ b/src/ci/scripts/free-disk-space-linux.sh @@ -0,0 +1,265 @@ +#!/bin/bash +set -euo pipefail + +# Free disk space on Linux GitHub action runners +# Script inspired by https://github.com/jlumbroso/free-disk-space + +isX86() { + local arch + arch=$(uname -m) + if [ "$arch" = "x86_64" ]; then + return 0 + else + return 1 + fi +} + +# Check if we're on a GitHub hosted runner. +# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted". +isGitHubRunner() { + # `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string". + if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then + return 0 + else + return 1 + fi +} + +# print a line of the specified character +printSeparationLine() { + for ((i = 0; i < 80; i++)); do + printf "%s" "$1" + done + printf "\n" +} + +# compute available space +# REF: https://unix.stackexchange.com/a/42049/60849 +# REF: https://stackoverflow.com/a/450821/408734 +getAvailableSpace() { + df -a | awk 'NR > 1 {avail+=$4} END {print avail}' +} + +# make Kb human readable (assume the input is Kb) +# REF: https://unix.stackexchange.com/a/44087/60849 +formatByteCount() { + numfmt --to=iec-i --suffix=B --padding=7 "${1}000" +} + +# macro to output saved space +printSavedSpace() { + # Disk space before the operation + local before=${1} + local title=${2:-} + + local after + after=$(getAvailableSpace) + local saved=$((after - before)) + + if [ "$saved" -lt 0 ]; then + echo "::warning::Saved space is negative: $saved. Using '0' as saved space." + saved=0 + fi + + echo "" + printSeparationLine "*" + if [ -n "${title}" ]; then + echo "=> ${title}: Saved $(formatByteCount "$saved")" + else + echo "=> Saved $(formatByteCount "$saved")" + fi + printSeparationLine "*" + echo "" +} + +# macro to print output of df with caption +printDF() { + local caption=${1} + + printSeparationLine "=" + echo "${caption}" + echo "" + echo "$ df -h" + echo "" + df -h + printSeparationLine "=" +} + +removeUnusedFilesAndDirs() { + local to_remove=( + "/usr/share/java" + ) + + if isGitHubRunner; then + to_remove+=( + "/usr/local/aws-sam-cli" + "/usr/local/doc/cmake" + "/usr/local/julia"* + "/usr/local/lib/android" + "/usr/local/share/chromedriver-"* + "/usr/local/share/chromium" + "/usr/local/share/cmake-"* + "/usr/local/share/edge_driver" + "/usr/local/share/emacs" + "/usr/local/share/gecko_driver" + "/usr/local/share/icons" + "/usr/local/share/powershell" + "/usr/local/share/vcpkg" + "/usr/local/share/vim" + "/usr/share/apache-maven-"* + "/usr/share/gradle-"* + "/usr/share/kotlinc" + "/usr/share/miniconda" + "/usr/share/php" + "/usr/share/ri" + "/usr/share/swift" + + # binaries + "/usr/local/bin/azcopy" + "/usr/local/bin/bicep" + "/usr/local/bin/ccmake" + "/usr/local/bin/cmake-"* + "/usr/local/bin/cmake" + "/usr/local/bin/cpack" + "/usr/local/bin/ctest" + "/usr/local/bin/helm" + "/usr/local/bin/kind" + "/usr/local/bin/kustomize" + "/usr/local/bin/minikube" + "/usr/local/bin/packer" + "/usr/local/bin/phpunit" + "/usr/local/bin/pulumi-"* + "/usr/local/bin/pulumi" + "/usr/local/bin/stack" + + # Haskell runtime + "/usr/local/.ghcup" + + # Azure + "/opt/az" + "/usr/share/az_"* + ) + + if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then + # Environment variable set by GitHub Actions + to_remove+=( + "${AGENT_TOOLSDIRECTORY}" + ) + else + echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal." + fi + else + # Remove folders and files present in AWS CodeBuild + to_remove+=( + # binaries + "/usr/local/bin/ecs-cli" + "/usr/local/bin/eksctl" + "/usr/local/bin/kubectl" + + "${HOME}/.gradle" + "${HOME}/.dotnet" + "${HOME}/.goenv" + "${HOME}/.phpenv" + + ) + fi + + for element in "${to_remove[@]}"; do + if [ ! -e "$element" ]; then + # The file or directory doesn't exist. + # Maybe it was removed in a newer version of the runner or it's not present in a + # specific architecture (e.g. ARM). + echo "::warning::Directory or file $element does not exist, skipping." + fi + done + + # Remove all files and directories at once to save time. + sudo rm -rf "${to_remove[@]}" +} + +execAndMeasureSpaceChange() { + local operation=${1} # Function to execute + local title=${2} + + local before + before=$(getAvailableSpace) + $operation + + printSavedSpace "$before" "$title" +} + +# Remove large packages +# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh +cleanPackages() { + local packages=( + '^aspnetcore-.*' + '^dotnet-.*' + '^llvm-.*' + '^mongodb-.*' + 'firefox' + 'libgl1-mesa-dri' + 'mono-devel' + 'php.*' + ) + + if isGitHubRunner; then + packages+=( + azure-cli + ) + + if isX86; then + packages+=( + 'google-chrome-stable' + 'google-cloud-cli' + 'google-cloud-sdk' + 'powershell' + ) + fi + else + packages+=( + 'google-chrome-stable' + ) + fi + + sudo apt-get -qq remove -y --fix-missing "${packages[@]}" + + sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed" + sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed failed" +} + +# Remove Docker images. +# Ubuntu 22 runners have docker images already installed. +# They aren't present in ubuntu 24 runners. +cleanDocker() { + echo "=> Removing the following docker images:" + sudo docker image ls + echo "=> Removing docker images..." + sudo docker image prune --all --force || true +} + +# Remove Swap storage +cleanSwap() { + sudo swapoff -a || true + sudo rm -rf /mnt/swapfile || true + free -h +} + +# Display initial disk space stats + +AVAILABLE_INITIAL=$(getAvailableSpace) + +printDF "BEFORE CLEAN-UP:" +echo "" +execAndMeasureSpaceChange cleanPackages "Unused packages" +execAndMeasureSpaceChange cleanDocker "Docker images" +execAndMeasureSpaceChange cleanSwap "Swap storage" +execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories" + +# Output saved space statistic +echo "" +printDF "AFTER CLEAN-UP:" + +echo "" +echo "" + +printSavedSpace "$AVAILABLE_INITIAL" "Total saved" diff --git a/src/ci/scripts/free-disk-space-windows.ps1 b/src/ci/scripts/free-disk-space-windows.ps1 new file mode 100644 index 000000000000..8a4677bd2ab4 --- /dev/null +++ b/src/ci/scripts/free-disk-space-windows.ps1 @@ -0,0 +1,35 @@ +# Free disk space on Windows GitHub action runners. + +$ErrorActionPreference = 'Stop' + +Get-Volume | Out-String | Write-Output + +$available = $(Get-Volume C).SizeRemaining + +$dirs = 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm', +'C:\rtools45', 'C:\ghcup', 'C:\Program Files (x86)\Android', +'C:\Program Files\Google\Chrome', 'C:\Program Files (x86)\Microsoft\Edge', +'C:\Program Files\Mozilla Firefox', 'C:\Program Files\MySQL', 'C:\Julia', +'C:\Program Files\MongoDB', 'C:\Program Files\Azure Cosmos DB Emulator', +'C:\Program Files\PostgreSQL', 'C:\Program Files\Unity Hub', +'C:\Strawberry', 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk' + +foreach ($dir in $dirs) { + Start-ThreadJob -InputObject $dir { + Remove-Item -Recurse -Force -LiteralPath $input + } | Out-Null +} + +foreach ($job in Get-Job) { + Wait-Job $job | Out-Null + if ($job.Error) { + Write-Output "::warning file=$PSCommandPath::$($job.Error)" + } + Remove-Job $job +} + +Get-Volume | Out-String | Write-Output + +$saved = ($(Get-Volume C).SizeRemaining - $available) / 1gb +$savedRounded = [math]::Round($saved, 3) +Write-Output "total space saved: $savedRounded GB" diff --git a/src/ci/scripts/free-disk-space.sh b/src/ci/scripts/free-disk-space.sh index 173f64858b37..062ad801cd8d 100755 --- a/src/ci/scripts/free-disk-space.sh +++ b/src/ci/scripts/free-disk-space.sh @@ -1,266 +1,10 @@ #!/bin/bash set -euo pipefail -# Free disk space on Linux GitHub action runners -# Script inspired by https://github.com/jlumbroso/free-disk-space +script_dir=$(dirname "$0") -isX86() { - local arch - arch=$(uname -m) - if [ "$arch" = "x86_64" ]; then - return 0 - else - return 1 - fi -} - -# Check if we're on a GitHub hosted runner. -# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted". -isGitHubRunner() { - # `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string". - if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then - return 0 - else - return 1 - fi -} - -# print a line of the specified character -printSeparationLine() { - for ((i = 0; i < 80; i++)); do - printf "%s" "$1" - done - printf "\n" -} - -# compute available space -# REF: https://unix.stackexchange.com/a/42049/60849 -# REF: https://stackoverflow.com/a/450821/408734 -getAvailableSpace() { - df -a | awk 'NR > 1 {avail+=$4} END {print avail}' -} - -# make Kb human readable (assume the input is Kb) -# REF: https://unix.stackexchange.com/a/44087/60849 -formatByteCount() { - numfmt --to=iec-i --suffix=B --padding=7 "${1}000" -} - -# macro to output saved space -printSavedSpace() { - # Disk space before the operation - local before=${1} - local title=${2:-} - - local after - after=$(getAvailableSpace) - local saved=$((after - before)) - - if [ "$saved" -lt 0 ]; then - echo "::warning::Saved space is negative: $saved. Using '0' as saved space." - saved=0 - fi - - echo "" - printSeparationLine "*" - if [ -n "${title}" ]; then - echo "=> ${title}: Saved $(formatByteCount "$saved")" - else - echo "=> Saved $(formatByteCount "$saved")" - fi - printSeparationLine "*" - echo "" -} - -# macro to print output of df with caption -printDF() { - local caption=${1} - - printSeparationLine "=" - echo "${caption}" - echo "" - echo "$ df -h" - echo "" - df -h - printSeparationLine "=" -} - -removeUnusedFilesAndDirs() { - local to_remove=( - "/usr/share/java" - ) - - if isGitHubRunner; then - to_remove+=( - "/usr/local/aws-sam-cli" - "/usr/local/doc/cmake" - "/usr/local/julia"* - "/usr/local/lib/android" - "/usr/local/share/chromedriver-"* - "/usr/local/share/chromium" - "/usr/local/share/cmake-"* - "/usr/local/share/edge_driver" - "/usr/local/share/emacs" - "/usr/local/share/gecko_driver" - "/usr/local/share/icons" - "/usr/local/share/powershell" - "/usr/local/share/vcpkg" - "/usr/local/share/vim" - "/usr/share/apache-maven-"* - "/usr/share/gradle-"* - "/usr/share/kotlinc" - "/usr/share/miniconda" - "/usr/share/php" - "/usr/share/ri" - "/usr/share/swift" - - # binaries - "/usr/local/bin/azcopy" - "/usr/local/bin/bicep" - "/usr/local/bin/ccmake" - "/usr/local/bin/cmake-"* - "/usr/local/bin/cmake" - "/usr/local/bin/cpack" - "/usr/local/bin/ctest" - "/usr/local/bin/helm" - "/usr/local/bin/kind" - "/usr/local/bin/kustomize" - "/usr/local/bin/minikube" - "/usr/local/bin/packer" - "/usr/local/bin/phpunit" - "/usr/local/bin/pulumi-"* - "/usr/local/bin/pulumi" - "/usr/local/bin/stack" - - # Haskell runtime - "/usr/local/.ghcup" - - # Azure - "/opt/az" - "/usr/share/az_"* - ) - - if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then - # Environment variable set by GitHub Actions - to_remove+=( - "${AGENT_TOOLSDIRECTORY}" - ) - else - echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal." - fi - else - # Remove folders and files present in AWS CodeBuild - to_remove+=( - # binaries - "/usr/local/bin/ecs-cli" - "/usr/local/bin/eksctl" - "/usr/local/bin/kubectl" - - "${HOME}/.gradle" - "${HOME}/.dotnet" - "${HOME}/.goenv" - "${HOME}/.phpenv" - - ) - fi - - for element in "${to_remove[@]}"; do - if [ ! -e "$element" ]; then - # The file or directory doesn't exist. - # Maybe it was removed in a newer version of the runner or it's not present in a - # specific architecture (e.g. ARM). - echo "::warning::Directory or file $element does not exist, skipping." - fi - done - - # Remove all files and directories at once to save time. - sudo rm -rf "${to_remove[@]}" -} - -execAndMeasureSpaceChange() { - local operation=${1} # Function to execute - local title=${2} - - local before - before=$(getAvailableSpace) - $operation - - printSavedSpace "$before" "$title" -} - -# Remove large packages -# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh -cleanPackages() { - local packages=( - '^aspnetcore-.*' - '^dotnet-.*' - '^llvm-.*' - '^mongodb-.*' - 'firefox' - 'libgl1-mesa-dri' - 'mono-devel' - 'php.*' - ) - - if isGitHubRunner; then - packages+=( - azure-cli - ) - - if isX86; then - packages+=( - 'google-chrome-stable' - 'google-cloud-cli' - 'google-cloud-sdk' - 'powershell' - ) - fi - else - packages+=( - 'google-chrome-stable' - ) - fi - - sudo apt-get -qq remove -y --fix-missing "${packages[@]}" - - sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed" - sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed failed" -} - -# Remove Docker images. -# Ubuntu 22 runners have docker images already installed. -# They aren't present in ubuntu 24 runners. -cleanDocker() { - echo "=> Removing the following docker images:" - sudo docker image ls - echo "=> Removing docker images..." - sudo docker image prune --all --force || true -} - -# Remove Swap storage -cleanSwap() { - sudo swapoff -a || true - sudo rm -rf /mnt/swapfile || true - free -h -} - -# Display initial disk space stats - -AVAILABLE_INITIAL=$(getAvailableSpace) - -printDF "BEFORE CLEAN-UP:" -echo "" - -execAndMeasureSpaceChange cleanPackages "Unused packages" -execAndMeasureSpaceChange cleanDocker "Docker images" -execAndMeasureSpaceChange cleanSwap "Swap storage" -execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories" - -# Output saved space statistic -echo "" -printDF "AFTER CLEAN-UP:" - -echo "" -echo "" - -printSavedSpace "$AVAILABLE_INITIAL" "Total saved" +if [[ "${RUNNER_OS:-}" == "Windows" ]]; then + pwsh $script_dir/free-disk-space-windows.ps1 +else + $script_dir/free-disk-space-linux.sh +fi diff --git a/src/ci/scripts/install-rust.sh b/src/ci/scripts/install-rust.sh deleted file mode 100755 index e4aee98c9fb2..000000000000 --- a/src/ci/scripts/install-rust.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# The Arm64 Windows Runner does not have Rust already installed -# https://github.com/actions/partner-runner-images/issues/77 - -set -euo pipefail -IFS=$'\n\t' - -source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" - -if [[ "${CI_JOB_NAME}" = *aarch64* ]] && isWindows; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ - sh -s -- -y -q --default-host aarch64-pc-windows-msvc - ciCommandAddPath "${USERPROFILE}/.cargo/bin" -fi diff --git a/src/doc/book b/src/doc/book index b2d1a0821e12..3e9dc46aa563 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit b2d1a0821e12a676b496d61891b8e3d374a8e832 +Subproject commit 3e9dc46aa563ca0c53ec826c41b05f10c5915925 diff --git a/src/doc/reference b/src/doc/reference index 1f45bd41fa6c..1be151c051a0 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 1f45bd41fa6c17b7c048ed6bfe5f168c4311206a +Subproject commit 1be151c051a082b542548c62cafbcb055fa8944f diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index e386be5f44af..bd1279cdc986 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit e386be5f44af711854207c11fdd61bb576270b04 +Subproject commit bd1279cdc9865bfff605e741fb76a0b2f07314a7 diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml index daf5223cbd4a..6eabb999fb01 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml @@ -17,7 +17,6 @@ jobs: MDBOOK_VERSION: 0.4.48 MDBOOK_LINKCHECK2_VERSION: 0.9.1 MDBOOK_MERMAID_VERSION: 0.12.6 - MDBOOK_TOC_VERSION: 0.11.2 MDBOOK_OUTPUT__LINKCHECK__FOLLOW_WEB_LINKS: ${{ github.event_name != 'pull_request' }} DEPLOY_DIR: book/html BASE_SHA: ${{ github.event.pull_request.base.sha }} @@ -34,7 +33,7 @@ jobs: with: path: | ~/.cargo/bin - key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }} + key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK2_VERSION }}--${{ env.MDBOOK_MERMAID_VERSION }} - name: Restore cached Linkcheck if: github.event_name == 'schedule' @@ -57,7 +56,6 @@ jobs: run: | cargo install mdbook --version ${{ env.MDBOOK_VERSION }} cargo install mdbook-linkcheck2 --version ${{ env.MDBOOK_LINKCHECK2_VERSION }} - cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }} cargo install mdbook-mermaid --version ${{ env.MDBOOK_MERMAID_VERSION }} - name: Check build diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index ad570ee4595d..04d6469aeaa4 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -11,10 +11,11 @@ jobs: if: github.repository == 'rust-lang/rustc-dev-guide' uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main with: + github-app-id: ${{ vars.APP_CLIENT_ID }} zulip-stream-id: 196385 zulip-bot-email: "rustc-dev-guide-gha-notif-bot@rust-lang.zulipchat.com" pr-base-branch: master branch-name: rustc-pull secrets: zulip-api-token: ${{ secrets.ZULIP_API_TOKEN }} - token: ${{ secrets.GITHUB_TOKEN }} + github-app-secret: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/src/doc/rustc-dev-guide/README.md b/src/doc/rustc-dev-guide/README.md index 5932da467ab2..1ad895aeda2e 100644 --- a/src/doc/rustc-dev-guide/README.md +++ b/src/doc/rustc-dev-guide/README.md @@ -43,7 +43,7 @@ rustdocs][rustdocs]. To build a local static HTML site, install [`mdbook`](https://github.com/rust-lang/mdBook) with: ``` -cargo install mdbook mdbook-linkcheck2 mdbook-toc mdbook-mermaid +cargo install mdbook mdbook-linkcheck2 mdbook-mermaid ``` and execute the following command in the root of the repository: @@ -67,8 +67,8 @@ ENABLE_LINKCHECK=1 mdbook serve ### Table of Contents -We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by -including the `` marker at the place where you want the TOC. +Each page has a TOC that is automatically generated by `pagetoc.js`. +There is an associated `pagetoc.css`, for styling. ## Synchronizing josh subtree with rustc diff --git a/src/doc/rustc-dev-guide/book.toml b/src/doc/rustc-dev-guide/book.toml index b84b1e7548a8..daf237ed9081 100644 --- a/src/doc/rustc-dev-guide/book.toml +++ b/src/doc/rustc-dev-guide/book.toml @@ -6,17 +6,18 @@ description = "A guide to developing the Rust compiler (rustc)" [build] create-missing = false -[preprocessor.toc] -command = "mdbook-toc" -renderer = ["html"] - [preprocessor.mermaid] command = "mdbook-mermaid" [output.html] git-repository-url = "https://github.com/rust-lang/rustc-dev-guide" edit-url-template = "https://github.com/rust-lang/rustc-dev-guide/edit/master/{path}" -additional-js = ["mermaid.min.js", "mermaid-init.js"] +additional-js = [ + "mermaid.min.js", + "mermaid-init.js", + "pagetoc.js", +] +additional-css = ["pagetoc.css"] [output.html.search] use-boolean-and = true diff --git a/src/doc/rustc-dev-guide/pagetoc.css b/src/doc/rustc-dev-guide/pagetoc.css new file mode 100644 index 000000000000..fa709194f375 --- /dev/null +++ b/src/doc/rustc-dev-guide/pagetoc.css @@ -0,0 +1,84 @@ +/* Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL) */ + +:root { + --toc-width: 270px; + --center-content-toc-shift: calc(-1 * var(--toc-width) / 2); +} + +.nav-chapters { + /* adjust width of buttons that bring to the previous or the next page */ + min-width: 50px; +} + +@media only screen { + @media (max-width: 1179px) { + .sidebar-hidden #sidetoc { + display: none; + } + } + + @media (max-width: 1439px) { + .sidebar-visible #sidetoc { + display: none; + } + } + + @media (1180px <= width <= 1439px) { + .sidebar-hidden main { + position: relative; + left: var(--center-content-toc-shift); + } + } + + @media (1440px <= width <= 1700px) { + .sidebar-visible main { + position: relative; + left: var(--center-content-toc-shift); + } + } + + #sidetoc { + margin-left: calc(100% + 20px); + } + #pagetoc { + position: fixed; + /* adjust TOC width */ + width: var(--toc-width); + height: calc(100vh - var(--menu-bar-height) - 0.67em * 4); + overflow: auto; + } + #pagetoc a { + border-left: 1px solid var(--sidebar-bg); + color: var(--fg); + display: block; + padding-bottom: 5px; + padding-top: 5px; + padding-left: 10px; + text-align: left; + text-decoration: none; + } + #pagetoc a:hover, + #pagetoc a.active { + background: var(--sidebar-bg); + color: var(--sidebar-active) !important; + } + #pagetoc .active { + background: var(--sidebar-bg); + color: var(--sidebar-active); + } + #pagetoc .pagetoc-H2 { + padding-left: 20px; + } + #pagetoc .pagetoc-H3 { + padding-left: 40px; + } + #pagetoc .pagetoc-H4 { + padding-left: 60px; + } +} + +@media print { + #sidetoc { + display: none; + } +} diff --git a/src/doc/rustc-dev-guide/pagetoc.js b/src/doc/rustc-dev-guide/pagetoc.js new file mode 100644 index 000000000000..927a5b10749b --- /dev/null +++ b/src/doc/rustc-dev-guide/pagetoc.js @@ -0,0 +1,104 @@ +// Inspired by https://github.com/JorelAli/mdBook-pagetoc/tree/98ee241 (under WTFPL) + +let activeHref = location.href; +function updatePageToc(elem = undefined) { + let selectedPageTocElem = elem; + const pagetoc = document.getElementById("pagetoc"); + + function getRect(element) { + return element.getBoundingClientRect(); + } + + function overflowTop(container, element) { + return getRect(container).top - getRect(element).top; + } + + function overflowBottom(container, element) { + return getRect(container).bottom - getRect(element).bottom; + } + + // We've not selected a heading to highlight, and the URL needs updating + // so we need to find a heading based on the URL + if (selectedPageTocElem === undefined && location.href !== activeHref) { + activeHref = location.href; + for (const pageTocElement of pagetoc.children) { + if (pageTocElement.href === activeHref) { + selectedPageTocElem = pageTocElement; + } + } + } + + // We still don't have a selected heading, let's try and find the most + // suitable heading based on the scroll position + if (selectedPageTocElem === undefined) { + const margin = window.innerHeight / 3; + + const headers = document.getElementsByClassName("header"); + for (let i = 0; i < headers.length; i++) { + const header = headers[i]; + if (selectedPageTocElem === undefined && getRect(header).top >= 0) { + if (getRect(header).top < margin) { + selectedPageTocElem = header; + } else { + selectedPageTocElem = headers[Math.max(0, i - 1)]; + } + } + // a very long last section's heading is over the screen + if (selectedPageTocElem === undefined && i === headers.length - 1) { + selectedPageTocElem = header; + } + } + } + + // Remove the active flag from all pagetoc elements + for (const pageTocElement of pagetoc.children) { + pageTocElement.classList.remove("active"); + } + + // If we have a selected heading, set it to active and scroll to it + if (selectedPageTocElem !== undefined) { + for (const pageTocElement of pagetoc.children) { + if (selectedPageTocElem.href.localeCompare(pageTocElement.href) === 0) { + pageTocElement.classList.add("active"); + if (overflowTop(pagetoc, pageTocElement) > 0) { + pagetoc.scrollTop = pageTocElement.offsetTop; + } + if (overflowBottom(pagetoc, pageTocElement) < 0) { + pagetoc.scrollTop -= overflowBottom(pagetoc, pageTocElement); + } + } + } + } +} + +if (document.getElementById("sidetoc") === null && + document.getElementsByClassName("header").length > 0) { + // The sidetoc element doesn't exist yet, let's create it + + // Create the empty sidetoc and pagetoc elements + const sidetoc = document.createElement("div"); + const pagetoc = document.createElement("div"); + sidetoc.id = "sidetoc"; + pagetoc.id = "pagetoc"; + sidetoc.appendChild(pagetoc); + + // And append them to the current DOM + const main = document.querySelector('main'); + main.insertBefore(sidetoc, main.firstChild); + + // Populate sidebar on load + window.addEventListener("load", () => { + for (const header of document.getElementsByClassName("header")) { + const link = document.createElement("a"); + link.innerHTML = header.innerHTML; + link.href = header.hash; + link.classList.add("pagetoc-" + header.parentElement.tagName); + document.getElementById("pagetoc").appendChild(link); + link.onclick = () => updatePageToc(link); + } + updatePageToc(); + }); + + // Update page table of contents selected heading on scroll + window.addEventListener("scroll", () => updatePageToc()); +} diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index ce9f984e637b..6ec700b9b4dc 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -efd420c770bb179537c01063e98cb6990c439654 +6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd diff --git a/src/doc/rustc-dev-guide/src/SUMMARY.md b/src/doc/rustc-dev-guide/src/SUMMARY.md index 651e2925ad50..9ded467d5cd7 100644 --- a/src/doc/rustc-dev-guide/src/SUMMARY.md +++ b/src/doc/rustc-dev-guide/src/SUMMARY.md @@ -53,7 +53,8 @@ - [Walkthrough: a typical contribution](./walkthrough.md) - [Implementing new language features](./implementing_new_features.md) - [Stability attributes](./stability.md) -- [Stabilizing Features](./stabilization_guide.md) +- [Stabilizing language features](./stabilization_guide.md) + - [Stabilization report template](./stabilization_report_template.md) - [Feature Gates](./feature-gates.md) - [Coding conventions](./conventions.md) - [Procedures for breaking changes](./bug-fix-procedure.md) @@ -175,6 +176,7 @@ - [Next-gen trait solving](./solve/trait-solving.md) - [Invariants of the type system](./solve/invariants.md) - [The solver](./solve/the-solver.md) + - [Candidate preference](./solve/candidate-preference.md) - [Canonicalization](./solve/canonicalization.md) - [Coinduction](./solve/coinduction.md) - [Caching](./solve/caching.md) diff --git a/src/doc/rustc-dev-guide/src/appendix/humorust.md b/src/doc/rustc-dev-guide/src/appendix/humorust.md index 6df3b212aa77..8681512ed56a 100644 --- a/src/doc/rustc-dev-guide/src/appendix/humorust.md +++ b/src/doc/rustc-dev-guide/src/appendix/humorust.md @@ -3,7 +3,7 @@ What's a project without a sense of humor? And frankly some of these are enlightening? -- [Weird exprs test](https://github.com/rust-lang/rust/blob/master/tests/ui/weird-exprs.rs) +- [Weird exprs test](https://github.com/rust-lang/rust/blob/master/tests/ui/expr/weird-exprs.rs) - [Ferris Rap](https://fitzgen.com/2018/12/13/rust-raps.html) - [The Genesis of Generic Germination](https://github.com/rust-lang/rust/pull/53645#issue-210543221) - [The Bastion of the Turbofish test](https://github.com/rust-lang/rust/blob/79d8a0fcefa5134db2a94739b1d18daa01fc6e9f/src/test/ui/bastion-of-the-turbofish.rs) diff --git a/src/doc/rustc-dev-guide/src/asm.md b/src/doc/rustc-dev-guide/src/asm.md index 1bb493e73d58..b5857d5465e1 100644 --- a/src/doc/rustc-dev-guide/src/asm.md +++ b/src/doc/rustc-dev-guide/src/asm.md @@ -1,7 +1,5 @@ # Inline assembly - - ## Overview Inline assembly in rustc mostly revolves around taking an `asm!` macro invocation and plumbing it diff --git a/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md b/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md index 0f81d3cb48a1..2fdda4eda99a 100644 --- a/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md +++ b/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md @@ -1,7 +1,5 @@ # Backend Agnostic Codegen - - [`rustc_codegen_ssa`] provides an abstract interface for all backends to implement, namely LLVM, [Cranelift], and [GCC]. diff --git a/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md b/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md index c5ee00813a34..9ca4bcab078e 100644 --- a/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md +++ b/src/doc/rustc-dev-guide/src/backend/implicit-caller-location.md @@ -1,7 +1,5 @@ # Implicit caller location - - Approved in [RFC 2091], this feature enables the accurate reporting of caller location during panics initiated from functions like `Option::unwrap`, `Result::expect`, and `Index::index`. This feature adds the [`#[track_caller]`][attr-reference] attribute for functions, the diff --git a/src/doc/rustc-dev-guide/src/backend/monomorph.md b/src/doc/rustc-dev-guide/src/backend/monomorph.md index 7ebb4d2b1e81..e9d98597ee0d 100644 --- a/src/doc/rustc-dev-guide/src/backend/monomorph.md +++ b/src/doc/rustc-dev-guide/src/backend/monomorph.md @@ -1,7 +1,5 @@ # Monomorphization - - As you probably know, Rust has a very expressive type system that has extensive support for generic types. But of course, assembly is not generic, so we need to figure out the concrete types of all the generics before the code can diff --git a/src/doc/rustc-dev-guide/src/backend/updating-llvm.md b/src/doc/rustc-dev-guide/src/backend/updating-llvm.md index 18c822aad790..ebef15d40baf 100644 --- a/src/doc/rustc-dev-guide/src/backend/updating-llvm.md +++ b/src/doc/rustc-dev-guide/src/backend/updating-llvm.md @@ -1,7 +1,5 @@ # Updating LLVM - - Rust supports building against multiple LLVM versions: diff --git a/src/doc/rustc-dev-guide/src/borrow_check/moves_and_initialization/move_paths.md b/src/doc/rustc-dev-guide/src/borrow_check/moves_and_initialization/move_paths.md index ad9c75d62960..95518fbc0184 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/moves_and_initialization/move_paths.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/moves_and_initialization/move_paths.md @@ -1,7 +1,5 @@ # Move paths - - In reality, it's not enough to track initialization at the granularity of local variables. Rust also allows us to do moves and initialization at the field granularity: diff --git a/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md b/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md index 85e71b4fa429..0d55ab955836 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/region_inference.md @@ -1,7 +1,5 @@ # Region inference (NLL) - - The MIR-based region checking code is located in [the `rustc_mir::borrow_check` module][nll]. diff --git a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/constraint_propagation.md b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/constraint_propagation.md index 4c30d25e0406..c3f8c03cb29f 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/constraint_propagation.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/constraint_propagation.md @@ -1,7 +1,5 @@ # Constraint propagation - - The main work of the region inference is **constraint propagation**, which is done in the [`propagate_constraints`] function. There are three sorts of constraints that are used in NLL, and we'll explain how diff --git a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/lifetime_parameters.md b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/lifetime_parameters.md index fadfac404569..2d337dbc020f 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/lifetime_parameters.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/lifetime_parameters.md @@ -1,7 +1,5 @@ # Universal regions - - "Universal regions" is the name that the code uses to refer to "named lifetimes" -- e.g., lifetime parameters and `'static`. The name derives from the fact that such lifetimes are "universally quantified" diff --git a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/member_constraints.md b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/member_constraints.md index fd7c87ffcea7..2804c97724f5 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/member_constraints.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/member_constraints.md @@ -1,7 +1,5 @@ # Member constraints - - A member constraint `'m member of ['c_1..'c_N]` expresses that the region `'m` must be *equal* to some **choice regions** `'c_i` (for some `i`). These constraints cannot be expressed by users, but they diff --git a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/placeholders_and_universes.md b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/placeholders_and_universes.md index 91c8c4526119..11fd2a5fc7db 100644 --- a/src/doc/rustc-dev-guide/src/borrow_check/region_inference/placeholders_and_universes.md +++ b/src/doc/rustc-dev-guide/src/borrow_check/region_inference/placeholders_and_universes.md @@ -1,7 +1,5 @@ # Placeholders and universes - - From time to time we have to reason about regions that we can't concretely know. For example, consider this program: diff --git a/src/doc/rustc-dev-guide/src/bug-fix-procedure.md b/src/doc/rustc-dev-guide/src/bug-fix-procedure.md index 55436261fdef..6b13c97023f5 100644 --- a/src/doc/rustc-dev-guide/src/bug-fix-procedure.md +++ b/src/doc/rustc-dev-guide/src/bug-fix-procedure.md @@ -1,7 +1,5 @@ # Procedures for breaking changes - - This page defines the best practices procedure for making bug fixes or soundness corrections in the compiler that can cause existing code to stop compiling. This text is based on diff --git a/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md b/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md index c9c0d64a604e..9c5ebbd36c46 100644 --- a/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md +++ b/src/doc/rustc-dev-guide/src/building/bootstrapping/debugging-bootstrap.md @@ -123,6 +123,12 @@ if [#96176][cleanup-compiler-for] is resolved. [cleanup-compiler-for]: https://github.com/rust-lang/rust/issues/96176 +### Rendering step graph + +When you run bootstrap with the `BOOTSTRAP_TRACING` environment variable configured, bootstrap will automatically output a DOT file that shows all executed steps and their dependencies. The files will have a prefix `bootstrap-steps`. You can use e.g. `xdot` to visualize the file or e.g. `dot -Tsvg` to convert the DOT file to a SVG file. + +A separate DOT file will be outputted for dry-run and non-dry-run execution. + ### Using `tracing` in bootstrap Both `tracing::*` macros and the `tracing::instrument` proc-macro attribute need to be gated behind `tracing` feature. Examples: diff --git a/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md b/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md index 2793ad438152..da425d8d39bb 100644 --- a/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md +++ b/src/doc/rustc-dev-guide/src/building/bootstrapping/what-bootstrapping-does.md @@ -1,7 +1,5 @@ # What Bootstrapping does - - [*Bootstrapping*][boot] is the process of using a compiler to compile itself. More accurately, it means using an older compiler to compile a newer version of the same compiler. diff --git a/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md b/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md index d29cd1448102..b07d3533f59b 100644 --- a/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md +++ b/src/doc/rustc-dev-guide/src/building/how-to-build-and-run.md @@ -1,7 +1,5 @@ # How to build and run the compiler - -

For `profile = "library"` users, or users who use `download-rustc = true | "if-unchanged"`, please be advised that diff --git a/src/doc/rustc-dev-guide/src/building/new-target.md b/src/doc/rustc-dev-guide/src/building/new-target.md index e11a2cd8ee57..436aec8ee265 100644 --- a/src/doc/rustc-dev-guide/src/building/new-target.md +++ b/src/doc/rustc-dev-guide/src/building/new-target.md @@ -6,8 +6,6 @@ relevant to your desired goal. See also the associated documentation in the [target tier policy]. - - [target tier policy]: https://doc.rust-lang.org/rustc/target-tier-policy.html#adding-a-new-target ## Specifying a new LLVM diff --git a/src/doc/rustc-dev-guide/src/building/optimized-build.md b/src/doc/rustc-dev-guide/src/building/optimized-build.md index 62dfaca89d24..863ed9749fb7 100644 --- a/src/doc/rustc-dev-guide/src/building/optimized-build.md +++ b/src/doc/rustc-dev-guide/src/building/optimized-build.md @@ -1,7 +1,5 @@ # Optimized build of the compiler - - There are multiple additional build configuration options and techniques that can be used to compile a build of `rustc` that is as optimized as possible (for example when building `rustc` for a Linux distribution). The status of these configuration options for various Rust targets is tracked [here]. diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index c046161e77f2..35c7e935b568 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -3,8 +3,6 @@ The full bootstrapping process takes quite a while. Here are some suggestions to make your life easier. - - ## Installing a pre-push hook CI will automatically fail your build if it doesn't pass `tidy`, our internal diff --git a/src/doc/rustc-dev-guide/src/compiler-debugging.md b/src/doc/rustc-dev-guide/src/compiler-debugging.md index 102e20207792..edd2aa6c5f64 100644 --- a/src/doc/rustc-dev-guide/src/compiler-debugging.md +++ b/src/doc/rustc-dev-guide/src/compiler-debugging.md @@ -1,7 +1,5 @@ # Debugging the compiler - - This chapter contains a few tips to debug the compiler. These tips aim to be useful no matter what you are working on. Some of the other chapters have advice about specific parts of the compiler (e.g. the [Queries Debugging and diff --git a/src/doc/rustc-dev-guide/src/compiler-src.md b/src/doc/rustc-dev-guide/src/compiler-src.md index 00aa96226849..d67bacb1b339 100644 --- a/src/doc/rustc-dev-guide/src/compiler-src.md +++ b/src/doc/rustc-dev-guide/src/compiler-src.md @@ -1,7 +1,5 @@ # High-level overview of the compiler source - - Now that we have [seen what the compiler does][orgch], let's take a look at the structure of the [`rust-lang/rust`] repository, where the rustc source code lives. diff --git a/src/doc/rustc-dev-guide/src/const-eval/interpret.md b/src/doc/rustc-dev-guide/src/const-eval/interpret.md index 51a539de5cb6..08382b12ff00 100644 --- a/src/doc/rustc-dev-guide/src/const-eval/interpret.md +++ b/src/doc/rustc-dev-guide/src/const-eval/interpret.md @@ -1,7 +1,5 @@ # Interpreter - - The interpreter is a virtual machine for executing MIR without compiling to machine code. It is usually invoked via `tcx.const_eval_*` functions. The interpreter is shared between the compiler (for compile-time function diff --git a/src/doc/rustc-dev-guide/src/contributing.md b/src/doc/rustc-dev-guide/src/contributing.md index b3fcd79ec818..963bef3af8de 100644 --- a/src/doc/rustc-dev-guide/src/contributing.md +++ b/src/doc/rustc-dev-guide/src/contributing.md @@ -1,7 +1,5 @@ # Contribution procedures - - ## Bug reports While bugs are unfortunate, they're a reality in software. We can't fix what we diff --git a/src/doc/rustc-dev-guide/src/coroutine-closures.md b/src/doc/rustc-dev-guide/src/coroutine-closures.md index 48cdba44a9f5..2617c824a391 100644 --- a/src/doc/rustc-dev-guide/src/coroutine-closures.md +++ b/src/doc/rustc-dev-guide/src/coroutine-closures.md @@ -1,7 +1,5 @@ # Async closures/"coroutine-closures" - - Please read [RFC 3668](https://rust-lang.github.io/rfcs/3668-async-closures.html) to understand the general motivation of the feature. This is a very technical and somewhat "vertical" chapter; ideally we'd split this and sprinkle it across all the relevant chapters, but for the purposes of understanding async closures *holistically*, I've put this together all here in one chapter. ## Coroutine-closures -- a technical deep dive diff --git a/src/doc/rustc-dev-guide/src/crates-io.md b/src/doc/rustc-dev-guide/src/crates-io.md index 4431585a2f02..677b1fc03134 100644 --- a/src/doc/rustc-dev-guide/src/crates-io.md +++ b/src/doc/rustc-dev-guide/src/crates-io.md @@ -11,7 +11,7 @@ you should avoid adding dependencies to the compiler for several reasons: - The dependency may have transitive dependencies that have one of the above problems. - + Note that there is no official policy for vetting new dependencies to the compiler. Decisions are made on a case-by-case basis, during code review. diff --git a/src/doc/rustc-dev-guide/src/debugging-support-in-rustc.md b/src/doc/rustc-dev-guide/src/debugging-support-in-rustc.md index ac629934e0a4..bd4f795ce03b 100644 --- a/src/doc/rustc-dev-guide/src/debugging-support-in-rustc.md +++ b/src/doc/rustc-dev-guide/src/debugging-support-in-rustc.md @@ -1,7 +1,5 @@ # Debugging support in the Rust compiler - - This document explains the state of debugging tools support in the Rust compiler (rustc). It gives an overview of GDB, LLDB, WinDbg/CDB, as well as infrastructure around Rust compiler to debug Rust code. diff --git a/src/doc/rustc-dev-guide/src/diagnostics.md b/src/doc/rustc-dev-guide/src/diagnostics.md index 33f5441d36e4..82191e0a6eaf 100644 --- a/src/doc/rustc-dev-guide/src/diagnostics.md +++ b/src/doc/rustc-dev-guide/src/diagnostics.md @@ -1,7 +1,5 @@ # Errors and lints - - A lot of effort has been put into making `rustc` have great error messages. This chapter is about how to emit compile errors and lints from the compiler. diff --git a/src/doc/rustc-dev-guide/src/early_late_parameters.md b/src/doc/rustc-dev-guide/src/early_late_parameters.md index 3f94b0905668..c472bdc2c481 100644 --- a/src/doc/rustc-dev-guide/src/early_late_parameters.md +++ b/src/doc/rustc-dev-guide/src/early_late_parameters.md @@ -1,8 +1,6 @@ # Early vs Late bound parameters - - > **NOTE**: This chapter largely talks about early/late bound as being solely relevant when discussing function item types/function definitions. This is potentially not completely true, async blocks and closures should likely be discussed somewhat in this chapter. ## What does it mean to be "early" bound or "late" bound diff --git a/src/doc/rustc-dev-guide/src/getting-started.md b/src/doc/rustc-dev-guide/src/getting-started.md index d6c5c3ac8521..04d2e37732fa 100644 --- a/src/doc/rustc-dev-guide/src/getting-started.md +++ b/src/doc/rustc-dev-guide/src/getting-started.md @@ -3,8 +3,6 @@ Thank you for your interest in contributing to Rust! There are many ways to contribute, and we appreciate all of them. - - If this is your first time contributing, the [walkthrough] chapter can give you a good example of how a typical contribution would go. diff --git a/src/doc/rustc-dev-guide/src/git.md b/src/doc/rustc-dev-guide/src/git.md index 8726ddfce20c..447c6fd45467 100644 --- a/src/doc/rustc-dev-guide/src/git.md +++ b/src/doc/rustc-dev-guide/src/git.md @@ -1,7 +1,5 @@ # Using Git - - The Rust project uses [Git] to manage its source code. In order to contribute, you'll need some familiarity with its features so that your changes can be incorporated into the compiler. diff --git a/src/doc/rustc-dev-guide/src/guides/editions.md b/src/doc/rustc-dev-guide/src/guides/editions.md index 9a92d4ebcb51..b65fbb13cd18 100644 --- a/src/doc/rustc-dev-guide/src/guides/editions.md +++ b/src/doc/rustc-dev-guide/src/guides/editions.md @@ -1,7 +1,5 @@ # Editions - - This chapter gives an overview of how Edition support works in rustc. This assumes that you are familiar with what Editions are (see the [Edition Guide]). diff --git a/src/doc/rustc-dev-guide/src/hir.md b/src/doc/rustc-dev-guide/src/hir.md index 72fb10701574..38ba33112f2e 100644 --- a/src/doc/rustc-dev-guide/src/hir.md +++ b/src/doc/rustc-dev-guide/src/hir.md @@ -1,7 +1,5 @@ # The HIR - - The HIR – "High-Level Intermediate Representation" – is the primary IR used in most of rustc. It is a compiler-friendly representation of the abstract syntax tree (AST) that is generated after parsing, macro expansion, and name diff --git a/src/doc/rustc-dev-guide/src/implementing_new_features.md b/src/doc/rustc-dev-guide/src/implementing_new_features.md index 5d0e875cbc18..00bce8599e43 100644 --- a/src/doc/rustc-dev-guide/src/implementing_new_features.md +++ b/src/doc/rustc-dev-guide/src/implementing_new_features.md @@ -1,146 +1,90 @@ # Implementing new language features - +When you want to implement a new significant feature in the compiler, you need to go through this process to make sure everything goes smoothly. -When you want to implement a new significant feature in the compiler, -you need to go through this process to make sure everything goes -smoothly. +**NOTE: This section is for *language* features, not *library* features, which use [a different process].** -**NOTE: this section is for *language* features, not *library* features, -which use [a different process].** - -See also [the Rust Language Design Team's procedures][lang-propose] for -proposing changes to the language. +See also [the Rust Language Design Team's procedures][lang-propose] for proposing changes to the language. [a different process]: ./stability.md [lang-propose]: https://lang-team.rust-lang.org/how_to/propose.html ## The @rfcbot FCP process -When the change is small and uncontroversial, then it can be done -with just writing a PR and getting an r+ from someone who knows that -part of the code. However, if the change is potentially controversial, -it would be a bad idea to push it without consensus from the rest -of the team (both in the "distributed system" sense to make sure -you don't break anything you don't know about, and in the social -sense to avoid PR fights). +When the change is small, uncontroversial, non-breaking, and does not affect the stable language in any user-observable ways or add any new unstable features, then it can be done with just writing a PR and getting an r+ from someone who knows that part of the code. However, if not, more must be done. Even for compiler-internal work, it would be a bad idea to push a controversial change without consensus from the rest of the team (both in the "distributed system" sense to make sure you don't break anything you don't know about, and in the social sense to avoid PR fights). -If such a change seems to be too small to require a full formal RFC process -(e.g., a small standard library addition, a big refactoring of the code, a -"technically-breaking" change, or a "big bugfix" that basically amounts to a -small feature) but is still too controversial or big to get by with a single r+, -you can propose a final comment period (FCP). Or, if you're not on the relevant -team (and thus don't have @rfcbot permissions), ask someone who is to start one; -unless they have a concern themselves, they should. +For changes that need the consensus of a team, we us the process of proposing a final comment period (FCP). If you're not on the relevant team (and thus don't have @rfcbot permissions), ask someone who is to start one; unless they have a concern themselves, they should. -Again, the FCP process is only needed if you need consensus – if you -don't think anyone would have a problem with your change, it's OK to -get by with only an r+. For example, it is OK to add or modify -unstable command-line flags or attributes without an FCP for -compiler development or standard library use, as long as you don't -expect them to be in wide use in the nightly ecosystem. -Some teams have lighter weight processes that they use in scenarios -like this; for example, the compiler team recommends -filing a Major Change Proposal ([MCP][mcp]) as a lightweight way to -garner support and feedback without requiring full consensus. +The FCP process is only needed if you need consensus – if no processes require consensus for your change and you don't think anyone would have a problem with it, it's OK to rely on only an r+. For example, it is OK to add or modify unstable command-line flags or attributes in the reserved compiler-internal `rustc_` namespace without an FCP for compiler development or standard library use, as long as you don't expect them to be in wide use in the nightly ecosystem. Some teams have lighter weight processes that they use in scenarios like this; for example, the compiler team recommends filing a Major Change Proposal ([MCP][mcp]) as a lightweight way to garner support and feedback without requiring full consensus. [mcp]: https://forge.rust-lang.org/compiler/proposals-and-stabilization.html#how-do-i-submit-an-mcp -You don't need to have the implementation fully ready for r+ to propose an FCP, -but it is generally a good idea to have at least a proof -of concept so that people can see what you are talking about. +You don't need to have the implementation fully ready for r+ to propose an FCP, but it is generally a good idea to have at least a proof of concept so that people can see what you are talking about. -When an FCP is proposed, it requires all members of the team to sign off the -FCP. After they all do so, there's a 10-day-long "final comment period" (hence -the name) where everybody can comment, and if no concerns are raised, the -PR/issue gets FCP approval. +When an FCP is proposed, it requires all members of the team to sign off on the FCP. After they all do so, there's a 10-day-long "final comment period" (hence the name) where everybody can comment, and if no concerns are raised, the PR/issue gets FCP approval. ## The logistics of writing features -There are a few "logistic" hoops you might need to go through in -order to implement a feature in a working way. +There are a few "logistical" hoops you might need to go through in order to implement a feature in a working way. ### Warning Cycles -In some cases, a feature or bugfix might break some existing programs -in some edge cases. In that case, you might want to do a crater run -to assess the impact and possibly add a future-compatibility lint, -similar to those used for -[edition-gated lints](diagnostics.md#edition-gated-lints). +In some cases, a feature or bugfix might break some existing programs in some edge cases. In that case, you'll want to do a crater run to assess the impact and possibly add a future-compatibility lint, similar to those used for [edition-gated lints](diagnostics.md#edition-gated-lints). ### Stability -We [value the stability of Rust]. Code that works and runs on stable -should (mostly) not break. Because of that, we don't want to release -a feature to the world with only team consensus and code review - -we want to gain real-world experience on using that feature on nightly, -and we might want to change the feature based on that experience. +We [value the stability of Rust]. Code that works and runs on stable should (mostly) not break. Because of that, we don't want to release a feature to the world with only team consensus and code review - we want to gain real-world experience on using that feature on nightly, and we might want to change the feature based on that experience. -To allow for that, we must make sure users don't accidentally depend -on that new feature - otherwise, especially if experimentation takes -time or is delayed and the feature takes the trains to stable, -it would end up de facto stable and we'll not be able to make changes -in it without breaking people's code. +To allow for that, we must make sure users don't accidentally depend on that new feature - otherwise, especially if experimentation takes time or is delayed and the feature takes the trains to stable, it would end up de facto stable and we'll not be able to make changes in it without breaking people's code. -The way we do that is that we make sure all new features are feature -gated - they can't be used without enabling a feature gate -(`#[feature(foo)]`), which can't be done in a stable/beta compiler. -See the [stability in code] section for the technical details. +The way we do that is that we make sure all new features are feature gated - they can't be used without enabling a feature gate (`#[feature(foo)]`), which can't be done in a stable/beta compiler. See the [stability in code] section for the technical details. -Eventually, after we gain enough experience using the feature, -make the necessary changes, and are satisfied, we expose it to -the world using the stabilization process described [here]. -Until then, the feature is not set in stone: every part of the -feature can be changed, or the feature might be completely -rewritten or removed. Features are not supposed to gain tenure -by being unstable and unchanged for a year. +Eventually, after we gain enough experience using the feature, make the necessary changes, and are satisfied, we expose it to the world using the stabilization process described [here]. Until then, the feature is not set in stone: every part of the feature can be changed, or the feature might be completely rewritten or removed. Features do not gain tenure by being unstable and unchanged for long periods of time. ### Tracking Issues -To keep track of the status of an unstable feature, the -experience we get while using it on nightly, and of the -concerns that block its stabilization, every feature-gate -needs a tracking issue. General discussions about the feature should be done on the tracking issue. +To keep track of the status of an unstable feature, the experience we get while using it on +nightly, and of the concerns that block its stabilization, every feature-gate needs a tracking +issue. When creating issues and PRs related to the feature, reference this tracking issue, and when there are updates about the feature's progress, post those to the tracking issue. -For features that have an RFC, you should use the RFC's -tracking issue for the feature. +For features that are part of an accept RFC or approved lang experiment, use the tracking issue for that. -For other features, you'll have to make a tracking issue -for that feature. The issue title should be "Tracking issue -for YOUR FEATURE". Use the ["Tracking Issue" issue template][template]. +For other features, create a tracking issue for that feature. The issue title should be "Tracking issue for YOUR FEATURE". Use the ["Tracking Issue" issue template][template]. [template]: https://github.com/rust-lang/rust/issues/new?template=tracking_issue.md +### Lang experiments + +To land in the compiler, features that have user-visible effects on the language (even unstable ones) must either be part of an accepted RFC or an approved [lang experiment]. + +To propose a new lang experiment, open an issue in `rust-lang/rust` that describes the motivation and the intended solution. If it's accepted, this issue will become the tracking issue for the experiment, so use the tracking issue [template] while also including these other details. Nominate the issue for the lang team and CC `@rust-lang/lang` and `@rust-lang/lang-advisors`. When the experiment is approved, the tracking issue will be marked as `B-experimental`. + +Feature flags related to a lang experiment must be marked as `incomplete` until an RFC is accepted for the feature. + +[lang experiment]: https://lang-team.rust-lang.org/how_to/experiment.html + ## Stability in code -The below steps needs to be followed in order to implement -a new unstable feature: +The below steps needs to be followed in order to implement a new unstable feature: -1. Open a [tracking issue] - - if you have an RFC, you can use the tracking issue for the RFC. +1. Open or identify the [tracking issue]. For features that are part of an accept RFC or approved lang experiment, use the tracking issue for that. - The tracking issue should be labeled with at least `C-tracking-issue`. - For a language feature, a label `F-feature_name` should be added as well. + Label the tracking issue with `C-tracking-issue` and the relevant `F-feature_name` label (adding that label if needed). -1. Pick a name for the feature gate (for RFCs, use the name - in the RFC). +1. Pick a name for the feature gate (for RFCs, use the name in the RFC). 1. Add the feature name to `rustc_span/src/symbol.rs` in the `Symbols {...}` block. Note that this block must be in alphabetical order. -1. Add a feature gate declaration to `rustc_feature/src/unstable.rs` in the unstable - `declare_features` block. +1. Add a feature gate declaration to `rustc_feature/src/unstable.rs` in the unstable `declare_features` block. ```rust ignore /// description of feature (unstable, $feature_name, "CURRENT_RUSTC_VERSION", Some($tracking_issue_number)) ``` - If you haven't yet - opened a tracking issue (e.g. because you want initial feedback on whether the feature is likely - to be accepted), you can temporarily use `None` - but make sure to update it before the PR is - merged! + If you haven't yet opened a tracking issue (e.g. because you want initial feedback on whether the feature is likely to be accepted), you can temporarily use `None` - but make sure to update it before the PR is merged! For example: @@ -149,9 +93,7 @@ a new unstable feature: (unstable, non_ascii_idents, "CURRENT_RUSTC_VERSION", Some(55467), None), ``` - Features can be marked as incomplete, and trigger the warn-by-default [`incomplete_features` - lint] - by setting their type to `incomplete`: + Features can be marked as incomplete, and trigger the warn-by-default [`incomplete_features` lint] by setting their type to `incomplete`: [`incomplete_features` lint]: https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#incomplete-features @@ -160,42 +102,27 @@ a new unstable feature: (incomplete, deref_patterns, "CURRENT_RUSTC_VERSION", Some(87121), None), ``` - To avoid [semantic merge conflicts], please use `CURRENT_RUSTC_VERSION` instead of `1.70` or - another explicit version number. + Feature flags related to a lang experiment must be marked as `incomplete` until an RFC is accepted for the feature. + + To avoid [semantic merge conflicts], use `CURRENT_RUSTC_VERSION` instead of `1.70` or another explicit version number. [semantic merge conflicts]: https://bors.tech/essay/2017/02/02/pitch/ -1. Prevent usage of the new feature unless the feature gate is set. - You can check it in most places in the compiler using the - expression `tcx.features().$feature_name()` +1. Prevent usage of the new feature unless the feature gate is set. You can check it in most places in the compiler using the expression `tcx.features().$feature_name()`. - If the feature gate is not set, you should either maintain - the pre-feature behavior or raise an error, depending on - what makes sense. Errors should generally use [`rustc_session::parse::feature_err`]. - For an example of adding an error, see [#81015]. + If the feature gate is not set, you should either maintain the pre-feature behavior or raise an error, depending on what makes sense. Errors should generally use [`rustc_session::parse::feature_err`]. For an example of adding an error, see [#81015]. - For features introducing new syntax, pre-expansion gating should be used instead. - During parsing, when the new syntax is parsed, the symbol must be inserted to the - current crate's [`GatedSpans`] via `self.sess.gated_span.gate(sym::my_feature, span)`. - - After being inserted to the gated spans, the span must be checked in the - [`rustc_ast_passes::feature_gate::check_crate`] function, which actually denies - features. Exactly how it is gated depends on the exact type of feature, but most - likely will use the `gate_all!()` macro. + For features introducing new syntax, pre-expansion gating should be used instead. During parsing, when the new syntax is parsed, the symbol must be inserted to the current crate's [`GatedSpans`] via `self.sess.gated_span.gate(sym::my_feature, span)`. -1. Add a test to ensure the feature cannot be used without - a feature gate, by creating `tests/ui/feature-gates/feature-gate-$feature_name.rs`. - You can generate the corresponding `.stderr` file by running `./x test -tests/ui/feature-gates/ --bless`. + After being inserted to the gated spans, the span must be checked in the [`rustc_ast_passes::feature_gate::check_crate`] function, which actually denies features. Exactly how it is gated depends on the exact type of feature, but most likely will use the `gate_all!()` macro. -1. Add a section to the unstable book, in - `src/doc/unstable-book/src/language-features/$feature_name.md`. +1. Add a test to ensure the feature cannot be used without a feature gate, by creating `tests/ui/feature-gates/feature-gate-$feature_name.rs`. You can generate the corresponding `.stderr` file by running `./x test tests/ui/feature-gates/ --bless`. -1. Write a lot of tests for the new feature, preferably in `tests/ui/$feature_name/`. - PRs without tests will not be accepted! +1. Add a section to the unstable book, in `src/doc/unstable-book/src/language-features/$feature_name.md`. -1. Get your PR reviewed and land it. You have now successfully - implemented a feature in Rust! +1. Write a lot of tests for the new feature, preferably in `tests/ui/$feature_name/`. PRs without tests will not be accepted! + +1. Get your PR reviewed and land it. You have now successfully implemented a feature in Rust! [`GatedSpans`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/struct.GatedSpans.html [#81015]: https://github.com/rust-lang/rust/pull/81015 @@ -206,3 +133,42 @@ tests/ui/feature-gates/ --bless`. [here]: ./stabilization_guide.md [tracking issue]: #tracking-issues [add-feature-gate]: ./feature-gates.md#adding-a-feature-gate + +## Call for testing + +Once the implementation is complete, the feature will be available to nightly users but not yet part of stable Rust. This is a good time to write a blog post on [the main Rust blog][rust-blog] and issue a "call for testing". + +Some earlier such blog posts include: + +1. [The push for GATs stabilization](https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push/) +2. [Changes to `impl Trait` in Rust 2024](https://blog.rust-lang.org/2024/09/05/impl-trait-capture-rules.html) +3. [Async Closures MVP: Call for Testing!](https://blog.rust-lang.org/inside-rust/2024/08/09/async-closures-call-for-testing/) + +Alternatively, [*This Week in Rust*][twir] has a [section][twir-cft] for this. One example of this having been used is: + +- [Call for testing on boolean literals as cfg predicates](https://github.com/rust-lang/rust/issues/131204#issuecomment-2569314526) + +Which option to choose might depend on how significant the language change is, though note that the [*This Week in Rust*][twir] section might be less visible than a dedicated post on the main Rust blog. + +## Polishing + +Giving users a polished experience means more than just implementing the feature in rustc. We need to think about all of the tools and resources that we ship. This work includes: + +- Documenting the language feature in the [Rust Reference][reference]. +- Extending [`rustfmt`] to format any new syntax (if applicable). +- Extending [`rust-analyzer`] (if applicable). The extent of this work can depend on the nature of the language feature, as some features don't need to be blocked on *full* support. + - When a language feature degrades the user experience simply by existing before support is implemented in [`rust-analyzer`], that may lead the lang team to raise a blocking concern. + - Examples of such might include new syntax that [`rust-analyzer`] can't parse or type inference changes it doesn't understand when those lead to bogus diagnostics. + +## Stabilization + +The final step in the feature lifecycle is [stabilization][stab], which is when the feature becomes available to all Rust users. At this point, backward incompatible changes are generally no longer permitted (see the lang team's [defined semver policies](https://rust-lang.github.io/rfcs/1122-language-semver.html) for details). To learn more about stabilization, see the [stabilization guide][stab]. + + +[stab]: ./stabilization_guide.md +[rust-blog]: https://github.com/rust-lang/blog.rust-lang.org/ +[twir]: https://github.com/rust-lang/this-week-in-rust +[twir-cft]: https://this-week-in-rust.org/blog/2025/01/22/this-week-in-rust-583/#calls-for-testing +[`rustfmt`]: https://github.com/rust-lang/rustfmt +[`rust-analyzer`]: https://github.com/rust-lang/rust-analyzer +[reference]: https://github.com/rust-lang/reference diff --git a/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md b/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md index 880363b94bf2..288b90f33c3d 100644 --- a/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md +++ b/src/doc/rustc-dev-guide/src/llvm-coverage-instrumentation.md @@ -1,7 +1,5 @@ # LLVM source-based code coverage - - `rustc` supports detailed source-based code and test coverage analysis with a command line option (`-C instrument-coverage`) that instruments Rust libraries and binaries with additional instructions and data, at compile time. diff --git a/src/doc/rustc-dev-guide/src/macro-expansion.md b/src/doc/rustc-dev-guide/src/macro-expansion.md index a90f717004f0..54d6d2b4e813 100644 --- a/src/doc/rustc-dev-guide/src/macro-expansion.md +++ b/src/doc/rustc-dev-guide/src/macro-expansion.md @@ -1,7 +1,5 @@ # Macro expansion - - Rust has a very powerful macro system. In the previous chapter, we saw how the parser sets aside macros to be expanded (using temporary [placeholders]). This chapter is about the process of expanding those macros iteratively until diff --git a/src/doc/rustc-dev-guide/src/mir/construction.md b/src/doc/rustc-dev-guide/src/mir/construction.md index f2559a22b955..8360d9ff1a8b 100644 --- a/src/doc/rustc-dev-guide/src/mir/construction.md +++ b/src/doc/rustc-dev-guide/src/mir/construction.md @@ -1,7 +1,5 @@ # MIR construction - - The lowering of [HIR] to [MIR] occurs for the following (probably incomplete) list of items: diff --git a/src/doc/rustc-dev-guide/src/mir/dataflow.md b/src/doc/rustc-dev-guide/src/mir/dataflow.md index 85e57dd839b8..970e61196c12 100644 --- a/src/doc/rustc-dev-guide/src/mir/dataflow.md +++ b/src/doc/rustc-dev-guide/src/mir/dataflow.md @@ -1,7 +1,5 @@ # Dataflow Analysis - - If you work on the MIR, you will frequently come across various flavors of [dataflow analysis][wiki]. `rustc` uses dataflow to find uninitialized variables, determine what variables are live across a generator `yield` diff --git a/src/doc/rustc-dev-guide/src/mir/drop-elaboration.md b/src/doc/rustc-dev-guide/src/mir/drop-elaboration.md index 3b321fd44d1d..4da612c83f0f 100644 --- a/src/doc/rustc-dev-guide/src/mir/drop-elaboration.md +++ b/src/doc/rustc-dev-guide/src/mir/drop-elaboration.md @@ -1,7 +1,5 @@ # Drop elaboration - - ## Dynamic drops According to the [reference][reference-drop]: diff --git a/src/doc/rustc-dev-guide/src/mir/index.md b/src/doc/rustc-dev-guide/src/mir/index.md index f355875aa156..8ba5f3ac8b78 100644 --- a/src/doc/rustc-dev-guide/src/mir/index.md +++ b/src/doc/rustc-dev-guide/src/mir/index.md @@ -1,7 +1,5 @@ # The MIR (Mid-level IR) - - MIR is Rust's _Mid-level Intermediate Representation_. It is constructed from [HIR](../hir.html). MIR was introduced in [RFC 1211]. It is a radically simplified form of Rust that is used for diff --git a/src/doc/rustc-dev-guide/src/name-resolution.md b/src/doc/rustc-dev-guide/src/name-resolution.md index 719ebce85536..2e96382f7797 100644 --- a/src/doc/rustc-dev-guide/src/name-resolution.md +++ b/src/doc/rustc-dev-guide/src/name-resolution.md @@ -1,7 +1,5 @@ # Name resolution - - In the previous chapters, we saw how the [*Abstract Syntax Tree* (`AST`)][ast] is built with all macros expanded. We saw how doing that requires doing some name resolution to resolve imports and macro names. In this chapter, we show diff --git a/src/doc/rustc-dev-guide/src/normalization.md b/src/doc/rustc-dev-guide/src/normalization.md index eb0962a41223..53e20f1c0db7 100644 --- a/src/doc/rustc-dev-guide/src/normalization.md +++ b/src/doc/rustc-dev-guide/src/normalization.md @@ -1,7 +1,5 @@ # Aliases and Normalization - - ## Aliases In Rust there are a number of types that are considered equal to some "underlying" type, for example inherent associated types, trait associated types, free type aliases (`type Foo = u32`), and opaque types (`-> impl RPIT`). We consider such types to be "aliases", alias types are represented by the [`TyKind::Alias`][tykind_alias] variant, with the kind of alias tracked by the [`AliasTyKind`][aliaskind] enum. diff --git a/src/doc/rustc-dev-guide/src/offload/installation.md b/src/doc/rustc-dev-guide/src/offload/installation.md index 1e792de3c8ce..b376e962ff63 100644 --- a/src/doc/rustc-dev-guide/src/offload/installation.md +++ b/src/doc/rustc-dev-guide/src/offload/installation.md @@ -8,7 +8,7 @@ First you need to clone and configure the Rust repository: ```bash git clone git@github.com:rust-lang/rust cd rust -./configure --enable-llvm-link-shared --release-channel=nightly --enable-llvm-assertions --enable-offload --enable-enzyme --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs +./configure --enable-llvm-link-shared --release-channel=nightly --enable-llvm-assertions --enable-llvm-offload --enable-llvm-enzyme --enable-clang --enable-lld --enable-option-checking --enable-ninja --disable-docs ``` Afterwards you can build rustc using: diff --git a/src/doc/rustc-dev-guide/src/overview.md b/src/doc/rustc-dev-guide/src/overview.md index 8a1a22fad660..378d8c4453f8 100644 --- a/src/doc/rustc-dev-guide/src/overview.md +++ b/src/doc/rustc-dev-guide/src/overview.md @@ -1,7 +1,5 @@ # Overview of the compiler - - This chapter is about the overall process of compiling a program -- how everything fits together. @@ -323,6 +321,10 @@ the name `'tcx`, which means that something is tied to the lifetime of the [`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html +For more information about queries in the compiler, see [the queries chapter][queries]. + +[queries]: ./query.md + ### `ty::Ty` Types are really important in Rust, and they form the core of a lot of compiler diff --git a/src/doc/rustc-dev-guide/src/panic-implementation.md b/src/doc/rustc-dev-guide/src/panic-implementation.md index 468190ffccd5..dba3f2146d23 100644 --- a/src/doc/rustc-dev-guide/src/panic-implementation.md +++ b/src/doc/rustc-dev-guide/src/panic-implementation.md @@ -1,7 +1,5 @@ # Panicking in Rust - - ## Step 1: Invocation of the `panic!` macro. There are actually two panic macros - one defined in `core`, and one defined in `std`. diff --git a/src/doc/rustc-dev-guide/src/profile-guided-optimization.md b/src/doc/rustc-dev-guide/src/profile-guided-optimization.md index 2fa810210451..4e3dadd406ec 100644 --- a/src/doc/rustc-dev-guide/src/profile-guided-optimization.md +++ b/src/doc/rustc-dev-guide/src/profile-guided-optimization.md @@ -1,7 +1,5 @@ # Profile-guided optimization - - `rustc` supports doing profile-guided optimization (PGO). This chapter describes what PGO is and how the support for it is implemented in `rustc`. diff --git a/src/doc/rustc-dev-guide/src/queries/incremental-compilation-in-detail.md b/src/doc/rustc-dev-guide/src/queries/incremental-compilation-in-detail.md index 18e0e25c5315..46e38832e64d 100644 --- a/src/doc/rustc-dev-guide/src/queries/incremental-compilation-in-detail.md +++ b/src/doc/rustc-dev-guide/src/queries/incremental-compilation-in-detail.md @@ -1,7 +1,5 @@ # Incremental compilation in detail - - The incremental compilation scheme is, in essence, a surprisingly simple extension to the overall query system. It relies on the fact that: diff --git a/src/doc/rustc-dev-guide/src/queries/incremental-compilation.md b/src/doc/rustc-dev-guide/src/queries/incremental-compilation.md index 6e5b4e8cc499..731ff3287d9f 100644 --- a/src/doc/rustc-dev-guide/src/queries/incremental-compilation.md +++ b/src/doc/rustc-dev-guide/src/queries/incremental-compilation.md @@ -1,7 +1,5 @@ # Incremental compilation - - The incremental compilation scheme is, in essence, a surprisingly simple extension to the overall query system. We'll start by describing a slightly simplified variant of the real thing – the "basic algorithm" – diff --git a/src/doc/rustc-dev-guide/src/queries/query-evaluation-model-in-detail.md b/src/doc/rustc-dev-guide/src/queries/query-evaluation-model-in-detail.md index 444e20bc580e..c1a4373f7dac 100644 --- a/src/doc/rustc-dev-guide/src/queries/query-evaluation-model-in-detail.md +++ b/src/doc/rustc-dev-guide/src/queries/query-evaluation-model-in-detail.md @@ -1,7 +1,5 @@ # The Query Evaluation Model in detail - - This chapter provides a deeper dive into the abstract model queries are built on. It does not go into implementation details but tries to explain the underlying logic. The examples here, therefore, have been stripped down and diff --git a/src/doc/rustc-dev-guide/src/queries/salsa.md b/src/doc/rustc-dev-guide/src/queries/salsa.md index 1a7b7fa9a683..dc7160edc22c 100644 --- a/src/doc/rustc-dev-guide/src/queries/salsa.md +++ b/src/doc/rustc-dev-guide/src/queries/salsa.md @@ -1,7 +1,5 @@ # How Salsa works - - This chapter is based on the explanation given by Niko Matsakis in this [video](https://www.youtube.com/watch?v=_muY4HjSqVw) about [Salsa](https://github.com/salsa-rs/salsa). To find out more you may diff --git a/src/doc/rustc-dev-guide/src/query.md b/src/doc/rustc-dev-guide/src/query.md index 0ca1b360a701..8377a7b2f31a 100644 --- a/src/doc/rustc-dev-guide/src/query.md +++ b/src/doc/rustc-dev-guide/src/query.md @@ -1,7 +1,5 @@ # Queries: demand-driven compilation - - As described in [Overview of the compiler], the Rust compiler is still (as of July 2021) transitioning from a traditional "pass-based" setup to a "demand-driven" system. The compiler query diff --git a/src/doc/rustc-dev-guide/src/rustdoc-internals.md b/src/doc/rustc-dev-guide/src/rustdoc-internals.md index 0234d4a920ed..4affbafe4777 100644 --- a/src/doc/rustc-dev-guide/src/rustdoc-internals.md +++ b/src/doc/rustc-dev-guide/src/rustdoc-internals.md @@ -1,7 +1,5 @@ # Rustdoc Internals - - This page describes [`rustdoc`]'s passes and modes. For an overview of `rustdoc`, see the ["Rustdoc overview" chapter](./rustdoc.md). diff --git a/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md b/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md index 3506431118ba..beff0a94c1ec 100644 --- a/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md +++ b/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md @@ -7,8 +7,6 @@ in the crates in the doc bundle, and the second reads it, turns it into some in-memory structures, and scans them linearly to search. - - ## Search index format `search.js` calls this Raw, because it turns it into diff --git a/src/doc/rustc-dev-guide/src/rustdoc.md b/src/doc/rustc-dev-guide/src/rustdoc.md index 52ae48c3735c..9290fcd3b41c 100644 --- a/src/doc/rustc-dev-guide/src/rustdoc.md +++ b/src/doc/rustc-dev-guide/src/rustdoc.md @@ -9,8 +9,6 @@ For more details about how rustdoc works, see the [Rustdoc internals]: ./rustdoc-internals.md - - `rustdoc` uses `rustc` internals (and, of course, the standard library), so you will have to build the compiler and `std` once before you can build `rustdoc`. diff --git a/src/doc/rustc-dev-guide/src/solve/candidate-preference.md b/src/doc/rustc-dev-guide/src/solve/candidate-preference.md new file mode 100644 index 000000000000..896052947353 --- /dev/null +++ b/src/doc/rustc-dev-guide/src/solve/candidate-preference.md @@ -0,0 +1,427 @@ +# Candidate preference + +There are multiple ways to prove `Trait` and `NormalizesTo` goals. Each such option is called a [`Candidate`]. If there are multiple applicable candidates, we prefer some candidates over others. We store the relevant information in their [`CandidateSource`]. + +This preference may result in incorrect inference or region constraints and would therefore be unsound during coherence. Because of this, we simply try to merge all candidates in coherence. + +## `Trait` goals + +Trait goals merge their applicable candidates in [`fn merge_trait_candidates`]. This document provides additional details and references to explain *why* we've got the current preference rules. + +### `CandidateSource::BuiltinImpl(BuiltinImplSource::Trivial))` + +Trivial builtin impls are builtin impls which are known to be always applicable for well-formed types. This means that if one exists, using another candidate should never have fewer constraints. We currently only consider `Sized` - and `MetaSized` - impls to be trivial. + +This is necessary to prevent a lifetime error for the following pattern + +```rust +trait Trait: Sized {} +impl<'a> Trait for &'a str {} +impl<'a> Trait for &'a str {} +fn is_sized(_: T) {} +fn foo<'a, 'b, T>(x: &'b str) +where + &'a str: Trait, +{ + // Elaborating the `&'a str: Trait` where-bound results in a + // `&'a str: Sized` where-bound. We do not want to prefer this + // over the builtin impl. + is_sized(x); +} +``` + +This preference is incorrect in case the builtin impl has a nested goal which relies on a non-param where-clause +```rust +struct MyType<'a, T: ?Sized>(&'a (), T); +fn is_sized() {} +fn foo<'a, T: ?Sized>() +where + (MyType<'a, T>,): Sized, + MyType<'static, T>: Sized, +{ + // The where-bound is trivial while the builtin `Sized` impl for tuples + // requires proving `MyType<'a, T>: Sized` which can only be proven by + // using the where-clause, adding an unnecessary `'static` constraint. + is_sized::<(MyType<'a, T>,)>(); + //~^ ERROR lifetime may not live long enough +} +``` + +### `CandidateSource::ParamEnv` + +Once there's at least one *non-global* `ParamEnv` candidate, we prefer *all* `ParamEnv` candidates over other candidate kinds. +A where-bound is global if it is not higher-ranked and doesn't contain any generic parameters. It may contain `'static`. + +We try to apply where-bounds over other candidates as users tends to have the most control over them, so they can most easily +adjust them in case our candidate preference is incorrect. + +#### Preference over `Impl` candidates + +This is necessary to avoid region errors in the following example + +```rust +trait Trait<'a> {} +impl Trait<'static> for T {} +fn impls_trait<'a, T: Trait<'a>>() {} +fn foo<'a, T: Trait<'a>>() { + impls_trait::<'a, T>(); +} +``` + +We also need this as shadowed impls can result in currently ambiguous solver cycles: [trait-system-refactor-initiative#76]. Without preference we'd be forced to fail with ambiguity +errors if the where-bound results in region constraints to avoid incompleteness. +```rust +trait Super { + type SuperAssoc; +} + +trait Trait: Super { + type TraitAssoc; +} + +impl Trait for T +where + T: Super, +{ + type TraitAssoc = U; +} + +fn overflow() { + // We can use the elaborated `Super` where-bound + // to prove the where-bound of the `T: Trait` implementation. This currently results in + // overflow. + let x: ::TraitAssoc; +} +``` + +This preference causes a lot of issues. See [#24066]. Most of the +issues are caused by prefering where-bounds over impls even if the where-bound guides type inference: +```rust +trait Trait { + fn call_me(&self, x: T) {} +} +impl Trait for T {} +impl Trait for T {} +fn bug, U>(x: T) { + x.call_me(1u32); + //~^ ERROR mismatched types +} +``` +However, even if we only apply this preference if the where-bound doesn't guide inference, it may still result +in incorrect lifetime constraints: +```rust +trait Trait<'a> {} +impl<'a> Trait<'a> for &'a str {} +fn impls_trait<'a, T: Trait<'a>>(_: T) {} +fn foo<'a, 'b>(x: &'b str) +where + &'a str: Trait<'b> +{ + // Need to prove `&'x str: Trait<'b>` with `'b: 'x`. + impls_trait::<'b, _>(x); + //~^ ERROR lifetime may not live long enough +} +``` + +#### Preference over `AliasBound` candidates + +This is necessary to avoid region errors in the following example +```rust +trait Bound<'a> {} +trait Trait<'a> { + type Assoc: Bound<'a>; +} + +fn impls_bound<'b, T: Bound<'b>>() {} +fn foo<'a, 'b, 'c, T>() +where + T: Trait<'a>, + for<'hr> T::Assoc: Bound<'hr>, +{ + impls_bound::<'b, T::Assoc>(); + impls_bound::<'c, T::Assoc>(); +} +``` +It can also result in unnecessary constraints +```rust +trait Bound<'a> {} +trait Trait<'a> { + type Assoc: Bound<'a>; +} + +fn impls_bound<'b, T: Bound<'b>>() {} +fn foo<'a, 'b, T>() +where + T: for<'hr> Trait<'hr>, + >::Assoc: Bound<'a>, +{ + // Using the where-bound for `>::Assoc: Bound<'a>` + // unnecessarily equates `>::Assoc` with the + // `>::Assoc` from the env. + impls_bound::<'a, >::Assoc>(); + // For a `>::Assoc: Bound<'b>` the self type of the + // where-bound matches, but the arguments of the trait bound don't. + impls_bound::<'b, >::Assoc>(); +} +``` + +#### Why no preference for global where-bounds + +Global where-bounds are either fully implied by an impl or unsatisfiable. If they are unsatisfiable, we don't really care what happens. If a where-bound is fully implied then using the impl to prove the trait goal cannot result in additional constraints. For trait goals this is only useful for where-bounds which use `'static`: + +```rust +trait A { + fn test(&self); +} + +fn foo(x: &dyn A) +where + dyn A + 'static: A, // Using this bound would lead to a lifetime error. +{ + x.test(); +} +``` +More importantly, by using impls here we prevent global where-bounds from shadowing impls when normalizing associated types. There are no known issues from preferring impls over global where-bounds. + +#### Why still consider global where-bounds + +Given that we just use impls even if there exists a global where-bounds, you may ask why we don't just ignore these global where-bounds entirely: we use them to weaken the inference guidance from non-global where-bounds. + +Without a global where-bound, we currently prefer non-global where bounds even though there would be an applicable impl as well. By adding a non-global where-bound, this unnecessary inference guidance is disabled, allowing the following to compile: +```rust +fn check(color: Color) +where + Vec: Into + Into, +{ + let _: f32 = Vec.into(); + // Without the global `Vec: Into` bound we'd + // eagerly use the non-global `Vec: Into` bound + // here, causing this to fail. +} + +struct Vec; +impl From for f32 { + fn from(_: Vec) -> Self { + loop {} + } +} +``` + +### `CandidateSource::AliasBound` + +We prefer alias-bound candidates over impls. We currently use this preference to guide type inference, causing the following to compile. I personally don't think this preference is desirable 🤷 +```rust +pub trait Dyn { + type Word: Into; + fn d_tag(&self) -> Self::Word; + fn tag32(&self) -> Option { + self.d_tag().into().try_into().ok() + // prove `Self::Word: Into` and then select a method + // on `?0`, needs eager inference. + } +} +``` +```rust +fn impl_trait() -> impl Into { + 0u16 +} + +fn main() { + // There are two possible types for `x`: + // - `u32` by using the "alias bound" of `impl Into` + // - `impl Into`, i.e. `u16`, by using `impl From for T` + // + // We infer the type of `x` to be `u32` even though this is not + // strictly necessary and can even lead to surprising errors. + let x = impl_trait().into(); + println!("{}", std::mem::size_of_val(&x)); +} +``` +This preference also avoids ambiguity due to region constraints, I don't know whether people rely on this in practice. +```rust +trait Bound<'a> {} +impl Bound<'static> for T {} +trait Trait<'a> { + type Assoc: Bound<'a>; +} + +fn impls_bound<'b, T: Bound<'b>>() {} +fn foo<'a, T: Trait<'a>>() { + // Should we infer this to `'a` or `'static`. + impls_bound::<'_, T::Assoc>(); +} +``` + +### `CandidateSource::BuiltinImpl(BuiltinImplSource::Object(_))` + +We prefer builtin trait object impls over user-written impls. This is **unsound** and should be remoed in the future. See [#57893](https://github.com/rust-lang/rust/issues/57893) and [#141347](https://github.com/rust-lang/rust/pull/141347) for more details. + +## `NormalizesTo` goals + +The candidate preference behavior during normalization is implemented in [`fn assemble_and_merge_candidates`]. + +### Where-bounds shadow impls + +Normalization of associated items does not consider impls if the corresponding trait goal has been proven via a `ParamEnv` or `AliasBound` candidate. +This means that for where-bounds which do not constrain associated types, the associated types remain *rigid*. + +This is necessary to avoid unnecessary region constraints from applying impls. +```rust +trait Trait<'a> { + type Assoc; +} +impl Trait<'static> for u32 { + type Assoc = u32; +} + +fn bar<'b, T: Trait<'b>>() -> T::Assoc { todo!() } +fn foo<'a>() +where + u32: Trait<'a>, +{ + // Normalizing the return type would use the impl, proving + // the `T: Trait` where-bound would use the where-bound, resulting + // in different region constraints. + bar::<'_, u32>(); +} +``` + +### We always consider `AliasBound` candidates + +In case the where-bound does not specify the associated item, we consider `AliasBound` candidates instead of treating the alias as rigid, even though the trait goal was proven via a `ParamEnv` candidate. + +```rust +trait Super { + type Assoc; +} +trait Bound { + type Assoc: Super; +} +trait Trait: Super {} + +// Elaborating the environment results in a `T::Assoc: Super` where-bound. +// This where-bound must not prevent normalization via the `Super` +// item bound. +fn heck>(x: ::Assoc) -> u32 { + x +} +``` +Using such an alias can result in additional region constraints, cc [#133044]. +```rust +trait Bound<'a> { + type Assoc; +} +trait Trait { + type Assoc: Bound<'static, Assoc = u32>; +} + +fn heck<'a, T: Trait>>(x: >::Assoc) { + // Normalizing the associated type requires `T::Assoc: Bound<'static>` as it + // uses the `Bound<'static>` alias-bound instead of keeping the alias rigid. + drop(x); +} +``` + +### We prefer `ParamEnv` candidates over `AliasBound` + +While we use `AliasBound` candidates if the where-bound does not specify the associated type, in case it does, we prefer the where-bound. +This is necessary for the following example: +```rust +// Make sure we prefer the `I::IntoIterator: Iterator` +// where-bound over the `I::Intoiterator: Iterator` +// alias-bound. + +trait Iterator { + type Item; +} + +trait IntoIterator { + type Item; + type IntoIter: Iterator; +} + +fn normalize>() {} + +fn foo() +where + I: IntoIterator, + I::IntoIter: Iterator, +{ + // We need to prefer the `I::IntoIterator: Iterator` + // where-bound over the `I::Intoiterator: Iterator` + // alias-bound. + normalize::(); +} +``` + +### We always consider where-bounds + +Even if the trait goal was proven via an impl, we still prefer `ParamEnv` candidates, if any exist. + +#### We prefer "orphaned" where-bounds + +We add "orphaned" `Projection` clauses into the `ParamEnv` when normalizing item bounds of GATs and RPITIT in `fn check_type_bounds`. +We need to prefer these `ParamEnv` candidates over impls and other where-bounds. +```rust +#![feature(associated_type_defaults)] +trait Foo { + // We should be able to prove that `i32: Baz` because of + // the impl below, which requires that `Self::Bar<()>: Eq` + // which is true, because we assume `for Self::Bar = i32`. + type Bar: Baz = i32; +} +trait Baz {} +impl Baz for i32 where T::Bar<()>: Eq {} +trait Eq {} +impl Eq for T {} +``` + +I don't fully understand the cases where this preference is actually necessary and haven't been able to exploit this in fun ways yet, but 🤷 + +#### We prefer global where-bounds over impls + +This is necessary for the following to compile. I don't know whether anything relies on it in practice 🤷 +```rust +trait Id { + type This; +} +impl Id for T { + type This = T; +} + +fn foo(x: T) -> ::This +where + u32: Id, +{ + x +} +``` +This means normalization can result in additional region constraints, cc [#133044]. +```rust +trait Trait { + type Assoc; +} + +impl Trait for &u32 { + type Assoc = u32; +} + +fn trait_bound() {} +fn normalize>() {} + +fn foo<'a>() +where + &'static u32: Trait, +{ + trait_bound::<&'a u32>(); // ok, proven via impl + normalize::<&'a u32>(); // error, proven via where-bound +} +``` + +[`Candidate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_next_trait_solver/solve/assembly/struct.Candidate.html +[`CandidateSource`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_next_trait_solver/solve/enum.CandidateSource.html +[`fn merge_trait_candidates`]: https://github.com/rust-lang/rust/blob/e3ee7f7aea5b45af3b42b5e4713da43876a65ac9/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs#L1342-L1424 +[`fn assemble_and_merge_candidates`]: https://github.com/rust-lang/rust/blob/e3ee7f7aea5b45af3b42b5e4713da43876a65ac9/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs#L920-L1003 +[trait-system-refactor-initiative#76]: https://github.com/rust-lang/trait-system-refactor-initiative/issues/76 +[#24066]: https://github.com/rust-lang/rust/issues/24066 +[#133044]: https://github.com/rust-lang/rust/issues/133044 \ No newline at end of file diff --git a/src/doc/rustc-dev-guide/src/stability.md b/src/doc/rustc-dev-guide/src/stability.md index 230925252bac..c26d34273d7e 100644 --- a/src/doc/rustc-dev-guide/src/stability.md +++ b/src/doc/rustc-dev-guide/src/stability.md @@ -6,8 +6,6 @@ APIs to use unstable APIs internally in the rustc standard library. **NOTE**: this section is for *library* features, not *language* features. For instructions on stabilizing a language feature see [Stabilizing Features](./stabilization_guide.md). - - ## unstable The `#[unstable(feature = "foo", issue = "1234", reason = "lorem ipsum")]` @@ -183,4 +181,7 @@ the `deprecated_in_future` lint is triggered which is default `allow`, but most of the standard library raises it to a warning with `#![warn(deprecated_in_future)]`. +## unstable_feature_bound +The `#[unstable_feature_bound(foo)]` attribute can be used together with `#[unstable]` attribute to mark an `impl` of stable type and stable trait as unstable. In std/core, an item annotated with `#[unstable_feature_bound(foo)]` can only be used by another item that is also annotated with `#[unstable_feature_bound(foo)]`. Outside of std/core, using an item with `#[unstable_feature_bound(foo)]` requires the feature to be enabled with `#![feature(foo)]` attribute on the crate. Currently, only `impl`s and free functions can be annotated with `#[unstable_feature_bound]`. + [blog]: https://www.ralfj.de/blog/2018/07/19/const.html diff --git a/src/doc/rustc-dev-guide/src/stabilization_guide.md b/src/doc/rustc-dev-guide/src/stabilization_guide.md index f875c68745f6..e399930fc523 100644 --- a/src/doc/rustc-dev-guide/src/stabilization_guide.md +++ b/src/doc/rustc-dev-guide/src/stabilization_guide.md @@ -1,120 +1,64 @@ # Request for stabilization -**NOTE**: this page is about stabilizing *language* features. -For stabilizing *library* features, see [Stabilizing a library feature]. +**NOTE**: This page is about stabilizing *language* features. For stabilizing *library* features, see [Stabilizing a library feature]. [Stabilizing a library feature]: ./stability.md#stabilizing-a-library-feature -Once an unstable feature has been well-tested with no outstanding -concern, anyone may push for its stabilization. It involves the -following steps: +Once an unstable feature has been well-tested with no outstanding concerns, anyone may push for its stabilization, though involving the people who have worked on it is prudent. Follow these steps: - +## Write an RFC, if needed + +If the feature was part of a [lang experiment], the lang team generally will want to first accept an RFC before stabilization. + +[lang experiment]: https://lang-team.rust-lang.org/how_to/experiment.html ## Documentation PRs -If any documentation for this feature exists, it should be -in the [`Unstable Book`], located at [`src/doc/unstable-book`]. -If it exists, the page for the feature gate should be removed. +The feature might be documented in the [`Unstable Book`], located at [`src/doc/unstable-book`]. Remove the page for the feature gate if it exists. Integrate any useful parts of that documentation in other places. -If there was documentation there, integrating it into the -existing documentation is needed. +Places that may need updated documentation include: -If there wasn't documentation there, it needs to be added. +- [The Reference]: This must be updated, in full detail, and a member of the lang-docs team must review and approve the PR before the stabilization can be merged. +- [The Book]: This is updated as needed. If you're not sure, please open an issue on this repository and it can be discussed. +- Standard library documentation: This is updated as needed. Language features often don't need this, but if it's a feature that changes how idiomatic examples are written, such as when `?` was added to the language, updating these in the library documentation is important. Review also the keyword documentation and ABI documentation in the standard library, as these sometimes needs updates for language changes. +- [Rust by Example]: This is updated as needed. -Places that may need updated documentation: - -- [The Reference]: This must be updated, in full detail. -- [The Book]: This may or may not need updating, depends. - If you're not sure, please open an issue on this repository - and it can be discussed. -- standard library documentation: As needed. Language features - often don't need this, but if it's a feature that changes - how good examples are written, such as when `?` was added - to the language, updating examples is important. -- [Rust by Example]: As needed. - -Prepare PRs to update documentation involving this new feature -for repositories mentioned above. Maintainers of these repositories -will keep these PRs open until the whole stabilization process -has completed. Meanwhile, we can proceed to the next step. +Prepare PRs to update documentation involving this new feature for the repositories mentioned above. Maintainers of these repositories will keep these PRs open until the whole stabilization process has completed. Meanwhile, we can proceed to the next step. ## Write a stabilization report -Find the tracking issue of the feature, and create a short -stabilization report. Essentially this would be a brief summary -of the feature plus some links to test cases showing it works -as expected, along with a list of edge cases that came up -and were considered. This is a minimal "due diligence" that -we do before stabilizing. +Author a stabilization report using the [template found in this repository][srt]. -The report should contain: +The stabilization reports summarizes: -- A summary, showing examples (e.g. code snippets) what is - enabled by this feature. -- Links to test cases in our test suite regarding this feature - and describe the feature's behavior on encountering edge cases. -- Links to the documentations (the PRs we have made in the - previous steps). -- Any other relevant information. -- The resolutions of any unresolved questions if the stabilization - is for an RFC. +- The main design decisions and deviations since the RFC was accepted, including both decisions that were FCP'd or otherwise accepted by the language team as well as those being presented to the lang team for the first time. + - Often, the final stabilized language feature has significant design deviations from the original RFC. That's OK, but these deviations must be highlighted and explained carefully. +- The work that has been done since the RFC was accepted, acknowledging the main contributors that helped drive the language feature forward. -Examples of stabilization reports can be found in -[rust-lang/rust#44494][report1] and [rust-lang/rust#28237][report2] (these links -will bring you directly to the comment containing the stabilization report). +The [*Stabilization Template*][srt] includes a series of questions that aim to surface connections between this feature and lang's subteams (e.g. types, opsem, lang-docs, etc.) and to identify items that are commonly overlooked. -[report1]: https://github.com/rust-lang/rust/issues/44494#issuecomment-360191474 -[report2]: https://github.com/rust-lang/rust/issues/28237#issuecomment-363374130 +[srt]: ./stabilization_report_template.md -## FCP - -If any member of the team responsible for tracking this -feature agrees with stabilizing this feature, they will -start the FCP (final-comment-period) process by commenting - -```text -@rfcbot fcp merge -``` - -The rest of the team members will review the proposal. If the final -decision is to stabilize, we proceed to do the actual code modification. +The stabilization report is typically posted as the main comment on the stabilization PR (see the next section). ## Stabilization PR -*This is for stabilizing language features. If you are stabilizing a library -feature, see [the stabilization chapter of the std dev guide][std-guide-stabilization] instead.* +Every feature is different, and some may require steps beyond what this guide discusses. -Once we have decided to stabilize a feature, we need to have -a PR that actually makes that stabilization happen. These kinds -of PRs are a great way to get involved in Rust, as they take -you on a little tour through the source code. - -Here is a general guide to how to stabilize a feature -- -every feature is different, of course, so some features may -require steps beyond what this guide talks about. - -Note: Before we stabilize any feature, it's the rule that it -should appear in the documentation. +Before the stabilization will be considered by the lang team, there must be a complete PR to the Reference describing the feature, and before the stabilization PR will be merged, this PR must have been reviewed and approved by the lang-docs team. ### Updating the feature-gate listing -There is a central listing of unstable feature-gates in -[`compiler/rustc_feature/src/unstable.rs`]. Search for the `declare_features!` -macro. There should be an entry for the feature you are aiming -to stabilize, something like (this example is taken from -[rust-lang/rust#32409]: +There is a central listing of unstable feature-gates in [`compiler/rustc_feature/src/unstable.rs`]. Search for the `declare_features!` macro. There should be an entry for the feature you are aiming to stabilize, something like (this example is taken from [rust-lang/rust#32409]: ```rust,ignore // pub(restricted) visibilities (RFC 1422) (unstable, pub_restricted, "CURRENT_RUSTC_VERSION", Some(32409)), ``` -The above line should be moved to [`compiler/rustc_feature/src/accepted.rs`]. -Entries in the `declare_features!` call are sorted, so find the correct place. -When it is done, it should look like: +The above line should be moved to [`compiler/rustc_feature/src/accepted.rs`]. Entries in the `declare_features!` call are sorted, so find the correct place. When it is done, it should look like: ```rust,ignore // pub(restricted) visibilities (RFC 1422) @@ -122,54 +66,31 @@ When it is done, it should look like: // note that we changed this ``` -(Even though you will encounter version numbers in the file of past changes, -you should not put the rustc version you expect your stabilization to happen in, -but instead `CURRENT_RUSTC_VERSION`) +(Even though you will encounter version numbers in the file of past changes, you should not put the rustc version you expect your stabilization to happen in, but instead use `CURRENT_RUSTC_VERSION`.) ### Removing existing uses of the feature-gate -Next search for the feature string (in this case, `pub_restricted`) -in the codebase to find where it appears. Change uses of -`#![feature(XXX)]` from the `std` and any rustc crates (this includes test folders -under `library/` and `compiler/` but not the toplevel `tests/` one) to be -`#![cfg_attr(bootstrap, feature(XXX))]`. This includes the feature-gate -only for stage0, which is built using the current beta (this is -needed because the feature is still unstable in the current beta). +Next, search for the feature string (in this case, `pub_restricted`) in the codebase to find where it appears. Change uses of `#![feature(XXX)]` from the `std` and any rustc crates (this includes test folders under `library/` and `compiler/` but not the toplevel `tests/` one) to be `#![cfg_attr(bootstrap, feature(XXX))]`. This includes the feature-gate only for stage0, which is built using the current beta (this is needed because the feature is still unstable in the current beta). -Also, remove those strings from any tests (e.g. under `tests/`). If there are tests -specifically targeting the feature-gate (i.e., testing that the -feature-gate is required to use the feature, but nothing else), -simply remove the test. +Also, remove those strings from any tests (e.g. under `tests/`). If there are tests specifically targeting the feature-gate (i.e., testing that the feature-gate is required to use the feature, but nothing else), simply remove the test. ### Do not require the feature-gate to use the feature -Most importantly, remove the code which flags an error if the -feature-gate is not present (since the feature is now considered -stable). If the feature can be detected because it employs some -new syntax, then a common place for that code to be is in the -same `compiler/rustc_ast_passes/src/feature_gate.rs`. -For example, you might see code like this: +Most importantly, remove the code which flags an error if the feature-gate is not present (since the feature is now considered stable). If the feature can be detected because it employs some new syntax, then a common place for that code to be is in `compiler/rustc_ast_passes/src/feature_gate.rs`. For example, you might see code like this: ```rust,ignore -gate_feature_post!(&self, pub_restricted, span, - "`pub(restricted)` syntax is experimental"); +gate_all!(pub_restricted, "`pub(restricted)` syntax is experimental"); ``` -This `gate_feature_post!` macro prints an error if the -`pub_restricted` feature is not enabled. It is not needed -now that `#[pub_restricted]` is stable. +This `gate_feature_post!` macro prints an error if the `pub_restricted` feature is not enabled. It is not needed now that `#[pub_restricted]` is stable. For more subtle features, you may find code like this: ```rust,ignore -if self.tcx.sess.features.borrow().pub_restricted { /* XXX */ } +if self.tcx.features().async_fn_in_dyn_trait() { /* XXX */ } ``` -This `pub_restricted` field (obviously named after the feature) -would ordinarily be false if the feature flag is not present -and true if it is. So transform the code to assume that the field -is true. In this case, that would mean removing the `if` and -leaving just the `/* XXX */`. +This `pub_restricted` field (named after the feature) would ordinarily be false if the feature flag is not present and true if it is. So transform the code to assume that the field is true. In this case, that would mean removing the `if` and leaving just the `/* XXX */`. ```rust,ignore if self.tcx.sess.features.borrow().pub_restricted { /* XXX */ } @@ -194,3 +115,40 @@ if something { /* XXX */ } [Rust by Example]: https://github.com/rust-lang/rust-by-example [`Unstable Book`]: https://doc.rust-lang.org/unstable-book/index.html [`src/doc/unstable-book`]: https://github.com/rust-lang/rust/tree/master/src/doc/unstable-book + +## Team nominations + +When opening the stabilization PR, CC the lang team and its advisors (`@rust-lang/lang @rust-lang/lang-advisors`) and any other teams to whom the feature is relevant, e.g.: + +- `@rust-lang/types`, for type system interactions. +- `@rust-lang/opsem`, for interactions with unsafe code. +- `@rust-lang/compiler`, for implementation robustness. +- `@rust-lang/libs-api`, for changes to the standard library API or its guarantees. +- `@rust-lang/lang-docs`, for questions about how this should be documented in the Reference. + +After the stabilization PR is opened with the stabilization report, wait a bit for any immediate comments. When such comments "simmer down" and you feel the PR is ready for consideration by the lang team, [nominate the PR](https://lang-team.rust-lang.org/how_to/nominate.html) to get it on the agenda for consideration in an upcoming lang meeting. + +If you are not a `rust-lang` organization member, you can ask your assigned reviewer to CC the relevant teams on your behalf. + +## Propose FCP on the PR + +After the lang team and other relevant teams review the stabilization, and after you have answered any questions they may have had, a member of one of the teams may propose to accept the stabilization by commenting: + +```text +@rfcbot fcp merge +``` + +Once enough team members have reviewed, the PR will move into a "final comment period" (FCP). If no new concerns are raised, this period will complete and the PR can be merged after implementation review in the usual way. + +## Reviewing and merging stabilizations + +On a stabilization, before giving it the `r+`, ensure that the PR: + +- Matches what the team proposed for stabilization and what is documented in the Reference PR. +- Includes any changes the team decided to request along the way in order to resolve or avoid concerns. +- Is otherwise exactly what is described in the stabilization report and in any relevant RFCs or prior lang FCPs. +- Does not expose on stable behaviors other than those specified, accepted for stabilization, and documented in the Reference. +- Has sufficient tests to convincingly demonstrate these things. +- Is accompanied by a PR to the Reference than has been reviewed and approved by a member of lang-docs. + +In particular, when reviewing the PR, keep an eye out for any user-visible details that the lang team failed to consider and specify. If you find one, describe it and nominate the PR for the lang team. diff --git a/src/doc/rustc-dev-guide/src/stabilization_report_template.md b/src/doc/rustc-dev-guide/src/stabilization_report_template.md new file mode 100644 index 000000000000..793f7d7e45cf --- /dev/null +++ b/src/doc/rustc-dev-guide/src/stabilization_report_template.md @@ -0,0 +1,277 @@ +# Stabilization report template + +## What is this? + +This is a template for [stabilization reports](./stabilization_guide.md) of **language features**. The questions aim to solicit the details most often needed. These details help reviewers to identify potential problems upfront. Not all parts of the template will apply to every stabilization. If a question doesn't apply, explain briefly why. + +Copy everything after the separator and edit it as Markdown. Replace each *TODO* with your answer. + +--- + +# Stabilization report + +## Summary + +> Remind us what this feature is and what value it provides. Tell the story of what led up to this stabilization. +> +> E.g., see: +> +> - [Stabilize AFIT/RPITIT](https://web.archive.org/web/20250329190642/https://github.com/rust-lang/rust/pull/115822) +> - [Stabilize RTN](https://web.archive.org/web/20250321214601/https://github.com/rust-lang/rust/pull/138424) +> - [Stabilize ATPIT](https://web.archive.org/web/20250124214256/https://github.com/rust-lang/rust/pull/120700) +> - [Stabilize opaque type precise capturing](https://web.archive.org/web/20250312173538/https://github.com/rust-lang/rust/pull/127672) + +*TODO* + +Tracking: + +- *TODO* (Link to tracking issue.) + +Reference PRs: + +- *TODO* (Link to Reference PRs.) + +cc @rust-lang/lang @rust-lang/lang-advisors + +### What is stabilized + +> Describe each behavior being stabilized and give a short example of code that will now be accepted. + +```rust +todo!() +``` + +### What isn't stabilized + +> Describe any parts of the feature not being stabilized. Talk about what we might want to do later and what doors are being left open for that. If what we're not stabilizing might lead to surprises for users, talk about that in particular. + +## Design + +### Reference + +> What updates are needed to the Reference? Link to each PR. If the Reference is missing content needed for describing this feature, discuss that. + +- *TODO* + +### RFC history + +> What RFCs have been accepted for this feature? + +- *TODO* + +### Answers to unresolved questions + +> What questions were left unresolved by the RFC? How have they been answered? Link to any relevant lang decisions. + +*TODO* + +### Post-RFC changes + +> What other user-visible changes have occurred since the RFC was accepted? Describe both changes that the lang team accepted (and link to those decisions) as well as changes that are being presented to the team for the first time in this stabilization report. + +*TODO* + +### Key points + +> What decisions have been most difficult and what behaviors to be stabilized have proved most contentious? Summarize the major arguments on all sides and link to earlier documents and discussions. + +*TODO* + +### Nightly extensions + +> Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? + +*TODO* + +### Doors closed + +> What doors does this stabilization close for later changes to the language? E.g., does this stabilization make any other RFCs, lang experiments, or known in-flight proposals more difficult or impossible to do later? + +## Feedback + +### Call for testing + +> Has a "call for testing" been done? If so, what feedback was received? + +*TODO* + +### Nightly use + +> Do any known nightly users use this feature? Counting instances of `#![feature(FEATURE_NAME)]` on GitHub with grep might be informative. + +*TODO* + +## Implementation + +### Major parts + +> Summarize the major parts of the implementation and provide links into the code and to relevant PRs. +> +> See, e.g., this breakdown of the major parts of async closures: +> +> - + +*TODO* + +### Coverage + +> Summarize the test coverage of this feature. +> +> Consider what the "edges" of this feature are. We're particularly interested in seeing tests that assure us about exactly what nearby things we're not stabilizing. Tests should of course comprehensively demonstrate that the feature works. Think too about demonstrating the diagnostics seen when common mistakes are made and the feature is used incorrectly. +> +> Within each test, include a comment at the top describing the purpose of the test and what set of invariants it intends to demonstrate. This is a great help to our review. +> +> Describe any known or intentional gaps in test coverage. +> +> Contextualize and link to test folders and individual tests. + +*TODO* + +### Outstanding bugs + +> What outstanding bugs involve this feature? List them. Should any block the stabilization? Discuss why or why not. + +*TODO* + +- *TODO* +- *TODO* +- *TODO* + +### Outstanding FIXMEs + +> What FIXMEs are still in the code for that feature and why is it OK to leave them there? + +*TODO* + +### Tool changes + +> What changes must be made to our other tools to support this feature. Has this work been done? Link to any relevant PRs and issues. + +- [ ] rustfmt + - *TODO* +- [ ] rust-analyzer + - *TODO* +- [ ] rustdoc (both JSON and HTML) + - *TODO* +- [ ] cargo + - *TODO* +- [ ] clippy + - *TODO* +- [ ] rustup + - *TODO* +- [ ] docs.rs + - *TODO* + +*TODO* + +### Breaking changes + +> If this stabilization represents a known breaking change, link to the crater report, the analysis of the crater report, and to all PRs we've made to ecosystem projects affected by this breakage. Discuss any limitations of what we're able to know about or to fix. + +*TODO* + +Crater report: + +- *TODO* + +Crater analysis: + +- *TODO* + +PRs to affected crates: + +- *TODO* +- *TODO* +- *TODO* + +## Type system, opsem + +### Compile-time checks + +> What compilation-time checks are done that are needed to prevent undefined behavior? +> +> Link to tests demonstrating that these checks are being done. + +*TODO* + +- *TODO* +- *TODO* +- *TODO* + +### Type system rules + +> What type system rules are enforced for this feature and what is the purpose of each? + +*TODO* + +### Sound by default? + +> Does the feature's implementation need specific checks to prevent UB, or is it sound by default and need specific opt-in to perform the dangerous/unsafe operations? If it is not sound by default, what is the rationale? + +*TODO* + +### Breaks the AM? + +> Can users use this feature to introduce undefined behavior, or use this feature to break the abstraction of Rust and expose the underlying assembly-level implementation? Describe this if so. + +*TODO* + +## Common interactions + +### Temporaries + +> Does this feature introduce new expressions that can produce temporaries? What are the scopes of those temporaries? + +*TODO* + +### Drop order + +> Does this feature raise questions about the order in which we should drop values? Talk about the decisions made here and how they're consistent with our earlier decisions. + +*TODO* + +### Pre-expansion / post-expansion + +> Does this feature raise questions about what should be accepted pre-expansion (e.g. in code covered by `#[cfg(false)]`) versus what should be accepted post-expansion? What decisions were made about this? + +*TODO* + +### Edition hygiene + +> If this feature is gated on an edition, how do we decide, in the context of the edition hygiene of tokens, whether to accept or reject code. E.g., what token do we use to decide? + +*TODO* + +### SemVer implications + +> Does this feature create any new ways in which library authors must take care to prevent breaking downstreams when making minor-version releases? Describe these. Are these new hazards "major" or "minor" according to [RFC 1105](https://rust-lang.github.io/rfcs/1105-api-evolution.html)? + +*TODO* + +### Exposing other features + +> Are there any other unstable features whose behavior may be exposed by this feature in any way? What features present the highest risk of that? + +*TODO* + +## History + +> List issues and PRs that are important for understanding how we got here. + +- *TODO* +- *TODO* +- *TODO* + +## Acknowledgments + +> Summarize contributors to the feature by name for recognition and so that those people are notified about the stabilization. Does anyone who worked on this *not* think it should be stabilized right now? We'd like to hear about that if so. + +*TODO* + +## Open items + +> List any known items that have not yet been completed and that should be before this is stabilized. + +- [ ] *TODO* +- [ ] *TODO* +- [ ] *TODO* diff --git a/src/doc/rustc-dev-guide/src/test-implementation.md b/src/doc/rustc-dev-guide/src/test-implementation.md index e906dd29f25f..f09d73631998 100644 --- a/src/doc/rustc-dev-guide/src/test-implementation.md +++ b/src/doc/rustc-dev-guide/src/test-implementation.md @@ -1,7 +1,5 @@ # The `#[test]` attribute - - Many Rust programmers rely on a built-in attribute called `#[test]`. All diff --git a/src/doc/rustc-dev-guide/src/tests/adding.md b/src/doc/rustc-dev-guide/src/tests/adding.md index 895eabfbd56a..e5c26bef11d0 100644 --- a/src/doc/rustc-dev-guide/src/tests/adding.md +++ b/src/doc/rustc-dev-guide/src/tests/adding.md @@ -1,7 +1,5 @@ # Adding new tests - - **In general, we expect every PR that fixes a bug in rustc to come accompanied by a regression test of some kind.** This test should fail in master but pass after the PR. These tests are really useful for preventing us from repeating the diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index a108dfdef9b3..4980ed845d6d 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -1,7 +1,5 @@ # Compiletest - - ## Introduction `compiletest` is the main test harness of the Rust test suite. It allows test diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 5c3ae359ba0b..f4ba9a044e66 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -1,7 +1,5 @@ # Compiletest directives - - @@ -52,6 +50,8 @@ not be exhaustive. Directives can generally be found by browsing the ### Auxiliary builds +See [Building auxiliary crates](compiletest.html#building-auxiliary-crates) + | Directive | Explanation | Supported test suites | Possible values | |-----------------------|-------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------| | `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make` | Path to auxiliary `.rs` file | @@ -61,8 +61,7 @@ not be exhaustive. Directives can generally be found by browsing the | `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make` | Path to auxiliary proc-macro `.rs` file | | `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make` | N/A | -[^pm]: please see the Auxiliary proc-macro section in the - [compiletest](./compiletest.md) chapter for specifics. +[^pm]: please see the [Auxiliary proc-macro section](compiletest.html#auxiliary-proc-macro) in the compiletest chapter for specifics. ### Controlling outcome expectations @@ -293,13 +292,12 @@ See [Pretty-printer](compiletest.md#pretty-printer-tests). - `no-auto-check-cfg` — disable auto check-cfg (only for `--check-cfg` tests) - [`revisions`](compiletest.md#revisions) — compile multiple times -- [`unused-revision-names`](compiletest.md#ignoring-unused-revision-names) - - suppress tidy checks for mentioning unknown revision names -[`forbid-output`](compiletest.md#incremental-tests) — incremental cfail rejects output pattern - [`should-ice`](compiletest.md#incremental-tests) — incremental cfail should ICE - [`reference`] — an annotation linking to a rule in the reference +- `disable-gdb-pretty-printers` — disable gdb pretty printers for debuginfo tests [`reference`]: https://github.com/rust-lang/reference/blob/master/docs/authoring.md#test-rule-annotations @@ -315,6 +313,17 @@ test suites that use those tools: - `llvm-cov-flags` adds extra flags when running LLVM's `llvm-cov` tool. - Used by [coverage tests](compiletest.md#coverage-tests) in `coverage-run` mode. +### Tidy specific directives + +The following directives control how the [tidy script](../conventions.md#formatting) +verifies tests. + +- `ignore-tidy-target-specific-tests` disables checking that the appropriate + LLVM component is required (via a `needs-llvm-components` directive) when a + test is compiled for a specific target (via the `--target` flag in a + `compile-flag` directive). +- [`unused-revision-names`](compiletest.md#ignoring-unused-revision-names) - + suppress tidy checks for mentioning unknown revision names. ## Substitutions @@ -349,7 +358,7 @@ described below: - Example: `x86_64-unknown-linux-gnu` See -[`tests/ui/commandline-argfile.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui/argfile/commandline-argfile.rs) +[`tests/ui/argfile/commandline-argfile.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui/argfile/commandline-argfile.rs) for an example of a test that uses this substitution. [output normalization]: ui.md#normalization diff --git a/src/doc/rustc-dev-guide/src/tests/docker.md b/src/doc/rustc-dev-guide/src/tests/docker.md index 032da1ca1e8d..ae0939842237 100644 --- a/src/doc/rustc-dev-guide/src/tests/docker.md +++ b/src/doc/rustc-dev-guide/src/tests/docker.md @@ -6,12 +6,12 @@ need to install Docker on a Linux, Windows, or macOS system (typically Linux will be much faster than Windows or macOS because the latter use virtual machines to emulate a Linux environment). -Jobs running in CI are configured through a set of bash scripts, and it is not always trivial to reproduce their behavior locally. If you want to run a CI job locally in the simplest way possible, you can use a provided helper Python script that tries to replicate what happens on CI as closely as possible: +Jobs running in CI are configured through a set of bash scripts, and it is not always trivial to reproduce their behavior locally. If you want to run a CI job locally in the simplest way possible, you can use a provided helper `citool` that tries to replicate what happens on CI as closely as possible: ```bash -python3 src/ci/github-actions/ci.py run-local +cargo run --manifest-path src/ci/citool/Cargo.toml run-local # For example: -python3 src/ci/github-actions/ci.py run-local dist-x86_64-linux-alt +cargo run --manifest-path src/ci/citool/Cargo.toml run-local dist-x86_64-linux-alt ``` If the above script does not work for you, you would like to have more control of the Docker image execution, or you want to understand what exactly happens during Docker job execution, then continue reading below. @@ -53,15 +53,6 @@ Some additional notes about using the interactive mode: containers. With the container name, run `docker exec -it /bin/bash` where `` is the container name like `4ba195e95cef`. -The approach described above is a relatively low-level interface for running the Docker images -directly. If you want to run a full CI Linux job locally with Docker, in a way that is as close to CI as possible, you can use the following command: - -```bash -cargo run --manifest-path src/ci/citool/Cargo.toml run-local -# For example: -cargo run --manifest-path src/ci/citool/Cargo.toml run-local dist-x86_64-linux-alt -``` - [Docker]: https://www.docker.com/ [`src/ci/docker`]: https://github.com/rust-lang/rust/tree/master/src/ci/docker [`src/ci/docker/run.sh`]: https://github.com/rust-lang/rust/blob/master/src/ci/docker/run.sh diff --git a/src/doc/rustc-dev-guide/src/tests/intro.md b/src/doc/rustc-dev-guide/src/tests/intro.md index 79b96c450a8d..b90c16d602c3 100644 --- a/src/doc/rustc-dev-guide/src/tests/intro.md +++ b/src/doc/rustc-dev-guide/src/tests/intro.md @@ -1,7 +1,5 @@ # Testing the compiler - - The Rust project runs a wide variety of different tests, orchestrated by the build system (`./x test`). This section gives a brief overview of the different testing tools. Subsequent chapters dive into [running tests](running.md) and diff --git a/src/doc/rustc-dev-guide/src/tests/running.md b/src/doc/rustc-dev-guide/src/tests/running.md index 6526fe9c2357..317b65f98cd3 100644 --- a/src/doc/rustc-dev-guide/src/tests/running.md +++ b/src/doc/rustc-dev-guide/src/tests/running.md @@ -1,7 +1,5 @@ # Running tests - - You can run the entire test collection using `x`. But note that running the *entire* test collection is almost never what you want to do during local development because it takes a really long time. For local development, see the @@ -344,7 +342,6 @@ coordinate running tests (see [src/bootstrap/src/core/build_steps/test.rs]). > **TODO** > > - Is there any support for using an iOS emulator? -> - It's also unclear to me how the wasm or asm.js tests are run. [armhf-gnu]: https://github.com/rust-lang/rust/tree/master/src/ci/docker/host-x86_64/armhf-gnu/Dockerfile [QEMU]: https://www.qemu.org/ @@ -352,6 +349,28 @@ coordinate running tests (see [src/bootstrap/src/core/build_steps/test.rs]). [remote-test-server]: https://github.com/rust-lang/rust/tree/master/src/tools/remote-test-server [src/bootstrap/src/core/build_steps/test.rs]: https://github.com/rust-lang/rust/blob/master/src/bootstrap/src/core/build_steps/test.rs +## Testing tests on wasi (wasm32-wasip1) + +Some tests are specific to wasm targets. +To run theste tests, you have to pass `--target wasm32-wasip1` to `x test`. +Additionally, you need the wasi sdk. +Follow the install instructions from the [wasi sdk repository] to get a sysroot on your computer. +On the [wasm32-wasip1 target support page] a minimum version is specified that your sdk must be able to build. +Some cmake commands that take a while and give a lot of very concerning c++ warnings... +Then, in `bootstrap.toml`, point to the sysroot like so: + +``` +[target.wasm32-wasip1] +wasi-root = "/build/sysroot/install/share/wasi-sysroot" +``` + +In my case I git-cloned it next to my rust folder, so it was `../wasi-sdk/build/....` +Now, tests should just run, you don't have to set up anything else. + +[wasi sdk repository]: https://github.com/WebAssembly/wasi-sdk +[wasm32-wasip1 target support page]: https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasip1.md#building-the-target. + + ## Running rustc_codegen_gcc tests First thing to know is that it only supports linux x86_64 at the moment. We will diff --git a/src/doc/rustc-dev-guide/src/tests/ui.md b/src/doc/rustc-dev-guide/src/tests/ui.md index b1feef9ed0cc..25dd5814cf6f 100644 --- a/src/doc/rustc-dev-guide/src/tests/ui.md +++ b/src/doc/rustc-dev-guide/src/tests/ui.md @@ -1,7 +1,5 @@ # UI tests - - UI tests are a particular [test suite](compiletest.md#test-suites) of compiletest. @@ -25,9 +23,9 @@ If you need to work with `#![no_std]` cross-compiling tests, consult the ## General structure of a test -A test consists of a Rust source file located anywhere in the `tests/ui` -directory, but they should be placed in a suitable sub-directory. For example, -[`tests/ui/hello.rs`] is a basic hello-world test. +A test consists of a Rust source file located in the `tests/ui` directory. +**Tests must be placed in the appropriate subdirectory** based on their purpose +and testing category - placing tests directly in `tests/ui` is not permitted. Compiletest will use `rustc` to compile the test, and compare the output against the expected output which is stored in a `.stdout` or `.stderr` file located @@ -46,8 +44,6 @@ pass/fail expectations](#controlling-passfail-expectations). By default, a test is built as an executable binary. If you need a different crate type, you can use the `#![crate_type]` attribute to set it as needed. -[`tests/ui/hello.rs`]: https://github.com/rust-lang/rust/blob/master/tests/ui/hello.rs - ## Output comparison UI tests store the expected output from the compiler in `.stderr` and `.stdout` @@ -309,8 +305,9 @@ fn main((ؼ Use `//~?` to match an error without line information. `//~?` is precise and will not match errors if their line information is available. -For tests wishing to match against compiler diagnostics, error annotations should -be preferred over //@ error-pattern, //@ error-pattern is imprecise and non-exhaustive. +It should be preferred over `//@ error-pattern` +for tests wishing to match against compiler diagnostics, +due to `//@ error-pattern` being imprecise and non-exhaustive. ```rust,ignore //@ compile-flags: --print yyyy @@ -320,8 +317,8 @@ be preferred over //@ error-pattern, //@ error-pattern is imprecise and non-exha ### `error-pattern` -The `error-pattern` [directive](directives.md) can be used for runtime messages, which don't -have a specific span, or in exceptional cases, for compile time messages. +The `error-pattern` [directive](directives.md) can be used for runtime messages which don't +have a specific span, or, in exceptional cases, for compile time messages. Let's think about this test: diff --git a/src/doc/rustc-dev-guide/src/thir.md b/src/doc/rustc-dev-guide/src/thir.md index 73d09ad80bf9..3d3dafaef49b 100644 --- a/src/doc/rustc-dev-guide/src/thir.md +++ b/src/doc/rustc-dev-guide/src/thir.md @@ -1,7 +1,5 @@ # The THIR - - The THIR ("Typed High-Level Intermediate Representation"), previously called HAIR for "High-Level Abstract IR", is another IR used by rustc that is generated after [type checking]. It is (as of January 2024) used for diff --git a/src/doc/rustc-dev-guide/src/tracing.md b/src/doc/rustc-dev-guide/src/tracing.md index 0cfdf306e92d..5e5b81fc65b2 100644 --- a/src/doc/rustc-dev-guide/src/tracing.md +++ b/src/doc/rustc-dev-guide/src/tracing.md @@ -1,7 +1,5 @@ # Using tracing to debug the compiler - - The compiler has a lot of [`debug!`] (or `trace!`) calls, which print out logging information at many points. These are very useful to at least narrow down the location of a bug if not to find it entirely, or just to orient yourself as to why the diff --git a/src/doc/rustc-dev-guide/src/traits/goals-and-clauses.md b/src/doc/rustc-dev-guide/src/traits/goals-and-clauses.md index 40fd4581bf3e..2884ca5a05a1 100644 --- a/src/doc/rustc-dev-guide/src/traits/goals-and-clauses.md +++ b/src/doc/rustc-dev-guide/src/traits/goals-and-clauses.md @@ -1,7 +1,5 @@ # Goals and clauses - - In logic programming terms, a **goal** is something that you must prove and a **clause** is something that you know is true. As described in the [lowering to logic](./lowering-to-logic.html) diff --git a/src/doc/rustc-dev-guide/src/traits/lowering-to-logic.md b/src/doc/rustc-dev-guide/src/traits/lowering-to-logic.md index 1248d434610b..cc8b3bf800cb 100644 --- a/src/doc/rustc-dev-guide/src/traits/lowering-to-logic.md +++ b/src/doc/rustc-dev-guide/src/traits/lowering-to-logic.md @@ -1,7 +1,5 @@ # Lowering to logic - - The key observation here is that the Rust trait system is basically a kind of logic, and it can be mapped onto standard logical inference rules. We can then look for solutions to those inference rules in a diff --git a/src/doc/rustc-dev-guide/src/traits/resolution.md b/src/doc/rustc-dev-guide/src/traits/resolution.md index c62b0593694f..ccb2b04268e8 100644 --- a/src/doc/rustc-dev-guide/src/traits/resolution.md +++ b/src/doc/rustc-dev-guide/src/traits/resolution.md @@ -1,7 +1,5 @@ # Trait resolution (old-style) - - This chapter describes the general process of _trait resolution_ and points out some non-obvious things. diff --git a/src/doc/rustc-dev-guide/src/ty.md b/src/doc/rustc-dev-guide/src/ty.md index 767ac3fdba21..4055f475e992 100644 --- a/src/doc/rustc-dev-guide/src/ty.md +++ b/src/doc/rustc-dev-guide/src/ty.md @@ -1,7 +1,5 @@ # The `ty` module: representing types - - The `ty` module defines how the Rust compiler represents types internally. It also defines the *typing context* (`tcx` or `TyCtxt`), which is the central data structure in the compiler. diff --git a/src/doc/rustc-dev-guide/src/type-inference.md b/src/doc/rustc-dev-guide/src/type-inference.md index 888eb2439c5b..2243205f129b 100644 --- a/src/doc/rustc-dev-guide/src/type-inference.md +++ b/src/doc/rustc-dev-guide/src/type-inference.md @@ -1,7 +1,5 @@ # Type inference - - Type inference is the process of automatic detection of the type of an expression. diff --git a/src/doc/rustc-dev-guide/src/typing_parameter_envs.md b/src/doc/rustc-dev-guide/src/typing_parameter_envs.md index e21bc5155da1..db15467a47a0 100644 --- a/src/doc/rustc-dev-guide/src/typing_parameter_envs.md +++ b/src/doc/rustc-dev-guide/src/typing_parameter_envs.md @@ -1,7 +1,5 @@ # Typing/Parameter Environments - - ## Typing Environments When interacting with the type system there are a few variables to consider that can affect the results of trait solving. The set of in-scope where clauses, and what phase of the compiler type system operations are being performed in (the [`ParamEnv`][penv] and [`TypingMode`][tmode] structs respectively). diff --git a/src/doc/rustc-dev-guide/src/variance.md b/src/doc/rustc-dev-guide/src/variance.md index ad4fa4adfddb..7aa014071551 100644 --- a/src/doc/rustc-dev-guide/src/variance.md +++ b/src/doc/rustc-dev-guide/src/variance.md @@ -1,7 +1,5 @@ # Variance of type and lifetime parameters - - For a more general background on variance, see the [background] appendix. [background]: ./appendix/background.html diff --git a/src/doc/rustc-dev-guide/src/walkthrough.md b/src/doc/rustc-dev-guide/src/walkthrough.md index 48b3f8bb15d3..b4c3379347ed 100644 --- a/src/doc/rustc-dev-guide/src/walkthrough.md +++ b/src/doc/rustc-dev-guide/src/walkthrough.md @@ -1,7 +1,5 @@ # Walkthrough: a typical contribution - - There are _a lot_ of ways to contribute to the Rust compiler, including fixing bugs, improving performance, helping design features, providing feedback on existing features, etc. This chapter does not claim to scratch the surface. diff --git a/src/doc/rustc-dev-guide/triagebot.toml b/src/doc/rustc-dev-guide/triagebot.toml index b3f4c2d281cd..3ac5d57a52b0 100644 --- a/src/doc/rustc-dev-guide/triagebot.toml +++ b/src/doc/rustc-dev-guide/triagebot.toml @@ -62,9 +62,6 @@ allow-unauthenticated = [ # Documentation at: https://forge.rust-lang.org/triagebot/issue-links.html [issue-links] -# Automatically close and reopen PRs made by bots to run CI on them -[bot-pull-requests] - [behind-upstream] days-threshold = 7 diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index 7c688e32bc0d..25f154f11807 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -65,6 +65,7 @@ - [armv7-sony-vita-newlibeabihf](platform-support/armv7-sony-vita-newlibeabihf.md) - [armv7-unknown-linux-uclibceabi](platform-support/armv7-unknown-linux-uclibceabi.md) - [armv7-unknown-linux-uclibceabihf](platform-support/armv7-unknown-linux-uclibceabihf.md) + - [armv7a-vex-v5](platform-support/armv7a-vex-v5.md) - [\*-android and \*-androideabi](platform-support/android.md) - [\*-linux-ohos](platform-support/openharmony.md) - [\*-hurd-gnu](platform-support/hurd.md) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 65b706301538..8ebaa8dd8747 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -297,6 +297,7 @@ target | std | host | notes [`armv7a-kmc-solid_asp3-eabi`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3 [`armv7a-kmc-solid_asp3-eabihf`](platform-support/kmc-solid.md) | ✓ | | ARM SOLID with TOPPERS/ASP3, hardfloat [`armv7a-none-eabihf`](platform-support/arm-none-eabi.md) | * | | Bare Armv7-A, hardfloat +[`armv7a-vex-v5`](platform-support/armv7a-vex-v5.md) | ? | | Armv7-A Cortex-A9 VEX V5 Brain, VEXos [`armv7k-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | Armv7-A Apple WatchOS [`armv7s-apple-ios`](platform-support/apple-ios.md) | ✓ | | Armv7-A Apple-A6 Apple iOS [`armv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | | Bare Armv8-R, hardfloat diff --git a/src/doc/rustc/src/platform-support/apple-ios-macabi.md b/src/doc/rustc/src/platform-support/apple-ios-macabi.md index d4b71dbd4f49..c6f68f7a1e81 100644 --- a/src/doc/rustc/src/platform-support/apple-ios-macabi.md +++ b/src/doc/rustc/src/platform-support/apple-ios-macabi.md @@ -56,6 +56,17 @@ Rust programs can be built for these targets by specifying `--target`, if $ rustc --target aarch64-apple-ios-macabi your-code.rs ``` +The target can be differentiated from the iOS targets with the +`target_env = "macabi"` cfg (or `target_abi = "macabi"` before Rust CURRENT_RUSTC_VERSION). + +```rust +if cfg!(target_env = "macabi") { + // Do something only on Mac Catalyst. +} +``` + +This is similar to the `TARGET_OS_MACCATALYST` define in C code. + ## Testing Mac Catalyst binaries can be run directly on macOS 10.15 Catalina or newer. diff --git a/src/doc/rustc/src/platform-support/apple-ios.md b/src/doc/rustc/src/platform-support/apple-ios.md index 64325554ab60..586afa652262 100644 --- a/src/doc/rustc/src/platform-support/apple-ios.md +++ b/src/doc/rustc/src/platform-support/apple-ios.md @@ -66,6 +66,20 @@ Rust programs can be built for these targets by specifying `--target`, if $ rustc --target aarch64-apple-ios your-code.rs ``` +The simulator variants can be differentiated from the variants running +on-device with the `target_env = "sim"` cfg (or `target_abi = "sim"` before +Rust CURRENT_RUSTC_VERSION). + +```rust +if cfg!(all(target_vendor = "apple", target_env = "sim")) { + // Do something on the iOS/tvOS/visionOS/watchOS Simulator. +} { + // Everything else, like Windows and non-Simulator iOS. +} +``` + +This is similar to the `TARGET_OS_SIMULATOR` define in C code. + ## Testing There is no support for running the Rust or standard library testsuite at the diff --git a/src/doc/rustc/src/platform-support/armv7a-vex-v5.md b/src/doc/rustc/src/platform-support/armv7a-vex-v5.md new file mode 100644 index 000000000000..a7da1b16f7e3 --- /dev/null +++ b/src/doc/rustc/src/platform-support/armv7a-vex-v5.md @@ -0,0 +1,83 @@ +# `armv7a-vex-v5` + +**Tier: 3** + +Allows compiling user programs for the [VEX V5 Brain](https://www.vexrobotics.com/276-4810.html), a microcontroller for educational and competitive robotics. + +Rust support for this target is not affiliated with VEX Robotics or IFI. + +## Target maintainers + +This target is maintained by members of the [vexide](https://github.com/vexide) organization: + +- [@lewisfm](https://github.com/lewisfm) +- [@Tropix126](https://github.com/Tropix126) +- [@Gavin-Niederman](https://github.com/Gavin-Niederman) +- [@max-niederman](https://github.com/max-niederman) + +## Requirements + +This target is cross-compiled and currently requires `#![no_std]`. Dynamic linking is unsupported. + +When compiling for this target, the "C" calling convention maps to AAPCS with VFP registers (hard float ABI) and the "system" calling convention maps to AAPCS without VFP registers (soft float ABI). + +This target generates binaries in the ELF format that may uploaded to the brain with external tools. + +## Building the target + +You can build Rust with support for this target by adding it to the `target` list in `bootstrap.toml`, and then running `./x build --target armv7a-vex-v5 compiler`. + +## Building Rust programs + +Rust does not yet ship pre-compiled artifacts for this target. To compile for +this target, you will either need to build Rust with the target enabled (see +"Building the target" above), or build your own copy of `core` by using +`build-std` or similar. + +When the compiler builds a binary, an ELF build artifact will be produced. Additional tools are required for this artifact to be recognizable to VEXos as a user program. + +The [cargo-v5](https://github.com/vexide/cargo-v5) tool is capable of creating binaries that can be uploaded to the V5 brain. This tool wraps the `cargo build` command by supplying arguments necessary to build the target and produce an artifact recognizable to VEXos, while also providing functionality for uploading over USB to a V5 Controller or Brain. + +To install the tool, run: + +```sh +cargo install cargo-v5 +``` + +The following fields in your project's `Cargo.toml` are read by `cargo-v5` to configure upload behavior: + +```toml +[package.metadata.v5] +# Slot number to upload the user program to. This should be from 1-8. +slot = 1 +# Program icon/thumbnail that will be displayed on the dashboard. +icon = "cool-x" +# Use gzip compression when uploading binaries. +compress = true +``` + +To build an uploadable BIN file using the release profile, run: + +```sh +cargo v5 build --release +``` + +Programs can also be directly uploaded to the brain over a USB connection immediately after building: + +```sh +cargo v5 upload --release +``` + +## Testing + +Binaries built for this target can be run in an emulator (such as [vex-v5-qemu](https://github.com/vexide/vex-v5-qemu)), or uploaded to a physical device over a serial (USB) connection. + +The default Rust test runner is not supported. + +The Rust test suite for `library/std` is not yet supported. + +## Cross-compilation toolchains and C code + +This target can be cross-compiled from any host. + +Linking to C libraries is not supported. diff --git a/src/doc/rustc/src/platform-support/lynxos178.md b/src/doc/rustc/src/platform-support/lynxos178.md index 6463f95a0b8e..121e11fb653c 100644 --- a/src/doc/rustc/src/platform-support/lynxos178.md +++ b/src/doc/rustc/src/platform-support/lynxos178.md @@ -15,7 +15,7 @@ Target triples available: ## Target maintainers -- Renat Fatykhov, https://github.com/rfatykhov-lynx +[@rfatykhov-lynx](https://github.com/rfatykhov-lynx) ## Requirements diff --git a/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md b/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md index 106ec562bfc7..36598982481b 100644 --- a/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md +++ b/src/doc/rustc/src/platform-support/nvptx64-nvidia-cuda.md @@ -10,6 +10,46 @@ platform. [@RDambrosio016](https://github.com/RDambrosio016) [@kjetilkjeka](https://github.com/kjetilkjeka) +## Requirements + +This target is `no_std` and will typically be built with crate-type `cdylib` and `-C linker-flavor=llbc`, which generates PTX. +The necessary components for this workflow are: + +- `rustup toolchain add nightly` +- `rustup component add llvm-tools --toolchain nightly` +- `rustup component add llvm-bitcode-linker --toolchain nightly` + +There are two options for using the core library: + +- `rustup component add rust-src --toolchain nightly` and build using `-Z build-std=core`. +- `rustup target add nvptx64-nvidia-cuda --toolchain nightly` + +### Target and features + +It is generally necessary to specify the target, such as `-C target-cpu=sm_89`, because the default is very old. This implies two target features: `sm_89` and `ptx78` (and all preceding features within `sm_*` and `ptx*`). Rust will default to using the oldest PTX version that supports the target processor (see [this table](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#release-notes-ptx-release-history)), which maximizes driver compatibility. +One can use `-C target-feature=+ptx80` to choose a later PTX version without changing the target (the default in this case, `ptx78`, requires CUDA driver version 11.8, while `ptx80` would require driver version 12.0). +Later PTX versions may allow more efficient code generation. + +Although Rust follows LLVM in representing `ptx*` and `sm_*` as target features, they should be thought of as having crate granularity, set via (either via `-Ctarget-cpu` and optionally `-Ctarget-feature`). +While the compiler accepts `#[target_feature(enable = "ptx80", enable = "sm_89")]`, it is not supported, may not behave as intended, and may become erroneous in the future. + +## Building Rust kernels + +A `no_std` crate containing one or more functions with `extern "ptx-kernel"` can be compiled to PTX using a command like the following. + +```console +$ RUSTFLAGS='-Ctarget-cpu=sm_89' cargo +nightly rustc --target=nvptx64-nvidia-cuda -Zbuild-std=core --crate-type=cdylib -- -Clinker-flavor=llbc -Zunstable-options +``` + +Intrinsics in `core::arch::nvptx` may use `#[cfg(target_feature = "...")]`, thus it's necessary to use `-Zbuild-std=core` with appropriate `RUSTFLAGS`. The following components are needed for this workflow: + +```console +$ rustup component add rust-src --toolchain nightly +$ rustup component add llvm-tools --toolchain nightly +$ rustup component add llvm-bitcode-linker --toolchain nightly +``` + + ``` -nightly-2025-07-25 +nightly-2025-08-07 ``` diff --git a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs index 96f0273c4396..0312bf56e597 100644 --- a/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ast_utils/mod.rs @@ -5,7 +5,6 @@ #![allow(clippy::wildcard_imports, clippy::enum_glob_use)] use crate::{both, over}; -use rustc_ast::ptr::P; use rustc_ast::{self as ast, *}; use rustc_span::symbol::Ident; use std::mem; @@ -83,11 +82,11 @@ pub fn eq_field_pat(l: &PatField, r: &PatField) -> bool { && over(&l.attrs, &r.attrs, eq_attr) } -pub fn eq_qself(l: &P, r: &P) -> bool { +pub fn eq_qself(l: &Box, r: &Box) -> bool { l.position == r.position && eq_ty(&l.ty, &r.ty) } -pub fn eq_maybe_qself(l: Option<&P>, r: Option<&P>) -> bool { +pub fn eq_maybe_qself(l: Option<&Box>, r: Option<&Box>) -> bool { match (l, r) { (Some(l), Some(r)) => eq_qself(l, r), (None, None) => true, @@ -130,7 +129,7 @@ pub fn eq_generic_arg(l: &GenericArg, r: &GenericArg) -> bool { } } -pub fn eq_expr_opt(l: Option<&P>, r: Option<&P>) -> bool { +pub fn eq_expr_opt(l: Option<&Box>, r: Option<&Box>) -> bool { both(l, r, |l, r| eq_expr(l, r)) } @@ -727,7 +726,7 @@ pub fn eq_fn_header(l: &FnHeader, r: &FnHeader) -> bool { } #[expect(clippy::ref_option, reason = "This is the type how it is stored in the AST")] -pub fn eq_opt_fn_contract(l: &Option>, r: &Option>) -> bool { +pub fn eq_opt_fn_contract(l: &Option>, r: &Option>) -> bool { match (l, r) { (Some(l), Some(r)) => { eq_expr_opt(l.requires.as_ref(), r.requires.as_ref()) && eq_expr_opt(l.ensures.as_ref(), r.ensures.as_ref()) diff --git a/src/tools/clippy/clippy_utils/src/attrs.rs b/src/tools/clippy/clippy_utils/src/attrs.rs index 34472eaab93c..2d42e76dcbc9 100644 --- a/src/tools/clippy/clippy_utils/src/attrs.rs +++ b/src/tools/clippy/clippy_utils/src/attrs.rs @@ -2,8 +2,9 @@ use crate::source::SpanRangeExt; use crate::{sym, tokenize_with_text}; use rustc_ast::attr; use rustc_ast::attr::AttributeExt; -use rustc_attr_data_structures::{AttributeKind, find_attr}; use rustc_errors::Applicability; +use rustc_hir::attrs::AttributeKind; +use rustc_hir::find_attr; use rustc_lexer::TokenKind; use rustc_lint::LateContext; use rustc_middle::ty::{AdtDef, TyCtxt}; diff --git a/src/tools/clippy/clippy_utils/src/consts.rs b/src/tools/clippy/clippy_utils/src/consts.rs index 25afa12e95d6..ecd88daa6b39 100644 --- a/src/tools/clippy/clippy_utils/src/consts.rs +++ b/src/tools/clippy/clippy_utils/src/consts.rs @@ -10,7 +10,7 @@ use crate::{clip, is_direct_expn_of, sext, unsext}; use rustc_abi::Size; use rustc_apfloat::Float; use rustc_apfloat::ieee::{Half, Quad}; -use rustc_ast::ast::{self, LitFloatType, LitKind}; +use rustc_ast::ast::{LitFloatType, LitKind}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::{ BinOpKind, Block, ConstBlock, Expr, ExprKind, HirId, Item, ItemKind, Node, PatExpr, PatExprKind, QPath, UnOp, @@ -309,10 +309,10 @@ pub fn lit_to_mir_constant<'tcx>(lit: &LitKind, ty: Option>) -> Constan LitKind::Int(n, _) => Constant::Int(n.get()), LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty { // FIXME(f16_f128): just use `parse()` directly when available for `f16`/`f128` - ast::FloatTy::F16 => Constant::parse_f16(is.as_str()), - ast::FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()), - ast::FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()), - ast::FloatTy::F128 => Constant::parse_f128(is.as_str()), + FloatTy::F16 => Constant::parse_f16(is.as_str()), + FloatTy::F32 => Constant::F32(is.as_str().parse().unwrap()), + FloatTy::F64 => Constant::F64(is.as_str().parse().unwrap()), + FloatTy::F128 => Constant::parse_f128(is.as_str()), }, LitKind::Float(ref is, LitFloatType::Unsuffixed) => match ty.expect("type of float is known").kind() { ty::Float(FloatTy::F16) => Constant::parse_f16(is.as_str()), diff --git a/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs b/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs index 9d38672efada..eb3f442ac754 100644 --- a/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs +++ b/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs @@ -51,7 +51,7 @@ impl ops::BitOrAssign for EagernessSuggestion { fn fn_eagerness(cx: &LateContext<'_>, fn_id: DefId, name: Symbol, have_one_arg: bool) -> EagernessSuggestion { use EagernessSuggestion::{Eager, Lazy, NoChange}; - let ty = match cx.tcx.impl_of_method(fn_id) { + let ty = match cx.tcx.impl_of_assoc(fn_id) { Some(id) => cx.tcx.type_of(id).instantiate_identity(), None => return Lazy, }; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index ce5af4d2f482..fc716d86fc62 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -28,7 +28,6 @@ extern crate indexmap; extern crate rustc_abi; extern crate rustc_ast; -extern crate rustc_attr_data_structures; extern crate rustc_attr_parsing; extern crate rustc_const_eval; extern crate rustc_data_structures; @@ -84,18 +83,18 @@ pub use self::hir_utils::{ use core::mem; use core::ops::ControlFlow; use std::collections::hash_map::Entry; -use std::iter::{once, repeat_n}; +use std::iter::{once, repeat_n, zip}; use std::sync::{Mutex, MutexGuard, OnceLock}; use itertools::Itertools; use rustc_abi::Integer; use rustc_ast::ast::{self, LitKind, RangeLimits}; use rustc_ast::join_path_syms; -use rustc_attr_data_structures::{AttributeKind, find_attr}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::packed::Pu128; use rustc_data_structures::unhash::UnindexMap; use rustc_hir::LangItem::{OptionNone, OptionSome, ResultErr, ResultOk}; +use rustc_hir::attrs::AttributeKind; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; use rustc_hir::definitions::{DefPath, DefPathData}; @@ -106,7 +105,7 @@ use rustc_hir::{ CoroutineKind, Destination, Expr, ExprField, ExprKind, FnDecl, FnRetTy, GenericArg, GenericArgs, HirId, Impl, ImplItem, ImplItemKind, Item, ItemKind, LangItem, LetStmt, MatchSource, Mutability, Node, OwnerId, OwnerNode, Param, Pat, PatExpr, PatExprKind, PatKind, Path, PathSegment, QPath, Stmt, StmtKind, TraitFn, TraitItem, - TraitItemKind, TraitRef, TyKind, UnOp, def, + TraitItemKind, TraitRef, TyKind, UnOp, def, find_attr, }; use rustc_lexer::{FrontmatterAllowed, TokenKind, tokenize}; use rustc_lint::{LateContext, Level, Lint, LintContext}; @@ -349,7 +348,7 @@ pub fn is_ty_alias(qpath: &QPath<'_>) -> bool { /// Checks if the given method call expression calls an inherent method. pub fn is_inherent_method_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { if let Some(method_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) { - cx.tcx.trait_of_item(method_id).is_none() + cx.tcx.trait_of_assoc(method_id).is_none() } else { false } @@ -357,7 +356,7 @@ pub fn is_inherent_method_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { /// Checks if a method is defined in an impl of a diagnostic item pub fn is_diag_item_method(cx: &LateContext<'_>, def_id: DefId, diag_item: Symbol) -> bool { - if let Some(impl_did) = cx.tcx.impl_of_method(def_id) + if let Some(impl_did) = cx.tcx.impl_of_assoc(def_id) && let Some(adt) = cx.tcx.type_of(impl_did).instantiate_identity().ty_adt_def() { return cx.tcx.is_diagnostic_item(diag_item, adt.did()); @@ -367,7 +366,7 @@ pub fn is_diag_item_method(cx: &LateContext<'_>, def_id: DefId, diag_item: Symbo /// Checks if a method is in a diagnostic item trait pub fn is_diag_trait_item(cx: &LateContext<'_>, def_id: DefId, diag_item: Symbol) -> bool { - if let Some(trait_did) = cx.tcx.trait_of_item(def_id) { + if let Some(trait_did) = cx.tcx.trait_of_assoc(def_id) { return cx.tcx.is_diagnostic_item(diag_item, trait_did); } false @@ -582,7 +581,7 @@ pub fn can_mut_borrow_both(cx: &LateContext<'_>, e1: &Expr<'_>, e2: &Expr<'_>) - return false; } - for (x1, x2) in s1.iter().zip(s2.iter()) { + for (x1, x2) in zip(&s1, &s2) { if expr_custom_deref_adjustment(cx, x1).is_some() || expr_custom_deref_adjustment(cx, x2).is_some() { return false; } @@ -620,7 +619,7 @@ fn is_default_equivalent_ctor(cx: &LateContext<'_>, def_id: DefId, path: &QPath< if let QPath::TypeRelative(_, method) = path && method.ident.name == sym::new - && let Some(impl_did) = cx.tcx.impl_of_method(def_id) + && let Some(impl_did) = cx.tcx.impl_of_assoc(def_id) && let Some(adt) = cx.tcx.type_of(impl_did).instantiate_identity().ty_adt_def() { return std_types_symbols.iter().any(|&symbol| { @@ -1898,42 +1897,11 @@ pub fn is_must_use_func_call(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { /// * `|x| { return x; }` /// * `|(x, y)| (x, y)` /// * `|[x, y]| [x, y]` +/// * `|Foo(bar, baz)| Foo(bar, baz)` +/// * `|Foo { bar, baz }| Foo { bar, baz }` /// /// Consider calling [`is_expr_untyped_identity_function`] or [`is_expr_identity_function`] instead. fn is_body_identity_function(cx: &LateContext<'_>, func: &Body<'_>) -> bool { - fn check_pat(cx: &LateContext<'_>, pat: &Pat<'_>, expr: &Expr<'_>) -> bool { - if cx - .typeck_results() - .pat_binding_modes() - .get(pat.hir_id) - .is_some_and(|mode| matches!(mode.0, ByRef::Yes(_))) - { - // If the parameter is `(x, y)` of type `&(T, T)`, or `[x, y]` of type `&[T; 2]`, then - // due to match ergonomics, the inner patterns become references. Don't consider this - // the identity function as that changes types. - return false; - } - - match (pat.kind, expr.kind) { - (PatKind::Binding(_, id, _, _), _) => { - path_to_local_id(expr, id) && cx.typeck_results().expr_adjustments(expr).is_empty() - }, - (PatKind::Tuple(pats, dotdot), ExprKind::Tup(tup)) - if dotdot.as_opt_usize().is_none() && pats.len() == tup.len() => - { - pats.iter().zip(tup).all(|(pat, expr)| check_pat(cx, pat, expr)) - }, - (PatKind::Slice(before, slice, after), ExprKind::Array(arr)) - if slice.is_none() && before.len() + after.len() == arr.len() => - { - (before.iter().chain(after)) - .zip(arr) - .all(|(pat, expr)| check_pat(cx, pat, expr)) - }, - _ => false, - } - } - let [param] = func.params else { return false; }; @@ -1966,11 +1934,81 @@ fn is_body_identity_function(cx: &LateContext<'_>, func: &Body<'_>) -> bool { return false; } }, - _ => return check_pat(cx, param.pat, expr), + _ => return is_expr_identity_of_pat(cx, param.pat, expr, true), } } } +/// Checks if the given expression is an identity representation of the given pattern: +/// * `x` is the identity representation of `x` +/// * `(x, y)` is the identity representation of `(x, y)` +/// * `[x, y]` is the identity representation of `[x, y]` +/// * `Foo(bar, baz)` is the identity representation of `Foo(bar, baz)` +/// * `Foo { bar, baz }` is the identity representation of `Foo { bar, baz }` +/// +/// Note that `by_hir` is used to determine bindings are checked by their `HirId` or by their name. +/// This can be useful when checking patterns in `let` bindings or `match` arms. +pub fn is_expr_identity_of_pat(cx: &LateContext<'_>, pat: &Pat<'_>, expr: &Expr<'_>, by_hir: bool) -> bool { + if cx + .typeck_results() + .pat_binding_modes() + .get(pat.hir_id) + .is_some_and(|mode| matches!(mode.0, ByRef::Yes(_))) + { + // If the parameter is `(x, y)` of type `&(T, T)`, or `[x, y]` of type `&[T; 2]`, then + // due to match ergonomics, the inner patterns become references. Don't consider this + // the identity function as that changes types. + return false; + } + + // NOTE: we're inside a (function) body, so this won't ICE + let qpath_res = |qpath, hir| cx.typeck_results().qpath_res(qpath, hir); + + match (pat.kind, expr.kind) { + (PatKind::Binding(_, id, _, _), _) if by_hir => { + path_to_local_id(expr, id) && cx.typeck_results().expr_adjustments(expr).is_empty() + }, + (PatKind::Binding(_, _, ident, _), ExprKind::Path(QPath::Resolved(_, path))) => { + matches!(path.segments, [ segment] if segment.ident.name == ident.name) + }, + (PatKind::Tuple(pats, dotdot), ExprKind::Tup(tup)) + if dotdot.as_opt_usize().is_none() && pats.len() == tup.len() => + { + zip(pats, tup).all(|(pat, expr)| is_expr_identity_of_pat(cx, pat, expr, by_hir)) + }, + (PatKind::Slice(before, None, after), ExprKind::Array(arr)) if before.len() + after.len() == arr.len() => { + zip(before.iter().chain(after), arr).all(|(pat, expr)| is_expr_identity_of_pat(cx, pat, expr, by_hir)) + }, + (PatKind::TupleStruct(pat_ident, field_pats, dotdot), ExprKind::Call(ident, fields)) + if dotdot.as_opt_usize().is_none() && field_pats.len() == fields.len() => + { + // check ident + if let ExprKind::Path(ident) = &ident.kind + && qpath_res(&pat_ident, pat.hir_id) == qpath_res(ident, expr.hir_id) + // check fields + && zip(field_pats, fields).all(|(pat, expr)| is_expr_identity_of_pat(cx, pat, expr,by_hir)) + { + true + } else { + false + } + }, + (PatKind::Struct(pat_ident, field_pats, false), ExprKind::Struct(ident, fields, hir::StructTailExpr::None)) + if field_pats.len() == fields.len() => + { + // check ident + qpath_res(&pat_ident, pat.hir_id) == qpath_res(ident, expr.hir_id) + // check fields + && field_pats.iter().all(|field_pat| { + fields.iter().any(|field| { + field_pat.ident == field.ident && is_expr_identity_of_pat(cx, field_pat.pat, field.expr, by_hir) + }) + }) + }, + _ => false, + } +} + /// This is the same as [`is_expr_identity_function`], but does not consider closures /// with type annotations for its bindings (or similar) as identity functions: /// * `|x: u8| x` diff --git a/src/tools/clippy/clippy_utils/src/macros.rs b/src/tools/clippy/clippy_utils/src/macros.rs index ba126fcd05de..60473a26493d 100644 --- a/src/tools/clippy/clippy_utils/src/macros.rs +++ b/src/tools/clippy/clippy_utils/src/macros.rs @@ -42,7 +42,7 @@ pub fn is_format_macro(cx: &LateContext<'_>, macro_def_id: DefId) -> bool { } else { // Allow users to tag any macro as being format!-like // TODO: consider deleting FORMAT_MACRO_DIAG_ITEMS and using just this method - get_unique_attr(cx.sess(), cx.tcx.get_attrs_unchecked(macro_def_id), sym::format_args).is_some() + get_unique_attr(cx.sess(), cx.tcx.get_all_attrs(macro_def_id), sym::format_args).is_some() } } diff --git a/src/tools/clippy/clippy_utils/src/msrvs.rs b/src/tools/clippy/clippy_utils/src/msrvs.rs index 24ed4c3a8bec..89a83e2c48f9 100644 --- a/src/tools/clippy/clippy_utils/src/msrvs.rs +++ b/src/tools/clippy/clippy_utils/src/msrvs.rs @@ -1,8 +1,8 @@ use crate::sym; use rustc_ast::Attribute; use rustc_ast::attr::AttributeExt; -use rustc_attr_data_structures::RustcVersion; use rustc_attr_parsing::parse_version; +use rustc_hir::RustcVersion; use rustc_lint::LateContext; use rustc_session::Session; use rustc_span::Symbol; diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs index b3356450d387..68f0b5ea2558 100644 --- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs +++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs @@ -5,10 +5,10 @@ use crate::msrvs::{self, Msrv}; use hir::LangItem; -use rustc_attr_data_structures::{RustcVersion, StableSince}; use rustc_const_eval::check_consts::ConstCx; use rustc_hir as hir; use rustc_hir::def_id::DefId; +use rustc_hir::{RustcVersion, StableSince}; use rustc_infer::infer::TyCtxtInferExt; use rustc_infer::traits::Obligation; use rustc_lint::LateContext; @@ -420,11 +420,11 @@ pub fn is_stable_const_fn(cx: &LateContext<'_>, def_id: DefId, msrv: Msrv) -> bo .lookup_const_stability(def_id) .or_else(|| { cx.tcx - .trait_of_item(def_id) + .trait_of_assoc(def_id) .and_then(|trait_def_id| cx.tcx.lookup_const_stability(trait_def_id)) }) .is_none_or(|const_stab| { - if let rustc_attr_data_structures::StabilityLevel::Stable { since, .. } = const_stab.level { + if let rustc_hir::StabilityLevel::Stable { since, .. } = const_stab.level { // Checking MSRV is manually necessary because `rustc` has no such concept. This entire // function could be removed if `rustc` provided a MSRV-aware version of `is_stable_const_fn`. // as a part of an unimplemented MSRV check https://github.com/rust-lang/rust/issues/65262. diff --git a/src/tools/clippy/clippy_utils/src/source.rs b/src/tools/clippy/clippy_utils/src/source.rs index 7d21336be1cd..e675291b6f3a 100644 --- a/src/tools/clippy/clippy_utils/src/source.rs +++ b/src/tools/clippy/clippy_utils/src/source.rs @@ -342,11 +342,8 @@ impl SourceFileRange { /// Attempts to get the text from the source file. This can fail if the source text isn't /// loaded. pub fn as_str(&self) -> Option<&str> { - self.sf - .src - .as_ref() - .map(|src| src.as_str()) - .or_else(|| self.sf.external_src.get().and_then(|src| src.get_source())) + (self.sf.src.as_ref().map(|src| src.as_str())) + .or_else(|| self.sf.external_src.get()?.get_source()) .and_then(|x| x.get(self.range.clone())) } } diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs index 7a24d07fa1df..a63333c9b48f 100644 --- a/src/tools/clippy/clippy_utils/src/sugg.rs +++ b/src/tools/clippy/clippy_utils/src/sugg.rs @@ -4,11 +4,11 @@ use crate::source::{snippet, snippet_opt, snippet_with_applicability, snippet_with_context}; use crate::ty::expr_sig; use crate::{get_parent_expr_for_hir, higher}; -use rustc_ast::ast; use rustc_ast::util::parser::AssocOp; +use rustc_ast::{UnOp, ast}; +use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; -use rustc_hir as hir; -use rustc_hir::{Closure, ExprKind, HirId, MutTy, TyKind}; +use rustc_hir::{self as hir, Closure, ExprKind, HirId, MutTy, Node, TyKind}; use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId}; use rustc_lint::{EarlyContext, LateContext, LintContext}; use rustc_middle::hir::place::ProjectionKind; @@ -29,6 +29,11 @@ pub enum Sugg<'a> { /// A binary operator expression, including `as`-casts and explicit type /// coercion. BinOp(AssocOp, Cow<'a, str>, Cow<'a, str>), + /// A unary operator expression. This is used to sometimes represent `!` + /// or `-`, but only if the type with and without the operator is kept identical. + /// It means that doubling the operator can be used to remove it instead, in + /// order to provide better suggestions. + UnOp(UnOp, Box>), } /// Literal constant `0`, for convenience. @@ -40,9 +45,10 @@ pub const EMPTY: Sugg<'static> = Sugg::NonParen(Cow::Borrowed("")); impl Display for Sugg<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { - match *self { - Sugg::NonParen(ref s) | Sugg::MaybeParen(ref s) => s.fmt(f), - Sugg::BinOp(op, ref lhs, ref rhs) => binop_to_string(op, lhs, rhs).fmt(f), + match self { + Sugg::NonParen(s) | Sugg::MaybeParen(s) => s.fmt(f), + Sugg::BinOp(op, lhs, rhs) => binop_to_string(*op, lhs, rhs).fmt(f), + Sugg::UnOp(op, inner) => write!(f, "{}{}", op.as_str(), inner.clone().maybe_inner_paren()), } } } @@ -100,9 +106,19 @@ impl<'a> Sugg<'a> { applicability: &mut Applicability, ) -> Self { if expr.span.ctxt() == ctxt { - Self::hir_from_snippet(expr, |span| { - snippet_with_context(cx, span, ctxt, default, applicability).0 - }) + if let ExprKind::Unary(op, inner) = expr.kind + && matches!(op, UnOp::Neg | UnOp::Not) + && cx.typeck_results().expr_ty(expr) == cx.typeck_results().expr_ty(inner) + { + Sugg::UnOp( + op, + Box::new(Self::hir_with_context(cx, inner, ctxt, default, applicability)), + ) + } else { + Self::hir_from_snippet(expr, |span| { + snippet_with_context(cx, span, ctxt, default, applicability).0 + }) + } } else { let (snip, _) = snippet_with_context(cx, expr.span, ctxt, default, applicability); Sugg::NonParen(snip) @@ -341,6 +357,7 @@ impl<'a> Sugg<'a> { let sugg = binop_to_string(op, &lhs, &rhs); Sugg::NonParen(format!("({sugg})").into()) }, + Sugg::UnOp(op, inner) => Sugg::NonParen(format!("({}{})", op.as_str(), inner.maybe_inner_paren()).into()), } } @@ -348,6 +365,26 @@ impl<'a> Sugg<'a> { match self { Sugg::NonParen(p) | Sugg::MaybeParen(p) => p.into_owned(), Sugg::BinOp(b, l, r) => binop_to_string(b, &l, &r), + Sugg::UnOp(op, inner) => format!("{}{}", op.as_str(), inner.maybe_inner_paren()), + } + } + + /// Checks if `self` starts with a unary operator. + fn starts_with_unary_op(&self) -> bool { + match self { + Sugg::UnOp(..) => true, + Sugg::BinOp(..) => false, + Sugg::MaybeParen(s) | Sugg::NonParen(s) => s.starts_with(['*', '!', '-', '&']), + } + } + + /// Call `maybe_paren` on `self` if it doesn't start with a unary operator, + /// don't touch it otherwise. + fn maybe_inner_paren(self) -> Self { + if self.starts_with_unary_op() { + self + } else { + self.maybe_paren() } } } @@ -430,10 +467,11 @@ impl Sub for &Sugg<'_> { forward_binop_impls_to_ref!(impl Add, add for Sugg<'_>, type Output = Sugg<'static>); forward_binop_impls_to_ref!(impl Sub, sub for Sugg<'_>, type Output = Sugg<'static>); -impl Neg for Sugg<'_> { - type Output = Sugg<'static>; - fn neg(self) -> Sugg<'static> { - match &self { +impl<'a> Neg for Sugg<'a> { + type Output = Sugg<'a>; + fn neg(self) -> Self::Output { + match self { + Self::UnOp(UnOp::Neg, sugg) => *sugg, Self::BinOp(AssocOp::Cast, ..) => Sugg::MaybeParen(format!("-({self})").into()), _ => make_unop("-", self), } @@ -446,19 +484,21 @@ impl<'a> Not for Sugg<'a> { use AssocOp::Binary; use ast::BinOpKind::{Eq, Ge, Gt, Le, Lt, Ne}; - if let Sugg::BinOp(op, lhs, rhs) = self { - let to_op = match op { - Binary(Eq) => Binary(Ne), - Binary(Ne) => Binary(Eq), - Binary(Lt) => Binary(Ge), - Binary(Ge) => Binary(Lt), - Binary(Gt) => Binary(Le), - Binary(Le) => Binary(Gt), - _ => return make_unop("!", Sugg::BinOp(op, lhs, rhs)), - }; - Sugg::BinOp(to_op, lhs, rhs) - } else { - make_unop("!", self) + match self { + Sugg::BinOp(op, lhs, rhs) => { + let to_op = match op { + Binary(Eq) => Binary(Ne), + Binary(Ne) => Binary(Eq), + Binary(Lt) => Binary(Ge), + Binary(Ge) => Binary(Lt), + Binary(Gt) => Binary(Le), + Binary(Le) => Binary(Gt), + _ => return make_unop("!", Sugg::BinOp(op, lhs, rhs)), + }; + Sugg::BinOp(to_op, lhs, rhs) + }, + Sugg::UnOp(UnOp::Not, expr) => *expr, + _ => make_unop("!", self), } } } @@ -491,20 +531,11 @@ impl Display for ParenHelper { /// Builds the string for `` adding parenthesis when necessary. /// /// For convenience, the operator is taken as a string because all unary -/// operators have the same -/// precedence. +/// operators have the same precedence. pub fn make_unop(op: &str, expr: Sugg<'_>) -> Sugg<'static> { - // If the `expr` starts with `op` already, do not add wrap it in + // If the `expr` starts with a unary operator already, do not wrap it in // parentheses. - let expr = if let Sugg::MaybeParen(ref sugg) = expr - && !has_enclosing_paren(sugg) - && sugg.starts_with(op) - { - expr - } else { - expr.maybe_paren() - }; - Sugg::MaybeParen(format!("{op}{expr}").into()) + Sugg::MaybeParen(format!("{op}{}", expr.maybe_inner_paren()).into()) } /// Builds the string for ` ` adding parenthesis when necessary. @@ -753,8 +784,10 @@ pub fn deref_closure_args(cx: &LateContext<'_>, closure: &hir::Expr<'_>) -> Opti let mut visitor = DerefDelegate { cx, closure_span: closure.span, + closure_arg_id: closure_body.params[0].pat.hir_id, closure_arg_is_type_annotated_double_ref, next_pos: closure.span.lo(), + checked_borrows: FxHashSet::default(), suggestion_start: String::new(), applicability: Applicability::MachineApplicable, }; @@ -780,10 +813,15 @@ struct DerefDelegate<'a, 'tcx> { cx: &'a LateContext<'tcx>, /// The span of the input closure to adapt closure_span: Span, + /// The `hir_id` of the closure argument being checked + closure_arg_id: HirId, /// Indicates if the arg of the closure is a type annotated double reference closure_arg_is_type_annotated_double_ref: bool, /// last position of the span to gradually build the suggestion next_pos: BytePos, + /// `hir_id`s that has been checked. This is used to avoid checking the same `hir_id` multiple + /// times when inside macro expansions. + checked_borrows: FxHashSet, /// starting part of the gradually built suggestion suggestion_start: String, /// confidence on the built suggestion @@ -847,9 +885,15 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> { fn use_cloned(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {} + #[expect(clippy::too_many_lines)] fn borrow(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId, _: ty::BorrowKind) { if let PlaceBase::Local(id) = cmt.place.base { let span = self.cx.tcx.hir_span(cmt.hir_id); + if !self.checked_borrows.insert(cmt.hir_id) { + // already checked this span and hir_id, skip + return; + } + let start_span = Span::new(self.next_pos, span.lo(), span.ctxt(), None); let mut start_snip = snippet_with_applicability(self.cx, start_span, "..", &mut self.applicability); @@ -858,7 +902,12 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> { // full identifier that includes projection (i.e.: `fp.field`) let ident_str_with_proj = snippet(self.cx, span, "..").to_string(); - if cmt.place.projections.is_empty() { + // Make sure to get in all projections if we're on a `matches!` + if let Node::Pat(pat) = self.cx.tcx.hir_node(id) + && pat.hir_id != self.closure_arg_id + { + let _ = write!(self.suggestion_start, "{start_snip}{ident_str_with_proj}"); + } else if cmt.place.projections.is_empty() { // handle item without any projection, that needs an explicit borrowing // i.e.: suggest `&x` instead of `x` let _: fmt::Result = write!(self.suggestion_start, "{start_snip}&{ident_str}"); diff --git a/src/tools/clippy/clippy_utils/src/sym.rs b/src/tools/clippy/clippy_utils/src/sym.rs index 934be97d94e5..ce7cc9348fbd 100644 --- a/src/tools/clippy/clippy_utils/src/sym.rs +++ b/src/tools/clippy/clippy_utils/src/sym.rs @@ -171,7 +171,6 @@ generate! { has_significant_drop, hidden_glob_reexports, hygiene, - if_chain, insert, inspect, int_roundings, diff --git a/src/tools/clippy/clippy_utils/src/ty/mod.rs b/src/tools/clippy/clippy_utils/src/ty/mod.rs index d70232ef3aa5..d79773f83211 100644 --- a/src/tools/clippy/clippy_utils/src/ty/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ty/mod.rs @@ -6,12 +6,12 @@ use core::ops::ControlFlow; use itertools::Itertools; use rustc_abi::VariantIdx; use rustc_ast::ast::Mutability; -use rustc_attr_data_structures::{AttributeKind, find_attr}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; +use rustc_hir::attrs::AttributeKind; use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; use rustc_hir::def_id::DefId; -use rustc_hir::{Expr, FnDecl, LangItem, TyKind}; +use rustc_hir::{Expr, FnDecl, LangItem, TyKind, find_attr}; use rustc_hir_analysis::lower_ty; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::LateContext; @@ -582,7 +582,7 @@ pub fn all_predicates_of(tcx: TyCtxt<'_>, id: DefId) -> impl Iterator { Sig(Binder<'tcx, FnSig<'tcx>>, Option), Closure(Option<&'tcx FnDecl<'tcx>>, Binder<'tcx, FnSig<'tcx>>), diff --git a/src/tools/clippy/declare_clippy_lint/Cargo.toml b/src/tools/clippy/declare_clippy_lint/Cargo.toml index bd6b4dfdee4d..ec0e59e70549 100644 --- a/src/tools/clippy/declare_clippy_lint/Cargo.toml +++ b/src/tools/clippy/declare_clippy_lint/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "declare_clippy_lint" -version = "0.1.90" +version = "0.1.91" edition = "2024" repository = "https://github.com/rust-lang/rust-clippy" license = "MIT OR Apache-2.0" diff --git a/src/tools/clippy/lintcheck/src/input.rs b/src/tools/clippy/lintcheck/src/input.rs index 408a2e087af2..1ed059d2fb11 100644 --- a/src/tools/clippy/lintcheck/src/input.rs +++ b/src/tools/clippy/lintcheck/src/input.rs @@ -117,7 +117,7 @@ pub fn read_crates(toml_path: &Path) -> (Vec, RecursiveOptions) crate_sources.push(CrateWithSource { name: tk.name.clone(), source: CrateSource::CratesIo { - version: version.to_string(), + version: version.clone(), }, file_link: tk.file_link(DEFAULT_DOCS_LINK), options: tk.options.clone(), diff --git a/src/tools/clippy/lintcheck/src/json.rs b/src/tools/clippy/lintcheck/src/json.rs index 808997ff0220..79c1255c5ffe 100644 --- a/src/tools/clippy/lintcheck/src/json.rs +++ b/src/tools/clippy/lintcheck/src/json.rs @@ -66,7 +66,7 @@ impl fmt::Display for Summary { } in &self.0 { let html_id = to_html_id(name); - writeln!(f, "| [`{name}`](#{html_id}) | {added} | {changed} | {removed} |")?; + writeln!(f, "| [`{name}`](#{html_id}) | {added} | {removed} | {changed} |")?; } Ok(()) diff --git a/src/tools/clippy/lintcheck/src/output.rs b/src/tools/clippy/lintcheck/src/output.rs index d7fe0915121d..1ecc3f7c2494 100644 --- a/src/tools/clippy/lintcheck/src/output.rs +++ b/src/tools/clippy/lintcheck/src/output.rs @@ -220,7 +220,7 @@ fn print_stats(old_stats: HashMap, new_stats: HashMap<&String, us let same_in_both_hashmaps = old_stats .iter() .filter(|(old_key, old_val)| new_stats.get::<&String>(old_key) == Some(old_val)) - .map(|(k, v)| (k.to_string(), *v)) + .map(|(k, v)| (k.clone(), *v)) .collect::>(); let mut old_stats_deduped = old_stats; diff --git a/src/tools/clippy/rust-toolchain.toml b/src/tools/clippy/rust-toolchain.toml index 0edb80edd04e..ac51ec2d61b5 100644 --- a/src/tools/clippy/rust-toolchain.toml +++ b/src/tools/clippy/rust-toolchain.toml @@ -1,6 +1,6 @@ [toolchain] # begin autogenerated nightly -channel = "nightly-2025-07-25" +channel = "nightly-2025-08-07" # end autogenerated nightly components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"] profile = "minimal" diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs index 464efc45c6b4..6b6dfd7b81ea 100644 --- a/src/tools/clippy/tests/compile-test.rs +++ b/src/tools/clippy/tests/compile-test.rs @@ -73,8 +73,7 @@ fn internal_extern_flags() -> Vec { && INTERNAL_TEST_DEPENDENCIES.contains(&name) { // A dependency may be listed twice if it is available in sysroot, - // and the sysroot dependencies are listed first. As of the writing, - // this only seems to apply to if_chain. + // and the sysroot dependencies are listed first. crates.insert(name, path); } } @@ -434,6 +433,7 @@ fn ui_cargo_toml_metadata() { #[derive(Template)] #[template(path = "index_template.html")] struct Renderer<'a> { + count: usize, lints: &'a Vec, } @@ -513,7 +513,12 @@ impl DiagnosticCollector { fs::write( "util/gh-pages/index.html", - Renderer { lints: &metadata }.render().unwrap(), + Renderer { + count: LINTS.len(), + lints: &metadata, + } + .render() + .unwrap(), ) .unwrap(); }); diff --git a/src/tools/clippy/tests/symbols-used.rs b/src/tools/clippy/tests/symbols-used.rs index bc0456711fb2..a1049ba64d54 100644 --- a/src/tools/clippy/tests/symbols-used.rs +++ b/src/tools/clippy/tests/symbols-used.rs @@ -75,7 +75,7 @@ fn all_symbols_are_used() -> Result<()> { for sym in extra { eprintln!(" - {sym}"); } - Err(format!("extra symbols found — remove them {SYM_FILE}"))?; + Err(format!("extra symbols found — remove them from {SYM_FILE}"))?; } Ok(()) } diff --git a/src/tools/clippy/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.stderr b/src/tools/clippy/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.stderr index 14a6b5047b18..666b842bf808 100644 --- a/src/tools/clippy/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.stderr +++ b/src/tools/clippy/tests/ui-cargo/cargo_rust_version/fail_file_attr/Cargo.stderr @@ -7,7 +7,7 @@ error: unnecessary structure name repetition note: the lint level is defined here --> src/main.rs:6:9 | -6 | #![deny(clippy::use_self)] + 6 | #![deny(clippy::use_self)] | ^^^^^^^^^^^^^^^^ error: unnecessary structure name repetition diff --git a/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/Cargo.stderr b/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/Cargo.stderr index b626551e35b9..8db52c47ad54 100644 --- a/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/Cargo.stderr +++ b/src/tools/clippy/tests/ui-cargo/duplicate_mod/fail/Cargo.stderr @@ -14,10 +14,10 @@ error: file is loaded as a module multiple times: `src/b.rs` error: file is loaded as a module multiple times: `src/c.rs` --> src/main.rs:7:1 | -7 | mod c; + 7 | mod c; | ^^^^^^ first loaded here -8 | / #[path = "c.rs"] -9 | | mod c2; + 8 | / #[path = "c.rs"] + 9 | | mod c2; | |_______^ loaded again here 10 | / #[path = "c.rs"] 11 | | mod c3; @@ -44,8 +44,8 @@ error: file is loaded as a module multiple times: `src/from_other_module.rs` | ::: src/other_module/mod.rs:1:1 | -1 | / #[path = "../from_other_module.rs"] -2 | | mod m; + 1 | / #[path = "../from_other_module.rs"] + 2 | | mod m; | |______^ loaded again here | = help: replace all but one `mod` item with `use` items diff --git a/src/tools/clippy/tests/ui-cargo/lint_groups_priority/fail/Cargo.stderr b/src/tools/clippy/tests/ui-cargo/lint_groups_priority/fail/Cargo.stderr index 059427d8ee0f..a87339a9a301 100644 --- a/src/tools/clippy/tests/ui-cargo/lint_groups_priority/fail/Cargo.stderr +++ b/src/tools/clippy/tests/ui-cargo/lint_groups_priority/fail/Cargo.stderr @@ -1,7 +1,7 @@ error: lint group `rust_2018_idioms` has the same priority (0) as a lint --> Cargo.toml:7:1 | -7 | rust_2018_idioms = "warn" + 7 | rust_2018_idioms = "warn" | ^^^^^^^^^^^^^^^^ ------ has an implicit priority of 0 ... 12 | unused_attributes = { level = "allow" } @@ -11,8 +11,8 @@ error: lint group `rust_2018_idioms` has the same priority (0) as a lint = note: `#[deny(clippy::lint_groups_priority)]` on by default help: to have lints override the group set `rust_2018_idioms` to a lower priority | -7 - rust_2018_idioms = "warn" -7 + rust_2018_idioms = { level = "warn", priority = -1 } + 7 - rust_2018_idioms = "warn" + 7 + rust_2018_idioms = { level = "warn", priority = -1 } | error: lint group `unused` has the same priority (0) as a lint diff --git a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.fixed b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.fixed index 20511cbed165..ec9fbcfd4a37 100644 --- a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.fixed +++ b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.fixed @@ -1,3 +1,4 @@ +//@aux-build:../../ui/auxiliary/proc_macros.rs #![warn(clippy::wildcard_imports)] mod prelude { @@ -13,6 +14,10 @@ mod my_crate { pub mod utils { pub fn my_util_fn() {} } + + pub mod utils2 { + pub const SOME_CONST: u32 = 1; + } } pub use utils::{BAR, print}; @@ -22,6 +27,12 @@ use my_crate::utils::my_util_fn; use prelude::FOO; //~^ ERROR: usage of wildcard import +proc_macros::external! { + use my_crate::utils2::*; + + static SOME_STATIC: u32 = SOME_CONST; +} + fn main() { let _ = FOO; let _ = BAR; diff --git a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.rs b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.rs index 8d05910f471b..233ee19f89b9 100644 --- a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.rs +++ b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.rs @@ -1,3 +1,4 @@ +//@aux-build:../../ui/auxiliary/proc_macros.rs #![warn(clippy::wildcard_imports)] mod prelude { @@ -13,6 +14,10 @@ mod my_crate { pub mod utils { pub fn my_util_fn() {} } + + pub mod utils2 { + pub const SOME_CONST: u32 = 1; + } } pub use utils::*; @@ -22,6 +27,12 @@ use my_crate::utils::*; use prelude::*; //~^ ERROR: usage of wildcard import +proc_macros::external! { + use my_crate::utils2::*; + + static SOME_STATIC: u32 = SOME_CONST; +} + fn main() { let _ = FOO; let _ = BAR; diff --git a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr index 5e624dd6c3cd..5d37cb705f51 100644 --- a/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr +++ b/src/tools/clippy/tests/ui-toml/wildcard_imports/wildcard_imports.stderr @@ -1,5 +1,5 @@ error: usage of wildcard import - --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:18:9 + --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:23:9 | LL | pub use utils::*; | ^^^^^^^^ help: try: `utils::{BAR, print}` @@ -8,13 +8,13 @@ LL | pub use utils::*; = help: to override `-D warnings` add `#[allow(clippy::wildcard_imports)]` error: usage of wildcard import - --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:20:5 + --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:25:5 | LL | use my_crate::utils::*; | ^^^^^^^^^^^^^^^^^^ help: try: `my_crate::utils::my_util_fn` error: usage of wildcard import - --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:22:5 + --> tests/ui-toml/wildcard_imports/wildcard_imports.rs:27:5 | LL | use prelude::*; | ^^^^^^^^^^ help: try: `prelude::FOO` diff --git a/src/tools/clippy/tests/ui/cast_lossless_integer_unfixable.rs b/src/tools/clippy/tests/ui/cast_lossless_integer_unfixable.rs new file mode 100644 index 000000000000..db9cbbb5b663 --- /dev/null +++ b/src/tools/clippy/tests/ui/cast_lossless_integer_unfixable.rs @@ -0,0 +1,17 @@ +//@check-pass +#![warn(clippy::cast_lossless)] + +fn issue15348() { + macro_rules! zero { + ($int:ty) => {{ + let data: [u8; 3] = [0, 0, 0]; + data[0] as $int + }}; + } + + let _ = zero!(u8); + let _ = zero!(u16); + let _ = zero!(u32); + let _ = zero!(u64); + let _ = zero!(u128); +} diff --git a/src/tools/clippy/tests/ui/collapsible_else_if.fixed b/src/tools/clippy/tests/ui/collapsible_else_if.fixed index fed75244c6f7..3d709fe9b8e0 100644 --- a/src/tools/clippy/tests/ui/collapsible_else_if.fixed +++ b/src/tools/clippy/tests/ui/collapsible_else_if.fixed @@ -104,3 +104,25 @@ fn issue14799() { } } } + +fn in_parens() { + let x = "hello"; + let y = "world"; + + if x == "hello" { + print!("Hello "); + } else if y == "world" { println!("world") } else { println!("!") } + //~^^^ collapsible_else_if +} + +fn in_brackets() { + let x = "hello"; + let y = "world"; + + // There is no lint when the inner `if` is in a block. + if x == "hello" { + print!("Hello "); + } else { + { if y == "world" { println!("world") } else { println!("!") } } + } +} diff --git a/src/tools/clippy/tests/ui/collapsible_else_if.rs b/src/tools/clippy/tests/ui/collapsible_else_if.rs index e50e781fb698..51868e039086 100644 --- a/src/tools/clippy/tests/ui/collapsible_else_if.rs +++ b/src/tools/clippy/tests/ui/collapsible_else_if.rs @@ -120,3 +120,27 @@ fn issue14799() { } } } + +fn in_parens() { + let x = "hello"; + let y = "world"; + + if x == "hello" { + print!("Hello "); + } else { + (if y == "world" { println!("world") } else { println!("!") }) + } + //~^^^ collapsible_else_if +} + +fn in_brackets() { + let x = "hello"; + let y = "world"; + + // There is no lint when the inner `if` is in a block. + if x == "hello" { + print!("Hello "); + } else { + { if y == "world" { println!("world") } else { println!("!") } } + } +} diff --git a/src/tools/clippy/tests/ui/collapsible_else_if.stderr b/src/tools/clippy/tests/ui/collapsible_else_if.stderr index 7d80894cadbb..1a7bcec7fd5d 100644 --- a/src/tools/clippy/tests/ui/collapsible_else_if.stderr +++ b/src/tools/clippy/tests/ui/collapsible_else_if.stderr @@ -150,5 +150,14 @@ LL | | if false {} LL | | } | |_____^ help: collapse nested if block: `if false {}` -error: aborting due to 8 previous errors +error: this `else { if .. }` block can be collapsed + --> tests/ui/collapsible_else_if.rs:130:12 + | +LL | } else { + | ____________^ +LL | | (if y == "world" { println!("world") } else { println!("!") }) +LL | | } + | |_____^ help: collapse nested if block: `if y == "world" { println!("world") } else { println!("!") }` + +error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/collapsible_if.fixed b/src/tools/clippy/tests/ui/collapsible_if.fixed index 77bc791ea8e9..78354c2d7cf8 100644 --- a/src/tools/clippy/tests/ui/collapsible_if.fixed +++ b/src/tools/clippy/tests/ui/collapsible_if.fixed @@ -163,3 +163,21 @@ fn issue14799() { if true {} }; } + +fn in_parens() { + if true + && true { + println!("In parens, linted"); + } + //~^^^^^ collapsible_if +} + +fn in_brackets() { + if true { + { + if true { + println!("In brackets, not linted"); + } + } + } +} diff --git a/src/tools/clippy/tests/ui/collapsible_if.rs b/src/tools/clippy/tests/ui/collapsible_if.rs index d30df157d5eb..5d9afa109569 100644 --- a/src/tools/clippy/tests/ui/collapsible_if.rs +++ b/src/tools/clippy/tests/ui/collapsible_if.rs @@ -173,3 +173,22 @@ fn issue14799() { if true {} }; } + +fn in_parens() { + if true { + (if true { + println!("In parens, linted"); + }) + } + //~^^^^^ collapsible_if +} + +fn in_brackets() { + if true { + { + if true { + println!("In brackets, not linted"); + } + } + } +} diff --git a/src/tools/clippy/tests/ui/collapsible_if.stderr b/src/tools/clippy/tests/ui/collapsible_if.stderr index 32c6b0194030..a685cc2e9291 100644 --- a/src/tools/clippy/tests/ui/collapsible_if.stderr +++ b/src/tools/clippy/tests/ui/collapsible_if.stderr @@ -190,5 +190,23 @@ LL | // This is a comment, do not collapse code to it LL ~ ; 3 | -error: aborting due to 11 previous errors +error: this `if` statement can be collapsed + --> tests/ui/collapsible_if.rs:178:5 + | +LL | / if true { +LL | | (if true { +LL | | println!("In parens, linted"); +LL | | }) +LL | | } + | |_____^ + | +help: collapse nested if block + | +LL ~ if true +LL ~ && true { +LL | println!("In parens, linted"); +LL ~ } + | + +error: aborting due to 12 previous errors diff --git a/src/tools/clippy/tests/ui/deprecated.rs b/src/tools/clippy/tests/ui/deprecated.rs index 6b69bdd29cea..9743a83fb934 100644 --- a/src/tools/clippy/tests/ui/deprecated.rs +++ b/src/tools/clippy/tests/ui/deprecated.rs @@ -12,6 +12,7 @@ #![warn(clippy::regex_macro)] //~ ERROR: lint `clippy::regex_macro` #![warn(clippy::replace_consts)] //~ ERROR: lint `clippy::replace_consts` #![warn(clippy::should_assert_eq)] //~ ERROR: lint `clippy::should_assert_eq` +#![warn(clippy::string_to_string)] //~ ERROR: lint `clippy::string_to_string` #![warn(clippy::unsafe_vector_initialization)] //~ ERROR: lint `clippy::unsafe_vector_initialization` #![warn(clippy::unstable_as_mut_slice)] //~ ERROR: lint `clippy::unstable_as_mut_slice` #![warn(clippy::unstable_as_slice)] //~ ERROR: lint `clippy::unstable_as_slice` diff --git a/src/tools/clippy/tests/ui/deprecated.stderr b/src/tools/clippy/tests/ui/deprecated.stderr index 07e59d33d608..cd225da611c4 100644 --- a/src/tools/clippy/tests/ui/deprecated.stderr +++ b/src/tools/clippy/tests/ui/deprecated.stderr @@ -61,35 +61,41 @@ error: lint `clippy::should_assert_eq` has been removed: `assert!(a == b)` can n LL | #![warn(clippy::should_assert_eq)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: lint `clippy::unsafe_vector_initialization` has been removed: the suggested alternative could be substantially slower +error: lint `clippy::string_to_string` has been removed: `clippy:implicit_clone` covers those cases --> tests/ui/deprecated.rs:15:9 | +LL | #![warn(clippy::string_to_string)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: lint `clippy::unsafe_vector_initialization` has been removed: the suggested alternative could be substantially slower + --> tests/ui/deprecated.rs:16:9 + | LL | #![warn(clippy::unsafe_vector_initialization)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: lint `clippy::unstable_as_mut_slice` has been removed: `Vec::as_mut_slice` is now stable - --> tests/ui/deprecated.rs:16:9 + --> tests/ui/deprecated.rs:17:9 | LL | #![warn(clippy::unstable_as_mut_slice)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: lint `clippy::unstable_as_slice` has been removed: `Vec::as_slice` is now stable - --> tests/ui/deprecated.rs:17:9 + --> tests/ui/deprecated.rs:18:9 | LL | #![warn(clippy::unstable_as_slice)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: lint `clippy::unused_collect` has been removed: `Iterator::collect` is now marked as `#[must_use]` - --> tests/ui/deprecated.rs:18:9 + --> tests/ui/deprecated.rs:19:9 | LL | #![warn(clippy::unused_collect)] | ^^^^^^^^^^^^^^^^^^^^^^ error: lint `clippy::wrong_pub_self_convention` has been removed: `clippy::wrong_self_convention` now covers this case via the `avoid-breaking-exported-api` config - --> tests/ui/deprecated.rs:19:9 + --> tests/ui/deprecated.rs:20:9 | LL | #![warn(clippy::wrong_pub_self_convention)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 15 previous errors +error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.fixed b/src/tools/clippy/tests/ui/doc/doc-fixable.fixed index 8cf20d8b1a11..bbbd5973036e 100644 --- a/src/tools/clippy/tests/ui/doc/doc-fixable.fixed +++ b/src/tools/clippy/tests/ui/doc/doc-fixable.fixed @@ -83,7 +83,7 @@ fn test_units() { /// WebGL WebGL2 WebGPU WebRTC WebSocket WebTransport /// TensorFlow /// TrueType -/// iOS macOS FreeBSD NetBSD OpenBSD +/// iOS macOS FreeBSD NetBSD OpenBSD NixOS /// TeX LaTeX BibTeX BibLaTeX /// MinGW /// CamelCase (see also #2395) diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.rs b/src/tools/clippy/tests/ui/doc/doc-fixable.rs index 5b6f2bd8330c..1077d3580d3c 100644 --- a/src/tools/clippy/tests/ui/doc/doc-fixable.rs +++ b/src/tools/clippy/tests/ui/doc/doc-fixable.rs @@ -83,7 +83,7 @@ fn test_units() { /// WebGL WebGL2 WebGPU WebRTC WebSocket WebTransport /// TensorFlow /// TrueType -/// iOS macOS FreeBSD NetBSD OpenBSD +/// iOS macOS FreeBSD NetBSD OpenBSD NixOS /// TeX LaTeX BibTeX BibLaTeX /// MinGW /// CamelCase (see also #2395) diff --git a/src/tools/clippy/tests/ui/duplicated_attributes.rs b/src/tools/clippy/tests/ui/duplicated_attributes.rs index 3ca91d6f1829..9a6714995059 100644 --- a/src/tools/clippy/tests/ui/duplicated_attributes.rs +++ b/src/tools/clippy/tests/ui/duplicated_attributes.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macro_attr.rs +#![warn(clippy::duplicated_attributes, clippy::duplicated_attributes)] //~ ERROR: duplicated attribute #![feature(rustc_attrs)] -#![warn(clippy::duplicated_attributes)] #![cfg(any(unix, windows))] #![allow(dead_code)] #![allow(dead_code)] //~ ERROR: duplicated attribute diff --git a/src/tools/clippy/tests/ui/duplicated_attributes.stderr b/src/tools/clippy/tests/ui/duplicated_attributes.stderr index 0903617a8d1f..922939d60dd6 100644 --- a/src/tools/clippy/tests/ui/duplicated_attributes.stderr +++ b/src/tools/clippy/tests/ui/duplicated_attributes.stderr @@ -1,3 +1,22 @@ +error: duplicated attribute + --> tests/ui/duplicated_attributes.rs:2:40 + | +LL | #![warn(clippy::duplicated_attributes, clippy::duplicated_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: first defined here + --> tests/ui/duplicated_attributes.rs:2:9 + | +LL | #![warn(clippy::duplicated_attributes, clippy::duplicated_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: remove this attribute + --> tests/ui/duplicated_attributes.rs:2:40 + | +LL | #![warn(clippy::duplicated_attributes, clippy::duplicated_attributes)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `-D clippy::duplicated-attributes` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]` + error: duplicated attribute --> tests/ui/duplicated_attributes.rs:6:10 | @@ -14,8 +33,6 @@ help: remove this attribute | LL | #![allow(dead_code)] | ^^^^^^^^^ - = note: `-D clippy::duplicated-attributes` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]` error: duplicated attribute --> tests/ui/duplicated_attributes.rs:14:9 @@ -34,5 +51,5 @@ help: remove this attribute LL | #[allow(dead_code)] | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/empty_structs_with_brackets.fixed b/src/tools/clippy/tests/ui/empty_structs_with_brackets.fixed index 419cf2354f89..22386245ffe6 100644 --- a/src/tools/clippy/tests/ui/empty_structs_with_brackets.fixed +++ b/src/tools/clippy/tests/ui/empty_structs_with_brackets.fixed @@ -32,3 +32,17 @@ macro_rules! empty_struct { empty_struct!(FromMacro); fn main() {} + +mod issue15349 { + trait Bar {} + impl Bar for [u8; 7] {} + + struct Foo; + //~^ empty_structs_with_brackets + impl Foo + where + [u8; N]: Bar<[(); N]>, + { + fn foo() {} + } +} diff --git a/src/tools/clippy/tests/ui/empty_structs_with_brackets.rs b/src/tools/clippy/tests/ui/empty_structs_with_brackets.rs index 90c415c12206..5cb54b661349 100644 --- a/src/tools/clippy/tests/ui/empty_structs_with_brackets.rs +++ b/src/tools/clippy/tests/ui/empty_structs_with_brackets.rs @@ -32,3 +32,17 @@ macro_rules! empty_struct { empty_struct!(FromMacro); fn main() {} + +mod issue15349 { + trait Bar {} + impl Bar for [u8; 7] {} + + struct Foo {} + //~^ empty_structs_with_brackets + impl Foo + where + [u8; N]: Bar<[(); N]>, + { + fn foo() {} + } +} diff --git a/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr b/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr index 86ef43aa9600..f662bb9423e3 100644 --- a/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr +++ b/src/tools/clippy/tests/ui/empty_structs_with_brackets.stderr @@ -16,5 +16,13 @@ LL | struct MyEmptyTupleStruct(); // should trigger lint | = help: remove the brackets -error: aborting due to 2 previous errors +error: found empty brackets on struct declaration + --> tests/ui/empty_structs_with_brackets.rs:40:31 + | +LL | struct Foo {} + | ^^^ + | + = help: remove the brackets + +error: aborting due to 3 previous errors diff --git a/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.rs b/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.rs new file mode 100644 index 000000000000..19123cd206e3 --- /dev/null +++ b/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.rs @@ -0,0 +1,6 @@ +//@no-rustfix +#![warn(clippy::four_forward_slashes)] + +//~v four_forward_slashes +//// nondoc comment with bare CR: ' ' +fn main() {} diff --git a/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.stderr b/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.stderr new file mode 100644 index 000000000000..64e70b97db9a --- /dev/null +++ b/src/tools/clippy/tests/ui/four_forward_slashes_bare_cr.stderr @@ -0,0 +1,14 @@ +error: this item has comments with 4 forward slashes (`////`). These look like doc comments, but they aren't + --> tests/ui/four_forward_slashes_bare_cr.rs:5:1 + | +LL | / //// nondoc comment with bare CR: '␍' +LL | | fn main() {} + | |_^ + | + = help: make this a doc comment by removing one `/` + = note: bare CR characters are not allowed in doc comments + = note: `-D clippy::four-forward-slashes` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]` + +error: aborting due to 1 previous error + diff --git a/src/tools/clippy/tests/ui/implicit_clone.fixed b/src/tools/clippy/tests/ui/implicit_clone.fixed index d60d1cb0ec04..267514c5f3d3 100644 --- a/src/tools/clippy/tests/ui/implicit_clone.fixed +++ b/src/tools/clippy/tests/ui/implicit_clone.fixed @@ -135,4 +135,10 @@ fn main() { } let no_clone = &NoClone; let _ = no_clone.to_owned(); + + let s = String::from("foo"); + let _ = s.clone(); + //~^ implicit_clone + let _ = s.clone(); + //~^ implicit_clone } diff --git a/src/tools/clippy/tests/ui/implicit_clone.rs b/src/tools/clippy/tests/ui/implicit_clone.rs index b96828f28c82..fba954026e7f 100644 --- a/src/tools/clippy/tests/ui/implicit_clone.rs +++ b/src/tools/clippy/tests/ui/implicit_clone.rs @@ -135,4 +135,10 @@ fn main() { } let no_clone = &NoClone; let _ = no_clone.to_owned(); + + let s = String::from("foo"); + let _ = s.to_owned(); + //~^ implicit_clone + let _ = s.to_string(); + //~^ implicit_clone } diff --git a/src/tools/clippy/tests/ui/implicit_clone.stderr b/src/tools/clippy/tests/ui/implicit_clone.stderr index 1eb6ff1fe429..4cca9b0d0c07 100644 --- a/src/tools/clippy/tests/ui/implicit_clone.stderr +++ b/src/tools/clippy/tests/ui/implicit_clone.stderr @@ -67,5 +67,17 @@ error: implicitly cloning a `PathBuf` by calling `to_path_buf` on its dereferenc LL | let _ = pathbuf_ref.to_path_buf(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `(**pathbuf_ref).clone()` -error: aborting due to 11 previous errors +error: implicitly cloning a `String` by calling `to_owned` on its dereferenced type + --> tests/ui/implicit_clone.rs:140:13 + | +LL | let _ = s.to_owned(); + | ^^^^^^^^^^^^ help: consider using: `s.clone()` + +error: implicitly cloning a `String` by calling `to_string` on its dereferenced type + --> tests/ui/implicit_clone.rs:142:13 + | +LL | let _ = s.to_string(); + | ^^^^^^^^^^^^^ help: consider using: `s.clone()` + +error: aborting due to 13 previous errors diff --git a/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.fixed b/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.fixed index 72edc539f043..edf6f014d3d0 100644 --- a/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.fixed +++ b/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.fixed @@ -1,8 +1,5 @@ #![deny(clippy::index_refutable_slice)] -extern crate if_chain; -use if_chain::if_chain; - macro_rules! if_let_slice_macro { () => { // This would normally be linted @@ -18,12 +15,9 @@ fn main() { if_let_slice_macro!(); // Do lint this - if_chain! { - let slice: Option<&[u32]> = Some(&[1, 2, 3]); - if let Some([slice_0, ..]) = slice; + let slice: Option<&[u32]> = Some(&[1, 2, 3]); + if let Some([slice_0, ..]) = slice { //~^ ERROR: this binding can be a slice pattern to avoid indexing - then { - println!("{}", slice_0); - } + println!("{}", slice_0); } } diff --git a/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.rs b/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.rs index 7b474ba423b9..76d4a2350f50 100644 --- a/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.rs +++ b/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.rs @@ -1,8 +1,5 @@ #![deny(clippy::index_refutable_slice)] -extern crate if_chain; -use if_chain::if_chain; - macro_rules! if_let_slice_macro { () => { // This would normally be linted @@ -18,12 +15,9 @@ fn main() { if_let_slice_macro!(); // Do lint this - if_chain! { - let slice: Option<&[u32]> = Some(&[1, 2, 3]); - if let Some(slice) = slice; + let slice: Option<&[u32]> = Some(&[1, 2, 3]); + if let Some(slice) = slice { //~^ ERROR: this binding can be a slice pattern to avoid indexing - then { - println!("{}", slice[0]); - } + println!("{}", slice[0]); } } diff --git a/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.stderr b/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.stderr index 64741abb9114..635e6d19aef2 100644 --- a/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.stderr +++ b/src/tools/clippy/tests/ui/index_refutable_slice/slice_indexing_in_macro.stderr @@ -1,8 +1,8 @@ error: this binding can be a slice pattern to avoid indexing - --> tests/ui/index_refutable_slice/slice_indexing_in_macro.rs:23:21 + --> tests/ui/index_refutable_slice/slice_indexing_in_macro.rs:19:17 | -LL | if let Some(slice) = slice; - | ^^^^^ +LL | if let Some(slice) = slice { + | ^^^^^ | note: the lint level is defined here --> tests/ui/index_refutable_slice/slice_indexing_in_macro.rs:1:9 @@ -11,10 +11,9 @@ LL | #![deny(clippy::index_refutable_slice)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the binding and indexed access with a slice pattern | -LL ~ if let Some([slice_0, ..]) = slice; +LL ~ if let Some([slice_0, ..]) = slice { LL | -LL | then { -LL ~ println!("{}", slice_0); +LL ~ println!("{}", slice_0); | error: aborting due to 1 previous error diff --git a/src/tools/clippy/tests/ui/indexing_slicing_slice.rs b/src/tools/clippy/tests/ui/indexing_slicing_slice.rs index cad77f56d03a..dea31530a0b6 100644 --- a/src/tools/clippy/tests/ui/indexing_slicing_slice.rs +++ b/src/tools/clippy/tests/ui/indexing_slicing_slice.rs @@ -1,6 +1,5 @@ //@aux-build: proc_macros.rs -#![warn(clippy::indexing_slicing)] // We also check the out_of_bounds_indexing lint here, because it lints similar things and // we want to avoid false positives. #![warn(clippy::out_of_bounds_indexing)] diff --git a/src/tools/clippy/tests/ui/indexing_slicing_slice.stderr b/src/tools/clippy/tests/ui/indexing_slicing_slice.stderr index e3ef89823e3d..e3d6086544de 100644 --- a/src/tools/clippy/tests/ui/indexing_slicing_slice.stderr +++ b/src/tools/clippy/tests/ui/indexing_slicing_slice.stderr @@ -1,5 +1,5 @@ error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:115:6 + --> tests/ui/indexing_slicing_slice.rs:114:6 | LL | &x[index..]; | ^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | &x[index..]; = help: to override `-D warnings` add `#[allow(clippy::indexing_slicing)]` error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:117:6 + --> tests/ui/indexing_slicing_slice.rs:116:6 | LL | &x[..index]; | ^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | &x[..index]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:119:6 + --> tests/ui/indexing_slicing_slice.rs:118:6 | LL | &x[index_from..index_to]; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL | &x[index_from..index_to]; = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:121:6 + --> tests/ui/indexing_slicing_slice.rs:120:6 | LL | &x[index_from..][..index_to]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL | &x[index_from..][..index_to]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:121:6 + --> tests/ui/indexing_slicing_slice.rs:120:6 | LL | &x[index_from..][..index_to]; | ^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | &x[index_from..][..index_to]; = help: consider using `.get(n..)` or .get_mut(n..)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:124:6 + --> tests/ui/indexing_slicing_slice.rs:123:6 | LL | &x[5..][..10]; | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | &x[5..][..10]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: range is out of bounds - --> tests/ui/indexing_slicing_slice.rs:124:8 + --> tests/ui/indexing_slicing_slice.rs:123:8 | LL | &x[5..][..10]; | ^ @@ -58,7 +58,7 @@ LL | &x[5..][..10]; = help: to override `-D warnings` add `#[allow(clippy::out_of_bounds_indexing)]` error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:127:6 + --> tests/ui/indexing_slicing_slice.rs:126:6 | LL | &x[0..][..3]; | ^^^^^^^^^^^ @@ -66,7 +66,7 @@ LL | &x[0..][..3]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:129:6 + --> tests/ui/indexing_slicing_slice.rs:128:6 | LL | &x[1..][..5]; | ^^^^^^^^^^^ @@ -74,19 +74,19 @@ LL | &x[1..][..5]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: range is out of bounds - --> tests/ui/indexing_slicing_slice.rs:137:12 + --> tests/ui/indexing_slicing_slice.rs:136:12 | LL | &y[0..=4]; | ^ error: range is out of bounds - --> tests/ui/indexing_slicing_slice.rs:139:11 + --> tests/ui/indexing_slicing_slice.rs:138:11 | LL | &y[..=4]; | ^ error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:145:6 + --> tests/ui/indexing_slicing_slice.rs:144:6 | LL | &v[10..100]; | ^^^^^^^^^^ @@ -94,7 +94,7 @@ LL | &v[10..100]; = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:147:6 + --> tests/ui/indexing_slicing_slice.rs:146:6 | LL | &x[10..][..100]; | ^^^^^^^^^^^^^^ @@ -102,13 +102,13 @@ LL | &x[10..][..100]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: range is out of bounds - --> tests/ui/indexing_slicing_slice.rs:147:8 + --> tests/ui/indexing_slicing_slice.rs:146:8 | LL | &x[10..][..100]; | ^^ error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:150:6 + --> tests/ui/indexing_slicing_slice.rs:149:6 | LL | &v[10..]; | ^^^^^^^ @@ -116,7 +116,7 @@ LL | &v[10..]; = help: consider using `.get(n..)` or .get_mut(n..)` instead error: slicing may panic - --> tests/ui/indexing_slicing_slice.rs:152:6 + --> tests/ui/indexing_slicing_slice.rs:151:6 | LL | &v[..100]; | ^^^^^^^^ @@ -124,7 +124,7 @@ LL | &v[..100]; = help: consider using `.get(..n)`or `.get_mut(..n)` instead error: indexing may panic - --> tests/ui/indexing_slicing_slice.rs:170:5 + --> tests/ui/indexing_slicing_slice.rs:169:5 | LL | map_with_get[true]; | ^^^^^^^^^^^^^^^^^^ @@ -132,7 +132,7 @@ LL | map_with_get[true]; = help: consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic - --> tests/ui/indexing_slicing_slice.rs:174:5 + --> tests/ui/indexing_slicing_slice.rs:173:5 | LL | s[0]; | ^^^^ @@ -140,7 +140,7 @@ LL | s[0]; = help: consider using `.get(n)` or `.get_mut(n)` instead error: indexing may panic - --> tests/ui/indexing_slicing_slice.rs:178:5 + --> tests/ui/indexing_slicing_slice.rs:177:5 | LL | y[0]; | ^^^^ diff --git a/src/tools/clippy/tests/ui/infallible_try_from.stderr b/src/tools/clippy/tests/ui/infallible_try_from.stderr index 705b1188489c..d1e0d9e7d3bb 100644 --- a/src/tools/clippy/tests/ui/infallible_try_from.stderr +++ b/src/tools/clippy/tests/ui/infallible_try_from.stderr @@ -1,4 +1,4 @@ -error: infallible TryFrom impl; consider implementing From, instead +error: infallible TryFrom impl; consider implementing From instead --> tests/ui/infallible_try_from.rs:8:1 | LL | impl TryFrom for MyStruct { @@ -10,7 +10,7 @@ LL | type Error = !; = note: `-D clippy::infallible-try-from` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::infallible_try_from)]` -error: infallible TryFrom impl; consider implementing From, instead +error: infallible TryFrom impl; consider implementing From instead --> tests/ui/infallible_try_from.rs:16:1 | LL | impl TryFrom for MyStruct { diff --git a/src/tools/clippy/tests/ui/ip_constant.fixed b/src/tools/clippy/tests/ui/ip_constant.fixed index 2e3389c11938..c94796821394 100644 --- a/src/tools/clippy/tests/ui/ip_constant.fixed +++ b/src/tools/clippy/tests/ui/ip_constant.fixed @@ -48,6 +48,20 @@ fn literal_test3() { //~^ ip_constant } +fn wrapped_in_parens() { + let _ = std::net::Ipv4Addr::LOCALHOST; + //~^ ip_constant + let _ = std::net::Ipv4Addr::BROADCAST; + //~^ ip_constant + let _ = std::net::Ipv4Addr::UNSPECIFIED; + //~^ ip_constant + + let _ = std::net::Ipv6Addr::LOCALHOST; + //~^ ip_constant + let _ = std::net::Ipv6Addr::UNSPECIFIED; + //~^ ip_constant +} + const CONST_U8_0: u8 = 0; const CONST_U8_1: u8 = 1; const CONST_U8_127: u8 = 127; diff --git a/src/tools/clippy/tests/ui/ip_constant.rs b/src/tools/clippy/tests/ui/ip_constant.rs index 15e0b0551bab..69a5c3b4e923 100644 --- a/src/tools/clippy/tests/ui/ip_constant.rs +++ b/src/tools/clippy/tests/ui/ip_constant.rs @@ -48,6 +48,20 @@ fn literal_test3() { //~^ ip_constant } +fn wrapped_in_parens() { + let _ = (std::net::Ipv4Addr::new(127, 0, 0, 1)); + //~^ ip_constant + let _ = (std::net::Ipv4Addr::new(255, 255, 255, 255)); + //~^ ip_constant + let _ = (std::net::Ipv4Addr::new(0, 0, 0, 0)); + //~^ ip_constant + + let _ = (std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + //~^ ip_constant + let _ = (std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)); + //~^ ip_constant +} + const CONST_U8_0: u8 = 0; const CONST_U8_1: u8 = 1; const CONST_U8_127: u8 = 127; diff --git a/src/tools/clippy/tests/ui/ip_constant.stderr b/src/tools/clippy/tests/ui/ip_constant.stderr index 3e984c6cb3bb..07d912b18a57 100644 --- a/src/tools/clippy/tests/ui/ip_constant.stderr +++ b/src/tools/clippy/tests/ui/ip_constant.stderr @@ -180,9 +180,69 @@ LL - let _ = std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0); LL + let _ = std::net::Ipv6Addr::UNSPECIFIED; | +error: hand-coded well-known IP address + --> tests/ui/ip_constant.rs:52:13 + | +LL | let _ = (std::net::Ipv4Addr::new(127, 0, 0, 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL - let _ = (std::net::Ipv4Addr::new(127, 0, 0, 1)); +LL + let _ = std::net::Ipv4Addr::LOCALHOST; + | + +error: hand-coded well-known IP address + --> tests/ui/ip_constant.rs:54:13 + | +LL | let _ = (std::net::Ipv4Addr::new(255, 255, 255, 255)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL - let _ = (std::net::Ipv4Addr::new(255, 255, 255, 255)); +LL + let _ = std::net::Ipv4Addr::BROADCAST; + | + +error: hand-coded well-known IP address + --> tests/ui/ip_constant.rs:56:13 + | +LL | let _ = (std::net::Ipv4Addr::new(0, 0, 0, 0)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL - let _ = (std::net::Ipv4Addr::new(0, 0, 0, 0)); +LL + let _ = std::net::Ipv4Addr::UNSPECIFIED; + | + +error: hand-coded well-known IP address + --> tests/ui/ip_constant.rs:59:13 + | +LL | let _ = (std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL - let _ = (std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); +LL + let _ = std::net::Ipv6Addr::LOCALHOST; + | + error: hand-coded well-known IP address --> tests/ui/ip_constant.rs:61:13 | +LL | let _ = (std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use + | +LL - let _ = (std::net::Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)); +LL + let _ = std::net::Ipv6Addr::UNSPECIFIED; + | + +error: hand-coded well-known IP address + --> tests/ui/ip_constant.rs:75:13 + | LL | let _ = Ipv4Addr::new(CONST_U8_127, CONST_U8_0, CONST_U8_0, CONST_U8_1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -193,7 +253,7 @@ LL + let _ = Ipv4Addr::LOCALHOST; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:63:13 + --> tests/ui/ip_constant.rs:77:13 | LL | let _ = Ipv4Addr::new(CONST_U8_255, CONST_U8_255, CONST_U8_255, CONST_U8_255); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -205,7 +265,7 @@ LL + let _ = Ipv4Addr::BROADCAST; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:65:13 + --> tests/ui/ip_constant.rs:79:13 | LL | let _ = Ipv4Addr::new(CONST_U8_0, CONST_U8_0, CONST_U8_0, CONST_U8_0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -217,7 +277,7 @@ LL + let _ = Ipv4Addr::UNSPECIFIED; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:69:13 + --> tests/ui/ip_constant.rs:83:13 | LL | let _ = Ipv6Addr::new( | _____________^ @@ -246,7 +306,7 @@ LL + let _ = Ipv6Addr::LOCALHOST; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:81:13 + --> tests/ui/ip_constant.rs:95:13 | LL | let _ = Ipv6Addr::new( | _____________^ @@ -275,7 +335,7 @@ LL + let _ = Ipv6Addr::UNSPECIFIED; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:96:13 + --> tests/ui/ip_constant.rs:110:13 | LL | let _ = Ipv4Addr::new(126 + 1, 0, 0, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -287,7 +347,7 @@ LL + let _ = Ipv4Addr::LOCALHOST; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:98:13 + --> tests/ui/ip_constant.rs:112:13 | LL | let _ = Ipv4Addr::new(254 + CONST_U8_1, 255, { 255 - CONST_U8_0 }, CONST_U8_255); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -299,7 +359,7 @@ LL + let _ = Ipv4Addr::BROADCAST; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:100:13 + --> tests/ui/ip_constant.rs:114:13 | LL | let _ = Ipv4Addr::new(0, CONST_U8_255 - 255, 0, { 1 + 0 - 1 }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -311,7 +371,7 @@ LL + let _ = Ipv4Addr::UNSPECIFIED; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:104:13 + --> tests/ui/ip_constant.rs:118:13 | LL | let _ = Ipv6Addr::new(0 + CONST_U16_0, 0, 0, 0, 0, 0, 0, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -323,7 +383,7 @@ LL + let _ = Ipv6Addr::LOCALHOST; | error: hand-coded well-known IP address - --> tests/ui/ip_constant.rs:106:13 + --> tests/ui/ip_constant.rs:120:13 | LL | let _ = Ipv6Addr::new(0 + 0, 0, 0, 0, 0, { 2 - 1 - CONST_U16_1 }, 0, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -334,5 +394,5 @@ LL - let _ = Ipv6Addr::new(0 + 0, 0, 0, 0, 0, { 2 - 1 - CONST_U16_1 }, 0, 1) LL + let _ = Ipv6Addr::LOCALHOST; | -error: aborting due to 25 previous errors +error: aborting due to 30 previous errors diff --git a/src/tools/clippy/tests/ui/iter_on_single_items.fixed b/src/tools/clippy/tests/ui/iter_on_single_items.fixed index b43fad6449c1..044037aac2e3 100644 --- a/src/tools/clippy/tests/ui/iter_on_single_items.fixed +++ b/src/tools/clippy/tests/ui/iter_on_single_items.fixed @@ -66,3 +66,27 @@ fn main() { custom_option::custom_option(); in_macros!(); } + +mod issue14981 { + use std::option::IntoIter; + fn takes_into_iter(_: impl IntoIterator) {} + + fn let_stmt() { + macro_rules! x { + ($e:expr) => { + let _: IntoIter = $e; + }; + } + x!(Some(5).into_iter()); + } + + fn fn_ptr() { + fn some_func(_: IntoIter) -> IntoIter { + todo!() + } + some_func(Some(5).into_iter()); + + const C: fn(IntoIter) -> IntoIter = as IntoIterator>::into_iter; + C(Some(5).into_iter()); + } +} diff --git a/src/tools/clippy/tests/ui/iter_on_single_items.rs b/src/tools/clippy/tests/ui/iter_on_single_items.rs index 625c96d3ef1f..c925d0e480fa 100644 --- a/src/tools/clippy/tests/ui/iter_on_single_items.rs +++ b/src/tools/clippy/tests/ui/iter_on_single_items.rs @@ -66,3 +66,27 @@ fn main() { custom_option::custom_option(); in_macros!(); } + +mod issue14981 { + use std::option::IntoIter; + fn takes_into_iter(_: impl IntoIterator) {} + + fn let_stmt() { + macro_rules! x { + ($e:expr) => { + let _: IntoIter = $e; + }; + } + x!(Some(5).into_iter()); + } + + fn fn_ptr() { + fn some_func(_: IntoIter) -> IntoIter { + todo!() + } + some_func(Some(5).into_iter()); + + const C: fn(IntoIter) -> IntoIter = as IntoIterator>::into_iter; + C(Some(5).into_iter()); + } +} diff --git a/src/tools/clippy/tests/ui/let_unit.fixed b/src/tools/clippy/tests/ui/let_unit.fixed index 304eacecd942..381d4cac4622 100644 --- a/src/tools/clippy/tests/ui/let_unit.fixed +++ b/src/tools/clippy/tests/ui/let_unit.fixed @@ -198,3 +198,14 @@ pub fn issue12594() { returns_result(res).unwrap(); } } + +fn issue15061() { + fn return_unit() {} + fn do_something(x: ()) {} + + let res = (); + return_unit(); + //~^ let_unit_value + do_something(()); + println!("{res:?}"); +} diff --git a/src/tools/clippy/tests/ui/let_unit.rs b/src/tools/clippy/tests/ui/let_unit.rs index a02cb346ff99..cdfc74991c40 100644 --- a/src/tools/clippy/tests/ui/let_unit.rs +++ b/src/tools/clippy/tests/ui/let_unit.rs @@ -198,3 +198,13 @@ pub fn issue12594() { returns_result(res).unwrap(); } } + +fn issue15061() { + fn return_unit() {} + fn do_something(x: ()) {} + + let res = return_unit(); + //~^ let_unit_value + do_something(res); + println!("{res:?}"); +} diff --git a/src/tools/clippy/tests/ui/let_unit.stderr b/src/tools/clippy/tests/ui/let_unit.stderr index d743110c99dd..637c9ff686bd 100644 --- a/src/tools/clippy/tests/ui/let_unit.stderr +++ b/src/tools/clippy/tests/ui/let_unit.stderr @@ -68,5 +68,19 @@ LL ~ returns_result(()).unwrap(); LL ~ returns_result(()).unwrap(); | -error: aborting due to 4 previous errors +error: this let-binding has unit value + --> tests/ui/let_unit.rs:206:5 + | +LL | let res = return_unit(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: replace variable usages with `()` + | +LL ~ let res = (); +LL ~ return_unit(); +LL | +LL ~ do_something(()); + | + +error: aborting due to 5 previous errors diff --git a/src/tools/clippy/tests/ui/let_with_type_underscore.fixed b/src/tools/clippy/tests/ui/let_with_type_underscore.fixed index 7a4af4e3d1e7..6339fe595c21 100644 --- a/src/tools/clippy/tests/ui/let_with_type_underscore.fixed +++ b/src/tools/clippy/tests/ui/let_with_type_underscore.fixed @@ -45,3 +45,15 @@ fn main() { x = (); }; } + +fn issue15377() { + let (a) = 0; + //~^ let_with_type_underscore + let ((a)) = 0; + //~^ let_with_type_underscore + let ((a,)) = (0,); + //~^ let_with_type_underscore + #[rustfmt::skip] + let ( (a ) ) = 0; + //~^ let_with_type_underscore +} diff --git a/src/tools/clippy/tests/ui/let_with_type_underscore.rs b/src/tools/clippy/tests/ui/let_with_type_underscore.rs index a7c2f598b56d..bd85346cf01a 100644 --- a/src/tools/clippy/tests/ui/let_with_type_underscore.rs +++ b/src/tools/clippy/tests/ui/let_with_type_underscore.rs @@ -45,3 +45,15 @@ fn main() { x = (); }; } + +fn issue15377() { + let (a): _ = 0; + //~^ let_with_type_underscore + let ((a)): _ = 0; + //~^ let_with_type_underscore + let ((a,)): _ = (0,); + //~^ let_with_type_underscore + #[rustfmt::skip] + let ( (a ) ): _ = 0; + //~^ let_with_type_underscore +} diff --git a/src/tools/clippy/tests/ui/let_with_type_underscore.stderr b/src/tools/clippy/tests/ui/let_with_type_underscore.stderr index 9179f9922071..c3f6c82397b8 100644 --- a/src/tools/clippy/tests/ui/let_with_type_underscore.stderr +++ b/src/tools/clippy/tests/ui/let_with_type_underscore.stderr @@ -60,5 +60,53 @@ LL - let x : _ = 1; LL + let x = 1; | -error: aborting due to 5 previous errors +error: variable declared with type underscore + --> tests/ui/let_with_type_underscore.rs:50:5 + | +LL | let (a): _ = 0; + | ^^^^^^^^^^^^^^^ + | +help: remove the explicit type `_` declaration + | +LL - let (a): _ = 0; +LL + let (a) = 0; + | + +error: variable declared with type underscore + --> tests/ui/let_with_type_underscore.rs:52:5 + | +LL | let ((a)): _ = 0; + | ^^^^^^^^^^^^^^^^^ + | +help: remove the explicit type `_` declaration + | +LL - let ((a)): _ = 0; +LL + let ((a)) = 0; + | + +error: variable declared with type underscore + --> tests/ui/let_with_type_underscore.rs:54:5 + | +LL | let ((a,)): _ = (0,); + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the explicit type `_` declaration + | +LL - let ((a,)): _ = (0,); +LL + let ((a,)) = (0,); + | + +error: variable declared with type underscore + --> tests/ui/let_with_type_underscore.rs:57:5 + | +LL | let ( (a ) ): _ = 0; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: remove the explicit type `_` declaration + | +LL - let ( (a ) ): _ = 0; +LL + let ( (a ) ) = 0; + | + +error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr b/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr index 221cddf069db..2e9c9045caae 100644 --- a/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr +++ b/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr @@ -167,7 +167,7 @@ LL - comment */ LL - /// Doc comment LL - panic!("panic with comment") // comment after `panic!` LL - } -LL + assert!(!(a > 2), "panic with comment"); +LL + assert!(a <= 2, "panic with comment"); | error: only a `panic!` in `if`-then statement @@ -186,7 +186,7 @@ LL - const BAR: () = if N == 0 { LL - LL - panic!() LL - }; -LL + const BAR: () = assert!(!(N == 0), ); +LL + const BAR: () = assert!(N != 0, ); | error: only a `panic!` in `if`-then statement diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr b/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr index 221cddf069db..2e9c9045caae 100644 --- a/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr +++ b/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr @@ -167,7 +167,7 @@ LL - comment */ LL - /// Doc comment LL - panic!("panic with comment") // comment after `panic!` LL - } -LL + assert!(!(a > 2), "panic with comment"); +LL + assert!(a <= 2, "panic with comment"); | error: only a `panic!` in `if`-then statement @@ -186,7 +186,7 @@ LL - const BAR: () = if N == 0 { LL - LL - panic!() LL - }; -LL + const BAR: () = assert!(!(N == 0), ); +LL + const BAR: () = assert!(N != 0, ); | error: only a `panic!` in `if`-then statement diff --git a/src/tools/clippy/tests/ui/manual_strip.rs b/src/tools/clippy/tests/ui/manual_strip.rs index 086b75a39875..0fdaa1c045e0 100644 --- a/src/tools/clippy/tests/ui/manual_strip.rs +++ b/src/tools/clippy/tests/ui/manual_strip.rs @@ -75,7 +75,7 @@ fn main() { s4[2..].to_string(); } - // Don't propose to reuse the `stripped` identifier as it is overriden + // Don't propose to reuse the `stripped` identifier as it is overridden if s.starts_with("ab") { let stripped = &s["ab".len()..]; //~^ ERROR: stripping a prefix manually diff --git a/src/tools/clippy/tests/ui/manual_unwrap_or_default.fixed b/src/tools/clippy/tests/ui/manual_unwrap_or_default.fixed index 41ca44ceef4e..189fe876aa5d 100644 --- a/src/tools/clippy/tests/ui/manual_unwrap_or_default.fixed +++ b/src/tools/clippy/tests/ui/manual_unwrap_or_default.fixed @@ -102,7 +102,7 @@ fn issue_12928() { let y = if let Some(Y(a, ..)) = x { a } else { 0 }; } -// For symetry with `manual_unwrap_or` test +// For symmetry with `manual_unwrap_or` test fn allowed_manual_unwrap_or_zero() -> u32 { Some(42).unwrap_or_default() } diff --git a/src/tools/clippy/tests/ui/manual_unwrap_or_default.rs b/src/tools/clippy/tests/ui/manual_unwrap_or_default.rs index 343fbc4879ce..ca87926763c9 100644 --- a/src/tools/clippy/tests/ui/manual_unwrap_or_default.rs +++ b/src/tools/clippy/tests/ui/manual_unwrap_or_default.rs @@ -138,7 +138,7 @@ fn issue_12928() { let y = if let Some(Y(a, ..)) = x { a } else { 0 }; } -// For symetry with `manual_unwrap_or` test +// For symmetry with `manual_unwrap_or` test fn allowed_manual_unwrap_or_zero() -> u32 { if let Some(x) = Some(42) { //~^ manual_unwrap_or_default diff --git a/src/tools/clippy/tests/ui/map_identity.fixed b/src/tools/clippy/tests/ui/map_identity.fixed index b82d3e6d9567..6c971ba63384 100644 --- a/src/tools/clippy/tests/ui/map_identity.fixed +++ b/src/tools/clippy/tests/ui/map_identity.fixed @@ -1,5 +1,5 @@ #![warn(clippy::map_identity)] -#![allow(clippy::needless_return)] +#![allow(clippy::needless_return, clippy::disallowed_names)] fn main() { let x: [u16; 3] = [1, 2, 3]; @@ -99,3 +99,65 @@ fn issue15198() { let _ = x.iter().copied(); //~^ map_identity } + +mod foo { + #[derive(Clone, Copy)] + pub struct Foo { + pub foo: u8, + pub bar: u8, + } + + #[derive(Clone, Copy)] + pub struct Foo2(pub u8, pub u8); +} +use foo::{Foo, Foo2}; + +struct Bar { + foo: u8, + bar: u8, +} + +struct Bar2(u8, u8); + +fn structs() { + let x = [Foo { foo: 0, bar: 0 }]; + + let _ = x.into_iter(); + //~^ map_identity + + // still lint when different paths are used for the same struct + let _ = x.into_iter(); + //~^ map_identity + + // don't lint: same fields but different structs + let _ = x.into_iter().map(|Foo { foo, bar }| Bar { foo, bar }); + + // still lint with redundant field names + #[allow(clippy::redundant_field_names)] + let _ = x.into_iter(); + //~^ map_identity + + // still lint with field order change + let _ = x.into_iter(); + //~^ map_identity + + // don't lint: switched field assignment + let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: bar, bar: foo }); +} + +fn tuple_structs() { + let x = [Foo2(0, 0)]; + + let _ = x.into_iter(); + //~^ map_identity + + // still lint when different paths are used for the same struct + let _ = x.into_iter(); + //~^ map_identity + + // don't lint: same fields but different structs + let _ = x.into_iter().map(|Foo2(foo, bar)| Bar2(foo, bar)); + + // don't lint: switched field assignment + let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(bar, foo)); +} diff --git a/src/tools/clippy/tests/ui/map_identity.rs b/src/tools/clippy/tests/ui/map_identity.rs index c295bf872701..59dcfcda3b6e 100644 --- a/src/tools/clippy/tests/ui/map_identity.rs +++ b/src/tools/clippy/tests/ui/map_identity.rs @@ -1,5 +1,5 @@ #![warn(clippy::map_identity)] -#![allow(clippy::needless_return)] +#![allow(clippy::needless_return, clippy::disallowed_names)] fn main() { let x: [u16; 3] = [1, 2, 3]; @@ -105,3 +105,65 @@ fn issue15198() { let _ = x.iter().copied().map(|[x, y]| [x, y]); //~^ map_identity } + +mod foo { + #[derive(Clone, Copy)] + pub struct Foo { + pub foo: u8, + pub bar: u8, + } + + #[derive(Clone, Copy)] + pub struct Foo2(pub u8, pub u8); +} +use foo::{Foo, Foo2}; + +struct Bar { + foo: u8, + bar: u8, +} + +struct Bar2(u8, u8); + +fn structs() { + let x = [Foo { foo: 0, bar: 0 }]; + + let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo, bar }); + //~^ map_identity + + // still lint when different paths are used for the same struct + let _ = x.into_iter().map(|Foo { foo, bar }| foo::Foo { foo, bar }); + //~^ map_identity + + // don't lint: same fields but different structs + let _ = x.into_iter().map(|Foo { foo, bar }| Bar { foo, bar }); + + // still lint with redundant field names + #[allow(clippy::redundant_field_names)] + let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: foo, bar: bar }); + //~^ map_identity + + // still lint with field order change + let _ = x.into_iter().map(|Foo { foo, bar }| Foo { bar, foo }); + //~^ map_identity + + // don't lint: switched field assignment + let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: bar, bar: foo }); +} + +fn tuple_structs() { + let x = [Foo2(0, 0)]; + + let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(foo, bar)); + //~^ map_identity + + // still lint when different paths are used for the same struct + let _ = x.into_iter().map(|Foo2(foo, bar)| foo::Foo2(foo, bar)); + //~^ map_identity + + // don't lint: same fields but different structs + let _ = x.into_iter().map(|Foo2(foo, bar)| Bar2(foo, bar)); + + // don't lint: switched field assignment + let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(bar, foo)); +} diff --git a/src/tools/clippy/tests/ui/map_identity.stderr b/src/tools/clippy/tests/ui/map_identity.stderr index 9b624a0dc755..a50c0d6b87b5 100644 --- a/src/tools/clippy/tests/ui/map_identity.stderr +++ b/src/tools/clippy/tests/ui/map_identity.stderr @@ -93,5 +93,41 @@ error: unnecessary map of the identity function LL | let _ = x.iter().copied().map(|[x, y]| [x, y]); | ^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` -error: aborting due to 14 previous errors +error: unnecessary map of the identity function + --> tests/ui/map_identity.rs:131:26 + | +LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo, bar }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + +error: unnecessary map of the identity function + --> tests/ui/map_identity.rs:135:26 + | +LL | let _ = x.into_iter().map(|Foo { foo, bar }| foo::Foo { foo, bar }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + +error: unnecessary map of the identity function + --> tests/ui/map_identity.rs:143:26 + | +LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { foo: foo, bar: bar }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + +error: unnecessary map of the identity function + --> tests/ui/map_identity.rs:147:26 + | +LL | let _ = x.into_iter().map(|Foo { foo, bar }| Foo { bar, foo }); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + +error: unnecessary map of the identity function + --> tests/ui/map_identity.rs:157:26 + | +LL | let _ = x.into_iter().map(|Foo2(foo, bar)| Foo2(foo, bar)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + +error: unnecessary map of the identity function + --> tests/ui/map_identity.rs:161:26 + | +LL | let _ = x.into_iter().map(|Foo2(foo, bar)| foo::Foo2(foo, bar)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` + +error: aborting due to 20 previous errors diff --git a/src/tools/clippy/tests/ui/match_single_binding.fixed b/src/tools/clippy/tests/ui/match_single_binding.fixed index e11dea352049..e29fb87dbc30 100644 --- a/src/tools/clippy/tests/ui/match_single_binding.fixed +++ b/src/tools/clippy/tests/ui/match_single_binding.fixed @@ -204,3 +204,65 @@ mod issue14991 { }], } } + +mod issue15018 { + fn used_later(a: i32, b: i32, c: i32) { + let x = 1; + { + let (x, y, z) = (a, b, c); + println!("{} {} {}", x, y, z); + } + println!("x = {x}"); + } + + fn not_used_later(a: i32, b: i32, c: i32) { + let (x, y, z) = (a, b, c); + println!("{} {} {}", x, y, z) + } + + #[allow(irrefutable_let_patterns)] + fn not_used_later_but_shadowed(a: i32, b: i32, c: i32) { + let (x, y, z) = (a, b, c); + println!("{} {} {}", x, y, z); + let x = 1; + println!("x = {x}"); + } + + #[allow(irrefutable_let_patterns)] + fn not_used_later_but_shadowed_nested(a: i32, b: i32, c: i32) { + let (x, y, z) = (a, b, c); + println!("{} {} {}", x, y, z); + if let (x, y, z) = (a, b, c) { + println!("{} {} {}", x, y, z) + } + + { + let x: i32 = 1; + { + let (x, y, z) = (a, b, c); + println!("{} {} {}", x, y, z); + } + if let (x, y, z) = (a, x, c) { + println!("{} {} {}", x, y, z) + } + } + + { + let (x, y, z) = (a, b, c); + println!("{} {} {}", x, y, z); + let fn_ = |y| { + println!("{} {} {}", a, b, y); + }; + fn_(c); + } + } +} + +#[allow(clippy::short_circuit_statement)] +fn issue15269(a: usize, b: usize, c: usize) -> bool { + a < b + && b < c; + + a < b + && b < c +} diff --git a/src/tools/clippy/tests/ui/match_single_binding.rs b/src/tools/clippy/tests/ui/match_single_binding.rs index d498da30fc87..ede1ab32beb5 100644 --- a/src/tools/clippy/tests/ui/match_single_binding.rs +++ b/src/tools/clippy/tests/ui/match_single_binding.rs @@ -267,3 +267,79 @@ mod issue14991 { }], } } + +mod issue15018 { + fn used_later(a: i32, b: i32, c: i32) { + let x = 1; + match (a, b, c) { + //~^ match_single_binding + (x, y, z) => println!("{} {} {}", x, y, z), + } + println!("x = {x}"); + } + + fn not_used_later(a: i32, b: i32, c: i32) { + match (a, b, c) { + //~^ match_single_binding + (x, y, z) => println!("{} {} {}", x, y, z), + } + } + + #[allow(irrefutable_let_patterns)] + fn not_used_later_but_shadowed(a: i32, b: i32, c: i32) { + match (a, b, c) { + //~^ match_single_binding + (x, y, z) => println!("{} {} {}", x, y, z), + } + let x = 1; + println!("x = {x}"); + } + + #[allow(irrefutable_let_patterns)] + fn not_used_later_but_shadowed_nested(a: i32, b: i32, c: i32) { + match (a, b, c) { + //~^ match_single_binding + (x, y, z) => println!("{} {} {}", x, y, z), + } + if let (x, y, z) = (a, b, c) { + println!("{} {} {}", x, y, z) + } + + { + let x: i32 = 1; + match (a, b, c) { + //~^ match_single_binding + (x, y, z) => println!("{} {} {}", x, y, z), + } + if let (x, y, z) = (a, x, c) { + println!("{} {} {}", x, y, z) + } + } + + { + match (a, b, c) { + //~^ match_single_binding + (x, y, z) => println!("{} {} {}", x, y, z), + } + let fn_ = |y| { + println!("{} {} {}", a, b, y); + }; + fn_(c); + } + } +} + +#[allow(clippy::short_circuit_statement)] +fn issue15269(a: usize, b: usize, c: usize) -> bool { + a < b + && match b { + //~^ match_single_binding + b => b < c, + }; + + a < b + && match (a, b) { + //~^ match_single_binding + (a, b) => b < c, + } +} diff --git a/src/tools/clippy/tests/ui/match_single_binding.stderr b/src/tools/clippy/tests/ui/match_single_binding.stderr index f274f80c81da..eea71777890e 100644 --- a/src/tools/clippy/tests/ui/match_single_binding.stderr +++ b/src/tools/clippy/tests/ui/match_single_binding.stderr @@ -411,5 +411,119 @@ LL ~ let _n = 1; LL + 42 | -error: aborting due to 29 previous errors +error: this match could be written as a `let` statement + --> tests/ui/match_single_binding.rs:274:9 + | +LL | / match (a, b, c) { +LL | | +LL | | (x, y, z) => println!("{} {} {}", x, y, z), +LL | | } + | |_________^ + | +help: consider using a `let` statement + | +LL ~ { +LL + let (x, y, z) = (a, b, c); +LL + println!("{} {} {}", x, y, z); +LL + } + | + +error: this match could be written as a `let` statement + --> tests/ui/match_single_binding.rs:282:9 + | +LL | / match (a, b, c) { +LL | | +LL | | (x, y, z) => println!("{} {} {}", x, y, z), +LL | | } + | |_________^ + | +help: consider using a `let` statement + | +LL ~ let (x, y, z) = (a, b, c); +LL + println!("{} {} {}", x, y, z) + | + +error: this match could be written as a `let` statement + --> tests/ui/match_single_binding.rs:290:9 + | +LL | / match (a, b, c) { +LL | | +LL | | (x, y, z) => println!("{} {} {}", x, y, z), +LL | | } + | |_________^ + | +help: consider using a `let` statement + | +LL ~ let (x, y, z) = (a, b, c); +LL + println!("{} {} {}", x, y, z); + | + +error: this match could be written as a `let` statement + --> tests/ui/match_single_binding.rs:300:9 + | +LL | / match (a, b, c) { +LL | | +LL | | (x, y, z) => println!("{} {} {}", x, y, z), +LL | | } + | |_________^ + | +help: consider using a `let` statement + | +LL ~ let (x, y, z) = (a, b, c); +LL + println!("{} {} {}", x, y, z); + | + +error: this match could be written as a `let` statement + --> tests/ui/match_single_binding.rs:310:13 + | +LL | / match (a, b, c) { +LL | | +LL | | (x, y, z) => println!("{} {} {}", x, y, z), +LL | | } + | |_____________^ + | +help: consider using a `let` statement + | +LL ~ { +LL + let (x, y, z) = (a, b, c); +LL + println!("{} {} {}", x, y, z); +LL + } + | + +error: this match could be written as a `let` statement + --> tests/ui/match_single_binding.rs:320:13 + | +LL | / match (a, b, c) { +LL | | +LL | | (x, y, z) => println!("{} {} {}", x, y, z), +LL | | } + | |_____________^ + | +help: consider using a `let` statement + | +LL ~ let (x, y, z) = (a, b, c); +LL + println!("{} {} {}", x, y, z); + | + +error: this match could be replaced by its body itself + --> tests/ui/match_single_binding.rs:335:12 + | +LL | && match b { + | ____________^ +LL | | +LL | | b => b < c, +LL | | }; + | |_________^ help: consider using the match body instead: `b < c` + +error: this match could be replaced by its body itself + --> tests/ui/match_single_binding.rs:341:12 + | +LL | && match (a, b) { + | ____________^ +LL | | +LL | | (a, b) => b < c, +LL | | } + | |_________^ help: consider using the match body instead: `b < c` + +error: aborting due to 37 previous errors diff --git a/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr b/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr index 8068edfff947..c2b58b952aaa 100644 --- a/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr +++ b/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr @@ -18,7 +18,7 @@ error: this `match` arm has a differing case than its expression LL | "~!@#$%^&*()-_=+Foo" => {}, | ^^^^^^^^^^^^^^^^^^^^ | -help: consider changing the case of this arm to respect `to_ascii_lowercase` (notice the capitalization difference) +help: consider changing the case of this arm to respect `to_ascii_lowercase` (notice the capitalization) | LL - "~!@#$%^&*()-_=+Foo" => {}, LL + "~!@#$%^&*()-_=+foo" => {}, diff --git a/src/tools/clippy/tests/ui/min_ident_chars.rs b/src/tools/clippy/tests/ui/min_ident_chars.rs index f473ac848a8e..e2f82e2a182f 100644 --- a/src/tools/clippy/tests/ui/min_ident_chars.rs +++ b/src/tools/clippy/tests/ui/min_ident_chars.rs @@ -124,3 +124,52 @@ fn wrong_pythagoras(a: f32, b: f32) -> f32 { mod issue_11163 { struct Array([T; N]); } + +struct Issue13396; + +impl core::fmt::Display for Issue13396 { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "Issue13396") + } +} + +impl core::fmt::Debug for Issue13396 { + fn fmt(&self, g: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + //~^ min_ident_chars + write!(g, "Issue13396") + } +} + +fn issue13396() { + let a = |f: i8| f; + //~^ min_ident_chars + //~| min_ident_chars +} + +trait D { + //~^ min_ident_chars + fn f(g: i32); + //~^ min_ident_chars + //~| min_ident_chars + fn long(long: i32); + + fn g(arg: i8) { + //~^ min_ident_chars + fn c(d: u8) {} + //~^ min_ident_chars + //~| min_ident_chars + } +} + +impl D for Issue13396 { + fn f(g: i32) { + fn h() {} + //~^ min_ident_chars + fn inner(a: i32) {} + //~^ min_ident_chars + let a = |f: String| f; + //~^ min_ident_chars + //~| min_ident_chars + } + fn long(long: i32) {} +} diff --git a/src/tools/clippy/tests/ui/min_ident_chars.stderr b/src/tools/clippy/tests/ui/min_ident_chars.stderr index bd6c45cf648e..36bf89e79f00 100644 --- a/src/tools/clippy/tests/ui/min_ident_chars.stderr +++ b/src/tools/clippy/tests/ui/min_ident_chars.stderr @@ -193,5 +193,83 @@ error: this ident consists of a single char LL | fn wrong_pythagoras(a: f32, b: f32) -> f32 { | ^ -error: aborting due to 32 previous errors +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:137:19 + | +LL | fn fmt(&self, g: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:144:14 + | +LL | let a = |f: i8| f; + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:144:9 + | +LL | let a = |f: i8| f; + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:149:7 + | +LL | trait D { + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:151:10 + | +LL | fn f(g: i32); + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:151:8 + | +LL | fn f(g: i32); + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:156:8 + | +LL | fn g(arg: i8) { + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:158:12 + | +LL | fn c(d: u8) {} + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:158:14 + | +LL | fn c(d: u8) {} + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:166:12 + | +LL | fn h() {} + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:168:18 + | +LL | fn inner(a: i32) {} + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:170:18 + | +LL | let a = |f: String| f; + | ^ + +error: this ident consists of a single char + --> tests/ui/min_ident_chars.rs:170:13 + | +LL | let a = |f: String| f; + | ^ + +error: aborting due to 45 previous errors diff --git a/src/tools/clippy/tests/ui/needless_collect_indirect.rs b/src/tools/clippy/tests/ui/needless_collect_indirect.rs index 57d0f2b99480..fff6d2f34b8e 100644 --- a/src/tools/clippy/tests/ui/needless_collect_indirect.rs +++ b/src/tools/clippy/tests/ui/needless_collect_indirect.rs @@ -1,5 +1,4 @@ -#![allow(clippy::uninlined_format_args, clippy::useless_vec)] -#![allow(clippy::needless_if, clippy::uninlined_format_args)] +#![allow(clippy::uninlined_format_args, clippy::useless_vec, clippy::needless_if)] #![warn(clippy::needless_collect)] //@no-rustfix use std::collections::{BinaryHeap, HashMap, HashSet, LinkedList, VecDeque}; diff --git a/src/tools/clippy/tests/ui/needless_collect_indirect.stderr b/src/tools/clippy/tests/ui/needless_collect_indirect.stderr index c7bf1b14df80..24523c9f97b0 100644 --- a/src/tools/clippy/tests/ui/needless_collect_indirect.stderr +++ b/src/tools/clippy/tests/ui/needless_collect_indirect.stderr @@ -1,5 +1,5 @@ error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:9:39 + --> tests/ui/needless_collect_indirect.rs:8:39 | LL | let indirect_iter = sample.iter().collect::>(); | ^^^^^^^ @@ -18,7 +18,7 @@ LL ~ sample.iter().map(|x| (x, x + 1)).collect::>(); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:13:38 + --> tests/ui/needless_collect_indirect.rs:12:38 | LL | let indirect_len = sample.iter().collect::>(); | ^^^^^^^ @@ -35,7 +35,7 @@ LL ~ sample.iter().count(); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:17:40 + --> tests/ui/needless_collect_indirect.rs:16:40 | LL | let indirect_empty = sample.iter().collect::>(); | ^^^^^^^ @@ -52,7 +52,7 @@ LL ~ sample.iter().next().is_none(); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:21:43 + --> tests/ui/needless_collect_indirect.rs:20:43 | LL | let indirect_contains = sample.iter().collect::>(); | ^^^^^^^ @@ -69,7 +69,7 @@ LL ~ sample.iter().any(|x| x == &5); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:35:48 + --> tests/ui/needless_collect_indirect.rs:34:48 | LL | let non_copy_contains = sample.into_iter().collect::>(); | ^^^^^^^ @@ -86,7 +86,7 @@ LL ~ sample.into_iter().any(|x| x == a); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:66:51 + --> tests/ui/needless_collect_indirect.rs:65:51 | LL | let buffer: Vec<&str> = string.split('/').collect(); | ^^^^^^^ @@ -103,7 +103,7 @@ LL ~ string.split('/').count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:73:55 + --> tests/ui/needless_collect_indirect.rs:72:55 | LL | let indirect_len: VecDeque<_> = sample.iter().collect(); | ^^^^^^^ @@ -120,7 +120,7 @@ LL ~ sample.iter().count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:80:57 + --> tests/ui/needless_collect_indirect.rs:79:57 | LL | let indirect_len: LinkedList<_> = sample.iter().collect(); | ^^^^^^^ @@ -137,7 +137,7 @@ LL ~ sample.iter().count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:87:57 + --> tests/ui/needless_collect_indirect.rs:86:57 | LL | let indirect_len: BinaryHeap<_> = sample.iter().collect(); | ^^^^^^^ @@ -154,7 +154,7 @@ LL ~ sample.iter().count() | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:149:59 + --> tests/ui/needless_collect_indirect.rs:148:59 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -172,7 +172,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == i); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:176:59 + --> tests/ui/needless_collect_indirect.rs:175:59 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -190,7 +190,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:207:63 + --> tests/ui/needless_collect_indirect.rs:206:63 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -208,7 +208,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:245:59 + --> tests/ui/needless_collect_indirect.rs:244:59 | LL | let y: Vec = vec.iter().map(|k| k * k).collect(); | ^^^^^^^ @@ -226,7 +226,7 @@ LL ~ vec.iter().map(|k| k * k).any(|x| x == n); | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:272:26 + --> tests/ui/needless_collect_indirect.rs:271:26 | LL | let w = v.iter().collect::>(); | ^^^^^^^ @@ -244,7 +244,7 @@ LL ~ for _ in 0..v.iter().count() { | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:296:30 + --> tests/ui/needless_collect_indirect.rs:295:30 | LL | let mut w = v.iter().collect::>(); | ^^^^^^^ @@ -262,7 +262,7 @@ LL ~ while 1 == v.iter().count() { | error: avoid using `collect()` when not needed - --> tests/ui/needless_collect_indirect.rs:320:30 + --> tests/ui/needless_collect_indirect.rs:319:30 | LL | let mut w = v.iter().collect::>(); | ^^^^^^^ diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.rs b/src/tools/clippy/tests/ui/nonminimal_bool.rs index 1eecc3dee3dc..cacce9a7d1cb 100644 --- a/src/tools/clippy/tests/ui/nonminimal_bool.rs +++ b/src/tools/clippy/tests/ui/nonminimal_bool.rs @@ -236,3 +236,21 @@ mod issue14404 { } } } + +fn dont_simplify_double_not_if_types_differ() { + struct S; + + impl std::ops::Not for S { + type Output = bool; + fn not(self) -> bool { + true + } + } + + // The lint must propose `if !!S`, not `if S`. + // FIXME: `bool_comparison` will propose to use `S == true` + // which is invalid. + if !S != true {} + //~^ nonminimal_bool + //~| bool_comparison +} diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.stderr b/src/tools/clippy/tests/ui/nonminimal_bool.stderr index ecb82a23da03..c20412974b20 100644 --- a/src/tools/clippy/tests/ui/nonminimal_bool.stderr +++ b/src/tools/clippy/tests/ui/nonminimal_bool.stderr @@ -179,7 +179,7 @@ error: inequality checks against true can be replaced by a negation --> tests/ui/nonminimal_bool.rs:186:8 | LL | if !b != true {} - | ^^^^^^^^^^ help: try simplifying it as shown: `!!b` + | ^^^^^^^^^^ help: try simplifying it as shown: `b` error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:189:8 @@ -209,7 +209,7 @@ error: inequality checks against true can be replaced by a negation --> tests/ui/nonminimal_bool.rs:193:8 | LL | if true != !b {} - | ^^^^^^^^^^ help: try simplifying it as shown: `!!b` + | ^^^^^^^^^^ help: try simplifying it as shown: `b` error: this boolean expression can be simplified --> tests/ui/nonminimal_bool.rs:196:8 @@ -235,5 +235,17 @@ error: this boolean expression can be simplified LL | if !(matches!(ty, TyKind::Ref(_, _, _)) && !is_mutable(&expr)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!matches!(ty, TyKind::Ref(_, _, _)) || is_mutable(&expr)` -error: aborting due to 31 previous errors +error: this boolean expression can be simplified + --> tests/ui/nonminimal_bool.rs:253:8 + | +LL | if !S != true {} + | ^^^^^^^^^^ help: try: `S == true` + +error: inequality checks against true can be replaced by a negation + --> tests/ui/nonminimal_bool.rs:253:8 + | +LL | if !S != true {} + | ^^^^^^^^^^ help: try simplifying it as shown: `!!S` + +error: aborting due to 33 previous errors diff --git a/src/tools/clippy/tests/ui/option_if_let_else.fixed b/src/tools/clippy/tests/ui/option_if_let_else.fixed index fe3ac9e8f92c..0f86de5646cd 100644 --- a/src/tools/clippy/tests/ui/option_if_let_else.fixed +++ b/src/tools/clippy/tests/ui/option_if_let_else.fixed @@ -302,3 +302,15 @@ mod issue11059 { if let Some(o) = o { o } else { &S } } } + +fn issue15379() { + let opt = Some(0usize); + let opt_raw_ptr = &opt as *const Option; + let _ = unsafe { (*opt_raw_ptr).map_or(1, |o| o) }; + //~^ option_if_let_else +} + +fn issue15002() { + let res: Result = Ok("_".to_string()); + let _ = res.map_or_else(|_| String::new(), |s| s.clone()); +} diff --git a/src/tools/clippy/tests/ui/option_if_let_else.rs b/src/tools/clippy/tests/ui/option_if_let_else.rs index 5b7498bc8e23..7aabd778f87e 100644 --- a/src/tools/clippy/tests/ui/option_if_let_else.rs +++ b/src/tools/clippy/tests/ui/option_if_let_else.rs @@ -365,3 +365,19 @@ mod issue11059 { if let Some(o) = o { o } else { &S } } } + +fn issue15379() { + let opt = Some(0usize); + let opt_raw_ptr = &opt as *const Option; + let _ = unsafe { if let Some(o) = *opt_raw_ptr { o } else { 1 } }; + //~^ option_if_let_else +} + +fn issue15002() { + let res: Result = Ok("_".to_string()); + let _ = match res { + //~^ option_if_let_else + Ok(s) => s.clone(), + Err(_) => String::new(), + }; +} diff --git a/src/tools/clippy/tests/ui/option_if_let_else.stderr b/src/tools/clippy/tests/ui/option_if_let_else.stderr index 9eb41f81a539..2e2fe6f20492 100644 --- a/src/tools/clippy/tests/ui/option_if_let_else.stderr +++ b/src/tools/clippy/tests/ui/option_if_let_else.stderr @@ -334,5 +334,22 @@ error: use Option::map_or_else instead of an if let/else LL | let mut _hm = if let Some(hm) = &opt { hm.clone() } else { new_map!() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `opt.as_ref().map_or_else(|| new_map!(), |hm| hm.clone())` -error: aborting due to 25 previous errors +error: use Option::map_or instead of an if let/else + --> tests/ui/option_if_let_else.rs:372:22 + | +LL | let _ = unsafe { if let Some(o) = *opt_raw_ptr { o } else { 1 } }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*opt_raw_ptr).map_or(1, |o| o)` + +error: use Option::map_or_else instead of an if let/else + --> tests/ui/option_if_let_else.rs:378:13 + | +LL | let _ = match res { + | _____________^ +LL | | +LL | | Ok(s) => s.clone(), +LL | | Err(_) => String::new(), +LL | | }; + | |_____^ help: try: `res.map_or_else(|_| String::new(), |s| s.clone())` + +error: aborting due to 27 previous errors diff --git a/src/tools/clippy/tests/ui/search_is_some.rs b/src/tools/clippy/tests/ui/search_is_some.rs index 4143b8bfba58..802d27449abf 100644 --- a/src/tools/clippy/tests/ui/search_is_some.rs +++ b/src/tools/clippy/tests/ui/search_is_some.rs @@ -87,3 +87,18 @@ fn is_none() { let _ = (0..1).find(some_closure).is_none(); //~^ search_is_some } + +#[allow(clippy::match_like_matches_macro)] +fn issue15102() { + let values = [None, Some(3)]; + let has_even = values + //~^ search_is_some + .iter() + .find(|v| match v { + Some(x) if x % 2 == 0 => true, + _ => false, + }) + .is_some(); + + println!("{has_even}"); +} diff --git a/src/tools/clippy/tests/ui/search_is_some.stderr b/src/tools/clippy/tests/ui/search_is_some.stderr index d9a43c8915e8..d5412f901110 100644 --- a/src/tools/clippy/tests/ui/search_is_some.stderr +++ b/src/tools/clippy/tests/ui/search_is_some.stderr @@ -90,5 +90,20 @@ error: called `is_none()` after searching an `Iterator` with `find` LL | let _ = (0..1).find(some_closure).is_none(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!(0..1).any(some_closure)` -error: aborting due to 8 previous errors +error: called `is_some()` after searching an `Iterator` with `find` + --> tests/ui/search_is_some.rs:94:20 + | +LL | let has_even = values + | ____________________^ +LL | | +LL | | .iter() +LL | | .find(|v| match v { +... | +LL | | }) +LL | | .is_some(); + | |__________________^ + | + = help: this is more succinctly expressed by calling `any()` + +error: aborting due to 9 previous errors diff --git a/src/tools/clippy/tests/ui/search_is_some_fixable_some.fixed b/src/tools/clippy/tests/ui/search_is_some_fixable_some.fixed index 42b39b33b575..c7a4422f3737 100644 --- a/src/tools/clippy/tests/ui/search_is_some_fixable_some.fixed +++ b/src/tools/clippy/tests/ui/search_is_some_fixable_some.fixed @@ -289,3 +289,10 @@ mod issue9120 { //~^ search_is_some } } + +fn issue15102() { + let values = [None, Some(3)]; + let has_even = values.iter().any(|v| matches!(&v, Some(x) if x % 2 == 0)); + //~^ search_is_some + println!("{has_even}"); +} diff --git a/src/tools/clippy/tests/ui/search_is_some_fixable_some.rs b/src/tools/clippy/tests/ui/search_is_some_fixable_some.rs index ca4f4d941cb2..d6b1c67c9718 100644 --- a/src/tools/clippy/tests/ui/search_is_some_fixable_some.rs +++ b/src/tools/clippy/tests/ui/search_is_some_fixable_some.rs @@ -297,3 +297,10 @@ mod issue9120 { //~^ search_is_some } } + +fn issue15102() { + let values = [None, Some(3)]; + let has_even = values.iter().find(|v| matches!(v, Some(x) if x % 2 == 0)).is_some(); + //~^ search_is_some + println!("{has_even}"); +} diff --git a/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr b/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr index 8291f48d43c4..551a670d937f 100644 --- a/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr +++ b/src/tools/clippy/tests/ui/search_is_some_fixable_some.stderr @@ -289,5 +289,11 @@ error: called `is_some()` after searching an `Iterator` with `find` LL | let _ = v.iter().find(|x: &&u32| (*arg_no_deref_dyn)(x)).is_some(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|x: &u32| (*arg_no_deref_dyn)(&x))` -error: aborting due to 46 previous errors +error: called `is_some()` after searching an `Iterator` with `find` + --> tests/ui/search_is_some_fixable_some.rs:303:34 + | +LL | let has_even = values.iter().find(|v| matches!(v, Some(x) if x % 2 == 0)).is_some(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `any(|v| matches!(&v, Some(x) if x % 2 == 0))` + +error: aborting due to 47 previous errors diff --git a/src/tools/clippy/tests/ui/string_to_string.rs b/src/tools/clippy/tests/ui/string_to_string.rs deleted file mode 100644 index 7c5bd8a897ba..000000000000 --- a/src/tools/clippy/tests/ui/string_to_string.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![warn(clippy::string_to_string)] -#![allow(clippy::redundant_clone, clippy::unnecessary_literal_unwrap)] - -fn main() { - let mut message = String::from("Hello"); - let mut v = message.to_string(); - //~^ string_to_string - - let variable1 = String::new(); - let v = &variable1; - let variable2 = Some(v); - let _ = variable2.map(|x| { - println!(); - x.to_string() - }); - //~^^ string_to_string - - let x = Some(String::new()); - let _ = x.unwrap_or_else(|| v.to_string()); - //~^ string_to_string -} diff --git a/src/tools/clippy/tests/ui/string_to_string.stderr b/src/tools/clippy/tests/ui/string_to_string.stderr deleted file mode 100644 index 99eea06f18eb..000000000000 --- a/src/tools/clippy/tests/ui/string_to_string.stderr +++ /dev/null @@ -1,28 +0,0 @@ -error: `to_string()` called on a `String` - --> tests/ui/string_to_string.rs:6:17 - | -LL | let mut v = message.to_string(); - | ^^^^^^^^^^^^^^^^^^^ - | - = help: consider using `.clone()` - = note: `-D clippy::string-to-string` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::string_to_string)]` - -error: `to_string()` called on a `String` - --> tests/ui/string_to_string.rs:14:9 - | -LL | x.to_string() - | ^^^^^^^^^^^^^ - | - = help: consider using `.clone()` - -error: `to_string()` called on a `String` - --> tests/ui/string_to_string.rs:19:33 - | -LL | let _ = x.unwrap_or_else(|| v.to_string()); - | ^^^^^^^^^^^^^ - | - = help: consider using `.clone()` - -error: aborting due to 3 previous errors - diff --git a/src/tools/clippy/tests/ui/string_to_string_in_map.fixed b/src/tools/clippy/tests/ui/string_to_string_in_map.fixed deleted file mode 100644 index efc085539f15..000000000000 --- a/src/tools/clippy/tests/ui/string_to_string_in_map.fixed +++ /dev/null @@ -1,20 +0,0 @@ -#![deny(clippy::string_to_string)] -#![allow(clippy::unnecessary_literal_unwrap, clippy::useless_vec, clippy::iter_cloned_collect)] - -fn main() { - let variable1 = String::new(); - let v = &variable1; - let variable2 = Some(v); - let _ = variable2.cloned(); - //~^ string_to_string - let _ = variable2.cloned(); - //~^ string_to_string - #[rustfmt::skip] - let _ = variable2.cloned(); - //~^ string_to_string - - let _ = vec![String::new()].iter().cloned().collect::>(); - //~^ string_to_string - let _ = vec![String::new()].iter().cloned().collect::>(); - //~^ string_to_string -} diff --git a/src/tools/clippy/tests/ui/string_to_string_in_map.rs b/src/tools/clippy/tests/ui/string_to_string_in_map.rs deleted file mode 100644 index 5bf1d7ba5a2e..000000000000 --- a/src/tools/clippy/tests/ui/string_to_string_in_map.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![deny(clippy::string_to_string)] -#![allow(clippy::unnecessary_literal_unwrap, clippy::useless_vec, clippy::iter_cloned_collect)] - -fn main() { - let variable1 = String::new(); - let v = &variable1; - let variable2 = Some(v); - let _ = variable2.map(String::to_string); - //~^ string_to_string - let _ = variable2.map(|x| x.to_string()); - //~^ string_to_string - #[rustfmt::skip] - let _ = variable2.map(|x| { x.to_string() }); - //~^ string_to_string - - let _ = vec![String::new()].iter().map(String::to_string).collect::>(); - //~^ string_to_string - let _ = vec![String::new()].iter().map(|x| x.to_string()).collect::>(); - //~^ string_to_string -} diff --git a/src/tools/clippy/tests/ui/string_to_string_in_map.stderr b/src/tools/clippy/tests/ui/string_to_string_in_map.stderr deleted file mode 100644 index 35aeed656eed..000000000000 --- a/src/tools/clippy/tests/ui/string_to_string_in_map.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: `to_string()` called on a `String` - --> tests/ui/string_to_string_in_map.rs:8:23 - | -LL | let _ = variable2.map(String::to_string); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `cloned()` - | -note: the lint level is defined here - --> tests/ui/string_to_string_in_map.rs:1:9 - | -LL | #![deny(clippy::string_to_string)] - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: `to_string()` called on a `String` - --> tests/ui/string_to_string_in_map.rs:10:23 - | -LL | let _ = variable2.map(|x| x.to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `cloned()` - -error: `to_string()` called on a `String` - --> tests/ui/string_to_string_in_map.rs:13:23 - | -LL | let _ = variable2.map(|x| { x.to_string() }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cloned()` - -error: `to_string()` called on a `String` - --> tests/ui/string_to_string_in_map.rs:16:40 - | -LL | let _ = vec![String::new()].iter().map(String::to_string).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `cloned()` - -error: `to_string()` called on a `String` - --> tests/ui/string_to_string_in_map.rs:18:40 - | -LL | let _ = vec![String::new()].iter().map(|x| x.to_string()).collect::>(); - | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `cloned()` - -error: aborting due to 5 previous errors - diff --git a/src/tools/clippy/tests/ui/suspicious_else_formatting.rs b/src/tools/clippy/tests/ui/suspicious_else_formatting.rs index 28a3b551116d..072e7b27b0d0 100644 --- a/src/tools/clippy/tests/ui/suspicious_else_formatting.rs +++ b/src/tools/clippy/tests/ui/suspicious_else_formatting.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macro_suspicious_else_formatting.rs -#![warn(clippy::suspicious_else_formatting)] +#![warn(clippy::suspicious_else_formatting, clippy::possible_missing_else)] #![allow( clippy::if_same_then_else, clippy::let_unit_value, @@ -20,12 +20,12 @@ fn main() { // weird `else` formatting: if foo() { } { - //~^ suspicious_else_formatting + //~^ possible_missing_else } if foo() { } if foo() { - //~^ suspicious_else_formatting + //~^ possible_missing_else } let _ = { // if as the last expression @@ -33,7 +33,7 @@ fn main() { if foo() { } if foo() { - //~^ suspicious_else_formatting + //~^ possible_missing_else } else { } @@ -42,7 +42,7 @@ fn main() { let _ = { // if in the middle of a block if foo() { } if foo() { - //~^ suspicious_else_formatting + //~^ possible_missing_else } else { } diff --git a/src/tools/clippy/tests/ui/suspicious_else_formatting.stderr b/src/tools/clippy/tests/ui/suspicious_else_formatting.stderr index affd20b22d9c..04555c6edbd3 100644 --- a/src/tools/clippy/tests/ui/suspicious_else_formatting.stderr +++ b/src/tools/clippy/tests/ui/suspicious_else_formatting.stderr @@ -5,8 +5,8 @@ LL | } { | ^ | = note: to remove this lint, add the missing `else` or add a new line before the next block - = note: `-D clippy::suspicious-else-formatting` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::suspicious_else_formatting)]` + = note: `-D clippy::possible-missing-else` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::possible_missing_else)]` error: this looks like an `else if` but the `else` is missing --> tests/ui/suspicious_else_formatting.rs:27:6 @@ -41,6 +41,8 @@ LL | | { | |____^ | = note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}` + = note: `-D clippy::suspicious-else-formatting` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::suspicious_else_formatting)]` error: this is an `else if` but the formatting might hide it --> tests/ui/suspicious_else_formatting.rs:67:6 diff --git a/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.rs b/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.rs index e7e01248dfbe..65f67df79131 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.rs +++ b/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.rs @@ -1,5 +1,6 @@ //@no-rustfix +#![allow(clippy::duplicated_attributes)] #![warn(clippy::unnecessary_clippy_cfg)] #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] //~^ unnecessary_clippy_cfg @@ -7,7 +8,6 @@ //~^ unnecessary_clippy_cfg #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] //~^ unnecessary_clippy_cfg -//~| duplicated_attributes #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] //~^ unnecessary_clippy_cfg @@ -17,7 +17,6 @@ //~^ unnecessary_clippy_cfg #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] //~^ unnecessary_clippy_cfg -//~| duplicated_attributes #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))] //~^ unnecessary_clippy_cfg diff --git a/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr b/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr index f66c68949548..4f638d5c513c 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_clippy_cfg.stderr @@ -1,5 +1,5 @@ error: no need to put clippy lints behind a `clippy` cfg - --> tests/ui/unnecessary_clippy_cfg.rs:4:1 + --> tests/ui/unnecessary_clippy_cfg.rs:5:1 | LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#![deny(clippy::non_minimal_cfg)]` @@ -8,7 +8,7 @@ LL | #![cfg_attr(clippy, deny(clippy::non_minimal_cfg))] = help: to override `-D warnings` add `#[allow(clippy::unnecessary_clippy_cfg)]` error: no need to put clippy lints behind a `clippy` cfg - --> tests/ui/unnecessary_clippy_cfg.rs:6:37 + --> tests/ui/unnecessary_clippy_cfg.rs:7:37 | LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] = note: write instead: `#![deny(clippy::non_minimal_cfg)]` error: no need to put clippy lints behind a `clippy` cfg - --> tests/ui/unnecessary_clippy_cfg.rs:8:37 + --> tests/ui/unnecessary_clippy_cfg.rs:9:37 | LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,46 +52,10 @@ LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] = note: write instead: `#[deny(clippy::non_minimal_cfg)]` error: no need to put clippy lints behind a `clippy` cfg - --> tests/ui/unnecessary_clippy_cfg.rs:21:1 + --> tests/ui/unnecessary_clippy_cfg.rs:20:1 | LL | #[cfg_attr(clippy, deny(clippy::non_minimal_cfg))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `#[deny(clippy::non_minimal_cfg)]` -error: duplicated attribute - --> tests/ui/unnecessary_clippy_cfg.rs:8:26 - | -LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] - | ^^^^^^^^^ - | -note: first defined here - --> tests/ui/unnecessary_clippy_cfg.rs:6:26 - | -LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] - | ^^^^^^^^^ -help: remove this attribute - --> tests/ui/unnecessary_clippy_cfg.rs:8:26 - | -LL | #![cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] - | ^^^^^^^^^ - = note: `-D clippy::duplicated-attributes` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::duplicated_attributes)]` - -error: duplicated attribute - --> tests/ui/unnecessary_clippy_cfg.rs:18:25 - | -LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] - | ^^^^^^^^^ - | -note: first defined here - --> tests/ui/unnecessary_clippy_cfg.rs:16:25 - | -LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] - | ^^^^^^^^^ -help: remove this attribute - --> tests/ui/unnecessary_clippy_cfg.rs:18:25 - | -LL | #[cfg_attr(clippy, deny(dead_code, clippy::non_minimal_cfg))] - | ^^^^^^^^^ - -error: aborting due to 10 previous errors +error: aborting due to 8 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_map_or.fixed b/src/tools/clippy/tests/ui/unnecessary_map_or.fixed index 3109c4af8e28..10552431d65d 100644 --- a/src/tools/clippy/tests/ui/unnecessary_map_or.fixed +++ b/src/tools/clippy/tests/ui/unnecessary_map_or.fixed @@ -131,6 +131,26 @@ fn issue14201(a: Option, b: Option, s: &String) -> bool { x && y } +fn issue14714() { + assert!(Some("test") == Some("test")); + //~^ unnecessary_map_or + + // even though we're in a macro context, we still need to parenthesise because of the `then` + assert!((Some("test") == Some("test")).then(|| 1).is_some()); + //~^ unnecessary_map_or + + // method lints don't fire on macros + macro_rules! m { + ($x:expr) => { + // should become !($x == Some(1)) + let _ = !$x.map_or(false, |v| v == 1); + // should become $x == Some(1) + let _ = $x.map_or(false, |v| v == 1); + }; + } + m!(Some(5)); +} + fn issue15180() { let s = std::sync::Mutex::new(Some("foo")); _ = s.lock().unwrap().is_some_and(|s| s == "foo"); diff --git a/src/tools/clippy/tests/ui/unnecessary_map_or.rs b/src/tools/clippy/tests/ui/unnecessary_map_or.rs index 52a55f9fc9e4..4b406ec2998b 100644 --- a/src/tools/clippy/tests/ui/unnecessary_map_or.rs +++ b/src/tools/clippy/tests/ui/unnecessary_map_or.rs @@ -135,6 +135,26 @@ fn issue14201(a: Option, b: Option, s: &String) -> bool { x && y } +fn issue14714() { + assert!(Some("test").map_or(false, |x| x == "test")); + //~^ unnecessary_map_or + + // even though we're in a macro context, we still need to parenthesise because of the `then` + assert!(Some("test").map_or(false, |x| x == "test").then(|| 1).is_some()); + //~^ unnecessary_map_or + + // method lints don't fire on macros + macro_rules! m { + ($x:expr) => { + // should become !($x == Some(1)) + let _ = !$x.map_or(false, |v| v == 1); + // should become $x == Some(1) + let _ = $x.map_or(false, |v| v == 1); + }; + } + m!(Some(5)); +} + fn issue15180() { let s = std::sync::Mutex::new(Some("foo")); _ = s.lock().unwrap().map_or(false, |s| s == "foo"); diff --git a/src/tools/clippy/tests/ui/unnecessary_map_or.stderr b/src/tools/clippy/tests/ui/unnecessary_map_or.stderr index 99e17e8b34ba..b8a22346c378 100644 --- a/src/tools/clippy/tests/ui/unnecessary_map_or.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_map_or.stderr @@ -327,7 +327,31 @@ LL + let y = b.is_none_or(|b| b == *s); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:140:9 + --> tests/ui/unnecessary_map_or.rs:139:13 + | +LL | assert!(Some("test").map_or(false, |x| x == "test")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a standard comparison instead + | +LL - assert!(Some("test").map_or(false, |x| x == "test")); +LL + assert!(Some("test") == Some("test")); + | + +error: this `map_or` can be simplified + --> tests/ui/unnecessary_map_or.rs:143:13 + | +LL | assert!(Some("test").map_or(false, |x| x == "test").then(|| 1).is_some()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: use a standard comparison instead + | +LL - assert!(Some("test").map_or(false, |x| x == "test").then(|| 1).is_some()); +LL + assert!((Some("test") == Some("test")).then(|| 1).is_some()); + | + +error: this `map_or` can be simplified + --> tests/ui/unnecessary_map_or.rs:160:9 | LL | _ = s.lock().unwrap().map_or(false, |s| s == "foo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -339,7 +363,7 @@ LL + _ = s.lock().unwrap().is_some_and(|s| s == "foo"); | error: this `map_or` can be simplified - --> tests/ui/unnecessary_map_or.rs:144:9 + --> tests/ui/unnecessary_map_or.rs:164:9 | LL | _ = s.map_or(false, |s| s == "foo"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -350,5 +374,5 @@ LL - _ = s.map_or(false, |s| s == "foo"); LL + _ = s.is_some_and(|s| s == "foo"); | -error: aborting due to 28 previous errors +error: aborting due to 30 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr b/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr index 9a38d3746da8..a066554037fe 100644 --- a/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_sort_by.stderr @@ -7,7 +7,7 @@ LL | vec.sort_by(|a, b| a.cmp(b)); = note: `-D clippy::unnecessary-sort-by` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_sort_by)]` -error: consider using `sort` +error: consider using `sort_unstable` --> tests/ui/unnecessary_sort_by.rs:14:5 | LL | vec.sort_unstable_by(|a, b| a.cmp(b)); @@ -19,7 +19,7 @@ error: consider using `sort_by_key` LL | vec.sort_by(|a, b| (a + 5).abs().cmp(&(b + 5).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (a + 5).abs())` -error: consider using `sort_by_key` +error: consider using `sort_unstable_by_key` --> tests/ui/unnecessary_sort_by.rs:18:5 | LL | vec.sort_unstable_by(|a, b| id(-a).cmp(&id(-b))); @@ -31,7 +31,7 @@ error: consider using `sort_by_key` LL | vec.sort_by(|a, b| (b + 5).abs().cmp(&(a + 5).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|b| std::cmp::Reverse((b + 5).abs()))` -error: consider using `sort_by_key` +error: consider using `sort_unstable_by_key` --> tests/ui/unnecessary_sort_by.rs:24:5 | LL | vec.sort_unstable_by(|a, b| id(-b).cmp(&id(-a))); @@ -43,7 +43,7 @@ error: consider using `sort_by_key` LL | vec.sort_by(|a, b| (***a).abs().cmp(&(***b).abs())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.sort_by_key(|a| (***a).abs())` -error: consider using `sort_by_key` +error: consider using `sort_unstable_by_key` --> tests/ui/unnecessary_sort_by.rs:37:5 | LL | vec.sort_unstable_by(|a, b| (***a).abs().cmp(&(***b).abs())); @@ -55,7 +55,7 @@ error: consider using `sort_by_key` LL | args.sort_by(|a, b| a.name().cmp(&b.name())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|a| a.name())` -error: consider using `sort_by_key` +error: consider using `sort_unstable_by_key` --> tests/ui/unnecessary_sort_by.rs:99:9 | LL | args.sort_unstable_by(|a, b| a.name().cmp(&b.name())); @@ -67,7 +67,7 @@ error: consider using `sort_by_key` LL | args.sort_by(|a, b| b.name().cmp(&a.name())); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `args.sort_by_key(|b| std::cmp::Reverse(b.name()))` -error: consider using `sort_by_key` +error: consider using `sort_unstable_by_key` --> tests/ui/unnecessary_sort_by.rs:104:9 | LL | args.sort_unstable_by(|a, b| b.name().cmp(&a.name())); diff --git a/src/tools/clippy/triagebot.toml b/src/tools/clippy/triagebot.toml index a62b6269a3bf..805baf2af6dd 100644 --- a/src/tools/clippy/triagebot.toml +++ b/src/tools/clippy/triagebot.toml @@ -54,7 +54,6 @@ contributing_url = "https://github.com/rust-lang/rust-clippy/blob/master/CONTRIB users_on_vacation = [ "matthiaskrgr", "Manishearth", - "samueltardieu", ] [assign.owners] diff --git a/src/tools/clippy/util/gh-pages/index_template.html b/src/tools/clippy/util/gh-pages/index_template.html index 5d65ea585df6..d34ff0a59732 100644 --- a/src/tools/clippy/util/gh-pages/index_template.html +++ b/src/tools/clippy/util/gh-pages/index_template.html @@ -14,7 +14,6 @@ Otherwise, have a great day =^.^= Clippy Lints {# #} - {# #} {# #} {# #} @@ -49,7 +48,7 @@ Otherwise, have a great day =^.^= {# #}
{# #} -

Clippy Lints

{# #} +

Clippy Lints Total number: {{+ count }}

{# #}