Skip to content

document differences from pure hardware behavior#2176

Merged
RalfJung merged 1 commit into
rust-lang:mainfrom
RalfJung:hw-diff
Jul 10, 2026
Merged

document differences from pure hardware behavior#2176
RalfJung merged 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

@sayantn sayantn added this pull request to the merge queue Jul 4, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 4, 2026
@RalfJung

RalfJung commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

I assume that's CI being broken?

@sayantn sayantn added this pull request to the merge queue Jul 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 10, 2026
@RalfJung RalfJung closed this Jul 10, 2026
@RalfJung RalfJung reopened this Jul 10, 2026
@RalfJung RalfJung enabled auto-merge July 10, 2026 06:27
@RalfJung RalfJung added this pull request to the merge queue Jul 10, 2026
Merged via the queue into rust-lang:main with commit fceaa1b Jul 10, 2026
162 checks passed
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