Skip to content

🛤 Non-trapping float-to-int conversions #1143

@jfbastien

Description

@jfbastien

This is a tracking issue for a post-MVP feature
It will be updated as the issue progresses.

Topic Non-trapping float-to-int conversions
Champion Dan Gohman @sunfishcode
Status in progress
Phase Implementation phase
Linked issues #986, #1089
Linked repositories github.com/WebAssembly/nontrapping-float-to-int-conversions

Details

The primary motivations are:

  • LLVM’s float-to-int conversion has an undefined result, rather than undefined behavior, and it seems LLVM does speculate it under certain conditions.
  • For the SIMD proposal, it’s more SIMD-hardware-like if no SIMD operations trap. This proposal would establish a convention for saturating operations which SIMD could share, to avoid introducing trapping.

This proposal is not motivated by performance data.

It's plausible that LLVM could be changed, to have something like an "nsw" flag for the "fptosi" instruction, especially with some of the recent proposals to modify the poison concept in LLVM. However, no one is currently working on this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions