<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/57045>57045</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            llvm::ConstantFP::get always returns Value of type FP128
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          AldrinMathew
      </td>
    </tr>
</table>

<pre>
    The following statements always returns `Constant*` of type `FP128` instead of the provided type
```cpp
llvm::ConstantFP::get(llvm::Type::getFloatTy(ctx->llvmCtx), std::stof(strvalue));
llvm::ConstantFP::get(llvm::Type::getDoubleTy(ctx->llvmCtx), std::stod(strvalue));
```
> `strvalue` is a string representation of the floating point number.

In fact, for all variants of floating point numbers provided to the `get` function, including `BFloat`, `Half`, `X86_FP80`, `PPC_FP128` and `FP128`, the returned `Constant*` is of type `FP128`.

In order to circumvent this, I tried to cast the obtained `Constant*` using `llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateFPCast`, but that also fails

**OS**: Ubuntu 20.04 LTS
**LLVM Version**: `14.0.6`

@lattner Any comments?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVNmK2zAU_Rr7RYxR5GWcBz9kGdPADA1tOvRtkG05UVEkoyUz-fteydkY0lIoCAvpLufec67cqO5YbXYM9UoI9c7lFhlLLdszaQ2i4p0eDdLMOi0Nigq8UBLs0kZkBiekemSPA_OWej0hpb_j4MFoF2yQeNDqwDvWBccILyPsI8fVDsN4I8RhH6UzWGeAej2etwywyqt947OcLbVQ1G6O4NDaj4coffJ-C_sRkWlEFtBJN7oaq3pwMlYfqHAsmKdROv8v8KVyjWD_ht79Gf1CxumYPnk2L86eUBACsmkvjmaDZgbEoZYreea49zx486C4tEi6fcN0ckoYviuJetpaX1evNAgr0IFqTr3KkORuAnOjnQo4UI2nBGrqnWx9BT4hl61wnY8Gyzxo4tsBC2xfqOivp59l8VavS3y9Wa8Xb5fRobK7HSXv4mHH-WPdnQHk5t4Mfm5d6Y5p30TLdev2B-APEnPjAVYImB1bbKmxAVA1lvL7gM6cGr1Oxerb3HEBCFG6uDNLKpgA6U7EkvXUCbuShmnrEzydgjWDR1ivF1DRiYjG-dqoBe2MAjG5MLdd-vLI7Ov3cYcU6EfjpHWI4ARn6Hnz_dbv-fn1Bb2CxEHCcwQgTbIEJ8V1GsdvhgW1VgKHM3lErdqH30OU1jGrJgVEkXJakLir0m6aTmlsuRWs-uu7-vxvefXTftEyCBk7LaqdtYPxUaSGteV255oEKoBDyD9uDzCpv5if75ob4xgoW-ePOMvjXdWSvO0pnpQE44K2GS1SnOMp7R6zspmWeSxow4Sponwe5cuYVwQTgssJnuAcWksykrI0a8s-JSVtcApssD3Qn3jgROltrEOrD43bGk8VN9ZcjdQYvpWMnfNTZ3dKVzPRwYN-oTBu73GouQoF_wZX57ZF">