diff --git a/compiler/rustc_attr_parsing/src/attributes/lint.rs b/compiler/rustc_attr_parsing/src/attributes/lint.rs index e1221ecbb96d8..0c603faa4b5f9 100644 --- a/compiler/rustc_attr_parsing/src/attributes/lint.rs +++ b/compiler/rustc_attr_parsing/src/attributes/lint.rs @@ -7,7 +7,7 @@ use thin_vec::ThinVec; use crate::attributes::{AcceptMapping, AttributeParser, AttributeStability}; use crate::context::{AcceptContext, ExpectStringLiteral, FinalizeContext}; -use crate::parser::ArgParser; +use crate::parser::{ArgParser, MetaItemOrLitParser}; use crate::target_checking::AllowedTargets; use crate::target_checking::Policy::{Allow, Warn}; use crate::{AttributeTemplate, diagnostics, template}; @@ -37,7 +37,7 @@ impl LintParser { if !p.path().word_is(sym::reason) { cx.emit_err(diagnostics::MalformedAttribute { span: p.span(), - sub: diagnostics::MalformedAttributeSub::BadAttributeArgument(p.span()), + kind: diagnostics::MalformedAttributeKind::BadAttributeArgument(p.span()), }); } else { parsers = &parsers[..(parsers.len() - 1)]; @@ -48,58 +48,70 @@ impl LintParser { }; for item in parsers { - if let Some(p) = item.meta_item() { - match p.args() { - ArgParser::NoArgs => { - let (tool, lint_name, rest) = match &*p.path().0.segments { - [] => unreachable!(), - [lint_name] => (None, lint_name.ident.name, None), - [tool, lint_name] => (Some(tool.ident), lint_name.ident.name, None), - [tool, lint_name, rest @ ..] => { - let rest = rest - .iter() - .map(|s| s.ident.name) - .collect::>() - .into(); - (Some(tool.ident), lint_name.ident.name, Some(rest)) - } - }; + match item { + MetaItemOrLitParser::MetaItemParser(p) => { + match p.args() { + ArgParser::NoArgs => { + let (tool, lint_name, rest) = match &*p.path().0.segments { + [] => unreachable!(), + [lint_name] => (None, lint_name.ident.name, None), + [tool, lint_name] => { + (Some(tool.ident), lint_name.ident.name, None) + } + [tool, lint_name, rest @ ..] => { + let rest = rest + .iter() + .map(|s| s.ident.name) + .collect::>() + .into(); + (Some(tool.ident), lint_name.ident.name, Some(rest)) + } + }; - self.lints.push(LintCheck { - tool, - lint_name, - lint_span: p.span(), - kind, - attr_id, - reason, - attr_span, - rest, - }) - } - // We're found a `reason = "reason"` but we're not the last element. - ArgParser::NameValue(nv) if p.path().word_is(sym::reason) => { - cx.emit_err(diagnostics::MalformedAttribute { - span: p.span(), - sub: diagnostics::MalformedAttributeSub::ReasonMustComeLast( - item.span(), - ), - }); - nv.expect_string_literal(cx); - } - ArgParser::NameValue(_) | ArgParser::List(_) => { - cx.emit_err(diagnostics::MalformedAttribute { - span: p.span(), - sub: diagnostics::MalformedAttributeSub::BadAttributeArgument( - item.span(), - ), - }); + self.lints.push(LintCheck { + tool, + lint_name, + lint_span: p.span(), + kind, + attr_id, + reason, + attr_span, + rest, + }) + } + // We've found a `reason = "reason"` but we're not the last element. + ArgParser::NameValue(nv) if p.path().word_is(sym::reason) => { + cx.emit_err(diagnostics::MalformedAttribute { + span: p.span(), + kind: diagnostics::MalformedAttributeKind::ReasonMustComeLast( + item.span(), + ), + }); + nv.expect_string_literal(cx); + } + ArgParser::NameValue(_) | ArgParser::List(_) => { + cx.emit_err(diagnostics::MalformedAttribute { + span: p.span(), + kind: diagnostics::MalformedAttributeKind::BadAttributeArgument( + item.span(), + ), + }); + } } } - } else { - cx.emit_err(diagnostics::MalformedAttribute { - span: item.span(), - sub: diagnostics::MalformedAttributeSub::BadAttributeArgument(item.span()), - }); + MetaItemOrLitParser::Lit(lit) => { + cx.emit_err(diagnostics::BadAttributeLit { + span: item.span(), + help: if lit.kind.is_str() { + diagnostics::BadAttributeLitHelp::StrLit { + sym: lit.symbol, + kind: kind.sym(), + } + } else { + diagnostics::BadAttributeLitHelp::Other { kind: kind.sym() } + }, + }); + } } } if parsers.is_empty() { diff --git a/compiler/rustc_attr_parsing/src/diagnostics.rs b/compiler/rustc_attr_parsing/src/diagnostics.rs index b55d7e476896b..848ab845dc7f6 100644 --- a/compiler/rustc_attr_parsing/src/diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/diagnostics.rs @@ -2139,17 +2139,35 @@ pub(crate) struct MalformedAttribute { #[primary_span] pub span: Span, #[subdiagnostic] - pub sub: MalformedAttributeSub, + pub kind: MalformedAttributeKind, } #[derive(Subdiagnostic)] -pub(crate) enum MalformedAttributeSub { +pub(crate) enum MalformedAttributeKind { #[label("bad attribute argument")] BadAttributeArgument(#[primary_span] Span), #[label("reason in lint attribute must come last")] ReasonMustComeLast(#[primary_span] Span), } +#[derive(Diagnostic)] +#[diag("expected a lint, found literal")] +pub(crate) struct BadAttributeLit { + #[primary_span] + #[label("not the name of a lint")] + pub span: Span, + #[subdiagnostic] + pub help: BadAttributeLitHelp, +} + +#[derive(Subdiagnostic)] +pub(crate) enum BadAttributeLitHelp { + #[help("try using `#[{$kind}({$sym})]`")] + StrLit { sym: Symbol, kind: Symbol }, + #[help("for example, write `#[{$kind}(dead_code)]` for `dead_code`")] + Other { kind: Symbol }, +} + #[derive(Subdiagnostic)] pub(crate) enum UnusedNote { #[note("attribute `{$name}` with an empty list has no effect")] diff --git a/library/alloc/src/io/copy.rs b/library/alloc/src/io/copy.rs index 798bd2c1ec0a0..f414078d3a0b5 100644 --- a/library/alloc/src/io/copy.rs +++ b/library/alloc/src/io/copy.rs @@ -75,6 +75,7 @@ pub enum CopyState { /// descriptors if possible. /// /// Note that platform-specific behavior may change in the future. +#[doc(alias = "copy_file_range", alias = "sendfile", alias = "splice")] #[stable(feature = "rust1", since = "1.0.0")] pub fn copy(reader: &mut R, writer: &mut W) -> Result where diff --git a/library/core/src/arch.rs b/library/core/src/arch.rs index 04fc16f50085b..92ff55ecc75c0 100644 --- a/library/core/src/arch.rs +++ b/library/core/src/arch.rs @@ -68,7 +68,12 @@ pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))? /// The precise behavior is not guaranteed, it depends on the architecture and operating system. /// Not all architectures guarantee that a breakpoint instruction interrupts execution in the absence /// of a debugger, and not all operating systems and execution environments guarantee that such an -/// interrupt aborts the current process. +/// interrupt aborts the current process. On operating systems where the behavior of the interrupt +/// can be overwritten by the application (e.g. via a SIGTRAP signal handler), the application +/// *should* make sure to still abort the process. However, code not fully in control of that +/// application state (e.g. signal handlers) cannot always rely on that for soundness. +/// If you do rely on this, such that your code's soundness requires applications to not continue +/// from your breakpoints, please document that for your users. /// /// The precise instruction is guaranteed only on the following targets: /// - On x86 targets, this produces an `int3` instruction. diff --git a/library/core/src/panic.rs b/library/core/src/panic.rs index 4fcd5f615e993..52fcfebd1111c 100644 --- a/library/core/src/panic.rs +++ b/library/core/src/panic.rs @@ -97,8 +97,9 @@ pub macro unreachable_2021 { /// Invokes a closure, aborting if the closure unwinds. /// /// When compiled with aborting panics, this function is effectively a no-op. -/// With unwinding panics, an unwind results in another call into the panic -/// hook followed by a process abort. +/// With unwinding panics, an unwind that would leave the closure results in another call into the +/// panic handler / panic hook followed by a process abort. (Locals in the closure get dropped as +/// usual.) Unwinds that get caught inside the closure still behave as normal. /// /// # Notes /// @@ -114,7 +115,7 @@ pub macro unreachable_2021 { /// to prevent unwinds. However, note that `extern "C" fn` will automatically /// convert unwinds to aborts, so using this function isn't necessary for FFI. #[unstable(feature = "abort_unwind", issue = "130338")] -#[rustc_nounwind] +#[rustc_nounwind] // this attribute does all the actual work here pub fn abort_on_unwind R, R>(f: F) -> R { f() } diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index c668e6216fd4b..f922696298fff 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -3039,7 +3039,7 @@ pub fn remove_file>(path: P) -> io::Result<()> { /// Ok(()) /// } /// ``` -#[doc(alias = "stat")] +#[doc(alias = "stat", alias = "GetFileAttributes", alias = "GetFileAttributesEx")] #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "fs_metadata")] pub fn metadata>(path: P) -> io::Result { @@ -3080,7 +3080,7 @@ pub fn metadata>(path: P) -> io::Result { /// Ok(()) /// } /// ``` -#[doc(alias = "lstat")] +#[doc(alias = "lstat", alias = "GetFileAttributes", alias = "GetFileAttributesEx")] #[stable(feature = "symlink_metadata", since = "1.1.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "fs_symlink_metadata")] pub fn symlink_metadata>(path: P) -> io::Result { @@ -3262,6 +3262,7 @@ pub fn rename_noreplace, Q: AsRef>(from: P, to: Q) -> io::R /// } /// ``` #[doc(alias = "cp")] +#[doc(alias = "copy_file_range")] #[doc(alias = "CopyFile", alias = "CopyFileEx")] #[doc(alias = "fclonefileat", alias = "fcopyfile")] #[stable(feature = "rust1", since = "1.0.0")] @@ -3511,6 +3512,7 @@ pub fn create_dir>(path: P) -> io::Result<()> { /// Ok(()) /// } /// ``` +#[doc(alias = "mkdir", alias = "CreateDirectory")] #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "fs_create_dir_all")] pub fn create_dir_all>(path: P) -> io::Result<()> { @@ -3626,6 +3628,7 @@ pub fn remove_dir>(path: P) -> io::Result<()> { /// Ok(()) /// } /// ``` +#[doc(alias = "rm")] #[stable(feature = "rust1", since = "1.0.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "fs_remove_dir_all")] pub fn remove_dir_all>(path: P) -> io::Result<()> { diff --git a/library/std/src/os/windows/fs.rs b/library/std/src/os/windows/fs.rs index 4c2506ffae66c..865cc90e83156 100644 --- a/library/std/src/os/windows/fs.rs +++ b/library/std/src/os/windows/fs.rs @@ -908,6 +908,7 @@ impl FileTimesExt for fs::FileTimes { /// the process as an administrator. /// /// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links +#[doc(alias = "CreateSymbolicLink", alias = "CreateSymbolicLinkW")] #[stable(feature = "symlink", since = "1.1.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "fs_symlink_file")] pub fn symlink_file, Q: AsRef>(original: P, link: Q) -> io::Result<()> { @@ -949,6 +950,7 @@ pub fn symlink_file, Q: AsRef>(original: P, link: Q) -> io: /// the process as an administrator. /// /// [symlink-security]: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links +#[doc(alias = "CreateSymbolicLink", alias = "CreateSymbolicLinkW")] #[stable(feature = "symlink", since = "1.1.0")] #[cfg_attr(not(test), rustc_diagnostic_item = "fs_symlink_dir")] pub fn symlink_dir, Q: AsRef>(original: P, link: Q) -> io::Result<()> { diff --git a/library/stdarch/.github/workflows/main.yml b/library/stdarch/.github/workflows/main.yml index d7539fe2e8ebd..bf8ad2e293e7f 100644 --- a/library/stdarch/.github/workflows/main.yml +++ b/library/stdarch/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: name: Check Style runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: rustup update nightly --no-self-update && rustup default nightly - run: ci/style.sh @@ -18,7 +18,7 @@ jobs: needs: [ style ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: rustup update nightly --no-self-update && rustup default nightly - run: ci/dox.sh @@ -30,7 +30,7 @@ jobs: needs: [ style ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: rustup update nightly --no-self-update && rustup default nightly - run: cargo test --manifest-path crates/stdarch-verify/Cargo.toml @@ -218,7 +218,7 @@ jobs: # build_std: true steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: | rustup update nightly --no-self-update @@ -298,7 +298,7 @@ jobs: - target: armv7-unknown-linux-gnueabihf cc: gcc steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: | rustup update nightly --no-self-update @@ -326,7 +326,7 @@ jobs: env: STDARCH_GEN_MODE: check steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: rustup update nightly && rustup default nightly && rustup component add rustfmt - name: Check arm spec @@ -352,7 +352,7 @@ jobs: name: Run some tests with miri runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: Install Rust run: rustup update nightly && rustup default nightly && rustup component add miri - name: Run miri tests diff --git a/library/stdarch/.github/workflows/rustc-pull.yml b/library/stdarch/.github/workflows/rustc-pull.yml index d2feb1add6344..96cf9285ec10b 100644 --- a/library/stdarch/.github/workflows/rustc-pull.yml +++ b/library/stdarch/.github/workflows/rustc-pull.yml @@ -10,6 +10,7 @@ on: jobs: pull: if: github.repository == 'rust-lang/stdarch' + # zizmor: ignore[unpinned-uses] We explicitly want to track the main branch. uses: rust-lang/josh-sync/.github/workflows/rustc-pull.yml@main with: github-app-id: ${{ vars.APP_CLIENT_ID }} 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 cfc4aced34173..70560f8b5a68d 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/generated.rs @@ -91,6 +91,22 @@ unsafe extern "llvm-intrinsic" { 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; + #[link_name = "llvm.loongarch.lasx.xvdiv.b"] + 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; + #[link_name = "llvm.loongarch.lasx.xvdiv.w"] + 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; + #[link_name = "llvm.loongarch.lasx.xvdiv.bu"] + 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; + #[link_name = "llvm.loongarch.lasx.xvdiv.wu"] + 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; #[link_name = "llvm.loongarch.lasx.xvhaddw.h.b"] fn __lasx_xvhaddw_h_b(a: __v32i8, b: __v32i8) -> __v16i16; #[link_name = "llvm.loongarch.lasx.xvhaddw.w.h"] @@ -115,6 +131,22 @@ unsafe extern "llvm-intrinsic" { 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; + #[link_name = "llvm.loongarch.lasx.xvmod.b"] + 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; + #[link_name = "llvm.loongarch.lasx.xvmod.w"] + 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; + #[link_name = "llvm.loongarch.lasx.xvmod.bu"] + 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; + #[link_name = "llvm.loongarch.lasx.xvmod.wu"] + 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; #[link_name = "llvm.loongarch.lasx.xvshuf.b"] fn __lasx_xvshuf_b(a: __v32i8, b: __v32i8, c: __v32i8) -> __v32i8; #[link_name = "llvm.loongarch.lasx.xvshuf.h"] @@ -1251,6 +1283,62 @@ pub fn lasx_xvsat_du(a: m256i) -> m256i { unsafe { transmute(__lasx_xvsat_du(transmute(a), IMM6)) } } +#[inline] +#[target_feature(enable = "lasx")] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +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: 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: 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: 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: 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: 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: 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: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvdiv_du(transmute(a), transmute(b))) } +} + #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -1335,6 +1423,62 @@ 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: 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: 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: 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: 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: 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: 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: 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: m256i, b: m256i) -> m256i { + unsafe { transmute(__lasx_xvmod_du(transmute(a), transmute(b))) } +} + #[inline] #[target_feature(enable = "lasx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs b/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs index d53f21c792626..fe45ed6543dfb 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lasx/portable.rs @@ -681,22 +681,6 @@ impl_vvv!("lasx", lasx_xvmul_b, simd_mul, m256i, i8x32); impl_vvv!("lasx", lasx_xvmul_h, simd_mul, m256i, i16x16); impl_vvv!("lasx", lasx_xvmul_w, simd_mul, m256i, i32x8); impl_vvv!("lasx", lasx_xvmul_d, simd_mul, m256i, i64x4); -impl_vvv!("lasx", lasx_xvdiv_b, simd_div, m256i, i8x32); -impl_vvv!("lasx", lasx_xvdiv_h, simd_div, m256i, i16x16); -impl_vvv!("lasx", lasx_xvdiv_w, simd_div, m256i, i32x8); -impl_vvv!("lasx", lasx_xvdiv_d, simd_div, m256i, i64x4); -impl_vvv!("lasx", lasx_xvdiv_bu, simd_div, m256i, u8x32); -impl_vvv!("lasx", lasx_xvdiv_hu, simd_div, m256i, u16x16); -impl_vvv!("lasx", lasx_xvdiv_wu, simd_div, m256i, u32x8); -impl_vvv!("lasx", lasx_xvdiv_du, simd_div, m256i, u64x4); -impl_vvv!("lasx", lasx_xvmod_b, simd_rem, m256i, i8x32); -impl_vvv!("lasx", lasx_xvmod_h, simd_rem, m256i, i16x16); -impl_vvv!("lasx", lasx_xvmod_w, simd_rem, m256i, i32x8); -impl_vvv!("lasx", lasx_xvmod_d, simd_rem, m256i, i64x4); -impl_vvv!("lasx", lasx_xvmod_bu, simd_rem, m256i, u8x32); -impl_vvv!("lasx", lasx_xvmod_hu, simd_rem, m256i, u16x16); -impl_vvv!("lasx", lasx_xvmod_wu, simd_rem, m256i, u32x8); -impl_vvv!("lasx", lasx_xvmod_du, simd_rem, m256i, u64x4); impl_vvv!("lasx", lasx_xvand_v, simd_and, m256i, u8x32); impl_vvv!("lasx", lasx_xvandn_v, simd_ext_andn, m256i, u8x32); impl_vvv!("lasx", lasx_xvor_v, simd_or, m256i, u8x32); 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 aa4e31ce8da6c..601b40467c6b2 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/generated.rs @@ -91,6 +91,22 @@ unsafe extern "llvm-intrinsic" { 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; + #[link_name = "llvm.loongarch.lsx.vdiv.b"] + 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; + #[link_name = "llvm.loongarch.lsx.vdiv.w"] + 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; + #[link_name = "llvm.loongarch.lsx.vdiv.bu"] + 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; + #[link_name = "llvm.loongarch.lsx.vdiv.wu"] + 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; #[link_name = "llvm.loongarch.lsx.vhaddw.h.b"] fn __lsx_vhaddw_h_b(a: __v16i8, b: __v16i8) -> __v8i16; #[link_name = "llvm.loongarch.lsx.vhaddw.w.h"] @@ -115,6 +131,22 @@ unsafe extern "llvm-intrinsic" { 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; + #[link_name = "llvm.loongarch.lsx.vmod.b"] + 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; + #[link_name = "llvm.loongarch.lsx.vmod.w"] + 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; + #[link_name = "llvm.loongarch.lsx.vmod.bu"] + 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; + #[link_name = "llvm.loongarch.lsx.vmod.wu"] + 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; #[link_name = "llvm.loongarch.lsx.vreplve.b"] fn __lsx_vreplve_b(a: __v16i8, b: i32) -> __v16i8; #[link_name = "llvm.loongarch.lsx.vreplve.h"] @@ -1171,6 +1203,62 @@ pub fn lsx_vsat_du(a: m128i) -> m128i { unsafe { transmute(__lsx_vsat_du(transmute(a), IMM6)) } } +#[inline] +#[target_feature(enable = "lsx")] +#[unstable(feature = "stdarch_loongarch", issue = "117427")] +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: 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: 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: 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: 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: 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: 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: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vdiv_du(transmute(a), transmute(b))) } +} + #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] @@ -1255,6 +1343,62 @@ 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: 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: 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: 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: 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: 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: 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: 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: m128i, b: m128i) -> m128i { + unsafe { transmute(__lsx_vmod_du(transmute(a), transmute(b))) } +} + #[inline] #[target_feature(enable = "lsx")] #[unstable(feature = "stdarch_loongarch", issue = "117427")] diff --git a/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs b/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs index 2b5bfe1ab4d2b..f2b86dae00af8 100644 --- a/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs +++ b/library/stdarch/crates/core_arch/src/loongarch64/lsx/portable.rs @@ -351,22 +351,6 @@ impl_vvv!("lsx", lsx_vmul_b, simd_mul, m128i, i8x16); impl_vvv!("lsx", lsx_vmul_h, simd_mul, m128i, i16x8); impl_vvv!("lsx", lsx_vmul_w, simd_mul, m128i, i32x4); impl_vvv!("lsx", lsx_vmul_d, simd_mul, m128i, i64x2); -impl_vvv!("lsx", lsx_vdiv_b, simd_div, m128i, i8x16); -impl_vvv!("lsx", lsx_vdiv_h, simd_div, m128i, i16x8); -impl_vvv!("lsx", lsx_vdiv_w, simd_div, m128i, i32x4); -impl_vvv!("lsx", lsx_vdiv_d, simd_div, m128i, i64x2); -impl_vvv!("lsx", lsx_vdiv_bu, simd_div, m128i, u8x16); -impl_vvv!("lsx", lsx_vdiv_hu, simd_div, m128i, u16x8); -impl_vvv!("lsx", lsx_vdiv_wu, simd_div, m128i, u32x4); -impl_vvv!("lsx", lsx_vdiv_du, simd_div, m128i, u64x2); -impl_vvv!("lsx", lsx_vmod_b, simd_rem, m128i, i8x16); -impl_vvv!("lsx", lsx_vmod_h, simd_rem, m128i, i16x8); -impl_vvv!("lsx", lsx_vmod_w, simd_rem, m128i, i32x4); -impl_vvv!("lsx", lsx_vmod_d, simd_rem, m128i, i64x2); -impl_vvv!("lsx", lsx_vmod_bu, simd_rem, m128i, u8x16); -impl_vvv!("lsx", lsx_vmod_hu, simd_rem, m128i, u16x8); -impl_vvv!("lsx", lsx_vmod_wu, simd_rem, m128i, u32x4); -impl_vvv!("lsx", lsx_vmod_du, simd_rem, m128i, u64x2); impl_vvv!("lsx", lsx_vand_v, simd_and, m128i, u8x16); impl_vvv!("lsx", lsx_vandn_v, simd_ext_andn, m128i, u8x16); impl_vvv!("lsx", lsx_vor_v, simd_or, m128i, u8x16); diff --git a/library/stdarch/crates/core_arch/src/nvptx/packed.rs b/library/stdarch/crates/core_arch/src/nvptx/packed.rs index 4933a601231f5..99220038e23a2 100644 --- a/library/stdarch/crates/core_arch/src/nvptx/packed.rs +++ b/library/stdarch/crates/core_arch/src/nvptx/packed.rs @@ -30,7 +30,7 @@ types! { /// - [`__hadd2`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__ARITHMETIC.html#group__CUDA__MATH____HALF2__ARITHMETIC_1g921c795176eaa31265bd80ef4fe4b8e6) /// - [`__hadd2_rn`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__ARITHMETIC.html#group__CUDA__MATH____HALF2__ARITHMETIC_1g6cd8ddb2c3d670e1a10c3eb2e7644f82) #[inline] -#[cfg_attr(test, assert_instr(add.rn.f16x22))] +#[cfg_attr(test, assert_instr(add.rn.f16x2))] #[unstable(feature = "stdarch_nvptx", issue = "111199")] pub unsafe fn f16x2_add(a: f16x2, b: f16x2) -> f16x2 { simd_add(a, b) @@ -68,9 +68,7 @@ pub unsafe fn f16x2_mul(a: f16x2, b: f16x2) -> f16x2 { /// /// /// -/// Corresponds to the CUDA C intrinsics: -/// - [`__fma2`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__ARITHMETIC.html#group__CUDA__MATH____HALF2__ARITHMETIC_1g43628ba21ded8b1e188a367348008dab) -/// - [`__fma2_rn`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__ARITHMETIC.html#group__CUDA__MATH____HALF2__ARITHMETIC_1g43628ba21ded8b1e188a367348008dab) +/// Corresponds to the CUDA C intrinsic [`__hfma2`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__ARITHMETIC.html#group__CUDA__MATH____HALF2__ARITHMETIC_1g43628ba21ded8b1e188a367348008dab) #[inline] #[cfg_attr(test, assert_instr(fma.rn.f16x2))] #[unstable(feature = "stdarch_nvptx", issue = "111199")] @@ -82,7 +80,7 @@ pub unsafe fn f16x2_fma(a: f16x2, b: f16x2, c: f16x2) -> f16x2 { /// /// /// -/// Corresponds to the CUDA C intrinsic [`__hmin2`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__COMPARISON.html#group__CUDA__MATH____HALF2__COMPARISON_1g9e17a33f96061804166f3fbd395422b6) +/// Corresponds to the CUDA C intrinsic [`__hneg2`](https://docs.nvidia.com/cuda/cuda-math-api/group__CUDA__MATH____HALF2__ARITHMETIC.html#group__CUDA__MATH____HALF2__ARITHMETIC_1g90e216094729014f541fa1e5a5aaeaf7) #[inline] #[cfg_attr(test, assert_instr(neg.f16x2))] #[unstable(feature = "stdarch_nvptx", issue = "111199")] diff --git a/library/stdarch/crates/core_arch/src/x86/avx2.rs b/library/stdarch/crates/core_arch/src/x86/avx2.rs index 7ad45421cf89f..168871188868b 100644 --- a/library/stdarch/crates/core_arch/src/x86/avx2.rs +++ b/library/stdarch/crates/core_arch/src/x86/avx2.rs @@ -290,14 +290,8 @@ pub const fn _mm256_andnot_si256(a: __m256i, b: __m256i) -> __m256i { #[target_feature(enable = "avx2")] #[cfg_attr(test, assert_instr(vpavgw))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_avg_epu16(a: __m256i, b: __m256i) -> __m256i { - unsafe { - let a = simd_cast::<_, u32x16>(a.as_u16x16()); - let b = simd_cast::<_, u32x16>(b.as_u16x16()); - let r = simd_shr(simd_add(simd_add(a, b), u32x16::splat(1)), u32x16::splat(1)); - transmute(simd_cast::<_, u16x16>(r)) - } +pub fn _mm256_avg_epu16(a: __m256i, b: __m256i) -> __m256i { + unsafe { transmute(pavgw(a.as_u16x16(), b.as_u16x16())) } } /// Averages packed unsigned 8-bit integers in `a` and `b`. @@ -307,14 +301,8 @@ pub const fn _mm256_avg_epu16(a: __m256i, b: __m256i) -> __m256i { #[target_feature(enable = "avx2")] #[cfg_attr(test, assert_instr(vpavgb))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_avg_epu8(a: __m256i, b: __m256i) -> __m256i { - unsafe { - let a = simd_cast::<_, u16x32>(a.as_u8x32()); - let b = simd_cast::<_, u16x32>(b.as_u8x32()); - let r = simd_shr(simd_add(simd_add(a, b), u16x32::splat(1)), u16x32::splat(1)); - transmute(simd_cast::<_, u8x32>(r)) - } +pub fn _mm256_avg_epu8(a: __m256i, b: __m256i) -> __m256i { + unsafe { transmute(pavgb(a.as_u8x32(), b.as_u8x32())) } } /// Blends packed 32-bit integers from `a` and `b` using control mask `IMM4`. @@ -2231,14 +2219,8 @@ pub const fn _mm256_mul_epu32(a: __m256i, b: __m256i) -> __m256i { #[target_feature(enable = "avx2")] #[cfg_attr(test, assert_instr(vpmulhw))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_mulhi_epi16(a: __m256i, b: __m256i) -> __m256i { - unsafe { - let a = simd_cast::<_, i32x16>(a.as_i16x16()); - let b = simd_cast::<_, i32x16>(b.as_i16x16()); - let r = simd_shr(simd_mul(a, b), i32x16::splat(16)); - transmute(simd_cast::(r)) - } +pub fn _mm256_mulhi_epi16(a: __m256i, b: __m256i) -> __m256i { + unsafe { transmute(pmulhw(a.as_i16x16(), b.as_i16x16())) } } /// Multiplies the packed unsigned 16-bit integers in `a` and `b`, producing @@ -2250,14 +2232,8 @@ pub const fn _mm256_mulhi_epi16(a: __m256i, b: __m256i) -> __m256i { #[target_feature(enable = "avx2")] #[cfg_attr(test, assert_instr(vpmulhuw))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_mulhi_epu16(a: __m256i, b: __m256i) -> __m256i { - unsafe { - let a = simd_cast::<_, u32x16>(a.as_u16x16()); - let b = simd_cast::<_, u32x16>(b.as_u16x16()); - let r = simd_shr(simd_mul(a, b), u32x16::splat(16)); - transmute(simd_cast::(r)) - } +pub fn _mm256_mulhi_epu16(a: __m256i, b: __m256i) -> __m256i { + unsafe { transmute(pmulhuw(a.as_u16x16(), b.as_u16x16())) } } /// Multiplies the packed 16-bit integers in `a` and `b`, producing @@ -3759,12 +3735,20 @@ pub const fn _mm256_extract_epi16(a: __m256i) -> i32 { #[allow(improper_ctypes)] unsafe extern "llvm-intrinsic" { + #[link_name = "llvm.x86.avx2.pavg.b"] + fn pavgb(a: u8x32, b: u8x32) -> u8x32; + #[link_name = "llvm.x86.avx2.pavg.w"] + fn pavgw(a: u16x16, b: u16x16) -> u16x16; #[link_name = "llvm.x86.avx2.pmadd.wd"] fn pmaddwd(a: i16x16, b: i16x16) -> i32x8; #[link_name = "llvm.x86.avx2.pmadd.ub.sw"] fn pmaddubsw(a: u8x32, b: i8x32) -> i16x16; #[link_name = "llvm.x86.avx2.mpsadbw"] fn mpsadbw(a: u8x32, b: u8x32, imm8: i8) -> u16x16; + #[link_name = "llvm.x86.avx2.pmulhu.w"] + fn pmulhuw(a: u16x16, b: u16x16) -> u16x16; + #[link_name = "llvm.x86.avx2.pmulh.w"] + fn pmulhw(a: i16x16, b: i16x16) -> i16x16; #[link_name = "llvm.x86.avx2.pmul.hr.sw"] fn pmulhrsw(a: i16x16, b: i16x16) -> i16x16; #[link_name = "llvm.x86.avx2.packsswb"] @@ -4186,14 +4170,14 @@ mod tests { } #[simd_test(enable = "avx2")] - const fn test_mm256_avg_epu8() { + fn test_mm256_avg_epu8() { let (a, b) = (_mm256_set1_epi8(3), _mm256_set1_epi8(9)); let r = _mm256_avg_epu8(a, b); assert_eq_m256i(r, _mm256_set1_epi8(6)); } #[simd_test(enable = "avx2")] - const fn test_mm256_avg_epu16() { + fn test_mm256_avg_epu16() { let (a, b) = (_mm256_set1_epi16(3), _mm256_set1_epi16(9)); let r = _mm256_avg_epu16(a, b); assert_eq_m256i(r, _mm256_set1_epi16(6)); @@ -4895,7 +4879,7 @@ mod tests { } #[simd_test(enable = "avx2")] - const fn test_mm256_mulhi_epi16() { + fn test_mm256_mulhi_epi16() { let a = _mm256_set1_epi16(6535); let b = _mm256_set1_epi16(6535); let r = _mm256_mulhi_epi16(a, b); @@ -4904,7 +4888,7 @@ mod tests { } #[simd_test(enable = "avx2")] - const fn test_mm256_mulhi_epu16() { + fn test_mm256_mulhi_epu16() { let a = _mm256_set1_epi16(6535); let b = _mm256_set1_epi16(6535); let r = _mm256_mulhi_epu16(a, b); diff --git a/library/stdarch/crates/core_arch/src/x86/avx512bw.rs b/library/stdarch/crates/core_arch/src/x86/avx512bw.rs index e400453f627bc..bc119870fa99a 100644 --- a/library/stdarch/crates/core_arch/src/x86/avx512bw.rs +++ b/library/stdarch/crates/core_arch/src/x86/avx512bw.rs @@ -1450,14 +1450,8 @@ pub const fn _mm_maskz_subs_epi8(k: __mmask16, a: __m128i, b: __m128i) -> __m128 #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_mulhi_epu16(a: __m512i, b: __m512i) -> __m512i { - unsafe { - let a = simd_cast::<_, u32x32>(a.as_u16x32()); - let b = simd_cast::<_, u32x32>(b.as_u16x32()); - let r = simd_shr(simd_mul(a, b), u32x32::splat(16)); - transmute(simd_cast::(r)) - } +pub fn _mm512_mulhi_epu16(a: __m512i, b: __m512i) -> __m512i { + unsafe { transmute(vpmulhuw(a.as_u16x32(), b.as_u16x32())) } } /// Multiply the packed unsigned 16-bit integers in a and b, producing intermediate 32-bit integers, and store the high 16 bits of the intermediate integers in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -1467,13 +1461,7 @@ pub const fn _mm512_mulhi_epu16(a: __m512i, b: __m512i) -> __m512i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_mask_mulhi_epu16( - src: __m512i, - k: __mmask32, - a: __m512i, - b: __m512i, -) -> __m512i { +pub fn _mm512_mask_mulhi_epu16(src: __m512i, k: __mmask32, a: __m512i, b: __m512i) -> __m512i { unsafe { let mul = _mm512_mulhi_epu16(a, b).as_u16x32(); transmute(simd_select_bitmask(k, mul, src.as_u16x32())) @@ -1487,8 +1475,7 @@ pub const fn _mm512_mask_mulhi_epu16( #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_maskz_mulhi_epu16(k: __mmask32, a: __m512i, b: __m512i) -> __m512i { +pub fn _mm512_maskz_mulhi_epu16(k: __mmask32, a: __m512i, b: __m512i) -> __m512i { unsafe { let mul = _mm512_mulhi_epu16(a, b).as_u16x32(); transmute(simd_select_bitmask(k, mul, u16x32::ZERO)) @@ -1502,13 +1489,7 @@ pub const fn _mm512_maskz_mulhi_epu16(k: __mmask32, a: __m512i, b: __m512i) -> _ #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_mask_mulhi_epu16( - src: __m256i, - k: __mmask16, - a: __m256i, - b: __m256i, -) -> __m256i { +pub fn _mm256_mask_mulhi_epu16(src: __m256i, k: __mmask16, a: __m256i, b: __m256i) -> __m256i { unsafe { let mul = _mm256_mulhi_epu16(a, b).as_u16x16(); transmute(simd_select_bitmask(k, mul, src.as_u16x16())) @@ -1522,8 +1503,7 @@ pub const fn _mm256_mask_mulhi_epu16( #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_maskz_mulhi_epu16(k: __mmask16, a: __m256i, b: __m256i) -> __m256i { +pub fn _mm256_maskz_mulhi_epu16(k: __mmask16, a: __m256i, b: __m256i) -> __m256i { unsafe { let mul = _mm256_mulhi_epu16(a, b).as_u16x16(); transmute(simd_select_bitmask(k, mul, u16x16::ZERO)) @@ -1537,8 +1517,7 @@ pub const fn _mm256_maskz_mulhi_epu16(k: __mmask16, a: __m256i, b: __m256i) -> _ #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_mask_mulhi_epu16(src: __m128i, k: __mmask8, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_mask_mulhi_epu16(src: __m128i, k: __mmask8, a: __m128i, b: __m128i) -> __m128i { unsafe { let mul = _mm_mulhi_epu16(a, b).as_u16x8(); transmute(simd_select_bitmask(k, mul, src.as_u16x8())) @@ -1552,8 +1531,7 @@ pub const fn _mm_mask_mulhi_epu16(src: __m128i, k: __mmask8, a: __m128i, b: __m1 #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhuw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_maskz_mulhi_epu16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_maskz_mulhi_epu16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i { unsafe { let mul = _mm_mulhi_epu16(a, b).as_u16x8(); transmute(simd_select_bitmask(k, mul, u16x8::ZERO)) @@ -1567,14 +1545,8 @@ pub const fn _mm_maskz_mulhi_epu16(k: __mmask8, a: __m128i, b: __m128i) -> __m12 #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_mulhi_epi16(a: __m512i, b: __m512i) -> __m512i { - unsafe { - let a = simd_cast::<_, i32x32>(a.as_i16x32()); - let b = simd_cast::<_, i32x32>(b.as_i16x32()); - let r = simd_shr(simd_mul(a, b), i32x32::splat(16)); - transmute(simd_cast::(r)) - } +pub fn _mm512_mulhi_epi16(a: __m512i, b: __m512i) -> __m512i { + unsafe { transmute(vpmulhw(a.as_i16x32(), b.as_i16x32())) } } /// Multiply the packed signed 16-bit integers in a and b, producing intermediate 32-bit integers, and store the high 16 bits of the intermediate integers in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -1584,13 +1556,7 @@ pub const fn _mm512_mulhi_epi16(a: __m512i, b: __m512i) -> __m512i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_mask_mulhi_epi16( - src: __m512i, - k: __mmask32, - a: __m512i, - b: __m512i, -) -> __m512i { +pub fn _mm512_mask_mulhi_epi16(src: __m512i, k: __mmask32, a: __m512i, b: __m512i) -> __m512i { unsafe { let mul = _mm512_mulhi_epi16(a, b).as_i16x32(); transmute(simd_select_bitmask(k, mul, src.as_i16x32())) @@ -1604,8 +1570,7 @@ pub const fn _mm512_mask_mulhi_epi16( #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_maskz_mulhi_epi16(k: __mmask32, a: __m512i, b: __m512i) -> __m512i { +pub fn _mm512_maskz_mulhi_epi16(k: __mmask32, a: __m512i, b: __m512i) -> __m512i { unsafe { let mul = _mm512_mulhi_epi16(a, b).as_i16x32(); transmute(simd_select_bitmask(k, mul, i16x32::ZERO)) @@ -1619,13 +1584,7 @@ pub const fn _mm512_maskz_mulhi_epi16(k: __mmask32, a: __m512i, b: __m512i) -> _ #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_mask_mulhi_epi16( - src: __m256i, - k: __mmask16, - a: __m256i, - b: __m256i, -) -> __m256i { +pub fn _mm256_mask_mulhi_epi16(src: __m256i, k: __mmask16, a: __m256i, b: __m256i) -> __m256i { unsafe { let mul = _mm256_mulhi_epi16(a, b).as_i16x16(); transmute(simd_select_bitmask(k, mul, src.as_i16x16())) @@ -1639,8 +1598,7 @@ pub const fn _mm256_mask_mulhi_epi16( #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_maskz_mulhi_epi16(k: __mmask16, a: __m256i, b: __m256i) -> __m256i { +pub fn _mm256_maskz_mulhi_epi16(k: __mmask16, a: __m256i, b: __m256i) -> __m256i { unsafe { let mul = _mm256_mulhi_epi16(a, b).as_i16x16(); transmute(simd_select_bitmask(k, mul, i16x16::ZERO)) @@ -1654,8 +1612,7 @@ pub const fn _mm256_maskz_mulhi_epi16(k: __mmask16, a: __m256i, b: __m256i) -> _ #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_mask_mulhi_epi16(src: __m128i, k: __mmask8, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_mask_mulhi_epi16(src: __m128i, k: __mmask8, a: __m128i, b: __m128i) -> __m128i { unsafe { let mul = _mm_mulhi_epi16(a, b).as_i16x8(); transmute(simd_select_bitmask(k, mul, src.as_i16x8())) @@ -1669,8 +1626,7 @@ pub const fn _mm_mask_mulhi_epi16(src: __m128i, k: __mmask8, a: __m128i, b: __m1 #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpmulhw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_maskz_mulhi_epi16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_maskz_mulhi_epi16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i { unsafe { let mul = _mm_mulhi_epi16(a, b).as_i16x8(); transmute(simd_select_bitmask(k, mul, i16x8::ZERO)) @@ -6903,14 +6859,8 @@ pub fn _mm_maskz_packus_epi16(k: __mmask16, a: __m128i, b: __m128i) -> __m128i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_avg_epu16(a: __m512i, b: __m512i) -> __m512i { - unsafe { - let a = simd_cast::<_, u32x32>(a.as_u16x32()); - let b = simd_cast::<_, u32x32>(b.as_u16x32()); - let r = simd_shr(simd_add(simd_add(a, b), u32x32::splat(1)), u32x32::splat(1)); - transmute(simd_cast::<_, u16x32>(r)) - } +pub fn _mm512_avg_epu16(a: __m512i, b: __m512i) -> __m512i { + unsafe { transmute(vpavgw(a.as_u16x32(), b.as_u16x32())) } } /// Average packed unsigned 16-bit integers in a and b, and store the results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -6920,8 +6870,7 @@ pub const fn _mm512_avg_epu16(a: __m512i, b: __m512i) -> __m512i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_mask_avg_epu16(src: __m512i, k: __mmask32, a: __m512i, b: __m512i) -> __m512i { +pub fn _mm512_mask_avg_epu16(src: __m512i, k: __mmask32, a: __m512i, b: __m512i) -> __m512i { unsafe { let avg = _mm512_avg_epu16(a, b).as_u16x32(); transmute(simd_select_bitmask(k, avg, src.as_u16x32())) @@ -6935,8 +6884,7 @@ pub const fn _mm512_mask_avg_epu16(src: __m512i, k: __mmask32, a: __m512i, b: __ #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_maskz_avg_epu16(k: __mmask32, a: __m512i, b: __m512i) -> __m512i { +pub fn _mm512_maskz_avg_epu16(k: __mmask32, a: __m512i, b: __m512i) -> __m512i { unsafe { let avg = _mm512_avg_epu16(a, b).as_u16x32(); transmute(simd_select_bitmask(k, avg, u16x32::ZERO)) @@ -6950,8 +6898,7 @@ pub const fn _mm512_maskz_avg_epu16(k: __mmask32, a: __m512i, b: __m512i) -> __m #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_mask_avg_epu16(src: __m256i, k: __mmask16, a: __m256i, b: __m256i) -> __m256i { +pub fn _mm256_mask_avg_epu16(src: __m256i, k: __mmask16, a: __m256i, b: __m256i) -> __m256i { unsafe { let avg = _mm256_avg_epu16(a, b).as_u16x16(); transmute(simd_select_bitmask(k, avg, src.as_u16x16())) @@ -6965,8 +6912,7 @@ pub const fn _mm256_mask_avg_epu16(src: __m256i, k: __mmask16, a: __m256i, b: __ #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_maskz_avg_epu16(k: __mmask16, a: __m256i, b: __m256i) -> __m256i { +pub fn _mm256_maskz_avg_epu16(k: __mmask16, a: __m256i, b: __m256i) -> __m256i { unsafe { let avg = _mm256_avg_epu16(a, b).as_u16x16(); transmute(simd_select_bitmask(k, avg, u16x16::ZERO)) @@ -6980,8 +6926,7 @@ pub const fn _mm256_maskz_avg_epu16(k: __mmask16, a: __m256i, b: __m256i) -> __m #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_mask_avg_epu16(src: __m128i, k: __mmask8, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_mask_avg_epu16(src: __m128i, k: __mmask8, a: __m128i, b: __m128i) -> __m128i { unsafe { let avg = _mm_avg_epu16(a, b).as_u16x8(); transmute(simd_select_bitmask(k, avg, src.as_u16x8())) @@ -6995,8 +6940,7 @@ pub const fn _mm_mask_avg_epu16(src: __m128i, k: __mmask8, a: __m128i, b: __m128 #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgw))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_maskz_avg_epu16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_maskz_avg_epu16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i { unsafe { let avg = _mm_avg_epu16(a, b).as_u16x8(); transmute(simd_select_bitmask(k, avg, u16x8::ZERO)) @@ -7010,14 +6954,8 @@ pub const fn _mm_maskz_avg_epu16(k: __mmask8, a: __m128i, b: __m128i) -> __m128i #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_avg_epu8(a: __m512i, b: __m512i) -> __m512i { - unsafe { - let a = simd_cast::<_, u16x64>(a.as_u8x64()); - let b = simd_cast::<_, u16x64>(b.as_u8x64()); - let r = simd_shr(simd_add(simd_add(a, b), u16x64::splat(1)), u16x64::splat(1)); - transmute(simd_cast::<_, u8x64>(r)) - } +pub fn _mm512_avg_epu8(a: __m512i, b: __m512i) -> __m512i { + unsafe { transmute(vpavgb(a.as_u8x64(), b.as_u8x64())) } } /// Average packed unsigned 8-bit integers in a and b, and store the results in dst using writemask k (elements are copied from src when the corresponding mask bit is not set). @@ -7027,8 +6965,7 @@ pub const fn _mm512_avg_epu8(a: __m512i, b: __m512i) -> __m512i { #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_mask_avg_epu8(src: __m512i, k: __mmask64, a: __m512i, b: __m512i) -> __m512i { +pub fn _mm512_mask_avg_epu8(src: __m512i, k: __mmask64, a: __m512i, b: __m512i) -> __m512i { unsafe { let avg = _mm512_avg_epu8(a, b).as_u8x64(); transmute(simd_select_bitmask(k, avg, src.as_u8x64())) @@ -7042,8 +6979,7 @@ pub const fn _mm512_mask_avg_epu8(src: __m512i, k: __mmask64, a: __m512i, b: __m #[target_feature(enable = "avx512bw")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm512_maskz_avg_epu8(k: __mmask64, a: __m512i, b: __m512i) -> __m512i { +pub fn _mm512_maskz_avg_epu8(k: __mmask64, a: __m512i, b: __m512i) -> __m512i { unsafe { let avg = _mm512_avg_epu8(a, b).as_u8x64(); transmute(simd_select_bitmask(k, avg, u8x64::ZERO)) @@ -7057,8 +6993,7 @@ pub const fn _mm512_maskz_avg_epu8(k: __mmask64, a: __m512i, b: __m512i) -> __m5 #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_mask_avg_epu8(src: __m256i, k: __mmask32, a: __m256i, b: __m256i) -> __m256i { +pub fn _mm256_mask_avg_epu8(src: __m256i, k: __mmask32, a: __m256i, b: __m256i) -> __m256i { unsafe { let avg = _mm256_avg_epu8(a, b).as_u8x32(); transmute(simd_select_bitmask(k, avg, src.as_u8x32())) @@ -7072,8 +7007,7 @@ pub const fn _mm256_mask_avg_epu8(src: __m256i, k: __mmask32, a: __m256i, b: __m #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm256_maskz_avg_epu8(k: __mmask32, a: __m256i, b: __m256i) -> __m256i { +pub fn _mm256_maskz_avg_epu8(k: __mmask32, a: __m256i, b: __m256i) -> __m256i { unsafe { let avg = _mm256_avg_epu8(a, b).as_u8x32(); transmute(simd_select_bitmask(k, avg, u8x32::ZERO)) @@ -7087,8 +7021,7 @@ pub const fn _mm256_maskz_avg_epu8(k: __mmask32, a: __m256i, b: __m256i) -> __m2 #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_mask_avg_epu8(src: __m128i, k: __mmask16, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_mask_avg_epu8(src: __m128i, k: __mmask16, a: __m128i, b: __m128i) -> __m128i { unsafe { let avg = _mm_avg_epu8(a, b).as_u8x16(); transmute(simd_select_bitmask(k, avg, src.as_u8x16())) @@ -7102,8 +7035,7 @@ pub const fn _mm_mask_avg_epu8(src: __m128i, k: __mmask16, a: __m128i, b: __m128 #[target_feature(enable = "avx512bw,avx512vl")] #[stable(feature = "stdarch_x86_avx512", since = "1.89")] #[cfg_attr(test, assert_instr(vpavgb))] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_maskz_avg_epu8(k: __mmask16, a: __m128i, b: __m128i) -> __m128i { +pub fn _mm_maskz_avg_epu8(k: __mmask16, a: __m128i, b: __m128i) -> __m128i { unsafe { let avg = _mm_avg_epu8(a, b).as_u8x16(); transmute(simd_select_bitmask(k, avg, u8x16::ZERO)) @@ -12499,6 +12431,11 @@ unsafe extern "llvm-intrinsic" { #[link_name = "llvm.x86.avx512.pmul.hr.sw.512"] fn vpmulhrsw(a: i16x32, b: i16x32) -> i16x32; + #[link_name = "llvm.x86.avx512.pmulhu.w.512"] + fn vpmulhuw(a: u16x32, b: u16x32) -> u16x32; + #[link_name = "llvm.x86.avx512.pmulh.w.512"] + fn vpmulhw(a: i16x32, b: i16x32) -> i16x32; + #[link_name = "llvm.x86.avx512.pmaddw.d.512"] fn vpmaddwd(a: i16x32, b: i16x32) -> i32x16; #[link_name = "llvm.x86.avx512.pmaddubs.w.512"] @@ -12581,6 +12518,11 @@ unsafe extern "llvm-intrinsic" { #[link_name = "llvm.x86.avx512.mask.pmovus.wb.mem.512"] fn vpmovuswbmem(mem_addr: *mut i8, a: i16x32, mask: u32); + + #[link_name = "llvm.x86.avx512.pavg.b.512"] + fn vpavgb(a: u8x64, b: u8x64) -> u8x64; + #[link_name = "llvm.x86.avx512.pavg.w.512"] + fn vpavgw(a: u16x32, b: u16x32) -> u16x32; } #[cfg(test)] @@ -13818,7 +13760,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_mulhi_epu16() { + fn test_mm512_mulhi_epu16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_mulhi_epu16(a, b); @@ -13827,7 +13769,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_mask_mulhi_epu16() { + fn test_mm512_mask_mulhi_epu16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_mask_mulhi_epu16(a, 0, a, b); @@ -13840,7 +13782,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_maskz_mulhi_epu16() { + fn test_mm512_maskz_mulhi_epu16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_maskz_mulhi_epu16(0, a, b); @@ -13853,7 +13795,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_mask_mulhi_epu16() { + fn test_mm256_mask_mulhi_epu16() { let a = _mm256_set1_epi16(1); let b = _mm256_set1_epi16(1); let r = _mm256_mask_mulhi_epu16(a, 0, a, b); @@ -13864,7 +13806,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_maskz_mulhi_epu16() { + fn test_mm256_maskz_mulhi_epu16() { let a = _mm256_set1_epi16(1); let b = _mm256_set1_epi16(1); let r = _mm256_maskz_mulhi_epu16(0, a, b); @@ -13875,7 +13817,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_mask_mulhi_epu16() { + fn test_mm_mask_mulhi_epu16() { let a = _mm_set1_epi16(1); let b = _mm_set1_epi16(1); let r = _mm_mask_mulhi_epu16(a, 0, a, b); @@ -13886,7 +13828,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_maskz_mulhi_epu16() { + fn test_mm_maskz_mulhi_epu16() { let a = _mm_set1_epi16(1); let b = _mm_set1_epi16(1); let r = _mm_maskz_mulhi_epu16(0, a, b); @@ -13897,7 +13839,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_mulhi_epi16() { + fn test_mm512_mulhi_epi16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_mulhi_epi16(a, b); @@ -13906,7 +13848,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_mask_mulhi_epi16() { + fn test_mm512_mask_mulhi_epi16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_mask_mulhi_epi16(a, 0, a, b); @@ -13919,7 +13861,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_maskz_mulhi_epi16() { + fn test_mm512_maskz_mulhi_epi16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_maskz_mulhi_epi16(0, a, b); @@ -13932,7 +13874,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_mask_mulhi_epi16() { + fn test_mm256_mask_mulhi_epi16() { let a = _mm256_set1_epi16(1); let b = _mm256_set1_epi16(1); let r = _mm256_mask_mulhi_epi16(a, 0, a, b); @@ -13943,7 +13885,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_maskz_mulhi_epi16() { + fn test_mm256_maskz_mulhi_epi16() { let a = _mm256_set1_epi16(1); let b = _mm256_set1_epi16(1); let r = _mm256_maskz_mulhi_epi16(0, a, b); @@ -13954,7 +13896,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_mask_mulhi_epi16() { + fn test_mm_mask_mulhi_epi16() { let a = _mm_set1_epi16(1); let b = _mm_set1_epi16(1); let r = _mm_mask_mulhi_epi16(a, 0, a, b); @@ -13965,7 +13907,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_maskz_mulhi_epi16() { + fn test_mm_maskz_mulhi_epi16() { let a = _mm_set1_epi16(1); let b = _mm_set1_epi16(1); let r = _mm_maskz_mulhi_epi16(0, a, b); @@ -17987,7 +17929,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_avg_epu16() { + fn test_mm512_avg_epu16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_avg_epu16(a, b); @@ -17996,7 +17938,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_mask_avg_epu16() { + fn test_mm512_mask_avg_epu16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_mask_avg_epu16(a, 0, a, b); @@ -18009,7 +17951,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_maskz_avg_epu16() { + fn test_mm512_maskz_avg_epu16() { let a = _mm512_set1_epi16(1); let b = _mm512_set1_epi16(1); let r = _mm512_maskz_avg_epu16(0, a, b); @@ -18022,7 +17964,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_mask_avg_epu16() { + fn test_mm256_mask_avg_epu16() { let a = _mm256_set1_epi16(1); let b = _mm256_set1_epi16(1); let r = _mm256_mask_avg_epu16(a, 0, a, b); @@ -18033,7 +17975,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_maskz_avg_epu16() { + fn test_mm256_maskz_avg_epu16() { let a = _mm256_set1_epi16(1); let b = _mm256_set1_epi16(1); let r = _mm256_maskz_avg_epu16(0, a, b); @@ -18044,7 +17986,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_mask_avg_epu16() { + fn test_mm_mask_avg_epu16() { let a = _mm_set1_epi16(1); let b = _mm_set1_epi16(1); let r = _mm_mask_avg_epu16(a, 0, a, b); @@ -18055,7 +17997,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_maskz_avg_epu16() { + fn test_mm_maskz_avg_epu16() { let a = _mm_set1_epi16(1); let b = _mm_set1_epi16(1); let r = _mm_maskz_avg_epu16(0, a, b); @@ -18066,7 +18008,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_avg_epu8() { + fn test_mm512_avg_epu8() { let a = _mm512_set1_epi8(1); let b = _mm512_set1_epi8(1); let r = _mm512_avg_epu8(a, b); @@ -18075,7 +18017,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_mask_avg_epu8() { + fn test_mm512_mask_avg_epu8() { let a = _mm512_set1_epi8(1); let b = _mm512_set1_epi8(1); let r = _mm512_mask_avg_epu8(a, 0, a, b); @@ -18095,7 +18037,7 @@ mod tests { } #[simd_test(enable = "avx512bw")] - const fn test_mm512_maskz_avg_epu8() { + fn test_mm512_maskz_avg_epu8() { let a = _mm512_set1_epi8(1); let b = _mm512_set1_epi8(1); let r = _mm512_maskz_avg_epu8(0, a, b); @@ -18114,7 +18056,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_mask_avg_epu8() { + fn test_mm256_mask_avg_epu8() { let a = _mm256_set1_epi8(1); let b = _mm256_set1_epi8(1); let r = _mm256_mask_avg_epu8(a, 0, a, b); @@ -18127,7 +18069,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm256_maskz_avg_epu8() { + fn test_mm256_maskz_avg_epu8() { let a = _mm256_set1_epi8(1); let b = _mm256_set1_epi8(1); let r = _mm256_maskz_avg_epu8(0, a, b); @@ -18140,7 +18082,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_mask_avg_epu8() { + fn test_mm_mask_avg_epu8() { let a = _mm_set1_epi8(1); let b = _mm_set1_epi8(1); let r = _mm_mask_avg_epu8(a, 0, a, b); @@ -18151,7 +18093,7 @@ mod tests { } #[simd_test(enable = "avx512bw,avx512vl")] - const fn test_mm_maskz_avg_epu8() { + fn test_mm_maskz_avg_epu8() { let a = _mm_set1_epi8(1); let b = _mm_set1_epi8(1); let r = _mm_maskz_avg_epu8(0, a, b); diff --git a/library/stdarch/crates/core_arch/src/x86/sse2.rs b/library/stdarch/crates/core_arch/src/x86/sse2.rs index 2c61b095c6b24..b52fce6765a00 100644 --- a/library/stdarch/crates/core_arch/src/x86/sse2.rs +++ b/library/stdarch/crates/core_arch/src/x86/sse2.rs @@ -178,14 +178,8 @@ pub const fn _mm_adds_epu16(a: __m128i, b: __m128i) -> __m128i { #[target_feature(enable = "sse2")] #[cfg_attr(test, assert_instr(pavgb))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_avg_epu8(a: __m128i, b: __m128i) -> __m128i { - unsafe { - let a = simd_cast::<_, u16x16>(a.as_u8x16()); - let b = simd_cast::<_, u16x16>(b.as_u8x16()); - let r = simd_shr(simd_add(simd_add(a, b), u16x16::splat(1)), u16x16::splat(1)); - transmute(simd_cast::<_, u8x16>(r)) - } +pub fn _mm_avg_epu8(a: __m128i, b: __m128i) -> __m128i { + unsafe { transmute(pavgb(a.as_u8x16(), b.as_u8x16())) } } /// Averages packed unsigned 16-bit integers in `a` and `b`. @@ -195,14 +189,8 @@ pub const fn _mm_avg_epu8(a: __m128i, b: __m128i) -> __m128i { #[target_feature(enable = "sse2")] #[cfg_attr(test, assert_instr(pavgw))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_avg_epu16(a: __m128i, b: __m128i) -> __m128i { - unsafe { - let a = simd_cast::<_, u32x8>(a.as_u16x8()); - let b = simd_cast::<_, u32x8>(b.as_u16x8()); - let r = simd_shr(simd_add(simd_add(a, b), u32x8::splat(1)), u32x8::splat(1)); - transmute(simd_cast::<_, u16x8>(r)) - } +pub fn _mm_avg_epu16(a: __m128i, b: __m128i) -> __m128i { + unsafe { transmute(pavgw(a.as_u16x8(), b.as_u16x8())) } } /// Multiplies and then horizontally add signed 16 bit integers in `a` and `b`. @@ -294,14 +282,8 @@ pub const fn _mm_min_epu8(a: __m128i, b: __m128i) -> __m128i { #[target_feature(enable = "sse2")] #[cfg_attr(test, assert_instr(pmulhw))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_mulhi_epi16(a: __m128i, b: __m128i) -> __m128i { - unsafe { - let a = simd_cast::<_, i32x8>(a.as_i16x8()); - let b = simd_cast::<_, i32x8>(b.as_i16x8()); - let r = simd_shr(simd_mul(a, b), i32x8::splat(16)); - transmute(simd_cast::(r)) - } +pub fn _mm_mulhi_epi16(a: __m128i, b: __m128i) -> __m128i { + unsafe { transmute(pmulhw(a.as_i16x8(), b.as_i16x8())) } } /// Multiplies the packed unsigned 16-bit integers in `a` and `b`. @@ -314,14 +296,8 @@ pub const fn _mm_mulhi_epi16(a: __m128i, b: __m128i) -> __m128i { #[target_feature(enable = "sse2")] #[cfg_attr(test, assert_instr(pmulhuw))] #[stable(feature = "simd_x86", since = "1.27.0")] -#[rustc_const_unstable(feature = "stdarch_const_x86", issue = "149298")] -pub const fn _mm_mulhi_epu16(a: __m128i, b: __m128i) -> __m128i { - unsafe { - let a = simd_cast::<_, u32x8>(a.as_u16x8()); - let b = simd_cast::<_, u32x8>(b.as_u16x8()); - let r = simd_shr(simd_mul(a, b), u32x8::splat(16)); - transmute(simd_cast::(r)) - } +pub fn _mm_mulhi_epu16(a: __m128i, b: __m128i) -> __m128i { + unsafe { transmute(pmulhuw(a.as_u16x8(), b.as_u16x8())) } } /// Multiplies the packed 16-bit integers in `a` and `b`. @@ -3200,8 +3176,16 @@ unsafe extern "llvm-intrinsic" { fn lfence(); #[link_name = "llvm.x86.sse2.mfence"] fn mfence(); + #[link_name = "llvm.x86.sse2.pavg.b"] + fn pavgb(a: u8x16, b: u8x16) -> u8x16; + #[link_name = "llvm.x86.sse2.pavg.w"] + fn pavgw(a: u16x8, b: u16x8) -> u16x8; #[link_name = "llvm.x86.sse2.pmadd.wd"] fn pmaddwd(a: i16x8, b: i16x8) -> i32x4; + #[link_name = "llvm.x86.sse2.pmulh.w"] + fn pmulhw(a: i16x8, b: i16x8) -> i16x8; + #[link_name = "llvm.x86.sse2.pmulhu.w"] + fn pmulhuw(a: u16x8, b: u16x8) -> u16x8; #[link_name = "llvm.x86.sse2.psad.bw"] fn psadbw(a: u8x16, b: u8x16) -> u64x2; #[link_name = "llvm.x86.sse2.psll.w"] @@ -3466,14 +3450,14 @@ mod tests { } #[simd_test(enable = "sse2")] - const fn test_mm_avg_epu8() { + fn test_mm_avg_epu8() { let (a, b) = (_mm_set1_epi8(3), _mm_set1_epi8(9)); let r = _mm_avg_epu8(a, b); assert_eq_m128i(r, _mm_set1_epi8(6)); } #[simd_test(enable = "sse2")] - const fn test_mm_avg_epu16() { + fn test_mm_avg_epu16() { let (a, b) = (_mm_set1_epi16(3), _mm_set1_epi16(9)); let r = _mm_avg_epu16(a, b); assert_eq_m128i(r, _mm_set1_epi16(6)); @@ -3547,14 +3531,14 @@ mod tests { } #[simd_test(enable = "sse2")] - const fn test_mm_mulhi_epi16() { + fn test_mm_mulhi_epi16() { let (a, b) = (_mm_set1_epi16(1000), _mm_set1_epi16(-1001)); let r = _mm_mulhi_epi16(a, b); assert_eq_m128i(r, _mm_set1_epi16(-16)); } #[simd_test(enable = "sse2")] - const fn test_mm_mulhi_epu16() { + fn test_mm_mulhi_epu16() { let (a, b) = (_mm_set1_epi16(1000), _mm_set1_epi16(1001)); let r = _mm_mulhi_epu16(a, b); assert_eq_m128i(r, _mm_set1_epi16(15)); diff --git a/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec b/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec index eb3ff074a3978..63895945948f8 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec +++ b/library/stdarch/crates/stdarch-gen-loongarch/lasx.spec @@ -1260,49 +1260,41 @@ asm-fmts = xd, xj, xk data-types = V4DI, V4DI, V4DI, V4DI /// lasx_xvdiv_b -impl = portable name = lasx_xvdiv_b asm-fmts = xd, xj, xk data-types = V32QI, V32QI, V32QI /// lasx_xvdiv_h -impl = portable name = lasx_xvdiv_h asm-fmts = xd, xj, xk data-types = V16HI, V16HI, V16HI /// lasx_xvdiv_w -impl = portable name = lasx_xvdiv_w asm-fmts = xd, xj, xk data-types = V8SI, V8SI, V8SI /// lasx_xvdiv_d -impl = portable name = lasx_xvdiv_d asm-fmts = xd, xj, xk data-types = V4DI, V4DI, V4DI /// lasx_xvdiv_bu -impl = portable name = lasx_xvdiv_bu asm-fmts = xd, xj, xk data-types = UV32QI, UV32QI, UV32QI /// lasx_xvdiv_hu -impl = portable name = lasx_xvdiv_hu asm-fmts = xd, xj, xk data-types = UV16HI, UV16HI, UV16HI /// lasx_xvdiv_wu -impl = portable name = lasx_xvdiv_wu asm-fmts = xd, xj, xk data-types = UV8SI, UV8SI, UV8SI /// lasx_xvdiv_du -impl = portable name = lasx_xvdiv_du asm-fmts = xd, xj, xk data-types = UV4DI, UV4DI, UV4DI @@ -1368,49 +1360,41 @@ asm-fmts = xd, xj, xk data-types = V4DI, UV8SI, UV8SI /// lasx_xvmod_b -impl = portable name = lasx_xvmod_b asm-fmts = xd, xj, xk data-types = V32QI, V32QI, V32QI /// lasx_xvmod_h -impl = portable name = lasx_xvmod_h asm-fmts = xd, xj, xk data-types = V16HI, V16HI, V16HI /// lasx_xvmod_w -impl = portable name = lasx_xvmod_w asm-fmts = xd, xj, xk data-types = V8SI, V8SI, V8SI /// lasx_xvmod_d -impl = portable name = lasx_xvmod_d asm-fmts = xd, xj, xk data-types = V4DI, V4DI, V4DI /// lasx_xvmod_bu -impl = portable name = lasx_xvmod_bu asm-fmts = xd, xj, xk data-types = UV32QI, UV32QI, UV32QI /// lasx_xvmod_hu -impl = portable name = lasx_xvmod_hu asm-fmts = xd, xj, xk data-types = UV16HI, UV16HI, UV16HI /// lasx_xvmod_wu -impl = portable name = lasx_xvmod_wu asm-fmts = xd, xj, xk data-types = UV8SI, UV8SI, UV8SI /// lasx_xvmod_du -impl = portable name = lasx_xvmod_du asm-fmts = xd, xj, xk data-types = UV4DI, UV4DI, UV4DI diff --git a/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec b/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec index 89970c3657048..e1fb72c7901c9 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec +++ b/library/stdarch/crates/stdarch-gen-loongarch/lsx.spec @@ -1260,49 +1260,41 @@ asm-fmts = vd, vj, vk data-types = V2DI, V2DI, V2DI, V2DI /// lsx_vdiv_b -impl = portable name = lsx_vdiv_b asm-fmts = vd, vj, vk data-types = V16QI, V16QI, V16QI /// lsx_vdiv_h -impl = portable name = lsx_vdiv_h asm-fmts = vd, vj, vk data-types = V8HI, V8HI, V8HI /// lsx_vdiv_w -impl = portable name = lsx_vdiv_w asm-fmts = vd, vj, vk data-types = V4SI, V4SI, V4SI /// lsx_vdiv_d -impl = portable name = lsx_vdiv_d asm-fmts = vd, vj, vk data-types = V2DI, V2DI, V2DI /// lsx_vdiv_bu -impl = portable name = lsx_vdiv_bu asm-fmts = vd, vj, vk data-types = UV16QI, UV16QI, UV16QI /// lsx_vdiv_hu -impl = portable name = lsx_vdiv_hu asm-fmts = vd, vj, vk data-types = UV8HI, UV8HI, UV8HI /// lsx_vdiv_wu -impl = portable name = lsx_vdiv_wu asm-fmts = vd, vj, vk data-types = UV4SI, UV4SI, UV4SI /// lsx_vdiv_du -impl = portable name = lsx_vdiv_du asm-fmts = vd, vj, vk data-types = UV2DI, UV2DI, UV2DI @@ -1368,49 +1360,41 @@ asm-fmts = vd, vj, vk data-types = V2DI, UV4SI, UV4SI /// lsx_vmod_b -impl = portable name = lsx_vmod_b asm-fmts = vd, vj, vk data-types = V16QI, V16QI, V16QI /// lsx_vmod_h -impl = portable name = lsx_vmod_h asm-fmts = vd, vj, vk data-types = V8HI, V8HI, V8HI /// lsx_vmod_w -impl = portable name = lsx_vmod_w asm-fmts = vd, vj, vk data-types = V4SI, V4SI, V4SI /// lsx_vmod_d -impl = portable name = lsx_vmod_d asm-fmts = vd, vj, vk data-types = V2DI, V2DI, V2DI /// lsx_vmod_bu -impl = portable name = lsx_vmod_bu asm-fmts = vd, vj, vk data-types = UV16QI, UV16QI, UV16QI /// lsx_vmod_hu -impl = portable name = lsx_vmod_hu asm-fmts = vd, vj, vk data-types = UV8HI, UV8HI, UV8HI /// lsx_vmod_wu -impl = portable name = lsx_vmod_wu asm-fmts = vd, vj, vk data-types = UV4SI, UV4SI, UV4SI /// lsx_vmod_du -impl = portable name = lsx_vmod_du asm-fmts = vd, vj, vk data-types = UV2DI, UV2DI, UV2DI diff --git a/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt b/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt index f47c17b23adea..4005385b75198 100644 --- a/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt +++ b/library/stdarch/crates/stdarch-gen-loongarch/src/portable-intrinsics.txt @@ -111,22 +111,6 @@ lsx_vmul_b lsx_vmul_h lsx_vmul_w lsx_vmul_d -lsx_vdiv_b -lsx_vdiv_h -lsx_vdiv_w -lsx_vdiv_d -lsx_vdiv_bu -lsx_vdiv_hu -lsx_vdiv_wu -lsx_vdiv_du -lsx_vmod_b -lsx_vmod_h -lsx_vmod_w -lsx_vmod_d -lsx_vmod_bu -lsx_vmod_hu -lsx_vmod_wu -lsx_vmod_du lsx_vmadd_b lsx_vmadd_h lsx_vmadd_w @@ -426,22 +410,6 @@ lasx_xvmul_b lasx_xvmul_h lasx_xvmul_w lasx_xvmul_d -lasx_xvdiv_b -lasx_xvdiv_h -lasx_xvdiv_w -lasx_xvdiv_d -lasx_xvdiv_bu -lasx_xvdiv_hu -lasx_xvdiv_wu -lasx_xvdiv_du -lasx_xvmod_b -lasx_xvmod_h -lasx_xvmod_w -lasx_xvmod_d -lasx_xvmod_bu -lasx_xvmod_hu -lasx_xvmod_wu -lasx_xvmod_du lasx_xvmadd_b lasx_xvmadd_h lasx_xvmadd_w diff --git a/library/stdarch/rust-version b/library/stdarch/rust-version index 368cecc0b82f9..271b3a644cfb8 100644 --- a/library/stdarch/rust-version +++ b/library/stdarch/rust-version @@ -1 +1 @@ -220b36c420c49c59923f54cd4a76634fac98a067 +260f1acad9d7f70b5b56a636a9dc5a7f76150417 diff --git a/library/stdarch/triagebot.toml b/library/stdarch/triagebot.toml index 149646aa65f01..c4a4b02b0179e 100644 --- a/library/stdarch/triagebot.toml +++ b/library/stdarch/triagebot.toml @@ -33,7 +33,7 @@ allow-unauthenticated = [ [assign] [assign.owners] -"*" = ["@Amanieu", "@folkertdev", "@sayantn", "@davidtwco", "@adamgemmell"] +"*" = ["@Amanieu", "@folkertdev", "@davidtwco", "@adamgemmell"] [ping.windows] message = """\ @@ -88,3 +88,13 @@ Thanks! # Documentation at: https://forge.rust-lang.org/triagebot/issue-links.html [issue-links] check-commits = false + +[notify-zulip."I-libs-nominated"] +zulip_stream = 639962 # #t-libs/nominated +topic = "stdarch#{number}: {title}" +message_on_add = """\ +[stdarch#{number} "{title}"](https://github.com/rust-lang/stdarch/pull/{number}) has been nominated for discussion. +""" +message_on_remove = """\ +stdarch#{number} is no longer nominated. +""" diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index f828327b4b985..96b735b08a894 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -725,14 +725,12 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { info!("Recursing into {}", self.dst.display()); - if !item.is_stripped() { - let buf = self.render_item(item, true); - // buf will be empty if the module is stripped and there is no redirect for it - if !buf.is_empty() { - self.shared.ensure_dir(&self.dst)?; - let joint_dst = self.dst.join("index.html"); - self.shared.fs.write(joint_dst, buf)?; - } + let buf = self.render_item(item, true); + // buf will be empty if the module is stripped and there is no redirect for it + if !buf.is_empty() { + self.shared.ensure_dir(&self.dst)?; + let joint_dst = self.dst.join("index.html"); + self.shared.fs.write(joint_dst, buf)?; } if !self.info.is_inside_inlined_module { if let Some(def_id) = item.def_id() diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs index 7b282b0c61d7e..6a7d9250319aa 100644 --- a/src/librustdoc/html/render/sidebar.rs +++ b/src/librustdoc/html/render/sidebar.rs @@ -354,12 +354,10 @@ fn sidebar_trait<'a>( sidebar_assoc_items(cx, it, blocks, deref_id_map); - if !t.is_dyn_compatible(tcx) { - blocks.push(LinkBlock::forced( - Link::new("dyn-compatibility", "Dyn Compatibility"), - "dyn-compatibility-note", - )); - } + blocks.push(LinkBlock::forced( + Link::new("dyn-compatibility", "Dyn Compatibility"), + "dyn-compatibility-note", + )); blocks.push(LinkBlock::new( Link::new("foreign-impls", "Implementations on Foreign Types"), diff --git a/tests/rustdoc-html/file-creation-111249.rs b/tests/rustdoc-html/file-creation-111249.rs index 7a075a1583f30..e745d59b10132 100644 --- a/tests/rustdoc-html/file-creation-111249.rs +++ b/tests/rustdoc-html/file-creation-111249.rs @@ -17,11 +17,12 @@ pub trait Sized: MetaSized {} // 'struct.Bar.html', 'trait.Sized.html', 'trait.MetaSized.html', 'trait.PointeeSized.html']" //@ files "foo/visible" "['trait.Foo.html', 'index.html', 'sidebar-items.js']" //@ files "foo/hidden" "['inner']" -//@ files "foo/hidden/inner" "['trait.Foo.html']" +//@ files "foo/hidden/inner" "['index.html', 'trait.Foo.html']" // The following five should not fail! //@ !has 'foo/hidden/index.html' -//@ !has 'foo/hidden/inner/index.html' +//@ has 'foo/hidden/inner/index.html' +//@ matchesraw - '' // FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249 //@ has 'foo/hidden/inner/trait.Foo.html' //@ matchesraw - '' diff --git a/tests/rustdoc-html/intra-doc/auxiliary/doc-hidden-reexported.rs b/tests/rustdoc-html/intra-doc/auxiliary/doc-hidden-reexported.rs new file mode 100644 index 0000000000000..096e958395f94 --- /dev/null +++ b/tests/rustdoc-html/intra-doc/auxiliary/doc-hidden-reexported.rs @@ -0,0 +1,10 @@ +#[doc(hidden)] +pub mod docs { + /// Foo + pub mod io_uring_provided_buffers {} + /// Bar + pub struct IoUringProvidedBuffers; +} + +pub use docs::io_uring_provided_buffers; +pub use docs::IoUringProvidedBuffers; diff --git a/tests/rustdoc-html/intra-doc/link-to-item-thats-reexport-from-doc-hidden.rs b/tests/rustdoc-html/intra-doc/link-to-item-thats-reexport-from-doc-hidden.rs new file mode 100644 index 0000000000000..0f9fc3e358ff3 --- /dev/null +++ b/tests/rustdoc-html/intra-doc/link-to-item-thats-reexport-from-doc-hidden.rs @@ -0,0 +1,22 @@ +//@ aux-build:doc-hidden-reexported.rs +//@ build-aux-docs + +//@ has doc_hidden_reexported/docs/io_uring_provided_buffers/index.html +//@ matchesraw - '' +//@ has doc_hidden_reexported/io_uring_provided_buffers/index.html + +//@ has doc_hidden_reexported/docs/struct.IoUringProvidedBuffers.html +//@ matchesraw - '' +//@ has doc_hidden_reexported/struct.IoUringProvidedBuffers.html + +//! Link to [doc_hidden_reexported::io_uring_provided_buffers] and +//! [doc_hidden_reexported::IoUringProvidedBuffers] +//! +//! Because these cross-crate links point at the internal, private path, +//! we need to make sure the redirect gets generated. + +//@ has link_to_item_thats_reexport_from_doc_hidden/index.html +//@ count - '//a[@href="../doc_hidden_reexported/docs/io_uring_provided_buffers/index.html"]' 1 +//@ count - '//a[@href="../doc_hidden_reexported/docs/struct.IoUringProvidedBuffers.html"]' 1 + +extern crate doc_hidden_reexported; diff --git a/tests/rustdoc-html/reexport/reexport-trait-from-hidden-111064-2.rs b/tests/rustdoc-html/reexport/reexport-trait-from-hidden-111064-2.rs index 8f0a5806b0918..e8d96cb19b6bd 100644 --- a/tests/rustdoc-html/reexport/reexport-trait-from-hidden-111064-2.rs +++ b/tests/rustdoc-html/reexport/reexport-trait-from-hidden-111064-2.rs @@ -15,11 +15,12 @@ pub trait Sized: MetaSized {} //@ files "foo" "['sidebar-items.js', 'all.html', 'hidden', 'index.html', 'struct.Bar.html', \ // 'visible', 'trait.Sized.html', 'trait.MetaSized.html', 'trait.PointeeSized.html']" //@ files "foo/hidden" "['inner']" -//@ files "foo/hidden/inner" "['trait.Foo.html']" +//@ files "foo/hidden/inner" "['index.html', 'trait.Foo.html']" //@ files "foo/visible" "['index.html', 'sidebar-items.js', 'trait.Foo.html']" //@ !has 'foo/hidden/index.html' -//@ !has 'foo/hidden/inner/index.html' +//@ has 'foo/hidden/inner/index.html' +//@ matchesraw - '' // FIXME: Should be `@!has`: https://github.com/rust-lang/rust/issues/111249 //@ has 'foo/hidden/inner/trait.Foo.html' //@ matchesraw - '' diff --git a/tests/rustdoc-html/sidebar/sidebar-items.rs b/tests/rustdoc-html/sidebar/sidebar-items.rs index bd0893dac3e36..19e6ab6d52580 100644 --- a/tests/rustdoc-html/sidebar/sidebar-items.rs +++ b/tests/rustdoc-html/sidebar/sidebar-items.rs @@ -26,7 +26,7 @@ pub trait Foo { } //@ has foo/trait.DynCompatible.html -//@ !has - '//div[@class="sidebar-elems"]//h3/a[@href="#dyn-compatibility"]' '' +//@ has - '//div[@class="sidebar-elems"]//h3/a[@href="#dyn-compatibility"]' '' pub trait DynCompatible { fn access(&self); } diff --git a/tests/rustdoc-html/trait-rustc_must_implement_one_of.rs b/tests/rustdoc-html/trait-rustc_must_implement_one_of.rs index 57accd9fa0791..40ca9ad8e3ff4 100644 --- a/tests/rustdoc-html/trait-rustc_must_implement_one_of.rs +++ b/tests/rustdoc-html/trait-rustc_must_implement_one_of.rs @@ -12,10 +12,12 @@ //@ has - '//*[@class="stab must_implement"]/a[@href="#method.read"]' 'read' //@ has - '//*[@class="stab must_implement"]/a[@href="#method.read_buf"]' 'read_buf' -// There should be 3 headings in the sidebar: Required/Provided methods and "Implementors". -//@ count - '//*[@id="rustdoc-toc"]/h3' 3 +// There should be 4 headings in the sidebar: Required/Provided methods, "Implementors" and +// "Dyn Compatibility". +//@ count - '//*[@id="rustdoc-toc"]/h3' 4 //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#required-methods"]' 'Required Methods' //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#provided-methods"]' 'Provided Methods' +//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#dyn-compatibility"]' 'Dyn Compatibility' //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#implementors"]' 'Implementors' #[rustc_must_implement_one_of(read_buf, read)] @@ -25,10 +27,12 @@ pub trait Read { } //@ has 'foo/trait.Tadam.html' -// There should still be 3 headings in the sidebar: Required/Provided methods and "Implementors". -//@ count - '//*[@id="rustdoc-toc"]/h3' 3 +// There should still be 4 headings in the sidebar: Required/Provided methods, "Implementors" +// and "Dyn Compatibility". +//@ count - '//*[@id="rustdoc-toc"]/h3' 4 //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#required-methods"]' 'Required Methods' //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#provided-methods"]' 'Provided Methods' +//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#dyn-compatibility"]' 'Dyn Compatibility' //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#implementors"]' 'Implementors' #[rustc_must_implement_one_of(read_buf, read)] @@ -39,9 +43,11 @@ pub trait Tadam { } //@ has 'foo/trait.Other.html' -// There should be 2 headings in the sidebar: Provided methods and "Implementors". -//@ count - '//*[@id="rustdoc-toc"]/h3' 2 +// There should be 3 headings in the sidebar: Provided methods, "Implementors" and +// "Dyn Compatibility". +//@ count - '//*[@id="rustdoc-toc"]/h3' 3 //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#provided-methods"]' 'Provided Methods' +//@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#dyn-compatibility"]' 'Dyn Compatibility' //@ has - '//*[@id="rustdoc-toc"]/h3/a[@href="#implementors"]' 'Implementors' pub trait Other { diff --git a/tests/ui/diagnostic-flags/deduplicate-diagnostics.deduplicate.stderr b/tests/ui/diagnostic-flags/deduplicate-diagnostics.deduplicate.stderr index c0d568eb5384e..114c37188a9ef 100644 --- a/tests/ui/diagnostic-flags/deduplicate-diagnostics.deduplicate.stderr +++ b/tests/ui/diagnostic-flags/deduplicate-diagnostics.deduplicate.stderr @@ -1,8 +1,10 @@ -error[E0452]: malformed lint attribute input +error: expected a lint, found literal --> $DIR/deduplicate-diagnostics.rs:10:8 | LL | #[deny("literal")] - | ^^^^^^^^^ bad attribute argument + | ^^^^^^^^^ not the name of a lint + | + = help: try using `#[deny(literal)]` error: cannot find derive macro `Unresolved` in this scope --> $DIR/deduplicate-diagnostics.rs:6:10 @@ -12,4 +14,3 @@ LL | #[derive(Unresolved)] error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0452`. diff --git a/tests/ui/diagnostic-flags/deduplicate-diagnostics.duplicate.stderr b/tests/ui/diagnostic-flags/deduplicate-diagnostics.duplicate.stderr index 74d7066293f30..66d0d94c0e815 100644 --- a/tests/ui/diagnostic-flags/deduplicate-diagnostics.duplicate.stderr +++ b/tests/ui/diagnostic-flags/deduplicate-diagnostics.duplicate.stderr @@ -1,8 +1,10 @@ -error[E0452]: malformed lint attribute input +error: expected a lint, found literal --> $DIR/deduplicate-diagnostics.rs:10:8 | LL | #[deny("literal")] - | ^^^^^^^^^ bad attribute argument + | ^^^^^^^^^ not the name of a lint + | + = help: try using `#[deny(literal)]` error: cannot find derive macro `Unresolved` in this scope --> $DIR/deduplicate-diagnostics.rs:6:10 @@ -18,22 +20,23 @@ LL | #[derive(Unresolved)] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0452]: malformed lint attribute input +error: expected a lint, found literal --> $DIR/deduplicate-diagnostics.rs:10:8 | LL | #[deny("literal")] - | ^^^^^^^^^ bad attribute argument + | ^^^^^^^^^ not the name of a lint | + = help: try using `#[deny(literal)]` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0452]: malformed lint attribute input +error: expected a lint, found literal --> $DIR/deduplicate-diagnostics.rs:10:8 | LL | #[deny("literal")] - | ^^^^^^^^^ bad attribute argument + | ^^^^^^^^^ not the name of a lint | + = help: try using `#[deny(literal)]` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0452`. diff --git a/tests/ui/diagnostic-flags/deduplicate-diagnostics.rs b/tests/ui/diagnostic-flags/deduplicate-diagnostics.rs index 48705266e3584..b070ec0f7dd93 100644 --- a/tests/ui/diagnostic-flags/deduplicate-diagnostics.rs +++ b/tests/ui/diagnostic-flags/deduplicate-diagnostics.rs @@ -7,7 +7,7 @@ //[duplicate]~| ERROR cannot find derive macro `Unresolved` in this scope struct S; -#[deny("literal")] //~ ERROR malformed lint attribute input - //[duplicate]~| ERROR malformed lint attribute input - //[duplicate]~| ERROR malformed lint attribute input +#[deny("literal")] //~ ERROR expected a lint, found literal + //[duplicate]~| ERROR expected a lint, found literal + //[duplicate]~| ERROR expected a lint, found literal fn main() {} diff --git a/tests/ui/lint/lint-attribute-literals.rs b/tests/ui/lint/lint-attribute-literals.rs new file mode 100644 index 0000000000000..34a4757adec3c --- /dev/null +++ b/tests/ui/lint/lint-attribute-literals.rs @@ -0,0 +1,11 @@ +// Checks that lint attributes with literals have an explanatory error + +#[allow("literal")] +//~^ ERROR expected a lint, found literal +//~| ERROR expected a lint, found literal +//~| ERROR expected a lint, found literal +#[deny(1.0)] +//~^ ERROR expected a lint, found literal +//~| ERROR expected a lint, found literal +//~| ERROR expected a lint, found literal +fn main() {} diff --git a/tests/ui/lint/lint-attribute-literals.stderr b/tests/ui/lint/lint-attribute-literals.stderr new file mode 100644 index 0000000000000..7434f8b5c5d4b --- /dev/null +++ b/tests/ui/lint/lint-attribute-literals.stderr @@ -0,0 +1,54 @@ +error: expected a lint, found literal + --> $DIR/lint-attribute-literals.rs:3:9 + | +LL | #[allow("literal")] + | ^^^^^^^^^ not the name of a lint + | + = help: try using `#[allow(literal)]` + +error: expected a lint, found literal + --> $DIR/lint-attribute-literals.rs:7:8 + | +LL | #[deny(1.0)] + | ^^^ not the name of a lint + | + = help: for example, write `#[deny(dead_code)]` for `dead_code` + +error: expected a lint, found literal + --> $DIR/lint-attribute-literals.rs:3:9 + | +LL | #[allow("literal")] + | ^^^^^^^^^ not the name of a lint + | + = help: try using `#[allow(literal)]` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: expected a lint, found literal + --> $DIR/lint-attribute-literals.rs:7:8 + | +LL | #[deny(1.0)] + | ^^^ not the name of a lint + | + = help: for example, write `#[deny(dead_code)]` for `dead_code` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: expected a lint, found literal + --> $DIR/lint-attribute-literals.rs:3:9 + | +LL | #[allow("literal")] + | ^^^^^^^^^ not the name of a lint + | + = help: try using `#[allow(literal)]` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: expected a lint, found literal + --> $DIR/lint-attribute-literals.rs:7:8 + | +LL | #[deny(1.0)] + | ^^^ not the name of a lint + | + = help: for example, write `#[deny(dead_code)]` for `dead_code` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 6 previous errors +