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/Cargo.lock b/Cargo.lock index 5a3906c470f7..dbb76ada8377 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -568,7 +568,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "clippy" -version = "0.1.90" +version = "0.1.91" dependencies = [ "anstream", "askama", @@ -595,7 +595,7 @@ dependencies = [ [[package]] name = "clippy_config" -version = "0.1.90" +version = "0.1.91" dependencies = [ "clippy_utils", "itertools", @@ -618,7 +618,7 @@ dependencies = [ [[package]] name = "clippy_lints" -version = "0.1.90" +version = "0.1.91" dependencies = [ "arrayvec", "cargo_metadata 0.18.1", @@ -649,7 +649,7 @@ dependencies = [ [[package]] name = "clippy_utils" -version = "0.1.90" +version = "0.1.91" dependencies = [ "arrayvec", "itertools", @@ -1051,7 +1051,7 @@ dependencies = [ [[package]] name = "declare_clippy_lint" -version = "0.1.90" +version = "0.1.91" [[package]] name = "derive-where" 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/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 1245d4897547..fb42cfea30b4 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -98,7 +98,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } let expr_hir_id = self.lower_node_id(e.id); - self.lower_attrs(expr_hir_id, &e.attrs, e.span); + let attrs = self.lower_attrs(expr_hir_id, &e.attrs, e.span); let kind = match &e.kind { ExprKind::Array(exprs) => hir::ExprKind::Array(self.lower_exprs(exprs)), @@ -232,10 +232,10 @@ impl<'hir> LoweringContext<'_, 'hir> { *fn_arg_span, ), None => self.lower_expr_closure( + attrs, binder, *capture_clause, e.id, - expr_hir_id, *constness, *movability, fn_decl, @@ -1052,10 +1052,10 @@ impl<'hir> LoweringContext<'_, 'hir> { fn lower_expr_closure( &mut self, + attrs: &[rustc_hir::Attribute], binder: &ClosureBinder, capture_clause: CaptureBy, closure_id: NodeId, - closure_hir_id: hir::HirId, constness: Const, movability: Movability, decl: &FnDecl, @@ -1067,15 +1067,9 @@ impl<'hir> LoweringContext<'_, 'hir> { let (binder_clause, generic_params) = self.lower_closure_binder(binder); let (body_id, closure_kind) = self.with_new_scopes(fn_decl_span, move |this| { - let mut coroutine_kind = if this - .attrs - .get(&closure_hir_id.local_id) - .is_some_and(|attrs| attrs.iter().any(|attr| attr.has_name(sym::coroutine))) - { - Some(hir::CoroutineKind::Coroutine(Movability::Movable)) - } else { - None - }; + + let mut coroutine_kind = find_attr!(attrs, AttributeKind::Coroutine(_) => hir::CoroutineKind::Coroutine(Movability::Movable)); + // FIXME(contracts): Support contracts on closures? let body_id = this.lower_fn_body(decl, None, |this| { this.coroutine_kind = coroutine_kind; diff --git a/compiler/rustc_ast_passes/messages.ftl b/compiler/rustc_ast_passes/messages.ftl index 42f3569f0f1e..53e64439afc6 100644 --- a/compiler/rustc_ast_passes/messages.ftl +++ b/compiler/rustc_ast_passes/messages.ftl @@ -40,7 +40,7 @@ ast_passes_auto_generic = auto traits cannot have generic parameters ast_passes_auto_items = auto traits cannot have associated items .label = {ast_passes_auto_items} - .suggestion = remove these associated items + .suggestion = remove the associated items ast_passes_auto_super_lifetime = auto traits cannot have super traits or lifetime bounds .label = {ast_passes_auto_super_lifetime} diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index ae482ceb9b72..1c1c5f82f3ef 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -699,19 +699,23 @@ impl<'a> AstValidator<'a> { } } - fn deny_super_traits(&self, bounds: &GenericBounds, ident_span: Span) { + fn deny_super_traits(&self, bounds: &GenericBounds, ident: Span) { if let [.., last] = &bounds[..] { - let span = ident_span.shrink_to_hi().to(last.span()); - self.dcx().emit_err(errors::AutoTraitBounds { span, ident: ident_span }); + let span = bounds.iter().map(|b| b.span()).collect(); + let removal = ident.shrink_to_hi().to(last.span()); + self.dcx().emit_err(errors::AutoTraitBounds { span, removal, ident }); } } - fn deny_where_clause(&self, where_clause: &WhereClause, ident_span: Span) { + fn deny_where_clause(&self, where_clause: &WhereClause, ident: Span) { if !where_clause.predicates.is_empty() { // FIXME: The current diagnostic is misleading since it only talks about // super trait and lifetime bounds while we should just say “bounds”. - self.dcx() - .emit_err(errors::AutoTraitBounds { span: where_clause.span, ident: ident_span }); + self.dcx().emit_err(errors::AutoTraitBounds { + span: vec![where_clause.span], + removal: where_clause.span, + ident, + }); } } diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index 8b5873a3ef37..60f47490f12a 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -344,7 +344,7 @@ pub(crate) struct ModuleNonAscii { #[diag(ast_passes_auto_generic, code = E0567)] pub(crate) struct AutoTraitGeneric { #[primary_span] - #[suggestion(code = "", applicability = "machine-applicable")] + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] pub span: Span, #[label] pub ident: Span, @@ -354,8 +354,9 @@ pub(crate) struct AutoTraitGeneric { #[diag(ast_passes_auto_super_lifetime, code = E0568)] pub(crate) struct AutoTraitBounds { #[primary_span] - #[suggestion(code = "", applicability = "machine-applicable")] - pub span: Span, + pub span: Vec, + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] + pub removal: Span, #[label] pub ident: Span, } @@ -365,7 +366,7 @@ pub(crate) struct AutoTraitBounds { pub(crate) struct AutoTraitItems { #[primary_span] pub spans: Vec, - #[suggestion(code = "", applicability = "machine-applicable")] + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] pub total: Span, #[label] pub ident: Span, diff --git a/compiler/rustc_attr_parsing/src/attributes/body.rs b/compiler/rustc_attr_parsing/src/attributes/body.rs new file mode 100644 index 000000000000..ab9330216f6c --- /dev/null +++ b/compiler/rustc_attr_parsing/src/attributes/body.rs @@ -0,0 +1,15 @@ +//! Attributes that can be found in function body. + +use rustc_hir::attrs::AttributeKind; +use rustc_span::{Symbol, sym}; + +use super::{NoArgsAttributeParser, OnDuplicate}; +use crate::context::Stage; + +pub(crate) struct CoroutineParser; + +impl NoArgsAttributeParser for CoroutineParser { + const PATH: &[Symbol] = &[sym::coroutine]; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::Error; + const CREATE: fn(rustc_span::Span) -> AttributeKind = |span| AttributeKind::Coroutine(span); +} diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index c574ef78bdf7..f7946ade6d2b 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -26,6 +26,7 @@ use crate::parser::ArgParser; use crate::session_diagnostics::UnusedMultiple; pub(crate) mod allow_unstable; +pub(crate) mod body; pub(crate) mod cfg; pub(crate) mod cfg_old; pub(crate) mod codegen_attrs; diff --git a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs index a90ed830cd1d..77b494328c70 100644 --- a/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/test_attrs.rs @@ -44,3 +44,55 @@ impl SingleAttributeParser for IgnoreParser { }) } } + +pub(crate) struct ShouldPanicParser; + +impl SingleAttributeParser for ShouldPanicParser { + const PATH: &[Symbol] = &[sym::should_panic]; + const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepOutermost; + const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; + const TEMPLATE: AttributeTemplate = + template!(Word, List: r#"expected = "reason""#, NameValueStr: "reason"); + + fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option { + Some(AttributeKind::ShouldPanic { + span: cx.attr_span, + reason: match args { + ArgParser::NoArgs => None, + ArgParser::NameValue(name_value) => { + let Some(str_value) = name_value.value_as_str() else { + cx.expected_string_literal( + name_value.value_span, + Some(name_value.value_as_lit()), + ); + return None; + }; + Some(str_value) + } + ArgParser::List(list) => { + let Some(single) = list.single() else { + cx.expected_single_argument(list.span); + return None; + }; + let Some(single) = single.meta_item() else { + cx.expected_name_value(single.span(), Some(sym::expected)); + return None; + }; + if !single.path().word_is(sym::expected) { + cx.expected_specific_argument_strings(list.span, vec!["expected"]); + return None; + } + let Some(nv) = single.args().name_value() else { + cx.expected_name_value(single.span(), Some(sym::expected)); + return None; + }; + let Some(expected) = nv.value_as_str() else { + cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit())); + return None; + }; + Some(expected) + } + }, + }) + } +} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index c6599f20c2d1..80dfdffdb554 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -16,6 +16,7 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym}; use crate::attributes::allow_unstable::{ AllowConstFnUnstableParser, AllowInternalUnstableParser, UnstableFeatureBoundParser, }; +use crate::attributes::body::CoroutineParser; use crate::attributes::codegen_attrs::{ ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser, OptimizeParser, TargetFeatureParser, TrackCallerParser, UsedParser, @@ -49,7 +50,7 @@ use crate::attributes::semantics::MayDangleParser; use crate::attributes::stability::{ BodyStabilityParser, ConstStabilityIndirectParser, ConstStabilityParser, StabilityParser, }; -use crate::attributes::test_attrs::IgnoreParser; +use crate::attributes::test_attrs::{IgnoreParser, ShouldPanicParser}; use crate::attributes::traits::{ AllowIncoherentImplParser, CoherenceIsCoreParser, CoinductiveParser, ConstTraitParser, DenyExplicitImplParser, DoNotImplementViaObjectParser, FundamentalParser, MarkerParser, @@ -173,6 +174,7 @@ attribute_parsers!( Single, Single, Single, + Single, Single, Single, Single>, @@ -184,6 +186,7 @@ attribute_parsers!( Single>, Single>, Single>, + Single>, Single>, Single>, Single>, diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 321b18c9b78b..752ff8e6f586 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -19,6 +19,7 @@ use std::borrow::Cow; use std::cell::{OnceCell, RefCell}; use std::marker::PhantomData; use std::ops::{ControlFlow, Deref}; +use std::rc::Rc; use borrow_set::LocalsStateAtExit; use root_cx::BorrowCheckRootCtxt; @@ -44,6 +45,7 @@ use rustc_mir_dataflow::impls::{EverInitializedPlaces, MaybeUninitializedPlaces} use rustc_mir_dataflow::move_paths::{ InitIndex, InitLocation, LookupResult, MoveData, MovePathIndex, }; +use rustc_mir_dataflow::points::DenseLocationMap; use rustc_mir_dataflow::{Analysis, Results, ResultsVisitor, visit_results}; use rustc_session::lint::builtin::{TAIL_EXPR_DROP_ORDER, UNUSED_MUT}; use rustc_span::{ErrorGuaranteed, Span, Symbol}; @@ -60,11 +62,14 @@ use crate::path_utils::*; use crate::place_ext::PlaceExt; use crate::places_conflict::{PlaceConflictBias, places_conflict}; use crate::polonius::PoloniusDiagnosticsContext; -use crate::polonius::legacy::{PoloniusLocationTable, PoloniusOutput}; +use crate::polonius::legacy::{ + PoloniusFacts, PoloniusFactsExt, PoloniusLocationTable, PoloniusOutput, +}; use crate::prefixes::PrefixSet; use crate::region_infer::RegionInferenceContext; use crate::renumber::RegionCtxt; use crate::session_diagnostics::VarNeedNotMut; +use crate::type_check::MirTypeckResults; mod borrow_set; mod borrowck_errors; @@ -321,7 +326,34 @@ fn do_mir_borrowck<'tcx>( let locals_are_invalidated_at_exit = tcx.hir_body_owner_kind(def).is_fn_or_closure(); let borrow_set = BorrowSet::build(tcx, body, locals_are_invalidated_at_exit, &move_data); - // Compute non-lexical lifetimes. + let location_map = Rc::new(DenseLocationMap::new(body)); + + let polonius_input = root_cx.consumer.as_ref().map_or(false, |c| c.polonius_input()) + || infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled(); + let mut polonius_facts = + (polonius_input || PoloniusFacts::enabled(infcx.tcx)).then_some(PoloniusFacts::default()); + + // Run the MIR type-checker. + let MirTypeckResults { + constraints, + universal_region_relations, + opaque_type_values, + polonius_context, + } = type_check::type_check( + root_cx, + &infcx, + body, + &promoted, + universal_regions, + &location_table, + &borrow_set, + &mut polonius_facts, + &move_data, + Rc::clone(&location_map), + ); + + // Compute non-lexical lifetimes using the constraints computed + // by typechecking the MIR body. let nll::NllOutput { regioncx, polonius_input, @@ -332,14 +364,19 @@ fn do_mir_borrowck<'tcx>( } = nll::compute_regions( root_cx, &infcx, - universal_regions, body, - &promoted, &location_table, &move_data, &borrow_set, + location_map, + universal_region_relations, + constraints, + polonius_facts, + polonius_context, ); + regioncx.infer_opaque_types(root_cx, &infcx, opaque_type_values); + // Dump MIR results into a file, if that is enabled. This lets us // write unit-tests, as well as helping with debugging. nll::dump_nll_mir(&infcx, body, ®ioncx, &opt_closure_req, &borrow_set); diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index 41f67e78930f..ca6092e70d25 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -5,7 +5,8 @@ use std::path::PathBuf; use std::rc::Rc; use std::str::FromStr; -use polonius_engine::{Algorithm, Output}; +use polonius_engine::{Algorithm, AllFacts, Output}; +use rustc_data_structures::frozen::Frozen; use rustc_index::IndexSlice; use rustc_middle::mir::pretty::{PrettyPrintMirOptions, dump_mir_with_options}; use rustc_middle::mir::{Body, PassWhere, Promoted, create_dump_file, dump_enabled, dump_mir}; @@ -18,14 +19,16 @@ use rustc_span::sym; use tracing::{debug, instrument}; use crate::borrow_set::BorrowSet; +use crate::consumers::RustcFacts; use crate::diagnostics::RegionErrors; use crate::handle_placeholders::compute_sccs_applying_placeholder_outlives_constraints; -use crate::polonius::PoloniusDiagnosticsContext; use crate::polonius::legacy::{ PoloniusFacts, PoloniusFactsExt, PoloniusLocationTable, PoloniusOutput, }; +use crate::polonius::{PoloniusContext, PoloniusDiagnosticsContext}; use crate::region_infer::RegionInferenceContext; -use crate::type_check::{self, MirTypeckResults}; +use crate::type_check::MirTypeckRegionConstraints; +use crate::type_check::free_region_relations::UniversalRegionRelations; use crate::universal_regions::UniversalRegions; use crate::{ BorrowCheckRootCtxt, BorrowckInferCtxt, ClosureOutlivesSubject, ClosureRegionRequirements, @@ -76,41 +79,18 @@ pub(crate) fn replace_regions_in_mir<'tcx>( pub(crate) fn compute_regions<'tcx>( root_cx: &mut BorrowCheckRootCtxt<'tcx>, infcx: &BorrowckInferCtxt<'tcx>, - universal_regions: UniversalRegions<'tcx>, body: &Body<'tcx>, - promoted: &IndexSlice>, location_table: &PoloniusLocationTable, move_data: &MoveData<'tcx>, borrow_set: &BorrowSet<'tcx>, + location_map: Rc, + universal_region_relations: Frozen>, + constraints: MirTypeckRegionConstraints<'tcx>, + mut polonius_facts: Option>, + polonius_context: Option, ) -> NllOutput<'tcx> { - let is_polonius_legacy_enabled = infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled(); - let polonius_input = root_cx.consumer.as_ref().map_or(false, |c| c.polonius_input()) - || is_polonius_legacy_enabled; let polonius_output = root_cx.consumer.as_ref().map_or(false, |c| c.polonius_output()) - || is_polonius_legacy_enabled; - let mut polonius_facts = - (polonius_input || PoloniusFacts::enabled(infcx.tcx)).then_some(PoloniusFacts::default()); - - let location_map = Rc::new(DenseLocationMap::new(body)); - - // Run the MIR type-checker. - let MirTypeckResults { - constraints, - universal_region_relations, - opaque_type_values, - polonius_context, - } = type_check::type_check( - root_cx, - infcx, - body, - promoted, - universal_regions, - location_table, - borrow_set, - &mut polonius_facts, - move_data, - Rc::clone(&location_map), - ); + || infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled(); let lowered_constraints = compute_sccs_applying_placeholder_outlives_constraints( constraints, @@ -173,8 +153,6 @@ pub(crate) fn compute_regions<'tcx>( infcx.set_tainted_by_errors(guar); } - regioncx.infer_opaque_types(root_cx, infcx, opaque_type_values); - NllOutput { regioncx, polonius_input: polonius_facts.map(Box::new), diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index f5fedbf95c1c..148d0de3bab2 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -769,9 +769,13 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { } TerminatorKind::Call { func, args, .. } | TerminatorKind::TailCall { func, args, .. } => { - let call_source = match term.kind { - TerminatorKind::Call { call_source, .. } => call_source, - TerminatorKind::TailCall { .. } => CallSource::Normal, + let (call_source, destination, is_diverging) = match term.kind { + TerminatorKind::Call { call_source, destination, target, .. } => { + (call_source, destination, target.is_none()) + } + TerminatorKind::TailCall { .. } => { + (CallSource::Normal, RETURN_PLACE.into(), false) + } _ => unreachable!(), }; @@ -845,9 +849,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { ); } - if let TerminatorKind::Call { destination, target, .. } = term.kind { - self.check_call_dest(term, &sig, destination, target, term_location); - } + self.check_call_dest(term, &sig, destination, is_diverging, term_location); // The ordinary liveness rules will ensure that all // regions in the type of the callee are live here. We @@ -1874,65 +1876,61 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { term: &Terminator<'tcx>, sig: &ty::FnSig<'tcx>, destination: Place<'tcx>, - target: Option, + is_diverging: bool, term_location: Location, ) { let tcx = self.tcx(); - match target { - Some(_) => { - let dest_ty = destination.ty(self.body, tcx).ty; - let dest_ty = self.normalize(dest_ty, term_location); - let category = match destination.as_local() { - Some(RETURN_PLACE) => { - if let DefiningTy::Const(def_id, _) | DefiningTy::InlineConst(def_id, _) = - self.universal_regions.defining_ty - { - if tcx.is_static(def_id) { - ConstraintCategory::UseAsStatic - } else { - ConstraintCategory::UseAsConst - } - } else { - ConstraintCategory::Return(ReturnConstraint::Normal) - } - } - Some(l) if !self.body.local_decls[l].is_user_variable() => { - ConstraintCategory::Boring - } - // The return type of a call is interesting for diagnostics. - _ => ConstraintCategory::Assignment, - }; - - let locations = term_location.to_locations(); - - if let Err(terr) = self.sub_types(sig.output(), dest_ty, locations, category) { - span_mirbug!( - self, - term, - "call dest mismatch ({:?} <- {:?}): {:?}", - dest_ty, - sig.output(), - terr - ); - } - - // When `unsized_fn_params` is not enabled, - // this check is done at `check_local`. - if self.unsized_feature_enabled() { - let span = term.source_info.span; - self.ensure_place_sized(dest_ty, span); - } + if is_diverging { + // The signature in this call can reference region variables, + // so erase them before calling a query. + let output_ty = self.tcx().erase_regions(sig.output()); + if !output_ty + .is_privately_uninhabited(self.tcx(), self.infcx.typing_env(self.infcx.param_env)) + { + span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig); } - None => { - // The signature in this call can reference region variables, - // so erase them before calling a query. - let output_ty = self.tcx().erase_regions(sig.output()); - if !output_ty.is_privately_uninhabited( - self.tcx(), - self.infcx.typing_env(self.infcx.param_env), - ) { - span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig); + } else { + let dest_ty = destination.ty(self.body, tcx).ty; + let dest_ty = self.normalize(dest_ty, term_location); + let category = match destination.as_local() { + Some(RETURN_PLACE) => { + if let DefiningTy::Const(def_id, _) | DefiningTy::InlineConst(def_id, _) = + self.universal_regions.defining_ty + { + if tcx.is_static(def_id) { + ConstraintCategory::UseAsStatic + } else { + ConstraintCategory::UseAsConst + } + } else { + ConstraintCategory::Return(ReturnConstraint::Normal) + } } + Some(l) if !self.body.local_decls[l].is_user_variable() => { + ConstraintCategory::Boring + } + // The return type of a call is interesting for diagnostics. + _ => ConstraintCategory::Assignment, + }; + + let locations = term_location.to_locations(); + + if let Err(terr) = self.sub_types(sig.output(), dest_ty, locations, category) { + span_mirbug!( + self, + term, + "call dest mismatch ({:?} <- {:?}): {:?}", + dest_ty, + sig.output(), + terr + ); + } + + // When `unsized_fn_params` is not enabled, + // this check is done at `check_local`. + if self.unsized_feature_enabled() { + let span = term.source_info.span; + self.ensure_place_sized(dest_ty, span); } } } diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index ba3d8368b2a0..7b57c02b1972 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -5,10 +5,13 @@ use std::assert_matches::assert_matches; use std::iter; use rustc_ast::ptr::P; -use rustc_ast::{self as ast, GenericParamKind, attr, join_path_idents}; +use rustc_ast::{self as ast, GenericParamKind, HasNodeId, attr, join_path_idents}; use rustc_ast_pretty::pprust; +use rustc_attr_parsing::AttributeParser; use rustc_errors::{Applicability, Diag, Level}; use rustc_expand::base::*; +use rustc_hir::Attribute; +use rustc_hir::attrs::AttributeKind; use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Ident, Span, Symbol, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::debug; @@ -473,39 +476,19 @@ fn should_ignore_message(i: &ast::Item) -> Option { } fn should_panic(cx: &ExtCtxt<'_>, i: &ast::Item) -> ShouldPanic { - match attr::find_by_name(&i.attrs, sym::should_panic) { - Some(attr) => { - match attr.meta_item_list() { - // Handle #[should_panic(expected = "foo")] - Some(list) => { - let msg = list - .iter() - .find(|mi| mi.has_name(sym::expected)) - .and_then(|mi| mi.meta_item()) - .and_then(|mi| mi.value_str()); - if list.len() != 1 || msg.is_none() { - cx.dcx() - .struct_span_warn( - attr.span, - "argument must be of the form: \ - `expected = \"error message\"`", - ) - .with_note( - "errors in this attribute were erroneously \ - allowed and will become a hard error in a \ - future release", - ) - .emit(); - ShouldPanic::Yes(None) - } else { - ShouldPanic::Yes(msg) - } - } - // Handle #[should_panic] and #[should_panic = "expected"] - None => ShouldPanic::Yes(attr.value_str()), - } - } - None => ShouldPanic::No, + if let Some(Attribute::Parsed(AttributeKind::ShouldPanic { reason, .. })) = + AttributeParser::parse_limited( + cx.sess, + &i.attrs, + sym::should_panic, + i.span, + i.node_id(), + None, + ) + { + ShouldPanic::Yes(reason) + } else { + ShouldPanic::No } } diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index a04cfa272376..bec546badc9c 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -310,7 +310,10 @@ fn data_id_for_static( // `extern_with_linkage_foo` will instead be initialized to // zero. - let ref_name = format!("_rust_extern_with_linkage_{}", symbol_name); + let ref_name = format!( + "_rust_extern_with_linkage_{:016x}_{symbol_name}", + tcx.stable_crate_id(LOCAL_CRATE) + ); let ref_data_id = module.declare_data(&ref_name, Linkage::Local, false, false).unwrap(); let mut data = DataDescription::new(); data.set_align(align); diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs index 4ff5773a06cb..ed40901ac9b8 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs @@ -969,7 +969,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let layout = amount.layout(); match layout.ty.kind() { - ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} + ty::Uint(_) | ty::Int(_) => {} _ => { report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); return Ok(()); @@ -982,7 +982,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Add, ptr, amount); - let old = CValue::by_val(old, layout); + let old = CValue::by_val(old, ret.layout()); ret.write_cvalue(fx, old); } sym::atomic_xsub => { @@ -991,7 +991,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let layout = amount.layout(); match layout.ty.kind() { - ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} + ty::Uint(_) | ty::Int(_) => {} _ => { report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); return Ok(()); @@ -1004,7 +1004,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Sub, ptr, amount); - let old = CValue::by_val(old, layout); + let old = CValue::by_val(old, ret.layout()); ret.write_cvalue(fx, old); } sym::atomic_and => { @@ -1013,7 +1013,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let layout = src.layout(); match layout.ty.kind() { - ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} + ty::Uint(_) | ty::Int(_) => {} _ => { report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); return Ok(()); @@ -1025,7 +1025,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::And, ptr, src); - let old = CValue::by_val(old, layout); + let old = CValue::by_val(old, ret.layout()); ret.write_cvalue(fx, old); } sym::atomic_or => { @@ -1034,7 +1034,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let layout = src.layout(); match layout.ty.kind() { - ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} + ty::Uint(_) | ty::Int(_) => {} _ => { report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); return Ok(()); @@ -1046,7 +1046,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Or, ptr, src); - let old = CValue::by_val(old, layout); + let old = CValue::by_val(old, ret.layout()); ret.write_cvalue(fx, old); } sym::atomic_xor => { @@ -1055,7 +1055,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let layout = src.layout(); match layout.ty.kind() { - ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} + ty::Uint(_) | ty::Int(_) => {} _ => { report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); return Ok(()); @@ -1067,7 +1067,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Xor, ptr, src); - let old = CValue::by_val(old, layout); + let old = CValue::by_val(old, ret.layout()); ret.write_cvalue(fx, old); } sym::atomic_nand => { @@ -1076,7 +1076,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let layout = src.layout(); match layout.ty.kind() { - ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {} + ty::Uint(_) | ty::Int(_) => {} _ => { report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty); return Ok(()); @@ -1088,7 +1088,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Nand, ptr, src); - let old = CValue::by_val(old, layout); + let old = CValue::by_val(old, ret.layout()); ret.write_cvalue(fx, old); } sym::atomic_max => { diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 34ade3d025f8..f7a7a3f8c7e3 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -1671,6 +1671,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { dst: RValue<'gcc>, src: RValue<'gcc>, order: AtomicOrdering, + ret_ptr: bool, ) -> RValue<'gcc> { let size = get_maybe_pointer_size(src); let name = match op { @@ -1698,6 +1699,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { let atomic_function = self.context.get_builtin_function(name); let order = self.context.new_rvalue_from_int(self.i32_type, order.to_gcc()); + // FIXME: If `ret_ptr` is true and `src` is an integer, we should really tell GCC + // that this is a pointer operation that needs to preserve provenance -- but like LLVM, + // GCC does not currently seems to support that. let void_ptr_type = self.context.new_type::<*mut ()>(); let volatile_void_ptr_type = void_ptr_type.make_volatile(); let dst = self.context.new_cast(self.location, dst, volatile_void_ptr_type); @@ -1705,7 +1709,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { let new_src_type = atomic_function.get_param(1).to_rvalue().get_type(); let src = self.context.new_bitcast(self.location, src, new_src_type); let res = self.context.new_call(self.location, atomic_function, &[dst, src, order]); - self.context.new_cast(self.location, res, src.get_type()) + let res_type = if ret_ptr { void_ptr_type } else { src.get_type() }; + self.context.new_cast(self.location, res, res_type) } fn atomic_fence(&mut self, order: AtomicOrdering, scope: SynchronizationScope) { diff --git a/compiler/rustc_codegen_gcc/src/consts.rs b/compiler/rustc_codegen_gcc/src/consts.rs index c04c75e1b11f..873f1f1951c1 100644 --- a/compiler/rustc_codegen_gcc/src/consts.rs +++ b/compiler/rustc_codegen_gcc/src/consts.rs @@ -6,6 +6,7 @@ use rustc_codegen_ssa::traits::{ BaseTypeCodegenMethods, ConstCodegenMethods, StaticCodegenMethods, }; use rustc_hir::def::DefKind; +use rustc_hir::def_id::LOCAL_CRATE; use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc_middle::mir::interpret::{ self, ConstAllocation, ErrorHandled, Scalar as InterpScalar, read_target_uint, @@ -384,8 +385,8 @@ fn check_and_apply_linkage<'gcc, 'tcx>( // linkage and there are no definitions), then // `extern_with_linkage_foo` will instead be initialized to // zero. - let mut real_name = "_rust_extern_with_linkage_".to_string(); - real_name.push_str(sym); + let real_name = + format!("_rust_extern_with_linkage_{:016x}_{sym}", cx.tcx.stable_crate_id(LOCAL_CRATE)); let global2 = cx.define_global(&real_name, gcc_type, is_tls, attrs.link_section); // TODO(antoyo): set linkage. let value = cx.const_ptrcast(global1.get_address(None), gcc_type); diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index da2a153d819f..32cdef075e76 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -1327,15 +1327,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { &mut self, op: rustc_codegen_ssa::common::AtomicRmwBinOp, dst: &'ll Value, - mut src: &'ll Value, + src: &'ll Value, order: rustc_middle::ty::AtomicOrdering, + ret_ptr: bool, ) -> &'ll Value { - // The only RMW operation that LLVM supports on pointers is compare-exchange. - let requires_cast_to_int = self.val_ty(src) == self.type_ptr() - && op != rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg; - if requires_cast_to_int { - src = self.ptrtoint(src, self.type_isize()); - } + // FIXME: If `ret_ptr` is true and `src` is not a pointer, we *should* tell LLVM that the + // LHS is a pointer and the operation should be provenance-preserving, but LLVM does not + // currently support that (https://github.com/llvm/llvm-project/issues/120837). let mut res = unsafe { llvm::LLVMBuildAtomicRMW( self.llbuilder, @@ -1346,7 +1344,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { llvm::False, // SingleThreaded ) }; - if requires_cast_to_int { + if ret_ptr && self.val_ty(res) != self.type_ptr() { res = self.inttoptr(res, self.type_ptr()); } res @@ -1886,48 +1884,4 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> { ) { self.call_intrinsic("llvm.instrprof.increment", &[], &[fn_name, hash, num_counters, index]); } - - /// Emits a call to `llvm.instrprof.mcdc.parameters`. - /// - /// This doesn't produce any code directly, but is used as input by - /// the LLVM pass that handles coverage instrumentation. - /// - /// (See clang's [`CodeGenPGO::emitMCDCParameters`] for comparison.) - /// - /// [`CodeGenPGO::emitMCDCParameters`]: - /// https://github.com/rust-lang/llvm-project/blob/5399a24/clang/lib/CodeGen/CodeGenPGO.cpp#L1124 - #[instrument(level = "debug", skip(self))] - pub(crate) fn mcdc_parameters( - &mut self, - fn_name: &'ll Value, - hash: &'ll Value, - bitmap_bits: &'ll Value, - ) { - self.call_intrinsic("llvm.instrprof.mcdc.parameters", &[], &[fn_name, hash, bitmap_bits]); - } - - #[instrument(level = "debug", skip(self))] - pub(crate) fn mcdc_tvbitmap_update( - &mut self, - fn_name: &'ll Value, - hash: &'ll Value, - bitmap_index: &'ll Value, - mcdc_temp: &'ll Value, - ) { - let args = &[fn_name, hash, bitmap_index, mcdc_temp]; - self.call_intrinsic("llvm.instrprof.mcdc.tvbitmap.update", &[], args); - } - - #[instrument(level = "debug", skip(self))] - pub(crate) fn mcdc_condbitmap_reset(&mut self, mcdc_temp: &'ll Value) { - self.store(self.const_i32(0), mcdc_temp, self.tcx.data_layout.i32_align.abi); - } - - #[instrument(level = "debug", skip(self))] - pub(crate) fn mcdc_condbitmap_update(&mut self, cond_index: &'ll Value, mcdc_temp: &'ll Value) { - let align = self.tcx.data_layout.i32_align.abi; - let current_tv_index = self.load(self.cx.type_i32(), mcdc_temp, align); - let new_tv_index = self.add(current_tv_index, cond_index); - self.store(new_tv_index, mcdc_temp, align); - } } diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index 0b96b63bc857..6b06daf3477f 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -5,7 +5,7 @@ use rustc_codegen_ssa::common; use rustc_codegen_ssa::traits::*; use rustc_hir::LangItem; use rustc_hir::def::DefKind; -use rustc_hir::def_id::DefId; +use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc_middle::mir::interpret::{ Allocation, ConstAllocation, ErrorHandled, InitChunk, Pointer, Scalar as InterpScalar, @@ -191,8 +191,8 @@ fn check_and_apply_linkage<'ll, 'tcx>( // linkage and there are no definitions), then // `extern_with_linkage_foo` will instead be initialized to // zero. - let mut real_name = "_rust_extern_with_linkage_".to_string(); - real_name.push_str(sym); + let real_name = + format!("_rust_extern_with_linkage_{:016x}_{sym}", cx.tcx.stable_crate_id(LOCAL_CRATE)); let g2 = cx.define_global(&real_name, llty).unwrap_or_else(|| { cx.sess().dcx().emit_fatal(SymbolAlreadyDefined { span: cx.tcx.def_span(def_id), diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs index f6000e728400..a4b60d420f3f 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs @@ -73,48 +73,6 @@ pub(crate) struct CounterExpression { pub(crate) rhs: Counter, } -pub(crate) mod mcdc { - use rustc_middle::mir::coverage::{ConditionId, ConditionInfo, DecisionInfo}; - - /// Must match the layout of `LLVMRustMCDCDecisionParameters`. - #[repr(C)] - #[derive(Clone, Copy, Debug, Default)] - pub(crate) struct DecisionParameters { - bitmap_idx: u32, - num_conditions: u16, - } - - type LLVMConditionId = i16; - - /// Must match the layout of `LLVMRustMCDCBranchParameters`. - #[repr(C)] - #[derive(Clone, Copy, Debug, Default)] - pub(crate) struct BranchParameters { - condition_id: LLVMConditionId, - condition_ids: [LLVMConditionId; 2], - } - - impl From for BranchParameters { - fn from(value: ConditionInfo) -> Self { - let to_llvm_cond_id = |cond_id: Option| { - cond_id.and_then(|id| LLVMConditionId::try_from(id.as_usize()).ok()).unwrap_or(-1) - }; - let ConditionInfo { condition_id, true_next_id, false_next_id } = value; - Self { - condition_id: to_llvm_cond_id(Some(condition_id)), - condition_ids: [to_llvm_cond_id(false_next_id), to_llvm_cond_id(true_next_id)], - } - } - } - - impl From for DecisionParameters { - fn from(info: DecisionInfo) -> Self { - let DecisionInfo { bitmap_idx, num_conditions } = info; - Self { bitmap_idx, num_conditions } - } - } -} - /// A span of source code coordinates to be embedded in coverage metadata. /// /// Must match the layout of `LLVMRustCoverageSpan`. @@ -148,26 +106,14 @@ pub(crate) struct Regions { pub(crate) code_regions: Vec, pub(crate) expansion_regions: Vec, pub(crate) branch_regions: Vec, - pub(crate) mcdc_branch_regions: Vec, - pub(crate) mcdc_decision_regions: Vec, } impl Regions { /// Returns true if none of this structure's tables contain any regions. pub(crate) fn has_no_regions(&self) -> bool { - let Self { - code_regions, - expansion_regions, - branch_regions, - mcdc_branch_regions, - mcdc_decision_regions, - } = self; + let Self { code_regions, expansion_regions, branch_regions } = self; - code_regions.is_empty() - && expansion_regions.is_empty() - && branch_regions.is_empty() - && mcdc_branch_regions.is_empty() - && mcdc_decision_regions.is_empty() + code_regions.is_empty() && expansion_regions.is_empty() && branch_regions.is_empty() } } @@ -195,21 +141,3 @@ pub(crate) struct BranchRegion { pub(crate) true_counter: Counter, pub(crate) false_counter: Counter, } - -/// Must match the layout of `LLVMRustCoverageMCDCBranchRegion`. -#[derive(Clone, Debug)] -#[repr(C)] -pub(crate) struct MCDCBranchRegion { - pub(crate) cov_span: CoverageSpan, - pub(crate) true_counter: Counter, - pub(crate) false_counter: Counter, - pub(crate) mcdc_branch_params: mcdc::BranchParameters, -} - -/// Must match the layout of `LLVMRustCoverageMCDCDecisionRegion`. -#[derive(Clone, Debug)] -#[repr(C)] -pub(crate) struct MCDCDecisionRegion { - pub(crate) cov_span: CoverageSpan, - pub(crate) mcdc_decision_params: mcdc::DecisionParameters, -} diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/llvm_cov.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/llvm_cov.rs index 907d6d41a1fb..bc4f6bb6a82b 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/llvm_cov.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/llvm_cov.rs @@ -63,13 +63,7 @@ pub(crate) fn write_function_mappings_to_buffer( expressions: &[ffi::CounterExpression], regions: &ffi::Regions, ) -> Vec { - let ffi::Regions { - code_regions, - expansion_regions, - branch_regions, - mcdc_branch_regions, - mcdc_decision_regions, - } = regions; + let ffi::Regions { code_regions, expansion_regions, branch_regions } = regions; // SAFETY: // - All types are FFI-compatible and have matching representations in Rust/C++. @@ -87,10 +81,6 @@ pub(crate) fn write_function_mappings_to_buffer( expansion_regions.len(), branch_regions.as_ptr(), branch_regions.len(), - mcdc_branch_regions.as_ptr(), - mcdc_branch_regions.len(), - mcdc_decision_regions.as_ptr(), - mcdc_decision_regions.len(), buffer, ) }) diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs index fd1e7f7f160a..e0da8d368762 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen/covfun.rs @@ -140,8 +140,6 @@ fn fill_region_tables<'tcx>( code_regions, expansion_regions: _, // FIXME(Zalathar): Fill out support for expansion regions branch_regions, - mcdc_branch_regions, - mcdc_decision_regions, } = &mut covfun.regions; // For each counter/region pair in this function+file, convert it to a @@ -161,20 +159,6 @@ fn fill_region_tables<'tcx>( false_counter: counter_for_bcb(false_bcb), }); } - MappingKind::MCDCBranch { true_bcb, false_bcb, mcdc_params } => { - mcdc_branch_regions.push(ffi::MCDCBranchRegion { - cov_span, - true_counter: counter_for_bcb(true_bcb), - false_counter: counter_for_bcb(false_bcb), - mcdc_branch_params: ffi::mcdc::BranchParameters::from(mcdc_params), - }); - } - MappingKind::MCDCDecision(mcdc_decision_params) => { - mcdc_decision_regions.push(ffi::MCDCDecisionRegion { - cov_span, - mcdc_decision_params: ffi::mcdc::DecisionParameters::from(mcdc_decision_params), - }); - } } } } diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs index 119237abd6b8..6a58f495c9d8 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs @@ -1,11 +1,10 @@ use std::cell::{OnceCell, RefCell}; use std::ffi::{CStr, CString}; -use rustc_abi::Size; use rustc_codegen_ssa::traits::{ - BuilderMethods, ConstCodegenMethods, CoverageInfoBuilderMethods, MiscCodegenMethods, + ConstCodegenMethods, CoverageInfoBuilderMethods, MiscCodegenMethods, }; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::fx::FxIndexMap; use rustc_middle::mir::coverage::CoverageKind; use rustc_middle::ty::Instance; use tracing::{debug, instrument}; @@ -28,34 +27,13 @@ pub(crate) struct CguCoverageContext<'ll, 'tcx> { /// symbol name, and `llvm-cov` will exit fatally if it can't resolve that /// hash back to an entry in the binary's `__llvm_prf_names` linker section. pub(crate) pgo_func_name_var_map: RefCell, &'ll llvm::Value>>, - pub(crate) mcdc_condition_bitmap_map: RefCell, Vec<&'ll llvm::Value>>>, covfun_section_name: OnceCell, } impl<'ll, 'tcx> CguCoverageContext<'ll, 'tcx> { pub(crate) fn new() -> Self { - Self { - pgo_func_name_var_map: Default::default(), - mcdc_condition_bitmap_map: Default::default(), - covfun_section_name: Default::default(), - } - } - - /// LLVM use a temp value to record evaluated mcdc test vector of each decision, which is - /// called condition bitmap. In order to handle nested decisions, several condition bitmaps can - /// be allocated for a function body. These values are named `mcdc.addr.{i}` and are a 32-bit - /// integers. They respectively hold the condition bitmaps for decisions with a depth of `i`. - fn try_get_mcdc_condition_bitmap( - &self, - instance: &Instance<'tcx>, - decision_depth: u16, - ) -> Option<&'ll llvm::Value> { - self.mcdc_condition_bitmap_map - .borrow() - .get(instance) - .and_then(|bitmap_map| bitmap_map.get(decision_depth as usize)) - .copied() // Dereference Option<&&Value> to Option<&Value> + Self { pgo_func_name_var_map: Default::default(), covfun_section_name: Default::default() } } /// Returns the list of instances considered "used" in this CGU, as @@ -105,38 +83,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { } impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> { - fn init_coverage(&mut self, instance: Instance<'tcx>) { - let Some(function_coverage_info) = - self.tcx.instance_mir(instance.def).function_coverage_info.as_deref() - else { - return; - }; - - // If there are no MC/DC bitmaps to set up, return immediately. - if function_coverage_info.mcdc_bitmap_bits == 0 { - return; - } - - let fn_name = self.ensure_pgo_func_name_var(instance); - let hash = self.const_u64(function_coverage_info.function_source_hash); - let bitmap_bits = self.const_u32(function_coverage_info.mcdc_bitmap_bits as u32); - self.mcdc_parameters(fn_name, hash, bitmap_bits); - - // Create pointers named `mcdc.addr.{i}` to stack-allocated condition bitmaps. - let mut cond_bitmaps = vec![]; - for i in 0..function_coverage_info.mcdc_num_condition_bitmaps { - // MC/DC intrinsics will perform loads/stores that use the ABI default - // alignment for i32, so our variable declaration should match. - let align = self.tcx.data_layout.i32_align.abi; - let cond_bitmap = self.alloca(Size::from_bytes(4), align); - llvm::set_value_name(cond_bitmap, format!("mcdc.addr.{i}").as_bytes()); - self.store(self.const_i32(0), cond_bitmap, align); - cond_bitmaps.push(cond_bitmap); - } - - self.coverage_cx().mcdc_condition_bitmap_map.borrow_mut().insert(instance, cond_bitmaps); - } - #[instrument(level = "debug", skip(self))] fn add_coverage(&mut self, instance: Instance<'tcx>, kind: &CoverageKind) { // Our caller should have already taken care of inlining subtleties, @@ -153,7 +99,7 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> { // When that happens, we currently just discard those statements, so // the corresponding code will be undercounted. // FIXME(Zalathar): Find a better solution for mixed-coverage builds. - let Some(coverage_cx) = &bx.cx.coverage_cx else { return }; + let Some(_coverage_cx) = &bx.cx.coverage_cx else { return }; let Some(function_coverage_info) = bx.tcx.instance_mir(instance.def).function_coverage_info.as_deref() @@ -185,30 +131,6 @@ impl<'tcx> CoverageInfoBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> { } // If a BCB doesn't have an associated physical counter, there's nothing to codegen. CoverageKind::VirtualCounter { .. } => {} - CoverageKind::CondBitmapUpdate { index, decision_depth } => { - let cond_bitmap = coverage_cx - .try_get_mcdc_condition_bitmap(&instance, decision_depth) - .expect("mcdc cond bitmap should have been allocated for updating"); - let cond_index = bx.const_i32(index as i32); - bx.mcdc_condbitmap_update(cond_index, cond_bitmap); - } - CoverageKind::TestVectorBitmapUpdate { bitmap_idx, decision_depth } => { - let cond_bitmap = - coverage_cx.try_get_mcdc_condition_bitmap(&instance, decision_depth).expect( - "mcdc cond bitmap should have been allocated for merging \ - into the global bitmap", - ); - assert!( - bitmap_idx as usize <= function_coverage_info.mcdc_bitmap_bits, - "bitmap index of the decision out of range" - ); - - let fn_name = bx.ensure_pgo_func_name_var(instance); - let hash = bx.const_u64(function_coverage_info.function_source_hash); - let bitmap_index = bx.const_u32(bitmap_idx); - bx.mcdc_tvbitmap_update(fn_name, hash, bitmap_index, cond_bitmap); - bx.mcdc_condbitmap_reset(cond_bitmap); - } } } } diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 2443194ff483..75d3d27f74e1 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -2056,10 +2056,6 @@ unsafe extern "C" { NumExpansionRegions: size_t, BranchRegions: *const crate::coverageinfo::ffi::BranchRegion, NumBranchRegions: size_t, - MCDCBranchRegions: *const crate::coverageinfo::ffi::MCDCBranchRegion, - NumMCDCBranchRegions: size_t, - MCDCDecisionRegions: *const crate::coverageinfo::ffi::MCDCDecisionRegion, - NumMCDCDecisionRegions: size_t, BufferOut: &RustString, ); diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 53899da183a3..28d2100f478c 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -262,6 +262,15 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option None, // only existed in 18 ("arm", "fp16") => Some(LLVMFeature::new("fullfp16")), + // NVPTX targets added in LLVM 20 + ("nvptx64", "sm_100") if get_version().0 < 20 => None, + ("nvptx64", "sm_100a") if get_version().0 < 20 => None, + ("nvptx64", "sm_101") if get_version().0 < 20 => None, + ("nvptx64", "sm_101a") if get_version().0 < 20 => None, + ("nvptx64", "sm_120") if get_version().0 < 20 => None, + ("nvptx64", "sm_120a") if get_version().0 < 20 => None, + ("nvptx64", "ptx86") if get_version().0 < 20 => None, + ("nvptx64", "ptx87") if get_version().0 < 20 => None, // Filter out features that are not supported by the current LLVM version ("loongarch64", "div32" | "lam-bh" | "lamcas" | "ld-seq-sa" | "scq") if get_version().0 < 20 => @@ -324,15 +333,12 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option TargetConfig { - // Add base features for the target. - // We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below. - // The reason is that if LLVM considers a feature implied but we do not, we don't want that to - // show up in `cfg`. That way, `cfg` is entirely under our control -- except for the handling of - // the target CPU, that is still expanded to target features (with all their implied features) - // by LLVM. let target_machine = create_informational_target_machine(sess, true); let (unstable_target_features, target_features) = cfg_target_feature(sess, |feature| { + // This closure determines whether the target CPU has the feature according to LLVM. We do + // *not* consider the `-Ctarget-feature`s here, as that will be handled later in + // `cfg_target_feature`. if let Some(feat) = to_llvm_features(sess, feature) { // All the LLVM features this expands to must be enabled. for llvm_feature in feat { @@ -371,24 +377,25 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { let target_abi = sess.target.options.abi.as_ref(); let target_pointer_width = sess.target.pointer_width; let version = get_version(); + let lt_20_1_1 = version < (20, 1, 1); + let lt_21_0_0 = version < (21, 0, 0); cfg.has_reliable_f16 = match (target_arch, target_os) { - // Selection failure - ("s390x", _) => false, - // LLVM crash without neon (now fixed) + // LLVM crash without neon (fixed in llvm20) ("aarch64", _) - if !cfg.target_features.iter().any(|f| f.as_str() == "neon") - && version < (20, 1, 1) => + if !cfg.target_features.iter().any(|f| f.as_str() == "neon") && lt_20_1_1 => { false } // Unsupported ("arm64ec", _) => false, + // Selection failure (fixed in llvm21) + ("s390x", _) if lt_21_0_0 => false, // MinGW ABI bugs ("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false, // Infinite recursion ("csky", _) => false, - ("hexagon", _) => false, + ("hexagon", _) if lt_21_0_0 => false, // (fixed in llvm21) ("powerpc" | "powerpc64", _) => false, ("sparc" | "sparc64", _) => false, ("wasm32" | "wasm64", _) => false, @@ -401,9 +408,10 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { cfg.has_reliable_f128 = match (target_arch, target_os) { // Unsupported ("arm64ec", _) => false, - // Selection bug - ("mips64" | "mips64r6", _) => false, - // Selection bug + // Selection bug (fixed in llvm20) + ("mips64" | "mips64r6", _) if lt_20_1_1 => false, + // Selection bug . This issue is closed + // but basic math still does not work. ("nvptx64", _) => false, // Unsupported https://github.com/llvm/llvm-project/issues/121122 ("amdgpu", _) => false, @@ -413,8 +421,8 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { // ABI unsupported ("sparc", _) => false, // Stack alignment bug . NB: tests may - // not fail if our compiler-builtins is linked. - ("x86", _) => false, + // not fail if our compiler-builtins is linked. (fixed in llvm21) + ("x86", _) if lt_21_0_0 => false, // MinGW ABI bugs ("x86_64", "windows") if target_env == "gnu" && target_abi != "llvm" => false, // There are no known problems on other platforms, so the only requirement is that symbols diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index a70d0011d161..36ad5ede7c2c 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -101,6 +101,8 @@ codegen_ssa_invalid_monomorphization_basic_float_type = invalid monomorphization codegen_ssa_invalid_monomorphization_basic_integer_type = invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}` +codegen_ssa_invalid_monomorphization_basic_integer_or_ptr_type = invalid monomorphization of `{$name}` intrinsic: expected basic integer or pointer type, found `{$ty}` + codegen_ssa_invalid_monomorphization_cannot_return = invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]` codegen_ssa_invalid_monomorphization_cast_wide_pointer = invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}` diff --git a/compiler/rustc_codegen_ssa/src/assert_module_sources.rs b/compiler/rustc_codegen_ssa/src/assert_module_sources.rs index 3710625ac12d..43e1e135a666 100644 --- a/compiler/rustc_codegen_ssa/src/assert_module_sources.rs +++ b/compiler/rustc_codegen_ssa/src/assert_module_sources.rs @@ -69,6 +69,15 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>, set_reuse: &dyn Fn(&mut CguReuseTr set_reuse(&mut ams.cgu_reuse_tracker); + if tcx.sess.opts.unstable_opts.print_mono_items + && let Some(data) = &ams.cgu_reuse_tracker.data + { + data.actual_reuse.items().all(|(cgu, reuse)| { + println!("CGU_REUSE {cgu} {reuse}"); + true + }); + } + ams.cgu_reuse_tracker.check_expected_reuse(tcx.sess); }); } diff --git a/compiler/rustc_codegen_ssa/src/back/apple.rs b/compiler/rustc_codegen_ssa/src/back/apple.rs index d242efaf4fd4..2f68bad1695b 100644 --- a/compiler/rustc_codegen_ssa/src/back/apple.rs +++ b/compiler/rustc_codegen_ssa/src/back/apple.rs @@ -17,7 +17,7 @@ mod tests; /// The canonical name of the desired SDK for a given target. pub(super) fn sdk_name(target: &Target) -> &'static str { - match (&*target.os, &*target.abi) { + match (&*target.os, &*target.env) { ("macos", "") => "MacOSX", ("ios", "") => "iPhoneOS", ("ios", "sim") => "iPhoneSimulator", @@ -34,7 +34,7 @@ pub(super) fn sdk_name(target: &Target) -> &'static str { } pub(super) fn macho_platform(target: &Target) -> u32 { - match (&*target.os, &*target.abi) { + match (&*target.os, &*target.env) { ("macos", _) => object::macho::PLATFORM_MACOS, ("ios", "macabi") => object::macho::PLATFORM_MACCATALYST, ("ios", "sim") => object::macho::PLATFORM_IOSSIMULATOR, diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index b69fbf61185d..6e21f54587f6 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -3026,7 +3026,7 @@ pub(crate) fn are_upstream_rust_objects_already_included(sess: &Session) -> bool /// We need to communicate five things to the linker on Apple/Darwin targets: /// - The architecture. /// - The operating system (and that it's an Apple platform). -/// - The environment / ABI. +/// - The environment. /// - The deployment target. /// - The SDK version. fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) { @@ -3040,7 +3040,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo // `sess.target.arch` (`target_arch`) is not detailed enough. let llvm_arch = sess.target.llvm_target.split_once('-').expect("LLVM target must have arch").0; let target_os = &*sess.target.os; - let target_abi = &*sess.target.abi; + let target_env = &*sess.target.env; // The architecture name to forward to the linker. // @@ -3091,14 +3091,14 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo // > - visionos-simulator // > - xros-simulator // > - driverkit - let platform_name = match (target_os, target_abi) { + let platform_name = match (target_os, target_env) { (os, "") => os, ("ios", "macabi") => "mac-catalyst", ("ios", "sim") => "ios-simulator", ("tvos", "sim") => "tvos-simulator", ("watchos", "sim") => "watchos-simulator", ("visionos", "sim") => "visionos-simulator", - _ => bug!("invalid OS/ABI combination for Apple target: {target_os}, {target_abi}"), + _ => bug!("invalid OS/env combination for Apple target: {target_os}, {target_env}"), }; let min_version = sess.apple_deployment_target().fmt_full().to_string(); diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 050797354b4a..df1e91b12f90 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1805,11 +1805,18 @@ pub(crate) fn exported_symbols( .collect(); } - if let CrateType::ProcMacro = crate_type { + let mut symbols = if let CrateType::ProcMacro = crate_type { exported_symbols_for_proc_macro_crate(tcx) } else { exported_symbols_for_non_proc_macro(tcx, crate_type) + }; + + if crate_type == CrateType::Dylib || crate_type == CrateType::ProcMacro { + let metadata_symbol_name = exported_symbols::metadata_symbol_name(tcx); + symbols.push((metadata_symbol_name, SymbolExportKind::Data)); } + + symbols } fn exported_symbols_for_non_proc_macro( @@ -1842,12 +1849,8 @@ fn exported_symbols_for_proc_macro_crate(tcx: TyCtxt<'_>) -> Vec<(String, Symbol let stable_crate_id = tcx.stable_crate_id(LOCAL_CRATE); let proc_macro_decls_name = tcx.sess.generate_proc_macro_decls_symbol(stable_crate_id); - let metadata_symbol_name = exported_symbols::metadata_symbol_name(tcx); - vec![ - (proc_macro_decls_name, SymbolExportKind::Data), - (metadata_symbol_name, SymbolExportKind::Data), - ] + vec![(proc_macro_decls_name, SymbolExportKind::Data)] } pub(crate) fn linked_symbols( diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 4b4b39f53533..7e124f65324a 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -8,7 +8,7 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE, LocalDefId}; use rustc_middle::bug; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::middle::exported_symbols::{ - ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel, metadata_symbol_name, + ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel, }; use rustc_middle::query::LocalCrate; use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, Ty, TyCtxt}; @@ -289,23 +289,6 @@ fn exported_non_generic_symbols_provider_local<'tcx>( })); } - if tcx.crate_types().contains(&CrateType::Dylib) - || tcx.crate_types().contains(&CrateType::ProcMacro) - { - let symbol_name = metadata_symbol_name(tcx); - let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, &symbol_name)); - - symbols.push(( - exported_symbol, - SymbolExportInfo { - level: SymbolExportLevel::C, - kind: SymbolExportKind::Data, - used: true, - rustc_std_internal_symbol: false, - }, - )); - } - // Sort so we get a stable incr. comp. hash. symbols.sort_by_cached_key(|s| s.0.symbol_name_for_local_instance(tcx)); diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index 3d787d8bdbde..af4adcd19542 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -764,6 +764,14 @@ pub enum InvalidMonomorphization<'tcx> { ty: Ty<'tcx>, }, + #[diag(codegen_ssa_invalid_monomorphization_basic_integer_or_ptr_type, code = E0511)] + BasicIntegerOrPtrType { + #[primary_span] + span: Span, + name: Symbol, + ty: Ty<'tcx>, + }, + #[diag(codegen_ssa_invalid_monomorphization_basic_float_type, code = E0511)] BasicFloatType { #[primary_span] diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs index fc95f62b4a43..3c667b8e8820 100644 --- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs +++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs @@ -92,6 +92,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let invalid_monomorphization_int_type = |ty| { bx.tcx().dcx().emit_err(InvalidMonomorphization::BasicIntegerType { span, name, ty }); }; + let invalid_monomorphization_int_or_ptr_type = |ty| { + bx.tcx().dcx().emit_err(InvalidMonomorphization::BasicIntegerOrPtrType { + span, + name, + ty, + }); + }; let parse_atomic_ordering = |ord: ty::Value<'tcx>| { let discr = ord.valtree.unwrap_branch()[0].unwrap_leaf(); @@ -351,7 +358,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { sym::atomic_load => { let ty = fn_args.type_at(0); if !(int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr()) { - invalid_monomorphization_int_type(ty); + invalid_monomorphization_int_or_ptr_type(ty); return Ok(()); } let ordering = fn_args.const_at(1).to_value(); @@ -367,7 +374,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { sym::atomic_store => { let ty = fn_args.type_at(0); if !(int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr()) { - invalid_monomorphization_int_type(ty); + invalid_monomorphization_int_or_ptr_type(ty); return Ok(()); } let ordering = fn_args.const_at(1).to_value(); @@ -377,10 +384,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.atomic_store(val, ptr, parse_atomic_ordering(ordering), size); return Ok(()); } + // These are all AtomicRMW ops sym::atomic_cxchg | sym::atomic_cxchgweak => { let ty = fn_args.type_at(0); if !(int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr()) { - invalid_monomorphization_int_type(ty); + invalid_monomorphization_int_or_ptr_type(ty); return Ok(()); } let succ_ordering = fn_args.const_at(1).to_value(); @@ -407,7 +415,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { return Ok(()); } - // These are all AtomicRMW ops sym::atomic_max | sym::atomic_min => { let atom_op = if name == sym::atomic_max { AtomicRmwBinOp::AtomicMax @@ -420,7 +427,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let ordering = fn_args.const_at(1).to_value(); let ptr = args[0].immediate(); let val = args[1].immediate(); - bx.atomic_rmw(atom_op, ptr, val, parse_atomic_ordering(ordering)) + bx.atomic_rmw( + atom_op, + ptr, + val, + parse_atomic_ordering(ordering), + /* ret_ptr */ false, + ) } else { invalid_monomorphization_int_type(ty); return Ok(()); @@ -438,21 +451,44 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let ordering = fn_args.const_at(1).to_value(); let ptr = args[0].immediate(); let val = args[1].immediate(); - bx.atomic_rmw(atom_op, ptr, val, parse_atomic_ordering(ordering)) + bx.atomic_rmw( + atom_op, + ptr, + val, + parse_atomic_ordering(ordering), + /* ret_ptr */ false, + ) } else { invalid_monomorphization_int_type(ty); return Ok(()); } } - sym::atomic_xchg - | sym::atomic_xadd + sym::atomic_xchg => { + let ty = fn_args.type_at(0); + let ordering = fn_args.const_at(1).to_value(); + if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { + let ptr = args[0].immediate(); + let val = args[1].immediate(); + let atomic_op = AtomicRmwBinOp::AtomicXchg; + bx.atomic_rmw( + atomic_op, + ptr, + val, + parse_atomic_ordering(ordering), + /* ret_ptr */ ty.is_raw_ptr(), + ) + } else { + invalid_monomorphization_int_or_ptr_type(ty); + return Ok(()); + } + } + sym::atomic_xadd | sym::atomic_xsub | sym::atomic_and | sym::atomic_nand | sym::atomic_or | sym::atomic_xor => { let atom_op = match name { - sym::atomic_xchg => AtomicRmwBinOp::AtomicXchg, sym::atomic_xadd => AtomicRmwBinOp::AtomicAdd, sym::atomic_xsub => AtomicRmwBinOp::AtomicSub, sym::atomic_and => AtomicRmwBinOp::AtomicAnd, @@ -462,14 +498,28 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { _ => unreachable!(), }; - let ty = fn_args.type_at(0); - if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { - let ordering = fn_args.const_at(1).to_value(); - let ptr = args[0].immediate(); - let val = args[1].immediate(); - bx.atomic_rmw(atom_op, ptr, val, parse_atomic_ordering(ordering)) + // The type of the in-memory data. + let ty_mem = fn_args.type_at(0); + // The type of the 2nd operand, given by-value. + let ty_op = fn_args.type_at(1); + + let ordering = fn_args.const_at(2).to_value(); + // We require either both arguments to have the same integer type, or the first to + // be a pointer and the second to be `usize`. + if (int_type_width_signed(ty_mem, bx.tcx()).is_some() && ty_op == ty_mem) + || (ty_mem.is_raw_ptr() && ty_op == bx.tcx().types.usize) + { + let ptr = args[0].immediate(); // of type "pointer to `ty_mem`" + let val = args[1].immediate(); // of type `ty_op` + bx.atomic_rmw( + atom_op, + ptr, + val, + parse_atomic_ordering(ordering), + /* ret_ptr */ ty_mem.is_raw_ptr(), + ) } else { - invalid_monomorphization_int_type(ty); + invalid_monomorphization_int_or_ptr_type(ty_mem); return Ok(()); } } diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs index 50d0f9107445..06873313e2ec 100644 --- a/compiler/rustc_codegen_ssa/src/mir/mod.rs +++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs @@ -296,10 +296,6 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( // Apply debuginfo to the newly allocated locals. fx.debug_introduce_locals(&mut start_bx, consts_debug_info.unwrap_or_default()); - // If the backend supports coverage, and coverage is enabled for this function, - // do any necessary start-of-function codegen (e.g. locals for MC/DC bitmaps). - start_bx.init_coverage(instance); - // The builders will be created separately for each basic block at `codegen_block`. // So drop the builder of `start_llbb` to avoid having two at the same time. drop(start_bx); diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 5459f95c1860..d851c3329802 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -498,6 +498,35 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { bx.cx().const_uint(cast_to, niche_variants.start().as_u32() as u64); (is_niche, tagged_discr, 0) } else { + // Thanks to parameter attributes and load metadata, LLVM already knows + // the general valid range of the tag. It's possible, though, for there + // to be an impossible value *in the middle*, which those ranges don't + // communicate, so it's worth an `assume` to let the optimizer know. + // Most importantly, this means when optimizing a variant test like + // `SELECT(is_niche, complex, CONST) == CONST` it's ok to simplify that + // to `!is_niche` because the `complex` part can't possibly match. + // + // This was previously asserted on `tagged_discr` below, where the + // impossible value is more obvious, but that caused an intermediate + // value to become multi-use and thus not optimize, so instead this + // assumes on the original input which is always multi-use. See + // + // + // FIXME: If we ever get range assume operand bundles in LLVM (so we + // don't need the `icmp`s in the instruction stream any more), it + // might be worth moving this back to being on the switch argument + // where it's more obviously applicable. + if niche_variants.contains(&untagged_variant) + && bx.cx().sess().opts.optimize != OptLevel::No + { + let impossible = niche_start + .wrapping_add(u128::from(untagged_variant.as_u32())) + .wrapping_sub(u128::from(niche_variants.start().as_u32())); + let impossible = bx.cx().const_uint_big(tag_llty, impossible); + let ne = bx.icmp(IntPredicate::IntNE, tag, impossible); + bx.assume(ne); + } + // With multiple niched variants we'll have to actually compute // the variant index from the stored tag. // @@ -588,20 +617,6 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { let untagged_variant_const = bx.cx().const_uint(cast_to, u64::from(untagged_variant.as_u32())); - // Thanks to parameter attributes and load metadata, LLVM already knows - // the general valid range of the tag. It's possible, though, for there - // to be an impossible value *in the middle*, which those ranges don't - // communicate, so it's worth an `assume` to let the optimizer know. - // Most importantly, this means when optimizing a variant test like - // `SELECT(is_niche, complex, CONST) == CONST` it's ok to simplify that - // to `!is_niche` because the `complex` part can't possibly match. - if niche_variants.contains(&untagged_variant) - && bx.cx().sess().opts.optimize != OptLevel::No - { - let ne = bx.icmp(IntPredicate::IntNE, tagged_discr, untagged_variant_const); - bx.assume(ne); - } - let discr = bx.select(is_niche, tagged_discr, untagged_variant_const); // In principle we could insert assumes on the possible range of `discr`, but diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index d984156c674c..7e4341a82366 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -197,7 +197,10 @@ fn parse_rust_feature_flag<'a>( /// 2nd component of the return value, respectively). /// /// `target_base_has_feature` should check whether the given feature (a Rust feature name!) is -/// enabled in the "base" target machine, i.e., without applying `-Ctarget-feature`. +/// enabled in the "base" target machine, i.e., without applying `-Ctarget-feature`. Note that LLVM +/// may consider features to be implied that we do not and vice-versa. We want `cfg` to be entirely +/// consistent with Rust feature implications, and thus only consult LLVM to expand the target CPU +/// to target features. /// /// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled elsewhere. pub fn cfg_target_feature( @@ -211,7 +214,15 @@ pub fn cfg_target_feature( .rust_target_features() .iter() .filter(|(feature, _, _)| target_base_has_feature(feature)) - .map(|(feature, _, _)| Symbol::intern(feature)) + .flat_map(|(base_feature, _, _)| { + // Expand the direct base feature into all transitively-implied features. Note that we + // cannot simply use the `implied` field of the tuple since that only contains + // directly-implied features. + // + // Iteration order is irrelevant because we're collecting into an `UnordSet`. + #[allow(rustc::potential_query_instability)] + sess.target.implied_target_features(base_feature).into_iter().map(|f| Symbol::intern(f)) + }) .collect(); // Add enabled and remove disabled features. diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index 4b18146863bf..f417d1a7bf72 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -548,12 +548,15 @@ pub trait BuilderMethods<'a, 'tcx>: failure_order: AtomicOrdering, weak: bool, ) -> (Self::Value, Self::Value); + /// `ret_ptr` indicates whether the return type (which is also the type `dst` points to) + /// is a pointer or the same type as `src`. fn atomic_rmw( &mut self, op: AtomicRmwBinOp, dst: Self::Value, src: Self::Value, order: AtomicOrdering, + ret_ptr: bool, ) -> Self::Value; fn atomic_fence(&mut self, order: AtomicOrdering, scope: SynchronizationScope); fn set_invariant_load(&mut self, load: Self::Value); diff --git a/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs b/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs index 0b513dac5037..31482a53b6d4 100644 --- a/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs +++ b/compiler/rustc_codegen_ssa/src/traits/coverageinfo.rs @@ -2,11 +2,6 @@ use rustc_middle::mir::coverage::CoverageKind; use rustc_middle::ty::Instance; pub trait CoverageInfoBuilderMethods<'tcx> { - /// Performs any start-of-function codegen needed for coverage instrumentation. - /// - /// Can be a no-op in backends that don't support coverage instrumentation. - fn init_coverage(&mut self, _instance: Instance<'tcx>) {} - /// Handle the MIR coverage info in a backend-specific way. /// /// This can potentially be a no-op in backends that don't support diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs index 982e640fa92a..79e32dcf105c 100644 --- a/compiler/rustc_const_eval/src/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/check_consts/ops.rs @@ -142,7 +142,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { |err, self_ty, trait_id| { // FIXME(const_trait_impl): Do we need any of this on the non-const codepath? - let trait_ref = TraitRef::from_method(tcx, trait_id, self.args); + let trait_ref = TraitRef::from_assoc(tcx, trait_id, self.args); match self_ty.kind() { Param(param_ty) => { diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index b8a653698258..a0160d1188d0 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -732,7 +732,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { let tcx = *self.tcx; let trait_def_id = tcx.trait_of_assoc(def_id).unwrap(); - let virtual_trait_ref = ty::TraitRef::from_method(tcx, trait_def_id, virtual_instance.args); + let virtual_trait_ref = ty::TraitRef::from_assoc(tcx, trait_def_id, virtual_instance.args); let existential_trait_ref = ty::ExistentialTraitRef::erase_self_ty(tcx, virtual_trait_ref); let concrete_trait_ref = existential_trait_ref.with_self_ty(tcx, dyn_ty); diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 3840cdf75750..8ace560d85d1 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -1,6 +1,7 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] +#![cfg_attr(bootstrap, feature(strict_overflow_ops))] #![doc(rust_logo)] #![feature(array_try_map)] #![feature(assert_matches)] @@ -10,7 +11,6 @@ #![feature(never_type)] #![feature(rustdoc_internals)] #![feature(slice_ptr_get)] -#![feature(strict_overflow_ops)] #![feature(trait_alias)] #![feature(try_blocks)] #![feature(unqualified_local_imports)] diff --git a/compiler/rustc_const_eval/src/util/type_name.rs b/compiler/rustc_const_eval/src/util/type_name.rs index e6b9759819f1..2dc746754f87 100644 --- a/compiler/rustc_const_eval/src/util/type_name.rs +++ b/compiler/rustc_const_eval/src/util/type_name.rs @@ -18,7 +18,9 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> { } fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> { - unreachable!(); // because `::should_print_region` returns false + // This is reachable (via `pretty_print_dyn_existential`) even though + // `::should_print_region` returns false. See #144994. + Ok(()) } fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> { diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 96c7ba6ed27b..5a5563c7bb2c 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -1382,6 +1382,11 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { &mut self.long_ty_path } + pub fn with_long_ty_path(mut self, long_ty_path: Option) -> Self { + self.long_ty_path = long_ty_path; + self + } + /// Most `emit_producing_guarantee` functions use this as a starting point. fn emit_producing_nothing(mut self) { let diag = self.take_diag(); diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 84970e7c162b..0c839f94f7f1 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -409,7 +409,7 @@ pub trait Emitter { if !redundant_span || always_backtrace { let msg: Cow<'static, _> = match trace.kind { ExpnKind::Macro(MacroKind::Attr, _) => { - "this procedural macro expansion".into() + "this attribute macro expansion".into() } ExpnKind::Macro(MacroKind::Derive, _) => { "this derive macro expansion".into() diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl index 5a53670c865d..1f8f3be68092 100644 --- a/compiler/rustc_expand/messages.ftl +++ b/compiler/rustc_expand/messages.ftl @@ -70,6 +70,9 @@ expand_invalid_fragment_specifier = invalid fragment specifier `{$fragment}` .help = {$help} +expand_macro_args_bad_delim = macro attribute argument matchers require parentheses +expand_macro_args_bad_delim_sugg = the delimiters should be `(` and `)` + expand_macro_body_stability = macros cannot have body stability attributes .label = invalid body stability attribute diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs index fd1391a554a8..e58269991fcb 100644 --- a/compiler/rustc_expand/src/errors.rs +++ b/compiler/rustc_expand/src/errors.rs @@ -482,3 +482,21 @@ mod metavar_exprs { pub key: MacroRulesNormalizedIdent, } } + +#[derive(Diagnostic)] +#[diag(expand_macro_args_bad_delim)] +pub(crate) struct MacroArgsBadDelim { + #[primary_span] + pub span: Span, + #[subdiagnostic] + pub sugg: MacroArgsBadDelimSugg, +} + +#[derive(Subdiagnostic)] +#[multipart_suggestion(expand_macro_args_bad_delim_sugg, applicability = "machine-applicable")] +pub(crate) struct MacroArgsBadDelimSugg { + #[suggestion_part(code = "(")] + pub open: Span, + #[suggestion_part(code = ")")] + pub close: Span, +} diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs index 7a280d671f41..5b9d56ee2bc3 100644 --- a/compiler/rustc_expand/src/mbe/diagnostics.rs +++ b/compiler/rustc_expand/src/mbe/diagnostics.rs @@ -7,29 +7,40 @@ use rustc_macros::Subdiagnostic; use rustc_parse::parser::{Parser, Recovery, token_descr}; use rustc_session::parse::ParseSess; use rustc_span::source_map::SourceMap; -use rustc_span::{ErrorGuaranteed, Ident, Span}; +use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span}; use tracing::debug; use super::macro_rules::{MacroRule, NoopTracker, parser_from_cx}; use crate::expand::{AstFragmentKind, parse_ast_fragment}; use crate::mbe::macro_parser::ParseResult::*; use crate::mbe::macro_parser::{MatcherLoc, NamedParseResult, TtParser}; -use crate::mbe::macro_rules::{Tracker, try_match_macro}; +use crate::mbe::macro_rules::{Tracker, try_match_macro, try_match_macro_attr}; pub(super) fn failed_to_match_macro( psess: &ParseSess, sp: Span, def_span: Span, name: Ident, - arg: TokenStream, + attr_args: Option<&TokenStream>, + body: &TokenStream, rules: &[MacroRule], ) -> (Span, ErrorGuaranteed) { debug!("failed to match macro"); + let def_head_span = if !def_span.is_dummy() && !psess.source_map().is_imported(def_span) { + psess.source_map().guess_head_span(def_span) + } else { + DUMMY_SP + }; + // An error occurred, try the expansion again, tracking the expansion closely for better // diagnostics. let mut tracker = CollectTrackerAndEmitter::new(psess.dcx(), sp); - let try_success_result = try_match_macro(psess, name, &arg, rules, &mut tracker); + let try_success_result = if let Some(attr_args) = attr_args { + try_match_macro_attr(psess, name, attr_args, body, rules, &mut tracker) + } else { + try_match_macro(psess, name, body, rules, &mut tracker) + }; if try_success_result.is_ok() { // Nonterminal parser recovery might turn failed matches into successful ones, @@ -47,6 +58,18 @@ pub(super) fn failed_to_match_macro( let Some(BestFailure { token, msg: label, remaining_matcher, .. }) = tracker.best_failure else { + // FIXME: we should report this at macro resolution time, as we do for + // `resolve_macro_cannot_use_as_attr`. We can do that once we track multiple macro kinds for a + // Def. + if attr_args.is_none() && !rules.iter().any(|rule| matches!(rule, MacroRule::Func { .. })) { + let msg = format!("macro has no rules for function-like invocation `{name}!`"); + let mut err = psess.dcx().struct_span_err(sp, msg); + if !def_head_span.is_dummy() { + let msg = "this macro has no rules for function-like invocation"; + err.span_label(def_head_span, msg); + } + return (sp, err.emit()); + } return (sp, psess.dcx().span_delayed_bug(sp, "failed to match a macro")); }; @@ -54,8 +77,8 @@ pub(super) fn failed_to_match_macro( let mut err = psess.dcx().struct_span_err(span, parse_failure_msg(&token, None)); err.span_label(span, label); - if !def_span.is_dummy() && !psess.source_map().is_imported(def_span) { - err.span_label(psess.source_map().guess_head_span(def_span), "when calling this macro"); + if !def_head_span.is_dummy() { + err.span_label(def_head_span, "when calling this macro"); } annotate_doc_comment(&mut err, psess.source_map(), span); @@ -79,13 +102,16 @@ pub(super) fn failed_to_match_macro( } // Check whether there's a missing comma in this macro call, like `println!("{}" a);` - if let Some((arg, comma_span)) = arg.add_comma() { + if attr_args.is_none() + && let Some((body, comma_span)) = body.add_comma() + { for rule in rules { - let parser = parser_from_cx(psess, arg.clone(), Recovery::Allowed); + let MacroRule::Func { lhs, .. } = rule else { continue }; + let parser = parser_from_cx(psess, body.clone(), Recovery::Allowed); let mut tt_parser = TtParser::new(name); if let Success(_) = - tt_parser.parse_tt(&mut Cow::Borrowed(&parser), &rule.lhs, &mut NoopTracker) + tt_parser.parse_tt(&mut Cow::Borrowed(&parser), lhs, &mut NoopTracker) { if comma_span.is_dummy() { err.note("you might be missing a comma"); @@ -116,13 +142,13 @@ struct CollectTrackerAndEmitter<'dcx, 'matcher> { struct BestFailure { token: Token, - position_in_tokenstream: u32, + position_in_tokenstream: (bool, u32), msg: &'static str, remaining_matcher: MatcherLoc, } impl BestFailure { - fn is_better_position(&self, position: u32) -> bool { + fn is_better_position(&self, position: (bool, u32)) -> bool { position > self.position_in_tokenstream } } @@ -142,7 +168,7 @@ impl<'dcx, 'matcher> Tracker<'matcher> for CollectTrackerAndEmitter<'dcx, 'match } } - fn after_arm(&mut self, result: &NamedParseResult) { + fn after_arm(&mut self, in_body: bool, result: &NamedParseResult) { match result { Success(_) => { // Nonterminal parser recovery might turn failed matches into successful ones, @@ -155,14 +181,15 @@ impl<'dcx, 'matcher> Tracker<'matcher> for CollectTrackerAndEmitter<'dcx, 'match Failure((token, approx_position, msg)) => { debug!(?token, ?msg, "a new failure of an arm"); + let position_in_tokenstream = (in_body, *approx_position); if self .best_failure .as_ref() - .is_none_or(|failure| failure.is_better_position(*approx_position)) + .is_none_or(|failure| failure.is_better_position(position_in_tokenstream)) { self.best_failure = Some(BestFailure { token: *token, - position_in_tokenstream: *approx_position, + position_in_tokenstream, msg, remaining_matcher: self .remaining_matcher diff --git a/compiler/rustc_expand/src/mbe/macro_check.rs b/compiler/rustc_expand/src/mbe/macro_check.rs index bbdff866feba..25987a503663 100644 --- a/compiler/rustc_expand/src/mbe/macro_check.rs +++ b/compiler/rustc_expand/src/mbe/macro_check.rs @@ -193,15 +193,19 @@ struct MacroState<'a> { /// Arguments: /// - `psess` is used to emit diagnostics and lints /// - `node_id` is used to emit lints -/// - `lhs` and `rhs` represent the rule +/// - `args`, `lhs`, and `rhs` represent the rule pub(super) fn check_meta_variables( psess: &ParseSess, node_id: NodeId, + args: Option<&TokenTree>, lhs: &TokenTree, rhs: &TokenTree, ) -> Result<(), ErrorGuaranteed> { let mut guar = None; let mut binders = Binders::default(); + if let Some(args) = args { + check_binders(psess, node_id, args, &Stack::Empty, &mut binders, &Stack::Empty, &mut guar); + } check_binders(psess, node_id, lhs, &Stack::Empty, &mut binders, &Stack::Empty, &mut guar); check_occurrences(psess, node_id, rhs, &Stack::Empty, &binders, &Stack::Empty, &mut guar); guar.map_or(Ok(()), Err) diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 52d38c35f980..37b236a2e268 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -6,12 +6,12 @@ use std::{mem, slice}; use ast::token::IdentIsRaw; use rustc_ast::token::NtPatKind::*; use rustc_ast::token::TokenKind::*; -use rustc_ast::token::{self, NonterminalKind, Token, TokenKind}; -use rustc_ast::tokenstream::{DelimSpan, TokenStream}; +use rustc_ast::token::{self, Delimiter, NonterminalKind, Token, TokenKind}; +use rustc_ast::tokenstream::{self, DelimSpan, TokenStream}; use rustc_ast::{self as ast, DUMMY_NODE_ID, NodeId}; use rustc_ast_pretty::pprust; use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; -use rustc_errors::{Applicability, Diag, ErrorGuaranteed}; +use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan}; use rustc_feature::Features; use rustc_hir as hir; use rustc_hir::attrs::AttributeKind; @@ -23,23 +23,26 @@ use rustc_lint_defs::builtin::{ use rustc_parse::exp; use rustc_parse::parser::{Parser, Recovery}; use rustc_session::Session; -use rustc_session::parse::ParseSess; +use rustc_session::parse::{ParseSess, feature_err}; use rustc_span::edition::Edition; use rustc_span::hygiene::Transparency; use rustc_span::{Ident, Span, kw, sym}; use tracing::{debug, instrument, trace, trace_span}; +use super::diagnostics::failed_to_match_macro; use super::macro_parser::{NamedMatches, NamedParseResult}; use super::{SequenceRepetition, diagnostics}; use crate::base::{ - DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult, SyntaxExtension, - SyntaxExtensionKind, TTMacroExpander, + AttrProcMacro, DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult, + SyntaxExtension, SyntaxExtensionKind, TTMacroExpander, }; +use crate::errors; use crate::expand::{AstFragment, AstFragmentKind, ensure_complete_parse, parse_ast_fragment}; +use crate::mbe::macro_check::check_meta_variables; use crate::mbe::macro_parser::{Error, ErrorReported, Failure, MatcherLoc, Success, TtParser}; use crate::mbe::quoted::{RulePart, parse_one_tt}; use crate::mbe::transcribe::transcribe; -use crate::mbe::{self, KleeneOp, macro_check}; +use crate::mbe::{self, KleeneOp}; pub(crate) struct ParserAnyMacro<'a> { parser: Parser<'a>, @@ -123,10 +126,17 @@ impl<'a> ParserAnyMacro<'a> { } } -pub(super) struct MacroRule { - pub(super) lhs: Vec, - lhs_span: Span, - rhs: mbe::TokenTree, +pub(super) enum MacroRule { + /// A function-style rule, for use with `m!()` + Func { lhs: Vec, lhs_span: Span, rhs: mbe::TokenTree }, + /// An attr rule, for use with `#[m]` + Attr { + args: Vec, + args_span: Span, + body: Vec, + body_span: Span, + rhs: mbe::TokenTree, + }, } pub struct MacroRulesMacroExpander { @@ -138,10 +148,15 @@ pub struct MacroRulesMacroExpander { } impl MacroRulesMacroExpander { - pub fn get_unused_rule(&self, rule_i: usize) -> Option<(&Ident, Span)> { + pub fn get_unused_rule(&self, rule_i: usize) -> Option<(&Ident, MultiSpan)> { // If the rhs contains an invocation like `compile_error!`, don't report it as unused. - let rule = &self.rules[rule_i]; - if has_compile_error_macro(&rule.rhs) { None } else { Some((&self.name, rule.lhs_span)) } + let (span, rhs) = match self.rules[rule_i] { + MacroRule::Func { lhs_span, ref rhs, .. } => (MultiSpan::from_span(lhs_span), rhs), + MacroRule::Attr { args_span, body_span, ref rhs, .. } => { + (MultiSpan::from_spans(vec![args_span, body_span]), rhs) + } + }; + if has_compile_error_macro(rhs) { None } else { Some((&self.name, span)) } } } @@ -165,6 +180,28 @@ impl TTMacroExpander for MacroRulesMacroExpander { } } +impl AttrProcMacro for MacroRulesMacroExpander { + fn expand( + &self, + cx: &mut ExtCtxt<'_>, + sp: Span, + args: TokenStream, + body: TokenStream, + ) -> Result { + expand_macro_attr( + cx, + sp, + self.span, + self.node_id, + self.name, + self.transparency, + args, + body, + &self.rules, + ) + } +} + struct DummyExpander(ErrorGuaranteed); impl TTMacroExpander for DummyExpander { @@ -197,7 +234,7 @@ pub(super) trait Tracker<'matcher> { /// This is called after an arm has been parsed, either successfully or unsuccessfully. When /// this is called, `before_match_loc` was called at least once (with a `MatcherLoc::Eof`). - fn after_arm(&mut self, _result: &NamedParseResult) {} + fn after_arm(&mut self, _in_body: bool, _result: &NamedParseResult) {} /// For tracing. fn description() -> &'static str; @@ -245,14 +282,17 @@ fn expand_macro<'cx>( match try_success_result { Ok((rule_index, rule, named_matches)) => { - let mbe::TokenTree::Delimited(rhs_span, _, ref rhs) = rule.rhs else { + let MacroRule::Func { rhs, .. } = rule else { + panic!("try_match_macro returned non-func rule"); + }; + let mbe::TokenTree::Delimited(rhs_span, _, rhs) = rhs else { cx.dcx().span_bug(sp, "malformed macro rhs"); }; - let arm_span = rule.rhs.span(); + let arm_span = rhs_span.entire(); // rhs has holes ( `$id` and `$(...)` that need filled) let id = cx.current_expansion.id; - let tts = match transcribe(psess, &named_matches, rhs, rhs_span, transparency, id) { + let tts = match transcribe(psess, &named_matches, rhs, *rhs_span, transparency, id) { Ok(tts) => tts, Err(err) => { let guar = err.emit(); @@ -280,13 +320,76 @@ fn expand_macro<'cx>( Err(CanRetry::Yes) => { // Retry and emit a better error. let (span, guar) = - diagnostics::failed_to_match_macro(cx.psess(), sp, def_span, name, arg, rules); + failed_to_match_macro(cx.psess(), sp, def_span, name, None, &arg, rules); cx.macro_error_and_trace_macros_diag(); DummyResult::any(span, guar) } } } +/// Expands the rules based macro defined by `rules` for a given attribute `args` and `body`. +#[instrument(skip(cx, transparency, args, body, rules))] +fn expand_macro_attr( + cx: &mut ExtCtxt<'_>, + sp: Span, + def_span: Span, + node_id: NodeId, + name: Ident, + transparency: Transparency, + args: TokenStream, + body: TokenStream, + rules: &[MacroRule], +) -> Result { + let psess = &cx.sess.psess; + // Macros defined in the current crate have a real node id, + // whereas macros from an external crate have a dummy id. + let is_local = node_id != DUMMY_NODE_ID; + + if cx.trace_macros() { + let msg = format!( + "expanding `$[{name}({})] {}`", + pprust::tts_to_string(&args), + pprust::tts_to_string(&body), + ); + trace_macros_note(&mut cx.expansions, sp, msg); + } + + // Track nothing for the best performance. + match try_match_macro_attr(psess, name, &args, &body, rules, &mut NoopTracker) { + Ok((i, rule, named_matches)) => { + let MacroRule::Attr { rhs, .. } = rule else { + panic!("try_macro_match_attr returned non-attr rule"); + }; + let mbe::TokenTree::Delimited(rhs_span, _, rhs) = rhs else { + cx.dcx().span_bug(sp, "malformed macro rhs"); + }; + + let id = cx.current_expansion.id; + let tts = transcribe(psess, &named_matches, rhs, *rhs_span, transparency, id) + .map_err(|e| e.emit())?; + + if cx.trace_macros() { + let msg = format!("to `{}`", pprust::tts_to_string(&tts)); + trace_macros_note(&mut cx.expansions, sp, msg); + } + + if is_local { + cx.resolver.record_macro_rule_usage(node_id, i); + } + + Ok(tts) + } + Err(CanRetry::No(guar)) => Err(guar), + Err(CanRetry::Yes) => { + // Retry and emit a better error. + let (_, guar) = + failed_to_match_macro(cx.psess(), sp, def_span, name, Some(&args), &body, rules); + cx.trace_macros_diag(); + Err(guar) + } + } +} + pub(super) enum CanRetry { Yes, /// We are not allowed to retry macro expansion as a fatal error has been emitted already. @@ -327,6 +430,7 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>( // Try each arm's matchers. let mut tt_parser = TtParser::new(name); for (i, rule) in rules.iter().enumerate() { + let MacroRule::Func { lhs, .. } = rule else { continue }; let _tracing_span = trace_span!("Matching arm", %i); // Take a snapshot of the state of pre-expansion gating at this point. @@ -335,9 +439,9 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>( // are not recorded. On the first `Success(..)`ful matcher, the spans are merged. let mut gated_spans_snapshot = mem::take(&mut *psess.gated_spans.spans.borrow_mut()); - let result = tt_parser.parse_tt(&mut Cow::Borrowed(&parser), &rule.lhs, track); + let result = tt_parser.parse_tt(&mut Cow::Borrowed(&parser), lhs, track); - track.after_arm(&result); + track.after_arm(true, &result); match result { Success(named_matches) => { @@ -372,6 +476,60 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>( Err(CanRetry::Yes) } +/// Try expanding the macro attribute. Returns the index of the successful arm and its +/// named_matches if it was successful, and nothing if it failed. On failure, it's the caller's job +/// to use `track` accordingly to record all errors correctly. +#[instrument(level = "debug", skip(psess, attr_args, attr_body, rules, track), fields(tracking = %T::description()))] +pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>( + psess: &ParseSess, + name: Ident, + attr_args: &TokenStream, + attr_body: &TokenStream, + rules: &'matcher [MacroRule], + track: &mut T, +) -> Result<(usize, &'matcher MacroRule, NamedMatches), CanRetry> { + // This uses the same strategy as `try_match_macro` + let args_parser = parser_from_cx(psess, attr_args.clone(), T::recovery()); + let body_parser = parser_from_cx(psess, attr_body.clone(), T::recovery()); + let mut tt_parser = TtParser::new(name); + for (i, rule) in rules.iter().enumerate() { + let MacroRule::Attr { args, body, .. } = rule else { continue }; + + let mut gated_spans_snapshot = mem::take(&mut *psess.gated_spans.spans.borrow_mut()); + + let result = tt_parser.parse_tt(&mut Cow::Borrowed(&args_parser), args, track); + track.after_arm(false, &result); + + let mut named_matches = match result { + Success(named_matches) => named_matches, + Failure(_) => { + mem::swap(&mut gated_spans_snapshot, &mut psess.gated_spans.spans.borrow_mut()); + continue; + } + Error(_, _) => return Err(CanRetry::Yes), + ErrorReported(guar) => return Err(CanRetry::No(guar)), + }; + + let result = tt_parser.parse_tt(&mut Cow::Borrowed(&body_parser), body, track); + track.after_arm(true, &result); + + match result { + Success(body_named_matches) => { + psess.gated_spans.merge(gated_spans_snapshot); + named_matches.extend(body_named_matches); + return Ok((i, rule, named_matches)); + } + Failure(_) => { + mem::swap(&mut gated_spans_snapshot, &mut psess.gated_spans.spans.borrow_mut()) + } + Error(_, _) => return Err(CanRetry::Yes), + ErrorReported(guar) => return Err(CanRetry::No(guar)), + } + } + + Err(CanRetry::Yes) +} + /// Converts a macro item into a syntax extension. pub fn compile_declarative_macro( sess: &Session, @@ -382,13 +540,13 @@ pub fn compile_declarative_macro( span: Span, node_id: NodeId, edition: Edition, -) -> (SyntaxExtension, usize) { - let mk_syn_ext = |expander| { - let kind = SyntaxExtensionKind::LegacyBang(expander); +) -> (SyntaxExtension, Option>, usize) { + let mk_syn_ext = |kind| { let is_local = is_defined_in_current_crate(node_id); SyntaxExtension::new(sess, kind, span, Vec::new(), edition, ident.name, attrs, is_local) }; - let dummy_syn_ext = |guar| (mk_syn_ext(Arc::new(DummyExpander(guar))), 0); + let mk_bang_ext = |expander| mk_syn_ext(SyntaxExtensionKind::LegacyBang(expander)); + let dummy_syn_ext = |guar| (mk_bang_ext(Arc::new(DummyExpander(guar))), None, 0); let macro_rules = macro_def.macro_rules; let exp_sep = if macro_rules { exp!(Semi) } else { exp!(Comma) }; @@ -401,9 +559,30 @@ pub fn compile_declarative_macro( let mut guar = None; let mut check_emission = |ret: Result<(), ErrorGuaranteed>| guar = guar.or(ret.err()); + let mut has_attr_rules = false; let mut rules = Vec::new(); while p.token != token::Eof { + let args = if p.eat_keyword_noexpect(sym::attr) { + has_attr_rules = true; + if !features.macro_attr() { + feature_err(sess, sym::macro_attr, span, "`macro_rules!` attributes are unstable") + .emit(); + } + if let Some(guar) = check_no_eof(sess, &p, "expected macro attr args") { + return dummy_syn_ext(guar); + } + let args = p.parse_token_tree(); + check_args_parens(sess, &args); + let args = parse_one_tt(args, RulePart::Pattern, sess, node_id, features, edition); + check_emission(check_lhs(sess, node_id, &args)); + if let Some(guar) = check_no_eof(sess, &p, "expected macro attr body") { + return dummy_syn_ext(guar); + } + Some(args) + } else { + None + }; let lhs_tt = p.parse_token_tree(); let lhs_tt = parse_one_tt(lhs_tt, RulePart::Pattern, sess, node_id, features, edition); check_emission(check_lhs(sess, node_id, &lhs_tt)); @@ -416,7 +595,7 @@ pub fn compile_declarative_macro( let rhs_tt = p.parse_token_tree(); let rhs_tt = parse_one_tt(rhs_tt, RulePart::Body, sess, node_id, features, edition); check_emission(check_rhs(sess, &rhs_tt)); - check_emission(macro_check::check_meta_variables(&sess.psess, node_id, &lhs_tt, &rhs_tt)); + check_emission(check_meta_variables(&sess.psess, node_id, args.as_ref(), &lhs_tt, &rhs_tt)); let lhs_span = lhs_tt.span(); // Convert the lhs into `MatcherLoc` form, which is better for doing the // actual matching. @@ -425,7 +604,17 @@ pub fn compile_declarative_macro( } else { return dummy_syn_ext(guar.unwrap()); }; - rules.push(MacroRule { lhs, lhs_span, rhs: rhs_tt }); + if let Some(args) = args { + let args_span = args.span(); + let mbe::TokenTree::Delimited(.., delimited) = args else { + return dummy_syn_ext(guar.unwrap()); + }; + let args = mbe::macro_parser::compute_locs(&delimited.tts); + let body_span = lhs_span; + rules.push(MacroRule::Attr { args, args_span, body: lhs, body_span, rhs: rhs_tt }); + } else { + rules.push(MacroRule::Func { lhs, lhs_span, rhs: rhs_tt }); + } if p.token == token::Eof { break; } @@ -451,9 +640,12 @@ pub fn compile_declarative_macro( // Return the number of rules for unused rule linting, if this is a local macro. let nrules = if is_defined_in_current_crate(node_id) { rules.len() } else { 0 }; - let expander = - Arc::new(MacroRulesMacroExpander { name: ident, span, node_id, transparency, rules }); - (mk_syn_ext(expander), nrules) + let exp = Arc::new(MacroRulesMacroExpander { name: ident, span, node_id, transparency, rules }); + let opt_attr_ext = has_attr_rules.then(|| { + let exp = Arc::clone(&exp); + Arc::new(mk_syn_ext(SyntaxExtensionKind::Attr(exp))) + }); + (mk_bang_ext(exp), opt_attr_ext, nrules) } fn check_no_eof(sess: &Session, p: &Parser<'_>, msg: &'static str) -> Option { @@ -469,6 +661,18 @@ fn check_no_eof(sess: &Session, p: &Parser<'_>, msg: &'static str) -> Option Result<(), ErrorGuaranteed> { let e1 = check_lhs_nt_follows(sess, node_id, lhs); let e2 = check_lhs_no_empty_seq(sess, slice::from_ref(lhs)); diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index 4eee79a2a71e..04f261ada069 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -54,7 +54,7 @@ declare_features! ( /// Allows using the `amdgpu-kernel` ABI. (removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None, 120495), - (removed, abi_c_cmse_nonsecure_call, "CURRENT_RUSTC_VERSION", Some(81391), Some("renamed to abi_cmse_nonsecure_call"), 142146), + (removed, abi_c_cmse_nonsecure_call, "1.90.0", Some(81391), Some("renamed to abi_cmse_nonsecure_call"), 142146), (removed, advanced_slice_patterns, "1.42.0", Some(62254), Some("merged into `#![feature(slice_patterns)]`"), 67712), (removed, allocator, "1.0.0", None, None), @@ -300,7 +300,7 @@ declare_features! ( // FIXME(#141617): we should have a better way to track removed library features, but we reuse // the infrastructure here so users still get hints. The symbols used here can be remove from // `symbol.rs` when that happens. - (removed, concat_idents, "CURRENT_RUSTC_VERSION", Some(29599), + (removed, concat_idents, "1.90.0", Some(29599), Some("use the `${concat(..)}` metavariable expression instead"), 142704), // ------------------------------------------------------------------------- // feature-group-end: removed library features diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 1303b3317e05..ae1f57c1ef61 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -327,6 +327,7 @@ declare_features! ( (unstable, m68k_target_feature, "1.85.0", Some(134328)), (unstable, mips_target_feature, "1.27.0", Some(44839)), (unstable, movrs_target_feature, "1.88.0", Some(137976)), + (unstable, nvptx_target_feature, "CURRENT_RUSTC_VERSION", Some(44839)), (unstable, powerpc_target_feature, "1.27.0", Some(44839)), (unstable, prfchw_target_feature, "1.78.0", Some(44839)), (unstable, riscv_target_feature, "1.45.0", Some(44839)), @@ -352,7 +353,7 @@ declare_features! ( /// Allows `extern "avr-interrupt" fn()` and `extern "avr-non-blocking-interrupt" fn()`. (unstable, abi_avr_interrupt, "1.45.0", Some(69664)), /// Allows `extern "cmse-nonsecure-call" fn()`. - (unstable, abi_cmse_nonsecure_call, "CURRENT_RUSTC_VERSION", Some(81391)), + (unstable, abi_cmse_nonsecure_call, "1.90.0", Some(81391)), /// Allows `extern "custom" fn()`. (unstable, abi_custom, "1.89.0", Some(140829)), /// Allows `extern "gpu-kernel" fn()`. @@ -552,7 +553,9 @@ declare_features! ( /// to pass custom arguments to the linker. (unstable, link_arg_attribute, "1.76.0", Some(99427)), /// Allows fused `loop`/`match` for direct intraprocedural jumps. - (incomplete, loop_match, "CURRENT_RUSTC_VERSION", Some(132306)), + (incomplete, loop_match, "1.90.0", Some(132306)), + /// Allow `macro_rules!` attribute rules + (unstable, macro_attr, "CURRENT_RUSTC_VERSION", Some(83527)), /// Give access to additional metadata about declarative macro meta-variables. (unstable, macro_metavar_expr, "1.61.0", Some(83527)), /// Provides a way to concatenate identifiers using metavariable expressions. diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 80618422b56d..5f4193154674 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -297,6 +297,9 @@ pub enum AttributeKind { /// Represents `#[const_trait]`. ConstTrait(Span), + /// Represents `#[coroutine]`. + Coroutine(Span), + /// Represents `#[coverage(..)]`. Coverage(Span, CoverageAttrKind), @@ -433,6 +436,9 @@ pub enum AttributeKind { /// Represents `#[rustc_object_lifetime_default]`. RustcObjectLifetimeDefault, + /// Represents `#[should_panic]` + ShouldPanic { reason: Option, span: Span }, + /// Represents `#[rustc_skip_during_method_dispatch]`. SkipDuringMethodDispatch { array: bool, boxed_slice: bool, span: Span }, diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index 9644a597a311..e3a7f0b97a8f 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -28,6 +28,7 @@ impl AttributeKind { ConstStability { .. } => Yes, ConstStabilityIndirect => No, ConstTrait(..) => No, + Coroutine(..) => No, Coverage(..) => No, DenyExplicitImpl(..) => No, Deprecation { .. } => Yes, @@ -69,6 +70,7 @@ impl AttributeKind { RustcLayoutScalarValidRangeEnd(..) => Yes, RustcLayoutScalarValidRangeStart(..) => Yes, RustcObjectLifetimeDefault => No, + ShouldPanic { .. } => No, SkipDuringMethodDispatch { .. } => No, SpecializationTrait(..) => No, Stability { .. } => Yes, diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index c30c830f9af8..34db6f92d928 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1308,6 +1308,7 @@ impl AttributeExt for Attribute { Attribute::Parsed(AttributeKind::MacroUse { span, .. }) => *span, Attribute::Parsed(AttributeKind::MayDangle(span)) => *span, Attribute::Parsed(AttributeKind::Ignore { span, .. }) => *span, + Attribute::Parsed(AttributeKind::ShouldPanic { span, .. }) => *span, Attribute::Parsed(AttributeKind::AutomaticallyDerived(span)) => *span, a => panic!("can't get the span of an arbitrary parsed attribute: {a:?}"), } diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 6e5fe3823ab5..4441dd6ebd66 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -652,16 +652,16 @@ pub(crate) fn check_intrinsic_type( sym::atomic_store => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit), sym::atomic_xchg - | sym::atomic_xadd - | sym::atomic_xsub - | sym::atomic_and - | sym::atomic_nand - | sym::atomic_or - | sym::atomic_xor | sym::atomic_max | sym::atomic_min | sym::atomic_umax | sym::atomic_umin => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], param(0)), + sym::atomic_xadd + | sym::atomic_xsub + | sym::atomic_and + | sym::atomic_nand + | sym::atomic_or + | sym::atomic_xor => (2, 1, vec![Ty::new_mut_ptr(tcx, param(0)), param(1)], param(0)), sym::atomic_fence | sym::atomic_singlethreadfence => (0, 1, Vec::new(), tcx.types.unit), other => { diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index e2462c2d4659..ce0e51f106f5 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -223,60 +223,27 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { "synthetic HIR should have its `generics_of` explicitly fed" ), - _ => span_bug!(tcx.def_span(def_id), "unhandled node {node:?}"), + _ => span_bug!(tcx.def_span(def_id), "generics_of: unexpected node kind {node:?}"), }; - enum Defaults { - Allowed, - // See #36887 - FutureCompatDisallowed, - Deny, - } + // Add in the self type parameter. + let opt_self = if let Node::Item(item) = node + && let ItemKind::Trait(..) | ItemKind::TraitAlias(..) = item.kind + { + // Something of a hack: We reuse the node ID of the trait for the self type parameter. + Some(ty::GenericParamDef { + index: 0, + name: kw::SelfUpper, + def_id: def_id.to_def_id(), + pure_wrt_drop: false, + kind: ty::GenericParamDefKind::Type { has_default: false, synthetic: false }, + }) + } else { + None + }; + let param_default_policy = param_default_policy(node); let hir_generics = node.generics().unwrap_or(hir::Generics::empty()); - let (opt_self, allow_defaults) = match node { - Node::Item(item) => { - match item.kind { - ItemKind::Trait(..) | ItemKind::TraitAlias(..) => { - // Add in the self type parameter. - // - // Something of a hack: use the node id for the trait, also as - // the node id for the Self type parameter. - let opt_self = Some(ty::GenericParamDef { - index: 0, - name: kw::SelfUpper, - def_id: def_id.to_def_id(), - pure_wrt_drop: false, - kind: ty::GenericParamDefKind::Type { - has_default: false, - synthetic: false, - }, - }); - - (opt_self, Defaults::Allowed) - } - ItemKind::TyAlias(..) - | ItemKind::Enum(..) - | ItemKind::Struct(..) - | ItemKind::Union(..) => (None, Defaults::Allowed), - ItemKind::Const(..) => (None, Defaults::Deny), - _ => (None, Defaults::FutureCompatDisallowed), - } - } - - Node::OpaqueTy(..) => (None, Defaults::Allowed), - - // GATs - Node::TraitItem(item) if matches!(item.kind, TraitItemKind::Type(..)) => { - (None, Defaults::Deny) - } - Node::ImplItem(item) if matches!(item.kind, ImplItemKind::Type(..)) => { - (None, Defaults::Deny) - } - - _ => (None, Defaults::FutureCompatDisallowed), - }; - let has_self = opt_self.is_some(); let mut parent_has_self = false; let mut own_start = has_self as u32; @@ -312,60 +279,53 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { prev + type_start }; - const TYPE_DEFAULT_NOT_ALLOWED: &'static str = "defaults for type parameters are only allowed in \ - `struct`, `enum`, `type`, or `trait` definitions"; - - own_params.extend(hir_generics.params.iter().filter_map(|param| match param.kind { - GenericParamKind::Lifetime { .. } => None, - GenericParamKind::Type { default, synthetic, .. } => { - if default.is_some() { - match allow_defaults { - Defaults::Allowed => {} - Defaults::FutureCompatDisallowed => { - tcx.node_span_lint( - lint::builtin::INVALID_TYPE_PARAM_DEFAULT, - param.hir_id, - param.span, - |lint| { - lint.primary_message(TYPE_DEFAULT_NOT_ALLOWED); - }, - ); - } - Defaults::Deny => { - tcx.dcx().span_err(param.span, TYPE_DEFAULT_NOT_ALLOWED); + own_params.extend(hir_generics.params.iter().filter_map(|param| { + const MESSAGE: &str = "defaults for generic parameters are not allowed here"; + let kind = match param.kind { + GenericParamKind::Lifetime { .. } => return None, + GenericParamKind::Type { default, synthetic } => { + if default.is_some() { + match param_default_policy.expect("no policy for generic param default") { + ParamDefaultPolicy::Allowed => {} + ParamDefaultPolicy::FutureCompatForbidden => { + tcx.node_span_lint( + lint::builtin::INVALID_TYPE_PARAM_DEFAULT, + param.hir_id, + param.span, + |lint| { + lint.primary_message(MESSAGE); + }, + ); + } + ParamDefaultPolicy::Forbidden => { + tcx.dcx().span_err(param.span, MESSAGE); + } } } + + ty::GenericParamDefKind::Type { has_default: default.is_some(), synthetic } } + GenericParamKind::Const { ty: _, default, synthetic } => { + if default.is_some() { + match param_default_policy.expect("no policy for generic param default") { + ParamDefaultPolicy::Allowed => {} + ParamDefaultPolicy::FutureCompatForbidden + | ParamDefaultPolicy::Forbidden => { + tcx.dcx().span_err(param.span, MESSAGE); + } + } + } - let kind = ty::GenericParamDefKind::Type { has_default: default.is_some(), synthetic }; - - Some(ty::GenericParamDef { - index: next_index(), - name: param.name.ident().name, - def_id: param.def_id.to_def_id(), - pure_wrt_drop: param.pure_wrt_drop, - kind, - }) - } - GenericParamKind::Const { ty: _, default, synthetic } => { - if !matches!(allow_defaults, Defaults::Allowed) && default.is_some() { - tcx.dcx().span_err( - param.span, - "defaults for const parameters are only allowed in \ - `struct`, `enum`, `type`, or `trait` definitions", - ); + ty::GenericParamDefKind::Const { has_default: default.is_some(), synthetic } } - - let index = next_index(); - - Some(ty::GenericParamDef { - index, - name: param.name.ident().name, - def_id: param.def_id.to_def_id(), - pure_wrt_drop: param.pure_wrt_drop, - kind: ty::GenericParamDefKind::Const { has_default: default.is_some(), synthetic }, - }) - } + }; + Some(ty::GenericParamDef { + index: next_index(), + name: param.name.ident().name, + def_id: param.def_id.to_def_id(), + pure_wrt_drop: param.pure_wrt_drop, + kind, + }) })); // provide junk type parameter defs - the only place that @@ -438,6 +398,48 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { } } +#[derive(Clone, Copy)] +enum ParamDefaultPolicy { + Allowed, + /// Tracked in . + FutureCompatForbidden, + Forbidden, +} + +fn param_default_policy(node: Node<'_>) -> Option { + use rustc_hir::*; + + Some(match node { + Node::Item(item) => match item.kind { + ItemKind::Trait(..) + | ItemKind::TraitAlias(..) + | ItemKind::TyAlias(..) + | ItemKind::Enum(..) + | ItemKind::Struct(..) + | ItemKind::Union(..) => ParamDefaultPolicy::Allowed, + ItemKind::Fn { .. } | ItemKind::Impl(_) => ParamDefaultPolicy::FutureCompatForbidden, + // Re. GCI, we're not bound by backward compatibility. + ItemKind::Const(..) => ParamDefaultPolicy::Forbidden, + _ => return None, + }, + Node::TraitItem(item) => match item.kind { + // Re. GATs and GACs (generic_const_items), we're not bound by backward compatibility. + TraitItemKind::Const(..) | TraitItemKind::Type(..) => ParamDefaultPolicy::Forbidden, + TraitItemKind::Fn(..) => ParamDefaultPolicy::FutureCompatForbidden, + }, + Node::ImplItem(item) => match item.kind { + // Re. GATs and GACs (generic_const_items), we're not bound by backward compatibility. + ImplItemKind::Const(..) | ImplItemKind::Type(..) => ParamDefaultPolicy::Forbidden, + ImplItemKind::Fn(..) => ParamDefaultPolicy::FutureCompatForbidden, + }, + // Generic params are (semantically) invalid on foreign items. Still, for maximum forward + // compatibility, let's hard-reject defaults on them. + Node::ForeignItem(_) => ParamDefaultPolicy::Forbidden, + Node::OpaqueTy(..) => ParamDefaultPolicy::Allowed, + _ => return None, + }) +} + fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option { struct LateBoundRegionsDetector<'tcx> { tcx: TyCtxt<'tcx>, diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 7e2bfa9f920c..1675aecd2b84 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -1135,9 +1135,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { ); } } else { + let trait_ = + tcx.short_string(bound.print_only_trait_path(), err.long_ty_path()); err.note(format!( - "associated {assoc_kind_str} `{assoc_ident}` could derive from `{}`", - bound.print_only_trait_path(), + "associated {assoc_kind_str} `{assoc_ident}` could derive from `{trait_}`", )); } } diff --git a/compiler/rustc_hir_typeck/messages.ftl b/compiler/rustc_hir_typeck/messages.ftl index bac4d70103c3..1ed0756fdd6a 100644 --- a/compiler/rustc_hir_typeck/messages.ftl +++ b/compiler/rustc_hir_typeck/messages.ftl @@ -159,7 +159,7 @@ hir_typeck_lossy_provenance_ptr2int = .suggestion = use `.addr()` to obtain the address of a pointer .help = if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead -hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}` +hir_typeck_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty}` hir_typeck_naked_asm_outside_naked_fn = the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]` @@ -184,7 +184,7 @@ hir_typeck_never_type_fallback_flowing_into_unsafe_path = never type fallback af hir_typeck_never_type_fallback_flowing_into_unsafe_union_field = never type fallback affects this union access .help = specify the type explicitly -hir_typeck_no_associated_item = no {$item_kind} named `{$item_ident}` found for {$ty_prefix} `{$ty_str}`{$trait_missing_method -> +hir_typeck_no_associated_item = no {$item_kind} named `{$item_ident}` found for {$ty_prefix} `{$ty}`{$trait_missing_method -> [true] {""} *[other] {" "}in the current scope } diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index a8bb6956f101..d15d092b7d3d 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -200,11 +200,11 @@ pub(crate) enum ExplicitDestructorCallSugg { #[derive(Diagnostic)] #[diag(hir_typeck_missing_parentheses_in_range, code = E0689)] -pub(crate) struct MissingParenthesesInRange { +pub(crate) struct MissingParenthesesInRange<'tcx> { #[primary_span] #[label(hir_typeck_missing_parentheses_in_range)] pub span: Span, - pub ty_str: String, + pub ty: Ty<'tcx>, pub method_name: String, #[subdiagnostic] pub add_missing_parentheses: Option, @@ -828,13 +828,13 @@ pub(crate) struct UnlabeledCfInWhileCondition<'a> { #[derive(Diagnostic)] #[diag(hir_typeck_no_associated_item, code = E0599)] -pub(crate) struct NoAssociatedItem { +pub(crate) struct NoAssociatedItem<'tcx> { #[primary_span] pub span: Span, pub item_kind: &'static str, pub item_ident: Ident, pub ty_prefix: Cow<'static, str>, - pub ty_str: String, + pub ty: Ty<'tcx>, pub trait_missing_method: bool, } diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 454ec7ddcafb..0498a9383663 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -2745,6 +2745,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let available_field_names = self.available_field_names(variant, expr, skip_fields); if let Some(field_name) = find_best_match_for_name(&available_field_names, field.ident.name, None) + && !(field.ident.name.as_str().parse::().is_ok() + && field_name.as_str().parse::().is_ok()) { err.span_label(field.ident.span, "unknown field"); err.span_suggestion_verbose( @@ -3321,18 +3323,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { (base_ty, "") }; - for (found_fields, args) in + for found_fields in self.get_field_candidates_considering_privacy_for_diag(span, ty, mod_id, expr.hir_id) { - let field_names = found_fields.iter().map(|field| field.name).collect::>(); + let field_names = found_fields.iter().map(|field| field.0.name).collect::>(); let mut candidate_fields: Vec<_> = found_fields .into_iter() .filter_map(|candidate_field| { self.check_for_nested_field_satisfying_condition_for_diag( span, - &|candidate_field, _| candidate_field.ident(self.tcx()) == field, + &|candidate_field, _| candidate_field == field, candidate_field, - args, vec![], mod_id, expr.hir_id, @@ -3361,6 +3362,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } else if let Some(field_name) = find_best_match_for_name(&field_names, field.name, None) + && !(field.name.as_str().parse::().is_ok() + && field_name.as_str().parse::().is_ok()) { err.span_suggestion_verbose( field.span, @@ -3396,7 +3399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { base_ty: Ty<'tcx>, mod_id: DefId, hir_id: HirId, - ) -> Vec<(Vec<&'tcx ty::FieldDef>, GenericArgsRef<'tcx>)> { + ) -> Vec)>> { debug!("get_field_candidates(span: {:?}, base_t: {:?}", span, base_ty); let mut autoderef = self.autoderef(span, base_ty).silence_errors(); @@ -3422,7 +3425,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if fields.iter().all(|field| !field.vis.is_accessible_from(mod_id, tcx)) { return None; } - return Some(( + return Some( fields .iter() .filter(move |field| { @@ -3431,9 +3434,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }) // For compile-time reasons put a limit on number of fields we search .take(100) + .map(|field_def| { + ( + field_def.ident(self.tcx).normalize_to_macros_2_0(), + field_def.ty(self.tcx, args), + ) + }) .collect::>(), - *args, - )); + ); + } + ty::Tuple(types) => { + return Some( + types + .iter() + .enumerate() + // For compile-time reasons put a limit on number of fields we search + .take(100) + .map(|(i, ty)| (Ident::from_str(&i.to_string()), ty)) + .collect::>(), + ); } _ => None, } @@ -3443,56 +3462,46 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// This method is called after we have encountered a missing field error to recursively /// search for the field + #[instrument(skip(self, matches, mod_id, hir_id), level = "debug")] pub(crate) fn check_for_nested_field_satisfying_condition_for_diag( &self, span: Span, - matches: &impl Fn(&ty::FieldDef, Ty<'tcx>) -> bool, - candidate_field: &ty::FieldDef, - subst: GenericArgsRef<'tcx>, + matches: &impl Fn(Ident, Ty<'tcx>) -> bool, + (candidate_name, candidate_ty): (Ident, Ty<'tcx>), mut field_path: Vec, mod_id: DefId, hir_id: HirId, ) -> Option> { - debug!( - "check_for_nested_field_satisfying(span: {:?}, candidate_field: {:?}, field_path: {:?}", - span, candidate_field, field_path - ); - if field_path.len() > 3 { // For compile-time reasons and to avoid infinite recursion we only check for fields // up to a depth of three - None - } else { - field_path.push(candidate_field.ident(self.tcx).normalize_to_macros_2_0()); - let field_ty = candidate_field.ty(self.tcx, subst); - if matches(candidate_field, field_ty) { - return Some(field_path); - } else { - for (nested_fields, subst) in self - .get_field_candidates_considering_privacy_for_diag( - span, field_ty, mod_id, hir_id, - ) - { - // recursively search fields of `candidate_field` if it's a ty::Adt - for field in nested_fields { - if let Some(field_path) = self - .check_for_nested_field_satisfying_condition_for_diag( - span, - matches, - field, - subst, - field_path.clone(), - mod_id, - hir_id, - ) - { - return Some(field_path); - } - } + return None; + } + field_path.push(candidate_name); + if matches(candidate_name, candidate_ty) { + return Some(field_path); + } + for nested_fields in self.get_field_candidates_considering_privacy_for_diag( + span, + candidate_ty, + mod_id, + hir_id, + ) { + // recursively search fields of `candidate_field` if it's a ty::Adt + for field in nested_fields { + if let Some(field_path) = self.check_for_nested_field_satisfying_condition_for_diag( + span, + matches, + field, + field_path.clone(), + mod_id, + hir_id, + ) { + return Some(field_path); } } - None } + None } fn check_expr_index( diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 0c0cc752b01a..f7430f7af4e9 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -376,16 +376,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - fn suggest_missing_writer(&self, rcvr_ty: Ty<'tcx>, rcvr_expr: &hir::Expr<'tcx>) -> Diag<'_> { - let mut file = None; + fn suggest_missing_writer( + &self, + rcvr_ty: Ty<'tcx>, + rcvr_expr: &hir::Expr<'tcx>, + mut long_ty_path: Option, + ) -> Diag<'_> { let mut err = struct_span_code_err!( self.dcx(), rcvr_expr.span, E0599, "cannot write into `{}`", - self.tcx.short_string(rcvr_ty, &mut file), + self.tcx.short_string(rcvr_ty, &mut long_ty_path), ); - *err.long_ty_path() = file; + *err.long_ty_path() = long_ty_path; err.span_note( rcvr_expr.span, "must implement `io::Write`, `fmt::Write`, or have a `write_fmt` method", @@ -403,7 +407,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &self, self_source: SelfSource<'tcx>, method_name: Ident, - ty_str_reported: &str, + ty: Ty<'tcx>, err: &mut Diag<'_>, ) { #[derive(Debug)] @@ -478,7 +482,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } // If the shadowed binding has an itializer expression, - // use the initializer expression'ty to try to find the method again. + // use the initializer expression's ty to try to find the method again. // For example like: `let mut x = Vec::new();`, // `Vec::new()` is the itializer expression. if let Some(self_ty) = self.fcx.node_ty_opt(binding.init_hir_id) @@ -566,17 +570,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut span = MultiSpan::from_span(sugg_let.span); span.push_span_label(sugg_let.span, format!("`{rcvr_name}` of type `{self_ty}` that has method `{method_name}` defined earlier here")); + + let ty = self.tcx.short_string(ty, err.long_ty_path()); span.push_span_label( self.tcx.hir_span(recv_id), - format!( - "earlier `{rcvr_name}` shadowed here with type `{ty_str_reported}`" - ), + format!("earlier `{rcvr_name}` shadowed here with type `{ty}`"), ); err.span_note( span, format!( "there's an earlier shadowed binding `{rcvr_name}` of type `{self_ty}` \ - that has method `{method_name}` available" + that has method `{method_name}` available" ), ); } @@ -602,15 +606,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let tcx = self.tcx; let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty); let mut ty_file = None; - let (ty_str, short_ty_str) = - if trait_missing_method && let ty::Dynamic(predicates, _, _) = rcvr_ty.kind() { - (predicates.to_string(), with_forced_trimmed_paths!(predicates.to_string())) - } else { - ( - tcx.short_string(rcvr_ty, &mut ty_file), - with_forced_trimmed_paths!(rcvr_ty.to_string()), - ) - }; let is_method = mode == Mode::MethodCall; let unsatisfied_predicates = &no_match_data.unsatisfied_predicates; let similar_candidate = no_match_data.similar_candidate; @@ -629,15 +624,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // We could pass the file for long types into these two, but it isn't strictly necessary // given how targeted they are. - if let Err(guar) = self.report_failed_method_call_on_range_end( - tcx, - rcvr_ty, - source, - span, - item_ident, - &short_ty_str, - &mut ty_file, - ) { + if let Err(guar) = + self.report_failed_method_call_on_range_end(tcx, rcvr_ty, source, span, item_ident) + { return guar; } if let Err(guar) = self.report_failed_method_call_on_numerical_infer_var( @@ -647,44 +636,42 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span, item_kind, item_ident, - &short_ty_str, &mut ty_file, ) { return guar; } span = item_ident.span; - // Don't show generic arguments when the method can't be found in any implementation (#81576). - let mut ty_str_reported = ty_str.clone(); - if let ty::Adt(_, generics) = rcvr_ty.kind() { - if generics.len() > 0 { - let mut autoderef = self.autoderef(span, rcvr_ty).silence_errors(); - let candidate_found = autoderef.any(|(ty, _)| { - if let ty::Adt(adt_def, _) = ty.kind() { - self.tcx - .inherent_impls(adt_def.did()) - .into_iter() - .any(|def_id| self.associated_value(*def_id, item_ident).is_some()) - } else { - false - } - }); - let has_deref = autoderef.step_count() > 0; - if !candidate_found && !has_deref && unsatisfied_predicates.is_empty() { - if let Some((path_string, _)) = ty_str.split_once('<') { - ty_str_reported = path_string.to_string(); - } - } - } - } - let is_write = sugg_span.ctxt().outer_expn_data().macro_def_id.is_some_and(|def_id| { tcx.is_diagnostic_item(sym::write_macro, def_id) || tcx.is_diagnostic_item(sym::writeln_macro, def_id) }) && item_ident.name == sym::write_fmt; let mut err = if is_write && let SelfSource::MethodCall(rcvr_expr) = source { - self.suggest_missing_writer(rcvr_ty, rcvr_expr) + self.suggest_missing_writer(rcvr_ty, rcvr_expr, ty_file) } else { + // Don't show expanded generic arguments when the method can't be found in any + // implementation (#81576). + let mut ty = rcvr_ty; + if let ty::Adt(def, generics) = rcvr_ty.kind() { + if generics.len() > 0 { + let mut autoderef = self.autoderef(span, rcvr_ty).silence_errors(); + let candidate_found = autoderef.any(|(ty, _)| { + if let ty::Adt(adt_def, _) = ty.kind() { + self.tcx + .inherent_impls(adt_def.did()) + .into_iter() + .any(|def_id| self.associated_value(*def_id, item_ident).is_some()) + } else { + false + } + }); + let has_deref = autoderef.step_count() > 0; + if !candidate_found && !has_deref && unsatisfied_predicates.is_empty() { + ty = self.tcx.at(span).type_of(def.did()).instantiate_identity(); + } + } + } + let mut err = self.dcx().create_err(NoAssociatedItem { span, item_kind, @@ -695,16 +682,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { rcvr_ty.prefix_string(self.tcx) }, - ty_str: ty_str_reported.clone(), + ty, trait_missing_method, }); if is_method { self.suggest_use_shadowed_binding_with_method( - source, - item_ident, - &ty_str_reported, - &mut err, + source, item_ident, rcvr_ty, &mut err, ); } @@ -734,6 +718,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err }; + if tcx.sess.source_map().is_multiline(sugg_span) { err.span_label(sugg_span.with_hi(span.lo()), ""); } @@ -750,6 +735,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } if tcx.ty_is_opaque_future(rcvr_ty) && item_ident.name == sym::poll { + let ty_str = self.tcx.short_string(rcvr_ty, err.long_ty_path()); err.help(format!( "method `poll` found on `Pin<&mut {ty_str}>`, \ see documentation for `std::pin::Pin`" @@ -1339,7 +1325,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } let OnUnimplementedNote { message, label, notes, .. } = self .err_ctxt() - .on_unimplemented_note(trait_ref, &obligation, &mut ty_file); + .on_unimplemented_note(trait_ref, &obligation, err.long_ty_path()); (message, label, notes) }) .unwrap() @@ -1347,6 +1333,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (None, None, Vec::new()) }; let primary_message = primary_message.unwrap_or_else(|| { + let ty_str = self.tcx.short_string(rcvr_ty, err.long_ty_path()); format!( "the {item_kind} `{item_ident}` exists for {actual_prefix} `{ty_str}`, \ but its trait bounds were not satisfied" @@ -1409,6 +1396,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut find_candidate_for_method = false; let mut label_span_not_found = |err: &mut Diag<'_>| { + let ty_str = self.tcx.short_string(rcvr_ty, err.long_ty_path()); if unsatisfied_predicates.is_empty() { err.span_label(span, format!("{item_kind} not found in `{ty_str}`")); let is_string_or_ref_str = match rcvr_ty.kind() { @@ -2520,8 +2508,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { source: SelfSource<'tcx>, span: Span, item_name: Ident, - ty_str: &str, - long_ty_path: &mut Option, ) -> Result<(), ErrorGuaranteed> { if let SelfSource::MethodCall(expr) = source { for (_, parent) in tcx.hir_parent_iter(expr.hir_id).take(5) { @@ -2583,18 +2569,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); if pick.is_ok() { let range_span = parent_expr.span.with_hi(expr.span.hi()); - let mut err = self.dcx().create_err(errors::MissingParenthesesInRange { + return Err(self.dcx().emit_err(errors::MissingParenthesesInRange { span, - ty_str: ty_str.to_string(), + ty: actual, method_name: item_name.as_str().to_string(), add_missing_parentheses: Some(errors::AddMissingParenthesesInRange { func_name: item_name.name.as_str().to_string(), left: range_span.shrink_to_lo(), right: range_span.shrink_to_hi(), }), - }); - *err.long_ty_path() = long_ty_path.take(); - return Err(err.emit()); + })); } } } @@ -2610,7 +2594,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { span: Span, item_kind: &str, item_name: Ident, - ty_str: &str, long_ty_path: &mut Option, ) -> Result<(), ErrorGuaranteed> { let found_candidate = all_traits(self.tcx) @@ -2643,14 +2626,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && !actual.has_concrete_skeleton() && let SelfSource::MethodCall(expr) = source { + let ty_str = self.tcx.short_string(actual, long_ty_path); let mut err = struct_span_code_err!( self.dcx(), span, E0689, - "can't call {} `{}` on ambiguous numeric type `{}`", - item_kind, - item_name, - ty_str + "can't call {item_kind} `{item_name}` on ambiguous numeric type `{ty_str}`" ); *err.long_ty_path() = long_ty_path.take(); let concrete_type = if actual.is_integral() { "i32" } else { "f32" }; @@ -2792,7 +2773,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) { if let SelfSource::MethodCall(expr) = source { let mod_id = self.tcx.parent_module(expr.hir_id).to_def_id(); - for (fields, args) in self.get_field_candidates_considering_privacy_for_diag( + for fields in self.get_field_candidates_considering_privacy_for_diag( span, actual, mod_id, @@ -2831,7 +2812,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }) }, candidate_field, - args, vec![], mod_id, expr.hir_id, @@ -3671,7 +3651,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) { debug!("try_alt_rcvr: pick candidate {:?}", pick); - let did = Some(pick.item.container_id(self.tcx)); + let did = pick.item.trait_container(self.tcx); // We don't want to suggest a container type when the missing // method is `.clone()` or `.deref()` otherwise we'd suggest // `Arc::new(foo).clone()`, which is far from what the user wants. @@ -3720,8 +3700,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && !alt_rcvr_sugg // `T: !Unpin` && !unpin - // The method isn't `as_ref`, as it would provide a wrong suggestion for `Pin`. - && sym::as_ref != item_name.name // Either `Pin::as_ref` or `Pin::as_mut`. && let Some(pin_call) = pin_call // Search for `item_name` as a method accessible on `Pin`. @@ -3735,6 +3713,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // We skip some common traits that we don't want to consider because autoderefs // would take care of them. && !skippable.contains(&Some(pick.item.container_id(self.tcx))) + // Do not suggest pinning when the method is directly on `Pin`. + && pick.item.impl_container(self.tcx).map_or(true, |did| { + match self.tcx.type_of(did).skip_binder().kind() { + ty::Adt(def, _) => Some(def.did()) != self.tcx.lang_items().pin_type(), + _ => true, + } + }) // We don't want to go through derefs. && pick.autoderefs == 0 // Check that the method of the same name that was found on the new `Pin` diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 86faab62d03a..16474b231e04 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -777,7 +777,7 @@ fn test_unstable_options_tracking_hash() { tracked!( coverage_options, CoverageOptions { - level: CoverageLevel::Mcdc, + level: CoverageLevel::Branch, // (don't collapse test-only options onto the same line) discard_all_spans_in_codegen: true, } diff --git a/compiler/rustc_lint/src/lifetime_syntax.rs b/compiler/rustc_lint/src/lifetime_syntax.rs index 2a5a34cdc6e9..464f4fc34b96 100644 --- a/compiler/rustc_lint/src/lifetime_syntax.rs +++ b/compiler/rustc_lint/src/lifetime_syntax.rs @@ -434,7 +434,7 @@ fn emit_mismatch_diagnostic<'tcx>( lints::MismatchedLifetimeSyntaxesSuggestion::Mixed { implicit_suggestions, explicit_anonymous_suggestions, - tool_only: false, + optional_alternative: false, } }); @@ -455,7 +455,10 @@ fn emit_mismatch_diagnostic<'tcx>( let implicit_suggestion = should_suggest_implicit.then(|| { let suggestions = make_implicit_suggestions(&suggest_change_to_implicit); - lints::MismatchedLifetimeSyntaxesSuggestion::Implicit { suggestions, tool_only: false } + lints::MismatchedLifetimeSyntaxesSuggestion::Implicit { + suggestions, + optional_alternative: false, + } }); tracing::debug!( @@ -508,7 +511,7 @@ fn build_mismatch_suggestion( lints::MismatchedLifetimeSyntaxesSuggestion::Explicit { lifetime_name, suggestions, - tool_only: false, + optional_alternative: false, } } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index ef63c0dee8c2..ac6147b16312 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3292,7 +3292,7 @@ impl<'a, G: EmissionGuarantee> LintDiagnostic<'a, G> for MismatchedLifetimeSynta diag.subdiagnostic(s); for mut s in suggestions { - s.make_tool_only(); + s.make_optional_alternative(); diag.subdiagnostic(s); } } @@ -3303,33 +3303,33 @@ impl<'a, G: EmissionGuarantee> LintDiagnostic<'a, G> for MismatchedLifetimeSynta pub(crate) enum MismatchedLifetimeSyntaxesSuggestion { Implicit { suggestions: Vec, - tool_only: bool, + optional_alternative: bool, }, Mixed { implicit_suggestions: Vec, explicit_anonymous_suggestions: Vec<(Span, String)>, - tool_only: bool, + optional_alternative: bool, }, Explicit { lifetime_name: String, suggestions: Vec<(Span, String)>, - tool_only: bool, + optional_alternative: bool, }, } impl MismatchedLifetimeSyntaxesSuggestion { - fn make_tool_only(&mut self) { + fn make_optional_alternative(&mut self) { use MismatchedLifetimeSyntaxesSuggestion::*; - let tool_only = match self { - Implicit { tool_only, .. } | Mixed { tool_only, .. } | Explicit { tool_only, .. } => { - tool_only - } + let optional_alternative = match self { + Implicit { optional_alternative, .. } + | Mixed { optional_alternative, .. } + | Explicit { optional_alternative, .. } => optional_alternative, }; - *tool_only = true; + *optional_alternative = true; } } @@ -3337,22 +3337,40 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion { fn add_to_diag(self, diag: &mut Diag<'_, G>) { use MismatchedLifetimeSyntaxesSuggestion::*; - let style = |tool_only| { - if tool_only { SuggestionStyle::CompletelyHidden } else { SuggestionStyle::ShowAlways } + let style = |optional_alternative| { + if optional_alternative { + SuggestionStyle::CompletelyHidden + } else { + SuggestionStyle::ShowAlways + } + }; + + let applicability = |optional_alternative| { + // `cargo fix` can't handle more than one fix for the same issue, + // so hide alternative suggestions from it by marking them as maybe-incorrect + if optional_alternative { + Applicability::MaybeIncorrect + } else { + Applicability::MachineApplicable + } }; match self { - Implicit { suggestions, tool_only } => { + Implicit { suggestions, optional_alternative } => { let suggestions = suggestions.into_iter().map(|s| (s, String::new())).collect(); diag.multipart_suggestion_with_style( fluent::lint_mismatched_lifetime_syntaxes_suggestion_implicit, suggestions, - Applicability::MaybeIncorrect, - style(tool_only), + applicability(optional_alternative), + style(optional_alternative), ); } - Mixed { implicit_suggestions, explicit_anonymous_suggestions, tool_only } => { + Mixed { + implicit_suggestions, + explicit_anonymous_suggestions, + optional_alternative, + } => { let message = if implicit_suggestions.is_empty() { fluent::lint_mismatched_lifetime_syntaxes_suggestion_mixed_only_paths } else { @@ -3368,12 +3386,12 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion { diag.multipart_suggestion_with_style( message, suggestions, - Applicability::MaybeIncorrect, - style(tool_only), + applicability(optional_alternative), + style(optional_alternative), ); } - Explicit { lifetime_name, suggestions, tool_only } => { + Explicit { lifetime_name, suggestions, optional_alternative } => { diag.arg("lifetime_name", lifetime_name); let msg = diag.eagerly_translate( fluent::lint_mismatched_lifetime_syntaxes_suggestion_explicit, @@ -3382,8 +3400,8 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion { diag.multipart_suggestion_with_style( msg, suggestions, - Applicability::MaybeIncorrect, - style(tool_only), + applicability(optional_alternative), + style(optional_alternative), ); } } diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 3b84c6b61101..e660b9502627 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -2156,6 +2156,7 @@ declare_lint! { @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::FutureReleaseError, reference: "issue #52234 ", + report_in_deps: true, }; crate_level_only } @@ -2839,7 +2840,7 @@ declare_lint! { /// [issue #79813]: https://github.com/rust-lang/rust/issues/79813 /// [future-incompatible]: ../index.md#future-incompatible-lints pub SEMICOLON_IN_EXPRESSIONS_FROM_MACROS, - Warn, + Deny, "trailing semicolon in macro body used as expression", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::FutureReleaseError, @@ -2887,11 +2888,12 @@ declare_lint! { /// struct S { /* fields */ } /// ``` pub LEGACY_DERIVE_HELPERS, - Warn, + Deny, "detects derive helper attributes that are used before they are introduced", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::FutureReleaseError, reference: "issue #79202 ", + report_in_deps: true, }; } @@ -4624,11 +4626,12 @@ declare_lint! { /// /// [future-incompatible]: ../index.md#future-incompatible-lints pub PRIVATE_MACRO_USE, - Warn, + Deny, "detects certain macro bindings that should not be re-exported", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::FutureReleaseError, reference: "issue #120192 ", + report_in_deps: true, }; } @@ -4828,7 +4831,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,compile_fail /// #![doc = in_root!()] /// /// macro_rules! in_root { () => { "" } } @@ -4853,11 +4856,12 @@ declare_lint! { /// /// [future-incompatible]: ../index.md#future-incompatible-lints pub OUT_OF_SCOPE_MACRO_CALLS, - Warn, + Deny, "detects out of scope calls to `macro_rules` in key-value attributes", @future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::FutureReleaseError, reference: "issue #124535 ", + report_in_deps: true, }; } diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 069b684ad09b..6c740156c4d1 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -171,6 +171,16 @@ fn main() { let cxxflags = output(&mut cmd); let mut cfg = cc::Build::new(); cfg.warnings(false); + + // Prevent critical warnings when we're compiling from rust-lang/rust CI, + // except on MSVC, as the compiler throws warnings that are only reported + // for this platform. See https://github.com/rust-lang/rust/pull/145031#issuecomment-3162677202 + // FIXME(llvm22): It looks like the specific problem code has been removed + // in https://github.com/llvm/llvm-project/commit/e8fc808bf8e78a3c80d1f8e293a92677b92366dd, + // retry msvc once we bump our LLVM version. + if std::env::var_os("CI").is_some() && !target.contains("msvc") { + cfg.warnings_into_errors(true); + } for flag in cxxflags.split_whitespace() { // Ignore flags like `-m64` when we're doing a cross build if is_crossed && flag.starts_with("-m") { diff --git a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp index 4695de8ea09a..22e7c7a160ff 100644 --- a/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp @@ -37,28 +37,6 @@ static coverage::Counter fromRust(LLVMRustCounter Counter) { report_fatal_error("Bad LLVMRustCounterKind!"); } -struct LLVMRustMCDCDecisionParameters { - uint32_t BitmapIdx; - uint16_t NumConditions; -}; - -struct LLVMRustMCDCBranchParameters { - int16_t ConditionID; - int16_t ConditionIDs[2]; -}; - -static coverage::mcdc::BranchParameters -fromRust(LLVMRustMCDCBranchParameters Params) { - return coverage::mcdc::BranchParameters( - Params.ConditionID, {Params.ConditionIDs[0], Params.ConditionIDs[1]}); -} - -static coverage::mcdc::DecisionParameters -fromRust(LLVMRustMCDCDecisionParameters Params) { - return coverage::mcdc::DecisionParameters(Params.BitmapIdx, - Params.NumConditions); -} - // Must match the layout of // `rustc_codegen_llvm::coverageinfo::ffi::CoverageSpan`. struct LLVMRustCoverageSpan { @@ -90,22 +68,6 @@ struct LLVMRustCoverageBranchRegion { LLVMRustCounter FalseCount; }; -// Must match the layout of -// `rustc_codegen_llvm::coverageinfo::ffi::MCDCBranchRegion`. -struct LLVMRustCoverageMCDCBranchRegion { - LLVMRustCoverageSpan Span; - LLVMRustCounter TrueCount; - LLVMRustCounter FalseCount; - LLVMRustMCDCBranchParameters MCDCBranchParams; -}; - -// Must match the layout of -// `rustc_codegen_llvm::coverageinfo::ffi::MCDCDecisionRegion`. -struct LLVMRustCoverageMCDCDecisionRegion { - LLVMRustCoverageSpan Span; - LLVMRustMCDCDecisionParameters MCDCDecisionParams; -}; - // FFI equivalent of enum `llvm::coverage::CounterExpression::ExprKind` // https://github.com/rust-lang/llvm-project/blob/ea6fa9c2/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L154 enum class LLVMRustCounterExprKind { @@ -159,10 +121,7 @@ extern "C" void LLVMRustCoverageWriteFunctionMappingsToBuffer( const LLVMRustCoverageExpansionRegion *ExpansionRegions, size_t NumExpansionRegions, const LLVMRustCoverageBranchRegion *BranchRegions, size_t NumBranchRegions, - const LLVMRustCoverageMCDCBranchRegion *MCDCBranchRegions, - size_t NumMCDCBranchRegions, - const LLVMRustCoverageMCDCDecisionRegion *MCDCDecisionRegions, - size_t NumMCDCDecisionRegions, RustStringRef BufferOut) { + RustStringRef BufferOut) { // Convert from FFI representation to LLVM representation. // Expressions: @@ -176,8 +135,8 @@ extern "C" void LLVMRustCoverageWriteFunctionMappingsToBuffer( } std::vector MappingRegions; - MappingRegions.reserve(NumCodeRegions + NumBranchRegions + - NumMCDCBranchRegions + NumMCDCDecisionRegions); + MappingRegions.reserve(NumCodeRegions + NumExpansionRegions + + NumBranchRegions); // Code regions: for (const auto &Region : ArrayRef(CodeRegions, NumCodeRegions)) { @@ -201,24 +160,6 @@ extern "C" void LLVMRustCoverageWriteFunctionMappingsToBuffer( Region.Span.LineEnd, Region.Span.ColumnEnd)); } - // MC/DC branch regions: - for (const auto &Region : ArrayRef(MCDCBranchRegions, NumMCDCBranchRegions)) { - MappingRegions.push_back(coverage::CounterMappingRegion::makeBranchRegion( - fromRust(Region.TrueCount), fromRust(Region.FalseCount), - Region.Span.FileID, Region.Span.LineStart, Region.Span.ColumnStart, - Region.Span.LineEnd, Region.Span.ColumnEnd, - fromRust(Region.MCDCBranchParams))); - } - - // MC/DC decision regions: - for (const auto &Region : - ArrayRef(MCDCDecisionRegions, NumMCDCDecisionRegions)) { - MappingRegions.push_back(coverage::CounterMappingRegion::makeDecisionRegion( - fromRust(Region.MCDCDecisionParams), Region.Span.FileID, - Region.Span.LineStart, Region.Span.ColumnStart, Region.Span.LineEnd, - Region.Span.ColumnEnd)); - } - // Write the converted expressions and mappings to a byte buffer. auto CoverageMappingWriter = coverage::CoverageMappingWriter( ArrayRef(VirtualFileMappingIDs, NumVirtualFileMappingIDs), diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index 8855766ca98f..958e314efabb 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -83,7 +83,7 @@ pub fn walk_native_lib_search_dirs( // Mac Catalyst uses the macOS SDK, but to link to iOS-specific frameworks // we must have the support library stubs in the library search path (#121430). if let Some(sdk_root) = apple_sdk_root - && sess.target.llvm_target.contains("macabi") + && sess.target.env == "macabi" { f(&sdk_root.join("System/iOSSupport/usr/lib"), false)?; f(&sdk_root.join("System/iOSSupport/System/Library/Frameworks"), true)?; diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index ff9f77be9455..d42c8b947a48 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -19,13 +19,12 @@ use rustc_hir::find_attr; use rustc_hir_pretty::id_to_string; use rustc_middle::dep_graph::WorkProductId; use rustc_middle::middle::dependency_format::Linkage; -use rustc_middle::middle::exported_symbols::metadata_symbol_name; use rustc_middle::mir::interpret; use rustc_middle::query::Providers; use rustc_middle::traits::specialization_graph; +use rustc_middle::ty::AssocItemContainer; use rustc_middle::ty::codec::TyEncoder; use rustc_middle::ty::fast_reject::{self, TreatParams}; -use rustc_middle::ty::{AssocItemContainer, SymbolName}; use rustc_middle::{bug, span_bug}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque}; use rustc_session::config::{CrateType, OptLevel, TargetModifier}; @@ -2207,19 +2206,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { exported_symbols: &[(ExportedSymbol<'tcx>, SymbolExportInfo)], ) -> LazyArray<(ExportedSymbol<'static>, SymbolExportInfo)> { empty_proc_macro!(self); - // The metadata symbol name is special. It should not show up in - // downstream crates. - let metadata_symbol_name = SymbolName::new(self.tcx, &metadata_symbol_name(self.tcx)); - self.lazy_array( - exported_symbols - .iter() - .filter(|&(exported_symbol, _)| match *exported_symbol { - ExportedSymbol::NoDefId(symbol_name) => symbol_name != metadata_symbol_name, - _ => true, - }) - .cloned(), - ) + self.lazy_array(exported_symbols.iter().cloned()) } fn encode_dylib_dependency_formats(&mut self) -> LazyArray> { diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl index 69aa4383f135..69adb2fe3919 100644 --- a/compiler/rustc_middle/messages.ftl +++ b/compiler/rustc_middle/messages.ftl @@ -122,8 +122,6 @@ middle_strict_coherence_needs_negative_coherence = to use `strict_coherence` on this trait, the `with_negative_coherence` feature must be enabled .label = due to this attribute -middle_type_length_limit = reached the type-length limit while instantiating `{$shrunk}` +middle_type_length_limit = reached the type-length limit while instantiating `{$instance}` middle_unsupported_union = we don't support unions yet: '{$ty_name}' - -middle_written_to_path = the full type name has been written to '{$path}' diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs index f36ae8316531..7520bc262c6b 100644 --- a/compiler/rustc_middle/src/error.rs +++ b/compiler/rustc_middle/src/error.rs @@ -1,4 +1,4 @@ -use std::path::{Path, PathBuf}; +use std::path::Path; use std::{fmt, io}; use rustc_errors::codes::*; @@ -6,7 +6,7 @@ use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage}; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Span, Symbol}; -use crate::ty::Ty; +use crate::ty::{Instance, Ty}; #[derive(Diagnostic)] #[diag(middle_drop_check_overflow, code = E0320)] @@ -161,13 +161,10 @@ pub(crate) struct ErroneousConstant { #[derive(Diagnostic)] #[diag(middle_type_length_limit)] #[help(middle_consider_type_length_limit)] -pub(crate) struct TypeLengthLimit { +pub(crate) struct TypeLengthLimit<'tcx> { #[primary_span] pub span: Span, - pub shrunk: String, - #[note(middle_written_to_path)] - pub was_written: bool, - pub path: PathBuf, + pub instance: Instance<'tcx>, pub type_length: usize, } diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs index e26575b552ee..fd4c64b9a61c 100644 --- a/compiler/rustc_middle/src/mir/coverage.rs +++ b/compiler/rustc_middle/src/mir/coverage.rs @@ -50,25 +50,6 @@ rustc_index::newtype_index! { pub struct ExpressionId {} } -rustc_index::newtype_index! { - /// ID of a mcdc condition. Used by llvm to check mcdc coverage. - /// - /// Note for future: the max limit of 0xFFFF is probably too loose. Actually llvm does not - /// support decisions with too many conditions (7 and more at LLVM 18 while may be hundreds at 19) - /// and represents it with `int16_t`. This max value may be changed once we could - /// figure out an accurate limit. - #[derive(HashStable)] - #[encodable] - #[orderable] - #[max = 0xFFFF] - #[debug_format = "ConditionId({})"] - pub struct ConditionId {} -} - -impl ConditionId { - pub const START: Self = Self::from_usize(0); -} - /// Enum that can hold a constant zero value, the ID of an physical coverage /// counter, or the ID of a coverage-counter expression. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] @@ -109,16 +90,6 @@ pub enum CoverageKind { /// During codegen, this might be lowered to `llvm.instrprof.increment` or /// to a no-op, depending on the outcome of counter-creation. VirtualCounter { bcb: BasicCoverageBlock }, - - /// Marks the point in MIR control flow represented by a evaluated condition. - /// - /// This is eventually lowered to instruments updating mcdc temp variables. - CondBitmapUpdate { index: u32, decision_depth: u16 }, - - /// Marks the point in MIR control flow represented by a evaluated decision. - /// - /// This is eventually lowered to `llvm.instrprof.mcdc.tvbitmap.update` in LLVM IR. - TestVectorBitmapUpdate { bitmap_idx: u32, decision_depth: u16 }, } impl Debug for CoverageKind { @@ -128,12 +99,6 @@ impl Debug for CoverageKind { SpanMarker => write!(fmt, "SpanMarker"), BlockMarker { id } => write!(fmt, "BlockMarker({:?})", id.index()), VirtualCounter { bcb } => write!(fmt, "VirtualCounter({bcb:?})"), - CondBitmapUpdate { index, decision_depth } => { - write!(fmt, "CondBitmapUpdate(index={:?}, depth={:?})", index, decision_depth) - } - TestVectorBitmapUpdate { bitmap_idx, decision_depth } => { - write!(fmt, "TestVectorUpdate({:?}, depth={:?})", bitmap_idx, decision_depth) - } } } } @@ -170,14 +135,6 @@ pub enum MappingKind { Code { bcb: BasicCoverageBlock }, /// Associates a branch region with separate counters for true and false. Branch { true_bcb: BasicCoverageBlock, false_bcb: BasicCoverageBlock }, - /// Associates a branch region with separate counters for true and false. - MCDCBranch { - true_bcb: BasicCoverageBlock, - false_bcb: BasicCoverageBlock, - mcdc_params: ConditionInfo, - }, - /// Associates a decision region with a bitmap and number of conditions. - MCDCDecision(DecisionInfo), } #[derive(Clone, Debug)] @@ -201,11 +158,6 @@ pub struct FunctionCoverageInfo { pub priority_list: Vec, pub mappings: Vec, - - pub mcdc_bitmap_bits: usize, - /// The depth of the deepest decision is used to know how many - /// temp condbitmaps should be allocated for the function. - pub mcdc_num_condition_bitmaps: usize, } /// Coverage information for a function, recorded during MIR building and @@ -222,10 +174,6 @@ pub struct CoverageInfoHi { /// data structures without having to scan the entire body first. pub num_block_markers: usize, pub branch_spans: Vec, - /// Branch spans generated by mcdc. Because of some limits mcdc builder give up generating - /// decisions including them so that they are handled as normal branch spans. - pub mcdc_degraded_branch_spans: Vec, - pub mcdc_spans: Vec<(MCDCDecisionSpan, Vec)>, } #[derive(Clone, Debug)] @@ -236,39 +184,6 @@ pub struct BranchSpan { pub false_marker: BlockMarkerId, } -#[derive(Copy, Clone, Debug)] -#[derive(TyEncodable, TyDecodable, Hash, HashStable)] -pub struct ConditionInfo { - pub condition_id: ConditionId, - pub true_next_id: Option, - pub false_next_id: Option, -} - -#[derive(Clone, Debug)] -#[derive(TyEncodable, TyDecodable, Hash, HashStable)] -pub struct MCDCBranchSpan { - pub span: Span, - pub condition_info: ConditionInfo, - pub true_marker: BlockMarkerId, - pub false_marker: BlockMarkerId, -} - -#[derive(Copy, Clone, Debug)] -#[derive(TyEncodable, TyDecodable, Hash, HashStable)] -pub struct DecisionInfo { - pub bitmap_idx: u32, - pub num_conditions: u16, -} - -#[derive(Clone, Debug)] -#[derive(TyEncodable, TyDecodable, Hash, HashStable)] -pub struct MCDCDecisionSpan { - pub span: Span, - pub end_markers: Vec, - pub decision_depth: u16, - pub num_conditions: usize, -} - /// Contains information needed during codegen, obtained by inspecting the /// function's MIR after MIR optimizations. /// diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index ed067d491276..84abcf550d28 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -585,12 +585,7 @@ fn write_coverage_info_hi( coverage_info_hi: &coverage::CoverageInfoHi, w: &mut dyn io::Write, ) -> io::Result<()> { - let coverage::CoverageInfoHi { - num_block_markers: _, - branch_spans, - mcdc_degraded_branch_spans, - mcdc_spans, - } = coverage_info_hi; + let coverage::CoverageInfoHi { num_block_markers: _, branch_spans } = coverage_info_hi; // Only add an extra trailing newline if we printed at least one thing. let mut did_print = false; @@ -603,38 +598,6 @@ fn write_coverage_info_hi( did_print = true; } - for coverage::MCDCBranchSpan { span, true_marker, false_marker, .. } in - mcdc_degraded_branch_spans - { - writeln!( - w, - "{INDENT}coverage branch {{ true: {true_marker:?}, false: {false_marker:?} }} => {span:?}", - )?; - did_print = true; - } - - for ( - coverage::MCDCDecisionSpan { span, end_markers, decision_depth, num_conditions: _ }, - conditions, - ) in mcdc_spans - { - let num_conditions = conditions.len(); - writeln!( - w, - "{INDENT}coverage mcdc decision {{ num_conditions: {num_conditions:?}, end: {end_markers:?}, depth: {decision_depth:?} }} => {span:?}" - )?; - for coverage::MCDCBranchSpan { span, condition_info, true_marker, false_marker } in - conditions - { - writeln!( - w, - "{INDENT}coverage mcdc branch {{ condition_id: {:?}, true: {true_marker:?}, false: {false_marker:?} }} => {span:?}", - condition_info.condition_id - )?; - } - did_print = true; - } - if did_print { writeln!(w)?; } diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 929ebe1aee18..42a68b29ec75 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1205,18 +1205,19 @@ macro_rules! visit_place_fns { self.super_projection_elem(place_ref, elem, context, location); } - fn super_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) { - let mut context = context; - - if !place.projection.is_empty() { - if context.is_use() { - // ^ Only change the context if it is a real use, not a "use" in debuginfo. - context = if context.is_mutating_use() { - PlaceContext::MutatingUse(MutatingUseContext::Projection) - } else { - PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) - }; - } + fn super_place( + &mut self, + place: &Place<'tcx>, + mut context: PlaceContext, + location: Location, + ) { + if !place.projection.is_empty() && context.is_use() { + // ^ Only change the context if it is a real use, not a "use" in debuginfo. + context = if context.is_mutating_use() { + PlaceContext::MutatingUse(MutatingUseContext::Projection) + } else { + PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) + }; } self.visit_local(place.local, context, location); @@ -1239,7 +1240,7 @@ macro_rules! visit_place_fns { &mut self, _place_ref: PlaceRef<'tcx>, elem: PlaceElem<'tcx>, - _context: PlaceContext, + context: PlaceContext, location: Location, ) { match elem { @@ -1252,7 +1253,12 @@ macro_rules! visit_place_fns { ProjectionElem::Index(local) => { self.visit_local( local, - PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy), + if context.is_use() { + // ^ Only change the context if it is a real use, not a "use" in debuginfo. + PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) + } else { + context + }, location, ); } diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 2941808e806f..a45895765945 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1178,11 +1178,10 @@ rustc_queries! { /// Return the live symbols in the crate for dead code check. /// - /// The second return value maps from ADTs to ignored derived traits (e.g. Debug and Clone) and - /// their respective impl (i.e., part of the derive macro) + /// The second return value maps from ADTs to ignored derived traits (e.g. Debug and Clone). query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx ( LocalDefIdSet, - LocalDefIdMap> + LocalDefIdMap>, ) { arena_cache desc { "finding live symbols in crate" } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index db56082c71aa..49a4733de3b0 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -290,11 +290,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> { debug_assert_matches!(self.def_kind(def_id), DefKind::AssocTy | DefKind::AssocConst); let trait_def_id = self.parent(def_id); debug_assert_matches!(self.def_kind(trait_def_id), DefKind::Trait); - let trait_generics = self.generics_of(trait_def_id); - ( - ty::TraitRef::new_from_args(self, trait_def_id, args.truncate_to(self, trait_generics)), - &args[trait_generics.count()..], - ) + let trait_ref = ty::TraitRef::from_assoc(self, trait_def_id, args); + (trait_ref, &args[trait_ref.args.len()..]) } fn mk_args(self, args: &[Self::GenericArg]) -> ty::GenericArgsRef<'tcx> { diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index b122ada0925d..b3042904a296 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -7,14 +7,14 @@ use rustc_data_structures::fx::FxIndexMap; use rustc_errors::{ Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display, listify, pluralize, }; -use rustc_hir::def::DefKind; +use rustc_hir::def::{DefKind, Namespace}; use rustc_hir::def_id::DefId; use rustc_hir::{self as hir, AmbigArg, LangItem, PredicateOrigin, WherePredicateKind}; use rustc_span::{BytePos, Span}; use rustc_type_ir::TyKind::*; use crate::ty::{ - self, AliasTy, Const, ConstKind, FallibleTypeFolder, InferConst, InferTy, Opaque, + self, AliasTy, Const, ConstKind, FallibleTypeFolder, InferConst, InferTy, Instance, Opaque, PolyTraitPredicate, Projection, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitor, }; @@ -28,6 +28,15 @@ impl IntoDiagArg for Ty<'_> { } } +impl IntoDiagArg for Instance<'_> { + fn into_diag_arg(self, path: &mut Option) -> rustc_errors::DiagArgValue { + ty::tls::with(|tcx| { + let instance = tcx.short_string_namespace(self, path, Namespace::ValueNS); + rustc_errors::DiagArgValue::Str(std::borrow::Cow::Owned(instance)) + }) + } +} + into_diag_arg_using_display! { ty::Region<'_>, } diff --git a/compiler/rustc_middle/src/ty/error.rs b/compiler/rustc_middle/src/ty/error.rs index c24dc983d216..3f854038651a 100644 --- a/compiler/rustc_middle/src/ty/error.rs +++ b/compiler/rustc_middle/src/ty/error.rs @@ -160,7 +160,11 @@ impl<'tcx> Ty<'tcx> { _ => { let width = tcx.sess.diagnostic_width(); let length_limit = std::cmp::max(width / 4, 40); - format!("`{}`", tcx.string_with_limit(self, length_limit)).into() + format!( + "`{}`", + tcx.string_with_limit(self, length_limit, hir::def::Namespace::TypeNS) + ) + .into() } } } @@ -213,12 +217,12 @@ impl<'tcx> Ty<'tcx> { } impl<'tcx> TyCtxt<'tcx> { - pub fn string_with_limit(self, t: T, length_limit: usize) -> String + pub fn string_with_limit(self, t: T, length_limit: usize, ns: hir::def::Namespace) -> String where T: Copy + for<'a, 'b> Lift, Lifted: Print<'b, FmtPrinter<'a, 'b>>>, { let mut type_limit = 50; - let regular = FmtPrinter::print_string(self, hir::def::Namespace::TypeNS, |p| { + let regular = FmtPrinter::print_string(self, ns, |p| { self.lift(t).expect("could not lift for printing").print(p) }) .expect("could not write to `String`"); @@ -229,11 +233,7 @@ impl<'tcx> TyCtxt<'tcx> { loop { // Look for the longest properly trimmed path that still fits in length_limit. short = with_forced_trimmed_paths!({ - let mut p = FmtPrinter::new_with_limit( - self, - hir::def::Namespace::TypeNS, - rustc_session::Limit(type_limit), - ); + let mut p = FmtPrinter::new_with_limit(self, ns, rustc_session::Limit(type_limit)); self.lift(t) .expect("could not lift for printing") .print(&mut p) @@ -251,12 +251,28 @@ impl<'tcx> TyCtxt<'tcx> { /// When calling this after a `Diag` is constructed, the preferred way of doing so is /// `tcx.short_string(ty, diag.long_ty_path())`. The diagnostic itself is the one that keeps /// the existence of a "long type" anywhere in the diagnostic, so the note telling the user - /// where we wrote the file to is only printed once. + /// where we wrote the file to is only printed once. The path will use the type namespace. pub fn short_string(self, t: T, path: &mut Option) -> String where T: Copy + Hash + for<'a, 'b> Lift, Lifted: Print<'b, FmtPrinter<'a, 'b>>>, { - let regular = FmtPrinter::print_string(self, hir::def::Namespace::TypeNS, |p| { + self.short_string_namespace(t, path, hir::def::Namespace::TypeNS) + } + + /// When calling this after a `Diag` is constructed, the preferred way of doing so is + /// `tcx.short_string(ty, diag.long_ty_path())`. The diagnostic itself is the one that keeps + /// the existence of a "long type" anywhere in the diagnostic, so the note telling the user + /// where we wrote the file to is only printed once. + pub fn short_string_namespace( + self, + t: T, + path: &mut Option, + namespace: hir::def::Namespace, + ) -> String + where + T: Copy + Hash + for<'a, 'b> Lift, Lifted: Print<'b, FmtPrinter<'a, 'b>>>, + { + let regular = FmtPrinter::print_string(self, namespace, |p| { self.lift(t).expect("could not lift for printing").print(p) }) .expect("could not write to `String`"); @@ -270,7 +286,7 @@ impl<'tcx> TyCtxt<'tcx> { if regular.len() <= width * 2 / 3 { return regular; } - let short = self.string_with_limit(t, length_limit); + let short = self.string_with_limit(t, length_limit, namespace); if regular == short { return regular; } diff --git a/compiler/rustc_middle/src/ty/generic_args.rs b/compiler/rustc_middle/src/ty/generic_args.rs index b02abb5ab43b..3ade3a3ef51e 100644 --- a/compiler/rustc_middle/src/ty/generic_args.rs +++ b/compiler/rustc_middle/src/ty/generic_args.rs @@ -527,21 +527,28 @@ impl<'tcx> GenericArgs<'tcx> { #[inline] #[track_caller] pub fn type_at(&self, i: usize) -> Ty<'tcx> { - self[i].as_type().unwrap_or_else(|| bug!("expected type for param #{} in {:?}", i, self)) + self[i].as_type().unwrap_or_else( + #[track_caller] + || bug!("expected type for param #{} in {:?}", i, self), + ) } #[inline] #[track_caller] pub fn region_at(&self, i: usize) -> ty::Region<'tcx> { - self[i] - .as_region() - .unwrap_or_else(|| bug!("expected region for param #{} in {:?}", i, self)) + self[i].as_region().unwrap_or_else( + #[track_caller] + || bug!("expected region for param #{} in {:?}", i, self), + ) } #[inline] #[track_caller] pub fn const_at(&self, i: usize) -> ty::Const<'tcx> { - self[i].as_const().unwrap_or_else(|| bug!("expected const for param #{} in {:?}", i, self)) + self[i].as_const().unwrap_or_else( + #[track_caller] + || bug!("expected const for param #{} in {:?}", i, self), + ) } #[inline] @@ -578,6 +585,9 @@ impl<'tcx> GenericArgs<'tcx> { tcx.mk_args_from_iter(target_args.iter().chain(self.iter().skip(defs.count()))) } + /// Truncates this list of generic args to have at most the number of args in `generics`. + /// + /// You might be looking for [`TraitRef::from_assoc`](super::TraitRef::from_assoc). pub fn truncate_to(&self, tcx: TyCtxt<'tcx>, generics: &ty::Generics) -> GenericArgsRef<'tcx> { tcx.mk_args(&self[..generics.count()]) } diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index 16873b6ee21a..3a51f79f1216 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -1,6 +1,5 @@ use std::assert_matches::assert_matches; use std::fmt; -use std::path::PathBuf; use rustc_data_structures::fx::FxHashMap; use rustc_errors::ErrorGuaranteed; @@ -17,7 +16,7 @@ use tracing::{debug, instrument}; use crate::error; use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; use crate::ty::normalize_erasing_regions::NormalizationError; -use crate::ty::print::{FmtPrinter, Printer, shrunk_instance_name}; +use crate::ty::print::{FmtPrinter, Print}; use crate::ty::{ self, EarlyBinder, GenericArgs, GenericArgsRef, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, @@ -389,59 +388,15 @@ fn type_length<'tcx>(item: impl TypeVisitable>) -> usize { visitor.type_length } -pub fn fmt_instance( - f: &mut fmt::Formatter<'_>, - instance: Instance<'_>, - type_length: Option, -) -> fmt::Result { - ty::tls::with(|tcx| { - let args = tcx.lift(instance.args).expect("could not lift for printing"); - - let mut p = if let Some(type_length) = type_length { - FmtPrinter::new_with_limit(tcx, Namespace::ValueNS, type_length) - } else { - FmtPrinter::new(tcx, Namespace::ValueNS) - }; - p.print_def_path(instance.def_id(), args)?; - let s = p.into_buffer(); - f.write_str(&s) - })?; - - match instance.def { - InstanceKind::Item(_) => Ok(()), - InstanceKind::VTableShim(_) => write!(f, " - shim(vtable)"), - InstanceKind::ReifyShim(_, None) => write!(f, " - shim(reify)"), - InstanceKind::ReifyShim(_, Some(ReifyReason::FnPtr)) => write!(f, " - shim(reify-fnptr)"), - InstanceKind::ReifyShim(_, Some(ReifyReason::Vtable)) => write!(f, " - shim(reify-vtable)"), - InstanceKind::ThreadLocalShim(_) => write!(f, " - shim(tls)"), - InstanceKind::Intrinsic(_) => write!(f, " - intrinsic"), - InstanceKind::Virtual(_, num) => write!(f, " - virtual#{num}"), - InstanceKind::FnPtrShim(_, ty) => write!(f, " - shim({ty})"), - InstanceKind::ClosureOnceShim { .. } => write!(f, " - shim"), - InstanceKind::ConstructCoroutineInClosureShim { .. } => write!(f, " - shim"), - InstanceKind::DropGlue(_, None) => write!(f, " - shim(None)"), - InstanceKind::DropGlue(_, Some(ty)) => write!(f, " - shim(Some({ty}))"), - InstanceKind::CloneShim(_, ty) => write!(f, " - shim({ty})"), - InstanceKind::FnPtrAddrShim(_, ty) => write!(f, " - shim({ty})"), - InstanceKind::FutureDropPollShim(_, proxy_ty, impl_ty) => { - write!(f, " - dropshim({proxy_ty}-{impl_ty})") - } - InstanceKind::AsyncDropGlue(_, ty) => write!(f, " - shim({ty})"), - InstanceKind::AsyncDropGlueCtorShim(_, ty) => write!(f, " - shim(Some({ty}))"), - } -} - -pub struct ShortInstance<'tcx>(pub Instance<'tcx>, pub usize); - -impl<'tcx> fmt::Display for ShortInstance<'tcx> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt_instance(f, self.0, Some(rustc_session::Limit(self.1))) - } -} - impl<'tcx> fmt::Display for Instance<'tcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt_instance(f, *self, None) + ty::tls::with(|tcx| { + let mut p = FmtPrinter::new(tcx, Namespace::ValueNS); + let instance = tcx.lift(*self).expect("could not lift for printing"); + instance.print(&mut p)?; + let s = p.into_buffer(); + f.write_str(&s) + }) } } @@ -610,23 +565,12 @@ impl<'tcx> Instance<'tcx> { Ok(None) => { let type_length = type_length(args); if !tcx.type_length_limit().value_within_limit(type_length) { - let (shrunk, written_to_path) = - shrunk_instance_name(tcx, Instance::new_raw(def_id, args)); - let mut path = PathBuf::new(); - let was_written = if let Some(path2) = written_to_path { - path = path2; - true - } else { - false - }; tcx.dcx().emit_fatal(error::TypeLengthLimit { // We don't use `def_span(def_id)` so that diagnostics point // to the crate root during mono instead of to foreign items. // This is arguably better. span: span_or_local_def_span(), - shrunk, - was_written, - path, + instance: Instance::new_raw(def_id, args), type_length, }); } else { diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 0deb2482c6fe..8c0277055cd2 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -82,7 +82,7 @@ pub use self::context::{ TyCtxtFeed, tls, }; pub use self::fold::*; -pub use self::instance::{Instance, InstanceKind, ReifyReason, ShortInstance, UnusedGenericParams}; +pub use self::instance::{Instance, InstanceKind, ReifyReason, UnusedGenericParams}; pub use self::list::{List, ListWithCachedTypeInfo}; pub use self::opaque_types::OpaqueTypeKey; pub use self::pattern::{Pattern, PatternKind}; diff --git a/compiler/rustc_middle/src/ty/predicate.rs b/compiler/rustc_middle/src/ty/predicate.rs index 73a6f1829afe..59e00f85957e 100644 --- a/compiler/rustc_middle/src/ty/predicate.rs +++ b/compiler/rustc_middle/src/ty/predicate.rs @@ -6,8 +6,7 @@ use rustc_macros::{HashStable, extension}; use rustc_type_ir as ir; use crate::ty::{ - self, DebruijnIndex, EarlyBinder, PredicatePolarity, Ty, TyCtxt, TypeFlags, Upcast, UpcastFrom, - WithCachedTypeInfo, + self, DebruijnIndex, EarlyBinder, Ty, TyCtxt, TypeFlags, Upcast, UpcastFrom, WithCachedTypeInfo, }; pub type TraitRef<'tcx> = ir::TraitRef>; @@ -536,15 +535,6 @@ impl<'tcx> UpcastFrom, ty::Binder<'tcx, TraitRef<'tcx>>> for Clause } } -impl<'tcx> UpcastFrom, ty::Binder<'tcx, TraitRef<'tcx>>> for PolyTraitPredicate<'tcx> { - fn upcast_from(from: ty::Binder<'tcx, TraitRef<'tcx>>, _tcx: TyCtxt<'tcx>) -> Self { - from.map_bound(|trait_ref| TraitPredicate { - trait_ref, - polarity: PredicatePolarity::Positive, - }) - } -} - impl<'tcx> UpcastFrom, TraitPredicate<'tcx>> for Predicate<'tcx> { fn upcast_from(from: TraitPredicate<'tcx>, tcx: TyCtxt<'tcx>) -> Self { PredicateKind::Clause(ClauseKind::Trait(from)).upcast(tcx) diff --git a/compiler/rustc_middle/src/ty/print/mod.rs b/compiler/rustc_middle/src/ty/print/mod.rs index 8a125c7fe284..efa017074dbf 100644 --- a/compiler/rustc_middle/src/ty/print/mod.rs +++ b/compiler/rustc_middle/src/ty/print/mod.rs @@ -1,5 +1,3 @@ -use std::path::PathBuf; - use hir::def::Namespace; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sso::SsoHashSet; @@ -8,7 +6,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LocalDefId}; use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; use tracing::{debug, instrument, trace}; -use crate::ty::{self, GenericArg, ShortInstance, Ty, TyCtxt}; +use crate::ty::{self, GenericArg, Ty, TyCtxt}; // `pretty` is a separate module only for organization. mod pretty; @@ -317,6 +315,43 @@ impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for Ty<'tcx> { } } +impl<'tcx, P: Printer<'tcx> + std::fmt::Write> Print<'tcx, P> for ty::Instance<'tcx> { + fn print(&self, cx: &mut P) -> Result<(), PrintError> { + cx.print_def_path(self.def_id(), self.args)?; + match self.def { + ty::InstanceKind::Item(_) => {} + ty::InstanceKind::VTableShim(_) => cx.write_str(" - shim(vtable)")?, + ty::InstanceKind::ReifyShim(_, None) => cx.write_str(" - shim(reify)")?, + ty::InstanceKind::ReifyShim(_, Some(ty::ReifyReason::FnPtr)) => { + cx.write_str(" - shim(reify-fnptr)")? + } + ty::InstanceKind::ReifyShim(_, Some(ty::ReifyReason::Vtable)) => { + cx.write_str(" - shim(reify-vtable)")? + } + ty::InstanceKind::ThreadLocalShim(_) => cx.write_str(" - shim(tls)")?, + ty::InstanceKind::Intrinsic(_) => cx.write_str(" - intrinsic")?, + ty::InstanceKind::Virtual(_, num) => cx.write_str(&format!(" - virtual#{num}"))?, + ty::InstanceKind::FnPtrShim(_, ty) => cx.write_str(&format!(" - shim({ty})"))?, + ty::InstanceKind::ClosureOnceShim { .. } => cx.write_str(" - shim")?, + ty::InstanceKind::ConstructCoroutineInClosureShim { .. } => cx.write_str(" - shim")?, + ty::InstanceKind::DropGlue(_, None) => cx.write_str(" - shim(None)")?, + ty::InstanceKind::DropGlue(_, Some(ty)) => { + cx.write_str(&format!(" - shim(Some({ty}))"))? + } + ty::InstanceKind::CloneShim(_, ty) => cx.write_str(&format!(" - shim({ty})"))?, + ty::InstanceKind::FnPtrAddrShim(_, ty) => cx.write_str(&format!(" - shim({ty})"))?, + ty::InstanceKind::FutureDropPollShim(_, proxy_ty, impl_ty) => { + cx.write_str(&format!(" - dropshim({proxy_ty}-{impl_ty})"))? + } + ty::InstanceKind::AsyncDropGlue(_, ty) => cx.write_str(&format!(" - shim({ty})"))?, + ty::InstanceKind::AsyncDropGlueCtorShim(_, ty) => { + cx.write_str(&format!(" - shim(Some({ty}))"))? + } + }; + Ok(()) + } +} + impl<'tcx, P: Printer<'tcx>> Print<'tcx, P> for &'tcx ty::List> { fn print(&self, p: &mut P) -> Result<(), PrintError> { p.print_dyn_existential(self) @@ -356,31 +391,3 @@ where with_no_trimmed_paths!(Self::print(t, fmt)) } } - -/// Format instance name that is already known to be too long for rustc. -/// Show only the first 2 types if it is longer than 32 characters to avoid blasting -/// the user's terminal with thousands of lines of type-name. -/// -/// If the type name is longer than before+after, it will be written to a file. -pub fn shrunk_instance_name<'tcx>( - tcx: TyCtxt<'tcx>, - instance: ty::Instance<'tcx>, -) -> (String, Option) { - let s = instance.to_string(); - - // Only use the shrunk version if it's really shorter. - // This also avoids the case where before and after slices overlap. - if s.chars().nth(33).is_some() { - let shrunk = format!("{}", ShortInstance(instance, 4)); - if shrunk == s { - return (s, None); - } - - let path = tcx.output_filenames(()).temp_path_for_diagnostic("long-type.txt"); - let written_to_path = std::fs::write(&path, s).ok().map(|_| path); - - (shrunk, written_to_path) - } else { - (s, None) - } -} diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index b381d62be47e..67244e767cbe 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2987,7 +2987,7 @@ impl<'tcx> ty::Binder<'tcx, ty::TraitRef<'tcx>> { } } -#[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift)] +#[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift, Hash)] pub struct TraitPredPrintModifiersAndPath<'tcx>(ty::TraitPredicate<'tcx>); impl<'tcx> fmt::Debug for TraitPredPrintModifiersAndPath<'tcx> { diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl index 287639de663c..83fbcb30dd94 100644 --- a/compiler/rustc_mir_build/messages.ftl +++ b/compiler/rustc_mir_build/messages.ftl @@ -121,8 +121,6 @@ mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed = .note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior .label = dereference of raw pointer -mir_build_exceeds_mcdc_condition_limit = number of conditions in decision ({$num_conditions}) exceeds limit ({$max_conditions}), so MC/DC analysis will not count this expression - mir_build_extern_static_requires_unsafe = use of extern static is unsafe and requires unsafe block .note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior diff --git a/compiler/rustc_mir_build/src/builder/block.rs b/compiler/rustc_mir_build/src/builder/block.rs index a71196f79d78..566d89f4269c 100644 --- a/compiler/rustc_mir_build/src/builder/block.rs +++ b/compiler/rustc_mir_build/src/builder/block.rs @@ -6,7 +6,7 @@ use rustc_span::Span; use tracing::debug; use crate::builder::ForGuard::OutsideGuard; -use crate::builder::matches::{DeclareLetBindings, EmitStorageLive, ScheduleDrops}; +use crate::builder::matches::{DeclareLetBindings, ScheduleDrops}; use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; impl<'a, 'tcx> Builder<'a, 'tcx> { @@ -199,15 +199,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { None, Some((Some(&destination), initializer_span)), ); - this.visit_primary_bindings(pattern, &mut |this, node, span| { - this.storage_live_binding( - block, - node, - span, - OutsideGuard, - ScheduleDrops::Yes, - ); - }); let else_block_span = this.thir[*else_block].span; let (matching, failure) = this.in_if_then_scope(last_remainder_scope, else_block_span, |this| { @@ -218,7 +209,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { None, initializer_span, DeclareLetBindings::No, - EmitStorageLive::No, ) }); matching.and(failure) diff --git a/compiler/rustc_mir_build/src/builder/coverageinfo.rs b/compiler/rustc_mir_build/src/builder/coverageinfo.rs index aa43b273cff5..14199c209217 100644 --- a/compiler/rustc_mir_build/src/builder/coverageinfo.rs +++ b/compiler/rustc_mir_build/src/builder/coverageinfo.rs @@ -8,11 +8,8 @@ use rustc_middle::thir::{ExprId, ExprKind, Pat, Thir}; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::LocalDefId; -use crate::builder::coverageinfo::mcdc::MCDCInfoBuilder; use crate::builder::{Builder, CFG}; -mod mcdc; - /// Collects coverage-related information during MIR building, to eventually be /// turned into a function's [`CoverageInfoHi`] when MIR building is complete. pub(crate) struct CoverageInfoBuilder { @@ -23,8 +20,6 @@ pub(crate) struct CoverageInfoBuilder { /// Present if branch coverage is enabled. branch_info: Option, - /// Present if MC/DC coverage is enabled. - mcdc_info: Option, } #[derive(Default)] @@ -83,7 +78,6 @@ impl CoverageInfoBuilder { nots: FxHashMap::default(), markers: BlockMarkerGen::default(), branch_info: tcx.sess.instrument_coverage_branch().then(BranchInfo::default), - mcdc_info: tcx.sess.instrument_coverage_mcdc().then(MCDCInfoBuilder::new), }) } @@ -135,26 +129,11 @@ impl CoverageInfoBuilder { fn register_two_way_branch<'tcx>( &mut self, - tcx: TyCtxt<'tcx>, cfg: &mut CFG<'tcx>, source_info: SourceInfo, true_block: BasicBlock, false_block: BasicBlock, ) { - // Separate path for handling branches when MC/DC is enabled. - if let Some(mcdc_info) = self.mcdc_info.as_mut() { - let inject_block_marker = - |source_info, block| self.markers.inject_block_marker(cfg, source_info, block); - mcdc_info.visit_evaluated_condition( - tcx, - source_info, - true_block, - false_block, - inject_block_marker, - ); - return; - } - // Bail out if branch coverage is not enabled. let Some(branch_info) = self.branch_info.as_mut() else { return }; @@ -169,23 +148,14 @@ impl CoverageInfoBuilder { } pub(crate) fn into_done(self) -> Box { - let Self { nots: _, markers: BlockMarkerGen { num_block_markers }, branch_info, mcdc_info } = - self; + let Self { nots: _, markers: BlockMarkerGen { num_block_markers }, branch_info } = self; let branch_spans = branch_info.map(|branch_info| branch_info.branch_spans).unwrap_or_default(); - let (mcdc_spans, mcdc_degraded_branch_spans) = - mcdc_info.map(MCDCInfoBuilder::into_done).unwrap_or_default(); - // For simplicity, always return an info struct (without Option), even // if there's nothing interesting in it. - Box::new(CoverageInfoHi { - num_block_markers, - branch_spans, - mcdc_degraded_branch_spans, - mcdc_spans, - }) + Box::new(CoverageInfoHi { num_block_markers, branch_spans }) } } @@ -238,14 +208,7 @@ impl<'tcx> Builder<'_, 'tcx> { mir::TerminatorKind::if_(mir::Operand::Copy(place), true_block, false_block), ); - // Separate path for handling branches when MC/DC is enabled. - coverage_info.register_two_way_branch( - self.tcx, - &mut self.cfg, - source_info, - true_block, - false_block, - ); + coverage_info.register_two_way_branch(&mut self.cfg, source_info, true_block, false_block); let join_block = self.cfg.start_new_block(); self.cfg.goto(true_block, source_info, join_block); @@ -276,13 +239,7 @@ impl<'tcx> Builder<'_, 'tcx> { let source_info = SourceInfo { span: self.thir[expr_id].span, scope: self.source_scope }; - coverage_info.register_two_way_branch( - self.tcx, - &mut self.cfg, - source_info, - then_block, - else_block, - ); + coverage_info.register_two_way_branch(&mut self.cfg, source_info, then_block, else_block); } /// If branch coverage is enabled, inject marker statements into `true_block` @@ -299,12 +256,6 @@ impl<'tcx> Builder<'_, 'tcx> { let Some(coverage_info) = self.coverage_info.as_mut() else { return }; let source_info = SourceInfo { span: pattern.span, scope: self.source_scope }; - coverage_info.register_two_way_branch( - self.tcx, - &mut self.cfg, - source_info, - true_block, - false_block, - ); + coverage_info.register_two_way_branch(&mut self.cfg, source_info, true_block, false_block); } } diff --git a/compiler/rustc_mir_build/src/builder/coverageinfo/mcdc.rs b/compiler/rustc_mir_build/src/builder/coverageinfo/mcdc.rs deleted file mode 100644 index 6b4871dc1fcc..000000000000 --- a/compiler/rustc_mir_build/src/builder/coverageinfo/mcdc.rs +++ /dev/null @@ -1,295 +0,0 @@ -use std::collections::VecDeque; - -use rustc_middle::bug; -use rustc_middle::mir::coverage::{ - BlockMarkerId, ConditionId, ConditionInfo, MCDCBranchSpan, MCDCDecisionSpan, -}; -use rustc_middle::mir::{BasicBlock, SourceInfo}; -use rustc_middle::thir::LogicalOp; -use rustc_middle::ty::TyCtxt; -use rustc_span::Span; - -use crate::builder::Builder; -use crate::errors::MCDCExceedsConditionLimit; - -/// LLVM uses `i16` to represent condition id. Hence `i16::MAX` is the hard limit for number of -/// conditions in a decision. -const MAX_CONDITIONS_IN_DECISION: usize = i16::MAX as usize; - -#[derive(Default)] -struct MCDCDecisionCtx { - /// To construct condition evaluation tree. - decision_stack: VecDeque, - processing_decision: Option, - conditions: Vec, -} - -struct MCDCState { - decision_ctx_stack: Vec, -} - -impl MCDCState { - fn new() -> Self { - Self { decision_ctx_stack: vec![MCDCDecisionCtx::default()] } - } - - /// Decision depth is given as a u16 to reduce the size of the `CoverageKind`, - /// as it is very unlikely that the depth ever reaches 2^16. - #[inline] - fn decision_depth(&self) -> u16 { - match u16::try_from(self.decision_ctx_stack.len()) - .expect( - "decision depth did not fit in u16, this is likely to be an instrumentation error", - ) - .checked_sub(1) - { - Some(d) => d, - None => bug!("Unexpected empty decision stack"), - } - } - - // At first we assign ConditionIds for each sub expression. - // If the sub expression is composite, re-assign its ConditionId to its LHS and generate a new ConditionId for its RHS. - // - // Example: "x = (A && B) || (C && D) || (D && F)" - // - // Visit Depth1: - // (A && B) || (C && D) || (D && F) - // ^-------LHS--------^ ^-RHS--^ - // ID=1 ID=2 - // - // Visit LHS-Depth2: - // (A && B) || (C && D) - // ^-LHS--^ ^-RHS--^ - // ID=1 ID=3 - // - // Visit LHS-Depth3: - // (A && B) - // LHS RHS - // ID=1 ID=4 - // - // Visit RHS-Depth3: - // (C && D) - // LHS RHS - // ID=3 ID=5 - // - // Visit RHS-Depth2: (D && F) - // LHS RHS - // ID=2 ID=6 - // - // Visit Depth1: - // (A && B) || (C && D) || (D && F) - // ID=1 ID=4 ID=3 ID=5 ID=2 ID=6 - // - // A node ID of '0' always means MC/DC isn't being tracked. - // - // If a "next" node ID is '0', it means it's the end of the test vector. - // - // As the compiler tracks expression in pre-order, we can ensure that condition info of parents are always properly assigned when their children are visited. - // - If the op is AND, the "false_next" of LHS and RHS should be the parent's "false_next". While "true_next" of the LHS is the RHS, the "true next" of RHS is the parent's "true_next". - // - If the op is OR, the "true_next" of LHS and RHS should be the parent's "true_next". While "false_next" of the LHS is the RHS, the "false next" of RHS is the parent's "false_next". - fn record_conditions(&mut self, op: LogicalOp, span: Span) { - let decision_depth = self.decision_depth(); - let Some(decision_ctx) = self.decision_ctx_stack.last_mut() else { - bug!("Unexpected empty decision_ctx_stack") - }; - let decision = match decision_ctx.processing_decision.as_mut() { - Some(decision) => { - decision.span = decision.span.to(span); - decision - } - None => decision_ctx.processing_decision.insert(MCDCDecisionSpan { - span, - num_conditions: 0, - end_markers: vec![], - decision_depth, - }), - }; - - let parent_condition = decision_ctx.decision_stack.pop_back().unwrap_or_else(|| { - assert_eq!( - decision.num_conditions, 0, - "decision stack must be empty only for empty decision" - ); - decision.num_conditions += 1; - ConditionInfo { - condition_id: ConditionId::START, - true_next_id: None, - false_next_id: None, - } - }); - let lhs_id = parent_condition.condition_id; - - let rhs_condition_id = ConditionId::from(decision.num_conditions); - decision.num_conditions += 1; - let (lhs, rhs) = match op { - LogicalOp::And => { - let lhs = ConditionInfo { - condition_id: lhs_id, - true_next_id: Some(rhs_condition_id), - false_next_id: parent_condition.false_next_id, - }; - let rhs = ConditionInfo { - condition_id: rhs_condition_id, - true_next_id: parent_condition.true_next_id, - false_next_id: parent_condition.false_next_id, - }; - (lhs, rhs) - } - LogicalOp::Or => { - let lhs = ConditionInfo { - condition_id: lhs_id, - true_next_id: parent_condition.true_next_id, - false_next_id: Some(rhs_condition_id), - }; - let rhs = ConditionInfo { - condition_id: rhs_condition_id, - true_next_id: parent_condition.true_next_id, - false_next_id: parent_condition.false_next_id, - }; - (lhs, rhs) - } - }; - // We visit expressions tree in pre-order, so place the left-hand side on the top. - decision_ctx.decision_stack.push_back(rhs); - decision_ctx.decision_stack.push_back(lhs); - } - - fn try_finish_decision( - &mut self, - span: Span, - true_marker: BlockMarkerId, - false_marker: BlockMarkerId, - degraded_branches: &mut Vec, - ) -> Option<(MCDCDecisionSpan, Vec)> { - let Some(decision_ctx) = self.decision_ctx_stack.last_mut() else { - bug!("Unexpected empty decision_ctx_stack") - }; - let Some(condition_info) = decision_ctx.decision_stack.pop_back() else { - let branch = MCDCBranchSpan { - span, - condition_info: ConditionInfo { - condition_id: ConditionId::START, - true_next_id: None, - false_next_id: None, - }, - true_marker, - false_marker, - }; - degraded_branches.push(branch); - return None; - }; - let Some(decision) = decision_ctx.processing_decision.as_mut() else { - bug!("Processing decision should have been created before any conditions are taken"); - }; - if condition_info.true_next_id.is_none() { - decision.end_markers.push(true_marker); - } - if condition_info.false_next_id.is_none() { - decision.end_markers.push(false_marker); - } - decision_ctx.conditions.push(MCDCBranchSpan { - span, - condition_info, - true_marker, - false_marker, - }); - - if decision_ctx.decision_stack.is_empty() { - let conditions = std::mem::take(&mut decision_ctx.conditions); - decision_ctx.processing_decision.take().map(|decision| (decision, conditions)) - } else { - None - } - } -} - -pub(crate) struct MCDCInfoBuilder { - degraded_spans: Vec, - mcdc_spans: Vec<(MCDCDecisionSpan, Vec)>, - state: MCDCState, -} - -impl MCDCInfoBuilder { - pub(crate) fn new() -> Self { - Self { degraded_spans: vec![], mcdc_spans: vec![], state: MCDCState::new() } - } - - pub(crate) fn visit_evaluated_condition( - &mut self, - tcx: TyCtxt<'_>, - source_info: SourceInfo, - true_block: BasicBlock, - false_block: BasicBlock, - mut inject_block_marker: impl FnMut(SourceInfo, BasicBlock) -> BlockMarkerId, - ) { - let true_marker = inject_block_marker(source_info, true_block); - let false_marker = inject_block_marker(source_info, false_block); - - // take_condition() returns Some for decision_result when the decision stack - // is empty, i.e. when all the conditions of the decision were instrumented, - // and the decision is "complete". - if let Some((decision, conditions)) = self.state.try_finish_decision( - source_info.span, - true_marker, - false_marker, - &mut self.degraded_spans, - ) { - let num_conditions = conditions.len(); - assert_eq!( - num_conditions, decision.num_conditions, - "final number of conditions is not correct" - ); - match num_conditions { - 0 => { - unreachable!("Decision with no condition is not expected"); - } - 1..=MAX_CONDITIONS_IN_DECISION => { - self.mcdc_spans.push((decision, conditions)); - } - _ => { - self.degraded_spans.extend(conditions); - - tcx.dcx().emit_warn(MCDCExceedsConditionLimit { - span: decision.span, - num_conditions, - max_conditions: MAX_CONDITIONS_IN_DECISION, - }); - } - } - } - } - - pub(crate) fn into_done( - self, - ) -> (Vec<(MCDCDecisionSpan, Vec)>, Vec) { - (self.mcdc_spans, self.degraded_spans) - } -} - -impl Builder<'_, '_> { - pub(crate) fn visit_coverage_branch_operation(&mut self, logical_op: LogicalOp, span: Span) { - if let Some(coverage_info) = self.coverage_info.as_mut() - && let Some(mcdc_info) = coverage_info.mcdc_info.as_mut() - { - mcdc_info.state.record_conditions(logical_op, span); - } - } - - pub(crate) fn mcdc_increment_depth_if_enabled(&mut self) { - if let Some(coverage_info) = self.coverage_info.as_mut() - && let Some(mcdc_info) = coverage_info.mcdc_info.as_mut() - { - mcdc_info.state.decision_ctx_stack.push(MCDCDecisionCtx::default()); - }; - } - - pub(crate) fn mcdc_decrement_depth_if_enabled(&mut self) { - if let Some(coverage_info) = self.coverage_info.as_mut() - && let Some(mcdc_info) = coverage_info.mcdc_info.as_mut() - && mcdc_info.state.decision_ctx_stack.pop().is_none() - { - bug!("Unexpected empty decision stack"); - }; - } -} diff --git a/compiler/rustc_mir_build/src/builder/expr/into.rs b/compiler/rustc_mir_build/src/builder/expr/into.rs index 82b883a99a11..eb99c184bd29 100644 --- a/compiler/rustc_mir_build/src/builder/expr/into.rs +++ b/compiler/rustc_mir_build/src/builder/expr/into.rs @@ -159,8 +159,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let condition_scope = this.local_scope(); let source_info = this.source_info(expr.span); - this.visit_coverage_branch_operation(op, expr.span); - // We first evaluate the left-hand side of the predicate ... let (then_block, else_block) = this.in_if_then_scope(condition_scope, expr.span, |this| { diff --git a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs index 3a7854a5e118..7a848536d0e3 100644 --- a/compiler/rustc_mir_build/src/builder/matches/match_pair.rs +++ b/compiler/rustc_mir_build/src/builder/matches/match_pair.rs @@ -124,9 +124,19 @@ impl<'tcx> MatchPairTree<'tcx> { let test_case = match pattern.kind { PatKind::Missing | PatKind::Wild | PatKind::Error(_) => None, - PatKind::Or { ref pats } => Some(TestCase::Or { - pats: pats.iter().map(|pat| FlatPat::new(place_builder.clone(), pat, cx)).collect(), - }), + PatKind::Or { ref pats } => { + let pats: Box<[FlatPat<'tcx>]> = + pats.iter().map(|pat| FlatPat::new(place_builder.clone(), pat, cx)).collect(); + if !pats[0].extra_data.bindings.is_empty() { + // Hold a place for any bindings established in (possibly-nested) or-patterns. + // By only holding a place when bindings are present, we skip over any + // or-patterns that will be simplified by `merge_trivial_subcandidates`. In + // other words, we can assume this expands into subcandidates. + // FIXME(@dianne): this needs updating/removing if we always merge or-patterns + extra_data.bindings.push(super::SubpatternBindings::FromOrPattern); + } + Some(TestCase::Or { pats }) + } PatKind::Range(ref range) => { if range.is_full_range(cx.tcx) == Some(true) { @@ -194,12 +204,12 @@ impl<'tcx> MatchPairTree<'tcx> { // Then push this binding, after any bindings in the subpattern. if let Some(source) = place { - extra_data.bindings.push(super::Binding { + extra_data.bindings.push(super::SubpatternBindings::One(super::Binding { span: pattern.span, source, var_id: var, binding_mode: mode, - }); + })); } None diff --git a/compiler/rustc_mir_build/src/builder/matches/mod.rs b/compiler/rustc_mir_build/src/builder/matches/mod.rs index 2c29b8628417..7e25a173bf82 100644 --- a/compiler/rustc_mir_build/src/builder/matches/mod.rs +++ b/compiler/rustc_mir_build/src/builder/matches/mod.rs @@ -5,11 +5,11 @@ //! This also includes code for pattern bindings in `let` statements and //! function parameters. -use std::assert_matches::assert_matches; use std::borrow::Borrow; use std::mem; use std::sync::Arc; +use itertools::{Itertools, Position}; use rustc_abi::VariantIdx; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::stack::ensure_sufficient_stack; @@ -69,18 +69,6 @@ pub(crate) enum DeclareLetBindings { LetNotPermitted, } -/// Used by [`Builder::bind_matched_candidate_for_arm_body`] to determine -/// whether or not to call [`Builder::storage_live_binding`] to emit -/// [`StatementKind::StorageLive`]. -#[derive(Clone, Copy)] -pub(crate) enum EmitStorageLive { - /// Yes, emit `StorageLive` as normal. - Yes, - /// No, don't emit `StorageLive`. The caller has taken responsibility for - /// emitting `StorageLive` as appropriate. - No, -} - /// Used by [`Builder::storage_live_binding`] and [`Builder::bind_matched_candidate_for_arm_body`] /// to decide whether to schedule drops. #[derive(Clone, Copy, Debug)] @@ -125,15 +113,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let expr_span = expr.span; match expr.kind { - ExprKind::LogicalOp { op: op @ LogicalOp::And, lhs, rhs } => { - this.visit_coverage_branch_operation(op, expr_span); + ExprKind::LogicalOp { op: LogicalOp::And, lhs, rhs } => { let lhs_then_block = this.then_else_break_inner(block, lhs, args).into_block(); let rhs_then_block = this.then_else_break_inner(lhs_then_block, rhs, args).into_block(); rhs_then_block.unit() } - ExprKind::LogicalOp { op: op @ LogicalOp::Or, lhs, rhs } => { - this.visit_coverage_branch_operation(op, expr_span); + ExprKind::LogicalOp { op: LogicalOp::Or, lhs, rhs } => { let local_scope = this.local_scope(); let (lhs_success_block, failure_block) = this.in_if_then_scope(local_scope, expr_span, |this| { @@ -207,16 +193,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { Some(args.variable_source_info.scope), args.variable_source_info.span, args.declare_let_bindings, - EmitStorageLive::Yes, ), _ => { let mut block = block; let temp_scope = args.temp_scope_override.unwrap_or_else(|| this.local_scope()); let mutability = Mutability::Mut; - // Increment the decision depth, in case we encounter boolean expressions - // further down. - this.mcdc_increment_depth_if_enabled(); let place = unpack!( block = this.as_temp( block, @@ -228,7 +210,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { mutability ) ); - this.mcdc_decrement_depth_if_enabled(); let operand = Operand::Move(Place::from(place)); @@ -479,7 +460,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &built_match_tree.fake_borrow_temps, scrutinee_span, Some((arm, match_scope)), - EmitStorageLive::Yes, ); this.fixed_temps_scope = old_dedup_scope; @@ -533,7 +513,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { fake_borrow_temps: &[(Place<'tcx>, Local, FakeBorrowKind)], scrutinee_span: Span, arm_match_scope: Option<(&Arm<'tcx>, region::Scope)>, - emit_storage_live: EmitStorageLive, ) -> BasicBlock { if branch.sub_branches.len() == 1 { let [sub_branch] = branch.sub_branches.try_into().unwrap(); @@ -544,7 +523,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { scrutinee_span, arm_match_scope, ScheduleDrops::Yes, - emit_storage_live, ) } else { // It's helpful to avoid scheduling drops multiple times to save @@ -561,27 +539,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // return: it isn't bound by move until right before enter the arm. // To handle this we instead unschedule it's drop after each time // we lower the guard. + // As a result, we end up with the drop order of the last sub-branch we lower. To use + // the drop order for the first sub-branch, we lower sub-branches in reverse (#142163). let target_block = self.cfg.start_new_block(); - let mut schedule_drops = ScheduleDrops::Yes; - let arm = arm_match_scope.unzip().0; - // We keep a stack of all of the bindings and type ascriptions - // from the parent candidates that we visit, that also need to - // be bound for each candidate. - for sub_branch in branch.sub_branches { - if let Some(arm) = arm { - self.clear_top_scope(arm.scope); - } + for (pos, sub_branch) in branch.sub_branches.into_iter().rev().with_position() { + debug_assert!(pos != Position::Only); + let schedule_drops = + if pos == Position::Last { ScheduleDrops::Yes } else { ScheduleDrops::No }; let binding_end = self.bind_and_guard_matched_candidate( sub_branch, fake_borrow_temps, scrutinee_span, arm_match_scope, schedule_drops, - emit_storage_live, ); - if arm.is_none() { - schedule_drops = ScheduleDrops::No; - } self.cfg.goto(binding_end, outer_source_info, target_block); } @@ -741,7 +712,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { &[], irrefutable_pat.span, None, - EmitStorageLive::Yes, ) .unit() } @@ -996,7 +966,7 @@ struct PatternExtraData<'tcx> { span: Span, /// Bindings that must be established. - bindings: Vec>, + bindings: Vec>, /// Types that must be asserted. ascriptions: Vec>, @@ -1011,6 +981,15 @@ impl<'tcx> PatternExtraData<'tcx> { } } +#[derive(Debug, Clone)] +enum SubpatternBindings<'tcx> { + /// A single binding. + One(Binding<'tcx>), + /// Holds the place for an or-pattern's bindings. This ensures their drops are scheduled in the + /// order the primary bindings appear. See rust-lang/rust#142163 for more information. + FromOrPattern, +} + /// A pattern in a form suitable for lowering the match tree, with all irrefutable /// patterns simplified away. /// @@ -1226,7 +1205,7 @@ fn traverse_candidate<'tcx, C, T, I>( } } -#[derive(Clone, Debug)] +#[derive(Clone, Copy, Debug)] struct Binding<'tcx> { span: Span, source: Place<'tcx>, @@ -1452,12 +1431,7 @@ impl<'tcx> MatchTreeSubBranch<'tcx> { span: candidate.extra_data.span, success_block: candidate.pre_binding_block.unwrap(), otherwise_block: candidate.otherwise_block.unwrap(), - bindings: parent_data - .iter() - .flat_map(|d| &d.bindings) - .chain(&candidate.extra_data.bindings) - .cloned() - .collect(), + bindings: sub_branch_bindings(parent_data, &candidate.extra_data.bindings), ascriptions: parent_data .iter() .flat_map(|d| &d.ascriptions) @@ -1490,6 +1464,68 @@ impl<'tcx> MatchTreeBranch<'tcx> { } } +/// Collects the bindings for a [`MatchTreeSubBranch`], preserving the order they appear in the +/// pattern, as though the or-alternatives chosen in this sub-branch were inlined. +fn sub_branch_bindings<'tcx>( + parents: &[PatternExtraData<'tcx>], + leaf_bindings: &[SubpatternBindings<'tcx>], +) -> Vec> { + // In the common case, all bindings will be in leaves. Allocate to fit the leaf's bindings. + let mut all_bindings = Vec::with_capacity(leaf_bindings.len()); + let mut remainder = parents + .iter() + .map(|parent| parent.bindings.as_slice()) + .chain([leaf_bindings]) + // Skip over unsimplified or-patterns without bindings. + .filter(|bindings| !bindings.is_empty()); + if let Some(candidate_bindings) = remainder.next() { + push_sub_branch_bindings(&mut all_bindings, candidate_bindings, &mut remainder); + } + // Make sure we've included all bindings. For ill-formed patterns like `(x, _ | y)`, we may not + // have collected all bindings yet, since we only check the first alternative when determining + // whether to inline subcandidates' bindings. + // FIXME(@dianne): prevent ill-formed patterns from getting here + while let Some(candidate_bindings) = remainder.next() { + ty::tls::with(|tcx| { + tcx.dcx().delayed_bug("mismatched or-pattern bindings but no error emitted") + }); + // To recover, we collect the rest in an arbitrary order. + push_sub_branch_bindings(&mut all_bindings, candidate_bindings, &mut remainder); + } + all_bindings +} + +/// Helper for [`sub_branch_bindings`]. Collects bindings from `candidate_bindings` into +/// `flattened`. Bindings in or-patterns are collected recursively from `remainder`. +fn push_sub_branch_bindings<'c, 'tcx: 'c>( + flattened: &mut Vec>, + candidate_bindings: &'c [SubpatternBindings<'tcx>], + remainder: &mut impl Iterator]>, +) { + for subpat_bindings in candidate_bindings { + match subpat_bindings { + SubpatternBindings::One(binding) => flattened.push(*binding), + SubpatternBindings::FromOrPattern => { + // Inline bindings from an or-pattern. By construction, this always + // corresponds to a subcandidate and its closest descendants (i.e. those + // from nested or-patterns, but not adjacent or-patterns). To handle + // adjacent or-patterns, e.g. `(x | x, y | y)`, we update the `remainder` to + // point to the first descendant candidate from outside this or-pattern. + if let Some(subcandidate_bindings) = remainder.next() { + push_sub_branch_bindings(flattened, subcandidate_bindings, remainder); + } else { + // For ill-formed patterns like `x | _`, we may not have any subcandidates left + // to inline bindings from. + // FIXME(@dianne): prevent ill-formed patterns from getting here + ty::tls::with(|tcx| { + tcx.dcx().delayed_bug("mismatched or-pattern bindings but no error emitted") + }); + }; + } + } + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) enum HasMatchGuard { Yes, @@ -2364,7 +2400,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { source_scope: Option, scope_span: Span, declare_let_bindings: DeclareLetBindings, - emit_storage_live: EmitStorageLive, ) -> BlockAnd<()> { let expr_span = self.thir[expr_id].span; let scrutinee = unpack!(block = self.lower_scrutinee(block, expr_id, expr_span)); @@ -2398,14 +2433,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } - let success = self.bind_pattern( - self.source_info(pat.span), - branch, - &[], - expr_span, - None, - emit_storage_live, - ); + let success = self.bind_pattern(self.source_info(pat.span), branch, &[], expr_span, None); // If branch coverage is enabled, record this branch. self.visit_coverage_conditional_let(pat, success, built_tree.otherwise_block); @@ -2428,7 +2456,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { scrutinee_span: Span, arm_match_scope: Option<(&Arm<'tcx>, region::Scope)>, schedule_drops: ScheduleDrops, - emit_storage_live: EmitStorageLive, ) -> BasicBlock { debug!("bind_and_guard_matched_candidate(subbranch={:?})", sub_branch); @@ -2453,11 +2480,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // Bindings for guards require some extra handling to automatically // insert implicit references/dereferences. - self.bind_matched_candidate_for_guard( - block, - schedule_drops, - sub_branch.bindings.iter(), - ); + // This always schedules storage drops, so we may need to unschedule them below. + self.bind_matched_candidate_for_guard(block, sub_branch.bindings.iter()); let guard_frame = GuardFrame { locals: sub_branch .bindings @@ -2489,6 +2513,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ) }); + // If this isn't the final sub-branch being lowered, we need to unschedule drops of + // bindings and temporaries created for and by the guard. As a result, the drop order + // for the arm will correspond to the binding order of the final sub-branch lowered. + if matches!(schedule_drops, ScheduleDrops::No) { + self.clear_top_scope(arm.scope); + } + let source_info = self.source_info(guard_span); let guard_end = self.source_info(tcx.sess.source_map().end_point(guard_span)); let guard_frame = self.guard_context.pop().unwrap(); @@ -2538,16 +2569,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let cause = FakeReadCause::ForGuardBinding; self.cfg.push_fake_read(post_guard_block, guard_end, cause, Place::from(local_id)); } - assert_matches!( - schedule_drops, - ScheduleDrops::Yes, - "patterns with guards must schedule drops" - ); + // Only schedule drops for the last sub-branch we lower. self.bind_matched_candidate_for_arm_body( post_guard_block, - ScheduleDrops::Yes, + schedule_drops, by_value_bindings, - emit_storage_live, ); post_guard_block @@ -2559,7 +2585,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { block, schedule_drops, sub_branch.bindings.iter(), - emit_storage_live, ); block } @@ -2671,7 +2696,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { fn bind_matched_candidate_for_guard<'b>( &mut self, block: BasicBlock, - schedule_drops: ScheduleDrops, bindings: impl IntoIterator>, ) where 'tcx: 'b, @@ -2690,12 +2714,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // a reference R: &T pointing to the location matched by // the pattern, and every occurrence of P within a guard // denotes *R. + // Drops must be scheduled to emit `StorageDead` on the guard's failure/break branches. let ref_for_guard = self.storage_live_binding( block, binding.var_id, binding.span, RefWithinGuard, - schedule_drops, + ScheduleDrops::Yes, ); match binding.binding_mode.0 { ByRef::No => { @@ -2705,13 +2730,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { self.cfg.push_assign(block, source_info, ref_for_guard, rvalue); } ByRef::Yes(mutbl) => { - // The arm binding will be by reference, so eagerly create it now. + // The arm binding will be by reference, so eagerly create it now. Drops must + // be scheduled to emit `StorageDead` on the guard's failure/break branches. let value_for_arm = self.storage_live_binding( block, binding.var_id, binding.span, OutsideGuard, - schedule_drops, + ScheduleDrops::Yes, ); let rvalue = @@ -2730,7 +2756,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { block: BasicBlock, schedule_drops: ScheduleDrops, bindings: impl IntoIterator>, - emit_storage_live: EmitStorageLive, ) where 'tcx: 'b, { @@ -2740,19 +2765,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // Assign each of the bindings. This may trigger moves out of the candidate. for binding in bindings { let source_info = self.source_info(binding.span); - let local = match emit_storage_live { - // Here storages are already alive, probably because this is a binding - // from let-else. - // We just need to schedule drop for the value. - EmitStorageLive::No => self.var_local_id(binding.var_id, OutsideGuard).into(), - EmitStorageLive::Yes => self.storage_live_binding( - block, - binding.var_id, - binding.span, - OutsideGuard, - schedule_drops, - ), - }; + let local = self.storage_live_binding( + block, + binding.var_id, + binding.span, + OutsideGuard, + schedule_drops, + ); if matches!(schedule_drops, ScheduleDrops::Yes) { self.schedule_drop_for_binding(binding.var_id, binding.span, OutsideGuard); } diff --git a/compiler/rustc_mir_build/src/builder/matches/util.rs b/compiler/rustc_mir_build/src/builder/matches/util.rs index 589e350a03fc..2c8ad95b6afd 100644 --- a/compiler/rustc_mir_build/src/builder/matches/util.rs +++ b/compiler/rustc_mir_build/src/builder/matches/util.rs @@ -138,7 +138,9 @@ impl<'a, 'b, 'tcx> FakeBorrowCollector<'a, 'b, 'tcx> { fn visit_candidate(&mut self, candidate: &Candidate<'tcx>) { for binding in &candidate.extra_data.bindings { - self.visit_binding(binding); + if let super::SubpatternBindings::One(binding) = binding { + self.visit_binding(binding); + } } for match_pair in &candidate.match_pairs { self.visit_match_pair(match_pair); @@ -147,7 +149,9 @@ impl<'a, 'b, 'tcx> FakeBorrowCollector<'a, 'b, 'tcx> { fn visit_flat_pat(&mut self, flat_pat: &FlatPat<'tcx>) { for binding in &flat_pat.extra_data.bindings { - self.visit_binding(binding); + if let super::SubpatternBindings::One(binding) = binding { + self.visit_binding(binding); + } } for match_pair in &flat_pat.match_pairs { self.visit_match_pair(match_pair); diff --git a/compiler/rustc_mir_build/src/check_tail_calls.rs b/compiler/rustc_mir_build/src/check_tail_calls.rs index b4c8b20e50f9..3ecccb422c46 100644 --- a/compiler/rustc_mir_build/src/check_tail_calls.rs +++ b/compiler/rustc_mir_build/src/check_tail_calls.rs @@ -60,9 +60,13 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> { let BodyTy::Fn(caller_sig) = self.thir.body_type else { span_bug!( call.span, - "`become` outside of functions should have been disallowed by hit_typeck" + "`become` outside of functions should have been disallowed by hir_typeck" ) }; + // While the `caller_sig` does have its regions erased, it does not have its + // binders anonymized. We call `erase_regions` once again to anonymize any binders + // within the signature, such as in function pointer or `dyn Trait` args. + let caller_sig = self.tcx.erase_regions(caller_sig); let ExprKind::Scope { value, .. } = call.kind else { span_bug!(call.span, "expected scope, found: {call:?}") diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 1a52c6c85cb6..58c3de4a8b59 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -975,15 +975,6 @@ pub(crate) struct NonEmptyNeverPattern<'tcx> { pub(crate) ty: Ty<'tcx>, } -#[derive(Diagnostic)] -#[diag(mir_build_exceeds_mcdc_condition_limit)] -pub(crate) struct MCDCExceedsConditionLimit { - #[primary_span] - pub(crate) span: Span, - pub(crate) num_conditions: usize, - pub(crate) max_conditions: usize, -} - #[derive(Diagnostic)] #[diag(mir_build_pattern_not_covered, code = E0005)] pub(crate) struct PatternNotCovered<'s, 'tcx> { diff --git a/compiler/rustc_mir_transform/messages.ftl b/compiler/rustc_mir_transform/messages.ftl index ae3062f07de9..2e08f50e8a9a 100644 --- a/compiler/rustc_mir_transform/messages.ftl +++ b/compiler/rustc_mir_transform/messages.ftl @@ -9,8 +9,6 @@ mir_transform_const_mut_borrow = taking a mutable reference to a `const` item .note2 = the mutable reference will refer to this temporary, not the original `const` item .note3 = mutable reference created due to call to this method -mir_transform_exceeds_mcdc_test_vector_limit = number of total test vectors in one function will exceed limit ({$max_num_test_vectors}) if this decision is instrumented, so MC/DC analysis ignores it - mir_transform_ffi_unwind_call = call to {$foreign -> [true] foreign function *[false] function pointer diff --git a/compiler/rustc_mir_transform/src/check_inline.rs b/compiler/rustc_mir_transform/src/check_inline.rs index af6da209081b..8d28cb3ca003 100644 --- a/compiler/rustc_mir_transform/src/check_inline.rs +++ b/compiler/rustc_mir_transform/src/check_inline.rs @@ -45,12 +45,6 @@ pub(super) fn is_inline_valid_on_fn<'tcx>( return Err("#[rustc_no_mir_inline]"); } - // FIXME(#127234): Coverage instrumentation currently doesn't handle inlined - // MIR correctly when Modified Condition/Decision Coverage is enabled. - if tcx.sess.instrument_coverage_mcdc() { - return Err("incompatible with MC/DC coverage"); - } - let ty = tcx.type_of(def_id); if match ty.instantiate_identity().kind() { ty::FnDef(..) => tcx.fn_sig(def_id).instantiate_identity().c_variadic(), diff --git a/compiler/rustc_mir_transform/src/coverage/mappings.rs b/compiler/rustc_mir_transform/src/coverage/mappings.rs index b0e24cf2bdb8..399978b5915a 100644 --- a/compiler/rustc_mir_transform/src/coverage/mappings.rs +++ b/compiler/rustc_mir_transform/src/coverage/mappings.rs @@ -1,10 +1,5 @@ -use std::collections::BTreeSet; - -use rustc_data_structures::fx::FxIndexMap; use rustc_index::IndexVec; -use rustc_middle::mir::coverage::{ - BlockMarkerId, BranchSpan, ConditionId, ConditionInfo, CoverageInfoHi, CoverageKind, -}; +use rustc_middle::mir::coverage::{BlockMarkerId, BranchSpan, CoverageInfoHi, CoverageKind}; use rustc_middle::mir::{self, BasicBlock, StatementKind}; use rustc_middle::ty::TyCtxt; use rustc_span::Span; @@ -13,7 +8,6 @@ use crate::coverage::ExtractedHirInfo; use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph}; use crate::coverage::spans::extract_refined_covspans; use crate::coverage::unexpand::unexpand_into_body_span; -use crate::errors::MCDCExceedsTestVectorLimit; /// Associates an ordinary executable code span with its corresponding BCB. #[derive(Debug)] @@ -22,9 +16,6 @@ pub(super) struct CodeMapping { pub(super) bcb: BasicCoverageBlock, } -/// This is separate from [`MCDCBranch`] to help prepare for larger changes -/// that will be needed for improved branch coverage in the future. -/// (See .) #[derive(Debug)] pub(super) struct BranchPair { pub(super) span: Span, @@ -32,40 +23,10 @@ pub(super) struct BranchPair { pub(super) false_bcb: BasicCoverageBlock, } -/// Associates an MC/DC branch span with condition info besides fields for normal branch. -#[derive(Debug)] -pub(super) struct MCDCBranch { - pub(super) span: Span, - pub(super) true_bcb: BasicCoverageBlock, - pub(super) false_bcb: BasicCoverageBlock, - pub(super) condition_info: ConditionInfo, - // Offset added to test vector idx if this branch is evaluated to true. - pub(super) true_index: usize, - // Offset added to test vector idx if this branch is evaluated to false. - pub(super) false_index: usize, -} - -/// Associates an MC/DC decision with its join BCBs. -#[derive(Debug)] -pub(super) struct MCDCDecision { - pub(super) span: Span, - pub(super) end_bcbs: BTreeSet, - pub(super) bitmap_idx: usize, - pub(super) num_test_vectors: usize, - pub(super) decision_depth: u16, -} - -// LLVM uses `i32` to index the bitmap. Thus `i32::MAX` is the hard limit for number of all test vectors -// in a function. -const MCDC_MAX_BITMAP_SIZE: usize = i32::MAX as usize; - #[derive(Default)] pub(super) struct ExtractedMappings { pub(super) code_mappings: Vec, pub(super) branch_pairs: Vec, - pub(super) mcdc_bitmap_bits: usize, - pub(super) mcdc_degraded_branches: Vec, - pub(super) mcdc_mappings: Vec<(MCDCDecision, Vec)>, } /// Extracts coverage-relevant spans from MIR, and associates them with @@ -78,32 +39,13 @@ pub(super) fn extract_all_mapping_info_from_mir<'tcx>( ) -> ExtractedMappings { let mut code_mappings = vec![]; let mut branch_pairs = vec![]; - let mut mcdc_bitmap_bits = 0; - let mut mcdc_degraded_branches = vec![]; - let mut mcdc_mappings = vec![]; // Extract ordinary code mappings from MIR statement/terminator spans. extract_refined_covspans(tcx, mir_body, hir_info, graph, &mut code_mappings); branch_pairs.extend(extract_branch_pairs(mir_body, hir_info, graph)); - extract_mcdc_mappings( - mir_body, - tcx, - hir_info.body_span, - graph, - &mut mcdc_bitmap_bits, - &mut mcdc_degraded_branches, - &mut mcdc_mappings, - ); - - ExtractedMappings { - code_mappings, - branch_pairs, - mcdc_bitmap_bits, - mcdc_degraded_branches, - mcdc_mappings, - } + ExtractedMappings { code_mappings, branch_pairs } } fn resolve_block_markers( @@ -127,12 +69,6 @@ fn resolve_block_markers( block_markers } -// FIXME: There is currently a lot of redundancy between -// `extract_branch_pairs` and `extract_mcdc_mappings`. This is needed so -// that they can each be modified without interfering with the other, but in -// the long term we should try to bring them together again when branch coverage -// and MC/DC coverage support are more mature. - pub(super) fn extract_branch_pairs( mir_body: &mir::Body<'_>, hir_info: &ExtractedHirInfo, @@ -162,175 +98,3 @@ pub(super) fn extract_branch_pairs( }) .collect::>() } - -pub(super) fn extract_mcdc_mappings( - mir_body: &mir::Body<'_>, - tcx: TyCtxt<'_>, - body_span: Span, - graph: &CoverageGraph, - mcdc_bitmap_bits: &mut usize, - mcdc_degraded_branches: &mut impl Extend, - mcdc_mappings: &mut impl Extend<(MCDCDecision, Vec)>, -) { - let Some(coverage_info_hi) = mir_body.coverage_info_hi.as_deref() else { return }; - - let block_markers = resolve_block_markers(coverage_info_hi, mir_body); - - let bcb_from_marker = |marker: BlockMarkerId| graph.bcb_from_bb(block_markers[marker]?); - - let check_branch_bcb = - |raw_span: Span, true_marker: BlockMarkerId, false_marker: BlockMarkerId| { - // For now, ignore any branch span that was introduced by - // expansion. This makes things like assert macros less noisy. - if !raw_span.ctxt().outer_expn_data().is_root() { - return None; - } - let span = unexpand_into_body_span(raw_span, body_span)?; - - let true_bcb = bcb_from_marker(true_marker)?; - let false_bcb = bcb_from_marker(false_marker)?; - Some((span, true_bcb, false_bcb)) - }; - - let to_mcdc_branch = |&mir::coverage::MCDCBranchSpan { - span: raw_span, - condition_info, - true_marker, - false_marker, - }| { - let (span, true_bcb, false_bcb) = check_branch_bcb(raw_span, true_marker, false_marker)?; - Some(MCDCBranch { - span, - true_bcb, - false_bcb, - condition_info, - true_index: usize::MAX, - false_index: usize::MAX, - }) - }; - - let mut get_bitmap_idx = |num_test_vectors: usize| -> Option { - let bitmap_idx = *mcdc_bitmap_bits; - let next_bitmap_bits = bitmap_idx.saturating_add(num_test_vectors); - (next_bitmap_bits <= MCDC_MAX_BITMAP_SIZE).then(|| { - *mcdc_bitmap_bits = next_bitmap_bits; - bitmap_idx - }) - }; - mcdc_degraded_branches - .extend(coverage_info_hi.mcdc_degraded_branch_spans.iter().filter_map(to_mcdc_branch)); - - mcdc_mappings.extend(coverage_info_hi.mcdc_spans.iter().filter_map(|(decision, branches)| { - if branches.len() == 0 { - return None; - } - let decision_span = unexpand_into_body_span(decision.span, body_span)?; - - let end_bcbs = decision - .end_markers - .iter() - .map(|&marker| bcb_from_marker(marker)) - .collect::>()?; - let mut branch_mappings: Vec<_> = branches.into_iter().filter_map(to_mcdc_branch).collect(); - if branch_mappings.len() != branches.len() { - mcdc_degraded_branches.extend(branch_mappings); - return None; - } - let num_test_vectors = calc_test_vectors_index(&mut branch_mappings); - let Some(bitmap_idx) = get_bitmap_idx(num_test_vectors) else { - tcx.dcx().emit_warn(MCDCExceedsTestVectorLimit { - span: decision_span, - max_num_test_vectors: MCDC_MAX_BITMAP_SIZE, - }); - mcdc_degraded_branches.extend(branch_mappings); - return None; - }; - // LLVM requires span of the decision contains all spans of its conditions. - // Usually the decision span meets the requirement well but in cases like macros it may not. - let span = branch_mappings - .iter() - .map(|branch| branch.span) - .reduce(|lhs, rhs| lhs.to(rhs)) - .map( - |joint_span| { - if decision_span.contains(joint_span) { decision_span } else { joint_span } - }, - ) - .expect("branch mappings are ensured to be non-empty as checked above"); - Some(( - MCDCDecision { - span, - end_bcbs, - bitmap_idx, - num_test_vectors, - decision_depth: decision.decision_depth, - }, - branch_mappings, - )) - })); -} - -// LLVM checks the executed test vector by accumulating indices of tested branches. -// We calculate number of all possible test vectors of the decision and assign indices -// to branches here. -// See [the rfc](https://discourse.llvm.org/t/rfc-coverage-new-algorithm-and-file-format-for-mc-dc/76798/) -// for more details about the algorithm. -// This function is mostly like [`TVIdxBuilder::TvIdxBuilder`](https://github.com/llvm/llvm-project/blob/d594d9f7f4dc6eb748b3261917db689fdc348b96/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L226) -fn calc_test_vectors_index(conditions: &mut Vec) -> usize { - let mut indegree_stats = IndexVec::::from_elem_n(0, conditions.len()); - // `num_paths` is `width` described at the llvm rfc, which indicates how many paths reaching the condition node. - let mut num_paths_stats = IndexVec::::from_elem_n(0, conditions.len()); - let mut next_conditions = conditions - .iter_mut() - .map(|branch| { - let ConditionInfo { condition_id, true_next_id, false_next_id } = branch.condition_info; - [true_next_id, false_next_id] - .into_iter() - .flatten() - .for_each(|next_id| indegree_stats[next_id] += 1); - (condition_id, branch) - }) - .collect::>(); - - let mut queue = - std::collections::VecDeque::from_iter(next_conditions.swap_remove(&ConditionId::START)); - num_paths_stats[ConditionId::START] = 1; - let mut decision_end_nodes = Vec::new(); - while let Some(branch) = queue.pop_front() { - let ConditionInfo { condition_id, true_next_id, false_next_id } = branch.condition_info; - let (false_index, true_index) = (&mut branch.false_index, &mut branch.true_index); - let this_paths_count = num_paths_stats[condition_id]; - // Note. First check the false next to ensure conditions are touched in same order with llvm-cov. - for (next, index) in [(false_next_id, false_index), (true_next_id, true_index)] { - if let Some(next_id) = next { - let next_paths_count = &mut num_paths_stats[next_id]; - *index = *next_paths_count; - *next_paths_count = next_paths_count.saturating_add(this_paths_count); - let next_indegree = &mut indegree_stats[next_id]; - *next_indegree -= 1; - if *next_indegree == 0 { - queue.push_back(next_conditions.swap_remove(&next_id).expect( - "conditions with non-zero indegree before must be in next_conditions", - )); - } - } else { - decision_end_nodes.push((this_paths_count, condition_id, index)); - } - } - } - assert!(next_conditions.is_empty(), "the decision tree has untouched nodes"); - let mut cur_idx = 0; - // LLVM hopes the end nodes are sorted in descending order by `num_paths` so that it can - // optimize bitmap size for decisions in tree form such as `a && b && c && d && ...`. - decision_end_nodes.sort_by_key(|(num_paths, _, _)| usize::MAX - *num_paths); - for (num_paths, condition_id, index) in decision_end_nodes { - assert_eq!( - num_paths, num_paths_stats[condition_id], - "end nodes should not be updated since they were visited" - ); - assert_eq!(*index, usize::MAX, "end nodes should not be assigned index before"); - *index = cur_idx; - cur_idx += num_paths; - } - cur_idx -} diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs index f253d1662cac..f6945a95a7c3 100644 --- a/compiler/rustc_mir_transform/src/coverage/mod.rs +++ b/compiler/rustc_mir_transform/src/coverage/mod.rs @@ -10,9 +10,7 @@ mod unexpand; use rustc_hir as hir; use rustc_hir::intravisit::{Visitor, walk_expr}; use rustc_middle::hir::nested_filter; -use rustc_middle::mir::coverage::{ - CoverageKind, DecisionInfo, FunctionCoverageInfo, Mapping, MappingKind, -}; +use rustc_middle::mir::coverage::{CoverageKind, FunctionCoverageInfo, Mapping, MappingKind}; use rustc_middle::mir::{self, BasicBlock, Statement, StatementKind, TerminatorKind}; use rustc_middle::ty::TyCtxt; use rustc_span::Span; @@ -95,14 +93,6 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir: // Inject coverage statements into MIR. inject_coverage_statements(mir_body, &graph); - inject_mcdc_statements(mir_body, &graph, &extracted_mappings); - - let mcdc_num_condition_bitmaps = extracted_mappings - .mcdc_mappings - .iter() - .map(|&(mappings::MCDCDecision { decision_depth, .. }, _)| decision_depth) - .max() - .map_or(0, |max| usize::from(max) + 1); mir_body.function_coverage_info = Some(Box::new(FunctionCoverageInfo { function_source_hash: hir_info.function_source_hash, @@ -111,9 +101,6 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir: priority_list, mappings, - - mcdc_bitmap_bits: extracted_mappings.mcdc_bitmap_bits, - mcdc_num_condition_bitmaps, })); } @@ -124,13 +111,7 @@ fn instrument_function_for_coverage<'tcx>(tcx: TyCtxt<'tcx>, mir_body: &mut mir: /// function can potentially be simplified even further. fn create_mappings(extracted_mappings: &ExtractedMappings) -> Vec { // Fully destructure the mappings struct to make sure we don't miss any kinds. - let ExtractedMappings { - code_mappings, - branch_pairs, - mcdc_bitmap_bits: _, - mcdc_degraded_branches, - mcdc_mappings, - } = extracted_mappings; + let ExtractedMappings { code_mappings, branch_pairs } = extracted_mappings; let mut mappings = Vec::new(); mappings.extend(code_mappings.iter().map( @@ -148,57 +129,6 @@ fn create_mappings(extracted_mappings: &ExtractedMappings) -> Vec { }, )); - // MCDC branch mappings are appended with their decisions in case decisions were ignored. - mappings.extend(mcdc_degraded_branches.iter().map( - |&mappings::MCDCBranch { - span, - true_bcb, - false_bcb, - condition_info: _, - true_index: _, - false_index: _, - }| { Mapping { kind: MappingKind::Branch { true_bcb, false_bcb }, span } }, - )); - - for (decision, branches) in mcdc_mappings { - // FIXME(#134497): Previously it was possible for some of these branch - // conversions to fail, in which case the remaining branches in the - // decision would be degraded to plain `MappingKind::Branch`. - // The changes in #134497 made that failure impossible, because the - // fallible step was deferred to codegen. But the corresponding code - // in codegen wasn't updated to detect the need for a degrade step. - let conditions = branches - .into_iter() - .map( - |&mappings::MCDCBranch { - span, - true_bcb, - false_bcb, - condition_info, - true_index: _, - false_index: _, - }| { - Mapping { - kind: MappingKind::MCDCBranch { - true_bcb, - false_bcb, - mcdc_params: condition_info, - }, - span, - } - }, - ) - .collect::>(); - - // LLVM requires end index for counter mapping regions. - let kind = MappingKind::MCDCDecision(DecisionInfo { - bitmap_idx: (decision.bitmap_idx + decision.num_test_vectors) as u32, - num_conditions: u16::try_from(conditions.len()).unwrap(), - }); - let span = decision.span; - mappings.extend(std::iter::once(Mapping { kind, span }).chain(conditions.into_iter())); - } - mappings } @@ -210,51 +140,6 @@ fn inject_coverage_statements<'tcx>(mir_body: &mut mir::Body<'tcx>, graph: &Cove } } -/// For each conditions inject statements to update condition bitmap after it has been evaluated. -/// For each decision inject statements to update test vector bitmap after it has been evaluated. -fn inject_mcdc_statements<'tcx>( - mir_body: &mut mir::Body<'tcx>, - graph: &CoverageGraph, - extracted_mappings: &ExtractedMappings, -) { - for (decision, conditions) in &extracted_mappings.mcdc_mappings { - // Inject test vector update first because `inject_statement` always insert new statement at head. - for &end in &decision.end_bcbs { - let end_bb = graph[end].leader_bb(); - inject_statement( - mir_body, - CoverageKind::TestVectorBitmapUpdate { - bitmap_idx: decision.bitmap_idx as u32, - decision_depth: decision.decision_depth, - }, - end_bb, - ); - } - - for &mappings::MCDCBranch { - span: _, - true_bcb, - false_bcb, - condition_info: _, - true_index, - false_index, - } in conditions - { - for (index, bcb) in [(false_index, false_bcb), (true_index, true_bcb)] { - let bb = graph[bcb].leader_bb(); - inject_statement( - mir_body, - CoverageKind::CondBitmapUpdate { - index: index as u32, - decision_depth: decision.decision_depth, - }, - bb, - ); - } - } - } -} - fn inject_statement(mir_body: &mut mir::Body<'_>, counter_kind: CoverageKind, bb: BasicBlock) { debug!(" injecting statement {counter_kind:?} for {bb:?}"); let data = &mut mir_body[bb]; diff --git a/compiler/rustc_mir_transform/src/coverage/query.rs b/compiler/rustc_mir_transform/src/coverage/query.rs index c195ca51540d..63c550c27fe4 100644 --- a/compiler/rustc_mir_transform/src/coverage/query.rs +++ b/compiler/rustc_mir_transform/src/coverage/query.rs @@ -111,11 +111,6 @@ fn coverage_ids_info<'tcx>( bcb_needs_counter.insert(true_bcb); bcb_needs_counter.insert(false_bcb); } - MappingKind::MCDCBranch { true_bcb, false_bcb, mcdc_params: _ } => { - bcb_needs_counter.insert(true_bcb); - bcb_needs_counter.insert(false_bcb); - } - MappingKind::MCDCDecision(_) => {} } } diff --git a/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs b/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs index 804cd8ab3f7d..7985e1c07988 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs @@ -101,11 +101,7 @@ fn filtered_statement_span(statement: &Statement<'_>) -> Option { StatementKind::Coverage(CoverageKind::BlockMarker { .. }) => None, // These coverage statements should not exist prior to coverage instrumentation. - StatementKind::Coverage( - CoverageKind::VirtualCounter { .. } - | CoverageKind::CondBitmapUpdate { .. } - | CoverageKind::TestVectorBitmapUpdate { .. }, - ) => bug!( + StatementKind::Coverage(CoverageKind::VirtualCounter { .. }) => bug!( "Unexpected coverage statement found during coverage instrumentation: {statement:?}" ), } diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs index cffa0183fa7a..ad9635aae330 100644 --- a/compiler/rustc_mir_transform/src/errors.rs +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -117,14 +117,6 @@ pub(crate) struct FnItemRef { pub ident: Ident, } -#[derive(Diagnostic)] -#[diag(mir_transform_exceeds_mcdc_test_vector_limit)] -pub(crate) struct MCDCExceedsTestVectorLimit { - #[primary_span] - pub(crate) span: Span, - pub(crate) max_num_test_vectors: usize, -} - pub(crate) struct MustNotSupend<'a, 'tcx> { pub tcx: TyCtxt<'tcx>, pub yield_sp: Span, diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index dc99b67a1e8c..952da2cdf725 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -756,7 +756,13 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { && let Some(v) = self.simplify_place_value(&mut pointee, location) { value = v; - place_ref = pointee.project_deeper(&place.projection[index..], self.tcx).as_ref(); + // `pointee` holds a `Place`, so `ProjectionElem::Index` holds a `Local`. + // That local is SSA, but we otherwise have no guarantee on that local's value at + // the current location compared to its value where `pointee` was borrowed. + if pointee.projection.iter().all(|elem| !matches!(elem, ProjectionElem::Index(_))) { + place_ref = + pointee.project_deeper(&place.projection[index..], self.tcx).as_ref(); + } } if let Some(local) = self.try_as_local(value, location) { // Both `local` and `Place { local: place.local, projection: projection[..index] }` @@ -774,7 +780,12 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { && let Some(v) = self.simplify_place_value(&mut pointee, location) { value = v; - place_ref = pointee.project_deeper(&[], self.tcx).as_ref(); + // `pointee` holds a `Place`, so `ProjectionElem::Index` holds a `Local`. + // That local is SSA, but we otherwise have no guarantee on that local's value at + // the current location compared to its value where `pointee` was borrowed. + if pointee.projection.iter().all(|elem| !matches!(elem, ProjectionElem::Index(_))) { + place_ref = pointee.project_deeper(&[], self.tcx).as_ref(); + } } if let Some(new_local) = self.try_as_local(value, location) { place_ref = PlaceRef { local: new_local, projection: &[] }; diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index db933da64137..468ef742dfb7 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -225,6 +225,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> { current = target; } let last = current; + *changed |= *start != last; *start = last; while let Some((current, mut terminator)) = terminators.pop() { let Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } = terminator diff --git a/compiler/rustc_monomorphize/messages.ftl b/compiler/rustc_monomorphize/messages.ftl index 2bd19e81b01c..9595a5b5ac7f 100644 --- a/compiler/rustc_monomorphize/messages.ftl +++ b/compiler/rustc_monomorphize/messages.ftl @@ -40,7 +40,10 @@ monomorphize_couldnt_dump_mono_stats = unexpected error occurred while dumping monomorphization stats: {$error} monomorphize_encountered_error_while_instantiating = - the above error was encountered while instantiating `{$formatted_item}` + the above error was encountered while instantiating `{$kind} {$instance}` + +monomorphize_encountered_error_while_instantiating_global_asm = + the above error was encountered while instantiating `global_asm` monomorphize_large_assignments = moving {$size} bytes @@ -52,12 +55,10 @@ monomorphize_no_optimized_mir = .note = missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?) monomorphize_recursion_limit = - reached the recursion limit while instantiating `{$shrunk}` + reached the recursion limit while instantiating `{$instance}` .note = `{$def_path_str}` defined here monomorphize_start_not_found = using `fn main` requires the standard library .help = use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]` monomorphize_symbol_already_defined = symbol `{$symbol}` is already defined - -monomorphize_written_to_path = the full type name has been written to '{$path}' diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 35b80a9b96f4..26ca8518434b 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -206,7 +206,6 @@ //! regardless of whether it is actually needed or not. use std::cell::OnceCell; -use std::path::PathBuf; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::sync::{MTLock, par_for_each_in}; @@ -224,7 +223,6 @@ use rustc_middle::mir::{self, Location, MentionedItem, traversal}; use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCoercion}; use rustc_middle::ty::layout::ValidityRequirement; -use rustc_middle::ty::print::{shrunk_instance_name, with_no_trimmed_paths}; use rustc_middle::ty::{ self, GenericArgs, GenericParamDefKind, Instance, InstanceKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, VtblEntry, @@ -237,7 +235,10 @@ use rustc_span::source_map::{Spanned, dummy_spanned, respan}; use rustc_span::{DUMMY_SP, Span}; use tracing::{debug, instrument, trace}; -use crate::errors::{self, EncounteredErrorWhileInstantiating, NoOptimizedMir, RecursionLimit}; +use crate::errors::{ + self, EncounteredErrorWhileInstantiating, EncounteredErrorWhileInstantiatingGlobalAsm, + NoOptimizedMir, RecursionLimit, +}; #[derive(PartialEq)] pub(crate) enum MonoItemCollectionStrategy { @@ -525,11 +526,23 @@ fn collect_items_rec<'tcx>( && starting_item.node.is_generic_fn() && starting_item.node.is_user_defined() { - let formatted_item = with_no_trimmed_paths!(starting_item.node.to_string()); - tcx.dcx().emit_note(EncounteredErrorWhileInstantiating { - span: starting_item.span, - formatted_item, - }); + match starting_item.node { + MonoItem::Fn(instance) => tcx.dcx().emit_note(EncounteredErrorWhileInstantiating { + span: starting_item.span, + kind: "fn", + instance, + }), + MonoItem::Static(def_id) => tcx.dcx().emit_note(EncounteredErrorWhileInstantiating { + span: starting_item.span, + kind: "static", + instance: Instance::new_raw(def_id, GenericArgs::empty()), + }), + MonoItem::GlobalAsm(_) => { + tcx.dcx().emit_note(EncounteredErrorWhileInstantiatingGlobalAsm { + span: starting_item.span, + }) + } + } } // Only updating `usage_map` for used items as otherwise we may be inserting the same item // multiple times (if it is first 'mentioned' and then later actually used), and the usage map @@ -612,22 +625,7 @@ fn check_recursion_limit<'tcx>( if !recursion_limit.value_within_limit(adjusted_recursion_depth) { let def_span = tcx.def_span(def_id); let def_path_str = tcx.def_path_str(def_id); - let (shrunk, written_to_path) = shrunk_instance_name(tcx, instance); - let mut path = PathBuf::new(); - let was_written = if let Some(written_to_path) = written_to_path { - path = written_to_path; - true - } else { - false - }; - tcx.dcx().emit_fatal(RecursionLimit { - span, - shrunk, - def_span, - def_path_str, - was_written, - path, - }); + tcx.dcx().emit_fatal(RecursionLimit { span, instance, def_span, def_path_str }); } recursion_depths.insert(def_id, recursion_depth + 1); diff --git a/compiler/rustc_monomorphize/src/errors.rs b/compiler/rustc_monomorphize/src/errors.rs index 938c427b56c8..89a78897dea9 100644 --- a/compiler/rustc_monomorphize/src/errors.rs +++ b/compiler/rustc_monomorphize/src/errors.rs @@ -1,21 +1,16 @@ -use std::path::PathBuf; - use rustc_macros::{Diagnostic, LintDiagnostic}; -use rustc_middle::ty::Ty; +use rustc_middle::ty::{Instance, Ty}; use rustc_span::{Span, Symbol}; #[derive(Diagnostic)] #[diag(monomorphize_recursion_limit)] -pub(crate) struct RecursionLimit { +pub(crate) struct RecursionLimit<'tcx> { #[primary_span] pub span: Span, - pub shrunk: String, + pub instance: Instance<'tcx>, #[note] pub def_span: Span, pub def_path_str: String, - #[note(monomorphize_written_to_path)] - pub was_written: bool, - pub path: PathBuf, } #[derive(Diagnostic)] @@ -53,10 +48,18 @@ pub(crate) struct CouldntDumpMonoStats { #[derive(Diagnostic)] #[diag(monomorphize_encountered_error_while_instantiating)] -pub(crate) struct EncounteredErrorWhileInstantiating { +pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> { + #[primary_span] + pub span: Span, + pub kind: &'static str, + pub instance: Instance<'tcx>, +} + +#[derive(Diagnostic)] +#[diag(monomorphize_encountered_error_while_instantiating_global_asm)] +pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm { #[primary_span] pub span: Span, - pub formatted_item: String, } #[derive(Diagnostic)] diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs index 231fb3e2964a..5e08c3a03d8a 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs @@ -959,36 +959,23 @@ where // Even when a trait bound has been proven using a where-bound, we // still need to consider alias-bounds for normalization, see // `tests/ui/next-solver/alias-bound-shadowed-by-env.rs`. - let candidates_from_env_and_bounds: Vec<_> = self + let mut candidates: Vec<_> = self .assemble_and_evaluate_candidates(goal, AssembleCandidatesFrom::EnvAndBounds); // We still need to prefer where-bounds over alias-bounds however. // See `tests/ui/winnowing/norm-where-bound-gt-alias-bound.rs`. - let mut considered_candidates: Vec<_> = if candidates_from_env_and_bounds - .iter() - .any(|c| matches!(c.source, CandidateSource::ParamEnv(_))) - { - candidates_from_env_and_bounds - .into_iter() - .filter(|c| matches!(c.source, CandidateSource::ParamEnv(_))) - .map(|c| c.result) - .collect() - } else { - candidates_from_env_and_bounds.into_iter().map(|c| c.result).collect() - }; - - // If the trait goal has been proven by using the environment, we want to treat - // aliases as rigid if there are no applicable projection bounds in the environment. - if considered_candidates.is_empty() { - if let Ok(response) = inject_normalize_to_rigid_candidate(self) { - considered_candidates.push(response); - } + if candidates.iter().any(|c| matches!(c.source, CandidateSource::ParamEnv(_))) { + candidates.retain(|c| matches!(c.source, CandidateSource::ParamEnv(_))); + } else if candidates.is_empty() { + // If the trait goal has been proven by using the environment, we want to treat + // aliases as rigid if there are no applicable projection bounds in the environment. + return inject_normalize_to_rigid_candidate(self); } - if let Some(response) = self.try_merge_responses(&considered_candidates) { + if let Some(response) = self.try_merge_candidates(&candidates) { Ok(response) } else { - self.flounder(&considered_candidates) + self.flounder(&candidates) } } TraitGoalProvenVia::Misc => { @@ -998,11 +985,9 @@ where // Prefer "orphaned" param-env normalization predicates, which are used // (for example, and ideally only) when proving item bounds for an impl. let candidates_from_env: Vec<_> = candidates - .iter() - .filter(|c| matches!(c.source, CandidateSource::ParamEnv(_))) - .map(|c| c.result) + .extract_if(.., |c| matches!(c.source, CandidateSource::ParamEnv(_))) .collect(); - if let Some(response) = self.try_merge_responses(&candidates_from_env) { + if let Some(response) = self.try_merge_candidates(&candidates_from_env) { return Ok(response); } @@ -1012,12 +997,10 @@ where // means we can just ignore inference constraints and don't have to special-case // constraining the normalized-to `term`. self.filter_specialized_impls(AllowInferenceConstraints::Yes, &mut candidates); - - let responses: Vec<_> = candidates.iter().map(|c| c.result).collect(); - if let Some(response) = self.try_merge_responses(&responses) { + if let Some(response) = self.try_merge_candidates(&candidates) { Ok(response) } else { - self.flounder(&responses) + self.flounder(&candidates) } } } diff --git a/compiler/rustc_next_trait_solver/src/solve/mod.rs b/compiler/rustc_next_trait_solver/src/solve/mod.rs index aec9594b834b..2feebe270a6b 100644 --- a/compiler/rustc_next_trait_solver/src/solve/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/mod.rs @@ -29,6 +29,7 @@ use tracing::instrument; pub use self::eval_ctxt::{EvalCtxt, GenerateProofTree, SolverDelegateEvalExt}; use crate::delegate::SolverDelegate; +use crate::solve::assembly::Candidate; /// How many fixpoint iterations we should attempt inside of the solver before bailing /// with overflow. @@ -244,50 +245,51 @@ where /// /// In this case we tend to flounder and return ambiguity by calling `[EvalCtxt::flounder]`. #[instrument(level = "trace", skip(self), ret)] - fn try_merge_responses( + fn try_merge_candidates( &mut self, - responses: &[CanonicalResponse], + candidates: &[Candidate], ) -> Option> { - if responses.is_empty() { + if candidates.is_empty() { return None; } - let one = responses[0]; - if responses[1..].iter().all(|&resp| resp == one) { + let one: CanonicalResponse = candidates[0].result; + if candidates[1..].iter().all(|candidate| candidate.result == one) { return Some(one); } - responses + candidates .iter() - .find(|response| { - response.value.certainty == Certainty::Yes - && has_no_inference_or_external_constraints(**response) + .find(|candidate| { + candidate.result.value.certainty == Certainty::Yes + && has_no_inference_or_external_constraints(candidate.result) }) - .copied() + .map(|candidate| candidate.result) } - fn bail_with_ambiguity(&mut self, responses: &[CanonicalResponse]) -> CanonicalResponse { - debug_assert!(responses.len() > 1); - let maybe_cause = responses.iter().fold(MaybeCause::Ambiguity, |maybe_cause, response| { - // Pull down the certainty of `Certainty::Yes` to ambiguity when combining - // these responses, b/c we're combining more than one response and this we - // don't know which one applies. - let candidate = match response.value.certainty { - Certainty::Yes => MaybeCause::Ambiguity, - Certainty::Maybe(candidate) => candidate, - }; - maybe_cause.or(candidate) - }); + fn bail_with_ambiguity(&mut self, candidates: &[Candidate]) -> CanonicalResponse { + debug_assert!(candidates.len() > 1); + let maybe_cause = + candidates.iter().fold(MaybeCause::Ambiguity, |maybe_cause, candidates| { + // Pull down the certainty of `Certainty::Yes` to ambiguity when combining + // these responses, b/c we're combining more than one response and this we + // don't know which one applies. + let candidate = match candidates.result.value.certainty { + Certainty::Yes => MaybeCause::Ambiguity, + Certainty::Maybe(candidate) => candidate, + }; + maybe_cause.or(candidate) + }); self.make_ambiguous_response_no_constraints(maybe_cause) } /// If we fail to merge responses we flounder and return overflow or ambiguity. #[instrument(level = "trace", skip(self), ret)] - fn flounder(&mut self, responses: &[CanonicalResponse]) -> QueryResult { - if responses.is_empty() { + fn flounder(&mut self, candidates: &[Candidate]) -> QueryResult { + if candidates.is_empty() { return Err(NoSolution); } else { - Ok(self.bail_with_ambiguity(responses)) + Ok(self.bail_with_ambiguity(candidates)) } } diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs index f760c2c07ffb..60bae738e61b 100644 --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs @@ -1346,11 +1346,10 @@ where mut candidates: Vec>, ) -> Result<(CanonicalResponse, Option), NoSolution> { if let TypingMode::Coherence = self.typing_mode() { - let all_candidates: Vec<_> = candidates.into_iter().map(|c| c.result).collect(); - return if let Some(response) = self.try_merge_responses(&all_candidates) { + return if let Some(response) = self.try_merge_candidates(&candidates) { Ok((response, Some(TraitGoalProvenVia::Misc))) } else { - self.flounder(&all_candidates).map(|r| (r, None)) + self.flounder(&candidates).map(|r| (r, None)) }; } @@ -1375,11 +1374,9 @@ where .any(|c| matches!(c.source, CandidateSource::ParamEnv(ParamEnvSource::NonGlobal))); if has_non_global_where_bounds { let where_bounds: Vec<_> = candidates - .iter() - .filter(|c| matches!(c.source, CandidateSource::ParamEnv(_))) - .map(|c| c.result) + .extract_if(.., |c| matches!(c.source, CandidateSource::ParamEnv(_))) .collect(); - return if let Some(response) = self.try_merge_responses(&where_bounds) { + return if let Some(response) = self.try_merge_candidates(&where_bounds) { Ok((response, Some(TraitGoalProvenVia::ParamEnv))) } else { Ok((self.bail_with_ambiguity(&where_bounds), None)) @@ -1388,11 +1385,9 @@ where if candidates.iter().any(|c| matches!(c.source, CandidateSource::AliasBound)) { let alias_bounds: Vec<_> = candidates - .iter() - .filter(|c| matches!(c.source, CandidateSource::AliasBound)) - .map(|c| c.result) + .extract_if(.., |c| matches!(c.source, CandidateSource::AliasBound)) .collect(); - return if let Some(response) = self.try_merge_responses(&alias_bounds) { + return if let Some(response) = self.try_merge_candidates(&alias_bounds) { Ok((response, Some(TraitGoalProvenVia::AliasBound))) } else { Ok((self.bail_with_ambiguity(&alias_bounds), None)) @@ -1417,11 +1412,10 @@ where TraitGoalProvenVia::Misc }; - let all_candidates: Vec<_> = candidates.into_iter().map(|c| c.result).collect(); - if let Some(response) = self.try_merge_responses(&all_candidates) { + if let Some(response) = self.try_merge_candidates(&candidates) { Ok((response, Some(proven_via))) } else { - self.flounder(&all_candidates).map(|r| (r, None)) + self.flounder(&candidates).map(|r| (r, None)) } } diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index 859118a4adee..7059ffbf375f 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -71,6 +71,17 @@ parse_attr_without_generics = attribute without generic parameters parse_attribute_on_param_type = attributes cannot be applied to a function parameter's type .label = attributes are not allowed here +parse_attribute_on_type = attributes cannot be applied to types + .label = attributes are not allowed here + .suggestion = remove attribute from here + +parse_attribute_on_generic_arg = attributes cannot be applied to generic arguments + .label = attributes are not allowed here + .suggestion = remove attribute from here + +parse_attribute_on_empty_type = attributes cannot be applied here + .label = attributes are not allowed here + parse_bad_assoc_type_bounds = bounds on associated types do not belong here .label = belongs in `where` clause diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 4aaaba01faeb..48ff0394d463 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1489,6 +1489,34 @@ pub(crate) struct AttributeOnParamType { pub span: Span, } +#[derive(Diagnostic)] +#[diag(parse_attribute_on_type)] +pub(crate) struct AttributeOnType { + #[primary_span] + #[label] + pub span: Span, + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] + pub fix_span: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_attribute_on_generic_arg)] +pub(crate) struct AttributeOnGenericArg { + #[primary_span] + #[label] + pub span: Span, + #[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")] + pub fix_span: Span, +} + +#[derive(Diagnostic)] +#[diag(parse_attribute_on_empty_type)] +pub(crate) struct AttributeOnEmptyType { + #[primary_span] + #[label] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(parse_pattern_method_param_without_body, code = E0642)] pub(crate) struct PatternMethodParamWithoutBody { diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 65d84b3e3d9d..cb7c56494332 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -885,6 +885,9 @@ impl<'a> Parser<'a> { /// Parses `unsafe? auto? trait Foo { ... }` or `trait Foo = Bar;`. fn parse_item_trait(&mut self, attrs: &mut AttrVec, lo: Span) -> PResult<'a, ItemKind> { let constness = self.parse_constness(Case::Sensitive); + if let Const::Yes(span) = constness { + self.psess.gated_spans.gate(sym::const_trait_impl, span); + } let safety = self.parse_safety(Case::Sensitive); // Parse optional `auto` prefix. let is_auto = if self.eat_keyword(exp!(Auto)) { diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 1f4049f197fa..8e65ab99c5e6 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -17,11 +17,11 @@ use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; use super::{Parser, Restrictions, TokenType}; use crate::ast::{PatKind, TyKind}; use crate::errors::{ - self, FnPathFoundNamedParams, PathFoundAttributeInParams, PathFoundCVariadicParams, - PathSingleColon, PathTripleColon, + self, AttributeOnEmptyType, AttributeOnGenericArg, FnPathFoundNamedParams, + PathFoundAttributeInParams, PathFoundCVariadicParams, PathSingleColon, PathTripleColon, }; use crate::exp; -use crate::parser::{CommaRecoveryMode, RecoverColon, RecoverComma}; +use crate::parser::{CommaRecoveryMode, ExprKind, RecoverColon, RecoverComma}; /// Specifies how to parse a path. #[derive(Copy, Clone, PartialEq)] @@ -880,6 +880,12 @@ impl<'a> Parser<'a> { &mut self, ty_generics: Option<&Generics>, ) -> PResult<'a, Option> { + let mut attr_span: Option = None; + if self.token == token::Pound && self.look_ahead(1, |t| *t == token::OpenBracket) { + let attrs_wrapper = self.parse_outer_attributes()?; + let raw_attrs = attrs_wrapper.take_for_recovery(self.psess); + attr_span = Some(raw_attrs[0].span.to(raw_attrs.last().unwrap().span)); + } let start = self.token.span; let arg = if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) { // Parse lifetime argument. @@ -934,6 +940,9 @@ impl<'a> Parser<'a> { } } else if self.token.is_keyword(kw::Const) { return self.recover_const_param_declaration(ty_generics); + } else if let Some(attr_span) = attr_span { + let diag = self.dcx().create_err(AttributeOnEmptyType { span: attr_span }); + return Err(diag); } else { // Fall back by trying to parse a const-expr expression. If we successfully do so, // then we should report an error that it needs to be wrapped in braces. @@ -953,6 +962,22 @@ impl<'a> Parser<'a> { } } }; + + if let Some(attr_span) = attr_span { + let guar = self.dcx().emit_err(AttributeOnGenericArg { + span: attr_span, + fix_span: attr_span.until(arg.span()), + }); + return Ok(Some(match arg { + GenericArg::Type(_) => GenericArg::Type(self.mk_ty(attr_span, TyKind::Err(guar))), + GenericArg::Const(_) => { + let error_expr = self.mk_expr(attr_span, ExprKind::Err(guar)); + GenericArg::Const(AnonConst { id: ast::DUMMY_NODE_ID, value: error_expr }) + } + GenericArg::Lifetime(lt) => GenericArg::Lifetime(lt), + })); + } + Ok(Some(arg)) } diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 740dd10ea8ba..59048e42e6f2 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -14,10 +14,10 @@ use thin_vec::{ThinVec, thin_vec}; use super::{Parser, PathStyle, SeqSep, TokenType, Trailing}; use crate::errors::{ - self, DynAfterMut, ExpectedFnPathFoundFnKeyword, ExpectedMutOrConstInRawPointerType, - FnPtrWithGenerics, FnPtrWithGenericsSugg, HelpUseLatestEdition, InvalidDynKeyword, - LifetimeAfterMut, NeedPlusAfterTraitObjectLifetime, NestedCVariadicType, - ReturnTypesUseThinArrow, + self, AttributeOnEmptyType, AttributeOnType, DynAfterMut, ExpectedFnPathFoundFnKeyword, + ExpectedMutOrConstInRawPointerType, FnPtrWithGenerics, FnPtrWithGenericsSugg, + HelpUseLatestEdition, InvalidDynKeyword, LifetimeAfterMut, NeedPlusAfterTraitObjectLifetime, + NestedCVariadicType, ReturnTypesUseThinArrow, }; use crate::parser::item::FrontMatterParsingMode; use crate::{exp, maybe_recover_from_interpolated_ty_qpath}; @@ -253,7 +253,27 @@ impl<'a> Parser<'a> { ) -> PResult<'a, P> { let allow_qpath_recovery = recover_qpath == RecoverQPath::Yes; maybe_recover_from_interpolated_ty_qpath!(self, allow_qpath_recovery); + if self.token == token::Pound && self.look_ahead(1, |t| *t == token::OpenBracket) { + let attrs_wrapper = self.parse_outer_attributes()?; + let raw_attrs = attrs_wrapper.take_for_recovery(self.psess); + let attr_span = raw_attrs[0].span.to(raw_attrs.last().unwrap().span); + let (full_span, guar) = match self.parse_ty() { + Ok(ty) => { + let full_span = attr_span.until(ty.span); + let guar = self + .dcx() + .emit_err(AttributeOnType { span: attr_span, fix_span: full_span }); + (attr_span, guar) + } + Err(err) => { + err.cancel(); + let guar = self.dcx().emit_err(AttributeOnEmptyType { span: attr_span }); + (attr_span, guar) + } + }; + return Ok(self.mk_ty(full_span, TyKind::Err(guar))); + } if let Some(ty) = self.eat_metavar_seq_with_matcher( |mv_kind| matches!(mv_kind, MetaVarKind::Ty { .. }), |this| this.parse_ty_no_question_mark_recover(), diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 2663d5fe99c7..10c532b436aa 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -315,6 +315,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> { Attribute::Parsed(AttributeKind::Used { span: attr_span, .. }) => { self.check_used(*attr_span, target, span); } + Attribute::Parsed(AttributeKind::ShouldPanic { span: attr_span, .. }) => self + .check_generic_attr(hir_id, sym::should_panic, *attr_span, target, Target::Fn), &Attribute::Parsed(AttributeKind::PassByValue(attr_span)) => { self.check_pass_by_value(attr_span, span, target) } @@ -324,6 +326,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> { &Attribute::Parsed(AttributeKind::Coverage(attr_span, _)) => { self.check_coverage(attr_span, span, target) } + &Attribute::Parsed(AttributeKind::Coroutine(attr_span)) => { + self.check_coroutine(attr_span, target) + } Attribute::Unparsed(attr_item) => { style = Some(attr_item.style); match attr.path().as_slice() { @@ -384,15 +389,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> { [sym::link, ..] => self.check_link(hir_id, attr, span, target), [sym::path, ..] => self.check_generic_attr_unparsed(hir_id, attr, target, Target::Mod), [sym::macro_export, ..] => self.check_macro_export(hir_id, attr, target), - [sym::should_panic, ..] => { - self.check_generic_attr_unparsed(hir_id, attr, target, Target::Fn) - } [sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => { self.check_autodiff(hir_id, attr, span, target) } - [sym::coroutine, ..] => { - self.check_coroutine(attr, target); - } [sym::linkage, ..] => self.check_linkage(attr, span, target), [ // ok @@ -2651,11 +2650,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } } - fn check_coroutine(&self, attr: &Attribute, target: Target) { + fn check_coroutine(&self, attr_span: Span, target: Target) { match target { Target::Closure => return, _ => { - self.dcx().emit_err(errors::CoroutineOnNonClosure { span: attr.span() }); + self.dcx().emit_err(errors::CoroutineOnNonClosure { span: attr_span }); } } } diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index a90d1af87ca1..fa9d0c7b1b7d 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -5,7 +5,6 @@ use std::mem; -use hir::ItemKind; use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; use rustc_abi::FieldIdx; use rustc_data_structures::fx::FxIndexSet; @@ -14,7 +13,7 @@ use rustc_errors::MultiSpan; use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; use rustc_hir::intravisit::{self, Visitor}; -use rustc_hir::{self as hir, ImplItem, ImplItemKind, Node, PatKind, QPath, TyKind}; +use rustc_hir::{self as hir, Node, PatKind, QPath}; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::middle::privacy::Level; use rustc_middle::query::Providers; @@ -28,37 +27,43 @@ use crate::errors::{ ChangeFields, IgnoredDerivedImpls, MultipleDeadCodes, ParentInfo, UselessAssignment, }; -// Any local node that may call something in its body block should be -// explored. For example, if it's a live Node::Item that is a -// function, then we should explore its block to check for codes that -// may need to be marked as live. +/// Any local definition that may call something in its body block should be explored. For example, +/// if it's a live function, then we should explore its block to check for codes that may need to +/// be marked as live. fn should_explore(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { - matches!( - tcx.hir_node_by_def_id(def_id), - Node::Item(..) - | Node::ImplItem(..) - | Node::ForeignItem(..) - | Node::TraitItem(..) - | Node::Variant(..) - | Node::AnonConst(..) - | Node::OpaqueTy(..) - ) -} + match tcx.def_kind(def_id) { + DefKind::Mod + | DefKind::Struct + | DefKind::Union + | DefKind::Enum + | DefKind::Variant + | DefKind::Trait + | DefKind::TyAlias + | DefKind::ForeignTy + | DefKind::TraitAlias + | DefKind::AssocTy + | DefKind::Fn + | DefKind::Const + | DefKind::Static { .. } + | DefKind::AssocFn + | DefKind::AssocConst + | DefKind::Macro(_) + | DefKind::GlobalAsm + | DefKind::Impl { .. } + | DefKind::OpaqueTy + | DefKind::AnonConst + | DefKind::InlineConst + | DefKind::ExternCrate + | DefKind::Use + | DefKind::Ctor(..) + | DefKind::ForeignMod => true, -/// Returns the local def id of the ADT if the given ty refers to a local one. -fn local_adt_def_of_ty<'tcx>(ty: &hir::Ty<'tcx>) -> Option { - match ty.kind { - TyKind::Path(QPath::Resolved(_, path)) => { - if let Res::Def(def_kind, def_id) = path.res - && let Some(local_def_id) = def_id.as_local() - && matches!(def_kind, DefKind::Struct | DefKind::Enum | DefKind::Union) - { - Some(local_def_id) - } else { - None - } - } - _ => None, + DefKind::TyParam + | DefKind::ConstParam + | DefKind::Field + | DefKind::LifetimeParam + | DefKind::Closure + | DefKind::SyntheticCoroutineBody => false, } } @@ -74,17 +79,16 @@ struct MarkSymbolVisitor<'tcx> { worklist: Vec<(LocalDefId, ComesFromAllowExpect)>, tcx: TyCtxt<'tcx>, maybe_typeck_results: Option<&'tcx ty::TypeckResults<'tcx>>, + scanned: UnordSet<(LocalDefId, ComesFromAllowExpect)>, live_symbols: LocalDefIdSet, repr_unconditionally_treats_fields_as_live: bool, repr_has_repr_simd: bool, in_pat: bool, ignore_variant_stack: Vec, - // maps from tuple struct constructors to tuple struct items - struct_constructors: LocalDefIdMap, // maps from ADTs to ignored derived traits (e.g. Debug and Clone) // and the span of their respective impl (i.e., part of the derive // macro) - ignored_derived_traits: LocalDefIdMap>, + ignored_derived_traits: LocalDefIdMap>, } impl<'tcx> MarkSymbolVisitor<'tcx> { @@ -99,7 +103,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { fn check_def_id(&mut self, def_id: DefId) { if let Some(def_id) = def_id.as_local() { - if should_explore(self.tcx, def_id) || self.struct_constructors.contains_key(&def_id) { + if should_explore(self.tcx, def_id) { self.worklist.push((def_id, ComesFromAllowExpect::No)); } self.live_symbols.insert(def_id); @@ -318,13 +322,12 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { } fn mark_live_symbols(&mut self) { - let mut scanned = UnordSet::default(); while let Some(work) = self.worklist.pop() { - if !scanned.insert(work) { + if !self.scanned.insert(work) { continue; } - let (id, comes_from_allow_expect) = work; + let (mut id, comes_from_allow_expect) = work; // Avoid accessing the HIR for the synthesized associated type generated for RPITITs. if self.tcx.is_impl_trait_in_trait(id.to_def_id()) { @@ -332,9 +335,11 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { continue; } - // in the case of tuple struct constructors we want to check the item, not the generated - // tuple struct constructor function - let id = self.struct_constructors.get(&id).copied().unwrap_or(id); + // in the case of tuple struct constructors we want to check the item, + // not the generated tuple struct constructor function + if let DefKind::Ctor(..) = self.tcx.def_kind(id) { + id = self.tcx.local_parent(id); + } // When using `#[allow]` or `#[expect]` of `dead_code`, we do a QOL improvement // by declaring fn calls, statics, ... within said items as live, as well as @@ -380,10 +385,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { if let ty::Adt(adt_def, _) = trait_ref.self_ty().kind() && let Some(adt_def_id) = adt_def.did().as_local() { - self.ignored_derived_traits - .entry(adt_def_id) - .or_default() - .insert((trait_of, impl_of)); + self.ignored_derived_traits.entry(adt_def_id).or_default().insert(trait_of); } return true; } @@ -478,24 +480,24 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { /// `local_def_id` points to an impl or an impl item, /// both impl and impl item that may be passed to this function are of a trait, /// and added into the unsolved_items during `create_and_seed_worklist` - fn check_impl_or_impl_item_live( - &mut self, - impl_id: hir::ItemId, - local_def_id: LocalDefId, - ) -> bool { - let trait_def_id = match self.tcx.def_kind(local_def_id) { + fn check_impl_or_impl_item_live(&mut self, local_def_id: LocalDefId) -> bool { + let (impl_block_id, trait_def_id) = match self.tcx.def_kind(local_def_id) { // assoc impl items of traits are live if the corresponding trait items are live - DefKind::AssocConst | DefKind::AssocTy | DefKind::AssocFn => self - .tcx - .associated_item(local_def_id) - .trait_item_def_id - .and_then(|def_id| def_id.as_local()), + DefKind::AssocConst | DefKind::AssocTy | DefKind::AssocFn => ( + self.tcx.local_parent(local_def_id), + self.tcx + .associated_item(local_def_id) + .trait_item_def_id + .and_then(|def_id| def_id.as_local()), + ), // impl items are live if the corresponding traits are live - DefKind::Impl { of_trait: true } => self - .tcx - .impl_trait_ref(impl_id.owner_id.def_id) - .and_then(|trait_ref| trait_ref.skip_binder().def_id.as_local()), - _ => None, + DefKind::Impl { of_trait: true } => ( + local_def_id, + self.tcx + .impl_trait_ref(local_def_id) + .and_then(|trait_ref| trait_ref.skip_binder().def_id.as_local()), + ), + _ => bug!(), }; if let Some(trait_def_id) = trait_def_id @@ -505,9 +507,9 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { } // The impl or impl item is used if the corresponding trait or trait item is used and the ty is used. - if let Some(local_def_id) = - local_adt_def_of_ty(self.tcx.hir_item(impl_id).expect_impl().self_ty) - && !self.live_symbols.contains(&local_def_id) + if let ty::Adt(adt, _) = self.tcx.type_of(impl_block_id).instantiate_identity().kind() + && let Some(adt_def_id) = adt.did().as_local() + && !self.live_symbols.contains(&adt_def_id) { return false; } @@ -714,139 +716,86 @@ fn has_allow_dead_code_or_lang_attr( } } -// These check_* functions seeds items that -// 1) We want to explicitly consider as live: -// * Item annotated with #[allow(dead_code)] -// - This is done so that if we want to suppress warnings for a -// group of dead functions, we only have to annotate the "root". -// For example, if both `f` and `g` are dead and `f` calls `g`, -// then annotating `f` with `#[allow(dead_code)]` will suppress -// warning for both `f` and `g`. -// * Item annotated with #[lang=".."] -// - This is because lang items are always callable from elsewhere. -// or -// 2) We are not sure to be live or not -// * Implementations of traits and trait methods -fn check_item<'tcx>( +/// Examine the given definition and record it in the worklist if it should be considered live. +/// +/// We want to explicitly consider as live: +/// * Item annotated with #[allow(dead_code)] +/// This is done so that if we want to suppress warnings for a +/// group of dead functions, we only have to annotate the "root". +/// For example, if both `f` and `g` are dead and `f` calls `g`, +/// then annotating `f` with `#[allow(dead_code)]` will suppress +/// warning for both `f` and `g`. +/// +/// * Item annotated with #[lang=".."] +/// Lang items are always callable from elsewhere. +/// +/// For trait methods and implementations of traits, we are not certain that the definitions are +/// live at this stage. We record them in `unsolved_items` for later examination. +fn maybe_record_as_seed<'tcx>( tcx: TyCtxt<'tcx>, + owner_id: hir::OwnerId, worklist: &mut Vec<(LocalDefId, ComesFromAllowExpect)>, - struct_constructors: &mut LocalDefIdMap, - unsolved_items: &mut Vec<(hir::ItemId, LocalDefId)>, - id: hir::ItemId, + unsolved_items: &mut Vec, ) { - let allow_dead_code = has_allow_dead_code_or_lang_attr(tcx, id.owner_id.def_id); + let allow_dead_code = has_allow_dead_code_or_lang_attr(tcx, owner_id.def_id); if let Some(comes_from_allow) = allow_dead_code { - worklist.push((id.owner_id.def_id, comes_from_allow)); + worklist.push((owner_id.def_id, comes_from_allow)); } - match tcx.def_kind(id.owner_id) { + match tcx.def_kind(owner_id) { DefKind::Enum => { - let item = tcx.hir_item(id); - if let hir::ItemKind::Enum(_, _, ref enum_def) = item.kind { - if let Some(comes_from_allow) = allow_dead_code { - worklist.extend( - enum_def.variants.iter().map(|variant| (variant.def_id, comes_from_allow)), - ); - } - - for variant in enum_def.variants { - if let Some(ctor_def_id) = variant.data.ctor_def_id() { - struct_constructors.insert(ctor_def_id, variant.def_id); + if let Some(comes_from_allow) = allow_dead_code { + let adt = tcx.adt_def(owner_id); + worklist.extend( + adt.variants() + .iter() + .map(|variant| (variant.def_id.expect_local(), comes_from_allow)), + ); + } + } + DefKind::AssocFn | DefKind::AssocConst | DefKind::AssocTy => { + if allow_dead_code.is_none() { + let parent = tcx.local_parent(owner_id.def_id); + match tcx.def_kind(parent) { + DefKind::Impl { of_trait: false } | DefKind::Trait => {} + DefKind::Impl { of_trait: true } => { + // We only care about associated items of traits, + // because they cannot be visited directly, + // so we later mark them as live if their corresponding traits + // or trait items and self types are both live, + // but inherent associated items can be visited and marked directly. + unsolved_items.push(owner_id.def_id); } + _ => bug!(), } } } - DefKind::Impl { of_trait } => { - if let Some(comes_from_allow) = - has_allow_dead_code_or_lang_attr(tcx, id.owner_id.def_id) - { - worklist.push((id.owner_id.def_id, comes_from_allow)); - } else if of_trait { - unsolved_items.push((id, id.owner_id.def_id)); - } - - for def_id in tcx.associated_item_def_ids(id.owner_id) { - let local_def_id = def_id.expect_local(); - - if let Some(comes_from_allow) = has_allow_dead_code_or_lang_attr(tcx, local_def_id) - { - worklist.push((local_def_id, comes_from_allow)); - } else if of_trait { - // We only care about associated items of traits, - // because they cannot be visited directly, - // so we later mark them as live if their corresponding traits - // or trait items and self types are both live, - // but inherent associated items can be visited and marked directly. - unsolved_items.push((id, local_def_id)); - } - } - } - DefKind::Struct => { - let item = tcx.hir_item(id); - if let hir::ItemKind::Struct(_, _, ref variant_data) = item.kind - && let Some(ctor_def_id) = variant_data.ctor_def_id() - { - struct_constructors.insert(ctor_def_id, item.owner_id.def_id); + DefKind::Impl { of_trait: true } => { + if allow_dead_code.is_none() { + unsolved_items.push(owner_id.def_id); } } DefKind::GlobalAsm => { // global_asm! is always live. - worklist.push((id.owner_id.def_id, ComesFromAllowExpect::No)); + worklist.push((owner_id.def_id, ComesFromAllowExpect::No)); } DefKind::Const => { - let item = tcx.hir_item(id); - if let hir::ItemKind::Const(ident, ..) = item.kind - && ident.name == kw::Underscore - { + if tcx.item_name(owner_id.def_id) == kw::Underscore { // `const _` is always live, as that syntax only exists for the side effects // of type checking and evaluating the constant expression, and marking them // as dead code would defeat that purpose. - worklist.push((id.owner_id.def_id, ComesFromAllowExpect::No)); + worklist.push((owner_id.def_id, ComesFromAllowExpect::No)); } } _ => {} } } -fn check_trait_item( - tcx: TyCtxt<'_>, - worklist: &mut Vec<(LocalDefId, ComesFromAllowExpect)>, - id: hir::TraitItemId, -) { - use hir::TraitItemKind::{Const, Fn, Type}; - - let trait_item = tcx.hir_trait_item(id); - if matches!(trait_item.kind, Const(_, Some(_)) | Type(_, Some(_)) | Fn(..)) - && let Some(comes_from_allow) = - has_allow_dead_code_or_lang_attr(tcx, trait_item.owner_id.def_id) - { - worklist.push((trait_item.owner_id.def_id, comes_from_allow)); - } -} - -fn check_foreign_item( - tcx: TyCtxt<'_>, - worklist: &mut Vec<(LocalDefId, ComesFromAllowExpect)>, - id: hir::ForeignItemId, -) { - if matches!(tcx.def_kind(id.owner_id), DefKind::Static { .. } | DefKind::Fn) - && let Some(comes_from_allow) = has_allow_dead_code_or_lang_attr(tcx, id.owner_id.def_id) - { - worklist.push((id.owner_id.def_id, comes_from_allow)); - } -} - fn create_and_seed_worklist( tcx: TyCtxt<'_>, -) -> ( - Vec<(LocalDefId, ComesFromAllowExpect)>, - LocalDefIdMap, - Vec<(hir::ItemId, LocalDefId)>, -) { +) -> (Vec<(LocalDefId, ComesFromAllowExpect)>, Vec) { let effective_visibilities = &tcx.effective_visibilities(()); - // see `MarkSymbolVisitor::struct_constructors` let mut unsolved_impl_item = Vec::new(); - let mut struct_constructors = Default::default(); let mut worklist = effective_visibilities .iter() .filter_map(|(&id, effective_vis)| { @@ -863,54 +812,49 @@ fn create_and_seed_worklist( .collect::>(); let crate_items = tcx.hir_crate_items(()); - for id in crate_items.free_items() { - check_item(tcx, &mut worklist, &mut struct_constructors, &mut unsolved_impl_item, id); + for id in crate_items.owners() { + maybe_record_as_seed(tcx, id, &mut worklist, &mut unsolved_impl_item); } - for id in crate_items.trait_items() { - check_trait_item(tcx, &mut worklist, id); - } - - for id in crate_items.foreign_items() { - check_foreign_item(tcx, &mut worklist, id); - } - - (worklist, struct_constructors, unsolved_impl_item) + (worklist, unsolved_impl_item) } fn live_symbols_and_ignored_derived_traits( tcx: TyCtxt<'_>, (): (), -) -> (LocalDefIdSet, LocalDefIdMap>) { - let (worklist, struct_constructors, mut unsolved_items) = create_and_seed_worklist(tcx); +) -> (LocalDefIdSet, LocalDefIdMap>) { + let (worklist, mut unsolved_items) = create_and_seed_worklist(tcx); let mut symbol_visitor = MarkSymbolVisitor { worklist, tcx, maybe_typeck_results: None, + scanned: Default::default(), live_symbols: Default::default(), repr_unconditionally_treats_fields_as_live: false, repr_has_repr_simd: false, in_pat: false, ignore_variant_stack: vec![], - struct_constructors, ignored_derived_traits: Default::default(), }; symbol_visitor.mark_live_symbols(); - let mut items_to_check; - (items_to_check, unsolved_items) = - unsolved_items.into_iter().partition(|&(impl_id, local_def_id)| { - symbol_visitor.check_impl_or_impl_item_live(impl_id, local_def_id) - }); + + // We have marked the primary seeds as live. We now need to process unsolved items from traits + // and trait impls: add them to the work list if the trait or the implemented type is live. + let mut items_to_check: Vec<_> = unsolved_items + .extract_if(.., |&mut local_def_id| { + symbol_visitor.check_impl_or_impl_item_live(local_def_id) + }) + .collect(); while !items_to_check.is_empty() { - symbol_visitor.worklist = - items_to_check.into_iter().map(|(_, id)| (id, ComesFromAllowExpect::No)).collect(); + symbol_visitor + .worklist + .extend(items_to_check.drain(..).map(|id| (id, ComesFromAllowExpect::No))); symbol_visitor.mark_live_symbols(); - (items_to_check, unsolved_items) = - unsolved_items.into_iter().partition(|&(impl_id, local_def_id)| { - symbol_visitor.check_impl_or_impl_item_live(impl_id, local_def_id) - }); + items_to_check.extend(unsolved_items.extract_if(.., |&mut local_def_id| { + symbol_visitor.check_impl_or_impl_item_live(local_def_id) + })); } (symbol_visitor.live_symbols, symbol_visitor.ignored_derived_traits) @@ -925,7 +869,7 @@ struct DeadItem { struct DeadVisitor<'tcx> { tcx: TyCtxt<'tcx>, live_symbols: &'tcx LocalDefIdSet, - ignored_derived_traits: &'tcx LocalDefIdMap>, + ignored_derived_traits: &'tcx LocalDefIdMap>, } enum ShouldWarnAboutField { @@ -984,25 +928,7 @@ impl<'tcx> DeadVisitor<'tcx> { parent_item: Option, report_on: ReportOn, ) { - fn get_parent_if_enum_variant<'tcx>( - tcx: TyCtxt<'tcx>, - may_variant: LocalDefId, - ) -> LocalDefId { - if let Node::Variant(_) = tcx.hir_node_by_def_id(may_variant) - && let Some(enum_did) = tcx.opt_parent(may_variant.to_def_id()) - && let Some(enum_local_id) = enum_did.as_local() - && let Node::Item(item) = tcx.hir_node_by_def_id(enum_local_id) - && let ItemKind::Enum(..) = item.kind - { - enum_local_id - } else { - may_variant - } - } - - let Some(&first_item) = dead_codes.first() else { - return; - }; + let Some(&first_item) = dead_codes.first() else { return }; let tcx = self.tcx; let first_lint_level = first_item.level; @@ -1011,81 +937,54 @@ impl<'tcx> DeadVisitor<'tcx> { let names: Vec<_> = dead_codes.iter().map(|item| item.name).collect(); let spans: Vec<_> = dead_codes .iter() - .map(|item| match tcx.def_ident_span(item.def_id) { - Some(s) => s.with_ctxt(tcx.def_span(item.def_id).ctxt()), - None => tcx.def_span(item.def_id), + .map(|item| { + let span = tcx.def_span(item.def_id); + let ident_span = tcx.def_ident_span(item.def_id); + // FIXME(cjgillot) this SyntaxContext manipulation does not make any sense. + ident_span.map(|s| s.with_ctxt(span.ctxt())).unwrap_or(span) }) .collect(); - let descr = tcx.def_descr(first_item.def_id.to_def_id()); + let mut descr = tcx.def_descr(first_item.def_id.to_def_id()); // `impl` blocks are "batched" and (unlike other batching) might // contain different kinds of associated items. - let descr = if dead_codes.iter().any(|item| tcx.def_descr(item.def_id.to_def_id()) != descr) - { - "associated item" - } else { - descr - }; + if dead_codes.iter().any(|item| tcx.def_descr(item.def_id.to_def_id()) != descr) { + descr = "associated item" + } + let num = dead_codes.len(); let multiple = num > 6; let name_list = names.into(); - let parent_info = if let Some(parent_item) = parent_item { + let parent_info = parent_item.map(|parent_item| { let parent_descr = tcx.def_descr(parent_item.to_def_id()); let span = if let DefKind::Impl { .. } = tcx.def_kind(parent_item) { tcx.def_span(parent_item) } else { tcx.def_ident_span(parent_item).unwrap() }; - Some(ParentInfo { num, descr, parent_descr, span }) - } else { - None - }; + ParentInfo { num, descr, parent_descr, span } + }); - let encl_def_id = parent_item.unwrap_or(first_item.def_id); - // If parent of encl_def_id is an enum, use the parent ID instead. - let encl_def_id = get_parent_if_enum_variant(tcx, encl_def_id); + let mut encl_def_id = parent_item.unwrap_or(first_item.def_id); + // `ignored_derived_traits` is computed for the enum, not for the variants. + if let DefKind::Variant = tcx.def_kind(encl_def_id) { + encl_def_id = tcx.local_parent(encl_def_id); + } let ignored_derived_impls = - if let Some(ign_traits) = self.ignored_derived_traits.get(&encl_def_id) { + self.ignored_derived_traits.get(&encl_def_id).map(|ign_traits| { let trait_list = ign_traits .iter() - .map(|(trait_id, _)| self.tcx.item_name(*trait_id)) + .map(|trait_id| self.tcx.item_name(*trait_id)) .collect::>(); let trait_list_len = trait_list.len(); - Some(IgnoredDerivedImpls { + IgnoredDerivedImpls { name: self.tcx.item_name(encl_def_id.to_def_id()), trait_list: trait_list.into(), trait_list_len, - }) - } else { - None - }; - - let enum_variants_with_same_name = dead_codes - .iter() - .filter_map(|dead_item| { - if let Node::ImplItem(ImplItem { - kind: ImplItemKind::Fn(..) | ImplItemKind::Const(..), - .. - }) = tcx.hir_node_by_def_id(dead_item.def_id) - && let Some(impl_did) = tcx.opt_parent(dead_item.def_id.to_def_id()) - && let DefKind::Impl { of_trait: false } = tcx.def_kind(impl_did) - && let ty::Adt(maybe_enum, _) = tcx.type_of(impl_did).skip_binder().kind() - && maybe_enum.is_enum() - && let Some(variant) = - maybe_enum.variants().iter().find(|i| i.name == dead_item.name) - { - Some(crate::errors::EnumVariantSameName { - dead_descr: tcx.def_descr(dead_item.def_id.to_def_id()), - dead_name: dead_item.name, - variant_span: tcx.def_span(variant.def_id), - }) - } else { - None } - }) - .collect(); + }); let diag = match report_on { ReportOn::TupleField => { @@ -1132,16 +1031,42 @@ impl<'tcx> DeadVisitor<'tcx> { ignored_derived_impls, } } - ReportOn::NamedField => MultipleDeadCodes::DeadCodes { - multiple, - num, - descr, - participle, - name_list, - parent_info, - ignored_derived_impls, - enum_variants_with_same_name, - }, + ReportOn::NamedField => { + let enum_variants_with_same_name = dead_codes + .iter() + .filter_map(|dead_item| { + if let DefKind::AssocFn | DefKind::AssocConst = + tcx.def_kind(dead_item.def_id) + && let impl_did = tcx.local_parent(dead_item.def_id) + && let DefKind::Impl { of_trait: false } = tcx.def_kind(impl_did) + && let ty::Adt(maybe_enum, _) = + tcx.type_of(impl_did).instantiate_identity().kind() + && maybe_enum.is_enum() + && let Some(variant) = + maybe_enum.variants().iter().find(|i| i.name == dead_item.name) + { + Some(crate::errors::EnumVariantSameName { + dead_descr: tcx.def_descr(dead_item.def_id.to_def_id()), + dead_name: dead_item.name, + variant_span: tcx.def_span(variant.def_id), + }) + } else { + None + } + }) + .collect(); + + MultipleDeadCodes::DeadCodes { + multiple, + num, + descr, + participle, + name_list, + parent_info, + ignored_derived_impls, + enum_variants_with_same_name, + } + } }; let hir_id = tcx.local_def_id_to_hir_id(first_item.def_id); diff --git a/compiler/rustc_passes/src/lib.rs b/compiler/rustc_passes/src/lib.rs index af7ecf0830c2..2ad0b5ff60e8 100644 --- a/compiler/rustc_passes/src/lib.rs +++ b/compiler/rustc_passes/src/lib.rs @@ -8,6 +8,7 @@ #![allow(internal_features)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] +#![feature(if_let_guard)] #![feature(map_try_insert)] #![feature(rustdoc_internals)] // tidy-alphabetical-end diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 9a9e0db964c9..12f653a13371 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -1130,16 +1130,16 @@ impl ConstructorSet { seen_false = true; } } - if seen_false { - present.push(Bool(false)); - } else { - missing.push(Bool(false)); - } if seen_true { present.push(Bool(true)); } else { missing.push(Bool(true)); } + if seen_false { + present.push(Bool(false)); + } else { + missing.push(Bool(false)); + } } ConstructorSet::Integers { range_1, range_2 } => { let seen_ranges: Vec<_> = diff --git a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs index 14ca0d057f06..4ad64f81560a 100644 --- a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs +++ b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs @@ -176,6 +176,9 @@ fn test_witnesses() { ), vec!["Enum::Variant1(_)", "Enum::Variant2(_)", "_"], ); + + // Assert we put `true` before `false`. + assert_witnesses(AllOfThem, Ty::Bool, Vec::new(), vec!["true", "false"]); } #[test] diff --git a/compiler/rustc_public/src/mir/body.rs b/compiler/rustc_public/src/mir/body.rs index 3d595286041c..276adacd99e0 100644 --- a/compiler/rustc_public/src/mir/body.rs +++ b/compiler/rustc_public/src/mir/body.rs @@ -349,7 +349,7 @@ impl AssertMessage { } } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum BinOp { Add, AddUnchecked, @@ -384,7 +384,7 @@ impl BinOp { } } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum UnOp { Not, Neg, @@ -490,7 +490,7 @@ pub enum StatementKind { Nop, } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum Rvalue { /// Creates a pointer with the indicated mutability to the place. /// @@ -666,7 +666,7 @@ impl Rvalue { } } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum AggregateKind { Array(Ty), Tuple, @@ -677,14 +677,14 @@ pub enum AggregateKind { RawPtr(Ty, Mutability), } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum Operand { Copy(Place), Move(Place), Constant(ConstOperand), } -#[derive(Clone, Eq, PartialEq, Serialize)] +#[derive(Clone, Eq, PartialEq, Hash, Serialize)] pub struct Place { pub local: Local, /// projection out of a place (access a field, deref a pointer, etc) @@ -697,7 +697,7 @@ impl From for Place { } } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct ConstOperand { pub span: Span, pub user_ty: Option, @@ -770,7 +770,7 @@ pub enum VarDebugInfoContents { // ProjectionElem) and user-provided type annotations (for which the projection elements // are of type ProjectionElem<(), ()>). // In rustc_public's IR we don't need this generality, so we just use ProjectionElem for Places. -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum ProjectionElem { /// Dereference projections (e.g. `*_1`) project to the address referenced by the base place. Deref, @@ -913,7 +913,7 @@ impl SwitchTargets { } } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum BorrowKind { /// Data must be immutable and is aliasable. Shared, @@ -940,7 +940,7 @@ impl BorrowKind { } } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum RawPtrKind { Mut, Const, @@ -958,14 +958,14 @@ impl RawPtrKind { } } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum MutBorrowKind { Default, TwoPhaseBorrow, ClosureCapture, } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum FakeBorrowKind { /// A shared (deep) borrow. Data must be immutable and is aliasable. Deep, @@ -982,13 +982,13 @@ pub enum Mutability { Mut, } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum Safety { Safe, Unsafe, } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum PointerCoercion { /// Go from a fn-item type to a fn-pointer type. ReifyFnPointer, @@ -1015,7 +1015,7 @@ pub enum PointerCoercion { Unsize, } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum CastKind { // FIXME(smir-rename): rename this to PointerExposeProvenance PointerExposeAddress, @@ -1030,7 +1030,7 @@ pub enum CastKind { Transmute, } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum NullOp { /// Returns the size of a value of that type. SizeOf, diff --git a/compiler/rustc_public/src/ty.rs b/compiler/rustc_public/src/ty.rs index de4b21b17647..1b5f0ed14299 100644 --- a/compiler/rustc_public/src/ty.rs +++ b/compiler/rustc_public/src/ty.rs @@ -113,7 +113,7 @@ pub enum Pattern { } /// Represents a constant in the type system -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct TyConst { pub(crate) kind: TyConstKind, pub id: TyConstId, @@ -140,7 +140,7 @@ impl TyConst { } } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum TyConstKind { Param(ParamConst), Bound(DebruijnIndex, BoundVar), @@ -151,11 +151,11 @@ pub enum TyConstKind { ZSTValue(Ty), } -#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct TyConstId(usize); /// Represents a constant in MIR -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct MirConst { /// The constant kind. pub(crate) kind: ConstantKind, @@ -212,17 +212,17 @@ impl MirConst { } } -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize)] pub struct MirConstId(usize); type Ident = Opaque; -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct Region { pub kind: RegionKind, } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum RegionKind { ReEarlyParam(EarlyParamRegion), ReBound(DebruijnIndex, BoundRegion), @@ -233,7 +233,7 @@ pub enum RegionKind { pub(crate) type DebruijnIndex = u32; -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct EarlyParamRegion { pub index: u32, pub name: Symbol, @@ -241,7 +241,7 @@ pub struct EarlyParamRegion { pub(crate) type BoundVar = u32; -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct BoundRegion { pub var: BoundVar, pub kind: BoundRegionKind, @@ -249,13 +249,13 @@ pub struct BoundRegion { pub(crate) type UniverseIndex = u32; -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct Placeholder { pub universe: UniverseIndex, pub bound: T, } -#[derive(Clone, Copy, PartialEq, Eq, Serialize)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize)] pub struct Span(usize); impl Debug for Span { @@ -997,7 +997,7 @@ crate_def! { } /// A list of generic arguments. -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct GenericArgs(pub Vec); impl std::ops::Index for GenericArgs { @@ -1016,7 +1016,7 @@ impl std::ops::Index for GenericArgs { } } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum GenericArgKind { Lifetime(Region), Type(Ty), @@ -1199,7 +1199,7 @@ pub enum BoundTyKind { Param(ParamDef, String), } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum BoundRegionKind { BrAnon, BrNamed(BrNamedDef, String), @@ -1354,7 +1354,7 @@ impl Allocation { } } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub enum ConstantKind { Ty(TyConst), Allocated(Allocation), @@ -1365,13 +1365,13 @@ pub enum ConstantKind { ZeroSized, } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct ParamConst { pub index: u32, pub name: String, } -#[derive(Clone, Debug, Eq, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)] pub struct UnevaluatedConst { pub def: ConstDef, pub args: GenericArgs, diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl index 39e9a9cc58af..ceef558c0cf9 100644 --- a/compiler/rustc_resolve/messages.ftl +++ b/compiler/rustc_resolve/messages.ftl @@ -243,7 +243,7 @@ resolve_lowercase_self = .suggestion = try using `Self` resolve_macro_cannot_use_as_attr = - `{$ident}` exists, but a declarative macro cannot be used as an attribute macro + `{$ident}` exists, but has no `attr` rules resolve_macro_cannot_use_as_derive = `{$ident}` exists, but a declarative macro cannot be used as a derive macro diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index d9671c43b3d8..2ad8543bf8ca 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -27,7 +27,7 @@ use rustc_middle::metadata::ModChild; use rustc_middle::ty::{Feed, Visibility}; use rustc_middle::{bug, span_bug}; use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind}; -use rustc_span::{Ident, Span, Symbol, kw, sym}; +use rustc_span::{Ident, Macros20NormalizedIdent, Span, Symbol, kw, sym}; use thin_vec::ThinVec; use tracing::debug; @@ -223,7 +223,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { pub(crate) fn build_reduced_graph_external(&self, module: Module<'ra>) { for child in self.tcx.module_children(module.def_id()) { - let parent_scope = ParentScope::module(module, self); + let parent_scope = ParentScope::module(module, self.arenas); self.build_reduced_graph_for_external_crate_res(child, parent_scope) } } @@ -373,7 +373,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { res, )) }; - match self.r.resolve_path( + match self.r.cm().resolve_path( &segments, None, parent_scope, @@ -969,8 +969,8 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { self.r.potentially_unused_imports.push(import); let imported_binding = self.r.import(binding, import); if ident.name != kw::Underscore && parent == self.r.graph_root { - let ident = ident.normalize_to_macros_2_0(); - if let Some(entry) = self.r.extern_prelude.get(&ident) + let norm_ident = Macros20NormalizedIdent::new(ident); + if let Some(entry) = self.r.extern_prelude.get(&norm_ident) && expansion != LocalExpnId::ROOT && orig_name.is_some() && !entry.is_import() @@ -986,7 +986,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { } use indexmap::map::Entry; - match self.r.extern_prelude.entry(ident) { + match self.r.extern_prelude.entry(norm_ident) { Entry::Occupied(mut occupied) => { let entry = occupied.get_mut(); if let Some(old_binding) = entry.binding.get() @@ -1128,7 +1128,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { }); } else { for ident in single_imports.iter().cloned() { - let result = self.r.maybe_resolve_ident_in_module( + let result = self.r.cm().maybe_resolve_ident_in_module( ModuleOrUniformRoot::Module(module), ident, MacroNS, diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index b85a814776a7..11d93a58ae29 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -33,7 +33,7 @@ use rustc_session::lint::BuiltinLintDiag; use rustc_session::lint::builtin::{ MACRO_USE_EXTERN_CRATE, UNUSED_EXTERN_CRATES, UNUSED_IMPORTS, UNUSED_QUALIFICATIONS, }; -use rustc_span::{DUMMY_SP, Ident, Span, kw}; +use rustc_span::{DUMMY_SP, Ident, Macros20NormalizedIdent, Span, kw}; use crate::imports::{Import, ImportKind}; use crate::{LexicalScopeBinding, NameBindingKind, Resolver, module_to_string}; @@ -203,7 +203,7 @@ impl<'a, 'ra, 'tcx> UnusedImportCheckVisitor<'a, 'ra, 'tcx> { if self .r .extern_prelude - .get(&extern_crate.ident) + .get(&Macros20NormalizedIdent::new(extern_crate.ident)) .is_none_or(|entry| entry.introduced_by_item) { continue; diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index d18554bba1b1..517e20e06196 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -30,7 +30,7 @@ use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; use rustc_span::source_map::SourceMap; -use rustc_span::{BytePos, Ident, Span, Symbol, SyntaxContext, kw, sym}; +use rustc_span::{BytePos, Ident, Macros20NormalizedIdent, Span, Symbol, SyntaxContext, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::{debug, instrument}; @@ -320,8 +320,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Check if the target of the use for both bindings is the same. let duplicate = new_binding.res().opt_def_id() == old_binding.res().opt_def_id(); let has_dummy_span = new_binding.span.is_dummy() || old_binding.span.is_dummy(); - let from_item = - self.extern_prelude.get(&ident).is_none_or(|entry| entry.introduced_by_item); + let from_item = self + .extern_prelude + .get(&Macros20NormalizedIdent::new(ident)) + .is_none_or(|entry| entry.introduced_by_item); // Only suggest removing an import if both bindings are to the same def, if both spans // aren't dummy spans. Further, if both bindings are imports, then the ident must have // been introduced by an item. @@ -467,13 +469,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { pub(crate) fn lint_if_path_starts_with_module( &mut self, - finalize: Option, + finalize: Finalize, path: &[Segment], second_binding: Option>, ) { - let Some(Finalize { node_id, root_span, .. }) = finalize else { - return; - }; + let Finalize { node_id, root_span, .. } = finalize; let first_name = match path.get(0) { // In the 2018 edition this lint is a hard error, so nothing to do @@ -530,7 +530,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { module.for_each_child(self, |_this, ident, _ns, binding| { let res = binding.res(); if filter_fn(res) && ctxt.is_none_or(|ctxt| ctxt == ident.span.ctxt()) { - names.push(TypoSuggestion::typo_from_ident(ident, res)); + names.push(TypoSuggestion::typo_from_ident(ident.0, res)); } }); } @@ -1027,7 +1027,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> Option { let mut suggestions = Vec::new(); let ctxt = ident.span.ctxt(); - self.visit_scopes(scope_set, parent_scope, ctxt, |this, scope, use_prelude, _| { + self.cm().visit_scopes(scope_set, parent_scope, ctxt, |this, scope, use_prelude, _| { match scope { Scope::DeriveHelpers(expn_id) => { let res = Res::NonMacroAttr(NonMacroAttrKind::DeriveHelper); @@ -1046,7 +1046,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if filter_fn(res) { for derive in parent_scope.derives { let parent_scope = &ParentScope { derives: &[], ..*parent_scope }; - let Ok((Some(ext), _)) = this.resolve_macro_path( + let Ok((Some(ext), _)) = this.reborrow().resolve_macro_path( derive, Some(MacroKind::Derive), parent_scope, @@ -1100,7 +1100,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Scope::ExternPrelude => { suggestions.extend(this.extern_prelude.keys().filter_map(|ident| { let res = Res::Def(DefKind::Mod, CRATE_DEF_ID.to_def_id()); - filter_fn(res).then_some(TypoSuggestion::typo_from_ident(*ident, res)) + filter_fn(res).then_some(TypoSuggestion::typo_from_ident(ident.0, res)) })); } Scope::ToolPrelude => { @@ -1246,7 +1246,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; segms.append(&mut path_segments.clone()); - segms.push(ast::PathSegment::from_ident(ident)); + segms.push(ast::PathSegment::from_ident(ident.0)); let path = Path { span: name_binding.span, segments: segms, tokens: None }; if child_accessible @@ -1319,7 +1319,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if let Some(def_id) = name_binding.res().module_like_def_id() { // form the path let mut path_segments = path_segments.clone(); - path_segments.push(ast::PathSegment::from_ident(ident)); + path_segments.push(ast::PathSegment::from_ident(ident.0)); let alias_import = if let NameBindingKind::Import { import, .. } = name_binding.kind @@ -1453,7 +1453,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if needs_disambiguation { crate_path.push(ast::PathSegment::path_root(rustc_span::DUMMY_SP)); } - crate_path.push(ast::PathSegment::from_ident(ident)); + crate_path.push(ast::PathSegment::from_ident(ident.0)); suggestions.extend(self.lookup_import_candidates_from_module( lookup_ident, @@ -1480,7 +1480,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) { // Bring imported but unused `derive` macros into `macro_map` so we ensure they can be used // for suggestions. - self.visit_scopes( + self.cm().visit_scopes( ScopeSet::Macro(MacroKind::Derive), &parent_scope, ident.span.ctxt(), @@ -1589,7 +1589,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }); } for ns in [Namespace::MacroNS, Namespace::TypeNS, Namespace::ValueNS] { - let Ok(binding) = self.early_resolve_ident_in_lexical_scope( + let Ok(binding) = self.cm().early_resolve_ident_in_lexical_scope( ident, ScopeSet::All(ns), parent_scope, @@ -2269,16 +2269,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if ns == TypeNS || ns == ValueNS { let ns_to_try = if ns == TypeNS { ValueNS } else { TypeNS }; let binding = if let Some(module) = module { - self.resolve_ident_in_module( - module, - ident, - ns_to_try, - parent_scope, - None, - ignore_binding, - ignore_import, - ) - .ok() + self.cm() + .resolve_ident_in_module( + module, + ident, + ns_to_try, + parent_scope, + None, + ignore_binding, + ignore_import, + ) + .ok() } else if let Some(ribs) = ribs && let Some(TypeNS | ValueNS) = opt_ns { @@ -2296,16 +2297,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { _ => None, } } else { - self.early_resolve_ident_in_lexical_scope( - ident, - ScopeSet::All(ns_to_try), - parent_scope, - None, - false, - ignore_binding, - ignore_import, - ) - .ok() + self.cm() + .early_resolve_ident_in_lexical_scope( + ident, + ScopeSet::All(ns_to_try), + parent_scope, + None, + false, + ignore_binding, + ignore_import, + ) + .ok() }; if let Some(binding) = binding { msg = format!( @@ -2399,7 +2401,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }, ) }); - if let Ok(binding) = self.early_resolve_ident_in_lexical_scope( + if let Ok(binding) = self.cm().early_resolve_ident_in_lexical_scope( ident, ScopeSet::All(ValueNS), parent_scope, @@ -2529,7 +2531,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> Option<(Vec, Option)> { // Replace first ident with `self` and check if that is valid. path[0].ident.name = kw::SelfLower; - let result = self.maybe_resolve_path(&path, None, parent_scope, None); + let result = self.cm().maybe_resolve_path(&path, None, parent_scope, None); debug!(?path, ?result); if let PathResult::Module(..) = result { Some((path, None)) } else { None } } @@ -2549,7 +2551,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> Option<(Vec, Option)> { // Replace first ident with `crate` and check if that is valid. path[0].ident.name = kw::Crate; - let result = self.maybe_resolve_path(&path, None, parent_scope, None); + let result = self.cm().maybe_resolve_path(&path, None, parent_scope, None); debug!(?path, ?result); if let PathResult::Module(..) = result { Some(( @@ -2581,7 +2583,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> Option<(Vec, Option)> { // Replace first ident with `crate` and check if that is valid. path[0].ident.name = kw::Super; - let result = self.maybe_resolve_path(&path, None, parent_scope, None); + let result = self.cm().maybe_resolve_path(&path, None, parent_scope, None); debug!(?path, ?result); if let PathResult::Module(..) = result { Some((path, None)) } else { None } } @@ -2616,7 +2618,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { for name in extern_crate_names.into_iter() { // Replace first ident with a crate name and check if that is valid. path[0].ident.name = name; - let result = self.maybe_resolve_path(&path, None, parent_scope, None); + let result = self.cm().maybe_resolve_path(&path, None, parent_scope, None); debug!(?path, ?name, ?result); if let PathResult::Module(..) = result { return Some((path, None)); diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index f5bc46bf0530..092bb6fc4f98 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -16,10 +16,10 @@ use crate::imports::{Import, NameResolution}; use crate::late::{ConstantHasGenerics, NoConstantGenericsReason, PathSource, Rib, RibKind}; use crate::macros::{MacroRulesScope, sub_namespace_match}; use crate::{ - AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, BindingKey, Determinacy, Finalize, - ImportKind, LexicalScopeBinding, Module, ModuleKind, ModuleOrUniformRoot, NameBinding, - NameBindingKind, ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope, - ScopeSet, Segment, Used, Weak, errors, + AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, BindingKey, CmResolver, Determinacy, + Finalize, ImportKind, LexicalScopeBinding, Module, ModuleKind, ModuleOrUniformRoot, + NameBinding, NameBindingKind, ParentScope, PathResult, PrivacyError, Res, ResolutionError, + Resolver, Scope, ScopeSet, Segment, Used, Weak, errors, }; #[derive(Copy, Clone)] @@ -44,12 +44,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { /// A generic scope visitor. /// Visits scopes in order to resolve some identifier in them or perform other actions. /// If the callback returns `Some` result, we stop visiting scopes and return it. - pub(crate) fn visit_scopes( - &mut self, + pub(crate) fn visit_scopes<'r, T>( + mut self: CmResolver<'r, 'ra, 'tcx>, scope_set: ScopeSet<'ra>, parent_scope: &ParentScope<'ra>, ctxt: SyntaxContext, - mut visitor: impl FnMut(&mut Self, Scope<'ra>, UsePrelude, SyntaxContext) -> Option, + mut visitor: impl FnMut( + &mut CmResolver<'r, 'ra, 'tcx>, + Scope<'ra>, + UsePrelude, + SyntaxContext, + ) -> Option, ) -> Option { // General principles: // 1. Not controlled (user-defined) names should have higher priority than controlled names @@ -146,7 +151,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if visit { let use_prelude = if use_prelude { UsePrelude::Yes } else { UsePrelude::No }; - if let break_result @ Some(..) = visitor(self, scope, use_prelude, ctxt) { + if let break_result @ Some(..) = visitor(&mut self, scope, use_prelude, ctxt) { return break_result; } } @@ -341,7 +346,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { _ => break, } - let item = self.resolve_ident_in_module_unadjusted( + let item = self.cm().resolve_ident_in_module_unadjusted( ModuleOrUniformRoot::Module(module), ident, ns, @@ -356,17 +361,18 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { return Some(LexicalScopeBinding::Item(binding)); } } - self.early_resolve_ident_in_lexical_scope( - orig_ident, - ScopeSet::Late(ns, module, finalize.map(|finalize| finalize.node_id)), - parent_scope, - finalize, - finalize.is_some(), - ignore_binding, - None, - ) - .ok() - .map(LexicalScopeBinding::Item) + self.cm() + .early_resolve_ident_in_lexical_scope( + orig_ident, + ScopeSet::Late(ns, module, finalize.map(|finalize| finalize.node_id)), + parent_scope, + finalize, + finalize.is_some(), + ignore_binding, + None, + ) + .ok() + .map(LexicalScopeBinding::Item) } /// Resolve an identifier in lexical scope. @@ -375,8 +381,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { /// The function is used for resolving initial segments of macro paths (e.g., `foo` in /// `foo::bar!();` or `foo!();`) and also for import paths on 2018 edition. #[instrument(level = "debug", skip(self))] - pub(crate) fn early_resolve_ident_in_lexical_scope( - &mut self, + pub(crate) fn early_resolve_ident_in_lexical_scope<'r>( + self: CmResolver<'r, 'ra, 'tcx>, orig_ident: Ident, scope_set: ScopeSet<'ra>, parent_scope: &ParentScope<'ra>, @@ -450,7 +456,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let mut result = Err(Determinacy::Determined); for derive in parent_scope.derives { let parent_scope = &ParentScope { derives: &[], ..*parent_scope }; - match this.resolve_macro_path( + match this.reborrow().resolve_macro_path( derive, Some(MacroKind::Derive), parent_scope, @@ -497,7 +503,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { finalize.map(|f| Finalize { used: Used::Scope, ..f }), ) }; - let binding = this.resolve_ident_in_module_unadjusted( + let binding = this.reborrow().resolve_ident_in_module_unadjusted( ModuleOrUniformRoot::Module(module), ident, ns, @@ -514,7 +520,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { match binding { Ok(binding) => { if let Some(lint_id) = derive_fallback_lint_id { - this.lint_buffer.buffer_lint( + this.get_mut().lint_buffer.buffer_lint( PROC_MACRO_DERIVE_RESOLUTION_FALLBACK, lint_id, orig_ident.span, @@ -556,7 +562,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { None => Err(Determinacy::Determined), }, Scope::ExternPrelude => { - match this.extern_prelude_get(ident, finalize.is_some()) { + match this.reborrow().extern_prelude_get(ident, finalize.is_some()) { Some(binding) => Ok((binding, Flags::empty())), None => Err(Determinacy::determined( this.graph_root.unexpanded_invocations.borrow().is_empty(), @@ -570,7 +576,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Scope::StdLibPrelude => { let mut result = Err(Determinacy::Determined); if let Some(prelude) = this.prelude - && let Ok(binding) = this.resolve_ident_in_module_unadjusted( + && let Ok(binding) = this.reborrow().resolve_ident_in_module_unadjusted( ModuleOrUniformRoot::Module(prelude), ident, ns, @@ -625,9 +631,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; match result { - Ok((binding, flags)) - if sub_namespace_match(binding.macro_kind(), macro_kind) => - { + Ok((binding, flags)) => { + let binding_macro_kind = binding.macro_kind(); + // If we're looking for an attribute, that might be supported by a + // `macro_rules!` macro. + // FIXME: Replace this with tracking multiple macro kinds for one Def. + if !(sub_namespace_match(binding_macro_kind, macro_kind) + || (binding_macro_kind == Some(MacroKind::Bang) + && macro_kind == Some(MacroKind::Attr) + && this + .get_macro(binding.res()) + .is_some_and(|macro_data| macro_data.attr_ext.is_some()))) + { + return None; + } + if finalize.is_none() || matches!(scope_set, ScopeSet::Late(..)) { return Some(Ok(binding)); } @@ -687,7 +705,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { AmbiguityErrorMisc::None } }; - this.ambiguity_errors.push(AmbiguityError { + this.get_mut().ambiguity_errors.push(AmbiguityError { kind, ident: orig_ident, b1: innermost_binding, @@ -704,7 +722,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { innermost_result = Some((binding, flags)); } } - Ok(..) | Err(Determinacy::Determined) => {} + Err(Determinacy::Determined) => {} Err(Determinacy::Undetermined) => determinacy = Determinacy::Undetermined, } @@ -725,8 +743,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } #[instrument(level = "debug", skip(self))] - pub(crate) fn maybe_resolve_ident_in_module( - &mut self, + pub(crate) fn maybe_resolve_ident_in_module<'r>( + self: CmResolver<'r, 'ra, 'tcx>, module: ModuleOrUniformRoot<'ra>, ident: Ident, ns: Namespace, @@ -738,8 +756,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } #[instrument(level = "debug", skip(self))] - pub(crate) fn resolve_ident_in_module( - &mut self, + pub(crate) fn resolve_ident_in_module<'r>( + self: CmResolver<'r, 'ra, 'tcx>, module: ModuleOrUniformRoot<'ra>, mut ident: Ident, ns: Namespace, @@ -776,12 +794,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ignore_import, ) } - /// Attempts to resolve `ident` in namespaces `ns` of `module`. /// Invariant: if `finalize` is `Some`, expansion and import resolution must be complete. #[instrument(level = "debug", skip(self))] - fn resolve_ident_in_module_unadjusted( - &mut self, + fn resolve_ident_in_module_unadjusted<'r>( + mut self: CmResolver<'r, 'ra, 'tcx>, module: ModuleOrUniformRoot<'ra>, ident: Ident, ns: Namespace, @@ -812,7 +829,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { assert_eq!(shadowing, Shadowing::Unrestricted); return if ns != TypeNS { Err((Determined, Weak::No)) - } else if let Some(binding) = self.extern_prelude_get(ident, finalize.is_some()) { + } else if let Some(binding) = + self.reborrow().extern_prelude_get(ident, finalize.is_some()) + { Ok(binding) } else if !self.graph_root.unexpanded_invocations.borrow().is_empty() { // Macro-expanded `extern crate` items can add names to extern prelude. @@ -865,7 +884,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .find_map(|binding| if binding == ignore_binding { None } else { binding }); if let Some(finalize) = finalize { - return self.finalize_module_binding( + return self.get_mut().finalize_module_binding( ident, binding, if resolution.non_glob_binding.is_some() { resolution.glob_binding } else { None }, @@ -875,7 +894,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ); } - let check_usable = |this: &Self, binding: NameBinding<'ra>| { + let check_usable = |this: CmResolver<'r, 'ra, 'tcx>, binding: NameBinding<'ra>| { let usable = this.is_accessible_from(binding.vis, parent_scope.module); if usable { Ok(binding) } else { Err((Determined, Weak::No)) } }; @@ -891,7 +910,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Check if one of single imports can still define the name, // if it can then our result is not determined and can be invalidated. - if self.single_import_can_define_name( + if self.reborrow().single_import_can_define_name( &resolution, binding, ns, @@ -962,7 +981,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Some(None) => {} None => continue, }; - let result = self.resolve_ident_in_module_unadjusted( + let result = self.reborrow().resolve_ident_in_module_unadjusted( ModuleOrUniformRoot::Module(module), ident, ns, @@ -1049,8 +1068,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Checks if a single import can define the `Ident` corresponding to `binding`. // This is used to check whether we can definitively accept a glob as a resolution. - fn single_import_can_define_name( - &mut self, + fn single_import_can_define_name<'r>( + mut self: CmResolver<'r, 'ra, 'tcx>, resolution: &NameResolution<'ra>, binding: Option>, ns: Namespace, @@ -1086,7 +1105,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } - match self.resolve_ident_in_module( + match self.reborrow().resolve_ident_in_module( module, *source, ns, @@ -1409,8 +1428,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } #[instrument(level = "debug", skip(self))] - pub(crate) fn maybe_resolve_path( - &mut self, + pub(crate) fn maybe_resolve_path<'r>( + self: CmResolver<'r, 'ra, 'tcx>, path: &[Segment], opt_ns: Option, // `None` indicates a module path in import parent_scope: &ParentScope<'ra>, @@ -1418,10 +1437,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) -> PathResult<'ra> { self.resolve_path_with_ribs(path, opt_ns, parent_scope, None, None, None, ignore_import) } - #[instrument(level = "debug", skip(self))] - pub(crate) fn resolve_path( - &mut self, + pub(crate) fn resolve_path<'r>( + self: CmResolver<'r, 'ra, 'tcx>, path: &[Segment], opt_ns: Option, // `None` indicates a module path in import parent_scope: &ParentScope<'ra>, @@ -1440,8 +1458,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) } - pub(crate) fn resolve_path_with_ribs( - &mut self, + pub(crate) fn resolve_path_with_ribs<'r>( + mut self: CmResolver<'r, 'ra, 'tcx>, path: &[Segment], opt_ns: Option, // `None` indicates a module path in import parent_scope: &ParentScope<'ra>, @@ -1457,18 +1475,23 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // We'll provide more context to the privacy errors later, up to `len`. let privacy_errors_len = self.privacy_errors.len(); + fn record_segment_res<'r, 'ra, 'tcx>( + mut this: CmResolver<'r, 'ra, 'tcx>, + finalize: Option, + res: Res, + id: Option, + ) { + if finalize.is_some() + && let Some(id) = id + && !this.partial_res_map.contains_key(&id) + { + assert!(id != ast::DUMMY_NODE_ID, "Trying to resolve dummy id"); + this.get_mut().record_partial_res(id, PartialRes::new(res)); + } + } for (segment_idx, &Segment { ident, id, .. }) in path.iter().enumerate() { debug!("resolve_path ident {} {:?} {:?}", segment_idx, ident, id); - let record_segment_res = |this: &mut Self, res| { - if finalize.is_some() - && let Some(id) = id - && !this.partial_res_map.contains_key(&id) - { - assert!(id != ast::DUMMY_NODE_ID, "Trying to resolve dummy id"); - this.record_partial_res(id, PartialRes::new(res)); - } - }; let is_last = segment_idx + 1 == path.len(); let ns = if is_last { opt_ns.unwrap_or(TypeNS) } else { TypeNS }; @@ -1507,7 +1530,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let mut ctxt = ident.span.ctxt().normalize_to_macros_2_0(); let self_mod = self.resolve_self(&mut ctxt, parent_scope.module); if let Some(res) = self_mod.res() { - record_segment_res(self, res); + record_segment_res(self.reborrow(), finalize, res, id); } module = Some(ModuleOrUniformRoot::Module(self_mod)); continue; @@ -1529,7 +1552,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // `::a::b`, `crate::a::b` or `$crate::a::b` let crate_root = self.resolve_crate_root(ident); if let Some(res) = crate_root.res() { - record_segment_res(self, res); + record_segment_res(self.reborrow(), finalize, res, id); } module = Some(ModuleOrUniformRoot::Module(crate_root)); continue; @@ -1562,21 +1585,22 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } let binding = if let Some(module) = module { - self.resolve_ident_in_module( - module, - ident, - ns, - parent_scope, - finalize, - ignore_binding, - ignore_import, - ) - .map_err(|(determinacy, _)| determinacy) + self.reborrow() + .resolve_ident_in_module( + module, + ident, + ns, + parent_scope, + finalize, + ignore_binding, + ignore_import, + ) + .map_err(|(determinacy, _)| determinacy) } else if let Some(ribs) = ribs && let Some(TypeNS | ValueNS) = opt_ns { assert!(ignore_import.is_none()); - match self.resolve_ident_in_lexical_scope( + match self.get_mut().resolve_ident_in_lexical_scope( ident, ns, parent_scope, @@ -1588,7 +1612,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Some(LexicalScopeBinding::Item(binding)) => Ok(binding), // we found a local variable or type param Some(LexicalScopeBinding::Res(res)) => { - record_segment_res(self, res); + record_segment_res(self.reborrow(), finalize, res, id); return PathResult::NonModule(PartialRes::with_unresolved_segments( res, path.len() - 1, @@ -1597,7 +1621,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { _ => Err(Determinacy::determined(finalize.is_some())), } } else { - self.early_resolve_ident_in_lexical_scope( + self.reborrow().early_resolve_ident_in_lexical_scope( ident, ScopeSet::All(ns), parent_scope, @@ -1618,8 +1642,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Mark every privacy error in this path with the res to the last element. This allows us // to detect the item the user cares about and either find an alternative import, or tell // the user it is not accessible. - for error in &mut self.privacy_errors[privacy_errors_len..] { - error.outermost_res = Some((res, ident)); + if finalize.is_some() { + for error in &mut self.get_mut().privacy_errors[privacy_errors_len..] { + error.outermost_res = Some((res, ident)); + } } let maybe_assoc = opt_ns != Some(MacroNS) && PathSource::Type.is_expected(res); @@ -1628,7 +1654,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { module_had_parse_errors = true; } module = Some(ModuleOrUniformRoot::Module(self.expect_module(def_id))); - record_segment_res(self, res); + record_segment_res(self.reborrow(), finalize, res, id); } else if res == Res::ToolMod && !is_last && opt_ns.is_some() { if binding.is_import() { self.dcx().emit_err(errors::ToolModuleImported { @@ -1641,8 +1667,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } else if res == Res::Err { return PathResult::NonModule(PartialRes::new(Res::Err)); } else if opt_ns.is_some() && (is_last || maybe_assoc) { - self.lint_if_path_starts_with_module(finalize, path, second_binding); - record_segment_res(self, res); + if let Some(finalize) = finalize { + self.get_mut().lint_if_path_starts_with_module( + finalize, + path, + second_binding, + ); + } + record_segment_res(self.reborrow(), finalize, res, id); return PathResult::NonModule(PartialRes::with_unresolved_segments( res, path.len() - segment_idx - 1, @@ -1677,6 +1709,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { )); } + let mut this = self.reborrow(); return PathResult::failed( ident, is_last, @@ -1684,7 +1717,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { module_had_parse_errors, module, || { - self.report_path_resolution_error( + this.get_mut().report_path_resolution_error( path, opt_ns, parent_scope, @@ -1701,7 +1734,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } - self.lint_if_path_starts_with_module(finalize, path, second_binding); + if let Some(finalize) = finalize { + self.get_mut().lint_if_path_starts_with_module(finalize, path, second_binding); + } PathResult::Module(match module { Some(module) => module, diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 156df45147fd..403d440bee78 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -33,9 +33,10 @@ use crate::errors::{ ConsiderAddingMacroExport, ConsiderMarkingAsPub, }; use crate::{ - AmbiguityError, AmbiguityKind, BindingKey, Determinacy, Finalize, ImportSuggestion, Module, - ModuleOrUniformRoot, NameBinding, NameBindingData, NameBindingKind, ParentScope, PathResult, - PerNS, ResolutionError, Resolver, ScopeSet, Segment, Used, module_to_string, names_to_string, + AmbiguityError, AmbiguityKind, BindingKey, CmResolver, Determinacy, Finalize, ImportSuggestion, + Module, ModuleOrUniformRoot, NameBinding, NameBindingData, NameBindingKind, ParentScope, + PathResult, PerNS, ResolutionError, Resolver, ScopeSet, Segment, Used, module_to_string, + names_to_string, }; type Res = def::Res; @@ -489,7 +490,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Define or update `binding` in `module`s glob importers. for import in glob_importers.iter() { let mut ident = key.ident; - let scope = match ident.span.reverse_glob_adjust(module.expansion, import.span) { + let scope = match ident.0.span.reverse_glob_adjust(module.expansion, import.span) { Some(Some(def)) => self.expn_def_scope(def), Some(None) => import.parent_scope.module, None => continue, @@ -498,7 +499,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let imported_binding = self.import(binding, *import); let _ = self.try_define_local( import.parent_scope.module, - ident, + ident.0, key.ns, imported_binding, warn_ambiguity, @@ -551,13 +552,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { /// Resolves all imports for the crate. This method performs the fixed- /// point iteration. pub(crate) fn resolve_imports(&mut self) { + self.assert_speculative = true; let mut prev_indeterminate_count = usize::MAX; let mut indeterminate_count = self.indeterminate_imports.len() * 3; while indeterminate_count < prev_indeterminate_count { prev_indeterminate_count = indeterminate_count; indeterminate_count = 0; for import in mem::take(&mut self.indeterminate_imports) { - let import_indeterminate_count = self.resolve_import(import); + let import_indeterminate_count = self.cm().resolve_import(import); indeterminate_count += import_indeterminate_count; match import_indeterminate_count { 0 => self.determined_imports.push(import), @@ -565,6 +567,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } } + self.assert_speculative = false; } pub(crate) fn finalize_imports(&mut self) { @@ -837,7 +840,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { /// /// Meanwhile, if resolve successful, the resolved bindings are written /// into the module. - fn resolve_import(&mut self, import: Import<'ra>) -> usize { + fn resolve_import<'r>(mut self: CmResolver<'r, 'ra, 'tcx>, import: Import<'ra>) -> usize { debug!( "(resolving import for module) resolving import `{}::...` in `{}`", Segment::names_to_string(&import.module_path), @@ -846,7 +849,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let module = if let Some(module) = import.imported_module.get() { module } else { - let path_res = self.maybe_resolve_path( + let path_res = self.reborrow().maybe_resolve_path( &import.module_path, None, &import.parent_scope, @@ -866,19 +869,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { (source, target, bindings, type_ns_only) } ImportKind::Glob { .. } => { - self.resolve_glob_import(import); + // FIXME: Use mutable resolver directly as a hack, this should be an output of + // specualtive resolution. + self.get_mut_unchecked().resolve_glob_import(import); return 0; } _ => unreachable!(), }; let mut indeterminate_count = 0; - self.per_ns(|this, ns| { + self.per_ns_cm(|this, ns| { if !type_ns_only || ns == TypeNS { if bindings[ns].get() != PendingBinding::Pending { return; }; - let binding_result = this.maybe_resolve_ident_in_module( + let binding_result = this.reborrow().maybe_resolve_ident_in_module( module, source, ns, @@ -901,16 +906,30 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } // We need the `target`, `source` can be extracted. let imported_binding = this.import(binding, import); - this.define_binding_local(parent, target, ns, imported_binding); + // FIXME: Use mutable resolver directly as a hack, this should be an output of + // specualtive resolution. + this.get_mut_unchecked().define_binding_local( + parent, + target, + ns, + imported_binding, + ); PendingBinding::Ready(Some(imported_binding)) } Err(Determinacy::Determined) => { // Don't remove underscores from `single_imports`, they were never added. if target.name != kw::Underscore { let key = BindingKey::new(target, ns); - this.update_local_resolution(parent, key, false, |_, resolution| { - resolution.single_imports.swap_remove(&import); - }); + // FIXME: Use mutable resolver directly as a hack, this should be an output of + // specualtive resolution. + this.get_mut_unchecked().update_local_resolution( + parent, + key, + false, + |_, resolution| { + resolution.single_imports.swap_remove(&import); + }, + ); } PendingBinding::Ready(None) } @@ -943,7 +962,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // We'll provide more context to the privacy errors later, up to `len`. let privacy_errors_len = self.privacy_errors.len(); - let path_res = self.resolve_path( + let path_res = self.cm().resolve_path( &import.module_path, None, &import.parent_scope, @@ -1060,7 +1079,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // 2 segments, so the `resolve_path` above won't trigger it. let mut full_path = import.module_path.clone(); full_path.push(Segment::from_ident(Ident::dummy())); - self.lint_if_path_starts_with_module(Some(finalize), &full_path, None); + self.lint_if_path_starts_with_module(finalize, &full_path, None); } if let ModuleOrUniformRoot::Module(module) = module @@ -1103,7 +1122,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // importing it if available. let mut path = import.module_path.clone(); path.push(Segment::from_ident(ident)); - if let PathResult::Module(ModuleOrUniformRoot::Module(module)) = self.resolve_path( + if let PathResult::Module(ModuleOrUniformRoot::Module(module)) = self.cm().resolve_path( &path, None, &import.parent_scope, @@ -1121,7 +1140,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let mut all_ns_err = true; self.per_ns(|this, ns| { if !type_ns_only || ns == TypeNS { - let binding = this.resolve_ident_in_module( + let binding = this.cm().resolve_ident_in_module( module, ident, ns, @@ -1184,7 +1203,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let mut all_ns_failed = true; self.per_ns(|this, ns| { if !type_ns_only || ns == TypeNS { - let binding = this.resolve_ident_in_module( + let binding = this.cm().resolve_ident_in_module( module, ident, ns, @@ -1373,7 +1392,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { full_path.push(Segment::from_ident(ident)); self.per_ns(|this, ns| { if let Some(binding) = bindings[ns].get().binding().map(|b| b.import_source()) { - this.lint_if_path_starts_with_module(Some(finalize), &full_path, Some(binding)); + this.lint_if_path_starts_with_module(finalize, &full_path, Some(binding)); } }); } @@ -1426,7 +1445,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { return; } - match this.early_resolve_ident_in_lexical_scope( + match this.cm().early_resolve_ident_in_lexical_scope( target, ScopeSet::All(ns), &import.parent_scope, @@ -1504,7 +1523,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }) .collect::>(); for (mut key, binding) in bindings { - let scope = match key.ident.span.reverse_glob_adjust(module.expansion, import.span) { + let scope = match key.ident.0.span.reverse_glob_adjust(module.expansion, import.span) { Some(Some(def)) => self.expn_def_scope(def), Some(None) => import.parent_scope.module, None => continue, @@ -1517,7 +1536,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .is_some_and(|binding| binding.warn_ambiguity_recursive()); let _ = self.try_define_local( import.parent_scope.module, - key.ident, + key.ident.0, key.ns, imported_binding, warn_ambiguity, @@ -1550,7 +1569,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { next_binding = binding; } - children.push(ModChild { ident, res, vis: binding.vis, reexport_chain }); + children.push(ModChild { ident: ident.0, res, vis: binding.vis, reexport_chain }); } }); diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 163e4b5b7a94..fb6f57257040 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -1424,7 +1424,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { // During late resolution we only track the module component of the parent scope, // although it may be useful to track other components as well for diagnostics. let graph_root = resolver.graph_root; - let parent_scope = ParentScope::module(graph_root, resolver); + let parent_scope = ParentScope::module(graph_root, resolver.arenas); let start_rib_kind = RibKind::Module(graph_root); LateResolutionVisitor { r: resolver, @@ -1484,7 +1484,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { opt_ns: Option, // `None` indicates a module path in import finalize: Option, ) -> PathResult<'ra> { - self.r.resolve_path_with_ribs( + self.r.cm().resolve_path_with_ribs( path, opt_ns, &self.parent_scope, @@ -4466,9 +4466,15 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { if qself.is_none() { let path_seg = |seg: &Segment| PathSegment::from_ident(seg.ident); let path = Path { segments: path.iter().map(path_seg).collect(), span, tokens: None }; - if let Ok((_, res)) = - self.r.resolve_macro_path(&path, None, &self.parent_scope, false, false, None, None) - { + if let Ok((_, res)) = self.r.cm().resolve_macro_path( + &path, + None, + &self.parent_scope, + false, + false, + None, + None, + ) { return Ok(Some(PartialRes::new(res))); } } diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index c8ca57a380fe..19cd45294ebd 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1472,7 +1472,10 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { }) .collect(); if let [target] = targets.as_slice() { - return Some(TypoSuggestion::single_item_from_ident(target.0.ident, target.1)); + return Some(TypoSuggestion::single_item_from_ident( + target.0.ident.0, + target.1, + )); } } } @@ -2386,7 +2389,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { // Look for associated items in the current trait. if let Some((module, _)) = self.current_trait_ref - && let Ok(binding) = self.r.maybe_resolve_ident_in_module( + && let Ok(binding) = self.r.cm().maybe_resolve_ident_in_module( ModuleOrUniformRoot::Module(module), ident, ns, @@ -2479,7 +2482,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { names.extend(self.r.extern_prelude.keys().flat_map(|ident| { let res = Res::Def(DefKind::Mod, CRATE_DEF_ID.to_def_id()); filter_fn(res) - .then_some(TypoSuggestion::typo_from_ident(*ident, res)) + .then_some(TypoSuggestion::typo_from_ident(ident.0, res)) })); if let Some(prelude) = self.r.prelude { @@ -2639,7 +2642,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { if let Some(module_def_id) = name_binding.res().module_like_def_id() { // form the path let mut path_segments = path_segments.clone(); - path_segments.push(ast::PathSegment::from_ident(ident)); + path_segments.push(ast::PathSegment::from_ident(ident.0)); let doc_visible = doc_visible && (module_def_id.is_local() || !r.tcx.is_doc_hidden(module_def_id)); if module_def_id == def_id { @@ -2678,7 +2681,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { enum_module.for_each_child(self.r, |_, ident, _, name_binding| { if let Res::Def(DefKind::Ctor(CtorOf::Variant, kind), def_id) = name_binding.res() { let mut segms = enum_import_suggestion.path.segments.clone(); - segms.push(ast::PathSegment::from_ident(ident)); + segms.push(ast::PathSegment::from_ident(ident.0)); let path = Path { span: name_binding.span, segments: segms, tokens: None }; variants.push((path, def_id, kind)); } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 6b034c5129f3..23f44ff16583 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -12,6 +12,7 @@ #![allow(rustc::untranslatable_diagnostic)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] +#![feature(arbitrary_self_types)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(if_let_guard)] @@ -71,7 +72,7 @@ use rustc_query_system::ich::StableHashingContext; use rustc_session::lint::builtin::PRIVATE_MACRO_USE; use rustc_session::lint::{BuiltinLintDiag, LintBuffer}; use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind, SyntaxContext, Transparency}; -use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym}; +use rustc_span::{DUMMY_SP, Ident, Macros20NormalizedIdent, Span, Symbol, kw, sym}; use smallvec::{SmallVec, smallvec}; use tracing::debug; @@ -162,11 +163,11 @@ struct ParentScope<'ra> { impl<'ra> ParentScope<'ra> { /// Creates a parent scope with the passed argument used as the module scope component, /// and other scope components set to default empty values. - fn module(module: Module<'ra>, resolver: &Resolver<'ra, '_>) -> ParentScope<'ra> { + fn module(module: Module<'ra>, arenas: &'ra ResolverArenas<'ra>) -> ParentScope<'ra> { ParentScope { module, expansion: LocalExpnId::ROOT, - macro_rules: resolver.arenas.alloc_macro_rules_scope(MacroRulesScope::Empty), + macro_rules: arenas.alloc_macro_rules_scope(MacroRulesScope::Empty), derives: &[], } } @@ -531,7 +532,7 @@ impl ModuleKind { struct BindingKey { /// The identifier for the binding, always the `normalize_to_macros_2_0` version of the /// identifier. - ident: Ident, + ident: Macros20NormalizedIdent, ns: Namespace, /// When we add an underscore binding (with ident `_`) to some module, this field has /// a non-zero value that uniquely identifies this binding in that module. @@ -543,7 +544,7 @@ struct BindingKey { impl BindingKey { fn new(ident: Ident, ns: Namespace) -> Self { - BindingKey { ident: ident.normalize_to_macros_2_0(), ns, disambiguator: 0 } + BindingKey { ident: Macros20NormalizedIdent::new(ident), ns, disambiguator: 0 } } fn new_disambiguated( @@ -552,7 +553,7 @@ impl BindingKey { disambiguator: impl FnOnce() -> u32, ) -> BindingKey { let disambiguator = if ident.name == kw::Underscore { disambiguator() } else { 0 }; - BindingKey { ident: ident.normalize_to_macros_2_0(), ns, disambiguator } + BindingKey { ident: Macros20NormalizedIdent::new(ident), ns, disambiguator } } } @@ -593,7 +594,8 @@ struct ModuleData<'ra> { globs: RefCell>>, /// Used to memoize the traits in this module for faster searches through all traits in scope. - traits: RefCell, Option>)]>>>, + traits: + RefCell, Option>)]>>>, /// Span of the module itself. Used for error reporting. span: Span, @@ -659,7 +661,7 @@ impl<'ra> Module<'ra> { fn for_each_child<'tcx, R: AsRef>>( self, resolver: &R, - mut f: impl FnMut(&R, Ident, Namespace, NameBinding<'ra>), + mut f: impl FnMut(&R, Macros20NormalizedIdent, Namespace, NameBinding<'ra>), ) { for (key, name_resolution) in resolver.as_ref().resolutions(self).borrow().iter() { if let Some(binding) = name_resolution.borrow().best_binding() { @@ -671,7 +673,7 @@ impl<'ra> Module<'ra> { fn for_each_child_mut<'tcx, R: AsMut>>( self, resolver: &mut R, - mut f: impl FnMut(&mut R, Ident, Namespace, NameBinding<'ra>), + mut f: impl FnMut(&mut R, Macros20NormalizedIdent, Namespace, NameBinding<'ra>), ) { for (key, name_resolution) in resolver.as_mut().resolutions(self).borrow().iter() { if let Some(binding) = name_resolution.borrow().best_binding() { @@ -1027,13 +1029,14 @@ struct DeriveData { struct MacroData { ext: Arc, + attr_ext: Option>, nrules: usize, macro_rules: bool, } impl MacroData { fn new(ext: Arc) -> MacroData { - MacroData { ext, nrules: 0, macro_rules: false } + MacroData { ext, attr_ext: None, nrules: 0, macro_rules: false } } } @@ -1053,8 +1056,11 @@ pub struct Resolver<'ra, 'tcx> { graph_root: Module<'ra>, + /// Assert that we are in speculative resolution mode. + assert_speculative: bool, + prelude: Option>, - extern_prelude: FxIndexMap>, + extern_prelude: FxIndexMap>, /// N.B., this is used only for better diagnostics, not name resolution itself. field_names: LocalDefIdMap>, @@ -1155,10 +1161,11 @@ pub struct Resolver<'ra, 'tcx> { unused_macro_rules: FxIndexMap>, proc_macro_stubs: FxHashSet, /// Traces collected during macro resolution and validated when it's complete. + // FIXME: Remove interior mutability when speculative resolution produces these as outputs. single_segment_macro_resolutions: - Vec<(Ident, MacroKind, ParentScope<'ra>, Option>, Option)>, + RefCell, Option>, Option)>>, multi_segment_macro_resolutions: - Vec<(Vec, Span, MacroKind, ParentScope<'ra>, Option, Namespace)>, + RefCell, Span, MacroKind, ParentScope<'ra>, Option, Namespace)>>, builtin_attrs: Vec<(Ident, ParentScope<'ra>)>, /// `derive(Copy)` marks items they are applied to so they are treated specially later. /// Derive macros cannot modify the item themselves and have to store the markers in the global @@ -1499,7 +1506,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { && let name = Symbol::intern(name) && name.can_be_raw() { - Some((Ident::with_dummy_span(name), Default::default())) + Some((Macros20NormalizedIdent::with_dummy_span(name), Default::default())) } else { None } @@ -1507,9 +1514,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .collect(); if !attr::contains_name(attrs, sym::no_core) { - extern_prelude.insert(Ident::with_dummy_span(sym::core), Default::default()); + extern_prelude + .insert(Macros20NormalizedIdent::with_dummy_span(sym::core), Default::default()); if !attr::contains_name(attrs, sym::no_std) { - extern_prelude.insert(Ident::with_dummy_span(sym::std), Default::default()); + extern_prelude + .insert(Macros20NormalizedIdent::with_dummy_span(sym::std), Default::default()); } } @@ -1524,6 +1533,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // The outermost module has def ID 0; this is not reflected in the // AST. graph_root, + assert_speculative: false, // Only set/cleared in Resolver::resolve_imports for now prelude: None, extern_prelude, @@ -1641,7 +1651,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { impl_trait_names: Default::default(), }; - let root_parent_scope = ParentScope::module(graph_root, &resolver); + let root_parent_scope = ParentScope::module(graph_root, resolver.arenas); resolver.invocation_parent_scopes.insert(LocalExpnId::ROOT, root_parent_scope); resolver.feed_visibility(crate_feed, Visibility::Public); @@ -1789,6 +1799,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } + /// Returns a conditionally mutable resolver. + /// + /// Currently only dependent on `assert_speculative`, if `assert_speculative` is false, + /// the resolver will allow mutation; otherwise, it will be immutable. + fn cm(&mut self) -> CmResolver<'_, 'ra, 'tcx> { + CmResolver::new(self, !self.assert_speculative) + } + /// Runs the function on each namespace. fn per_ns(&mut self, mut f: F) { f(self, TypeNS); @@ -1796,6 +1814,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { f(self, MacroNS); } + fn per_ns_cm<'r, F: FnMut(&mut CmResolver<'r, 'ra, 'tcx>, Namespace)>( + mut self: CmResolver<'r, 'ra, 'tcx>, + mut f: F, + ) { + f(&mut self, TypeNS); + f(&mut self, ValueNS); + f(&mut self, MacroNS); + } + fn is_builtin_macro(&self, res: Res) -> bool { self.get_macro(res).is_some_and(|macro_data| macro_data.ext.builtin_name.is_some()) } @@ -1849,14 +1876,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } - self.visit_scopes(ScopeSet::All(TypeNS), parent_scope, ctxt, |this, scope, _, _| { + self.cm().visit_scopes(ScopeSet::All(TypeNS), parent_scope, ctxt, |this, scope, _, _| { match scope { Scope::Module(module, _) => { - this.traits_in_module(module, assoc_item, &mut found_traits); + this.get_mut().traits_in_module(module, assoc_item, &mut found_traits); } Scope::StdLibPrelude => { if let Some(module) = this.prelude { - this.traits_in_module(module, assoc_item, &mut found_traits); + this.get_mut().traits_in_module(module, assoc_item, &mut found_traits); } } Scope::ExternPrelude | Scope::ToolPrelude | Scope::BuiltinTypes => {} @@ -1879,7 +1906,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { for &(trait_name, trait_binding, trait_module) in traits.as_ref().unwrap().iter() { if self.trait_may_have_item(trait_module, assoc_item) { let def_id = trait_binding.res().def_id(); - let import_ids = self.find_transitive_imports(&trait_binding.kind, trait_name); + let import_ids = self.find_transitive_imports(&trait_binding.kind, trait_name.0); found_traits.push(TraitCandidate { def_id, import_ids }); } } @@ -1999,14 +2026,17 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Do not report the lint if the macro name resolves in stdlib prelude // even without the problematic `macro_use` import. let found_in_stdlib_prelude = self.prelude.is_some_and(|prelude| { - self.maybe_resolve_ident_in_module( - ModuleOrUniformRoot::Module(prelude), - ident, - MacroNS, - &ParentScope::module(self.empty_module, self), - None, - ) - .is_ok() + let empty_module = self.empty_module; + let arenas = self.arenas; + self.cm() + .maybe_resolve_ident_in_module( + ModuleOrUniformRoot::Module(prelude), + ident, + MacroNS, + &ParentScope::module(empty_module, arenas), + None, + ) + .is_ok() }); if !found_in_stdlib_prelude { self.lint_buffer().buffer_lint( @@ -2020,7 +2050,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // Avoid marking `extern crate` items that refer to a name from extern prelude, // but not introduce it, as used if they are accessed from lexical scope. if used == Used::Scope { - if let Some(entry) = self.extern_prelude.get(&ident.normalize_to_macros_2_0()) { + if let Some(entry) = self.extern_prelude.get(&Macros20NormalizedIdent::new(ident)) { if !entry.introduced_by_item && entry.binding.get() == Some(used_binding) { return; } @@ -2177,9 +2207,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } - fn extern_prelude_get(&mut self, ident: Ident, finalize: bool) -> Option> { + fn extern_prelude_get<'r>( + mut self: CmResolver<'r, 'ra, 'tcx>, + ident: Ident, + finalize: bool, + ) -> Option> { let mut record_use = None; - let entry = self.extern_prelude.get(&ident.normalize_to_macros_2_0()); + let entry = self.extern_prelude.get(&Macros20NormalizedIdent::new(ident)); let binding = entry.and_then(|entry| match entry.binding.get() { Some(binding) if binding.is_import() => { if finalize { @@ -2213,7 +2247,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }); if let Some(binding) = record_use { - self.record_use(ident, binding, Used::Scope); + self.get_mut().record_use(ident, binding, Used::Scope); } binding @@ -2248,7 +2282,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { .collect(); let Ok(segments) = segments else { return None }; - match self.maybe_resolve_path(&segments, Some(ns), &parent_scope, None) { + match self.cm().maybe_resolve_path(&segments, Some(ns), &parent_scope, None) { PathResult::Module(ModuleOrUniformRoot::Module(module)) => Some(module.res().unwrap()), PathResult::NonModule(path_res) => { path_res.full_res().filter(|res| !matches!(res, Res::Def(DefKind::Ctor(..), _))) @@ -2327,9 +2361,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { fn resolve_main(&mut self) { let module = self.graph_root; let ident = Ident::with_dummy_span(sym::main); - let parent_scope = &ParentScope::module(module, self); + let parent_scope = &ParentScope::module(module, self.arenas); - let Ok(name_binding) = self.maybe_resolve_ident_in_module( + let Ok(name_binding) = self.cm().maybe_resolve_ident_in_module( ModuleOrUniformRoot::Module(module), ident, ValueNS, @@ -2423,3 +2457,63 @@ impl Finalize { pub fn provide(providers: &mut Providers) { providers.registered_tools = macros::registered_tools; } + +mod ref_mut { + use std::ops::Deref; + + /// A wrapper around a mutable reference that conditionally allows mutable access. + pub(crate) struct RefOrMut<'a, T> { + p: &'a mut T, + mutable: bool, + } + + impl<'a, T> Deref for RefOrMut<'a, T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + self.p + } + } + + impl<'a, T> AsRef for RefOrMut<'a, T> { + fn as_ref(&self) -> &T { + self.p + } + } + + impl<'a, T> RefOrMut<'a, T> { + pub(crate) fn new(p: &'a mut T, mutable: bool) -> Self { + RefOrMut { p, mutable } + } + + /// This is needed because this wraps a `&mut T` and is therefore not `Copy`. + pub(crate) fn reborrow(&mut self) -> RefOrMut<'_, T> { + RefOrMut { p: self.p, mutable: self.mutable } + } + + /// Returns a mutable reference to the inner value if allowed. + /// + /// # Panics + /// Panics if the `mutable` flag is false. + #[track_caller] + pub(crate) fn get_mut(&mut self) -> &mut T { + match self.mutable { + false => panic!("Can't mutably borrow speculative resolver"), + true => self.p, + } + } + + /// Returns a mutable reference to the inner value without checking if + /// it's in a mutable state. + pub(crate) fn get_mut_unchecked(&mut self) -> &mut T { + self.p + } + } +} + +/// A wrapper around `&mut Resolver` that may be mutable or immutable, depending on a conditions. +/// +/// `Cm` stands for "conditionally mutable". +/// +/// Prefer constructing it through [`Resolver::cm`] to ensure correctness. +type CmResolver<'r, 'ra, 'tcx> = ref_mut::RefOrMut<'r, Resolver<'ra, 'tcx>>; diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 4e3c0cd5bc00..9173d0d3ea5e 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -41,9 +41,9 @@ use crate::errors::{ }; use crate::imports::Import; use crate::{ - BindingKey, DeriveData, Determinacy, Finalize, InvocationParent, MacroData, ModuleKind, - ModuleOrUniformRoot, NameBinding, NameBindingKind, ParentScope, PathResult, ResolutionError, - Resolver, ScopeSet, Segment, Used, + BindingKey, CmResolver, DeriveData, Determinacy, Finalize, InvocationParent, MacroData, + ModuleKind, ModuleOrUniformRoot, NameBinding, NameBindingKind, ParentScope, PathResult, + ResolutionError, Resolver, ScopeSet, Segment, Used, }; type Res = def::Res; @@ -403,7 +403,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { for (i, resolution) in entry.resolutions.iter_mut().enumerate() { if resolution.exts.is_none() { resolution.exts = Some( - match self.resolve_macro_path( + match self.cm().resolve_macro_path( &resolution.path, Some(MacroKind::Derive), &parent_scope, @@ -536,11 +536,11 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { target_trait.for_each_child(self, |this, ident, ns, _binding| { // FIXME: Adjust hygiene for idents from globs, like for glob imports. if let Some(overriding_keys) = this.impl_binding_keys.get(&impl_def_id) - && overriding_keys.contains(&BindingKey::new(ident, ns)) + && overriding_keys.contains(&BindingKey::new(ident.0, ns)) { // The name is overridden, do not produce it from the glob delegation. } else { - idents.push((ident, None)); + idents.push((ident.0, None)); } }); Ok(idents) @@ -568,7 +568,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { invoc_in_mod_inert_attr: Option, suggestion_span: Option, ) -> Result<(Arc, Res), Indeterminate> { - let (ext, res) = match self.resolve_macro_or_delegation_path( + let (ext, res) = match self.cm().resolve_macro_or_delegation_path( path, Some(kind), parent_scope, @@ -713,8 +713,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { Ok((ext, res)) } - pub(crate) fn resolve_macro_path( - &mut self, + pub(crate) fn resolve_macro_path<'r>( + self: CmResolver<'r, 'ra, 'tcx>, path: &ast::Path, kind: Option, parent_scope: &ParentScope<'ra>, @@ -736,8 +736,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ) } - fn resolve_macro_or_delegation_path( - &mut self, + fn resolve_macro_or_delegation_path<'r>( + mut self: CmResolver<'r, 'ra, 'tcx>, ast_path: &ast::Path, kind: Option, parent_scope: &ParentScope<'ra>, @@ -763,7 +763,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let res = if deleg_impl.is_some() || path.len() > 1 { let ns = if deleg_impl.is_some() { TypeNS } else { MacroNS }; - let res = match self.maybe_resolve_path(&path, Some(ns), parent_scope, ignore_import) { + let res = match self.reborrow().maybe_resolve_path( + &path, + Some(ns), + parent_scope, + ignore_import, + ) { PathResult::NonModule(path_res) if let Some(res) = path_res.full_res() => Ok(res), PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined), PathResult::NonModule(..) @@ -777,7 +782,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if trace { let kind = kind.expect("macro kind must be specified if tracing is enabled"); - self.multi_segment_macro_resolutions.push(( + // FIXME: Should be an output of Speculative Resolution. + self.multi_segment_macro_resolutions.borrow_mut().push(( path, path_span, kind, @@ -791,7 +797,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { res } else { let scope_set = kind.map_or(ScopeSet::All(MacroNS), ScopeSet::Macro); - let binding = self.early_resolve_ident_in_lexical_scope( + let binding = self.reborrow().early_resolve_ident_in_lexical_scope( path[0].ident, scope_set, parent_scope, @@ -806,7 +812,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { if trace { let kind = kind.expect("macro kind must be specified if tracing is enabled"); - self.single_segment_macro_resolutions.push(( + // FIXME: Should be an output of Speculative Resolution. + self.single_segment_macro_resolutions.borrow_mut().push(( path[0].ident, kind, *parent_scope, @@ -817,7 +824,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let res = binding.map(|binding| binding.res()); self.prohibit_imported_non_macro_attrs(binding.ok(), res.ok(), path_span); - self.report_out_of_scope_macro_calls( + self.reborrow().report_out_of_scope_macro_calls( ast_path, parent_scope, invoc_in_mod_inert_attr, @@ -835,7 +842,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } _ => None, }, - None => self.get_macro(res).map(|macro_data| Arc::clone(¯o_data.ext)), + None => self.get_macro(res).map(|macro_data| match kind { + Some(MacroKind::Attr) if let Some(ref ext) = macro_data.attr_ext => Arc::clone(ext), + _ => Arc::clone(¯o_data.ext), + }), }; Ok((ext, res)) } @@ -872,13 +882,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } }; - let macro_resolutions = mem::take(&mut self.multi_segment_macro_resolutions); + // FIXME: Should be an output of Speculative Resolution. + let macro_resolutions = self.multi_segment_macro_resolutions.take(); for (mut path, path_span, kind, parent_scope, initial_res, ns) in macro_resolutions { // FIXME: Path resolution will ICE if segment IDs present. for seg in &mut path { seg.id = None; } - match self.resolve_path( + match self.cm().resolve_path( &path, Some(ns), &parent_scope, @@ -905,8 +916,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { path_res { // try to suggest if it's not a macro, maybe a function - if let PathResult::NonModule(partial_res) = - self.maybe_resolve_path(&path, Some(ValueNS), &parent_scope, None) + if let PathResult::NonModule(partial_res) = self + .cm() + .maybe_resolve_path(&path, Some(ValueNS), &parent_scope, None) && partial_res.unresolved_segments() == 0 { let sm = self.tcx.sess.source_map(); @@ -948,9 +960,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } - let macro_resolutions = mem::take(&mut self.single_segment_macro_resolutions); + // FIXME: Should be an output of Speculative Resolution. + let macro_resolutions = self.single_segment_macro_resolutions.take(); for (ident, kind, parent_scope, initial_binding, sugg_span) in macro_resolutions { - match self.early_resolve_ident_in_lexical_scope( + match self.cm().early_resolve_ident_in_lexical_scope( ident, ScopeSet::Macro(kind), &parent_scope, @@ -1005,7 +1018,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let builtin_attrs = mem::take(&mut self.builtin_attrs); for (ident, parent_scope) in builtin_attrs { - let _ = self.early_resolve_ident_in_lexical_scope( + let _ = self.cm().early_resolve_ident_in_lexical_scope( ident, ScopeSet::Macro(MacroKind::Attr), &parent_scope, @@ -1090,8 +1103,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { } } - fn report_out_of_scope_macro_calls( - &mut self, + fn report_out_of_scope_macro_calls<'r>( + mut self: CmResolver<'r, 'ra, 'tcx>, path: &ast::Path, parent_scope: &ParentScope<'ra>, invoc_in_mod_inert_attr: Option<(LocalDefId, NodeId)>, @@ -1110,7 +1123,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // If such resolution is successful and gives the same result // (e.g. if the macro is re-imported), then silence the lint. let no_macro_rules = self.arenas.alloc_macro_rules_scope(MacroRulesScope::Empty); - let fallback_binding = self.early_resolve_ident_in_lexical_scope( + let fallback_binding = self.reborrow().early_resolve_ident_in_lexical_scope( path.segments[0].ident, ScopeSet::Macro(MacroKind::Bang), &ParentScope { macro_rules: no_macro_rules, ..*parent_scope }, @@ -1168,7 +1181,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { node_id: NodeId, edition: Edition, ) -> MacroData { - let (mut ext, mut nrules) = compile_declarative_macro( + let (mut ext, mut attr_ext, mut nrules) = compile_declarative_macro( self.tcx.sess, self.tcx.features(), macro_def, @@ -1185,13 +1198,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // The macro is a built-in, replace its expander function // while still taking everything else from the source code. ext.kind = builtin_ext_kind.clone(); + attr_ext = None; nrules = 0; } else { self.dcx().emit_err(errors::CannotFindBuiltinMacroWithName { span, ident }); } } - MacroData { ext: Arc::new(ext), nrules, macro_rules: macro_def.macro_rules } + MacroData { ext: Arc::new(ext), attr_ext, nrules, macro_rules: macro_def.macro_rules } } fn path_accessible( @@ -1206,7 +1220,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let mut indeterminate = false; for ns in namespaces { - match self.maybe_resolve_path(path, Some(*ns), &parent_scope, None) { + match self.cm().maybe_resolve_path(path, Some(*ns), &parent_scope, None) { PathResult::Module(ModuleOrUniformRoot::Module(_)) => return Ok(true), PathResult::NonModule(partial_res) if partial_res.unresolved_segments() == 0 => { return Ok(true); diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs index 52717d73b8ae..d81fa062e010 100644 --- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs +++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs @@ -342,7 +342,7 @@ pub(crate) fn transform_instance<'tcx>( let upcast_ty = match tcx.trait_of_assoc(def_id) { Some(trait_id) => trait_object_ty( tcx, - ty::Binder::dummy(ty::TraitRef::from_method(tcx, trait_id, instance.args)), + ty::Binder::dummy(ty::TraitRef::from_assoc(tcx, trait_id, instance.args)), ), // drop_in_place won't have a defining trait, skip the upcast None => instance.args.type_at(0), @@ -481,7 +481,7 @@ fn implemented_method<'tcx>( trait_method = trait_method_bound; method_id = instance.def_id(); trait_id = tcx.trait_of_assoc(method_id)?; - trait_ref = ty::EarlyBinder::bind(TraitRef::from_method(tcx, trait_id, instance.args)); + trait_ref = ty::EarlyBinder::bind(TraitRef::from_assoc(tcx, trait_id, instance.args)); trait_id } else { return None; diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index cfeadf3c7595..c665c85d1fea 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -190,7 +190,7 @@ pub struct CoverageOptions { pub discard_all_spans_in_codegen: bool, } -/// Controls whether branch coverage or MC/DC coverage is enabled. +/// Controls whether branch coverage is enabled. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default)] pub enum CoverageLevel { /// Instrument for coverage at the MIR block level. @@ -214,9 +214,6 @@ pub enum CoverageLevel { /// instrumentation, so it might be removed in the future when MC/DC is /// sufficiently complete, or if it is making MC/DC changes difficult. Condition, - /// Instrument for MC/DC. Mostly a superset of condition coverage, but might - /// differ in some corner cases. - Mcdc, } // The different settings that the `-Z offload` flag can have. diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 880b08d44441..7c18fd890980 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -755,7 +755,7 @@ mod desc { pub(crate) const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of(); pub(crate) const parse_dump_mono_stats: &str = "`markdown` (default) or `json`"; pub(crate) const parse_instrument_coverage: &str = parse_bool; - pub(crate) const parse_coverage_options: &str = "`block` | `branch` | `condition` | `mcdc`"; + pub(crate) const parse_coverage_options: &str = "`block` | `branch` | `condition`"; pub(crate) const parse_instrument_xray: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or a comma separated list of settings: `always` or `never` (mutually exclusive), `ignore-loops`, `instruction-threshold=N`, `skip-entry`, `skip-exit`"; pub(crate) const parse_unpretty: &str = "`string` or `string=string`"; pub(crate) const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; @@ -1458,7 +1458,6 @@ pub mod parse { "block" => slot.level = CoverageLevel::Block, "branch" => slot.level = CoverageLevel::Branch, "condition" => slot.level = CoverageLevel::Condition, - "mcdc" => slot.level = CoverageLevel::Mcdc, "discard-all-spans-in-codegen" => slot.discard_all_spans_in_codegen = true, _ => return false, } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index b94636fea94e..c6956cf5f23b 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -354,11 +354,6 @@ impl Session { && self.opts.unstable_opts.coverage_options.level >= CoverageLevel::Condition } - pub fn instrument_coverage_mcdc(&self) -> bool { - self.instrument_coverage() - && self.opts.unstable_opts.coverage_options.level >= CoverageLevel::Mcdc - } - /// Provides direct access to the `CoverageOptions` struct, so that /// individual flags for debugging/testing coverage instrumetation don't /// need separate accessors. diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 3f72ccd9f89d..d647ec28aae5 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -66,7 +66,8 @@ pub use span_encoding::{DUMMY_SP, Span}; pub mod symbol; pub use symbol::{ - ByteSymbol, Ident, MacroRulesNormalizedIdent, STDLIB_STABLE_CRATES, Symbol, kw, sym, + ByteSymbol, Ident, MacroRulesNormalizedIdent, Macros20NormalizedIdent, STDLIB_STABLE_CRATES, + Symbol, kw, sym, }; mod analyze_source_file; diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index d54175548e30..5462ed38dd3d 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -3,6 +3,7 @@ //! type, and vice versa. use std::hash::{Hash, Hasher}; +use std::ops::Deref; use std::{fmt, str}; use rustc_arena::DroplessArena; @@ -1310,6 +1311,7 @@ symbols! { lt, m68k_target_feature, macro_at_most_once_rep, + macro_attr, macro_attributes_in_derive_output, macro_concat, macro_escape, @@ -1512,6 +1514,7 @@ symbols! { not, notable_trait, note, + nvptx_target_feature, object_safe_for_dispatch, of, off, @@ -2562,16 +2565,17 @@ impl fmt::Display for IdentPrinter { } /// An newtype around `Ident` that calls [Ident::normalize_to_macro_rules] on -/// construction. -// FIXME(matthewj, petrochenkov) Use this more often, add a similar -// `ModernIdent` struct and use that as well. +/// construction for "local variable hygiene" comparisons. +/// +/// Use this type when you need to compare identifiers according to macro_rules hygiene. +/// This ensures compile-time safety and avoids manual normalization calls. #[derive(Copy, Clone, Eq, PartialEq, Hash)] pub struct MacroRulesNormalizedIdent(Ident); impl MacroRulesNormalizedIdent { #[inline] pub fn new(ident: Ident) -> Self { - Self(ident.normalize_to_macro_rules()) + MacroRulesNormalizedIdent(ident.normalize_to_macro_rules()) } } @@ -2587,6 +2591,48 @@ impl fmt::Display for MacroRulesNormalizedIdent { } } +/// An newtype around `Ident` that calls [Ident::normalize_to_macros_2_0] on +/// construction for "item hygiene" comparisons. +/// +/// Identifiers with same string value become same if they came from the same macro 2.0 macro +/// (e.g., `macro` item, but not `macro_rules` item) and stay different if they came from +/// different macro 2.0 macros. +#[derive(Copy, Clone, Eq, PartialEq, Hash)] +pub struct Macros20NormalizedIdent(pub Ident); + +impl Macros20NormalizedIdent { + #[inline] + pub fn new(ident: Ident) -> Self { + Macros20NormalizedIdent(ident.normalize_to_macros_2_0()) + } + + // dummy_span does not need to be normalized, so we can use `Ident` directly + pub fn with_dummy_span(name: Symbol) -> Self { + Macros20NormalizedIdent(Ident::with_dummy_span(name)) + } +} + +impl fmt::Debug for Macros20NormalizedIdent { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.0, f) + } +} + +impl fmt::Display for Macros20NormalizedIdent { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Display::fmt(&self.0, f) + } +} + +/// By impl Deref, we can access the wrapped Ident as if it were a normal Ident +/// such as `norm_ident.name` instead of `norm_ident.0.name`. +impl Deref for Macros20NormalizedIdent { + type Target = Ident; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + /// An interned UTF-8 string. /// /// Internally, a `Symbol` is implemented as an index, and all operations diff --git a/compiler/rustc_symbol_mangling/src/legacy.rs b/compiler/rustc_symbol_mangling/src/legacy.rs index aa8292c05044..a7f64085bd91 100644 --- a/compiler/rustc_symbol_mangling/src/legacy.rs +++ b/compiler/rustc_symbol_mangling/src/legacy.rs @@ -234,7 +234,9 @@ impl<'tcx> Printer<'tcx> for SymbolPrinter<'tcx> { } fn print_region(&mut self, _region: ty::Region<'_>) -> Result<(), PrintError> { - unreachable!(); // because `::should_print_region` returns false + // This might be reachable (via `pretty_print_dyn_existential`) even though + // `::should_print_region` returns false. See #144994. + Ok(()) } fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> { diff --git a/compiler/rustc_target/src/spec/abi_map.rs b/compiler/rustc_target/src/spec/abi_map.rs index b13e21124787..23e74539ddc0 100644 --- a/compiler/rustc_target/src/spec/abi_map.rs +++ b/compiler/rustc_target/src/spec/abi_map.rs @@ -60,7 +60,15 @@ impl AbiMap { "x86_64" => Arch::X86_64, _ => Arch::Other, }; - let os = if target.is_like_windows { OsKind::Windows } else { OsKind::Other }; + + let os = if target.is_like_windows { + OsKind::Windows + } else if target.is_like_vexos { + OsKind::VEXos + } else { + OsKind::Other + }; + AbiMap { arch, os } } @@ -82,6 +90,10 @@ impl AbiMap { (ExternAbi::System { .. }, Arch::X86) if os == OsKind::Windows && !has_c_varargs => { CanonAbi::X86(X86Call::Stdcall) } + (ExternAbi::System { .. }, Arch::Arm(..)) if self.os == OsKind::VEXos => { + // Calls to VEXos APIs do not use VFP registers. + CanonAbi::Arm(ArmCall::Aapcs) + } (ExternAbi::System { .. }, _) => CanonAbi::C, // fallible lowerings @@ -191,6 +203,7 @@ enum Arch { #[derive(Debug, PartialEq, Copy, Clone)] enum OsKind { Windows, + VEXos, Other, } diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index aa6d1ec7009e..da9f96ce37d3 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -51,14 +51,14 @@ impl Arch { }) } - fn target_cpu(self, abi: TargetAbi) -> &'static str { + fn target_cpu(self, env: TargetEnv) -> &'static str { match self { Armv7k => "cortex-a8", Armv7s => "swift", // iOS 10 is only supported on iPhone 5 or higher. - Arm64 => match abi { - TargetAbi::Normal => "apple-a7", - TargetAbi::Simulator => "apple-a12", - TargetAbi::MacCatalyst => "apple-a12", + Arm64 => match env { + TargetEnv::Normal => "apple-a7", + TargetEnv::Simulator => "apple-a12", + TargetEnv::MacCatalyst => "apple-a12", }, Arm64e => "apple-a12", Arm64_32 => "apple-s4", @@ -83,14 +83,14 @@ impl Arch { } #[derive(Copy, Clone, PartialEq)] -pub(crate) enum TargetAbi { +pub(crate) enum TargetEnv { Normal, Simulator, MacCatalyst, } -impl TargetAbi { - fn target_abi(self) -> &'static str { +impl TargetEnv { + fn target_env(self) -> &'static str { match self { Self::Normal => "", Self::MacCatalyst => "macabi", @@ -104,13 +104,20 @@ impl TargetAbi { pub(crate) fn base( os: &'static str, arch: Arch, - abi: TargetAbi, + env: TargetEnv, ) -> (TargetOptions, StaticCow, StaticCow) { let mut opts = TargetOptions { - abi: abi.target_abi().into(), llvm_floatabi: Some(FloatAbi::Hard), os: os.into(), - cpu: arch.target_cpu(abi).into(), + env: env.target_env().into(), + // NOTE: We originally set `cfg(target_abi = "macabi")` / `cfg(target_abi = "sim")`, + // before it was discovered that those are actually environments: + // https://github.com/rust-lang/rust/issues/133331 + // + // But let's continue setting them for backwards compatibility. + // FIXME(madsmtm): Warn about using these in the future. + abi: env.target_env().into(), + cpu: arch.target_cpu(env).into(), link_env_remove: link_env_remove(os), vendor: "apple".into(), linker_flavor: LinkerFlavor::Darwin(Cc::Yes, Lld::No), @@ -168,14 +175,14 @@ pub(crate) fn base( // All Apple x86-32 targets have SSE2. opts.rustc_abi = Some(RustcAbi::X86Sse2); } - (opts, unversioned_llvm_target(os, arch, abi), arch.target_arch()) + (opts, unversioned_llvm_target(os, arch, env), arch.target_arch()) } /// Generate part of the LLVM target triple. /// /// See `rustc_codegen_ssa::back::versioned_llvm_target` for the full triple passed to LLVM and /// Clang. -fn unversioned_llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow { +fn unversioned_llvm_target(os: &str, arch: Arch, env: TargetEnv) -> StaticCow { let arch = arch.target_name(); // Convert to the "canonical" OS name used by LLVM: // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L236-L282 @@ -187,10 +194,10 @@ fn unversioned_llvm_target(os: &str, arch: Arch, abi: TargetAbi) -> StaticCow "xros", _ => unreachable!("tried to get LLVM target OS for non-Apple platform"), }; - let environment = match abi { - TargetAbi::Normal => "", - TargetAbi::MacCatalyst => "-macabi", - TargetAbi::Simulator => "-simulator", + let environment = match env { + TargetEnv::Normal => "", + TargetEnv::MacCatalyst => "-macabi", + TargetEnv::Simulator => "-simulator", }; format!("{arch}-apple-{os}{environment}").into() } @@ -309,7 +316,7 @@ impl OSVersion { /// This matches what LLVM does, see in part: /// pub fn minimum_deployment_target(target: &Target) -> Self { - let (major, minor, patch) = match (&*target.os, &*target.arch, &*target.abi) { + let (major, minor, patch) = match (&*target.os, &*target.arch, &*target.env) { ("macos", "aarch64", _) => (11, 0, 0), ("ios", "aarch64", "macabi") => (14, 0, 0), ("ios", "aarch64", "sim") => (14, 0, 0), diff --git a/compiler/rustc_target/src/spec/base/apple/tests.rs b/compiler/rustc_target/src/spec/base/apple/tests.rs index 391f34701043..bca86ce33c3d 100644 --- a/compiler/rustc_target/src/spec/base/apple/tests.rs +++ b/compiler/rustc_target/src/spec/base/apple/tests.rs @@ -6,7 +6,7 @@ use crate::spec::targets::{ }; #[test] -fn simulator_targets_set_abi() { +fn simulator_targets_set_env() { let all_sim_targets = [ x86_64_apple_ios::target(), x86_64_apple_tvos::target(), @@ -18,7 +18,9 @@ fn simulator_targets_set_abi() { ]; for target in &all_sim_targets { - assert_eq!(target.abi, "sim") + assert_eq!(target.env, "sim"); + // Ensure backwards compat + assert_eq!(target.abi, "sim"); } } diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs index d27c1929aef7..6c44b7ff52fe 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -153,6 +153,7 @@ impl Target { forward!(is_like_msvc); forward!(is_like_wasm); forward!(is_like_android); + forward!(is_like_vexos); forward!(binary_format); forward!(default_dwarf_version); forward!(allows_weak_linkage); @@ -345,6 +346,7 @@ impl ToJson for Target { target_option_val!(is_like_msvc); target_option_val!(is_like_wasm); target_option_val!(is_like_android); + target_option_val!(is_like_vexos); target_option_val!(binary_format); target_option_val!(default_dwarf_version); target_option_val!(allows_weak_linkage); @@ -538,6 +540,7 @@ struct TargetSpecJson { is_like_msvc: Option, is_like_wasm: Option, is_like_android: Option, + is_like_vexos: Option, binary_format: Option, default_dwarf_version: Option, allows_weak_linkage: Option, diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 033590e01a67..b9fbff8db05b 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2101,6 +2101,7 @@ supported_targets! { ("armv7a-none-eabihf", armv7a_none_eabihf), ("armv7a-nuttx-eabi", armv7a_nuttx_eabi), ("armv7a-nuttx-eabihf", armv7a_nuttx_eabihf), + ("armv7a-vex-v5", armv7a_vex_v5), ("msp430-none-elf", msp430_none_elf), @@ -2571,6 +2572,8 @@ pub struct TargetOptions { pub is_like_wasm: bool, /// Whether a target toolchain is like Android, implying a Linux kernel and a Bionic libc pub is_like_android: bool, + /// Whether a target toolchain is like VEXos, the operating system used by the VEX Robotics V5 Brain. + pub is_like_vexos: bool, /// Target's binary file format. Defaults to BinaryFormat::Elf pub binary_format: BinaryFormat, /// Default supported version of DWARF on this platform. @@ -2953,6 +2956,7 @@ impl Default for TargetOptions { is_like_msvc: false, is_like_wasm: false, is_like_android: false, + is_like_vexos: false, binary_format: BinaryFormat::Elf, default_dwarf_version: 4, allows_weak_linkage: true, diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs index 4dd39877715a..e19604725559 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("macos", Arch::Arm64, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("macos", Arch::Arm64, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs index 769a7b6c3919..3b522c34522b 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs index 4bb2f73e4f9f..4d6a3103ee30 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::MacCatalyst); + let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetEnv::MacCatalyst); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs index 7d04034e759b..d366ed264820 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("ios", Arch::Arm64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs index ec92a40e255f..7aef6f96e1c5 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs index 74fbe5a89ca7..f0d17db873bf 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("tvos", Arch::Arm64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs index dc595fbe7b6c..22ce52e637f3 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs index 06ff1bfb2f07..21739ba9fdb7 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("visionos", Arch::Arm64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs index 235962711072..2e88f95f1dd8 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs index bad9f6c1485c..272dc682dc0e 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("watchos", Arch::Arm64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs index 4c3a2f437438..564ac2cd7081 100644 --- a/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("watchos", Arch::Arm64_32, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("watchos", Arch::Arm64_32, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs index 326f2b16d594..86e178a95728 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("macos", Arch::Arm64e, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("macos", Arch::Arm64e, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs index 01c6f0b888d6..dae3f77d7ae3 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("ios", Arch::Arm64e, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("ios", Arch::Arm64e, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs index cad3650bda1a..a99fc5dc68c9 100644 --- a/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("tvos", Arch::Arm64e, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("tvos", Arch::Arm64e, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs b/compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs new file mode 100644 index 000000000000..e78f78399747 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs @@ -0,0 +1,44 @@ +use crate::spec::{ + Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, + TargetOptions, +}; + +const LINKER_SCRIPT: &str = include_str!("./armv7a_vex_v5_linker_script.ld"); + +pub(crate) fn target() -> Target { + let opts = TargetOptions { + vendor: "vex".into(), + env: "v5".into(), + os: "vexos".into(), + cpu: "cortex-a9".into(), + abi: "eabihf".into(), + is_like_vexos: true, + llvm_floatabi: Some(FloatAbi::Hard), + linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), + linker: Some("rust-lld".into()), + features: "+v7,+neon,+vfp3d16,+thumb2".into(), + relocation_model: RelocModel::Static, + disable_redzone: true, + max_atomic_width: Some(64), + panic_strategy: PanicStrategy::Abort, + emit_debug_gdb_scripts: false, + c_enum_min_bits: Some(8), + default_uwtable: true, + has_thumb_interworking: true, + link_script: Some(LINKER_SCRIPT.into()), + ..Default::default() + }; + Target { + llvm_target: "armv7a-none-eabihf".into(), + metadata: TargetMetadata { + description: Some("ARMv7-A Cortex-A9 VEX V5 Brain".into()), + tier: Some(3), + host_tools: Some(false), + std: Some(false), + }, + pointer_width: 32, + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), + arch: "arm".into(), + options: opts, + } +} diff --git a/compiler/rustc_target/src/spec/targets/armv7a_vex_v5_linker_script.ld b/compiler/rustc_target/src/spec/targets/armv7a_vex_v5_linker_script.ld new file mode 100644 index 000000000000..a4783de01830 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/armv7a_vex_v5_linker_script.ld @@ -0,0 +1,144 @@ +OUTPUT_FORMAT("elf32-littlearm") +ENTRY(_boot) + +/* + * PROVIDE() is used here so that users can override default values. + * This is intended to give developers the option to use this Rust + * target even if the default values in this linker script aren't + * suitable for their needs. + * + * For example: `-C link-arg=--defsym=__stack_length=8M` could + * be used to increase the stack size above the value set in this + * file. + */ + +PROVIDE(__vcodesig_magic = 0x35585658); /* XVX5 */ +PROVIDE(__vcodesig_type = 0); /* V5_SIG_TYPE_USER */ +PROVIDE(__vcodesig_owner = 2); /* V5_SIG_OWNER_PARTNER */ +PROVIDE(__vcodesig_options = 0); /* none (0) */ + +PROVIDE(__user_ram_start = 0x03800000); +PROVIDE(__user_ram_length = 48M); +PROVIDE(__user_ram_end = __user_ram_start + __user_ram_length); /* 0x8000000 */ + +PROVIDE(__code_signature_length = 0x20); + +PROVIDE(__stack_length = 4M); +PROVIDE(__heap_end = __user_ram_end - __stack_length); +PROVIDE(__user_length = __heap_start - __user_ram_start); + +MEMORY { + USER_RAM (RWX) : ORIGIN = __user_ram_start, LENGTH = __user_ram_length +} + +SECTIONS { + /* + * VEXos expects program binaries to have a 32-byte header called a "code signature" + * at their start which tells the OS that we are a valid program and configures some + * miscellaneous startup behavior. + */ + .code_signature : { + LONG(__vcodesig_magic) + LONG(__vcodesig_type) + LONG(__vcodesig_owner) + LONG(__vcodesig_options) + + FILL(0) + . = __user_ram_start + __code_signature_length; + } > USER_RAM + + /* + * Executable program instructions. + */ + .text : { + /* _boot routine (entry point from VEXos, must be at 0x03800020) */ + *(.boot) + + /* The rest of the program. */ + *(.text .text.*) + } > USER_RAM + + /* + * Global/uninitialized/static/constant data sections. + */ + .rodata : { + *(.rodata .rodata1 .rodata.*) + *(.srodata .srodata.*) + } > USER_RAM + + /* + * ARM Stack Unwinding Sections + * + * These sections are added by the compiler in some cases to facilitate stack unwinding. + * __eh_frame_start and similar symbols are used by libunwind. + */ + + .except_ordered : { + PROVIDE(__extab_start = .); + *(.gcc_except_table *.gcc_except_table.*) + *(.ARM.extab*) + PROVIDE(__extab_end = .); + } > USER_RAM + + .eh_frame_hdr : { + /* see https://github.com/llvm/llvm-project/blob/main/libunwind/src/AddressSpace.hpp#L78 */ + PROVIDE(__eh_frame_hdr_start = .); + KEEP(*(.eh_frame_hdr)) + PROVIDE(__eh_frame_hdr_end = .); + } > USER_RAM + + .eh_frame : { + PROVIDE(__eh_frame_start = .); + KEEP(*(.eh_frame)) + PROVIDE(__eh_frame_end = .); + } > USER_RAM + + .except_unordered : { + PROVIDE(__exidx_start = .); + *(.ARM.exidx*) + PROVIDE(__exidx_end = .); + } > USER_RAM + + /* -- Data intended to be mutable at runtime begins here. -- */ + + .data : { + *(.data .data1 .data.*) + *(.sdata .sdata.* .sdata2.*) + } > USER_RAM + + /* -- End of loadable sections - anything beyond this point shouldn't go in the binary uploaded to the device. -- */ + + .bss (NOLOAD) : { + __bss_start = .; + *(.sbss*) + *(.bss .bss.*) + + /* Align the heap */ + . = ALIGN(8); + __bss_end = .; + } > USER_RAM + + /* + * Active memory sections for the stack/heap. + * + * Because these are (NOLOAD), they will not influence the final size of the binary. + */ + .heap (NOLOAD) : { + __heap_start = .; + . = __heap_end; + } > USER_RAM + + .stack (NOLOAD) : ALIGN(8) { + __stack_bottom = .; + . += __stack_length; + __stack_top = .; + } > USER_RAM + + /* + * `.ARM.attributes` contains arch metadata for compatibility purposes, but we + * only target one hardware configuration, meaning it'd just take up space. + */ + /DISCARD/ : { + *(.ARM.attributes*) + } +} diff --git a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs index 8103d132cea8..df58559848a0 100644 --- a/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs +++ b/compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("watchos", Arch::Armv7k, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("watchos", Arch::Armv7k, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs index ba9edd714612..63259043b73d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("ios", Arch::Armv7s, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("ios", Arch::Armv7s, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs index 29865fcd4c4e..a919be765a27 100644 --- a/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/i386_apple_ios.rs @@ -1,10 +1,10 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { // i386-apple-ios is a simulator target, even though it isn't declared // that way in the target name like the other ones... - let (opts, llvm_target, arch) = base("ios", Arch::I386, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("ios", Arch::I386, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs index d1339c57b008..96c477d52367 100644 --- a/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("macos", Arch::I686, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("macos", Arch::I686, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs index eba595ba7dd2..53e2cb469ee8 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("macos", Arch::X86_64, TargetAbi::Normal); + let (opts, llvm_target, arch) = base("macos", Arch::X86_64, TargetEnv::Normal); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs index df45f430ecbf..d74a688fa0f7 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs @@ -1,10 +1,10 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { // x86_64-apple-ios is a simulator target, even though it isn't declared // that way in the target name like the other ones... - let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs index ee0c2bf31cd4..193e26f94c98 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetAbi::MacCatalyst); + let (opts, llvm_target, arch) = base("ios", Arch::X86_64, TargetEnv::MacCatalyst); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs index 80ca80013f05..e69bd17a0496 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs @@ -1,10 +1,10 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { // x86_64-apple-tvos is a simulator target, even though it isn't declared // that way in the target name like the other ones... - let (opts, llvm_target, arch) = base("tvos", Arch::X86_64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("tvos", Arch::X86_64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs index c503baedb8b5..9490ca6aa36c 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (opts, llvm_target, arch) = base("watchos", Arch::X86_64, TargetAbi::Simulator); + let (opts, llvm_target, arch) = base("watchos", Arch::X86_64, TargetEnv::Simulator); Target { llvm_target, metadata: TargetMetadata { diff --git a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs index e64556c4132a..67b5a160a89a 100644 --- a/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs +++ b/compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs @@ -1,8 +1,8 @@ -use crate::spec::base::apple::{Arch, TargetAbi, base}; +use crate::spec::base::apple::{Arch, TargetEnv, base}; use crate::spec::{SanitizerSet, Target, TargetMetadata, TargetOptions}; pub(crate) fn target() -> Target { - let (mut opts, llvm_target, arch) = base("macos", Arch::X86_64h, TargetAbi::Normal); + let (mut opts, llvm_target, arch) = base("macos", Arch::X86_64h, TargetEnv::Normal); opts.max_atomic_width = Some(128); opts.supported_sanitizers = SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK | SanitizerSet::THREAD; diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index b2af99228fe6..297d9ed84c50 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -517,6 +517,71 @@ const MIPS_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ // tidy-alphabetical-end ]; +const NVPTX_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ + // tidy-alphabetical-start + ("sm_20", Unstable(sym::nvptx_target_feature), &[]), + ("sm_21", Unstable(sym::nvptx_target_feature), &["sm_20"]), + ("sm_30", Unstable(sym::nvptx_target_feature), &["sm_21"]), + ("sm_32", Unstable(sym::nvptx_target_feature), &["sm_30"]), + ("sm_35", Unstable(sym::nvptx_target_feature), &["sm_32"]), + ("sm_37", Unstable(sym::nvptx_target_feature), &["sm_35"]), + ("sm_50", Unstable(sym::nvptx_target_feature), &["sm_37"]), + ("sm_52", Unstable(sym::nvptx_target_feature), &["sm_50"]), + ("sm_53", Unstable(sym::nvptx_target_feature), &["sm_52"]), + ("sm_60", Unstable(sym::nvptx_target_feature), &["sm_53"]), + ("sm_61", Unstable(sym::nvptx_target_feature), &["sm_60"]), + ("sm_62", Unstable(sym::nvptx_target_feature), &["sm_61"]), + ("sm_70", Unstable(sym::nvptx_target_feature), &["sm_62"]), + ("sm_72", Unstable(sym::nvptx_target_feature), &["sm_70"]), + ("sm_75", Unstable(sym::nvptx_target_feature), &["sm_72"]), + ("sm_80", Unstable(sym::nvptx_target_feature), &["sm_75"]), + ("sm_86", Unstable(sym::nvptx_target_feature), &["sm_80"]), + ("sm_87", Unstable(sym::nvptx_target_feature), &["sm_86"]), + ("sm_89", Unstable(sym::nvptx_target_feature), &["sm_87"]), + ("sm_90", Unstable(sym::nvptx_target_feature), &["sm_89"]), + ("sm_90a", Unstable(sym::nvptx_target_feature), &["sm_90"]), + // tidy-alphabetical-end + // tidy-alphabetical-start + ("sm_100", Unstable(sym::nvptx_target_feature), &["sm_90"]), + ("sm_100a", Unstable(sym::nvptx_target_feature), &["sm_100"]), + ("sm_101", Unstable(sym::nvptx_target_feature), &["sm_100"]), + ("sm_101a", Unstable(sym::nvptx_target_feature), &["sm_101"]), + ("sm_120", Unstable(sym::nvptx_target_feature), &["sm_101"]), + ("sm_120a", Unstable(sym::nvptx_target_feature), &["sm_120"]), + // tidy-alphabetical-end + // tidy-alphabetical-start + ("ptx32", Unstable(sym::nvptx_target_feature), &[]), + ("ptx40", Unstable(sym::nvptx_target_feature), &["ptx32"]), + ("ptx41", Unstable(sym::nvptx_target_feature), &["ptx40"]), + ("ptx42", Unstable(sym::nvptx_target_feature), &["ptx41"]), + ("ptx43", Unstable(sym::nvptx_target_feature), &["ptx42"]), + ("ptx50", Unstable(sym::nvptx_target_feature), &["ptx43"]), + ("ptx60", Unstable(sym::nvptx_target_feature), &["ptx50"]), + ("ptx61", Unstable(sym::nvptx_target_feature), &["ptx60"]), + ("ptx62", Unstable(sym::nvptx_target_feature), &["ptx61"]), + ("ptx63", Unstable(sym::nvptx_target_feature), &["ptx62"]), + ("ptx64", Unstable(sym::nvptx_target_feature), &["ptx63"]), + ("ptx65", Unstable(sym::nvptx_target_feature), &["ptx64"]), + ("ptx70", Unstable(sym::nvptx_target_feature), &["ptx65"]), + ("ptx71", Unstable(sym::nvptx_target_feature), &["ptx70"]), + ("ptx72", Unstable(sym::nvptx_target_feature), &["ptx71"]), + ("ptx73", Unstable(sym::nvptx_target_feature), &["ptx72"]), + ("ptx74", Unstable(sym::nvptx_target_feature), &["ptx73"]), + ("ptx75", Unstable(sym::nvptx_target_feature), &["ptx74"]), + ("ptx76", Unstable(sym::nvptx_target_feature), &["ptx75"]), + ("ptx77", Unstable(sym::nvptx_target_feature), &["ptx76"]), + ("ptx78", Unstable(sym::nvptx_target_feature), &["ptx77"]), + ("ptx80", Unstable(sym::nvptx_target_feature), &["ptx78"]), + ("ptx81", Unstable(sym::nvptx_target_feature), &["ptx80"]), + ("ptx82", Unstable(sym::nvptx_target_feature), &["ptx81"]), + ("ptx83", Unstable(sym::nvptx_target_feature), &["ptx82"]), + ("ptx84", Unstable(sym::nvptx_target_feature), &["ptx83"]), + ("ptx85", Unstable(sym::nvptx_target_feature), &["ptx84"]), + ("ptx86", Unstable(sym::nvptx_target_feature), &["ptx85"]), + ("ptx87", Unstable(sym::nvptx_target_feature), &["ptx86"]), + // tidy-alphabetical-end +]; + static RISCV_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ // tidy-alphabetical-start ("a", Stable, &["zaamo", "zalrsc"]), @@ -782,6 +847,7 @@ pub fn all_rust_features() -> impl Iterator { .chain(HEXAGON_FEATURES.iter()) .chain(POWERPC_FEATURES.iter()) .chain(MIPS_FEATURES.iter()) + .chain(NVPTX_FEATURES.iter()) .chain(RISCV_FEATURES.iter()) .chain(WASM_FEATURES.iter()) .chain(BPF_FEATURES.iter()) @@ -847,6 +913,7 @@ impl Target { "x86" | "x86_64" => X86_FEATURES, "hexagon" => HEXAGON_FEATURES, "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES, + "nvptx64" => NVPTX_FEATURES, "powerpc" | "powerpc64" => POWERPC_FEATURES, "riscv32" | "riscv64" => RISCV_FEATURES, "wasm32" | "wasm64" => WASM_FEATURES, @@ -873,7 +940,7 @@ impl Target { "sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI, "hexagon" => HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI, "mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI, - "bpf" | "m68k" => &[], // no vector ABI + "nvptx64" | "bpf" | "m68k" => &[], // no vector ABI "csky" => CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI, // FIXME: for some tier3 targets, we are overly cautious and always give warnings // when passing args in vector registers. diff --git a/compiler/rustc_thread_pool/Cargo.toml b/compiler/rustc_thread_pool/Cargo.toml index b01948342645..c92984470b7a 100644 --- a/compiler/rustc_thread_pool/Cargo.toml +++ b/compiler/rustc_thread_pool/Cargo.toml @@ -7,7 +7,6 @@ authors = [ ] description = "Core APIs for Rayon - fork for rustc" license = "MIT OR Apache-2.0" -rust-version = "1.63" edition = "2021" readme = "README.md" keywords = ["parallel", "thread", "concurrency", "join", "performance"] diff --git a/compiler/rustc_trait_selection/messages.ftl b/compiler/rustc_trait_selection/messages.ftl index 8232da4df43e..fcb250250871 100644 --- a/compiler/rustc_trait_selection/messages.ftl +++ b/compiler/rustc_trait_selection/messages.ftl @@ -171,8 +171,6 @@ trait_selection_fps_remove_ref = consider removing the reference trait_selection_fps_use_ref = consider using a reference trait_selection_fulfill_req_lifetime = the type `{$ty}` does not fulfill the required lifetime -trait_selection_full_type_written = the full type name has been written to '{$path}' - trait_selection_ignored_diagnostic_option = `{$option_name}` is ignored due to previous definition of `{$option_name}` .other_label = `{$option_name}` is first declared here .label = `{$option_name}` is already declared here diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs index ed8229154a9b..1c890821b1d0 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs @@ -1930,7 +1930,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { &self, trace: &TypeTrace<'tcx>, terr: TypeError<'tcx>, - path: &mut Option, + long_ty_path: &mut Option, ) -> Vec { let mut suggestions = Vec::new(); let span = trace.cause.span; @@ -2009,7 +2009,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }) | ObligationCauseCode::BlockTailExpression(.., source)) = code && let hir::MatchSource::TryDesugar(_) = source - && let Some((expected_ty, found_ty)) = self.values_str(trace.values, &trace.cause, path) + && let Some((expected_ty, found_ty)) = + self.values_str(trace.values, &trace.cause, long_ty_path) { suggestions.push(TypeErrorAdditionalDiags::TryCannotConvert { found: found_ty.content(), @@ -2139,11 +2140,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { &self, values: ValuePairs<'tcx>, cause: &ObligationCause<'tcx>, - file: &mut Option, + long_ty_path: &mut Option, ) -> Option<(DiagStyledString, DiagStyledString)> { match values { ValuePairs::Regions(exp_found) => self.expected_found_str(exp_found), - ValuePairs::Terms(exp_found) => self.expected_found_str_term(exp_found, file), + ValuePairs::Terms(exp_found) => self.expected_found_str_term(exp_found, long_ty_path), ValuePairs::Aliases(exp_found) => self.expected_found_str(exp_found), ValuePairs::ExistentialTraitRef(exp_found) => self.expected_found_str(exp_found), ValuePairs::ExistentialProjection(exp_found) => self.expected_found_str(exp_found), @@ -2183,7 +2184,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { fn expected_found_str_term( &self, exp_found: ty::error::ExpectedFound>, - path: &mut Option, + long_ty_path: &mut Option, ) -> Option<(DiagStyledString, DiagStyledString)> { let exp_found = self.resolve_vars_if_possible(exp_found); if exp_found.references_error() { @@ -2200,11 +2201,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let exp_s = exp.content(); let fnd_s = fnd.content(); if exp_s.len() > len { - let exp_s = self.tcx.short_string(expected, path); + let exp_s = self.tcx.short_string(expected, long_ty_path); exp = DiagStyledString::highlighted(exp_s); } if fnd_s.len() > len { - let fnd_s = self.tcx.short_string(found, path); + let fnd_s = self.tcx.short_string(found, long_ty_path); fnd = DiagStyledString::highlighted(fnd_s); } (exp, fnd) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs index 966f117a1bf9..ec2287ed5161 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs @@ -436,8 +436,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { infer_subdiags, multi_suggestions, bad_label, - was_written: false, - path: Default::default(), }), TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl { span, @@ -447,8 +445,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { infer_subdiags, multi_suggestions, bad_label, - was_written: false, - path: Default::default(), }), TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn { span, @@ -458,8 +454,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { infer_subdiags, multi_suggestions, bad_label, - was_written: false, - path: Default::default(), }), } } @@ -496,7 +490,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { return self.bad_inference_failure_err(failure_span, arg_data, error_code); }; - let (source_kind, name, path) = kind.ty_localized_msg(self); + let (source_kind, name, long_ty_path) = kind.ty_localized_msg(self); let failure_span = if should_label_span && !failure_span.overlaps(span) { Some(failure_span) } else { @@ -628,7 +622,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } } } - match error_code { + let mut err = match error_code { TypeAnnotationNeeded::E0282 => self.dcx().create_err(AnnotationRequired { span, source_kind, @@ -637,8 +631,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { infer_subdiags, multi_suggestions, bad_label: None, - was_written: path.is_some(), - path: path.unwrap_or_default(), }), TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl { span, @@ -648,8 +640,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { infer_subdiags, multi_suggestions, bad_label: None, - was_written: path.is_some(), - path: path.unwrap_or_default(), }), TypeAnnotationNeeded::E0284 => self.dcx().create_err(AmbiguousReturn { span, @@ -659,10 +649,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { infer_subdiags, multi_suggestions, bad_label: None, - was_written: path.is_some(), - path: path.unwrap_or_default(), }), - } + }; + *err.long_ty_path() = long_ty_path; + err } } @@ -726,22 +716,24 @@ impl<'tcx> InferSource<'tcx> { impl<'tcx> InferSourceKind<'tcx> { fn ty_localized_msg(&self, infcx: &InferCtxt<'tcx>) -> (&'static str, String, Option) { - let mut path = None; + let mut long_ty_path = None; match *self { InferSourceKind::LetBinding { ty, .. } | InferSourceKind::ClosureArg { ty, .. } | InferSourceKind::ClosureReturn { ty, .. } => { if ty.is_closure() { - ("closure", closure_as_fn_str(infcx, ty), path) + ("closure", closure_as_fn_str(infcx, ty), long_ty_path) } else if !ty.is_ty_or_numeric_infer() { - ("normal", infcx.tcx.short_string(ty, &mut path), path) + ("normal", infcx.tcx.short_string(ty, &mut long_ty_path), long_ty_path) } else { - ("other", String::new(), path) + ("other", String::new(), long_ty_path) } } // FIXME: We should be able to add some additional info here. InferSourceKind::GenericArg { .. } - | InferSourceKind::FullyQualifiedMethodCall { .. } => ("other", String::new(), path), + | InferSourceKind::FullyQualifiedMethodCall { .. } => { + ("other", String::new(), long_ty_path) + } } } } diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs index cdf1402252aa..af912227ce4e 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs @@ -169,7 +169,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let predicate = self.resolve_vars_if_possible(obligation.predicate); let span = obligation.cause.span; - let mut file = None; + let mut long_ty_path = None; debug!(?predicate, obligation.cause.code = ?obligation.cause.code()); @@ -211,19 +211,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { self.tcx.as_lang_item(trait_pred.def_id()), Some(LangItem::Sized | LangItem::MetaSized) ) { - match self.tainted_by_errors() { - None => { - let err = self.emit_inference_failure_err( + return match self.tainted_by_errors() { + None => self + .emit_inference_failure_err( obligation.cause.body_id, span, trait_pred.self_ty().skip_binder().into(), TypeAnnotationNeeded::E0282, false, - ); - return err.emit(); - } - Some(e) => return e, - } + ) + .emit(), + Some(e) => e, + }; } // Typically, this ambiguity should only happen if @@ -260,8 +259,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { span, E0283, "type annotations needed: cannot satisfy `{}`", - self.tcx.short_string(predicate, &mut file), + self.tcx.short_string(predicate, &mut long_ty_path), ) + .with_long_ty_path(long_ty_path) }; let mut ambiguities = compute_applicable_impls_for_diagnostics( @@ -307,7 +307,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { err.cancel(); return e; } - let pred = self.tcx.short_string(predicate, &mut file); + let pred = self.tcx.short_string(predicate, &mut err.long_ty_path()); err.note(format!("cannot satisfy `{pred}`")); let impl_candidates = self.find_similar_impl_candidates(predicate.as_trait_clause().unwrap()); @@ -512,6 +512,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { true, ) } + ty::PredicateKind::Clause(ty::ClauseKind::Projection(data)) => { if let Err(e) = predicate.error_reported() { return e; @@ -536,7 +537,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { .filter_map(ty::GenericArg::as_term) .chain([data.term]) .find(|g| g.has_non_region_infer()); - let predicate = self.tcx.short_string(predicate, &mut file); + let predicate = self.tcx.short_string(predicate, &mut long_ty_path); if let Some(term) = term { self.emit_inference_failure_err( obligation.cause.body_id, @@ -546,6 +547,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { true, ) .with_note(format!("cannot satisfy `{predicate}`")) + .with_long_ty_path(long_ty_path) } else { // If we can't find a generic parameter, just print a generic error struct_span_code_err!( @@ -555,6 +557,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "type annotations needed: cannot satisfy `{predicate}`", ) .with_span_label(span, format!("cannot satisfy `{predicate}`")) + .with_long_ty_path(long_ty_path) } } @@ -568,17 +571,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let term = data.walk().filter_map(ty::GenericArg::as_term).find(|term| term.is_infer()); if let Some(term) = term { - let err = self.emit_inference_failure_err( + self.emit_inference_failure_err( obligation.cause.body_id, span, term, TypeAnnotationNeeded::E0284, true, - ); - err + ) } else { // If we can't find a generic parameter, just print a generic error - let predicate = self.tcx.short_string(predicate, &mut file); + let predicate = self.tcx.short_string(predicate, &mut long_ty_path); struct_span_code_err!( self.dcx(), span, @@ -586,6 +588,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "type annotations needed: cannot satisfy `{predicate}`", ) .with_span_label(span, format!("cannot satisfy `{predicate}`")) + .with_long_ty_path(long_ty_path) } } @@ -597,13 +600,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { TypeAnnotationNeeded::E0284, true, ), + ty::PredicateKind::NormalizesTo(ty::NormalizesTo { alias, term }) if term.is_infer() => { if let Some(e) = self.tainted_by_errors() { return e; } - let alias = self.tcx.short_string(alias, &mut file); + let alias = self.tcx.short_string(alias, &mut long_ty_path); struct_span_code_err!( self.dcx(), span, @@ -611,37 +615,34 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "type annotations needed: cannot normalize `{alias}`", ) .with_span_label(span, format!("cannot normalize `{alias}`")) + .with_long_ty_path(long_ty_path) } + ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(sym)) => { if let Some(e) = self.tainted_by_errors() { return e; } - let mut err; - if self.tcx.features().staged_api() { - err = self.dcx().struct_span_err( + self.dcx().struct_span_err( span, format!("unstable feature `{sym}` is used without being enabled."), - ); - - err.help(format!("The feature can be enabled by marking the current item with `#[unstable_feature_bound({sym})]`")); + ).with_help(format!("The feature can be enabled by marking the current item with `#[unstable_feature_bound({sym})]`")) } else { - err = feature_err_unstable_feature_bound( + feature_err_unstable_feature_bound( &self.tcx.sess, sym, span, format!("use of unstable library feature `{sym}`"), - ); + ) } - err } _ => { if let Some(e) = self.tainted_by_errors() { return e; } - let predicate = self.tcx.short_string(predicate, &mut file); + let predicate = self.tcx.short_string(predicate, &mut long_ty_path); struct_span_code_err!( self.dcx(), span, @@ -649,9 +650,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "type annotations needed: cannot satisfy `{predicate}`", ) .with_span_label(span, format!("cannot satisfy `{predicate}`")) + .with_long_ty_path(long_ty_path) } }; - *err.long_ty_path() = file; self.note_obligation_cause(&mut err, obligation); err.emit() } diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index a9e346a5cdb0..62859329de35 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -208,16 +208,19 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { performs a conversion on the error value \ using the `From` trait"; let (message, notes, append_const_msg) = if is_try_conversion { + let ty = self.tcx.short_string( + main_trait_predicate.skip_binder().self_ty(), + &mut long_ty_file, + ); // We have a `-> Result<_, E1>` and `gives_E2()?`. ( - Some(format!( - "`?` couldn't convert the error to `{}`", - main_trait_predicate.skip_binder().self_ty(), - )), + Some(format!("`?` couldn't convert the error to `{ty}`")), vec![question_mark_message.to_owned()], Some(AppendConstMessage::Default), ) } else if is_question_mark { + let main_trait_predicate = + self.tcx.short_string(main_trait_predicate, &mut long_ty_file); // Similar to the case above, but in this case the conversion is for a // trait object: `-> Result<_, Box` and `gives_E()?` when // `E: Error` isn't met. @@ -233,7 +236,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { (message, notes, append_const_msg) }; - let err_msg = self.get_standard_error_message( + let default_err_msg = || self.get_standard_error_message( main_trait_predicate, message, None, @@ -258,7 +261,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); } GetSafeTransmuteErrorAndReason::Default => { - (err_msg, None) + (default_err_msg(), None) } GetSafeTransmuteErrorAndReason::Error { err_msg, @@ -266,7 +269,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } => (err_msg, safe_transmute_explanation), } } else { - (err_msg, None) + (default_err_msg(), None) }; let mut err = struct_span_code_err!(self.dcx(), span, E0277, "{}", err_msg); @@ -279,15 +282,21 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if let Some(ret_span) = self.return_type_span(&obligation) { if is_try_conversion { + let ty = self.tcx.short_string( + main_trait_predicate.skip_binder().self_ty(), + err.long_ty_path(), + ); err.span_label( ret_span, - format!( - "expected `{}` because of this", - main_trait_predicate.skip_binder().self_ty() - ), + format!("expected `{ty}` because of this"), ); } else if is_question_mark { - err.span_label(ret_span, format!("required `{main_trait_predicate}` because of this")); + let main_trait_predicate = + self.tcx.short_string(main_trait_predicate, err.long_ty_path()); + err.span_label( + ret_span, + format!("required `{main_trait_predicate}` because of this"), + ); } } @@ -303,6 +312,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { &obligation, leaf_trait_predicate, pre_message, + err.long_ty_path(), ); self.check_for_binding_assigned_block_without_tail_expression( @@ -414,11 +424,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } else { vec![(span.shrink_to_hi(), format!(" as {}", cand.self_ty()))] }; + let trait_ = self.tcx.short_string(cand.print_trait_sugared(), err.long_ty_path()); + let ty = self.tcx.short_string(cand.self_ty(), err.long_ty_path()); err.multipart_suggestion( format!( - "the trait `{}` is implemented for fn pointer `{}`, try casting using `as`", - cand.print_trait_sugared(), - cand.self_ty(), + "the trait `{trait_}` is implemented for fn pointer \ + `{ty}`, try casting using `as`", ), suggestion, Applicability::MaybeIncorrect, @@ -522,7 +533,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { \ for more information)", ); - err.help("did you intend to use the type `()` here instead?"); + err.help("you might have intended to use the type `()` here instead"); } } @@ -722,10 +733,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } SelectionError::ConstArgHasWrongType { ct, ct_ty, expected_ty } => { + let expected_ty_str = self.tcx.short_string(expected_ty, &mut long_ty_file); + let ct_str = self.tcx.short_string(ct, &mut long_ty_file); let mut diag = self.dcx().struct_span_err( span, - format!("the constant `{ct}` is not of type `{expected_ty}`"), + format!("the constant `{ct_str}` is not of type `{expected_ty_str}`"), ); + diag.long_ty_path = long_ty_file; self.note_type_err( &mut diag, @@ -1118,9 +1132,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { .must_apply_modulo_regions() { if !suggested { + let err_ty = self.tcx.short_string(err_ty, err.long_ty_path()); err.span_label(span, format!("this has type `Result<_, {err_ty}>`")); } } else { + let err_ty = self.tcx.short_string(err_ty, err.long_ty_path()); err.span_label( span, format!( @@ -1156,12 +1172,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); } (ty::Adt(def, _), None) if def.did().is_local() => { + let trait_path = self.tcx.short_string( + trait_pred.skip_binder().trait_ref.print_only_trait_path(), + err.long_ty_path(), + ); err.span_note( self.tcx.def_span(def.did()), - format!( - "`{self_ty}` needs to implement `{}`", - trait_pred.skip_binder().trait_ref.print_only_trait_path(), - ), + format!("`{self_ty}` needs to implement `{trait_path}`"), ); } (ty::Adt(def, _), Some(ty)) if def.did().is_local() => { @@ -1195,13 +1212,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { bug!() }; + let mut file = None; + let ty_str = self.tcx.short_string(ty, &mut file); let mut diag = match ty.kind() { ty::Float(_) => { struct_span_code_err!( self.dcx(), span, E0741, - "`{ty}` is forbidden as the type of a const generic parameter", + "`{ty_str}` is forbidden as the type of a const generic parameter", ) } ty::FnPtr(..) => { @@ -1226,7 +1245,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { self.dcx(), span, E0741, - "`{ty}` must implement `ConstParamTy` to be used as the type of a const generic parameter", + "`{ty_str}` must implement `ConstParamTy` to be used as the type of a const generic parameter", ); // Only suggest derive if this isn't a derived obligation, // and the struct is local. @@ -1258,21 +1277,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { self.dcx(), span, E0741, - "`{ty}` can't be used as a const parameter type", + "`{ty_str}` can't be used as a const parameter type", ) } }; + diag.long_ty_path = file; let mut code = obligation.cause.code(); let mut pred = obligation.predicate.as_trait_clause(); while let Some((next_code, next_pred)) = code.parent_with_predicate() { if let Some(pred) = pred { self.enter_forall(pred, |pred| { - diag.note(format!( - "`{}` must implement `{}`, but it does not", - pred.self_ty(), - pred.print_modifiers_and_trait_path() - )); + let ty = self.tcx.short_string(pred.self_ty(), diag.long_ty_path()); + let trait_path = self + .tcx + .short_string(pred.print_modifiers_and_trait_path(), diag.long_ty_path()); + diag.note(format!("`{ty}` must implement `{trait_path}`, but it does not")); }) } code = next_code; @@ -1584,7 +1604,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { projection_term: ty::AliasTerm<'tcx>, normalized_ty: ty::Term<'tcx>, expected_ty: ty::Term<'tcx>, - file: &mut Option, + long_ty_path: &mut Option, ) -> Option<(String, Span, Option)> { let trait_def_id = projection_term.trait_def_id(self.tcx); let self_ty = projection_term.self_ty(); @@ -1624,17 +1644,25 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }; let item = match self_ty.kind() { ty::FnDef(def, _) => self.tcx.item_name(*def).to_string(), - _ => self.tcx.short_string(self_ty, file), + _ => self.tcx.short_string(self_ty, long_ty_path), }; + let expected_ty = self.tcx.short_string(expected_ty, long_ty_path); + let normalized_ty = self.tcx.short_string(normalized_ty, long_ty_path); Some((format!( "expected `{item}` to return `{expected_ty}`, but it returns `{normalized_ty}`", ), span, closure_span)) } else if self.tcx.is_lang_item(trait_def_id, LangItem::Future) { + let self_ty = self.tcx.short_string(self_ty, long_ty_path); + let expected_ty = self.tcx.short_string(expected_ty, long_ty_path); + let normalized_ty = self.tcx.short_string(normalized_ty, long_ty_path); Some((format!( "expected `{self_ty}` to be a future that resolves to `{expected_ty}`, but it \ resolves to `{normalized_ty}`" ), span, None)) } else if Some(trait_def_id) == self.tcx.get_diagnostic_item(sym::Iterator) { + let self_ty = self.tcx.short_string(self_ty, long_ty_path); + let expected_ty = self.tcx.short_string(expected_ty, long_ty_path); + let normalized_ty = self.tcx.short_string(normalized_ty, long_ty_path); Some((format!( "expected `{self_ty}` to be an iterator that yields `{expected_ty}`, but it \ yields `{normalized_ty}`" @@ -2097,12 +2125,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { if let [TypeError::Sorts(exp_found)] = &terrs[..] { let exp_found = self.resolve_vars_if_possible(*exp_found); + let expected = + self.tcx.short_string(exp_found.expected, err.long_ty_path()); + let found = self.tcx.short_string(exp_found.found, err.long_ty_path()); err.highlighted_help(vec![ StringPart::normal("for that trait implementation, "), StringPart::normal("expected `"), - StringPart::highlighted(exp_found.expected.to_string()), + StringPart::highlighted(expected), StringPart::normal("`, found `"), - StringPart::highlighted(exp_found.found.to_string()), + StringPart::highlighted(found), StringPart::normal("`"), ]); self.suggest_function_pointers_impl(None, &exp_found, err); @@ -2135,11 +2166,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { (ty::FnPtr(..), _) => (" implemented for fn pointer `", ""), _ => (" implemented for `", ""), }; + let trait_ = self.tcx.short_string(cand.print_trait_sugared(), err.long_ty_path()); + let self_ty = self.tcx.short_string(cand.self_ty(), err.long_ty_path()); err.highlighted_help(vec![ - StringPart::normal(format!("the trait `{}` ", cand.print_trait_sugared())), + StringPart::normal(format!("the trait `{trait_}` ",)), StringPart::highlighted("is"), StringPart::normal(desc), - StringPart::highlighted(cand.self_ty().to_string()), + StringPart::highlighted(self_ty), StringPart::normal("`"), StringPart::normal(mention_castable), ]); @@ -2159,9 +2192,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { .into_iter() .map(|c| { if all_traits_equal { - format!("\n {}", c.self_ty()) + format!("\n {}", self.tcx.short_string(c.self_ty(), err.long_ty_path())) } else { - format!("\n `{}` implements `{}`", c.self_ty(), c.print_only_trait_path()) + format!( + "\n `{}` implements `{}`", + self.tcx.short_string(c.self_ty(), err.long_ty_path()), + self.tcx.short_string(c.print_only_trait_path(), err.long_ty_path()), + ) } }) .collect(); @@ -2477,7 +2514,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { predicate_constness: Option, append_const_msg: Option, post_message: String, - long_ty_file: &mut Option, + long_ty_path: &mut Option, ) -> String { message .and_then(|cannot_do_this| { @@ -2503,7 +2540,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { "the trait bound `{}` is not satisfied{post_message}", self.tcx.short_string( trait_predicate.print_with_bound_constness(predicate_constness), - long_ty_file, + long_ty_path, ), ) }) @@ -2608,8 +2645,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { dst_min_align, } => { format!( - "the minimum alignment of `{src}` ({src_min_align}) should \ - be greater than that of `{dst}` ({dst_min_align})" + "the minimum alignment of `{src}` ({src_min_align}) should be \ + greater than that of `{dst}` ({dst_min_align})" ) } rustc_transmute::Reason::DstIsMoreUnique => { diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs index 5765dfd891d4..bb5c6469f34b 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs @@ -99,7 +99,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { &self, trait_pred: ty::PolyTraitPredicate<'tcx>, obligation: &PredicateObligation<'tcx>, - long_ty_file: &mut Option, + long_ty_path: &mut Option, ) -> OnUnimplementedNote { if trait_pred.polarity() != ty::PredicatePolarity::Positive { return OnUnimplementedNote::default(); @@ -281,7 +281,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { GenericParamDefKind::Type { .. } | GenericParamDefKind::Const { .. } => { if let Some(ty) = trait_pred.trait_ref.args[param.index as usize].as_type() { - self.tcx.short_string(ty, long_ty_file) + self.tcx.short_string(ty, long_ty_path) } else { trait_pred.trait_ref.args[param.index as usize].to_string() } diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 718cff6d135b..374e1f679302 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -3,6 +3,7 @@ use std::assert_matches::debug_assert_matches; use std::borrow::Cow; use std::iter; +use std::path::PathBuf; use itertools::{EitherOrBoth, Itertools}; use rustc_abi::ExternAbi; @@ -1369,6 +1370,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { ); let self_ty_str = self.tcx.short_string(old_pred.self_ty().skip_binder(), err.long_ty_path()); + let trait_path = self + .tcx + .short_string(old_pred.print_modifiers_and_trait_path(), err.long_ty_path()); + if has_custom_message { err.note(msg); } else { @@ -1376,10 +1381,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } err.span_label( span, - format!( - "the trait `{}` is not implemented for `{self_ty_str}`", - old_pred.print_modifiers_and_trait_path() - ), + format!("the trait `{trait_path}` is not implemented for `{self_ty_str}`"), ); }; @@ -3333,17 +3335,22 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { tcx.async_fn_trait_kind_from_def_id(data.parent_trait_pred.def_id()).is_some(); if !is_upvar_tys_infer_tuple && !is_builtin_async_fn_trait { - let ty_str = tcx.short_string(ty, err.long_ty_path()); - let msg = format!("required because it appears within the type `{ty_str}`"); + let mut msg = || { + let ty_str = tcx.short_string(ty, err.long_ty_path()); + format!("required because it appears within the type `{ty_str}`") + }; match ty.kind() { - ty::Adt(def, _) => match tcx.opt_item_ident(def.did()) { - Some(ident) => { - err.span_note(ident.span, msg); + ty::Adt(def, _) => { + let msg = msg(); + match tcx.opt_item_ident(def.did()) { + Some(ident) => { + err.span_note(ident.span, msg); + } + None => { + err.note(msg); + } } - None => { - err.note(msg); - } - }, + } ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => { // If the previous type is async fn, this is the future generated by the body of an async function. // Avoid printing it twice (it was already printed in the `ty::Coroutine` arm below). @@ -3363,6 +3370,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { // See comment above; skip printing twice. } else { + let msg = msg(); err.span_note(tcx.def_span(def_id), msg); } } @@ -3392,6 +3400,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { err.note("`str` is considered to contain a `[u8]` slice for auto trait purposes"); } _ => { + let msg = msg(); err.note(msg); } }; @@ -3441,7 +3450,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } let self_ty_str = tcx.short_string(parent_trait_pred.skip_binder().self_ty(), err.long_ty_path()); - let trait_name = parent_trait_pred.print_modifiers_and_trait_path().to_string(); + let trait_name = tcx.short_string( + parent_trait_pred.print_modifiers_and_trait_path(), + err.long_ty_path(), + ); let msg = format!("required for `{self_ty_str}` to implement `{trait_name}`"); let mut is_auto_trait = false; match tcx.hir_get_if_local(data.impl_or_alias_def_id) { @@ -3539,10 +3551,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { parent_trait_pred.skip_binder().self_ty(), err.long_ty_path(), ); - err.note(format!( - "required for `{self_ty}` to implement `{}`", - parent_trait_pred.print_modifiers_and_trait_path() - )); + let trait_path = tcx.short_string( + parent_trait_pred.print_modifiers_and_trait_path(), + err.long_ty_path(), + ); + err.note(format!("required for `{self_ty}` to implement `{trait_path}`")); } // #74711: avoid a stack overflow ensure_sufficient_stack(|| { @@ -3558,15 +3571,20 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { }); } ObligationCauseCode::ImplDerivedHost(ref data) => { - let self_ty = - self.resolve_vars_if_possible(data.derived.parent_host_pred.self_ty()); - let msg = format!( - "required for `{self_ty}` to implement `{} {}`", - data.derived.parent_host_pred.skip_binder().constness, + let self_ty = tcx.short_string( + self.resolve_vars_if_possible(data.derived.parent_host_pred.self_ty()), + err.long_ty_path(), + ); + let trait_path = tcx.short_string( data.derived .parent_host_pred .map_bound(|pred| pred.trait_ref) .print_only_trait_path(), + err.long_ty_path(), + ); + let msg = format!( + "required for `{self_ty}` to implement `{} {trait_path}`", + data.derived.parent_host_pred.skip_binder().constness, ); match tcx.hir_get_if_local(data.impl_def_id) { Some(Node::Item(hir::Item { @@ -5351,6 +5369,7 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>( obligation: &PredicateObligation<'tcx>, trait_predicate: ty::PolyTraitPredicate<'tcx>, pre_message: String, + long_ty_path: &mut Option, ) -> String { if let ObligationCauseCode::MainFunctionType = obligation.cause.code() { "consider using `()`, or a `Result`".to_owned() @@ -5369,7 +5388,7 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>( format!( "{pre_message}the trait `{}` is not implemented for{desc} `{}`", trait_predicate.print_modifiers_and_trait_path(), - tcx.short_string(trait_predicate.self_ty().skip_binder(), &mut None), + tcx.short_string(trait_predicate.self_ty().skip_binder(), long_ty_path), ) } else { // "the trait bound `T: !Send` is not satisfied" reads better than "`!Send` is diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index 7901d52dffb6..af241099c014 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -1,5 +1,3 @@ -use std::path::PathBuf; - use rustc_ast::Path; use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_errors::codes::*; @@ -224,9 +222,6 @@ pub struct AnnotationRequired<'a> { pub infer_subdiags: Vec>, #[subdiagnostic] pub multi_suggestions: Vec>, - #[note(trait_selection_full_type_written)] - pub was_written: bool, - pub path: PathBuf, } // Copy of `AnnotationRequired` for E0283 @@ -245,9 +240,6 @@ pub struct AmbiguousImpl<'a> { pub infer_subdiags: Vec>, #[subdiagnostic] pub multi_suggestions: Vec>, - #[note(trait_selection_full_type_written)] - pub was_written: bool, - pub path: PathBuf, } // Copy of `AnnotationRequired` for E0284 @@ -266,9 +258,6 @@ pub struct AmbiguousReturn<'a> { pub infer_subdiags: Vec>, #[subdiagnostic] pub multi_suggestions: Vec>, - #[note(trait_selection_full_type_written)] - pub was_written: bool, - pub path: PathBuf, } // Used when a better one isn't available diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 08315dbd21fb..a9fb16b8000a 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -763,7 +763,7 @@ fn instantiate_and_check_impossible_predicates<'tcx>( // Specifically check trait fulfillment to avoid an error when trying to resolve // associated items. if let Some(trait_def_id) = tcx.trait_of_assoc(key.0) { - let trait_ref = ty::TraitRef::from_method(tcx, trait_def_id, key.1); + let trait_ref = ty::TraitRef::from_assoc(tcx, trait_def_id, key.1); predicates.push(trait_ref.upcast(tcx)); } diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index e6c3568620b5..5c3f7d491a57 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -109,7 +109,7 @@ fn resolve_associated_item<'tcx>( ) -> Result>, ErrorGuaranteed> { debug!(?trait_item_id, ?typing_env, ?trait_id, ?rcvr_args, "resolve_associated_item"); - let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_args); + let trait_ref = ty::TraitRef::from_assoc(tcx, trait_id, rcvr_args); let input = typing_env.as_query_input(trait_ref); let vtbl = match tcx.codegen_select_candidate(input) { @@ -238,7 +238,7 @@ fn resolve_associated_item<'tcx>( Some(ty::Instance::new_raw(leaf_def.item.def_id, args)) } traits::ImplSource::Builtin(BuiltinImplSource::Object(_), _) => { - let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_args); + let trait_ref = ty::TraitRef::from_assoc(tcx, trait_id, rcvr_args); if trait_ref.has_non_region_infer() || trait_ref.has_non_region_param() { // We only resolve totally substituted vtable entries. None diff --git a/compiler/rustc_type_ir/src/binder.rs b/compiler/rustc_type_ir/src/binder.rs index 189afa32852c..10d48526fd2a 100644 --- a/compiler/rustc_type_ir/src/binder.rs +++ b/compiler/rustc_type_ir/src/binder.rs @@ -15,13 +15,12 @@ use crate::lift::Lift; use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor}; use crate::{self as ty, Interner}; -/// Binder is a binder for higher-ranked lifetimes or types. It is part of the +/// `Binder` is a binder for higher-ranked lifetimes or types. It is part of the /// compiler's representation for things like `for<'a> Fn(&'a isize)` -/// (which would be represented by the type `PolyTraitRef == -/// Binder`). Note that when we instantiate, -/// erase, or otherwise "discharge" these bound vars, we change the -/// type from `Binder` to just `T` (see -/// e.g., `liberate_late_bound_regions`). +/// (which would be represented by the type `PolyTraitRef == Binder`). +/// +/// See +/// for more details. /// /// `Decodable` and `Encodable` are implemented for `Binder` using the `impl_binder_encode_decode!` macro. #[derive_where(Clone; I: Interner, T: Clone)] @@ -154,22 +153,19 @@ impl> TypeSuperVisitable for Binder { } impl Binder { - /// Skips the binder and returns the "bound" value. This is a - /// risky thing to do because it's easy to get confused about - /// De Bruijn indices and the like. It is usually better to - /// discharge the binder using `no_bound_vars` or - /// `instantiate_bound_regions` or something like - /// that. `skip_binder` is only valid when you are either - /// extracting data that has nothing to do with bound vars, you - /// are doing some sort of test that does not involve bound - /// regions, or you are being very careful about your depth - /// accounting. + /// Returns the value contained inside of this `for<'a>`. Accessing generic args + /// in the returned value is generally incorrect. /// - /// Some examples where `skip_binder` is reasonable: + /// Please read + /// before using this function. It is usually better to discharge the binder using + /// `no_bound_vars` or `instantiate_bound_regions` or something like that. /// - /// - extracting the `DefId` from a PolyTraitRef; - /// - comparing the self type of a PolyTraitRef to see if it is equal to - /// a type parameter `X`, since the type `X` does not reference any regions + /// `skip_binder` is only valid when you are either extracting data that does not reference + /// any generic arguments, e.g. a `DefId`, or when you're making sure you only pass the + /// value to things which can handle escaping bound vars. + /// + /// See existing uses of `.skip_binder()` in `rustc_trait_selection::traits::select` + /// or `rustc_next_trait_solver` for examples. pub fn skip_binder(self) -> T { self.value } @@ -355,12 +351,11 @@ impl TypeVisitor for ValidateBoundVars { } } -/// Similar to [`super::Binder`] except that it tracks early bound generics, i.e. `struct Foo(T)` +/// Similar to [`Binder`] except that it tracks early bound generics, i.e. `struct Foo(T)` /// needs `T` instantiated immediately. This type primarily exists to avoid forgetting to call /// `instantiate`. /// -/// If you don't have anything to `instantiate`, you may be looking for -/// [`instantiate_identity`](EarlyBinder::instantiate_identity) or [`skip_binder`](EarlyBinder::skip_binder). +/// See for more details. #[derive_where(Clone; I: Interner, T: Clone)] #[derive_where(Copy; I: Interner, T: Copy)] #[derive_where(PartialEq; I: Interner, T: PartialEq)] @@ -423,17 +418,22 @@ impl EarlyBinder { EarlyBinder { value, _tcx: PhantomData } } - /// Skips the binder and returns the "bound" value. - /// This can be used to extract data that does not depend on generic parameters - /// (e.g., getting the `DefId` of the inner value or getting the number of - /// arguments of an `FnSig`). Otherwise, consider using - /// [`instantiate_identity`](EarlyBinder::instantiate_identity). + /// Skips the binder and returns the "bound" value. Accessing generic args + /// in the returned value is generally incorrect. + /// + /// Please read + /// before using this function. + /// + /// Only use this to extract data that does not depend on generic parameters, e.g. + /// to get the `DefId` of the inner value or the number of arguments ofan `FnSig`, + /// or while making sure to only pass the value to functions which are explicitly + /// set up to handle these uninstantiated generic parameters. /// /// To skip the binder on `x: &EarlyBinder` to obtain `&T`, leverage /// [`EarlyBinder::as_ref`](EarlyBinder::as_ref): `x.as_ref().skip_binder()`. /// - /// See also [`Binder::skip_binder`](super::Binder::skip_binder), which is - /// the analogous operation on [`super::Binder`]. + /// See also [`Binder::skip_binder`](Binder::skip_binder), which is + /// the analogous operation on [`Binder`]. pub fn skip_binder(self) -> T { self.value } diff --git a/compiler/rustc_type_ir/src/const_kind.rs b/compiler/rustc_type_ir/src/const_kind.rs index 70a8509b5133..4be38d4e702d 100644 --- a/compiler/rustc_type_ir/src/const_kind.rs +++ b/compiler/rustc_type_ir/src/const_kind.rs @@ -92,10 +92,15 @@ rustc_index::newtype_index! { /// An inference variable for a const, for use in const generics. #[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Hash)] +#[derive(TypeVisitable_Generic, TypeFoldable_Generic)] #[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext))] pub enum InferConst { /// Infer the value of the const. - Var(ConstVid), + Var( + #[type_foldable(identity)] + #[type_visitable(ignore)] + ConstVid, + ), /// A fresh const variable. See `infer::freshen` for more details. Fresh(u32), } diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs index c9489c98ccea..475c9cd40ed6 100644 --- a/compiler/rustc_type_ir/src/predicate.rs +++ b/compiler/rustc_type_ir/src/predicate.rs @@ -82,7 +82,7 @@ impl TraitRef { Self::new_from_args(interner, trait_def_id, args) } - pub fn from_method(interner: I, trait_id: I::DefId, args: I::GenericArgs) -> TraitRef { + pub fn from_assoc(interner: I, trait_id: I::DefId, args: I::GenericArgs) -> TraitRef { let generics = interner.generics_of(trait_id); TraitRef::new(interner, trait_id, args.iter().take(generics.count())) } @@ -184,6 +184,15 @@ impl UpcastFrom> for TraitPredicate { } } +impl UpcastFrom>> for ty::Binder> { + fn upcast_from(from: ty::Binder>, _tcx: I) -> Self { + from.map_bound(|trait_ref| TraitPredicate { + trait_ref, + polarity: PredicatePolarity::Positive, + }) + } +} + impl fmt::Debug for TraitPredicate { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "TraitPredicate({:?}, polarity:{:?})", self.trait_ref, self.polarity) diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index 17c16e4aafff..acbbb6df9a5a 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -382,6 +382,7 @@ impl<'a, K: 'a, V: 'a> Default for Iter<'a, K, V> { /// documentation for more. /// /// [`iter_mut`]: BTreeMap::iter_mut +#[must_use = "iterators are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, K: 'a, V: 'a> { range: LazyLeafRange, K, V>, @@ -391,7 +392,6 @@ pub struct IterMut<'a, K: 'a, V: 'a> { _marker: PhantomData<&'a mut (K, V)>, } -#[must_use = "iterators are lazy and do nothing unless consumed"] #[stable(feature = "collection_debug", since = "1.17.0")] impl fmt::Debug for IterMut<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs index 93bdad753800..fe6c89a30949 100644 --- a/library/alloc/src/ffi/c_str.rs +++ b/library/alloc/src/ffi/c_str.rs @@ -1099,7 +1099,7 @@ impl From<&CStr> for CString { } } -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq for CString { #[inline] fn eq(&self, other: &CStr) -> bool { @@ -1112,7 +1112,7 @@ impl PartialEq for CString { } } -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq<&CStr> for CString { #[inline] fn eq(&self, other: &&CStr) -> bool { @@ -1126,7 +1126,7 @@ impl PartialEq<&CStr> for CString { } #[cfg(not(no_global_oom_handling))] -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq> for CString { #[inline] fn eq(&self, other: &Cow<'_, CStr>) -> bool { @@ -1221,7 +1221,7 @@ impl CStr { } } -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq for CStr { #[inline] fn eq(&self, other: &CString) -> bool { @@ -1235,7 +1235,7 @@ impl PartialEq for CStr { } #[cfg(not(no_global_oom_handling))] -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq> for CStr { #[inline] fn eq(&self, other: &Cow<'_, Self>) -> bool { @@ -1249,7 +1249,7 @@ impl PartialEq> for CStr { } #[cfg(not(no_global_oom_handling))] -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq for Cow<'_, CStr> { #[inline] fn eq(&self, other: &CStr) -> bool { @@ -1263,7 +1263,7 @@ impl PartialEq for Cow<'_, CStr> { } #[cfg(not(no_global_oom_handling))] -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq<&CStr> for Cow<'_, CStr> { #[inline] fn eq(&self, other: &&CStr) -> bool { @@ -1277,7 +1277,7 @@ impl PartialEq<&CStr> for Cow<'_, CStr> { } #[cfg(not(no_global_oom_handling))] -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq for Cow<'_, CStr> { #[inline] fn eq(&self, other: &CString) -> bool { diff --git a/library/compiler-builtins/.github/workflows/main.yaml b/library/compiler-builtins/.github/workflows/main.yaml index 541c99c828dc..c54df2e90b79 100644 --- a/library/compiler-builtins/.github/workflows/main.yaml +++ b/library/compiler-builtins/.github/workflows/main.yaml @@ -34,7 +34,9 @@ jobs: - name: Fetch pull request ref run: git fetch origin "$GITHUB_REF:$GITHUB_REF" if: github.event_name == 'pull_request' - - run: python3 ci/ci-util.py generate-matrix >> "$GITHUB_OUTPUT" + - run: | + set -eo pipefail # Needed to actually fail the job if ci-util fails + python3 ci/ci-util.py generate-matrix | tee "$GITHUB_OUTPUT" id: script test: @@ -50,7 +52,6 @@ jobs: os: ubuntu-24.04-arm - target: aarch64-pc-windows-msvc os: windows-2025 - test_verbatim: 1 build_only: 1 - target: arm-unknown-linux-gnueabi os: ubuntu-24.04 @@ -70,8 +71,12 @@ jobs: os: ubuntu-24.04 - target: powerpc64le-unknown-linux-gnu os: ubuntu-24.04 + - target: powerpc64le-unknown-linux-gnu + os: ubuntu-24.04-ppc64le - target: riscv64gc-unknown-linux-gnu os: ubuntu-24.04 + - target: s390x-unknown-linux-gnu + os: ubuntu-24.04-s390x - target: thumbv6m-none-eabi os: ubuntu-24.04 - target: thumbv7em-none-eabi @@ -88,10 +93,8 @@ jobs: os: macos-13 - target: i686-pc-windows-msvc os: windows-2025 - test_verbatim: 1 - target: x86_64-pc-windows-msvc os: windows-2025 - test_verbatim: 1 - target: i686-pc-windows-gnu os: windows-2025 channel: nightly-i686-gnu @@ -102,11 +105,23 @@ jobs: needs: [calculate_vars] env: BUILD_ONLY: ${{ matrix.build_only }} - TEST_VERBATIM: ${{ matrix.test_verbatim }} MAY_SKIP_LIBM_CI: ${{ needs.calculate_vars.outputs.may_skip_libm_ci }} steps: + - name: Print $HOME + shell: bash + run: | + set -x + echo "${HOME:-not found}" + pwd + printenv - name: Print runner information run: uname -a + + # Native ppc and s390x runners don't have rustup by default + - name: Install rustup + if: matrix.os == 'ubuntu-24.04-ppc64le' || matrix.os == 'ubuntu-24.04-s390x' + run: sudo apt-get update && sudo apt-get install -y rustup + - uses: actions/checkout@v4 - name: Install Rust (rustup) shell: bash @@ -117,7 +132,12 @@ jobs: rustup update "$channel" --no-self-update rustup default "$channel" rustup target add "${{ matrix.target }}" + + # Our scripts use nextest if possible. This is skipped on the native ppc + # and s390x runners since install-action doesn't support them. - uses: taiki-e/install-action@nextest + if: "!(matrix.os == 'ubuntu-24.04-ppc64le' || matrix.os == 'ubuntu-24.04-s390x')" + - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.target }} @@ -144,7 +164,7 @@ jobs: shell: bash - run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV" shell: bash - + - name: Download musl source run: ./ci/update-musl.sh shell: bash @@ -256,7 +276,7 @@ jobs: with: name: ${{ env.BASELINE_NAME }} path: ${{ env.BASELINE_NAME }}.tar.xz - + - name: Run wall time benchmarks run: | # Always use the same seed for benchmarks. Ideally we should switch to a @@ -311,8 +331,8 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@v4 - - name: Install stable `rustfmt` - run: rustup set profile minimal && rustup default stable && rustup component add rustfmt + - name: Install nightly `rustfmt` + run: rustup set profile minimal && rustup default nightly && rustup component add rustfmt - run: cargo fmt -- --check extensive: diff --git a/library/compiler-builtins/.github/workflows/rustc-pull.yml b/library/compiler-builtins/.github/workflows/rustc-pull.yml index ba698492e42a..ad7693e17b0e 100644 --- a/library/compiler-builtins/.github/workflows/rustc-pull.yml +++ b/library/compiler-builtins/.github/workflows/rustc-pull.yml @@ -12,12 +12,13 @@ jobs: if: github.repository == 'rust-lang/compiler-builtins' 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/219381-t-libs/topic/compiler-builtins.20subtree.20sync.20automation/with/528482375 zulip-stream-id: 219381 zulip-topic: 'compiler-builtins subtree sync automation' - zulip-bot-email: "compiler-builtins-ci-bot@rust-lang.zulipchat.com" + zulip-bot-email: "compiler-builtins-ci-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/library/compiler-builtins/builtins-shim/Cargo.toml b/library/compiler-builtins/builtins-shim/Cargo.toml index 8eb880c6fd1d..707ebdbc77b2 100644 --- a/library/compiler-builtins/builtins-shim/Cargo.toml +++ b/library/compiler-builtins/builtins-shim/Cargo.toml @@ -37,8 +37,9 @@ default = ["compiler-builtins"] # implementations and also filling in unimplemented intrinsics c = ["dep:cc"] -# Workaround for the Cranelift codegen backend. Disables any implementations -# which use inline assembly and fall back to pure Rust versions (if available). +# For implementations where there is both a generic version and a platform- +# specific version, use the generic version. This is meant to enable testing +# the generic versions on all platforms. no-asm = [] # Workaround for codegen backends which haven't yet implemented `f16` and diff --git a/library/compiler-builtins/builtins-test-intrinsics/src/main.rs b/library/compiler-builtins/builtins-test-intrinsics/src/main.rs index 66744a0817fe..b9d19ea77256 100644 --- a/library/compiler-builtins/builtins-test-intrinsics/src/main.rs +++ b/library/compiler-builtins/builtins-test-intrinsics/src/main.rs @@ -40,11 +40,7 @@ mod intrinsics { x as f64 } - #[cfg(all( - f16_enabled, - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(all(f16_enabled, f128_enabled))] pub fn extendhftf(x: f16) -> f128 { x as f128 } @@ -201,11 +197,7 @@ mod intrinsics { /* f128 operations */ - #[cfg(all( - f16_enabled, - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(all(f16_enabled, f128_enabled))] pub fn trunctfhf(x: f128) -> f16 { x as f16 } @@ -220,50 +212,32 @@ mod intrinsics { x as f64 } - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] pub fn fixtfsi(x: f128) -> i32 { x as i32 } - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] pub fn fixtfdi(x: f128) -> i64 { x as i64 } - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] pub fn fixtfti(x: f128) -> i128 { x as i128 } - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] pub fn fixunstfsi(x: f128) -> u32 { x as u32 } - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] pub fn fixunstfdi(x: f128) -> u64 { x as u64 } - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] pub fn fixunstfti(x: f128) -> u128 { x as u128 } @@ -540,47 +514,25 @@ fn run() { bb(extendhfdf(bb(2.))); #[cfg(f16_enabled)] bb(extendhfsf(bb(2.))); - #[cfg(all( - f16_enabled, - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(all(f16_enabled, f128_enabled))] bb(extendhftf(bb(2.))); #[cfg(f128_enabled)] bb(extendsftf(bb(2.))); bb(fixdfti(bb(2.))); bb(fixsfti(bb(2.))); - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] bb(fixtfdi(bb(2.))); - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] bb(fixtfsi(bb(2.))); - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] bb(fixtfti(bb(2.))); bb(fixunsdfti(bb(2.))); bb(fixunssfti(bb(2.))); - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] bb(fixunstfdi(bb(2.))); - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] bb(fixunstfsi(bb(2.))); - #[cfg(all( - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(f128_enabled)] bb(fixunstfti(bb(2.))); #[cfg(f128_enabled)] bb(floatditf(bb(2))); @@ -616,11 +568,7 @@ fn run() { bb(truncsfhf(bb(2.))); #[cfg(f128_enabled)] bb(trunctfdf(bb(2.))); - #[cfg(all( - f16_enabled, - f128_enabled, - not(any(target_arch = "powerpc", target_arch = "powerpc64")) - ))] + #[cfg(all(f16_enabled, f128_enabled))] bb(trunctfhf(bb(2.))); #[cfg(f128_enabled)] bb(trunctfsf(bb(2.))); diff --git a/library/compiler-builtins/builtins-test/benches/float_conv.rs b/library/compiler-builtins/builtins-test/benches/float_conv.rs index d4a7346d1d58..e0f488eb6855 100644 --- a/library/compiler-builtins/builtins-test/benches/float_conv.rs +++ b/library/compiler-builtins/builtins-test/benches/float_conv.rs @@ -365,7 +365,6 @@ float_bench! { /* float -> unsigned int */ -#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] float_bench! { name: conv_f32_u32, sig: (a: f32) -> u32, @@ -387,7 +386,6 @@ float_bench! { ], } -#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] float_bench! { name: conv_f32_u64, sig: (a: f32) -> u64, @@ -409,7 +407,6 @@ float_bench! { ], } -#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] float_bench! { name: conv_f32_u128, sig: (a: f32) -> u128, @@ -505,7 +502,6 @@ float_bench! { /* float -> signed int */ -#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] float_bench! { name: conv_f32_i32, sig: (a: f32) -> i32, @@ -527,7 +523,6 @@ float_bench! { ], } -#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] float_bench! { name: conv_f32_i64, sig: (a: f32) -> i64, @@ -549,7 +544,6 @@ float_bench! { ], } -#[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] float_bench! { name: conv_f32_i128, sig: (a: f32) -> i128, @@ -666,9 +660,6 @@ pub fn float_conv() { conv_f64_i128(&mut criterion); #[cfg(f128_enabled)] - // FIXME: ppc64le has a sporadic overflow panic in the crate functions - // - #[cfg(not(all(target_arch = "powerpc64", target_endian = "little")))] { conv_u32_f128(&mut criterion); conv_u64_f128(&mut criterion); diff --git a/library/compiler-builtins/builtins-test/benches/float_extend.rs b/library/compiler-builtins/builtins-test/benches/float_extend.rs index fc44e80c9e14..939dc60f95f4 100644 --- a/library/compiler-builtins/builtins-test/benches/float_extend.rs +++ b/library/compiler-builtins/builtins-test/benches/float_extend.rs @@ -110,9 +110,7 @@ float_bench! { pub fn float_extend() { let mut criterion = Criterion::default().configure_from_args(); - // FIXME(#655): `f16` tests disabled until we can bootstrap symbols #[cfg(f16_enabled)] - #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] { extend_f16_f32(&mut criterion); extend_f16_f64(&mut criterion); diff --git a/library/compiler-builtins/builtins-test/benches/float_trunc.rs b/library/compiler-builtins/builtins-test/benches/float_trunc.rs index 43310c7cfc82..9373f945bb2b 100644 --- a/library/compiler-builtins/builtins-test/benches/float_trunc.rs +++ b/library/compiler-builtins/builtins-test/benches/float_trunc.rs @@ -121,9 +121,7 @@ float_bench! { pub fn float_trunc() { let mut criterion = Criterion::default().configure_from_args(); - // FIXME(#655): `f16` tests disabled until we can bootstrap symbols #[cfg(f16_enabled)] - #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] { trunc_f32_f16(&mut criterion); trunc_f64_f16(&mut criterion); @@ -133,11 +131,8 @@ pub fn float_trunc() { #[cfg(f128_enabled)] { - // FIXME(#655): `f16` tests disabled until we can bootstrap symbols #[cfg(f16_enabled)] - #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] trunc_f128_f16(&mut criterion); - trunc_f128_f32(&mut criterion); trunc_f128_f64(&mut criterion); } diff --git a/library/compiler-builtins/builtins-test/src/bench.rs b/library/compiler-builtins/builtins-test/src/bench.rs index 0987185670ee..4bdcf482cd61 100644 --- a/library/compiler-builtins/builtins-test/src/bench.rs +++ b/library/compiler-builtins/builtins-test/src/bench.rs @@ -17,28 +17,14 @@ pub fn skip_sys_checks(test_name: &str) -> bool { "extend_f16_f32", "trunc_f32_f16", "trunc_f64_f16", - // FIXME(#616): re-enable once fix is in nightly - // - "mul_f32", - "mul_f64", ]; - // FIXME(f16_f128): error on LE ppc64. There are more tests that are cfg-ed out completely - // in their benchmark modules due to runtime panics. - // - const PPC64LE_SKIPPED: &[&str] = &["extend_f32_f128"]; - // FIXME(f16_f128): system symbols have incorrect results // const X86_NO_SSE_SKIPPED: &[&str] = &[ "add_f128", "sub_f128", "mul_f128", "div_f128", "powi_f32", "powi_f64", ]; - // FIXME(f16_f128): Wide multiply carry bug in `compiler-rt`, re-enable when nightly no longer - // uses `compiler-rt` version. - // - const AARCH64_SKIPPED: &[&str] = &["mul_f128", "div_f128"]; - // FIXME(llvm): system symbols have incorrect results on Windows // const WINDOWS_SKIPPED: &[&str] = &[ @@ -57,19 +43,7 @@ pub fn skip_sys_checks(test_name: &str) -> bool { return true; } - if cfg!(all(target_arch = "powerpc64", target_endian = "little")) - && PPC64LE_SKIPPED.contains(&test_name) - { - return true; - } - - if cfg!(all(target_arch = "x86", not(target_feature = "sse"))) - && X86_NO_SSE_SKIPPED.contains(&test_name) - { - return true; - } - - if cfg!(target_arch = "aarch64") && AARCH64_SKIPPED.contains(&test_name) { + if cfg!(x86_no_sse) && X86_NO_SSE_SKIPPED.contains(&test_name) { return true; } diff --git a/library/compiler-builtins/builtins-test/tests/addsub.rs b/library/compiler-builtins/builtins-test/tests/addsub.rs index 865b9e472ab4..abe7dde645e0 100644 --- a/library/compiler-builtins/builtins-test/tests/addsub.rs +++ b/library/compiler-builtins/builtins-test/tests/addsub.rs @@ -111,7 +111,7 @@ macro_rules! float_sum { } } -#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg(not(x86_no_sse))] mod float_addsub { use super::*; @@ -122,7 +122,7 @@ mod float_addsub { } #[cfg(f128_enabled)] -#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg(not(x86_no_sse))] #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] mod float_addsub_f128 { use super::*; diff --git a/library/compiler-builtins/builtins-test/tests/conv.rs b/library/compiler-builtins/builtins-test/tests/conv.rs index 7d729364faef..9b04295d2efe 100644 --- a/library/compiler-builtins/builtins-test/tests/conv.rs +++ b/library/compiler-builtins/builtins-test/tests/conv.rs @@ -59,32 +59,28 @@ mod i_to_f { || ((error_minus == error || error_plus == error) && ((f0.to_bits() & 1) != 0)) { - if !cfg!(any( - target_arch = "powerpc", - target_arch = "powerpc64" - )) { - panic!( - "incorrect rounding by {}({}): {}, ({}, {}, {}), errors ({}, {}, {})", - stringify!($fn), - x, - f1.to_bits(), - y_minus_ulp, - y, - y_plus_ulp, - error_minus, - error, - error_plus, - ); - } + panic!( + "incorrect rounding by {}({}): {}, ({}, {}, {}), errors ({}, {}, {})", + stringify!($fn), + x, + f1.to_bits(), + y_minus_ulp, + y, + y_plus_ulp, + error_minus, + error, + error_plus, + ); } } - // Test against native conversion. We disable testing on all `x86` because of - // rounding bugs with `i686`. `powerpc` also has the same rounding bug. + // Test against native conversion. + // FIXME(x86,ppc): the platform version has rounding bugs on i686 and + // PowerPC64le (for PPC this only shows up in Docker, not the native runner). + // https://github.com/rust-lang/compiler-builtins/pull/384#issuecomment-740413334 if !Float::eq_repr(f0, f1) && !cfg!(any( target_arch = "x86", - target_arch = "powerpc", - target_arch = "powerpc64" + all(target_arch = "powerpc64", target_endian = "little") )) { panic!( "{}({}): std: {:?}, builtins: {:?}", diff --git a/library/compiler-builtins/builtins-test/tests/div_rem.rs b/library/compiler-builtins/builtins-test/tests/div_rem.rs index e8327f9b4b86..caee4166c995 100644 --- a/library/compiler-builtins/builtins-test/tests/div_rem.rs +++ b/library/compiler-builtins/builtins-test/tests/div_rem.rs @@ -138,7 +138,7 @@ macro_rules! float { }; } -#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg(not(x86_no_sse))] mod float_div { use super::*; diff --git a/library/compiler-builtins/builtins-test/tests/float_pow.rs b/library/compiler-builtins/builtins-test/tests/float_pow.rs index 0e8ae88e83ef..a17dff27c105 100644 --- a/library/compiler-builtins/builtins-test/tests/float_pow.rs +++ b/library/compiler-builtins/builtins-test/tests/float_pow.rs @@ -1,7 +1,7 @@ #![allow(unused_macros)] #![cfg_attr(f128_enabled, feature(f128))] -#![cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg_attr(x86_no_sse, allow(unused))] use builtins_test::*; // This is approximate because of issues related to @@ -52,6 +52,7 @@ macro_rules! pow { }; } +#[cfg(not(x86_no_sse))] // FIXME(i586): failure for powidf2 pow! { f32, 1e-4, __powisf2, all(); f64, 1e-12, __powidf2, all(); diff --git a/library/compiler-builtins/builtins-test/tests/lse.rs b/library/compiler-builtins/builtins-test/tests/lse.rs index 0d85228d7a22..5d59fbb7f44d 100644 --- a/library/compiler-builtins/builtins-test/tests/lse.rs +++ b/library/compiler-builtins/builtins-test/tests/lse.rs @@ -1,6 +1,6 @@ #![feature(decl_macro)] // so we can use pub(super) #![feature(macro_metavar_expr_concat)] -#![cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "no-asm")))] +#![cfg(all(target_arch = "aarch64", target_os = "linux"))] /// Translate a byte size to a Rust type. macro int_ty { diff --git a/library/compiler-builtins/builtins-test/tests/mul.rs b/library/compiler-builtins/builtins-test/tests/mul.rs index 58bc9ab4ac95..3072b45dca03 100644 --- a/library/compiler-builtins/builtins-test/tests/mul.rs +++ b/library/compiler-builtins/builtins-test/tests/mul.rs @@ -113,7 +113,7 @@ macro_rules! float_mul { }; } -#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg(not(x86_no_sse))] mod float_mul { use super::*; @@ -126,7 +126,7 @@ mod float_mul { } #[cfg(f128_enabled)] -#[cfg(not(all(target_arch = "x86", not(target_feature = "sse"))))] +#[cfg(not(x86_no_sse))] #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] mod float_mul_f128 { use super::*; diff --git a/library/compiler-builtins/ci/ci-util.py b/library/compiler-builtins/ci/ci-util.py index 3437d304f48c..c1db17c6c901 100755 --- a/library/compiler-builtins/ci/ci-util.py +++ b/library/compiler-builtins/ci/ci-util.py @@ -7,10 +7,12 @@ git history. import json import os +import pprint import re import subprocess as sp import sys from dataclasses import dataclass +from functools import cache from glob import glob from inspect import cleandoc from os import getenv @@ -50,15 +52,6 @@ GIT = ["git", "-C", REPO_ROOT] DEFAULT_BRANCH = "master" WORKFLOW_NAME = "CI" # Workflow that generates the benchmark artifacts ARTIFACT_PREFIX = "baseline-icount*" -# Place this in a PR body to skip regression checks (must be at the start of a line). -REGRESSION_DIRECTIVE = "ci: allow-regressions" -# Place this in a PR body to skip extensive tests -SKIP_EXTENSIVE_DIRECTIVE = "ci: skip-extensive" -# Place this in a PR body to allow running a large number of extensive tests. If not -# set, this script will error out if a threshold is exceeded in order to avoid -# accidentally spending huge amounts of CI time. -ALLOW_MANY_EXTENSIVE_DIRECTIVE = "ci: allow-many-extensive" -MANY_EXTENSIVE_THRESHOLD = 20 # Don't run exhaustive tests if these files change, even if they contaiin a function # definition. @@ -70,7 +63,7 @@ IGNORE_FILES = [ # libm PR CI takes a long time and doesn't need to run unless relevant files have been # changed. Anything matching this regex pattern will trigger a run. -TRIGGER_LIBM_PR_CI = ".*(libm|musl).*" +TRIGGER_LIBM_CI_FILE_PAT = ".*(libm|musl).*" TYPES = ["f16", "f32", "f64", "f128"] @@ -80,6 +73,54 @@ def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) +@dataclass(init=False) +class PrCfg: + """Directives that we allow in the commit body to control test behavior. + + These are of the form `ci: foo`, at the start of a line. + """ + + # Skip regression checks (must be at the start of a line). + allow_regressions: bool = False + # Don't run extensive tests + skip_extensive: bool = False + + # Allow running a large number of extensive tests. If not set, this script + # will error out if a threshold is exceeded in order to avoid accidentally + # spending huge amounts of CI time. + allow_many_extensive: bool = False + + # Max number of extensive tests to run by default + MANY_EXTENSIVE_THRESHOLD: int = 20 + + # Run tests for `libm` that may otherwise be skipped due to no changed files. + always_test_libm: bool = False + + # String values of directive names + DIR_ALLOW_REGRESSIONS: str = "allow-regressions" + DIR_SKIP_EXTENSIVE: str = "skip-extensive" + DIR_ALLOW_MANY_EXTENSIVE: str = "allow-many-extensive" + DIR_TEST_LIBM: str = "test-libm" + + def __init__(self, body: str): + directives = re.finditer(r"^\s*ci:\s*(?P\S*)", body, re.MULTILINE) + for dir in directives: + name = dir.group("dir_name") + if name == self.DIR_ALLOW_REGRESSIONS: + self.allow_regressions = True + elif name == self.DIR_SKIP_EXTENSIVE: + self.skip_extensive = True + elif name == self.DIR_ALLOW_MANY_EXTENSIVE: + self.allow_many_extensive = True + elif name == self.DIR_TEST_LIBM: + self.always_test_libm = True + else: + eprint(f"Found unexpected directive `{name}`") + exit(1) + + pprint.pp(self) + + @dataclass class PrInfo: """GitHub response for PR query""" @@ -88,10 +129,21 @@ class PrInfo: commits: list[str] created_at: str number: int + cfg: PrCfg @classmethod - def load(cls, pr_number: int | str) -> Self: - """For a given PR number, query the body and commit list""" + def from_env(cls) -> Self | None: + """Create a PR object from the PR_NUMBER environment if set, `None` otherwise.""" + pr_env = os.environ.get("PR_NUMBER") + if pr_env is not None and len(pr_env) > 0: + return cls.from_pr(pr_env) + + return None + + @classmethod + @cache # Cache so we don't print info messages multiple times + def from_pr(cls, pr_number: int | str) -> Self: + """For a given PR number, query the body and commit list.""" pr_info = sp.check_output( [ "gh", @@ -104,13 +156,9 @@ class PrInfo: ], text=True, ) - eprint("PR info:", json.dumps(pr_info, indent=4)) - return cls(**json.loads(pr_info)) - - def contains_directive(self, directive: str) -> bool: - """Return true if the provided directive is on a line in the PR body""" - lines = self.body.splitlines() - return any(line.startswith(directive) for line in lines) + pr_json = json.loads(pr_info) + eprint("PR info:", json.dumps(pr_json, indent=4)) + return cls(**json.loads(pr_info), cfg=PrCfg(pr_json["body"])) class FunctionDef(TypedDict): @@ -207,26 +255,32 @@ class Context: """If this is a PR and no libm files were changed, allow skipping libm jobs.""" - if self.is_pr(): - return all(not re.match(TRIGGER_LIBM_PR_CI, str(f)) for f in self.changed) + # Always run on merge CI + if not self.is_pr(): + return False - return False + pr = PrInfo.from_env() + assert pr is not None, "Is a PR but couldn't load PrInfo" + + # Allow opting in to libm tests + if pr.cfg.always_test_libm: + return False + + # By default, run if there are any changed files matching the pattern + return all(not re.match(TRIGGER_LIBM_CI_FILE_PAT, str(f)) for f in self.changed) def emit_workflow_output(self): """Create a JSON object a list items for each type's changed files, if any did change, and the routines that were affected by the change. """ - pr_number = os.environ.get("PR_NUMBER") skip_tests = False error_on_many_tests = False - if pr_number is not None and len(pr_number) > 0: - pr = PrInfo.load(pr_number) - skip_tests = pr.contains_directive(SKIP_EXTENSIVE_DIRECTIVE) - error_on_many_tests = not pr.contains_directive( - ALLOW_MANY_EXTENSIVE_DIRECTIVE - ) + pr = PrInfo.from_env() + if pr is not None: + skip_tests = pr.cfg.skip_extensive + error_on_many_tests = not pr.cfg.allow_many_extensive if skip_tests: eprint("Skipping all extensive tests") @@ -253,16 +307,14 @@ class Context: may_skip = str(self.may_skip_libm_ci()).lower() print(f"extensive_matrix={ext_matrix}") print(f"may_skip_libm_ci={may_skip}") - eprint(f"extensive_matrix={ext_matrix}") - eprint(f"may_skip_libm_ci={may_skip}") eprint(f"total extensive tests: {total_to_test}") - if error_on_many_tests and total_to_test > MANY_EXTENSIVE_THRESHOLD: + if error_on_many_tests and total_to_test > PrCfg.MANY_EXTENSIVE_THRESHOLD: eprint( - f"More than {MANY_EXTENSIVE_THRESHOLD} tests would be run; add" - f" `{ALLOW_MANY_EXTENSIVE_DIRECTIVE}` to the PR body if this is" + f"More than {PrCfg.MANY_EXTENSIVE_THRESHOLD} tests would be run; add" + f" `{PrCfg.DIR_ALLOW_MANY_EXTENSIVE}` to the PR body if this is" " intentional. If this is refactoring that happens to touch a lot of" - f" files, `{SKIP_EXTENSIVE_DIRECTIVE}` can be used instead." + f" files, `{PrCfg.DIR_SKIP_EXTENSIVE}` can be used instead." ) exit(1) @@ -371,8 +423,8 @@ def handle_bench_regressions(args: list[str]): eprint(USAGE) exit(1) - pr = PrInfo.load(pr_number) - if pr.contains_directive(REGRESSION_DIRECTIVE): + pr = PrInfo.from_pr(pr_number) + if pr.cfg.allow_regressions: eprint("PR allows regressions") return diff --git a/library/compiler-builtins/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index df71804ba235..69b99f5b6b32 100644 --- a/library/compiler-builtins/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabi/Dockerfile b/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabi/Dockerfile index 38ad1a136236..2fa6f8520520 100644 --- a/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabi/Dockerfile +++ b/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabi/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile index ffead05d5f22..85f7335f5a85 100644 --- a/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ b/library/compiler-builtins/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile b/library/compiler-builtins/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile index 9ab49e46ee3a..42511479f36f 100644 --- a/library/compiler-builtins/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile +++ b/library/compiler-builtins/ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/i586-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/i586-unknown-linux-gnu/Dockerfile index d12ced3257fe..35488c477493 100644 --- a/library/compiler-builtins/ci/docker/i586-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/i586-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/i686-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/i686-unknown-linux-gnu/Dockerfile index d12ced3257fe..35488c477493 100644 --- a/library/compiler-builtins/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/i686-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile index 62b43da9e70d..e95a1b9163ff 100644 --- a/library/compiler-builtins/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/mips-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/mips-unknown-linux-gnu/Dockerfile index c02a94672340..fd1877603100 100644 --- a/library/compiler-builtins/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/mips-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/library/compiler-builtins/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile index 6d8b96069bed..4e542ce6858c 100644 --- a/library/compiler-builtins/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ b/library/compiler-builtins/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile b/library/compiler-builtins/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile index 7e6ac7c3b8aa..528dfd8940d5 100644 --- a/library/compiler-builtins/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile +++ b/library/compiler-builtins/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/mipsel-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/mipsel-unknown-linux-gnu/Dockerfile index 9feadc7b5ce1..2572180238e2 100644 --- a/library/compiler-builtins/ci/docker/mipsel-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/mipsel-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/powerpc-unknown-linux-gnu/Dockerfile index 84dcaf47ed5d..cac1f23610aa 100644 --- a/library/compiler-builtins/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/powerpc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile index b90fd5ec5456..76127b7dbb8c 100644 --- a/library/compiler-builtins/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile index e6d1d1cd0b53..da1d56ca66f2 100644 --- a/library/compiler-builtins/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ @@ -12,6 +12,5 @@ ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER="$TOOLCHAIN_PREFIX"gcc \ CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER=qemu-ppc64le-static \ AR_powerpc64le_unknown_linux_gnu="$TOOLCHAIN_PREFIX"ar \ CC_powerpc64le_unknown_linux_gnu="$TOOLCHAIN_PREFIX"gcc \ - QEMU_CPU=POWER8 \ QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu \ RUST_TEST_THREADS=1 diff --git a/library/compiler-builtins/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile index eeb4ed0193e2..513efacd6d96 100644 --- a/library/compiler-builtins/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/thumbv6m-none-eabi/Dockerfile b/library/compiler-builtins/ci/docker/thumbv6m-none-eabi/Dockerfile index ad0d4351ea65..a9a172a21137 100644 --- a/library/compiler-builtins/ci/docker/thumbv6m-none-eabi/Dockerfile +++ b/library/compiler-builtins/ci/docker/thumbv6m-none-eabi/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/thumbv7em-none-eabi/Dockerfile b/library/compiler-builtins/ci/docker/thumbv7em-none-eabi/Dockerfile index ad0d4351ea65..a9a172a21137 100644 --- a/library/compiler-builtins/ci/docker/thumbv7em-none-eabi/Dockerfile +++ b/library/compiler-builtins/ci/docker/thumbv7em-none-eabi/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/thumbv7em-none-eabihf/Dockerfile b/library/compiler-builtins/ci/docker/thumbv7em-none-eabihf/Dockerfile index ad0d4351ea65..a9a172a21137 100644 --- a/library/compiler-builtins/ci/docker/thumbv7em-none-eabihf/Dockerfile +++ b/library/compiler-builtins/ci/docker/thumbv7em-none-eabihf/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/thumbv7m-none-eabi/Dockerfile b/library/compiler-builtins/ci/docker/thumbv7m-none-eabi/Dockerfile index ad0d4351ea65..a9a172a21137 100644 --- a/library/compiler-builtins/ci/docker/thumbv7m-none-eabi/Dockerfile +++ b/library/compiler-builtins/ci/docker/thumbv7m-none-eabi/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/library/compiler-builtins/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index c590adcddf64..2ef800129d67 100644 --- a/library/compiler-builtins/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ b/library/compiler-builtins/ci/docker/x86_64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -ARG IMAGE=ubuntu:24.04 +ARG IMAGE=ubuntu:25.04 FROM $IMAGE RUN apt-get update && \ diff --git a/library/compiler-builtins/ci/run-docker.sh b/library/compiler-builtins/ci/run-docker.sh index d0122dee5c89..4c1fe0fe2644 100755 --- a/library/compiler-builtins/ci/run-docker.sh +++ b/library/compiler-builtins/ci/run-docker.sh @@ -97,7 +97,7 @@ if [ "${1:-}" = "--help" ] || [ "$#" -gt 1 ]; then usage: ./ci/run-docker.sh [target] you can also set DOCKER_BASE_IMAGE to use something other than the default - ubuntu:24.04 (or rustlang/rust:nightly). + ubuntu:25.04 (or rustlang/rust:nightly). " exit fi diff --git a/library/compiler-builtins/ci/run.sh b/library/compiler-builtins/ci/run.sh index 8b7965bb2056..bc94d42fe837 100755 --- a/library/compiler-builtins/ci/run.sh +++ b/library/compiler-builtins/ci/run.sh @@ -41,7 +41,10 @@ else "${test_builtins[@]}" --benches "${test_builtins[@]}" --benches --release - if [ "${TEST_VERBATIM:-}" = "1" ]; then + # Validate that having a verbatim path for the target directory works + # (trivial to regress using `/` in paths to build artifacts rather than + # `Path::join`). MinGW does not currently support these paths. + if [[ "$target" = *"windows"* ]] && [[ "$target" != *"gnu"* ]]; then verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2) "${test_builtins[@]}" --target-dir "$verb_path" --features c fi @@ -161,7 +164,7 @@ else mflags+=(--workspace --target "$target") cmd=(cargo test "${mflags[@]}") profile_flag="--profile" - + # If nextest is available, use that command -v cargo-nextest && nextest=1 || nextest=0 if [ "$nextest" = "1" ]; then @@ -204,7 +207,7 @@ else "${cmd[@]}" "$profile_flag" release-checked --features unstable-intrinsics --benches # Ensure that the routines do not panic. - # + # # `--tests` must be passed because no-panic is only enabled as a dev # dependency. The `release-opt` profile must be used to enable LTO and a # single CGU. diff --git a/library/compiler-builtins/ci/update-musl.sh b/library/compiler-builtins/ci/update-musl.sh index b71cf5778300..637ab1394855 100755 --- a/library/compiler-builtins/ci/update-musl.sh +++ b/library/compiler-builtins/ci/update-musl.sh @@ -3,7 +3,7 @@ set -eux -url=git://git.musl-libc.org/musl +url=https://github.com/kraj/musl.git ref=c47ad25ea3b484e10326f933e927c0bc8cded3da dst=crates/musl-math-sys/musl diff --git a/library/compiler-builtins/compiler-builtins/Cargo.toml b/library/compiler-builtins/compiler-builtins/Cargo.toml index 3ccb05f73fb8..8bbe136ce33e 100644 --- a/library/compiler-builtins/compiler-builtins/Cargo.toml +++ b/library/compiler-builtins/compiler-builtins/Cargo.toml @@ -35,8 +35,9 @@ default = ["compiler-builtins"] # implementations and also filling in unimplemented intrinsics c = ["dep:cc"] -# Workaround for the Cranelift codegen backend. Disables any implementations -# which use inline assembly and fall back to pure Rust versions (if available). +# For implementations where there is both a generic version and a platform- +# specific version, use the generic version. This is meant to enable testing +# the generic versions on all platforms. no-asm = [] # Workaround for codegen backends which haven't yet implemented `f16` and diff --git a/library/compiler-builtins/compiler-builtins/build.rs b/library/compiler-builtins/compiler-builtins/build.rs index 8f51c12b535d..43b978606e5f 100644 --- a/library/compiler-builtins/compiler-builtins/build.rs +++ b/library/compiler-builtins/compiler-builtins/build.rs @@ -106,13 +106,6 @@ fn configure_libm(target: &Target) { println!("cargo:rustc-cfg=optimizations_enabled"); } - // Config shorthands - println!("cargo:rustc-check-cfg=cfg(x86_no_sse)"); - if target.arch == "x86" && !target.features.iter().any(|f| f == "sse") { - // Shorthand to detect i586 targets - println!("cargo:rustc-cfg=x86_no_sse"); - } - println!( "cargo:rustc-env=CFG_CARGO_FEATURES={:?}", target.cargo_features diff --git a/library/compiler-builtins/compiler-builtins/configure.rs b/library/compiler-builtins/compiler-builtins/configure.rs index 9721ddf090c6..79e238abc0f6 100644 --- a/library/compiler-builtins/compiler-builtins/configure.rs +++ b/library/compiler-builtins/compiler-builtins/configure.rs @@ -1,6 +1,5 @@ // Configuration that is shared between `compiler_builtins` and `builtins_test`. -use std::process::{Command, Stdio}; use std::{env, str}; #[derive(Debug)] @@ -35,26 +34,6 @@ impl Target { .map(|s| s.to_lowercase().replace("_", "-")) .collect(); - // Query rustc for options that Cargo does not provide env for. The bootstrap hack is used - // to get consistent output regardless of channel (`f16`/`f128` config options are hidden - // on stable otherwise). - let mut cmd = Command::new(env::var("RUSTC").unwrap()); - cmd.args(["--print=cfg", "--target", &triple]) - .env("RUSTC_BOOTSTRAP", "1") - .stderr(Stdio::inherit()); - let out = cmd - .output() - .unwrap_or_else(|e| panic!("failed to run `{cmd:?}`: {e}")); - let rustc_cfg = str::from_utf8(&out.stdout).unwrap(); - - // If we couldn't query `rustc` (e.g. a custom JSON target was used), make the safe - // choice and leave `f16` and `f128` disabled. - let rustc_output_ok = out.status.success(); - let reliable_f128 = - rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f128"); - let reliable_f16 = - rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f16"); - Self { triple, triple_split, @@ -74,8 +53,10 @@ impl Target { .split(",") .map(ToOwned::to_owned) .collect(), - reliable_f128, - reliable_f16, + // Note that these are unstable options, so only show up with the nightly compiler or + // with `RUSTC_BOOTSTRAP=1` (which is required to use the types anyway). + reliable_f128: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F128").is_some(), + reliable_f16: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F16").is_some(), } } @@ -100,6 +81,13 @@ pub fn configure_aliases(target: &Target) { println!("cargo:rustc-cfg=thumb_1") } + // Config shorthands + println!("cargo:rustc-check-cfg=cfg(x86_no_sse)"); + if target.arch == "x86" && !target.features.iter().any(|f| f == "sse") { + // Shorthand to detect i586 targets + println!("cargo:rustc-cfg=x86_no_sse"); + } + /* Not all backends support `f16` and `f128` to the same level on all architectures, so we * need to disable things if the compiler may crash. See configuration at: * * https://github.com/rust-lang/rust/blob/c65dccabacdfd6c8a7f7439eba13422fdd89b91e/compiler/rustc_codegen_llvm/src/llvm_util.rs#L367-L432 diff --git a/library/compiler-builtins/compiler-builtins/src/aarch64.rs b/library/compiler-builtins/compiler-builtins/src/aarch64.rs index a72b30d29f0b..039fab2061c5 100644 --- a/library/compiler-builtins/compiler-builtins/src/aarch64.rs +++ b/library/compiler-builtins/compiler-builtins/src/aarch64.rs @@ -4,7 +4,7 @@ use core::intrinsics; intrinsics! { #[unsafe(naked)] - #[cfg(all(target_os = "uefi", not(feature = "no-asm")))] + #[cfg(target_os = "uefi")] pub unsafe extern "custom" fn __chkstk() { core::arch::naked_asm!( ".p2align 2", diff --git a/library/compiler-builtins/compiler-builtins/src/aarch64_linux.rs b/library/compiler-builtins/compiler-builtins/src/aarch64_linux.rs index 38fcab152aed..01d7fb473291 100644 --- a/library/compiler-builtins/compiler-builtins/src/aarch64_linux.rs +++ b/library/compiler-builtins/compiler-builtins/src/aarch64_linux.rs @@ -6,9 +6,6 @@ //! which is supported on the current CPU. //! See for more discussion. //! -//! Currently we only support LL/SC, because LSE requires `getauxval` from libc in order to do runtime detection. -//! Use the `compiler-rt` intrinsics if you want LSE support. -//! //! Ported from `aarch64/lse.S` in LLVM's compiler-rt. //! //! Generate functions for each of the following symbols: @@ -24,7 +21,18 @@ //! We do something similar, but with macro arguments. #![cfg_attr(feature = "c", allow(unused_macros))] // avoid putting the macros into a submodule -// We don't do runtime dispatch so we don't have to worry about the `__aarch64_have_lse_atomics` global ctor. +use core::sync::atomic::{AtomicU8, Ordering}; + +/// non-zero if the host supports LSE atomics. +static HAVE_LSE_ATOMICS: AtomicU8 = AtomicU8::new(0); + +intrinsics! { + /// Call to enable LSE in outline atomic operations. The caller must verify + /// LSE operations are supported. + pub extern "C" fn __rust_enable_lse() { + HAVE_LSE_ATOMICS.store(1, Ordering::Relaxed); + } +} /// Translate a byte size to a Rust type. #[rustfmt::skip] @@ -45,6 +53,7 @@ macro_rules! reg { (2, $num:literal) => { concat!("w", $num) }; (4, $num:literal) => { concat!("w", $num) }; (8, $num:literal) => { concat!("x", $num) }; + (16, $num:literal) => { concat!("x", $num) }; } /// Given an atomic ordering, translate it to the acquire suffix for the lxdr aarch64 ASM instruction. @@ -126,6 +135,41 @@ macro_rules! stxp { }; } +// If supported, perform the requested LSE op and return, or fallthrough. +macro_rules! try_lse_op { + ($op: literal, $ordering:ident, $bytes:tt, $($reg:literal,)* [ $mem:ident ] ) => { + concat!( + ".arch_extension lse; ", + "adrp x16, {have_lse}; ", + "ldrb w16, [x16, :lo12:{have_lse}]; ", + "cbz w16, 8f; ", + // LSE_OP s(reg),* [$mem] + concat!(lse!($op, $ordering, $bytes), $( " ", reg!($bytes, $reg), ", " ,)* "[", stringify!($mem), "]; ",), + "ret; ", + "8:" + ) + }; +} + +// Translate memory ordering to the LSE suffix +#[rustfmt::skip] +macro_rules! lse_mem_sfx { + (Relaxed) => { "" }; + (Acquire) => { "a" }; + (Release) => { "l" }; + (AcqRel) => { "al" }; +} + +// Generate the aarch64 LSE operation for memory ordering and width +macro_rules! lse { + ($op:literal, $order:ident, 16) => { + concat!($op, "p", lse_mem_sfx!($order)) + }; + ($op:literal, $order:ident, $bytes:tt) => { + concat!($op, lse_mem_sfx!($order), size!($bytes)) + }; +} + /// See . macro_rules! compare_and_swap { ($ordering:ident, $bytes:tt, $name:ident) => { @@ -137,7 +181,9 @@ macro_rules! compare_and_swap { ) -> int_ty!($bytes) { // We can't use `AtomicI8::compare_and_swap`; we *are* compare_and_swap. core::arch::naked_asm! { - // UXT s(tmp0), s(0) + // CAS s(0), s(1), [x2]; if LSE supported. + try_lse_op!("cas", $ordering, $bytes, 0, 1, [x2]), + // UXT s(tmp0), s(0) concat!(uxt!($bytes), " ", reg!($bytes, 16), ", ", reg!($bytes, 0)), "0:", // LDXR s(0), [x2] @@ -150,6 +196,7 @@ macro_rules! compare_and_swap { "cbnz w17, 0b", "1:", "ret", + have_lse = sym crate::aarch64_linux::HAVE_LSE_ATOMICS, } } } @@ -166,6 +213,8 @@ macro_rules! compare_and_swap_i128 { expected: i128, desired: i128, ptr: *mut i128 ) -> i128 { core::arch::naked_asm! { + // CASP x0, x1, x2, x3, [x4]; if LSE supported. + try_lse_op!("cas", $ordering, 16, 0, 1, 2, 3, [x4]), "mov x16, x0", "mov x17, x1", "0:", @@ -179,6 +228,7 @@ macro_rules! compare_and_swap_i128 { "cbnz w15, 0b", "1:", "ret", + have_lse = sym crate::aarch64_linux::HAVE_LSE_ATOMICS, } } } @@ -195,6 +245,8 @@ macro_rules! swap { left: int_ty!($bytes), right_ptr: *mut int_ty!($bytes) ) -> int_ty!($bytes) { core::arch::naked_asm! { + // SWP s(0), s(0), [x1]; if LSE supported. + try_lse_op!("swp", $ordering, $bytes, 0, 0, [x1]), // mov s(tmp0), s(0) concat!("mov ", reg!($bytes, 16), ", ", reg!($bytes, 0)), "0:", @@ -204,6 +256,7 @@ macro_rules! swap { concat!(stxr!($ordering, $bytes), " w17, ", reg!($bytes, 16), ", [x1]"), "cbnz w17, 0b", "ret", + have_lse = sym crate::aarch64_linux::HAVE_LSE_ATOMICS, } } } @@ -212,7 +265,7 @@ macro_rules! swap { /// See (e.g.) . macro_rules! fetch_op { - ($ordering:ident, $bytes:tt, $name:ident, $op:literal) => { + ($ordering:ident, $bytes:tt, $name:ident, $op:literal, $lse_op:literal) => { intrinsics! { #[maybe_use_optimized_c_shim] #[unsafe(naked)] @@ -220,6 +273,8 @@ macro_rules! fetch_op { val: int_ty!($bytes), ptr: *mut int_ty!($bytes) ) -> int_ty!($bytes) { core::arch::naked_asm! { + // LSEOP s(0), s(0), [x1]; if LSE supported. + try_lse_op!($lse_op, $ordering, $bytes, 0, 0, [x1]), // mov s(tmp0), s(0) concat!("mov ", reg!($bytes, 16), ", ", reg!($bytes, 0)), "0:", @@ -231,6 +286,7 @@ macro_rules! fetch_op { concat!(stxr!($ordering, $bytes), " w15, ", reg!($bytes, 17), ", [x1]"), "cbnz w15, 0b", "ret", + have_lse = sym crate::aarch64_linux::HAVE_LSE_ATOMICS, } } } @@ -240,25 +296,25 @@ macro_rules! fetch_op { // We need a single macro to pass to `foreach_ldadd`. macro_rules! add { ($ordering:ident, $bytes:tt, $name:ident) => { - fetch_op! { $ordering, $bytes, $name, "add" } + fetch_op! { $ordering, $bytes, $name, "add", "ldadd" } }; } macro_rules! and { ($ordering:ident, $bytes:tt, $name:ident) => { - fetch_op! { $ordering, $bytes, $name, "bic" } + fetch_op! { $ordering, $bytes, $name, "bic", "ldclr" } }; } macro_rules! xor { ($ordering:ident, $bytes:tt, $name:ident) => { - fetch_op! { $ordering, $bytes, $name, "eor" } + fetch_op! { $ordering, $bytes, $name, "eor", "ldeor" } }; } macro_rules! or { ($ordering:ident, $bytes:tt, $name:ident) => { - fetch_op! { $ordering, $bytes, $name, "orr" } + fetch_op! { $ordering, $bytes, $name, "orr", "ldset" } }; } diff --git a/library/compiler-builtins/compiler-builtins/src/arm.rs b/library/compiler-builtins/compiler-builtins/src/arm.rs index fbec93ca4312..0c15b37df1dc 100644 --- a/library/compiler-builtins/compiler-builtins/src/arm.rs +++ b/library/compiler-builtins/compiler-builtins/src/arm.rs @@ -1,5 +1,3 @@ -#![cfg(not(feature = "no-asm"))] - // Interfaces used by naked trampolines. // SAFETY: these are defined in compiler-builtins unsafe extern "C" { diff --git a/library/compiler-builtins/compiler-builtins/src/hexagon.rs b/library/compiler-builtins/compiler-builtins/src/hexagon.rs index 91cf91c31421..a5c7b4dfdda9 100644 --- a/library/compiler-builtins/compiler-builtins/src/hexagon.rs +++ b/library/compiler-builtins/compiler-builtins/src/hexagon.rs @@ -1,5 +1,3 @@ -#![cfg(not(feature = "no-asm"))] - use core::arch::global_asm; global_asm!(include_str!("hexagon/func_macro.s"), options(raw)); diff --git a/library/compiler-builtins/compiler-builtins/src/lib.rs b/library/compiler-builtins/compiler-builtins/src/lib.rs index fe0ad81dd3a3..ca75f44e02a9 100644 --- a/library/compiler-builtins/compiler-builtins/src/lib.rs +++ b/library/compiler-builtins/compiler-builtins/src/lib.rs @@ -60,7 +60,7 @@ pub mod arm; #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] pub mod aarch64; -#[cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "no-asm"),))] +#[cfg(all(target_arch = "aarch64", target_os = "linux"))] pub mod aarch64_linux; #[cfg(all( diff --git a/library/compiler-builtins/compiler-builtins/src/probestack.rs b/library/compiler-builtins/compiler-builtins/src/probestack.rs index f4105dde57e6..9a18216da99a 100644 --- a/library/compiler-builtins/compiler-builtins/src/probestack.rs +++ b/library/compiler-builtins/compiler-builtins/src/probestack.rs @@ -44,8 +44,6 @@ #![cfg(not(feature = "mangled-names"))] // Windows and Cygwin already has builtins to do this. #![cfg(not(any(windows, target_os = "cygwin")))] -// All these builtins require assembly -#![cfg(not(feature = "no-asm"))] // We only define stack probing for these architectures today. #![cfg(any(target_arch = "x86_64", target_arch = "x86"))] diff --git a/library/compiler-builtins/compiler-builtins/src/x86.rs b/library/compiler-builtins/compiler-builtins/src/x86.rs index 16e50922a945..51940b3b338a 100644 --- a/library/compiler-builtins/compiler-builtins/src/x86.rs +++ b/library/compiler-builtins/compiler-builtins/src/x86.rs @@ -9,10 +9,7 @@ use core::intrinsics; intrinsics! { #[unsafe(naked)] - #[cfg(all( - any(all(windows, target_env = "gnu"), target_os = "uefi"), - not(feature = "no-asm") - ))] + #[cfg(any(all(windows, target_env = "gnu"), target_os = "uefi"))] pub unsafe extern "custom" fn __chkstk() { core::arch::naked_asm!( "jmp {}", // Jump to __alloca since fallthrough may be unreliable" @@ -21,10 +18,7 @@ intrinsics! { } #[unsafe(naked)] - #[cfg(all( - any(all(windows, target_env = "gnu"), target_os = "uefi"), - not(feature = "no-asm") - ))] + #[cfg(any(all(windows, target_env = "gnu"), target_os = "uefi"))] pub unsafe extern "custom" fn _alloca() { // __chkstk and _alloca are the same function core::arch::naked_asm!( diff --git a/library/compiler-builtins/compiler-builtins/src/x86_64.rs b/library/compiler-builtins/compiler-builtins/src/x86_64.rs index 9b7133b482e4..f9ae784d5752 100644 --- a/library/compiler-builtins/compiler-builtins/src/x86_64.rs +++ b/library/compiler-builtins/compiler-builtins/src/x86_64.rs @@ -9,14 +9,7 @@ use core::intrinsics; intrinsics! { #[unsafe(naked)] - #[cfg(all( - any( - all(windows, target_env = "gnu"), - target_os = "cygwin", - target_os = "uefi" - ), - not(feature = "no-asm") - ))] + #[cfg(any(all(windows, target_env = "gnu"), target_os = "cygwin", target_os = "uefi"))] pub unsafe extern "custom" fn ___chkstk_ms() { core::arch::naked_asm!( "push %rcx", diff --git a/library/compiler-builtins/crates/musl-math-sys/src/lib.rs b/library/compiler-builtins/crates/musl-math-sys/src/lib.rs index 6a4bf4859d93..9cab8deefdef 100644 --- a/library/compiler-builtins/crates/musl-math-sys/src/lib.rs +++ b/library/compiler-builtins/crates/musl-math-sys/src/lib.rs @@ -40,8 +40,6 @@ macro_rules! functions { ) => { // Run a simple check to ensure we can link and call the function without crashing. #[test] - // FIXME(#309): LE PPC crashes calling some musl functions - #[cfg_attr(all(target_arch = "powerpc64", target_endian = "little"), ignore)] fn $name() { $rty>::check(super::$name); } diff --git a/library/compiler-builtins/crates/symbol-check/Cargo.toml b/library/compiler-builtins/crates/symbol-check/Cargo.toml index 30969ee406ab..e2218b491720 100644 --- a/library/compiler-builtins/crates/symbol-check/Cargo.toml +++ b/library/compiler-builtins/crates/symbol-check/Cargo.toml @@ -5,8 +5,7 @@ edition = "2024" publish = false [dependencies] -# FIXME: used as a git dependency since the latest release does not support wasm -object = { git = "https://github.com/gimli-rs/object.git", rev = "013fac75da56a684377af4151b8164b78c1790e0" } +object = "0.37.1" serde_json = "1.0.140" [features] diff --git a/library/compiler-builtins/libm-test/src/precision.rs b/library/compiler-builtins/libm-test/src/precision.rs index 32825b15d476..3fb8c1b37109 100644 --- a/library/compiler-builtins/libm-test/src/precision.rs +++ b/library/compiler-builtins/libm-test/src/precision.rs @@ -271,18 +271,6 @@ impl MaybeOverride<(f32,)> for SpecialCase { impl MaybeOverride<(f64,)> for SpecialCase { fn check_float(input: (f64,), actual: F, expected: F, ctx: &CheckCtx) -> CheckAction { - if cfg!(x86_no_sse) - && ctx.base_name == BaseName::Ceil - && ctx.basis == CheckBasis::Musl - && input.0 < 0.0 - && input.0 > -1.0 - && expected == F::ZERO - && actual == F::ZERO - { - // musl returns -0.0, we return +0.0 - return XFAIL("i586 ceil signed zero"); - } - if cfg!(x86_no_sse) && (ctx.base_name == BaseName::Rint || ctx.base_name == BaseName::Roundeven) && (expected - actual).abs() <= F::ONE @@ -292,16 +280,6 @@ impl MaybeOverride<(f64,)> for SpecialCase { return XFAIL("i586 rint rounding mode"); } - if cfg!(x86_no_sse) - && (ctx.fn_ident == Identifier::Ceil || ctx.fn_ident == Identifier::Floor) - && expected.eq_repr(F::NEG_ZERO) - && actual.eq_repr(F::ZERO) - { - // FIXME: the x87 implementations do not keep the distinction between -0.0 and 0.0. - // See https://github.com/rust-lang/libm/pull/404#issuecomment-2572399955 - return XFAIL("i586 ceil/floor signed zero"); - } - if cfg!(x86_no_sse) && (ctx.fn_ident == Identifier::Exp10 || ctx.fn_ident == Identifier::Exp2) { diff --git a/library/compiler-builtins/libm/configure.rs b/library/compiler-builtins/libm/configure.rs index f9100d2d58b2..76186e636527 100644 --- a/library/compiler-builtins/libm/configure.rs +++ b/library/compiler-builtins/libm/configure.rs @@ -1,9 +1,9 @@ // Configuration shared with both libm and libm-test +use std::env; use std::path::PathBuf; -use std::process::{Command, Stdio}; -use std::{env, str}; +#[derive(Debug)] #[allow(dead_code)] pub struct Config { pub manifest_dir: PathBuf, @@ -33,26 +33,6 @@ impl Config { .map(|s| s.to_lowercase().replace("_", "-")) .collect(); - // Query rustc for options that Cargo does not provide env for. The bootstrap hack is used - // to get consistent output regardless of channel (`f16`/`f128` config options are hidden - // on stable otherwise). - let mut cmd = Command::new(env::var("RUSTC").unwrap()); - cmd.args(["--print=cfg", "--target", &target_triple]) - .env("RUSTC_BOOTSTRAP", "1") - .stderr(Stdio::inherit()); - let out = cmd - .output() - .unwrap_or_else(|e| panic!("failed to run `{cmd:?}`: {e}")); - let rustc_cfg = str::from_utf8(&out.stdout).unwrap(); - - // If we couldn't query `rustc` (e.g. a custom JSON target was used), make the safe - // choice and leave `f16` and `f128` disabled. - let rustc_output_ok = out.status.success(); - let reliable_f128 = - rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f128"); - let reliable_f16 = - rustc_output_ok && rustc_cfg.lines().any(|l| l == "target_has_reliable_f16"); - Self { target_triple, manifest_dir: PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()), @@ -66,8 +46,10 @@ impl Config { target_string: env::var("TARGET").unwrap(), target_vendor: env::var("CARGO_CFG_TARGET_VENDOR").unwrap(), target_features, - reliable_f128, - reliable_f16, + // Note that these are unstable options, so only show up with the nightly compiler or + // with `RUSTC_BOOTSTRAP=1` (which is required to use the types anyway). + reliable_f128: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F128").is_some(), + reliable_f16: env::var_os("CARGO_CFG_TARGET_HAS_RELIABLE_F16").is_some(), } } } diff --git a/library/compiler-builtins/libm/src/math/acos.rs b/library/compiler-builtins/libm/src/math/acos.rs index 23b13251ee23..89b2e7c5f30e 100644 --- a/library/compiler-builtins/libm/src/math/acos.rs +++ b/library/compiler-builtins/libm/src/math/acos.rs @@ -59,7 +59,7 @@ fn r(z: f64) -> f64 { /// Computes the inverse cosine (arc cosine) of the input value. /// Arguments must be in the range -1 to 1. /// Returns values in radians, in the range of 0 to pi. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn acos(x: f64) -> f64 { let x1p_120f = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ -120 let z: f64; diff --git a/library/compiler-builtins/libm/src/math/acosf.rs b/library/compiler-builtins/libm/src/math/acosf.rs index dd88eea5b13a..d263b3f2ce33 100644 --- a/library/compiler-builtins/libm/src/math/acosf.rs +++ b/library/compiler-builtins/libm/src/math/acosf.rs @@ -33,7 +33,7 @@ fn r(z: f32) -> f32 { /// Computes the inverse cosine (arc cosine) of the input value. /// Arguments must be in the range -1 to 1. /// Returns values in radians, in the range of 0 to pi. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn acosf(x: f32) -> f32 { let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120) diff --git a/library/compiler-builtins/libm/src/math/acosh.rs b/library/compiler-builtins/libm/src/math/acosh.rs index d1f5b9fa9372..8737bad012c8 100644 --- a/library/compiler-builtins/libm/src/math/acosh.rs +++ b/library/compiler-builtins/libm/src/math/acosh.rs @@ -7,7 +7,7 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3 /// Calculates the inverse hyperbolic cosine of `x`. /// Is defined as `log(x + sqrt(x*x-1))`. /// `x` must be a number greater than or equal to 1. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn acosh(x: f64) -> f64 { let u = x.to_bits(); let e = ((u >> 52) as usize) & 0x7ff; diff --git a/library/compiler-builtins/libm/src/math/acoshf.rs b/library/compiler-builtins/libm/src/math/acoshf.rs index ad3455fdd48c..432fa03f1163 100644 --- a/library/compiler-builtins/libm/src/math/acoshf.rs +++ b/library/compiler-builtins/libm/src/math/acoshf.rs @@ -7,7 +7,7 @@ const LN2: f32 = 0.693147180559945309417232121458176568; /// Calculates the inverse hyperbolic cosine of `x`. /// Is defined as `log(x + sqrt(x*x-1))`. /// `x` must be a number greater than or equal to 1. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn acoshf(x: f32) -> f32 { let u = x.to_bits(); let a = u & 0x7fffffff; diff --git a/library/compiler-builtins/libm/src/math/arch/i586.rs b/library/compiler-builtins/libm/src/math/arch/i586.rs index f92b9a2af711..b9a66762063d 100644 --- a/library/compiler-builtins/libm/src/math/arch/i586.rs +++ b/library/compiler-builtins/libm/src/math/arch/i586.rs @@ -1,37 +1,62 @@ //! Architecture-specific support for x86-32 without SSE2 +//! +//! We use an alternative implementation on x86, because the +//! main implementation fails with the x87 FPU used by +//! debian i386, probably due to excess precision issues. +//! +//! See https://github.com/rust-lang/compiler-builtins/pull/976 for discussion on why these +//! functions are implemented in this way. -use super::super::fabs; - -/// Use an alternative implementation on x86, because the -/// main implementation fails with the x87 FPU used by -/// debian i386, probably due to excess precision issues. -/// Basic implementation taken from https://github.com/rust-lang/libm/issues/219. -pub fn ceil(x: f64) -> f64 { - if fabs(x).to_bits() < 4503599627370496.0_f64.to_bits() { - let truncated = x as i64 as f64; - if truncated < x { - return truncated + 1.0; - } else { - return truncated; - } - } else { - return x; +pub fn ceil(mut x: f64) -> f64 { + unsafe { + core::arch::asm!( + "fld qword ptr [{x}]", + // Save the FPU control word, using `x` as scratch space. + "fstcw [{x}]", + // Set rounding control to 0b10 (+∞). + "mov word ptr [{x} + 2], 0x0b7f", + "fldcw [{x} + 2]", + // Round. + "frndint", + // Restore FPU control word. + "fldcw [{x}]", + // Save rounded value to memory. + "fstp qword ptr [{x}]", + x = in(reg) &mut x, + // All the x87 FPU stack is used, all registers must be clobbered + out("st(0)") _, out("st(1)") _, + out("st(2)") _, out("st(3)") _, + out("st(4)") _, out("st(5)") _, + out("st(6)") _, out("st(7)") _, + options(nostack), + ); } + x } -/// Use an alternative implementation on x86, because the -/// main implementation fails with the x87 FPU used by -/// debian i386, probably due to excess precision issues. -/// Basic implementation taken from https://github.com/rust-lang/libm/issues/219. -pub fn floor(x: f64) -> f64 { - if fabs(x).to_bits() < 4503599627370496.0_f64.to_bits() { - let truncated = x as i64 as f64; - if truncated > x { - return truncated - 1.0; - } else { - return truncated; - } - } else { - return x; +pub fn floor(mut x: f64) -> f64 { + unsafe { + core::arch::asm!( + "fld qword ptr [{x}]", + // Save the FPU control word, using `x` as scratch space. + "fstcw [{x}]", + // Set rounding control to 0b01 (-∞). + "mov word ptr [{x} + 2], 0x077f", + "fldcw [{x} + 2]", + // Round. + "frndint", + // Restore FPU control word. + "fldcw [{x}]", + // Save rounded value to memory. + "fstp qword ptr [{x}]", + x = in(reg) &mut x, + // All the x87 FPU stack is used, all registers must be clobbered + out("st(0)") _, out("st(1)") _, + out("st(2)") _, out("st(3)") _, + out("st(4)") _, out("st(5)") _, + out("st(6)") _, out("st(7)") _, + options(nostack), + ); } + x } diff --git a/library/compiler-builtins/libm/src/math/asin.rs b/library/compiler-builtins/libm/src/math/asin.rs index 12d0cd35fa58..9554a3eacc24 100644 --- a/library/compiler-builtins/libm/src/math/asin.rs +++ b/library/compiler-builtins/libm/src/math/asin.rs @@ -66,7 +66,7 @@ fn comp_r(z: f64) -> f64 { /// Computes the inverse sine (arc sine) of the argument `x`. /// Arguments to asin must be in the range -1 to 1. /// Returns values in radians, in the range of -pi/2 to pi/2. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn asin(mut x: f64) -> f64 { let z: f64; let r: f64; diff --git a/library/compiler-builtins/libm/src/math/asinf.rs b/library/compiler-builtins/libm/src/math/asinf.rs index ed685556730e..2dfe2a6d486d 100644 --- a/library/compiler-builtins/libm/src/math/asinf.rs +++ b/library/compiler-builtins/libm/src/math/asinf.rs @@ -35,7 +35,7 @@ fn r(z: f32) -> f32 { /// Computes the inverse sine (arc sine) of the argument `x`. /// Arguments to asin must be in the range -1 to 1. /// Returns values in radians, in the range of -pi/2 to pi/2. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn asinf(mut x: f32) -> f32 { let x1p_120 = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ (-120) diff --git a/library/compiler-builtins/libm/src/math/asinh.rs b/library/compiler-builtins/libm/src/math/asinh.rs index 75d3c3ad462a..d63bc0aa9c35 100644 --- a/library/compiler-builtins/libm/src/math/asinh.rs +++ b/library/compiler-builtins/libm/src/math/asinh.rs @@ -7,7 +7,7 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3 /// /// Calculates the inverse hyperbolic sine of `x`. /// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn asinh(mut x: f64) -> f64 { let mut u = x.to_bits(); let e = ((u >> 52) as usize) & 0x7ff; diff --git a/library/compiler-builtins/libm/src/math/asinhf.rs b/library/compiler-builtins/libm/src/math/asinhf.rs index 27ed9dd372da..3ca2d44894db 100644 --- a/library/compiler-builtins/libm/src/math/asinhf.rs +++ b/library/compiler-builtins/libm/src/math/asinhf.rs @@ -7,7 +7,7 @@ const LN2: f32 = 0.693147180559945309417232121458176568; /// /// Calculates the inverse hyperbolic sine of `x`. /// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn asinhf(mut x: f32) -> f32 { let u = x.to_bits(); let i = u & 0x7fffffff; diff --git a/library/compiler-builtins/libm/src/math/atan.rs b/library/compiler-builtins/libm/src/math/atan.rs index 4ca5cc91a1e4..0590ba87cf85 100644 --- a/library/compiler-builtins/libm/src/math/atan.rs +++ b/library/compiler-builtins/libm/src/math/atan.rs @@ -65,7 +65,7 @@ const AT: [f64; 11] = [ /// /// Computes the inverse tangent (arc tangent) of the input value. /// Returns a value in radians, in the range of -pi/2 to pi/2. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn atan(x: f64) -> f64 { let mut x = x; let mut ix = (x.to_bits() >> 32) as u32; diff --git a/library/compiler-builtins/libm/src/math/atan2.rs b/library/compiler-builtins/libm/src/math/atan2.rs index c668731cf376..51456e409b8c 100644 --- a/library/compiler-builtins/libm/src/math/atan2.rs +++ b/library/compiler-builtins/libm/src/math/atan2.rs @@ -47,7 +47,7 @@ const PI_LO: f64 = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ /// Computes the inverse tangent (arc tangent) of `y/x`. /// Produces the correct result even for angles near pi/2 or -pi/2 (that is, when `x` is near 0). /// Returns a value in radians, in the range of -pi to pi. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn atan2(y: f64, x: f64) -> f64 { if x.is_nan() || y.is_nan() { return x + y; diff --git a/library/compiler-builtins/libm/src/math/atan2f.rs b/library/compiler-builtins/libm/src/math/atan2f.rs index 95b466fff4e4..0f46c9f3906b 100644 --- a/library/compiler-builtins/libm/src/math/atan2f.rs +++ b/library/compiler-builtins/libm/src/math/atan2f.rs @@ -23,7 +23,7 @@ const PI_LO: f32 = -8.7422776573e-08; /* 0xb3bbbd2e */ /// Computes the inverse tangent (arc tangent) of `y/x`. /// Produces the correct result even for angles near pi/2 or -pi/2 (that is, when `x` is near 0). /// Returns a value in radians, in the range of -pi to pi. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn atan2f(y: f32, x: f32) -> f32 { if x.is_nan() || y.is_nan() { return x + y; diff --git a/library/compiler-builtins/libm/src/math/atanf.rs b/library/compiler-builtins/libm/src/math/atanf.rs index da8daa41a010..58568d9a81f2 100644 --- a/library/compiler-builtins/libm/src/math/atanf.rs +++ b/library/compiler-builtins/libm/src/math/atanf.rs @@ -41,7 +41,7 @@ const A_T: [f32; 5] = [ /// /// Computes the inverse tangent (arc tangent) of the input value. /// Returns a value in radians, in the range of -pi/2 to pi/2. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn atanf(mut x: f32) -> f32 { let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120) diff --git a/library/compiler-builtins/libm/src/math/atanh.rs b/library/compiler-builtins/libm/src/math/atanh.rs index 9dc826f5605b..883ff150fd6c 100644 --- a/library/compiler-builtins/libm/src/math/atanh.rs +++ b/library/compiler-builtins/libm/src/math/atanh.rs @@ -5,7 +5,7 @@ use super::log1p; /// /// Calculates the inverse hyperbolic tangent of `x`. /// Is defined as `log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn atanh(x: f64) -> f64 { let u = x.to_bits(); let e = ((u >> 52) as usize) & 0x7ff; diff --git a/library/compiler-builtins/libm/src/math/atanhf.rs b/library/compiler-builtins/libm/src/math/atanhf.rs index 80ccec1f67fe..e4e356d18d83 100644 --- a/library/compiler-builtins/libm/src/math/atanhf.rs +++ b/library/compiler-builtins/libm/src/math/atanhf.rs @@ -5,7 +5,7 @@ use super::log1pf; /// /// Calculates the inverse hyperbolic tangent of `x`. /// Is defined as `log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn atanhf(mut x: f32) -> f32 { let mut u = x.to_bits(); let sign = (u >> 31) != 0; diff --git a/library/compiler-builtins/libm/src/math/cbrt.rs b/library/compiler-builtins/libm/src/math/cbrt.rs index cf56f7a9792a..e905e15f13fb 100644 --- a/library/compiler-builtins/libm/src/math/cbrt.rs +++ b/library/compiler-builtins/libm/src/math/cbrt.rs @@ -8,7 +8,7 @@ use super::Float; use super::support::{FpResult, Round, cold_path}; /// Compute the cube root of the argument. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn cbrt(x: f64) -> f64 { cbrt_round(x, Round::Nearest).val } diff --git a/library/compiler-builtins/libm/src/math/cbrtf.rs b/library/compiler-builtins/libm/src/math/cbrtf.rs index 9d70305c6472..9d69584834a3 100644 --- a/library/compiler-builtins/libm/src/math/cbrtf.rs +++ b/library/compiler-builtins/libm/src/math/cbrtf.rs @@ -25,7 +25,7 @@ const B2: u32 = 642849266; /* B2 = (127-127.0/3-24/3-0.03306235651)*2**23 */ /// Cube root (f32) /// /// Computes the cube root of the argument. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn cbrtf(x: f32) -> f32 { let x1p24 = f32::from_bits(0x4b800000); // 0x1p24f === 2 ^ 24 diff --git a/library/compiler-builtins/libm/src/math/ceil.rs b/library/compiler-builtins/libm/src/math/ceil.rs index 4e103545727a..2cac49f29ba9 100644 --- a/library/compiler-builtins/libm/src/math/ceil.rs +++ b/library/compiler-builtins/libm/src/math/ceil.rs @@ -2,7 +2,7 @@ /// /// Finds the nearest integer greater than or equal to `x`. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ceilf16(x: f16) -> f16 { super::generic::ceil(x) } @@ -10,7 +10,7 @@ pub fn ceilf16(x: f16) -> f16 { /// Ceil (f32) /// /// Finds the nearest integer greater than or equal to `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ceilf(x: f32) -> f32 { select_implementation! { name: ceilf, @@ -24,7 +24,7 @@ pub fn ceilf(x: f32) -> f32 { /// Ceil (f64) /// /// Finds the nearest integer greater than or equal to `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ceil(x: f64) -> f64 { select_implementation! { name: ceil, @@ -40,7 +40,7 @@ pub fn ceil(x: f64) -> f64 { /// /// Finds the nearest integer greater than or equal to `x`. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ceilf128(x: f128) -> f128 { super::generic::ceil(x) } diff --git a/library/compiler-builtins/libm/src/math/copysign.rs b/library/compiler-builtins/libm/src/math/copysign.rs index d093d6107273..591a87a940e2 100644 --- a/library/compiler-builtins/libm/src/math/copysign.rs +++ b/library/compiler-builtins/libm/src/math/copysign.rs @@ -3,7 +3,7 @@ /// Constructs a number with the magnitude (absolute value) of its /// first argument, `x`, and the sign of its second argument, `y`. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn copysignf16(x: f16, y: f16) -> f16 { super::generic::copysign(x, y) } @@ -12,7 +12,7 @@ pub fn copysignf16(x: f16, y: f16) -> f16 { /// /// Constructs a number with the magnitude (absolute value) of its /// first argument, `x`, and the sign of its second argument, `y`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn copysignf(x: f32, y: f32) -> f32 { super::generic::copysign(x, y) } @@ -21,7 +21,7 @@ pub fn copysignf(x: f32, y: f32) -> f32 { /// /// Constructs a number with the magnitude (absolute value) of its /// first argument, `x`, and the sign of its second argument, `y`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn copysign(x: f64, y: f64) -> f64 { super::generic::copysign(x, y) } @@ -31,7 +31,7 @@ pub fn copysign(x: f64, y: f64) -> f64 { /// Constructs a number with the magnitude (absolute value) of its /// first argument, `x`, and the sign of its second argument, `y`. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn copysignf128(x: f128, y: f128) -> f128 { super::generic::copysign(x, y) } diff --git a/library/compiler-builtins/libm/src/math/cos.rs b/library/compiler-builtins/libm/src/math/cos.rs index de99cd4c5e45..b2f786323f4d 100644 --- a/library/compiler-builtins/libm/src/math/cos.rs +++ b/library/compiler-builtins/libm/src/math/cos.rs @@ -45,7 +45,7 @@ use super::{k_cos, k_sin, rem_pio2}; /// The cosine of `x` (f64). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn cos(x: f64) -> f64 { let ix = (f64::to_bits(x) >> 32) as u32 & 0x7fffffff; diff --git a/library/compiler-builtins/libm/src/math/cosf.rs b/library/compiler-builtins/libm/src/math/cosf.rs index 27c2fc3b9945..bf5cb9196a36 100644 --- a/library/compiler-builtins/libm/src/math/cosf.rs +++ b/library/compiler-builtins/libm/src/math/cosf.rs @@ -27,7 +27,7 @@ const C4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */ /// The cosine of `x` (f32). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn cosf(x: f32) -> f32 { let x64 = x as f64; diff --git a/library/compiler-builtins/libm/src/math/cosh.rs b/library/compiler-builtins/libm/src/math/cosh.rs index d2e43fd6cb69..01081cfc77e0 100644 --- a/library/compiler-builtins/libm/src/math/cosh.rs +++ b/library/compiler-builtins/libm/src/math/cosh.rs @@ -5,7 +5,7 @@ use super::{exp, expm1, k_expo2}; /// Computes the hyperbolic cosine of the argument x. /// Is defined as `(exp(x) + exp(-x))/2` /// Angles are specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn cosh(mut x: f64) -> f64 { /* |x| */ let mut ix = x.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/coshf.rs b/library/compiler-builtins/libm/src/math/coshf.rs index 567a24410e79..dc039a3117cb 100644 --- a/library/compiler-builtins/libm/src/math/coshf.rs +++ b/library/compiler-builtins/libm/src/math/coshf.rs @@ -5,7 +5,7 @@ use super::{expf, expm1f, k_expo2f}; /// Computes the hyperbolic cosine of the argument x. /// Is defined as `(exp(x) + exp(-x))/2` /// Angles are specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn coshf(mut x: f32) -> f32 { let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120 diff --git a/library/compiler-builtins/libm/src/math/erf.rs b/library/compiler-builtins/libm/src/math/erf.rs index 5d82228a05fd..6c78440afcf5 100644 --- a/library/compiler-builtins/libm/src/math/erf.rs +++ b/library/compiler-builtins/libm/src/math/erf.rs @@ -219,7 +219,7 @@ fn erfc2(ix: u32, mut x: f64) -> f64 { /// Calculates an approximation to the “error function”, which estimates /// the probability that an observation will fall within x standard /// deviations of the mean (assuming a normal distribution). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn erf(x: f64) -> f64 { let r: f64; let s: f64; diff --git a/library/compiler-builtins/libm/src/math/erff.rs b/library/compiler-builtins/libm/src/math/erff.rs index fe15f01082e4..2a7680275b9f 100644 --- a/library/compiler-builtins/libm/src/math/erff.rs +++ b/library/compiler-builtins/libm/src/math/erff.rs @@ -130,7 +130,7 @@ fn erfc2(mut ix: u32, mut x: f32) -> f32 { /// Calculates an approximation to the “error function”, which estimates /// the probability that an observation will fall within x standard /// deviations of the mean (assuming a normal distribution). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn erff(x: f32) -> f32 { let r: f32; let s: f32; diff --git a/library/compiler-builtins/libm/src/math/exp.rs b/library/compiler-builtins/libm/src/math/exp.rs index 782042b62cd3..78ce5dd134ac 100644 --- a/library/compiler-builtins/libm/src/math/exp.rs +++ b/library/compiler-builtins/libm/src/math/exp.rs @@ -81,7 +81,7 @@ const P5: f64 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ /// /// Calculate the exponential of `x`, that is, *e* raised to the power `x` /// (where *e* is the base of the natural system of logarithms, approximately 2.71828). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn exp(mut x: f64) -> f64 { let x1p1023 = f64::from_bits(0x7fe0000000000000); // 0x1p1023 === 2 ^ 1023 let x1p_149 = f64::from_bits(0x36a0000000000000); // 0x1p-149 === 2 ^ -149 diff --git a/library/compiler-builtins/libm/src/math/exp10.rs b/library/compiler-builtins/libm/src/math/exp10.rs index 7c33c92b6032..1f49f5e96979 100644 --- a/library/compiler-builtins/libm/src/math/exp10.rs +++ b/library/compiler-builtins/libm/src/math/exp10.rs @@ -7,7 +7,7 @@ const P10: &[f64] = &[ ]; /// Calculates 10 raised to the power of `x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn exp10(x: f64) -> f64 { let (mut y, n) = modf(x); let u: u64 = n.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/exp10f.rs b/library/compiler-builtins/libm/src/math/exp10f.rs index 303045b33132..22a264211d03 100644 --- a/library/compiler-builtins/libm/src/math/exp10f.rs +++ b/library/compiler-builtins/libm/src/math/exp10f.rs @@ -7,7 +7,7 @@ const P10: &[f32] = &[ ]; /// Calculates 10 raised to the power of `x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn exp10f(x: f32) -> f32 { let (mut y, n) = modff(x); let u = n.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/exp2.rs b/library/compiler-builtins/libm/src/math/exp2.rs index 6e98d066cbfc..6e4cbc29dcc9 100644 --- a/library/compiler-builtins/libm/src/math/exp2.rs +++ b/library/compiler-builtins/libm/src/math/exp2.rs @@ -322,7 +322,7 @@ static TBL: [u64; TBLSIZE * 2] = [ /// Exponential, base 2 (f64) /// /// Calculate `2^x`, that is, 2 raised to the power `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn exp2(mut x: f64) -> f64 { let redux = f64::from_bits(0x4338000000000000) / TBLSIZE as f64; let p1 = f64::from_bits(0x3fe62e42fefa39ef); diff --git a/library/compiler-builtins/libm/src/math/exp2f.rs b/library/compiler-builtins/libm/src/math/exp2f.rs index f452b6a20f80..733d2f1a8473 100644 --- a/library/compiler-builtins/libm/src/math/exp2f.rs +++ b/library/compiler-builtins/libm/src/math/exp2f.rs @@ -73,7 +73,7 @@ static EXP2FT: [u64; TBLSIZE] = [ /// Exponential, base 2 (f32) /// /// Calculate `2^x`, that is, 2 raised to the power `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn exp2f(mut x: f32) -> f32 { let redux = f32::from_bits(0x4b400000) / TBLSIZE as f32; let p1 = f32::from_bits(0x3f317218); diff --git a/library/compiler-builtins/libm/src/math/expf.rs b/library/compiler-builtins/libm/src/math/expf.rs index 8dc067ab0846..dbbfdbba9253 100644 --- a/library/compiler-builtins/libm/src/math/expf.rs +++ b/library/compiler-builtins/libm/src/math/expf.rs @@ -30,7 +30,7 @@ const P2: f32 = -2.7667332906e-3; /* -0xb55215.0p-32 */ /// /// Calculate the exponential of `x`, that is, *e* raised to the power `x` /// (where *e* is the base of the natural system of logarithms, approximately 2.71828). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn expf(mut x: f32) -> f32 { let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127 let x1p_126 = f32::from_bits(0x800000); // 0x1p-126f === 2 ^ -126 /*original 0x1p-149f ??????????? */ diff --git a/library/compiler-builtins/libm/src/math/expm1.rs b/library/compiler-builtins/libm/src/math/expm1.rs index f25153f32a34..3714bf3afc93 100644 --- a/library/compiler-builtins/libm/src/math/expm1.rs +++ b/library/compiler-builtins/libm/src/math/expm1.rs @@ -30,7 +30,7 @@ const Q5: f64 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ /// system of logarithms, approximately 2.71828). /// The result is accurate even for small values of `x`, /// where using `exp(x)-1` would lose many significant digits. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn expm1(mut x: f64) -> f64 { let hi: f64; let lo: f64; diff --git a/library/compiler-builtins/libm/src/math/expm1f.rs b/library/compiler-builtins/libm/src/math/expm1f.rs index 63dc86e37c8c..f77515a4b99b 100644 --- a/library/compiler-builtins/libm/src/math/expm1f.rs +++ b/library/compiler-builtins/libm/src/math/expm1f.rs @@ -32,7 +32,7 @@ const Q2: f32 = 1.5807170421e-3; /* 0xcf3010.0p-33 */ /// system of logarithms, approximately 2.71828). /// The result is accurate even for small values of `x`, /// where using `exp(x)-1` would lose many significant digits. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn expm1f(mut x: f32) -> f32 { let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127 diff --git a/library/compiler-builtins/libm/src/math/expo2.rs b/library/compiler-builtins/libm/src/math/expo2.rs index 82e9b360a764..ce90858ec070 100644 --- a/library/compiler-builtins/libm/src/math/expo2.rs +++ b/library/compiler-builtins/libm/src/math/expo2.rs @@ -1,7 +1,7 @@ use super::{combine_words, exp}; /* exp(x)/2 for x >= log(DBL_MAX), slightly better than 0.5*exp(x/2)*exp(x/2) */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn expo2(x: f64) -> f64 { /* k is such that k*ln2 has minimal relative error and x - kln2 > log(DBL_MIN) */ const K: i32 = 2043; diff --git a/library/compiler-builtins/libm/src/math/fabs.rs b/library/compiler-builtins/libm/src/math/fabs.rs index 0050a309fee5..7344e21a18bd 100644 --- a/library/compiler-builtins/libm/src/math/fabs.rs +++ b/library/compiler-builtins/libm/src/math/fabs.rs @@ -3,7 +3,7 @@ /// Calculates the absolute value (magnitude) of the argument `x`, /// by direct manipulation of the bit representation of `x`. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fabsf16(x: f16) -> f16 { super::generic::fabs(x) } @@ -12,7 +12,7 @@ pub fn fabsf16(x: f16) -> f16 { /// /// Calculates the absolute value (magnitude) of the argument `x`, /// by direct manipulation of the bit representation of `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fabsf(x: f32) -> f32 { select_implementation! { name: fabsf, @@ -27,7 +27,7 @@ pub fn fabsf(x: f32) -> f32 { /// /// Calculates the absolute value (magnitude) of the argument `x`, /// by direct manipulation of the bit representation of `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fabs(x: f64) -> f64 { select_implementation! { name: fabs, @@ -43,7 +43,7 @@ pub fn fabs(x: f64) -> f64 { /// Calculates the absolute value (magnitude) of the argument `x`, /// by direct manipulation of the bit representation of `x`. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fabsf128(x: f128) -> f128 { super::generic::fabs(x) } diff --git a/library/compiler-builtins/libm/src/math/fdim.rs b/library/compiler-builtins/libm/src/math/fdim.rs index 082c5478b2aa..dac409e86b13 100644 --- a/library/compiler-builtins/libm/src/math/fdim.rs +++ b/library/compiler-builtins/libm/src/math/fdim.rs @@ -7,7 +7,7 @@ /// /// A range error may occur. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fdimf16(x: f16, y: f16) -> f16 { super::generic::fdim(x, y) } @@ -20,7 +20,7 @@ pub fn fdimf16(x: f16, y: f16) -> f16 { /// * NAN if either argument is NAN. /// /// A range error may occur. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fdimf(x: f32, y: f32) -> f32 { super::generic::fdim(x, y) } @@ -33,7 +33,7 @@ pub fn fdimf(x: f32, y: f32) -> f32 { /// * NAN if either argument is NAN. /// /// A range error may occur. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fdim(x: f64, y: f64) -> f64 { super::generic::fdim(x, y) } @@ -47,7 +47,7 @@ pub fn fdim(x: f64, y: f64) -> f64 { /// /// A range error may occur. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fdimf128(x: f128, y: f128) -> f128 { super::generic::fdim(x, y) } diff --git a/library/compiler-builtins/libm/src/math/floor.rs b/library/compiler-builtins/libm/src/math/floor.rs index 3c5eab101d18..7241c427f646 100644 --- a/library/compiler-builtins/libm/src/math/floor.rs +++ b/library/compiler-builtins/libm/src/math/floor.rs @@ -2,7 +2,7 @@ /// /// Finds the nearest integer less than or equal to `x`. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn floorf16(x: f16) -> f16 { return super::generic::floor(x); } @@ -10,7 +10,7 @@ pub fn floorf16(x: f16) -> f16 { /// Floor (f64) /// /// Finds the nearest integer less than or equal to `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn floor(x: f64) -> f64 { select_implementation! { name: floor, @@ -25,7 +25,7 @@ pub fn floor(x: f64) -> f64 { /// Floor (f32) /// /// Finds the nearest integer less than or equal to `x`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn floorf(x: f32) -> f32 { select_implementation! { name: floorf, @@ -40,7 +40,7 @@ pub fn floorf(x: f32) -> f32 { /// /// Finds the nearest integer less than or equal to `x`. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn floorf128(x: f128) -> f128 { return super::generic::floor(x); } diff --git a/library/compiler-builtins/libm/src/math/fma.rs b/library/compiler-builtins/libm/src/math/fma.rs index 5bf473cfe063..70e6de768fab 100644 --- a/library/compiler-builtins/libm/src/math/fma.rs +++ b/library/compiler-builtins/libm/src/math/fma.rs @@ -7,7 +7,7 @@ use crate::support::Round; // Placeholder so we can have `fmaf16` in the `Float` trait. #[allow(unused)] #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn fmaf16(_x: f16, _y: f16, _z: f16) -> f16 { unimplemented!() } @@ -15,7 +15,7 @@ pub(crate) fn fmaf16(_x: f16, _y: f16, _z: f16) -> f16 { /// Floating multiply add (f32) /// /// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaf(x: f32, y: f32, z: f32) -> f32 { select_implementation! { name: fmaf, @@ -32,7 +32,7 @@ pub fn fmaf(x: f32, y: f32, z: f32) -> f32 { /// Fused multiply add (f64) /// /// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fma(x: f64, y: f64, z: f64) -> f64 { select_implementation! { name: fma, @@ -50,7 +50,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 { /// /// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision). #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaf128(x: f128, y: f128, z: f128) -> f128 { generic::fma_round(x, y, z, Round::Nearest).val } diff --git a/library/compiler-builtins/libm/src/math/fmin_fmax.rs b/library/compiler-builtins/libm/src/math/fmin_fmax.rs index 481301994e99..c4c1b0435dd2 100644 --- a/library/compiler-builtins/libm/src/math/fmin_fmax.rs +++ b/library/compiler-builtins/libm/src/math/fmin_fmax.rs @@ -3,7 +3,7 @@ /// This coincides with IEEE 754-2011 `minNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminf16(x: f16, y: f16) -> f16 { super::generic::fmin(x, y) } @@ -12,7 +12,7 @@ pub fn fminf16(x: f16, y: f16) -> f16 { /// /// This coincides with IEEE 754-2011 `minNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminf(x: f32, y: f32) -> f32 { super::generic::fmin(x, y) } @@ -21,7 +21,7 @@ pub fn fminf(x: f32, y: f32) -> f32 { /// /// This coincides with IEEE 754-2011 `minNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmin(x: f64, y: f64) -> f64 { super::generic::fmin(x, y) } @@ -31,7 +31,7 @@ pub fn fmin(x: f64, y: f64) -> f64 { /// This coincides with IEEE 754-2011 `minNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminf128(x: f128, y: f128) -> f128 { super::generic::fmin(x, y) } @@ -41,7 +41,7 @@ pub fn fminf128(x: f128, y: f128) -> f128 { /// This coincides with IEEE 754-2011 `maxNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaxf16(x: f16, y: f16) -> f16 { super::generic::fmax(x, y) } @@ -50,7 +50,7 @@ pub fn fmaxf16(x: f16, y: f16) -> f16 { /// /// This coincides with IEEE 754-2011 `maxNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaxf(x: f32, y: f32) -> f32 { super::generic::fmax(x, y) } @@ -59,7 +59,7 @@ pub fn fmaxf(x: f32, y: f32) -> f32 { /// /// This coincides with IEEE 754-2011 `maxNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmax(x: f64, y: f64) -> f64 { super::generic::fmax(x, y) } @@ -69,7 +69,7 @@ pub fn fmax(x: f64, y: f64) -> f64 { /// This coincides with IEEE 754-2011 `maxNum`. The result disregards signed zero (meaning if /// the inputs are -0.0 and +0.0, either may be returned). #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaxf128(x: f128, y: f128) -> f128 { super::generic::fmax(x, y) } diff --git a/library/compiler-builtins/libm/src/math/fminimum_fmaximum.rs b/library/compiler-builtins/libm/src/math/fminimum_fmaximum.rs index 8f1308670511..a3c9c9c3991b 100644 --- a/library/compiler-builtins/libm/src/math/fminimum_fmaximum.rs +++ b/library/compiler-builtins/libm/src/math/fminimum_fmaximum.rs @@ -2,7 +2,7 @@ /// /// This coincides with IEEE 754-2019 `minimum`. The result orders -0.0 < 0.0. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimumf16(x: f16, y: f16) -> f16 { super::generic::fminimum(x, y) } @@ -10,7 +10,7 @@ pub fn fminimumf16(x: f16, y: f16) -> f16 { /// Return the lesser of two arguments or, if either argument is NaN, the other argument. /// /// This coincides with IEEE 754-2019 `minimum`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimum(x: f64, y: f64) -> f64 { super::generic::fminimum(x, y) } @@ -18,7 +18,7 @@ pub fn fminimum(x: f64, y: f64) -> f64 { /// Return the lesser of two arguments or, if either argument is NaN, the other argument. /// /// This coincides with IEEE 754-2019 `minimum`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimumf(x: f32, y: f32) -> f32 { super::generic::fminimum(x, y) } @@ -27,7 +27,7 @@ pub fn fminimumf(x: f32, y: f32) -> f32 { /// /// This coincides with IEEE 754-2019 `minimum`. The result orders -0.0 < 0.0. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimumf128(x: f128, y: f128) -> f128 { super::generic::fminimum(x, y) } @@ -36,7 +36,7 @@ pub fn fminimumf128(x: f128, y: f128) -> f128 { /// /// This coincides with IEEE 754-2019 `maximum`. The result orders -0.0 < 0.0. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximumf16(x: f16, y: f16) -> f16 { super::generic::fmaximum(x, y) } @@ -44,7 +44,7 @@ pub fn fmaximumf16(x: f16, y: f16) -> f16 { /// Return the greater of two arguments or, if either argument is NaN, the other argument. /// /// This coincides with IEEE 754-2019 `maximum`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximumf(x: f32, y: f32) -> f32 { super::generic::fmaximum(x, y) } @@ -52,7 +52,7 @@ pub fn fmaximumf(x: f32, y: f32) -> f32 { /// Return the greater of two arguments or, if either argument is NaN, the other argument. /// /// This coincides with IEEE 754-2019 `maximum`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximum(x: f64, y: f64) -> f64 { super::generic::fmaximum(x, y) } @@ -61,7 +61,7 @@ pub fn fmaximum(x: f64, y: f64) -> f64 { /// /// This coincides with IEEE 754-2019 `maximum`. The result orders -0.0 < 0.0. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximumf128(x: f128, y: f128) -> f128 { super::generic::fmaximum(x, y) } diff --git a/library/compiler-builtins/libm/src/math/fminimum_fmaximum_num.rs b/library/compiler-builtins/libm/src/math/fminimum_fmaximum_num.rs index fadf934180a0..612cefe756e3 100644 --- a/library/compiler-builtins/libm/src/math/fminimum_fmaximum_num.rs +++ b/library/compiler-builtins/libm/src/math/fminimum_fmaximum_num.rs @@ -2,7 +2,7 @@ /// /// This coincides with IEEE 754-2019 `minimumNumber`. The result orders -0.0 < 0.0. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimum_numf16(x: f16, y: f16) -> f16 { super::generic::fminimum_num(x, y) } @@ -10,7 +10,7 @@ pub fn fminimum_numf16(x: f16, y: f16) -> f16 { /// Return the lesser of two arguments or, if either argument is NaN, NaN. /// /// This coincides with IEEE 754-2019 `minimumNumber`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimum_numf(x: f32, y: f32) -> f32 { super::generic::fminimum_num(x, y) } @@ -18,7 +18,7 @@ pub fn fminimum_numf(x: f32, y: f32) -> f32 { /// Return the lesser of two arguments or, if either argument is NaN, NaN. /// /// This coincides with IEEE 754-2019 `minimumNumber`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimum_num(x: f64, y: f64) -> f64 { super::generic::fminimum_num(x, y) } @@ -27,7 +27,7 @@ pub fn fminimum_num(x: f64, y: f64) -> f64 { /// /// This coincides with IEEE 754-2019 `minimumNumber`. The result orders -0.0 < 0.0. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fminimum_numf128(x: f128, y: f128) -> f128 { super::generic::fminimum_num(x, y) } @@ -36,7 +36,7 @@ pub fn fminimum_numf128(x: f128, y: f128) -> f128 { /// /// This coincides with IEEE 754-2019 `maximumNumber`. The result orders -0.0 < 0.0. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximum_numf16(x: f16, y: f16) -> f16 { super::generic::fmaximum_num(x, y) } @@ -44,7 +44,7 @@ pub fn fmaximum_numf16(x: f16, y: f16) -> f16 { /// Return the greater of two arguments or, if either argument is NaN, NaN. /// /// This coincides with IEEE 754-2019 `maximumNumber`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximum_numf(x: f32, y: f32) -> f32 { super::generic::fmaximum_num(x, y) } @@ -52,7 +52,7 @@ pub fn fmaximum_numf(x: f32, y: f32) -> f32 { /// Return the greater of two arguments or, if either argument is NaN, NaN. /// /// This coincides with IEEE 754-2019 `maximumNumber`. The result orders -0.0 < 0.0. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximum_num(x: f64, y: f64) -> f64 { super::generic::fmaximum_num(x, y) } @@ -61,7 +61,7 @@ pub fn fmaximum_num(x: f64, y: f64) -> f64 { /// /// This coincides with IEEE 754-2019 `maximumNumber`. The result orders -0.0 < 0.0. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmaximum_numf128(x: f128, y: f128) -> f128 { super::generic::fmaximum_num(x, y) } diff --git a/library/compiler-builtins/libm/src/math/fmod.rs b/library/compiler-builtins/libm/src/math/fmod.rs index c4752b92578f..6ae1be560835 100644 --- a/library/compiler-builtins/libm/src/math/fmod.rs +++ b/library/compiler-builtins/libm/src/math/fmod.rs @@ -1,25 +1,25 @@ /// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmodf16(x: f16, y: f16) -> f16 { super::generic::fmod(x, y) } /// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmodf(x: f32, y: f32) -> f32 { super::generic::fmod(x, y) } /// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmod(x: f64, y: f64) -> f64 { super::generic::fmod(x, y) } /// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn fmodf128(x: f128, y: f128) -> f128 { super::generic::fmod(x, y) } diff --git a/library/compiler-builtins/libm/src/math/frexp.rs b/library/compiler-builtins/libm/src/math/frexp.rs index de7a64fdae1a..932111eebc95 100644 --- a/library/compiler-builtins/libm/src/math/frexp.rs +++ b/library/compiler-builtins/libm/src/math/frexp.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn frexp(x: f64) -> (f64, i32) { let mut y = x.to_bits(); let ee = ((y >> 52) & 0x7ff) as i32; diff --git a/library/compiler-builtins/libm/src/math/frexpf.rs b/library/compiler-builtins/libm/src/math/frexpf.rs index 0ec91c2d3507..904bf14f7b8e 100644 --- a/library/compiler-builtins/libm/src/math/frexpf.rs +++ b/library/compiler-builtins/libm/src/math/frexpf.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn frexpf(x: f32) -> (f32, i32) { let mut y = x.to_bits(); let ee: i32 = ((y >> 23) & 0xff) as i32; diff --git a/library/compiler-builtins/libm/src/math/hypot.rs b/library/compiler-builtins/libm/src/math/hypot.rs index da458ea1d05f..b92ee18ca110 100644 --- a/library/compiler-builtins/libm/src/math/hypot.rs +++ b/library/compiler-builtins/libm/src/math/hypot.rs @@ -17,7 +17,7 @@ fn sq(x: f64) -> (f64, f64) { (hi, lo) } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn hypot(mut x: f64, mut y: f64) -> f64 { let x1p700 = f64::from_bits(0x6bb0000000000000); // 0x1p700 === 2 ^ 700 let x1p_700 = f64::from_bits(0x1430000000000000); // 0x1p-700 === 2 ^ -700 diff --git a/library/compiler-builtins/libm/src/math/hypotf.rs b/library/compiler-builtins/libm/src/math/hypotf.rs index 576eebb33431..e7635ffc9a0b 100644 --- a/library/compiler-builtins/libm/src/math/hypotf.rs +++ b/library/compiler-builtins/libm/src/math/hypotf.rs @@ -2,7 +2,7 @@ use core::f32; use super::sqrtf; -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn hypotf(mut x: f32, mut y: f32) -> f32 { let x1p90 = f32::from_bits(0x6c800000); // 0x1p90f === 2 ^ 90 let x1p_90 = f32::from_bits(0x12800000); // 0x1p-90f === 2 ^ -90 diff --git a/library/compiler-builtins/libm/src/math/ilogb.rs b/library/compiler-builtins/libm/src/math/ilogb.rs index 5b41f7b1dc0b..ef774f6ad3a6 100644 --- a/library/compiler-builtins/libm/src/math/ilogb.rs +++ b/library/compiler-builtins/libm/src/math/ilogb.rs @@ -1,7 +1,7 @@ const FP_ILOGBNAN: i32 = -1 - 0x7fffffff; const FP_ILOGB0: i32 = FP_ILOGBNAN; -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ilogb(x: f64) -> i32 { let mut i: u64 = x.to_bits(); let e = ((i >> 52) & 0x7ff) as i32; diff --git a/library/compiler-builtins/libm/src/math/ilogbf.rs b/library/compiler-builtins/libm/src/math/ilogbf.rs index 3585d6d36f16..5b0cb46ec558 100644 --- a/library/compiler-builtins/libm/src/math/ilogbf.rs +++ b/library/compiler-builtins/libm/src/math/ilogbf.rs @@ -1,7 +1,7 @@ const FP_ILOGBNAN: i32 = -1 - 0x7fffffff; const FP_ILOGB0: i32 = FP_ILOGBNAN; -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ilogbf(x: f32) -> i32 { let mut i = x.to_bits(); let e = ((i >> 23) & 0xff) as i32; diff --git a/library/compiler-builtins/libm/src/math/j0.rs b/library/compiler-builtins/libm/src/math/j0.rs index 99d656f0d08a..7b0800477b3c 100644 --- a/library/compiler-builtins/libm/src/math/j0.rs +++ b/library/compiler-builtins/libm/src/math/j0.rs @@ -110,7 +110,7 @@ const S03: f64 = 5.13546550207318111446e-07; /* 0x3EA13B54, 0xCE84D5A9 */ const S04: f64 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */ /// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn j0(mut x: f64) -> f64 { let z: f64; let r: f64; @@ -165,7 +165,7 @@ const V03: f64 = 2.59150851840457805467e-07; /* 0x3E91642D, 0x7FF202FD */ const V04: f64 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ /// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn y0(x: f64) -> f64 { let z: f64; let u: f64; diff --git a/library/compiler-builtins/libm/src/math/j0f.rs b/library/compiler-builtins/libm/src/math/j0f.rs index 25e5b325c8cc..1c6a7c344623 100644 --- a/library/compiler-builtins/libm/src/math/j0f.rs +++ b/library/compiler-builtins/libm/src/math/j0f.rs @@ -63,7 +63,7 @@ const S03: f32 = 5.1354652442e-07; /* 0x3509daa6 */ const S04: f32 = 1.1661400734e-09; /* 0x30a045e8 */ /// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn j0f(mut x: f32) -> f32 { let z: f32; let r: f32; @@ -110,7 +110,7 @@ const V03: f32 = 2.5915085189e-07; /* 0x348b216c */ const V04: f32 = 4.4111031494e-10; /* 0x2ff280c2 */ /// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn y0f(x: f32) -> f32 { let z: f32; let u: f32; diff --git a/library/compiler-builtins/libm/src/math/j1.rs b/library/compiler-builtins/libm/src/math/j1.rs index 9b604d9e46e0..7d304ba10b7b 100644 --- a/library/compiler-builtins/libm/src/math/j1.rs +++ b/library/compiler-builtins/libm/src/math/j1.rs @@ -114,7 +114,7 @@ const S04: f64 = 5.04636257076217042715e-09; /* 0x3E35AC88, 0xC97DFF2C */ const S05: f64 = 1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */ /// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn j1(x: f64) -> f64 { let mut z: f64; let r: f64; @@ -161,7 +161,7 @@ const V0: [f64; 5] = [ ]; /// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn y1(x: f64) -> f64 { let z: f64; let u: f64; diff --git a/library/compiler-builtins/libm/src/math/j1f.rs b/library/compiler-builtins/libm/src/math/j1f.rs index a47472401ee2..cd829c1aa121 100644 --- a/library/compiler-builtins/libm/src/math/j1f.rs +++ b/library/compiler-builtins/libm/src/math/j1f.rs @@ -64,7 +64,7 @@ const S04: f32 = 5.0463624390e-09; /* 0x31ad6446 */ const S05: f32 = 1.2354227016e-11; /* 0x2d59567e */ /// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn j1f(x: f32) -> f32 { let mut z: f32; let r: f32; @@ -110,7 +110,7 @@ const V0: [f32; 5] = [ ]; /// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn y1f(x: f32) -> f32 { let z: f32; let u: f32; @@ -361,8 +361,6 @@ fn qonef(x: f32) -> f32 { return (0.375 + r / s) / x; } -// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520 -#[cfg(not(target_arch = "powerpc64"))] #[cfg(test)] mod tests { use super::{j1f, y1f}; @@ -371,6 +369,7 @@ mod tests { // 0x401F3E49 assert_eq!(j1f(2.4881766_f32), 0.49999475_f32); } + #[test] fn test_y1f_2002() { //allow slightly different result on x87 diff --git a/library/compiler-builtins/libm/src/math/jn.rs b/library/compiler-builtins/libm/src/math/jn.rs index 31f8d9c53829..b87aeaf1cc3d 100644 --- a/library/compiler-builtins/libm/src/math/jn.rs +++ b/library/compiler-builtins/libm/src/math/jn.rs @@ -39,7 +39,7 @@ use super::{cos, fabs, get_high_word, get_low_word, j0, j1, log, sin, sqrt, y0, const INVSQRTPI: f64 = 5.64189583547756279280e-01; /* 0x3FE20DD7, 0x50429B6D */ /// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn jn(n: i32, mut x: f64) -> f64 { let mut ix: u32; let lx: u32; @@ -249,7 +249,7 @@ pub fn jn(n: i32, mut x: f64) -> f64 { } /// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn yn(n: i32, x: f64) -> f64 { let mut ix: u32; let lx: u32; diff --git a/library/compiler-builtins/libm/src/math/jnf.rs b/library/compiler-builtins/libm/src/math/jnf.rs index 52cf7d8a8bda..34fdc5112dce 100644 --- a/library/compiler-builtins/libm/src/math/jnf.rs +++ b/library/compiler-builtins/libm/src/math/jnf.rs @@ -16,7 +16,7 @@ use super::{fabsf, j0f, j1f, logf, y0f, y1f}; /// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn jnf(n: i32, mut x: f32) -> f32 { let mut ix: u32; let mut nm1: i32; @@ -192,7 +192,7 @@ pub fn jnf(n: i32, mut x: f32) -> f32 { } /// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ynf(n: i32, x: f32) -> f32 { let mut ix: u32; let mut ib: u32; diff --git a/library/compiler-builtins/libm/src/math/k_cos.rs b/library/compiler-builtins/libm/src/math/k_cos.rs index 49b2fc64d864..1a2ebabe3343 100644 --- a/library/compiler-builtins/libm/src/math/k_cos.rs +++ b/library/compiler-builtins/libm/src/math/k_cos.rs @@ -51,7 +51,7 @@ const C6: f64 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ // expression for cos(). Retention happens in all cases tested // under FreeBSD, so don't pessimize things by forcibly clipping // any extra precision in w. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_cos(x: f64, y: f64) -> f64 { let z = x * x; let w = z * z; diff --git a/library/compiler-builtins/libm/src/math/k_cosf.rs b/library/compiler-builtins/libm/src/math/k_cosf.rs index e99f2348c00d..68f568c24257 100644 --- a/library/compiler-builtins/libm/src/math/k_cosf.rs +++ b/library/compiler-builtins/libm/src/math/k_cosf.rs @@ -20,7 +20,7 @@ const C1: f64 = 0.0416666233237390631894; /* 0x155553e1053a42.0p-57 */ const C2: f64 = -0.00138867637746099294692; /* -0x16c087e80f1e27.0p-62 */ const C3: f64 = 0.0000243904487962774090654; /* 0x199342e0ee5069.0p-68 */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_cosf(x: f64) -> f32 { let z = x * x; let w = z * z; diff --git a/library/compiler-builtins/libm/src/math/k_expo2.rs b/library/compiler-builtins/libm/src/math/k_expo2.rs index 7345075f3768..7b63952d255f 100644 --- a/library/compiler-builtins/libm/src/math/k_expo2.rs +++ b/library/compiler-builtins/libm/src/math/k_expo2.rs @@ -4,7 +4,7 @@ use super::exp; const K: i32 = 2043; /* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_expo2(x: f64) -> f64 { let k_ln2 = f64::from_bits(0x40962066151add8b); /* note that k is odd and scale*scale overflows */ diff --git a/library/compiler-builtins/libm/src/math/k_expo2f.rs b/library/compiler-builtins/libm/src/math/k_expo2f.rs index fbd7b27d5832..02213cec4549 100644 --- a/library/compiler-builtins/libm/src/math/k_expo2f.rs +++ b/library/compiler-builtins/libm/src/math/k_expo2f.rs @@ -4,7 +4,7 @@ use super::expf; const K: i32 = 235; /* expf(x)/2 for x >= log(FLT_MAX), slightly better than 0.5f*expf(x/2)*expf(x/2) */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_expo2f(x: f32) -> f32 { let k_ln2 = f32::from_bits(0x4322e3bc); /* note that k is odd and scale*scale overflows */ diff --git a/library/compiler-builtins/libm/src/math/k_sin.rs b/library/compiler-builtins/libm/src/math/k_sin.rs index 9dd96c944744..2f8542945136 100644 --- a/library/compiler-builtins/libm/src/math/k_sin.rs +++ b/library/compiler-builtins/libm/src/math/k_sin.rs @@ -43,7 +43,7 @@ const S6: f64 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ // r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) // then 3 2 // sin(x) = x + (S1*x + (x *(r-y/2)+y)) -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_sin(x: f64, y: f64, iy: i32) -> f64 { let z = x * x; let w = z * z; diff --git a/library/compiler-builtins/libm/src/math/k_sinf.rs b/library/compiler-builtins/libm/src/math/k_sinf.rs index 88d10cababc5..297d88bbbbe1 100644 --- a/library/compiler-builtins/libm/src/math/k_sinf.rs +++ b/library/compiler-builtins/libm/src/math/k_sinf.rs @@ -20,7 +20,7 @@ const S2: f64 = 0.0083333293858894631756; /* 0x111110896efbb2.0p-59 */ const S3: f64 = -0.000198393348360966317347; /* -0x1a00f9e2cae774.0p-65 */ const S4: f64 = 0.0000027183114939898219064; /* 0x16cd878c3b46a7.0p-71 */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_sinf(x: f64) -> f32 { let z = x * x; let w = z * z; diff --git a/library/compiler-builtins/libm/src/math/k_tan.rs b/library/compiler-builtins/libm/src/math/k_tan.rs index d177010bb0a0..ac48d661fd62 100644 --- a/library/compiler-builtins/libm/src/math/k_tan.rs +++ b/library/compiler-builtins/libm/src/math/k_tan.rs @@ -58,7 +58,7 @@ static T: [f64; 13] = [ const PIO4: f64 = 7.85398163397448278999e-01; /* 3FE921FB, 54442D18 */ const PIO4_LO: f64 = 3.06161699786838301793e-17; /* 3C81A626, 33145C07 */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_tan(mut x: f64, mut y: f64, odd: i32) -> f64 { let hx = (f64::to_bits(x) >> 32) as u32; let big = (hx & 0x7fffffff) >= 0x3FE59428; /* |x| >= 0.6744 */ diff --git a/library/compiler-builtins/libm/src/math/k_tanf.rs b/library/compiler-builtins/libm/src/math/k_tanf.rs index af8db539dad4..79382f57bf68 100644 --- a/library/compiler-builtins/libm/src/math/k_tanf.rs +++ b/library/compiler-builtins/libm/src/math/k_tanf.rs @@ -19,7 +19,7 @@ const T: [f64; 6] = [ 0.00946564784943673166728, /* 0x1362b9bf971bcd.0p-59 */ ]; -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn k_tanf(x: f64, odd: bool) -> f32 { let z = x * x; /* diff --git a/library/compiler-builtins/libm/src/math/ldexp.rs b/library/compiler-builtins/libm/src/math/ldexp.rs index 24899ba306af..b32b8d5241b1 100644 --- a/library/compiler-builtins/libm/src/math/ldexp.rs +++ b/library/compiler-builtins/libm/src/math/ldexp.rs @@ -1,21 +1,21 @@ #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ldexpf16(x: f16, n: i32) -> f16 { super::scalbnf16(x, n) } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ldexpf(x: f32, n: i32) -> f32 { super::scalbnf(x, n) } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ldexp(x: f64, n: i32) -> f64 { super::scalbn(x, n) } #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn ldexpf128(x: f128, n: i32) -> f128 { super::scalbnf128(x, n) } diff --git a/library/compiler-builtins/libm/src/math/lgamma.rs b/library/compiler-builtins/libm/src/math/lgamma.rs index 8312dc18648e..da7ce5c983b9 100644 --- a/library/compiler-builtins/libm/src/math/lgamma.rs +++ b/library/compiler-builtins/libm/src/math/lgamma.rs @@ -2,7 +2,7 @@ use super::lgamma_r; /// The natural logarithm of the /// [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn lgamma(x: f64) -> f64 { lgamma_r(x).0 } diff --git a/library/compiler-builtins/libm/src/math/lgamma_r.rs b/library/compiler-builtins/libm/src/math/lgamma_r.rs index 6becaad2ce91..38eb270f6839 100644 --- a/library/compiler-builtins/libm/src/math/lgamma_r.rs +++ b/library/compiler-builtins/libm/src/math/lgamma_r.rs @@ -165,7 +165,7 @@ fn sin_pi(mut x: f64) -> f64 { } } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn lgamma_r(mut x: f64) -> (f64, i32) { let u: u64 = x.to_bits(); let mut t: f64; diff --git a/library/compiler-builtins/libm/src/math/lgammaf.rs b/library/compiler-builtins/libm/src/math/lgammaf.rs index d37512397cb3..920acfed2a05 100644 --- a/library/compiler-builtins/libm/src/math/lgammaf.rs +++ b/library/compiler-builtins/libm/src/math/lgammaf.rs @@ -2,7 +2,7 @@ use super::lgammaf_r; /// The natural logarithm of the /// [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn lgammaf(x: f32) -> f32 { lgammaf_r(x).0 } diff --git a/library/compiler-builtins/libm/src/math/lgammaf_r.rs b/library/compiler-builtins/libm/src/math/lgammaf_r.rs index 10cecee541cc..a0b6a678a670 100644 --- a/library/compiler-builtins/libm/src/math/lgammaf_r.rs +++ b/library/compiler-builtins/libm/src/math/lgammaf_r.rs @@ -100,7 +100,7 @@ fn sin_pi(mut x: f32) -> f32 { } } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn lgammaf_r(mut x: f32) -> (f32, i32) { let u = x.to_bits(); let mut t: f32; diff --git a/library/compiler-builtins/libm/src/math/log.rs b/library/compiler-builtins/libm/src/math/log.rs index f2dc47ec5ccf..9499c56d8ade 100644 --- a/library/compiler-builtins/libm/src/math/log.rs +++ b/library/compiler-builtins/libm/src/math/log.rs @@ -71,7 +71,7 @@ const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */ const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ /// The natural logarithm of `x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log(mut x: f64) -> f64 { let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54 diff --git a/library/compiler-builtins/libm/src/math/log10.rs b/library/compiler-builtins/libm/src/math/log10.rs index 8c9d68c492db..29f25d944af9 100644 --- a/library/compiler-builtins/libm/src/math/log10.rs +++ b/library/compiler-builtins/libm/src/math/log10.rs @@ -32,7 +32,7 @@ const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */ const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ /// The base 10 logarithm of `x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log10(mut x: f64) -> f64 { let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54 diff --git a/library/compiler-builtins/libm/src/math/log10f.rs b/library/compiler-builtins/libm/src/math/log10f.rs index 18bf8fcc8320..f89584bf9c99 100644 --- a/library/compiler-builtins/libm/src/math/log10f.rs +++ b/library/compiler-builtins/libm/src/math/log10f.rs @@ -26,7 +26,7 @@ const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */ const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */ /// The base 10 logarithm of `x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log10f(mut x: f32) -> f32 { let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25 diff --git a/library/compiler-builtins/libm/src/math/log1p.rs b/library/compiler-builtins/libm/src/math/log1p.rs index 65142c0d622c..c991cce60df0 100644 --- a/library/compiler-builtins/libm/src/math/log1p.rs +++ b/library/compiler-builtins/libm/src/math/log1p.rs @@ -66,7 +66,7 @@ const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */ const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ /// The natural logarithm of 1+`x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log1p(x: f64) -> f64 { let mut ui: u64 = x.to_bits(); let hfsq: f64; diff --git a/library/compiler-builtins/libm/src/math/log1pf.rs b/library/compiler-builtins/libm/src/math/log1pf.rs index 23978e61c3c4..89a92fac98ee 100644 --- a/library/compiler-builtins/libm/src/math/log1pf.rs +++ b/library/compiler-builtins/libm/src/math/log1pf.rs @@ -21,7 +21,7 @@ const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */ const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */ /// The natural logarithm of 1+`x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log1pf(x: f32) -> f32 { let mut ui: u32 = x.to_bits(); let hfsq: f32; diff --git a/library/compiler-builtins/libm/src/math/log2.rs b/library/compiler-builtins/libm/src/math/log2.rs index 701f63c25e72..9b750c9a2a6c 100644 --- a/library/compiler-builtins/libm/src/math/log2.rs +++ b/library/compiler-builtins/libm/src/math/log2.rs @@ -30,7 +30,7 @@ const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */ const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ /// The base 2 logarithm of `x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log2(mut x: f64) -> f64 { let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54 diff --git a/library/compiler-builtins/libm/src/math/log2f.rs b/library/compiler-builtins/libm/src/math/log2f.rs index 5ba2427d1d46..0e5177d7afa8 100644 --- a/library/compiler-builtins/libm/src/math/log2f.rs +++ b/library/compiler-builtins/libm/src/math/log2f.rs @@ -24,7 +24,7 @@ const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */ const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */ /// The base 2 logarithm of `x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn log2f(mut x: f32) -> f32 { let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25 diff --git a/library/compiler-builtins/libm/src/math/logf.rs b/library/compiler-builtins/libm/src/math/logf.rs index 68d1943025e3..cd7a7b0ba00d 100644 --- a/library/compiler-builtins/libm/src/math/logf.rs +++ b/library/compiler-builtins/libm/src/math/logf.rs @@ -22,7 +22,7 @@ const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */ const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */ /// The natural logarithm of `x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn logf(mut x: f32) -> f32 { let x1p25 = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25 diff --git a/library/compiler-builtins/libm/src/math/mod.rs b/library/compiler-builtins/libm/src/math/mod.rs index ce9b8fc58bbd..8eecfe5667d1 100644 --- a/library/compiler-builtins/libm/src/math/mod.rs +++ b/library/compiler-builtins/libm/src/math/mod.rs @@ -1,3 +1,5 @@ +#![allow(clippy::approx_constant)] // many false positives + macro_rules! force_eval { ($e:expr) => { unsafe { ::core::ptr::read_volatile(&$e) } diff --git a/library/compiler-builtins/libm/src/math/modf.rs b/library/compiler-builtins/libm/src/math/modf.rs index 6541862cdd98..a92a83dc5d10 100644 --- a/library/compiler-builtins/libm/src/math/modf.rs +++ b/library/compiler-builtins/libm/src/math/modf.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn modf(x: f64) -> (f64, f64) { let rv2: f64; let mut u = x.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/modff.rs b/library/compiler-builtins/libm/src/math/modff.rs index 90c6bca7d8da..691f351ca8d7 100644 --- a/library/compiler-builtins/libm/src/math/modff.rs +++ b/library/compiler-builtins/libm/src/math/modff.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn modff(x: f32) -> (f32, f32) { let rv2: f32; let mut u: u32 = x.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/nextafter.rs b/library/compiler-builtins/libm/src/math/nextafter.rs index c991ff6f2330..f4408468cc92 100644 --- a/library/compiler-builtins/libm/src/math/nextafter.rs +++ b/library/compiler-builtins/libm/src/math/nextafter.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn nextafter(x: f64, y: f64) -> f64 { if x.is_nan() || y.is_nan() { return x + y; diff --git a/library/compiler-builtins/libm/src/math/nextafterf.rs b/library/compiler-builtins/libm/src/math/nextafterf.rs index 8ba3833562fb..c15eb9de2818 100644 --- a/library/compiler-builtins/libm/src/math/nextafterf.rs +++ b/library/compiler-builtins/libm/src/math/nextafterf.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn nextafterf(x: f32, y: f32) -> f32 { if x.is_nan() || y.is_nan() { return x + y; diff --git a/library/compiler-builtins/libm/src/math/pow.rs b/library/compiler-builtins/libm/src/math/pow.rs index 94ae31cf0dab..914d68cfce1a 100644 --- a/library/compiler-builtins/libm/src/math/pow.rs +++ b/library/compiler-builtins/libm/src/math/pow.rs @@ -90,7 +90,7 @@ const IVLN2_H: f64 = 1.44269502162933349609e+00; /* 0x3ff71547_60000000 =24b 1/l const IVLN2_L: f64 = 1.92596299112661746887e-08; /* 0x3e54ae0b_f85ddf44 =1/ln2 tail*/ /// Returns `x` to the power of `y` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn pow(x: f64, y: f64) -> f64 { let t1: f64; let t2: f64; diff --git a/library/compiler-builtins/libm/src/math/powf.rs b/library/compiler-builtins/libm/src/math/powf.rs index 11c7a7cbd94d..17772ae872d3 100644 --- a/library/compiler-builtins/libm/src/math/powf.rs +++ b/library/compiler-builtins/libm/src/math/powf.rs @@ -46,7 +46,7 @@ const IVLN2_H: f32 = 1.4426879883e+00; const IVLN2_L: f32 = 7.0526075433e-06; /// Returns `x` to the power of `y` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn powf(x: f32, y: f32) -> f32 { let mut z: f32; let mut ax: f32; diff --git a/library/compiler-builtins/libm/src/math/rem_pio2.rs b/library/compiler-builtins/libm/src/math/rem_pio2.rs index d677fd9dcb30..61b1030275a2 100644 --- a/library/compiler-builtins/libm/src/math/rem_pio2.rs +++ b/library/compiler-builtins/libm/src/math/rem_pio2.rs @@ -41,7 +41,7 @@ const PIO2_3T: f64 = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ // use rem_pio2_large() for large x // // caller must handle the case when reduction is not needed: |x| ~<= pi/4 */ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn rem_pio2(x: f64) -> (i32, f64, f64) { let x1p24 = f64::from_bits(0x4170000000000000); @@ -195,7 +195,7 @@ mod tests { #[test] // FIXME(correctness): inaccurate results on i586 - #[cfg_attr(all(target_arch = "x86", not(target_feature = "sse")), ignore)] + #[cfg_attr(x86_no_sse, ignore)] fn test_near_pi() { let arg = 3.141592025756836; let arg = force_eval!(arg); diff --git a/library/compiler-builtins/libm/src/math/rem_pio2_large.rs b/library/compiler-builtins/libm/src/math/rem_pio2_large.rs index 6d679bbe98c4..f1fdf3673a8d 100644 --- a/library/compiler-builtins/libm/src/math/rem_pio2_large.rs +++ b/library/compiler-builtins/libm/src/math/rem_pio2_large.rs @@ -11,7 +11,7 @@ * ==================================================== */ -use super::{floor, scalbn}; +use super::scalbn; // initial value for jk const INIT_JK: [usize; 4] = [3, 4, 4, 6]; @@ -221,8 +221,16 @@ const PIO2: [f64; 8] = [ /// skip the part of the product that are known to be a huge integer ( /// more accurately, = 0 mod 8 ). Thus the number of operations are /// independent of the exponent of the input. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) -> i32 { + // FIXME(rust-lang/rust#144518): Inline assembly would cause `no_panic` to fail + // on the callers of this function. As a workaround, avoid inlining `floor` here + // when implemented with assembly. + #[cfg_attr(x86_no_sse, inline(never))] + extern "C" fn floor(x: f64) -> f64 { + super::floor(x) + } + let x1p24 = f64::from_bits(0x4170000000000000); // 0x1p24 === 2 ^ 24 let x1p_24 = f64::from_bits(0x3e70000000000000); // 0x1p_24 === 2 ^ (-24) diff --git a/library/compiler-builtins/libm/src/math/rem_pio2f.rs b/library/compiler-builtins/libm/src/math/rem_pio2f.rs index 3c658fe3dbce..0472a10355a0 100644 --- a/library/compiler-builtins/libm/src/math/rem_pio2f.rs +++ b/library/compiler-builtins/libm/src/math/rem_pio2f.rs @@ -31,7 +31,7 @@ const PIO2_1T: f64 = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ /// /// use double precision for everything except passing x /// use __rem_pio2_large() for large x -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub(crate) fn rem_pio2f(x: f32) -> (i32, f64) { let x64 = x as f64; diff --git a/library/compiler-builtins/libm/src/math/remainder.rs b/library/compiler-builtins/libm/src/math/remainder.rs index 9e966c9ed7f4..54152df32f15 100644 --- a/library/compiler-builtins/libm/src/math/remainder.rs +++ b/library/compiler-builtins/libm/src/math/remainder.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn remainder(x: f64, y: f64) -> f64 { let (result, _) = super::remquo(x, y); result diff --git a/library/compiler-builtins/libm/src/math/remainderf.rs b/library/compiler-builtins/libm/src/math/remainderf.rs index b1407cf2ace3..21f629214280 100644 --- a/library/compiler-builtins/libm/src/math/remainderf.rs +++ b/library/compiler-builtins/libm/src/math/remainderf.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn remainderf(x: f32, y: f32) -> f32 { let (result, _) = super::remquof(x, y); result diff --git a/library/compiler-builtins/libm/src/math/remquo.rs b/library/compiler-builtins/libm/src/math/remquo.rs index 4c11e848746b..f13b092373e5 100644 --- a/library/compiler-builtins/libm/src/math/remquo.rs +++ b/library/compiler-builtins/libm/src/math/remquo.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn remquo(mut x: f64, mut y: f64) -> (f64, i32) { let ux: u64 = x.to_bits(); let mut uy: u64 = y.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/remquof.rs b/library/compiler-builtins/libm/src/math/remquof.rs index b0e85ca66116..cc7863a096f9 100644 --- a/library/compiler-builtins/libm/src/math/remquof.rs +++ b/library/compiler-builtins/libm/src/math/remquof.rs @@ -1,4 +1,4 @@ -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn remquof(mut x: f32, mut y: f32) -> (f32, i32) { let ux: u32 = x.to_bits(); let mut uy: u32 = y.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/rint.rs b/library/compiler-builtins/libm/src/math/rint.rs index e1c32c943552..011a7ae3d60a 100644 --- a/library/compiler-builtins/libm/src/math/rint.rs +++ b/library/compiler-builtins/libm/src/math/rint.rs @@ -2,7 +2,7 @@ use super::support::Round; /// Round `x` to the nearest integer, breaking ties toward even. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn rintf16(x: f16) -> f16 { select_implementation! { name: rintf16, @@ -14,7 +14,7 @@ pub fn rintf16(x: f16) -> f16 { } /// Round `x` to the nearest integer, breaking ties toward even. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn rintf(x: f32) -> f32 { select_implementation! { name: rintf, @@ -29,7 +29,7 @@ pub fn rintf(x: f32) -> f32 { } /// Round `x` to the nearest integer, breaking ties toward even. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn rint(x: f64) -> f64 { select_implementation! { name: rint, @@ -45,7 +45,7 @@ pub fn rint(x: f64) -> f64 { /// Round `x` to the nearest integer, breaking ties toward even. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn rintf128(x: f128) -> f128 { super::generic::rint_round(x, Round::Nearest).val } diff --git a/library/compiler-builtins/libm/src/math/round.rs b/library/compiler-builtins/libm/src/math/round.rs index 6cd091cd73cd..256197e6ccbe 100644 --- a/library/compiler-builtins/libm/src/math/round.rs +++ b/library/compiler-builtins/libm/src/math/round.rs @@ -1,25 +1,25 @@ /// Round `x` to the nearest integer, breaking ties away from zero. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundf16(x: f16) -> f16 { super::generic::round(x) } /// Round `x` to the nearest integer, breaking ties away from zero. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundf(x: f32) -> f32 { super::generic::round(x) } /// Round `x` to the nearest integer, breaking ties away from zero. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn round(x: f64) -> f64 { super::generic::round(x) } /// Round `x` to the nearest integer, breaking ties away from zero. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundf128(x: f128) -> f128 { super::generic::round(x) } diff --git a/library/compiler-builtins/libm/src/math/roundeven.rs b/library/compiler-builtins/libm/src/math/roundeven.rs index 6e621d7628f2..f0d67d41076e 100644 --- a/library/compiler-builtins/libm/src/math/roundeven.rs +++ b/library/compiler-builtins/libm/src/math/roundeven.rs @@ -3,21 +3,21 @@ use super::support::{Float, Round}; /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 /// `roundToIntegralTiesToEven`. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundevenf16(x: f16) -> f16 { roundeven_impl(x) } /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 /// `roundToIntegralTiesToEven`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundevenf(x: f32) -> f32 { roundeven_impl(x) } /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 /// `roundToIntegralTiesToEven`. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundeven(x: f64) -> f64 { roundeven_impl(x) } @@ -25,7 +25,7 @@ pub fn roundeven(x: f64) -> f64 { /// Round `x` to the nearest integer, breaking ties toward even. This is IEEE 754 /// `roundToIntegralTiesToEven`. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn roundevenf128(x: f128) -> f128 { roundeven_impl(x) } diff --git a/library/compiler-builtins/libm/src/math/scalbn.rs b/library/compiler-builtins/libm/src/math/scalbn.rs index ed73c3f94f00..f1a67cb7f82f 100644 --- a/library/compiler-builtins/libm/src/math/scalbn.rs +++ b/library/compiler-builtins/libm/src/math/scalbn.rs @@ -1,21 +1,21 @@ #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn scalbnf16(x: f16, n: i32) -> f16 { super::generic::scalbn(x, n) } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn scalbnf(x: f32, n: i32) -> f32 { super::generic::scalbn(x, n) } -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn scalbn(x: f64, n: i32) -> f64 { super::generic::scalbn(x, n) } #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn scalbnf128(x: f128, n: i32) -> f128 { super::generic::scalbn(x, n) } diff --git a/library/compiler-builtins/libm/src/math/sin.rs b/library/compiler-builtins/libm/src/math/sin.rs index 229fa4bef083..5378a7bc3874 100644 --- a/library/compiler-builtins/libm/src/math/sin.rs +++ b/library/compiler-builtins/libm/src/math/sin.rs @@ -44,7 +44,7 @@ use super::{k_cos, k_sin, rem_pio2}; /// The sine of `x` (f64). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sin(x: f64) -> f64 { let x1p120 = f64::from_bits(0x4770000000000000); // 0x1p120f === 2 ^ 120 diff --git a/library/compiler-builtins/libm/src/math/sincos.rs b/library/compiler-builtins/libm/src/math/sincos.rs index ebf482f2df35..a364f73759d5 100644 --- a/library/compiler-builtins/libm/src/math/sincos.rs +++ b/library/compiler-builtins/libm/src/math/sincos.rs @@ -15,7 +15,7 @@ use super::{get_high_word, k_cos, k_sin, rem_pio2}; /// Both the sine and cosine of `x` (f64). /// /// `x` is specified in radians and the return value is (sin(x), cos(x)). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sincos(x: f64) -> (f64, f64) { let s: f64; let c: f64; diff --git a/library/compiler-builtins/libm/src/math/sincosf.rs b/library/compiler-builtins/libm/src/math/sincosf.rs index f3360767683e..c4beb5267f28 100644 --- a/library/compiler-builtins/libm/src/math/sincosf.rs +++ b/library/compiler-builtins/libm/src/math/sincosf.rs @@ -26,7 +26,7 @@ const S4PIO2: f64 = 4.0 * PI_2; /* 0x401921FB, 0x54442D18 */ /// Both the sine and cosine of `x` (f32). /// /// `x` is specified in radians and the return value is (sin(x), cos(x)). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sincosf(x: f32) -> (f32, f32) { let s: f32; let c: f32; diff --git a/library/compiler-builtins/libm/src/math/sinf.rs b/library/compiler-builtins/libm/src/math/sinf.rs index 709b63fcf297..b4edf6769d30 100644 --- a/library/compiler-builtins/libm/src/math/sinf.rs +++ b/library/compiler-builtins/libm/src/math/sinf.rs @@ -27,7 +27,7 @@ const S4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */ /// The sine of `x` (f32). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sinf(x: f32) -> f32 { let x64 = x as f64; diff --git a/library/compiler-builtins/libm/src/math/sinh.rs b/library/compiler-builtins/libm/src/math/sinh.rs index 79184198263c..900dd6ca4d8e 100644 --- a/library/compiler-builtins/libm/src/math/sinh.rs +++ b/library/compiler-builtins/libm/src/math/sinh.rs @@ -6,7 +6,7 @@ use super::{expm1, expo2}; // /// The hyperbolic sine of `x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sinh(x: f64) -> f64 { // union {double f; uint64_t i;} u = {.f = x}; // uint32_t w; diff --git a/library/compiler-builtins/libm/src/math/sinhf.rs b/library/compiler-builtins/libm/src/math/sinhf.rs index 44d2e3560d57..501acea30287 100644 --- a/library/compiler-builtins/libm/src/math/sinhf.rs +++ b/library/compiler-builtins/libm/src/math/sinhf.rs @@ -1,7 +1,7 @@ use super::{expm1f, k_expo2f}; /// The hyperbolic sine of `x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sinhf(x: f32) -> f32 { let mut h = 0.5f32; let mut ix = x.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/sqrt.rs b/library/compiler-builtins/libm/src/math/sqrt.rs index 76bc240cf01c..7ba1bc9b32b2 100644 --- a/library/compiler-builtins/libm/src/math/sqrt.rs +++ b/library/compiler-builtins/libm/src/math/sqrt.rs @@ -1,6 +1,6 @@ /// The square root of `x` (f16). #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sqrtf16(x: f16) -> f16 { select_implementation! { name: sqrtf16, @@ -12,7 +12,7 @@ pub fn sqrtf16(x: f16) -> f16 { } /// The square root of `x` (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sqrtf(x: f32) -> f32 { select_implementation! { name: sqrtf, @@ -28,7 +28,7 @@ pub fn sqrtf(x: f32) -> f32 { } /// The square root of `x` (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sqrt(x: f64) -> f64 { select_implementation! { name: sqrt, @@ -45,7 +45,7 @@ pub fn sqrt(x: f64) -> f64 { /// The square root of `x` (f128). #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn sqrtf128(x: f128) -> f128 { return super::generic::sqrt(x); } diff --git a/library/compiler-builtins/libm/src/math/support/mod.rs b/library/compiler-builtins/libm/src/math/support/mod.rs index 2e7edd03c421..b2d7bd8d5567 100644 --- a/library/compiler-builtins/libm/src/math/support/mod.rs +++ b/library/compiler-builtins/libm/src/math/support/mod.rs @@ -11,7 +11,8 @@ mod int_traits; #[allow(unused_imports)] pub use big::{i256, u256}; -#[allow(unused_imports)] +// Clippy seems to have a false positive +#[allow(unused_imports, clippy::single_component_path_imports)] pub(crate) use cfg_if; pub use env::{FpResult, Round, Status}; #[allow(unused_imports)] diff --git a/library/compiler-builtins/libm/src/math/tan.rs b/library/compiler-builtins/libm/src/math/tan.rs index a072bdec56e0..79c1bad563e2 100644 --- a/library/compiler-builtins/libm/src/math/tan.rs +++ b/library/compiler-builtins/libm/src/math/tan.rs @@ -43,7 +43,7 @@ use super::{k_tan, rem_pio2}; /// The tangent of `x` (f64). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn tan(x: f64) -> f64 { let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120 diff --git a/library/compiler-builtins/libm/src/math/tanf.rs b/library/compiler-builtins/libm/src/math/tanf.rs index 8bcf9581ff60..a615573d87a5 100644 --- a/library/compiler-builtins/libm/src/math/tanf.rs +++ b/library/compiler-builtins/libm/src/math/tanf.rs @@ -27,7 +27,7 @@ const T4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */ /// The tangent of `x` (f32). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn tanf(x: f32) -> f32 { let x64 = x as f64; diff --git a/library/compiler-builtins/libm/src/math/tanh.rs b/library/compiler-builtins/libm/src/math/tanh.rs index cc0abe4fcb2d..c99cc2a70b15 100644 --- a/library/compiler-builtins/libm/src/math/tanh.rs +++ b/library/compiler-builtins/libm/src/math/tanh.rs @@ -8,7 +8,7 @@ use super::expm1; /// The hyperbolic tangent of `x` (f64). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn tanh(mut x: f64) -> f64 { let mut uf: f64 = x; let mut ui: u64 = f64::to_bits(uf); diff --git a/library/compiler-builtins/libm/src/math/tanhf.rs b/library/compiler-builtins/libm/src/math/tanhf.rs index fffbba6c6ec4..3cbd5917f07a 100644 --- a/library/compiler-builtins/libm/src/math/tanhf.rs +++ b/library/compiler-builtins/libm/src/math/tanhf.rs @@ -3,7 +3,7 @@ use super::expm1f; /// The hyperbolic tangent of `x` (f32). /// /// `x` is specified in radians. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn tanhf(mut x: f32) -> f32 { /* x = |x| */ let mut ix = x.to_bits(); diff --git a/library/compiler-builtins/libm/src/math/tgamma.rs b/library/compiler-builtins/libm/src/math/tgamma.rs index 3059860646a5..41415d9d1258 100644 --- a/library/compiler-builtins/libm/src/math/tgamma.rs +++ b/library/compiler-builtins/libm/src/math/tgamma.rs @@ -131,7 +131,7 @@ fn s(x: f64) -> f64 { } /// The [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f64). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn tgamma(mut x: f64) -> f64 { let u: u64 = x.to_bits(); let absx: f64; diff --git a/library/compiler-builtins/libm/src/math/tgammaf.rs b/library/compiler-builtins/libm/src/math/tgammaf.rs index fe178f7a3c0e..a63a2a31862c 100644 --- a/library/compiler-builtins/libm/src/math/tgammaf.rs +++ b/library/compiler-builtins/libm/src/math/tgammaf.rs @@ -1,7 +1,7 @@ use super::tgamma; /// The [Gamma function](https://en.wikipedia.org/wiki/Gamma_function) (f32). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn tgammaf(x: f32) -> f32 { tgamma(x as f64) as f32 } diff --git a/library/compiler-builtins/libm/src/math/trunc.rs b/library/compiler-builtins/libm/src/math/trunc.rs index fa50d55e1368..20d52a111a12 100644 --- a/library/compiler-builtins/libm/src/math/trunc.rs +++ b/library/compiler-builtins/libm/src/math/trunc.rs @@ -2,7 +2,7 @@ /// /// This effectively removes the decimal part of the number, leaving the integral part. #[cfg(f16_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn truncf16(x: f16) -> f16 { super::generic::trunc(x) } @@ -10,7 +10,7 @@ pub fn truncf16(x: f16) -> f16 { /// Rounds the number toward 0 to the closest integral value (f32). /// /// This effectively removes the decimal part of the number, leaving the integral part. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn truncf(x: f32) -> f32 { select_implementation! { name: truncf, @@ -24,7 +24,7 @@ pub fn truncf(x: f32) -> f32 { /// Rounds the number toward 0 to the closest integral value (f64). /// /// This effectively removes the decimal part of the number, leaving the integral part. -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn trunc(x: f64) -> f64 { select_implementation! { name: trunc, @@ -39,7 +39,7 @@ pub fn trunc(x: f64) -> f64 { /// /// This effectively removes the decimal part of the number, leaving the integral part. #[cfg(f128_enabled)] -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +#[cfg_attr(assert_no_panic, no_panic::no_panic)] pub fn truncf128(x: f128) -> f128 { super::generic::trunc(x) } diff --git a/library/compiler-builtins/triagebot.toml b/library/compiler-builtins/triagebot.toml index 8a2356c2b1c0..eba5cdd88b94 100644 --- a/library/compiler-builtins/triagebot.toml +++ b/library/compiler-builtins/triagebot.toml @@ -19,6 +19,3 @@ check-commits = false # Enable issue transfers within the org # Documentation at: https://forge.rust-lang.org/triagebot/transfer.html [transfer] - -# Automatically close and reopen PRs made by bots to run CI on them -[bot-pull-requests] diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 38393379a78a..ceb9748e7feb 100644 --- a/library/core/src/any.rs +++ b/library/core/src/any.rs @@ -725,7 +725,7 @@ unsafe impl Send for TypeId {} unsafe impl Sync for TypeId {} #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_type_id", issue = "77125")] +#[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq for TypeId { #[inline] fn eq(&self, other: &Self) -> bool { @@ -773,7 +773,7 @@ impl TypeId { /// ``` #[must_use] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] + #[rustc_const_stable(feature = "const_type_id", since = "CURRENT_RUSTC_VERSION")] pub const fn of() -> TypeId { const { intrinsics::type_id::() } } diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 1c23218552aa..b3a498570f95 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -378,7 +378,7 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] { #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const Index for [T; N] where - [T]: ~const Index, + [T]: [const] Index, { type Output = <[T] as Index>::Output; @@ -392,7 +392,7 @@ where #[rustc_const_unstable(feature = "const_index", issue = "143775")] impl const IndexMut for [T; N] where - [T]: ~const IndexMut, + [T]: [const] IndexMut, { #[inline] fn index_mut(&mut self, index: I) -> &mut Self::Output { diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index d67408cae1b9..c639d50cc3d8 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -334,7 +334,7 @@ impl Clone for Cell { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for Cell { +impl const Default for Cell { /// Creates a `Cell`, with the `Default` value for T. #[inline] fn default() -> Cell { @@ -1325,7 +1325,7 @@ impl Clone for RefCell { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for RefCell { +impl const Default for RefCell { /// Creates a `RefCell`, with the `Default` value for T. #[inline] fn default() -> RefCell { @@ -2333,7 +2333,7 @@ impl UnsafeCell { #[stable(feature = "unsafe_cell_default", since = "1.10.0")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for UnsafeCell { +impl const Default for UnsafeCell { /// Creates an `UnsafeCell`, with the `Default` value for T. fn default() -> UnsafeCell { UnsafeCell::new(Default::default()) @@ -2438,7 +2438,7 @@ impl SyncUnsafeCell { #[unstable(feature = "sync_unsafe_cell", issue = "95439")] #[rustc_const_unstable(feature = "const_default", issue = "143894")] -impl const Default for SyncUnsafeCell { +impl const Default for SyncUnsafeCell { /// Creates an `SyncUnsafeCell`, with the `Default` value for T. fn default() -> SyncUnsafeCell { SyncUnsafeCell::new(Default::default()) diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 51d037ddfd2c..e315c4fac08a 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -212,7 +212,7 @@ pub trait Clone: Sized { #[stable(feature = "rust1", since = "1.0.0")] fn clone_from(&mut self, source: &Self) where - Self: ~const Destruct, + Self: [const] Destruct, { *self = source.clone() } diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 1b9af10a6fda..a64fade285bf 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -2022,7 +2022,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&B> for &A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&B) -> bool { @@ -2094,7 +2094,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&mut B> for &mut A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&mut B) -> bool { @@ -2164,7 +2164,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&mut B> for &A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&mut B) -> bool { @@ -2180,7 +2180,7 @@ mod impls { #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq<&B> for &mut A where - A: ~const PartialEq, + A: [const] PartialEq, { #[inline] fn eq(&self, other: &&B) -> bool { diff --git a/library/core/src/cmp/bytewise.rs b/library/core/src/cmp/bytewise.rs index 7d61c9345ecf..a06a6e8b69a2 100644 --- a/library/core/src/cmp/bytewise.rs +++ b/library/core/src/cmp/bytewise.rs @@ -19,7 +19,7 @@ use crate::num::NonZero; #[rustc_specialization_trait] #[const_trait] pub(crate) unsafe trait BytewiseEq: - ~const PartialEq + Sized + [const] PartialEq + Sized { } diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 220a24caf09e..0c3034c3d4cf 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -717,7 +717,7 @@ pub trait TryFrom: Sized { #[rustc_const_unstable(feature = "const_try", issue = "74935")] impl const AsRef for &T where - T: ~const AsRef, + T: [const] AsRef, { #[inline] fn as_ref(&self) -> &U { @@ -730,7 +730,7 @@ where #[rustc_const_unstable(feature = "const_try", issue = "74935")] impl const AsRef for &mut T where - T: ~const AsRef, + T: [const] AsRef, { #[inline] fn as_ref(&self) -> &U { @@ -751,7 +751,7 @@ where #[rustc_const_unstable(feature = "const_try", issue = "74935")] impl const AsMut for &mut T where - T: ~const AsMut, + T: [const] AsMut, { #[inline] fn as_mut(&mut self) -> &mut U { @@ -772,7 +772,7 @@ where #[rustc_const_unstable(feature = "const_from", issue = "143773")] impl const Into for T where - U: ~const From, + U: [const] From, { /// Calls `U::from(self)`. /// @@ -816,7 +816,7 @@ impl const From for T { #[rustc_const_unstable(feature = "const_from", issue = "143773")] impl const TryInto for T where - U: ~const TryFrom, + U: [const] TryFrom, { type Error = U::Error; @@ -832,7 +832,7 @@ where #[rustc_const_unstable(feature = "const_from", issue = "143773")] impl const TryFrom for T where - U: ~const Into, + U: [const] Into, { type Error = Infallible; diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs index c43f3834630f..e6b599fafcff 100644 --- a/library/core/src/ffi/c_str.rs +++ b/library/core/src/ffi/c_str.rs @@ -652,7 +652,7 @@ impl CStr { } } -#[stable(feature = "c_string_eq_c_str", since = "CURRENT_RUSTC_VERSION")] +#[stable(feature = "c_string_eq_c_str", since = "1.90.0")] impl PartialEq<&Self> for CStr { #[inline] fn eq(&self, other: &&Self) -> bool { diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index 106cc725fee2..7228ad0ed6d0 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -150,69 +150,63 @@ pub unsafe fn atomic_xchg(dst: *mut T, src: /// Adds to the current value, returning the previous value. /// `T` must be an integer or pointer type. -/// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new -/// value stored at `*dst` will have the provenance of the old value stored there. +/// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. /// /// The stabilized version of this intrinsic is available on the /// [`atomic`] types via the `fetch_add` method. For example, [`AtomicIsize::fetch_add`]. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn atomic_xadd(dst: *mut T, src: T) -> T; +pub unsafe fn atomic_xadd(dst: *mut T, src: U) -> T; /// Subtract from the current value, returning the previous value. /// `T` must be an integer or pointer type. -/// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new -/// value stored at `*dst` will have the provenance of the old value stored there. +/// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. /// /// The stabilized version of this intrinsic is available on the /// [`atomic`] types via the `fetch_sub` method. For example, [`AtomicIsize::fetch_sub`]. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn atomic_xsub(dst: *mut T, src: T) -> T; +pub unsafe fn atomic_xsub(dst: *mut T, src: U) -> T; /// Bitwise and with the current value, returning the previous value. /// `T` must be an integer or pointer type. -/// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new -/// value stored at `*dst` will have the provenance of the old value stored there. +/// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. /// /// The stabilized version of this intrinsic is available on the /// [`atomic`] types via the `fetch_and` method. For example, [`AtomicBool::fetch_and`]. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn atomic_and(dst: *mut T, src: T) -> T; +pub unsafe fn atomic_and(dst: *mut T, src: U) -> T; /// Bitwise nand with the current value, returning the previous value. /// `T` must be an integer or pointer type. -/// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new -/// value stored at `*dst` will have the provenance of the old value stored there. +/// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. /// /// The stabilized version of this intrinsic is available on the /// [`AtomicBool`] type via the `fetch_nand` method. For example, [`AtomicBool::fetch_nand`]. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn atomic_nand(dst: *mut T, src: T) -> T; +pub unsafe fn atomic_nand(dst: *mut T, src: U) -> T; /// Bitwise or with the current value, returning the previous value. /// `T` must be an integer or pointer type. -/// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new -/// value stored at `*dst` will have the provenance of the old value stored there. +/// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. /// /// The stabilized version of this intrinsic is available on the /// [`atomic`] types via the `fetch_or` method. For example, [`AtomicBool::fetch_or`]. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn atomic_or(dst: *mut T, src: T) -> T; +pub unsafe fn atomic_or(dst: *mut T, src: U) -> T; /// Bitwise xor with the current value, returning the previous value. /// `T` must be an integer or pointer type. -/// If `T` is a pointer type, the provenance of `src` is ignored: both the return value and the new -/// value stored at `*dst` will have the provenance of the old value stored there. +/// `U` must be the same as `T` if that is an integer type, or `usize` if `T` is a pointer type. /// /// The stabilized version of this intrinsic is available on the /// [`atomic`] types via the `fetch_xor` method. For example, [`AtomicBool::fetch_xor`]. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn atomic_xor(dst: *mut T, src: T) -> T; +pub unsafe fn atomic_xor(dst: *mut T, src: U) -> T; /// Maximum with the current value using a signed comparison. /// `T` must be a signed integer type. @@ -1828,7 +1822,7 @@ pub const fn three_way_compare(lhs: T, rhss: T) -> crate::cmp::Ordering #[rustc_intrinsic] #[track_caller] #[miri::intrinsic_fallback_is_spec] // the fallbacks all `assume` to tell Miri -pub const unsafe fn disjoint_bitor(a: T, b: T) -> T { +pub const unsafe fn disjoint_bitor(a: T, b: T) -> T { // SAFETY: same preconditions as this function. unsafe { fallback::DisjointBitOr::disjoint_bitor(a, b) } } @@ -1897,7 +1891,7 @@ pub const fn mul_with_overflow(x: T, y: T) -> (T, bool); #[rustc_nounwind] #[rustc_intrinsic] #[miri::intrinsic_fallback_is_spec] -pub const fn carrying_mul_add, U>( +pub const fn carrying_mul_add, U>( multiplier: T, multiplicand: T, addend: T, @@ -2667,7 +2661,7 @@ pub unsafe fn vtable_align(ptr: *const ()) -> usize; /// More specifically, this is the offset in bytes between successive /// items of the same type, including alignment padding. /// -/// The stabilized version of this intrinsic is [`size_of`]. +/// The stabilized version of this intrinsic is [`core::mem::size_of`]. #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_intrinsic_const_stable_indirect] @@ -2681,7 +2675,7 @@ pub const fn size_of() -> usize; /// Therefore, implementations must not require the user to uphold /// any safety invariants. /// -/// The stabilized version of this intrinsic is [`align_of`]. +/// The stabilized version of this intrinsic is [`core::mem::align_of`]. #[rustc_nounwind] #[unstable(feature = "core_intrinsics", issue = "none")] #[rustc_intrinsic_const_stable_indirect] @@ -2704,7 +2698,7 @@ pub const fn variant_count() -> usize; /// The size of the referenced value in bytes. /// -/// The stabilized version of this intrinsic is [`size_of_val`]. +/// The stabilized version of this intrinsic is [`core::mem::size_of_val`]. /// /// # Safety /// @@ -2717,7 +2711,7 @@ pub const unsafe fn size_of_val(ptr: *const T) -> usize; /// The required alignment of the referenced value. /// -/// The stabilized version of this intrinsic is [`align_of_val`]. +/// The stabilized version of this intrinsic is [`core::mem::align_of_val`]. /// /// # Safety /// diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index 29313867ff26..7fb162a653fb 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -1875,7 +1875,7 @@ pub trait Iterator { /// without giving up ownership of the original iterator, /// so you can use the original iterator afterwards. /// - /// Uses [impl Iterator for &mut I { type Item = I::Item; ...}](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#impl-Iterator-for-%26mut+I). + /// Uses [`impl Iterator for &mut I { type Item = I::Item; ...}`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#impl-Iterator-for-%26mut+I). /// /// # Examples /// diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 3c33f4b13684..d5bce6ad233e 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -195,6 +195,7 @@ #![feature(hexagon_target_feature)] #![feature(loongarch_target_feature)] #![feature(mips_target_feature)] +#![feature(nvptx_target_feature)] #![feature(powerpc_target_feature)] #![feature(riscv_target_feature)] #![feature(rtm_target_feature)] diff --git a/library/core/src/net/socket_addr.rs b/library/core/src/net/socket_addr.rs index 69924199f99f..df99e9b20c2e 100644 --- a/library/core/src/net/socket_addr.rs +++ b/library/core/src/net/socket_addr.rs @@ -613,7 +613,7 @@ impl const From for SocketAddr { #[stable(feature = "addr_from_into_ip", since = "1.17.0")] #[rustc_const_unstable(feature = "const_try", issue = "74935")] -impl> const From<(I, u16)> for SocketAddr { +impl> const From<(I, u16)> for SocketAddr { /// Converts a tuple struct (Into<[`IpAddr`]>, `u16`) into a [`SocketAddr`]. /// /// This conversion creates a [`SocketAddr::V4`] for an [`IpAddr::V4`] diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 7fa2a3e45f37..dbcccdf497c2 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -177,14 +177,14 @@ macro_rules! int_impl { /// #[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")] /// - /// assert_eq!(n.isolate_most_significant_one(), 0b_01000000); - #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_most_significant_one(), 0);")] + /// assert_eq!(n.isolate_highest_one(), 0b_01000000); + #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_highest_one(), 0);")] /// ``` #[unstable(feature = "isolate_most_least_significant_one", issue = "136909")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn isolate_most_significant_one(self) -> Self { + pub const fn isolate_highest_one(self) -> Self { self & (((1 as $SelfT) << (<$SelfT>::BITS - 1)).wrapping_shr(self.leading_zeros())) } @@ -198,14 +198,14 @@ macro_rules! int_impl { /// #[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")] /// - /// assert_eq!(n.isolate_least_significant_one(), 0b_00000100); - #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_least_significant_one(), 0);")] + /// assert_eq!(n.isolate_lowest_one(), 0b_00000100); + #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_lowest_one(), 0);")] /// ``` #[unstable(feature = "isolate_most_least_significant_one", issue = "136909")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn isolate_least_significant_one(self) -> Self { + pub const fn isolate_lowest_one(self) -> Self { self & self.wrapping_neg() } @@ -469,17 +469,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).strict_add(1), ", stringify!($SelfT), "::MAX - 1);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add(3);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -560,17 +559,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".strict_add_unsigned(2), 3);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add_unsigned(3);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -611,17 +609,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 2).strict_sub(1), ", stringify!($SelfT), "::MIN + 1);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub(3);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -702,17 +699,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".strict_sub_unsigned(2), -1);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub_unsigned(3);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -753,17 +749,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.strict_mul(1), ", stringify!($SelfT), "::MAX);")] /// ``` /// /// The following panics because of overflow: /// /// ``` should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_mul(2);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -855,24 +850,22 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 1).strict_div(-1), ", stringify!($Max), ");")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_div(-1);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div(0);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -924,24 +917,22 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 1).strict_div_euclid(-1), ", stringify!($Max), ");")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_div_euclid(-1);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div_euclid(0);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1092,24 +1083,22 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_rem(2), 1);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 5", stringify!($SelfT), ".strict_rem(0);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem(-1);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1160,24 +1149,22 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_rem_euclid(2), 1);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 5", stringify!($SelfT), ".strict_rem_euclid(0);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem_euclid(-1);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1249,17 +1236,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_neg(), -5);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_neg();")] /// - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1306,17 +1292,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".strict_shl(4), 0x10);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 0x1", stringify!($SelfT), ".strict_shl(129);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1422,17 +1407,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".strict_shr(4), 0x1);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 0x10", stringify!($SelfT), ".strict_shr(128);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1542,17 +1526,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!((-5", stringify!($SelfT), ").strict_abs(), 5);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_abs();")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1612,17 +1595,16 @@ macro_rules! int_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(8", stringify!($SelfT), ".strict_pow(2), 64);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_pow(2);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index f793602de508..08a66361e6f4 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -203,7 +203,7 @@ impl Copy for NonZero where T: ZeroablePrimitive {} #[rustc_const_unstable(feature = "const_cmp", issue = "143800")] impl const PartialEq for NonZero where - T: ZeroablePrimitive + ~const PartialEq, + T: ZeroablePrimitive + [const] PartialEq, { #[inline] fn eq(&self, other: &Self) -> bool { @@ -629,7 +629,7 @@ macro_rules! nonzero_integer { #[doc = concat!("let a = NonZero::<", stringify!($Int), ">::new(0b_01100100)?;")] #[doc = concat!("let b = NonZero::<", stringify!($Int), ">::new(0b_01000000)?;")] /// - /// assert_eq!(a.isolate_most_significant_one(), b); + /// assert_eq!(a.isolate_highest_one(), b); /// # Some(()) /// # } /// ``` @@ -637,7 +637,7 @@ macro_rules! nonzero_integer { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn isolate_most_significant_one(self) -> Self { + pub const fn isolate_highest_one(self) -> Self { let n = self.get() & (((1 as $Int) << (<$Int>::BITS - 1)).wrapping_shr(self.leading_zeros())); // SAFETY: @@ -659,7 +659,7 @@ macro_rules! nonzero_integer { #[doc = concat!("let a = NonZero::<", stringify!($Int), ">::new(0b_01100100)?;")] #[doc = concat!("let b = NonZero::<", stringify!($Int), ">::new(0b_00000100)?;")] /// - /// assert_eq!(a.isolate_least_significant_one(), b); + /// assert_eq!(a.isolate_lowest_one(), b); /// # Some(()) /// # } /// ``` @@ -667,7 +667,7 @@ macro_rules! nonzero_integer { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn isolate_least_significant_one(self) -> Self { + pub const fn isolate_lowest_one(self) -> Self { let n = self.get(); let n = n & n.wrapping_neg(); diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 84d8de665b23..9284a566208b 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -229,14 +229,14 @@ macro_rules! uint_impl { /// #[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")] /// - /// assert_eq!(n.isolate_most_significant_one(), 0b_01000000); - #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_most_significant_one(), 0);")] + /// assert_eq!(n.isolate_highest_one(), 0b_01000000); + #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_highest_one(), 0);")] /// ``` #[unstable(feature = "isolate_most_least_significant_one", issue = "136909")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn isolate_most_significant_one(self) -> Self { + pub const fn isolate_highest_one(self) -> Self { self & (((1 as $SelfT) << (<$SelfT>::BITS - 1)).wrapping_shr(self.leading_zeros())) } @@ -250,14 +250,14 @@ macro_rules! uint_impl { /// #[doc = concat!("let n: ", stringify!($SelfT), " = 0b_01100100;")] /// - /// assert_eq!(n.isolate_least_significant_one(), 0b_00000100); - #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_least_significant_one(), 0);")] + /// assert_eq!(n.isolate_lowest_one(), 0b_00000100); + #[doc = concat!("assert_eq!(0_", stringify!($SelfT), ".isolate_lowest_one(), 0);")] /// ``` #[unstable(feature = "isolate_most_least_significant_one", issue = "136909")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] - pub const fn isolate_least_significant_one(self) -> Self { + pub const fn isolate_lowest_one(self) -> Self { self & self.wrapping_neg() } @@ -538,17 +538,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).strict_add(1), ", stringify!($SelfT), "::MAX - 1);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add(3);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -630,22 +629,20 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".strict_add_signed(2), 3);")] /// ``` /// /// The following panic because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 1", stringify!($SelfT), ".strict_add_signed(-2);")] /// ``` /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add_signed(3);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -695,17 +692,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".strict_sub(1), 0);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 0", stringify!($SelfT), ".strict_sub(1);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -790,8 +786,8 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".checked_sub_signed(-2), Some(3));")] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_sub_signed(-4), None);")] /// ``` - #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] + #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -817,22 +813,20 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(3", stringify!($SelfT), ".strict_sub_signed(2), 1);")] /// ``` /// /// The following panic because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 1", stringify!($SelfT), ".strict_sub_signed(2);")] /// ``` /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (", stringify!($SelfT), "::MAX).strict_sub_signed(-1);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -850,7 +844,6 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(unsigned_signed_diff)] #[doc = concat!("assert_eq!(10", stringify!($SelfT), ".checked_signed_diff(2), Some(8));")] #[doc = concat!("assert_eq!(2", stringify!($SelfT), ".checked_signed_diff(10), Some(-8));")] #[doc = concat!( @@ -888,7 +881,8 @@ macro_rules! uint_impl { "::MAX), Some(0));" )] /// ``` - #[unstable(feature = "unsigned_signed_diff", issue = "126041")] + #[stable(feature = "unsigned_signed_diff", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "unsigned_signed_diff", since = "CURRENT_RUSTC_VERSION")] #[inline] pub const fn checked_signed_diff(self, rhs: Self) -> Option<$SignedT> { let res = self.wrapping_sub(rhs) as $SignedT; @@ -932,17 +926,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_mul(1), 5);")] /// ``` /// /// The following panics because of overflow: /// /// ``` should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_mul(2);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1029,17 +1022,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".strict_div(10), 10);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div(0);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] @@ -1085,16 +1077,15 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".strict_div_euclid(10), 10);")] /// ``` /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div_euclid(0);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] @@ -1239,17 +1230,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".strict_rem(10), 0);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 5", stringify!($SelfT), ".strict_rem(0);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] @@ -1296,17 +1286,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".strict_rem_euclid(10), 0);")] /// ``` /// /// The following panics because of division by zero: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 5", stringify!($SelfT), ".strict_rem_euclid(0);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline(always)] @@ -1568,17 +1557,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".strict_neg(), 0);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 1", stringify!($SelfT), ".strict_neg();")] /// - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1625,17 +1613,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".strict_shl(4), 0x10);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 0x10", stringify!($SelfT), ".strict_shl(129);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1741,17 +1728,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".strict_shr(4), 0x1);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = 0x10", stringify!($SelfT), ".strict_shr(129);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1867,17 +1853,16 @@ macro_rules! uint_impl { /// # Examples /// /// ``` - /// #![feature(strict_overflow_ops)] #[doc = concat!("assert_eq!(2", stringify!($SelfT), ".strict_pow(5), 32);")] /// ``` /// /// The following panics because of overflow: /// /// ```should_panic - /// #![feature(strict_overflow_ops)] #[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_pow(2);")] /// ``` - #[unstable(feature = "strict_overflow_ops", issue = "118260")] + #[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -1974,8 +1959,8 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".saturating_sub_signed(-2), 3);")] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).saturating_sub_signed(-4), ", stringify!($SelfT), "::MAX);")] /// ``` - #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] + #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -2122,8 +2107,8 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".wrapping_sub_signed(-2), 3);")] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).wrapping_sub_signed(-4), 1);")] /// ``` - #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] + #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] @@ -2580,8 +2565,8 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(1", stringify!($SelfT), ".overflowing_sub_signed(-2), (3, false));")] #[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).overflowing_sub_signed(-4), (1, true));")] /// ``` - #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] - #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "CURRENT_RUSTC_VERSION")] + #[stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] + #[rustc_const_stable(feature = "mixed_integer_ops_unsigned_sub", since = "1.90.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] diff --git a/library/core/src/ops/control_flow.rs b/library/core/src/ops/control_flow.rs index 26661b20c12d..7489a8bb6e74 100644 --- a/library/core/src/ops/control_flow.rs +++ b/library/core/src/ops/control_flow.rs @@ -187,6 +187,80 @@ impl ControlFlow { } } + /// Converts the `ControlFlow` into an `Result` which is `Ok` if the + /// `ControlFlow` was `Break` and `Err` if otherwise. + /// + /// # Examples + /// + /// ``` + /// #![feature(control_flow_ok)] + /// + /// use std::ops::ControlFlow; + /// + /// struct TreeNode { + /// value: T, + /// left: Option>>, + /// right: Option>>, + /// } + /// + /// impl TreeNode { + /// fn find<'a>(&'a self, mut predicate: impl FnMut(&T) -> bool) -> Result<&'a T, ()> { + /// let mut f = |t: &'a T| -> ControlFlow<&'a T> { + /// if predicate(t) { + /// ControlFlow::Break(t) + /// } else { + /// ControlFlow::Continue(()) + /// } + /// }; + /// + /// self.traverse_inorder(&mut f).break_ok() + /// } + /// + /// fn traverse_inorder<'a, B>( + /// &'a self, + /// f: &mut impl FnMut(&'a T) -> ControlFlow, + /// ) -> ControlFlow { + /// if let Some(left) = &self.left { + /// left.traverse_inorder(f)?; + /// } + /// f(&self.value)?; + /// if let Some(right) = &self.right { + /// right.traverse_inorder(f)?; + /// } + /// ControlFlow::Continue(()) + /// } + /// + /// fn leaf(value: T) -> Option>> { + /// Some(Box::new(Self { + /// value, + /// left: None, + /// right: None, + /// })) + /// } + /// } + /// + /// let node = TreeNode { + /// value: 0, + /// left: TreeNode::leaf(1), + /// right: Some(Box::new(TreeNode { + /// value: -1, + /// left: TreeNode::leaf(5), + /// right: TreeNode::leaf(2), + /// })), + /// }; + /// + /// let res = node.find(|val: &i32| *val > 3); + /// assert_eq!(res, Ok(&5)); + /// ``` + #[inline] + #[unstable(feature = "control_flow_ok", issue = "140266")] + pub fn break_ok(self) -> Result { + match self { + ControlFlow::Continue(c) => Err(c), + ControlFlow::Break(b) => Ok(b), + } + } + /// Maps `ControlFlow` to `ControlFlow` by applying a function /// to the break value in case it exists. #[inline] @@ -218,6 +292,79 @@ impl ControlFlow { } } + /// Converts the `ControlFlow` into an `Result` which is `Ok` if the + /// `ControlFlow` was `Continue` and `Err` if otherwise. + /// + /// # Examples + /// + /// ``` + /// #![feature(control_flow_ok)] + /// + /// use std::ops::ControlFlow; + /// + /// struct TreeNode { + /// value: T, + /// left: Option>>, + /// right: Option>>, + /// } + /// + /// impl TreeNode { + /// fn validate(&self, f: &mut impl FnMut(&T) -> ControlFlow) -> Result<(), B> { + /// self.traverse_inorder(f).continue_ok() + /// } + /// + /// fn traverse_inorder(&self, f: &mut impl FnMut(&T) -> ControlFlow) -> ControlFlow { + /// if let Some(left) = &self.left { + /// left.traverse_inorder(f)?; + /// } + /// f(&self.value)?; + /// if let Some(right) = &self.right { + /// right.traverse_inorder(f)?; + /// } + /// ControlFlow::Continue(()) + /// } + /// + /// fn leaf(value: T) -> Option>> { + /// Some(Box::new(Self { + /// value, + /// left: None, + /// right: None, + /// })) + /// } + /// } + /// + /// let node = TreeNode { + /// value: 0, + /// left: TreeNode::leaf(1), + /// right: Some(Box::new(TreeNode { + /// value: -1, + /// left: TreeNode::leaf(5), + /// right: TreeNode::leaf(2), + /// })), + /// }; + /// + /// let res = node.validate(&mut |val| { + /// if *val < 0 { + /// return ControlFlow::Break("negative value detected"); + /// } + /// + /// if *val > 4 { + /// return ControlFlow::Break("too big value detected"); + /// } + /// + /// ControlFlow::Continue(()) + /// }); + /// assert_eq!(res, Err("too big value detected")); + /// ``` + #[inline] + #[unstable(feature = "control_flow_ok", issue = "140266")] + pub fn continue_ok(self) -> Result { + match self { + ControlFlow::Continue(c) => Ok(c), + ControlFlow::Break(b) => Err(b), + } + } + /// Maps `ControlFlow` to `ControlFlow` by applying a function /// to the continue value in case it exists. #[inline] diff --git a/library/core/src/ops/deref.rs b/library/core/src/ops/deref.rs index c2dede9fa088..5f68c1f55c25 100644 --- a/library/core/src/ops/deref.rs +++ b/library/core/src/ops/deref.rs @@ -269,7 +269,7 @@ impl const Deref for &mut T { #[stable(feature = "rust1", since = "1.0.0")] #[const_trait] #[rustc_const_unstable(feature = "const_deref", issue = "88955")] -pub trait DerefMut: ~const Deref + PointeeSized { +pub trait DerefMut: [const] Deref + PointeeSized { /// Mutably dereferences the value. #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "deref_mut_method"] diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs index efc751a094d1..ad46e52a475d 100644 --- a/library/core/src/ops/function.rs +++ b/library/core/src/ops/function.rs @@ -260,7 +260,7 @@ mod impls { #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")] impl const Fn 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/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/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/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/result.rs b/library/core/src/result.rs index 474f86395ae0..6148bdb866ad 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -610,9 +610,9 @@ impl Result { #[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, + F: [const] FnOnce(T) -> bool + [const] Destruct, + T: [const] Destruct, + E: [const] Destruct, { match self { Err(_) => false, @@ -665,9 +665,9 @@ impl Result { #[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, + F: [const] FnOnce(E) -> bool + [const] Destruct, + E: [const] Destruct, + T: [const] Destruct, { match self { Ok(_) => false, @@ -699,8 +699,8 @@ impl Result { #[rustc_diagnostic_item = "result_ok_method"] pub const fn ok(self) -> Option where - T: ~const Destruct, - E: ~const Destruct, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(x) => Some(x), @@ -727,8 +727,8 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn err(self) -> Option where - T: ~const Destruct, - E: ~const Destruct, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(_) => None, @@ -822,7 +822,7 @@ impl 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, + F: [const] FnOnce(T) -> U + [const] Destruct, { match self { Ok(t) => Ok(op(t)), @@ -854,10 +854,10 @@ impl Result { #[must_use = "if you don't need the returned value, use `if let` instead"] 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, + F: [const] FnOnce(T) -> U + [const] Destruct, + T: [const] Destruct, + E: [const] Destruct, + U: [const] Destruct, { match self { Ok(t) => f(t), @@ -888,8 +888,8 @@ impl Result { #[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, + D: [const] FnOnce(E) -> U + [const] Destruct, + F: [const] FnOnce(T) -> U + [const] Destruct, { match self { Ok(t) => f(t), @@ -919,10 +919,10 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn map_or_default(self, f: F) -> U where - F: ~const FnOnce(T) -> U + ~const Destruct, - U: ~const Default, - T: ~const Destruct, - E: ~const Destruct, + F: [const] FnOnce(T) -> U + [const] Destruct, + U: [const] Default, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(t) => f(t), @@ -953,7 +953,7 @@ impl 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, + O: [const] FnOnce(E) -> F + [const] Destruct, { match self { Ok(t) => Ok(t), @@ -979,7 +979,7 @@ impl Result { #[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, + F: [const] FnOnce(&T) + [const] Destruct, { if let Ok(ref t) = self { f(t); @@ -1007,7 +1007,7 @@ impl Result { #[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, + F: [const] FnOnce(&E) + [const] Destruct, { if let Err(ref e) = self { f(e); @@ -1254,8 +1254,8 @@ impl Result { #[rustc_const_unstable(feature = "const_result_trait_fn", issue = "144211")] pub const fn unwrap_or_default(self) -> T where - T: ~const Default + ~const Destruct, - E: ~const Destruct, + T: [const] Default + [const] Destruct, + E: [const] Destruct, { match self { Ok(x) => x, @@ -1350,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, @@ -1387,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(), @@ -1431,9 +1431,9 @@ impl 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, + T: [const] Destruct, + E: [const] Destruct, + U: [const] Destruct, { match self { Ok(_) => res, @@ -1477,7 +1477,7 @@ impl Result { #[rustc_confusables("flat_map", "flatmap")] pub const fn and_then(self, op: F) -> Result where - F: ~const FnOnce(T) -> Result + ~const Destruct, + F: [const] FnOnce(T) -> Result + [const] Destruct, { match self { Ok(t) => op(t), @@ -1517,9 +1517,9 @@ impl 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, + T: [const] Destruct, + E: [const] Destruct, + F: [const] Destruct, { match self { Ok(v) => Ok(v), @@ -1548,7 +1548,7 @@ impl 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, + O: [const] FnOnce(E) -> Result + [const] Destruct, { match self { Ok(t) => Ok(t), @@ -1579,8 +1579,8 @@ impl Result { #[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, + T: [const] Destruct, + E: [const] Destruct, { match self { Ok(t) => t, @@ -1605,7 +1605,7 @@ impl Result { #[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, + F: [const] FnOnce(E) -> T + [const] Destruct, { match self { Ok(t) => t, @@ -2164,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] @@ -2178,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/mod.rs b/library/core/src/slice/mod.rs index 1dddc48e68e9..64f5b5dd8313 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -569,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) } @@ -596,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) } @@ -636,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. @@ -681,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. @@ -969,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; diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index c40af4de7e03..1b6e84175b93 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -603,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) } @@ -636,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/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 70c02ead3584..44a6895f90ac 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -2293,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 @@ -2318,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")] @@ -2328,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, @@ -2379,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 @@ -2429,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 @@ -2477,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. @@ -3981,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), } } } @@ -3998,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), } } } @@ -4147,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), } } } @@ -4163,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), } } } @@ -4179,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), } } } @@ -4195,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/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/lib.rs b/library/coretests/tests/lib.rs index 0a9c0c61c958..75679bbac91f 100644 --- a/library/coretests/tests/lib.rs +++ b/library/coretests/tests/lib.rs @@ -18,10 +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)] 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/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 fd06a3b540cd..0c5375306472 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -321,7 +321,6 @@ #![feature(try_blocks)] #![feature(try_trait_v2)] #![feature(type_alias_impl_trait)] -#![feature(unsigned_signed_diff)] // tidy-alphabetical-end // // Library features (core): 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 913ef72f6746..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) diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index 224cd39855a4..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, diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 055e7f814800..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 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/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 95fe4f902d33..cc4734b68190 100644 --- a/library/std/src/sys/pal/hermit/thread.rs +++ b/library/std/src/sys/pal/hermit/thread.rs @@ -115,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 0d28051fcc46..4e14cb3cbcaa 100644 --- a/library/std/src/sys/pal/itron/thread.rs +++ b/library/std/src/sys/pal/itron/thread.rs @@ -361,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 a236c3627060..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; @@ -149,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 a91d95626e70..1812d11e692e 100644 --- a/library/std/src/sys/pal/teeos/thread.rs +++ b/library/std/src/sys/pal/teeos/thread.rs @@ -144,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/thread.rs b/library/std/src/sys/pal/uefi/thread.rs index 75c364362b2d..47a48008c76d 100644 --- a/library/std/src/sys/pal/uefi/thread.rs +++ b/library/std/src/sys/pal/uefi/thread.rs @@ -56,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 d89100e69196..0d2100d66bc0 100644 --- a/library/std/src/sys/pal/unix/stack_overflow.rs +++ b/library/std/src/sys/pal/unix/stack_overflow.rs @@ -119,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"); } }) @@ -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 diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 7f6440152d4b..36e53e7cadca 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -398,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 5a1e3fde9860..34d9b5ec70c6 100644 --- a/library/std/src/sys/pal/unsupported/thread.rs +++ b/library/std/src/sys/pal/unsupported/thread.rs @@ -39,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 a46c74630c97..4755e2ef5da0 100644 --- a/library/std/src/sys/pal/wasi/thread.rs +++ b/library/std/src/sys/pal/wasi/thread.rs @@ -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/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 b45f76fb546f..c708da5af12a 100644 --- a/library/std/src/sys/pal/windows/thread.rs +++ b/library/std/src/sys/pal/windows/thread.rs @@ -127,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 f2404a62abf9..92803c94c6e7 100644 --- a/library/std/src/sys/pal/xous/thread.rs +++ b/library/std/src/sys/pal/xous/thread.rs @@ -145,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/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 8d3ab82ace12..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; 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/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/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 1190bb56b97a..d554807bbde7 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -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/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index f6653ed899bf..f931aae3c2e0 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -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 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 59541bf12def..e1ee0773107e 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -19,7 +19,7 @@ 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::{ @@ -269,7 +269,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); } @@ -497,7 +497,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. // @@ -645,12 +645,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"); } @@ -1131,7 +1127,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)), @@ -1544,9 +1540,8 @@ impl Step for RustcLink { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CodegenBackend { - pub target: TargetSelection, - pub compiler: Compiler, - pub backend: CodegenBackendKind, + compilers: RustcPrivateCompilers, + backend: CodegenBackendKind, } fn needs_codegen_config(run: &RunConfig<'_>) -> bool { @@ -1610,8 +1605,11 @@ impl Step for CodegenBackend { } run.builder.ensure(CodegenBackend { - target: run.target, - compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()), + compilers: RustcPrivateCompilers::new( + run.builder, + run.builder.top_stage, + run.target, + ), backend: backend.clone(), }); } @@ -1624,20 +1622,17 @@ impl Step for CodegenBackend { name = "CodegenBackend::run", skip_all, fields( - compiler = ?self.compiler, - target = ?self.target, - backend = ?self.target, + compilers = ?self.compilers, + backend = ?self.backend, ), ), )] fn run(self, builder: &Builder<'_>) { - let compiler = self.compiler; - let target = self.target; let backend = self.backend; + let target = self.compilers.target(); + let build_compiler = self.compilers.build_compiler(); - builder.ensure(Rustc::new(compiler, target)); - - 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. \ @@ -1648,17 +1643,11 @@ impl Step for CodegenBackend { return; } - 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 out_dir = builder.cargo_out(build_compiler, Mode::Codegen, target); let mut cargo = builder::Cargo::new( builder, - compiler, + build_compiler, Mode::Codegen, SourceType::InTree, target, @@ -1679,8 +1668,13 @@ impl Step for CodegenBackend { let tmp_stamp = BuildStamp::new(&out_dir).with_prefix("tmp"); - let _guard = - builder.msg_build(compiler, format_args!("codegen backend {}", backend.name()), target); + let _guard = builder.msg_rustc_tool( + Kind::Build, + build_compiler.stage, + format_args!("codegen backend {}", backend.name()), + build_compiler.host, + target, + ); let files = run_cargo(builder, cargo, vec![], &tmp_stamp, vec![], false, false); if builder.config.dry_run() { return; @@ -1700,10 +1694,17 @@ impl Step for CodegenBackend { f.display() ); } - let stamp = build_stamp::codegen_backend_stamp(builder, compiler, target, &backend); + let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, &backend); let codegen_backend = codegen_backend.to_str().unwrap(); t!(stamp.add_stamp(codegen_backend).write()); } + + fn metadata(&self) -> Option { + Some( + StepMetadata::build(&self.backend.crate_name(), self.compilers.target()) + .built_by(self.compilers.build_compiler()), + ) + } } /// Creates the `codegen-backends` folder for a compiler that's about to be @@ -2190,8 +2191,10 @@ impl Step for Assemble { continue; } builder.ensure(CodegenBackend { - compiler: build_compiler, - target: target_compiler.host, + compilers: RustcPrivateCompilers::from_build_and_target_compiler( + build_compiler, + target_compiler, + ), backend: backend.clone(), }); } @@ -2381,15 +2384,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 4699813abf42..cbbfb6b6a110 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}; @@ -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"); @@ -1172,7 +1195,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 +1211,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 +1221,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 +1249,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 +1265,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 +1275,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 +1290,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 +1308,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 +1318,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 +1338,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 +1356,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 +1373,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); @@ -1466,9 +1482,9 @@ impl Step for CodegenBackend { } } -#[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, } @@ -1484,7 +1500,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, @@ -1494,14 +1510,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); @@ -1548,7 +1563,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); } @@ -1568,12 +1583,12 @@ 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), 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 4513a138e192..f628330e9ed4 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); diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index b2056f5cf378..721ba6ca459e 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -1528,8 +1528,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 8bee00a9c137..66332c0b3e83 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -4,10 +4,12 @@ //! 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; @@ -17,7 +19,10 @@ 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::{ @@ -29,8 +34,8 @@ 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, CodegenBackendKind, DocTests, GitRepo, Mode, PathSet, debug, envify}; @@ -226,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, } @@ -239,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. @@ -247,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 @@ -262,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, } @@ -295,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, @@ -340,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`. @@ -352,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, ); @@ -364,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 { @@ -378,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 @@ -398,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, @@ -425,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 { @@ -438,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); } } @@ -542,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. @@ -599,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); } @@ -615,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)", @@ -692,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); } @@ -762,7 +806,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Clippy { - host: TargetSelection, + compilers: RustcPrivateCompilers, } impl Step for Clippy { @@ -775,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, @@ -800,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. @@ -831,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) { @@ -846,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("") @@ -884,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); } @@ -1043,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); @@ -1059,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) { @@ -1095,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", @@ -1737,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); @@ -1756,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" { @@ -1893,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; @@ -2272,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))) @@ -2456,7 +2502,7 @@ test_book!( #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ErrorIndex { - compiler: Compiler, + compilers: RustcPrivateCompilers, } impl Step for ErrorIndex { @@ -2474,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 @@ -2485,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); } } @@ -2595,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")] @@ -2800,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 => { diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index f5fa33b98f3b..7b0ef942abec 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,27 +331,6 @@ 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 { @@ -624,20 +588,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 +620,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 +643,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 +695,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 +718,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 +748,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 +761,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 +777,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 +793,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 +842,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 +853,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 +1055,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 +1080,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 +1100,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 +1139,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 +1159,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 +1167,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 +1316,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 +1415,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 +1432,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 +1442,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 +1460,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 +1493,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 +1536,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 +1565,7 @@ tool_extended!(Clippy { } } }); -tool_extended!(Miri { +tool_rustc_extended!(Miri { path: "src/tools/miri", tool_name: "miri", stable: false, @@ -1472,13 +1573,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 6b3236ef47ef..e10af2b55f9e 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); } @@ -508,7 +503,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 +817,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"), }; diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 20f3fee1c6cb..e15941938f19 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, }; @@ -1543,8 +1544,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 { @@ -1560,10 +1564,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")); @@ -1575,11 +1582,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); @@ -1604,7 +1614,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"); @@ -1613,7 +1623,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 } @@ -1728,11 +1738,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)); @@ -1744,7 +1754,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 f012645b7ef5..5361347da904 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,7 +938,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 + [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,15 @@ 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 dist_default_stage() { let ctx = TestCtx::new(); @@ -1047,8 +996,10 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [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 +1040,29 @@ mod snapshot { [build] rustc 1 -> LldWrapper 2 [build] rustc 1 -> WasmComponentLd 2 [build] rustc 1 -> LlvmBitcodeLinker 2 - [build] rustdoc 1 + [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 +1081,11 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [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 +1120,17 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [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 +1138,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 +1161,18 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [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 +1183,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,7 +1207,7 @@ mod snapshot { [build] rustc 0 -> rustc 1 [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 - [build] rustdoc 1 + [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 @@ -1273,30 +1239,35 @@ mod snapshot { [build] rustc 1 -> std 1 [build] rustc 1 -> rustc 2 [build] rustc 1 -> WasmComponentLd 2 - [build] rustdoc 1 + [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] 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 "); } @@ -1610,6 +1581,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,7 +1661,7 @@ mod snapshot { .render_steps(), @r" [build] llvm [build] rustc 0 -> rustc 1 - [build] rustdoc 0 + [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 +1675,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 +1690,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 +1720,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 +1736,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 6055876c4757..2c008f957d98 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -32,13 +32,18 @@ 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::{ @@ -89,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, @@ -442,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", @@ -469,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; @@ -489,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; @@ -499,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( @@ -556,220 +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_allow_stage0, - 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| { @@ -784,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() { @@ -800,21 +780,13 @@ 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.patch_binaries_for_nix = patch_binaries_for_nix; - config.bootstrap_cache_path = bootstrap_cache_path; - config.llvm_assertions = - toml.llvm.as_ref().is_some_and(|llvm| llvm.assertions.unwrap_or(false)); - - 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 { let dwn_ctx = DownloadContext::from(&config); @@ -836,12 +808,9 @@ 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 { let dwn_ctx = DownloadContext::from(&config); @@ -856,62 +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; - 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.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 = 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 @@ -924,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 = @@ -942,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(), @@ -955,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, @@ -977,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()); @@ -1005,9 +1270,18 @@ 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 { + config.initial_rustfmt = if let Some(r) = build_rustfmt { Some(r) } else { let dwn_ctx = DownloadContext::from(&config); @@ -1028,41 +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_allow_stage0 = compiletest_allow_stage0.unwrap_or(false); - 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. @@ -1512,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, @@ -1846,3 +2076,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/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 03da993a17dd..b95fb236fa16 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -1,22 +1,16 @@ //! 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, CodegenBackendKind, 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", @@ -424,7 +418,7 @@ pub(crate) fn parse_codegen_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()] } @@ -434,7 +428,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() } @@ -447,250 +441,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| parse_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 9dedadff3a19..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::parse_codegen_backends; use crate::core::config::{LlvmLibunwind, Merge, ReplaceOpt, SplitDebuginfo, StringOrBool}; -use crate::{CodegenBackendKind, 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. @@ -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(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") - }) - }); - - self.target_config.insert(TargetSelection::from_user(&triple), target); - } - } - } -} 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 e49513a21160..4abf386e5de6 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -517,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(), @@ -1105,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 @@ -1162,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) } diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs index 209ff3939731..7527dff9cd84 100644 --- a/src/bootstrap/src/utils/exec.rs +++ b/src/bootstrap/src/utils/exec.rs @@ -550,7 +550,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 +603,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 +629,7 @@ impl ExecutionContext { } pub fn is_verbose(&self) -> bool { - self.verbose > 0 + self.verbosity > 0 } pub fn fail_fast(&self) -> bool { @@ -640,8 +640,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) { 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/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/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/rust-version b/src/doc/rustc-dev-guide/rust-version index e9f1626f1fdd..6ec700b9b4dc 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -383b9c447b61641e1f1a3850253944a897a60827 +6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd 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 12b76828b5c3..378d8c4453f8 100644 --- a/src/doc/rustc-dev-guide/src/overview.md +++ b/src/doc/rustc-dev-guide/src/overview.md @@ -321,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/stability.md b/src/doc/rustc-dev-guide/src/stability.md index d0cee54adb6a..c26d34273d7e 100644 --- a/src/doc/rustc-dev-guide/src/stability.md +++ b/src/doc/rustc-dev-guide/src/stability.md @@ -181,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/tests/running.md b/src/doc/rustc-dev-guide/src/tests/running.md index f6e313062cda..317b65f98cd3 100644 --- a/src/doc/rustc-dev-guide/src/tests/running.md +++ b/src/doc/rustc-dev-guide/src/tests/running.md @@ -342,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/ @@ -350,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/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/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/attrs.rs b/src/tools/clippy/clippy_utils/src/attrs.rs index 4ccd9c5300b1..2d42e76dcbc9 100644 --- a/src/tools/clippy/clippy_utils/src/attrs.rs +++ b/src/tools/clippy/clippy_utils/src/attrs.rs @@ -2,9 +2,9 @@ use crate::source::SpanRangeExt; use crate::{sym, tokenize_with_text}; use rustc_ast::attr; use rustc_ast::attr::AttributeExt; -use rustc_hir::attrs::{AttributeKind}; -use rustc_hir::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/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 5b9b0ef30014..fc716d86fc62 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -83,19 +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_hir::attrs::{AttributeKind}; -use rustc_hir::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}; @@ -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; } @@ -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/msrvs.rs b/src/tools/clippy/clippy_utils/src/msrvs.rs index 480e0687756f..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_hir::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 79116eba971a..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_hir::{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; 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 02a8eda5893e..d79773f83211 100644 --- a/src/tools/clippy/clippy_utils/src/ty/mod.rs +++ b/src/tools/clippy/clippy_utils/src/ty/mod.rs @@ -6,13 +6,12 @@ use core::ops::ControlFlow; use itertools::Itertools; use rustc_abi::VariantIdx; use rustc_ast::ast::Mutability; -use rustc_hir::attrs::{AttributeKind}; -use rustc_hir::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; @@ -583,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/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 }}

{# #}