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

    <tr>
        <th>Summary</th>
        <td>
            Possible bug in compiler-rt 128x128 `wideMultiply`
        </td>
    </tr>

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

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

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

<pre>
    [This bit of code](https://github.com/llvm/llvm-project/blob/49b209d0d1833a339e66735e1288c1805224603e/compiler-rt/lib/builtins/fp_lib.h#L145-L185) seems to have a bug where it is missing the carry bit. This was discovered when I was porting the function to Rust's compiler-rt and results of unit tests disagreed with Python, see https://github.com/rust-lang/compiler-builtins/pull/587#issuecomment-2060543566 and the followup discussion.

To reproduce - `"0xffffffffffffffffffffffffffffffff * 0xffffffffffffffffffffffffffffffff` should be `0xfffffffffffffffffffffffffffffffe00000000000000000000000000000001`, but this function returns `0xfffffffffffffffffffffffffffffffd00000000000000000000000000000001`.

cc @marthadev who found a fix for the Rust side.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2L5DYQ_TXypehGLlv-OPgw2aEhsIEl7D3IVtlWUEtGJU3P_Psgh01mLzu7Othg-VW9enpPmtlunmgS6jehniud0x7ilLYYmBtVzcG8lb2vu2WYbYKwwhIMCfUscNhTOlg0TwJvAm-bTXuer0u4C7w59_LtdTli-JuWJPA2uzALvLXjjHI00tRD0-imGanr-kZRjcOw1INUiG0nGxJ4W8L9sI7iJRa8swU-Z-uS9Szwth5_OTtfd4HN57pVl8_1oASOwER3hhRg1y8EGua8wWOnSGATWIa7ZbZ-g7QTLDrGtzLcFc4xH5rBWF7CC0UyBebh9_PrEWL6hlqzX5INvjT5M3MS2DO8YwvaG4jE2SUuqmVvEyTidBbXW6RS26YdvrylPXiBnwpr-IGmMXO6OO2397q8E-PIzgm8qaEX2FjmTEu438mnC8pOqrZRXXfSOvkH58IjH-eomdkGfxXyWcinf59fA0Q6YjB5IbiA6KRAlK_rBwsEPsHHv4lOAu8hOwMzleIfQkj-eNUnw08w5wSpHON_BxQp5ej5p7qYn-jynUzLAqKVdx3Trg29wGMPsIbsDWhY7SusIZ5yF4sAW0PXykyNGZtRVzTVfd1K2Ss1VPtESvV9P5h6bE1vRlz6rtVY46jWWa_aVHZCia1sUcm6xma4Dh32ddPSPKx9K1UtWkl3bd21xO4a4ladLphGKeVYOT2T4zPpiJ4ecG4KxBL8OJ1RnfPGopXOcuL_qySbHE1fArOdHZ1hsv47s9c4vNY4FI0f1tAf2SV7uDfRySpHN_3yRXFSK54-qf8TAAD__1ObgEE">