Skip to content

_mm*_mask_cmp_*_mask::<7> comparisons don't respect the input mask #133067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CatsAreFluffy opened this issue Nov 15, 2024 · 0 comments · Fixed by rust-lang/stdarch#1694
Closed
Labels
C-bug Category: This is a bug. F-stdarch_x86_avx512 `#![feature(stdarch_x86_avx512)]` T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@CatsAreFluffy
Copy link

I tried this code:

#![feature(stdarch_x86_avx512)]
use std::arch::x86_64::*;

pub fn main() {
    unsafe {
        let x = _mm512_setzero_si512();
        let mask = _mm512_mask_cmp_epi32_mask::<7>(1, x, x);
        println!("{mask}")
    }
}

I expected to see this happen: It prints 1 (compare this similar C++ program)

Instead, this happened: It prints 65535 (Godbolt, since the playground doesn't support AVX512)

This issue applies to all _mm*_mask_cmp_*_mask functions, not just _mm512_mask_cmp_epi32_mask. It seems to have been introduced in rust-lang/stdarch#1597.

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (8adb4b30f 2024-11-13)
binary: rustc
commit-hash: 8adb4b30f40e6fbd21dc1ba26c3301c7eeb6de3c
commit-date: 2024-11-13
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3
@CatsAreFluffy CatsAreFluffy added the C-bug Category: This is a bug. label Nov 15, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 15, 2024
@jieyouxu jieyouxu added T-libs Relevant to the library team, which will review and decide on the PR/issue. F-stdarch_x86_avx512 `#![feature(stdarch_x86_avx512)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-stdarch_x86_avx512 `#![feature(stdarch_x86_avx512)]` T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants