| Issue |
244102
|
| Summary |
[KnownFPClass] Add toUnsignedRange/toSignedRange/toSignMagnitudeRange
|
| Labels |
llvm:support,
floating-point,
llvm:analysis
|
| Assignees |
ZERICO2005
|
| Reporter |
ZERICO2005
|
For float32, `fcPosNormal` has values ranging from `[0x0080000, 0x7F7FFFFF]`. I think it would be good to have `KnownFPClass::toUnsignedRange` and others to parity `KnownFPClass::toKnownBits`.
In addition to adding `KnownFPClass::toUnsignedRange` and `KnownFPClass::toSignedRange`, I think it would also be useful to also have `KnownFPClass::toSignMagnitudeRange` which corresponds with IEEE total-ordering.
Currently, `KnownFPClass::toKnownBits` can only give a weak bound for the unsigned/signed/sign-magnitude range of a `KnownFPClass` value. The only useful information `KnownFPClass::toKnownBits` can provide is the sign-bit. Since `fcPosNormal` does not have any known bits, the range would be reported as `[0x00000000, 0x7FFFFFFF]`.
***
There is no current strong motivating use case for adding these currently. It would probably consider adding these if we would want `ConstantRange` to have better information that what is currently provided by `KnownFPClass::toKnownBits`.
One use case I can think of would be optimizing software (integer) floating point comparisons. But we don't do this currently since `x == 1.0f` will currently emit a library call instead of `x = 0x3F800000` for soft-float targets.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs