| Issue |
243132
|
| Summary |
`[InstCombine]` Fold `exp(subnormal)` and `exp(+inf)` to `x + 1.0`
|
| Labels |
good first issue,
llvm:instcombine,
floating-point
|
| Assignees |
|
| Reporter |
ZERICO2005
|
https://github.com/llvm/llvm-project/blob/f1b92cc3a1b0d13b01633b1d333a033b2da8006a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp#L3194-L3203
Currently, we perform these folds:
- `exp(zero)` --> `1.0`
- `exp(zero | NaN)` --> `x + 1.0`
- `exp(+-inf | NaN)` --> `select (fcmp ueq x, +inf) x, +0.0`
Since `exp(x) = 1.0 + x + ...`, and `1.0 + subnormal == 1.0`, we can also fold `exp(subnormal)` --> `1.0`. Also `exp(+inf) == +inf`.
TODO:
- Fold `exp(zero | subnormal)` --> `1.0` (Invalid for `RoundingMode::Dynamic`, although we don't have to worry about this here).
- Fold `exp(zero | subnormal | +inf | NaN)` --> `x + 1.0`
- Also make sure we do **not** fold `exp(zero | subnormal | +-inf | NaN)` --> `x + 1.0`
These also apply to `exp2` and `exp10`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs