Skip to content

core_arch::x86::avx512f intrinsics with rounding do not compile #140352

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

Open
TechPizzaDev opened this issue Apr 26, 2025 · 0 comments
Open

core_arch::x86::avx512f intrinsics with rounding do not compile #140352

TechPizzaDev opened this issue Apr 26, 2025 · 0 comments
Labels
C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.

Comments

@TechPizzaDev
Copy link

TechPizzaDev commented Apr 26, 2025

I tried this code:

core_arch::x86::avx512f::_mm512_cvtps_ph::<_MM_FROUND_TO_NEAREST_INT>(value)

I expected this to compile.
Instead, this happened:

error[E0080]: evaluation of `std::arch::x86_64::_mm512_cvtps_ph::<0>::{constant#0}` failed

                static_assert_sae!(SAE);
      |         ^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: Invalid IMM value

It seems that the assertion macros static_assert_sae and static_assert_mantissas_sae are not checking the flags properly and error on most valid values.
https://github.com/rust-lang/stdarch/blob/e907456b2e10622ccd854a3bba8d02ce170b5dbb/crates/core_arch/src/x86/macros.rs#L18-L22

As an added note, some docs seem to be inconsistent with Intel® Intrinsics Guide:
Rustdoc of _mm512_cvtps_ph only mentions _MM_FROUND_NO_EXC, while Guide mentions many flags.
Rustdoc of _mm_maskz_cvt_roundps_ph mentions flags with _MM_FROUND_NO_EXC, while Guide does not.

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (b4c8b0c3f 2025-04-25)
binary: rustc
commit-hash: b4c8b0c3f0533bb342a4873ff59bdad3883ab8e3
commit-date: 2025-04-25
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

@TechPizzaDev TechPizzaDev added the C-bug Category: This is a bug. label Apr 26, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 26, 2025
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. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.
Projects
None yet
Development

No branches or pull requests

2 participants