Skip to content

document differences from pure hardware behavior#2176

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:hw-diff
Open

document differences from pure hardware behavior#2176
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:hw-diff

Conversation

@RalfJung

Copy link
Copy Markdown
Member

Fixes rust-lang/rust#153990 by documenting that the NaN rules also apply to stdarch intrinsics.

Rust does not have a general rule of "signaling NaN may be treated like quiet NaN"; that only affects a few operations (pow, powi, max, min) which just then state this caveat in their respective docs. My understanding is that stdarch wants to properly reflect hardware behavior here. That means however stdarch must be careful not to use the normal LLMV intrinsics for such operations. I think nvptx currently may be getting this wrong, which is already tracked at #2056.

@Amanieu also mentioned that for subnormals, the intent is that stdarch matches the hardware. I suspect this may be tricky since LLVM will probably reserve the right to perform constant propagation with full subnormal precision, i.e., "guaranteed subnormal flushing" is probably not going to work. But right now the ARM32 NEON intrinsics are unsound and can cause UB (rust-lang/rust#129880) so we can't really even have that discussion yet until that is fixed.

@rustbot

rustbot commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

r? @sayantn

rustbot has assigned @sayantn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Amanieu, @adamgemmell, @davidtwco, @folkertdev, @sayantn
  • @Amanieu, @adamgemmell, @davidtwco, @folkertdev, @sayantn expanded to Amanieu, adamgemmell, davidtwco, folkertdev, sayantn
  • Random selection from Amanieu, adamgemmell, davidtwco, folkertdev, sayantn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decide and document where stdarch intrinsics are allowed to diverge from asm behavior

3 participants