llvm / llvm/llvm-project

Stop making assumptions about subnormals and NaN payloads

Open
#182,746 20 comments 0 reactions 0 assignees View on GitHub
floating-point llvm question
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The behavior of subnormal numbers and signed zeros in particular is target-specific. Some platforms simply cannot support subnormals or signed zeros without software support code that might not be present. The only long-term solution I can think of is for LLVM to stop making assumptions about this:

- Treat operations on subnormal numbers as opaque.
- Do not constant-fold operations that produce subnormal numbers as intermediates (even if the final result is normal).
- Do not assume that the payload of NaNs is preserved.
- Do not assume that the sign of zero is preserved.

This will avoid problems on platforms that omit full IEEE 754 conformance in the interest of speed, cost, or power consumption.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.