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

    <tr>
        <th>Summary</th>
        <td>
            Missed optimization for constant loads using x87
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    The X87 extenstion provides multiple builtinns to load constants such as:
* 0, 1
* E, PI
* log(2), ln(2)
* log2(10), log2(e)

Clang only seems to generate the `fldz` and `fld1` instructions,
incomparison to gcc, which seems to generate all of them.

A quick demonstration/comparison can be found [here](https://godbolt.org/z/93b8xbazq)
Also tested with godbolts trunk version of clang as of 25.04.2022
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxlUk2TnCAU_DV6eRVLUUc9eJjsZio5pCqHHHJFeI5kEWYF5uvX5-Hu7ExtqkRoeHb3axmsvPS_J4Q_bQN49micV9bAYbFHJdHBHLRXB40wBEUrYxx4C9pyCcJSMTfegQtiAu6Scpvkz0m-TdgW8oQ9QXHH3yL-9eO-oe0-YS1LWBdPtLmBxwLaaIv8VvKG8V60vp80N3uwRl_AIc6rvz0aXLhH8NRasslHLa80ATfyHRYRKmpgCSJ27EjhjU8ZYecDX5SjHCKXEFH9NClq8n8FrjXYMQrN2aOtLbwGJV5A4hxzolpSSdjugVxwAwPCaEO0VX-dcMGkfqYeJ-8Pa5xsR8_eysFqn9mFEttdaXTl0J4Hfn39yGKrnQWPzqOEk_ITvH9EZpdgXuCIi4s_lqyKNTDu4prVWV5lLGcslX0pu7LjqVdeY_9TOUdc9uDVrK6re3K6fPz19Q44CE4R2blt0rDo_pNv8hGGjDomoPXxNn2h2_UXhSdIIgEp-11d502VTn2NTdU0-aZmXI40Khy7LhfjgG0jsC1TzQfUrqe4EsYMnmCloDUll6o-tpJXrC6qoqjbrGRjWQ8F20jcjHXdJVWOM1c6iz5ioOnSr5aGsHd0qJXz7n7InVN7g7jKET8PfrJL_x2NVFxerDJFuur3q_9_DasM8g">