Skip to content

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

Closed
rust-lang/stdarch
#1694
@CatsAreFluffy

Description

@CatsAreFluffy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-stdarch_x86_avx512`#![feature(stdarch_x86_avx512)]`T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions