[llvm] [SelectionDAG] Promote FPOWI/FLDEXP exponents where possible, and raise an error otherwise (PR #200621)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 02:04:38 PDT 2026


================
@@ -2821,13 +2821,27 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) {
   // we rewrite to a libcall here directly, letting makeLibCall handle promotion
   // if the target accepts it according to shouldSignExtendTypeInLibCall.
----------------
nikic wrote:

So if I try something like this:
```
define double @test(double %val, i64 %x) {
  %call = call double @llvm.ldexp(double %val, i64 %x)
  ret double %call
}
```
It will happily generate an ldexp call even though i64 is not the int type. It's weird that i48 generates an error instead because it promotes. i128 also generates an error because it expands.

I'm not sure how this is actually *supposed* to work. Maybe @arsenm knows.

https://github.com/llvm/llvm-project/pull/200621


More information about the llvm-commits mailing list