[KnownFPClass] `roundToIntegral` does not account for input denormal mode
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Under `DAPZ` (denormals are positive zero) a negative subnormal input is interpreted as `+0.0`. So `trunc(negative_subnormal)` may produce positive zero.
In total, this impacts these functions:
- `trunc`
- `floor`
- `ceil`
- `round`
- `roundeven`
- `rint`
- `nearbyint`
Currently, `KnownFPClass::roundToIntegral` does not account for the input denormal mode and assumes that if the input is not a finite positive then the output will never be a finite positive. But under `DAPZ`, a negative subnormal could become positive zero, invalidating this deduction.
https://github.com/llvm/llvm-project/blob/9932f190f42e1a12c3cafea23938241abf6337ca/llvm/lib/Support/KnownFPClass.cpp#L766-L770
Contributor guide
Research direction
Start in llvm/lib/Support/KnownFPClass.cpp at the roundToIntegral logic around lines 766-770. Trace how the input denormal mode is represented and how the result deduction affects trunc, floor, ceil, round, roundeven, rint, and nearbyint. Done means the DAPZ case, including a negative subnormal becoming positive zero, is accounted for without invalidating the other deductions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100