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

    <tr>
        <th>Summary</th>
        <td>
            [mlir][arith] `--convert-arith-to-llvm` miscompiles `arith.ceildivsi`
        </td>
    </tr>

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

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

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

<pre>
    For the following code, the code computes `ceildivsi -128, 7`, with an expected result of `-18`.

However, `--convert-arith-to-llvm` produces an incorrect output of `18`.

Reproduction: https://godbolt.org/z/cWf96T8v3
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEkb2unDAQRp9maCyQGWMWCoq9WaHUUaTUYM-CI4ORf3Zz8_SRWSWRkuI2DLLnO9bMmUIwy040gHwDeSumFFfnh8PsS1jNeypmp9-H0XkWV2J3Z617mn1hymkC_HSe5n-m3HakSIFByxUZq80jGFbW2OW2C7Q816eJK5t2Rj8OUpE08xSSjczdc66sO2h5BfwG_Pr6fnZPepDP2dxQKrc_yMdy8iauZXSltY8NWs4O73RSFDLd7Mp5Tyoyl-KRfuP_p3-hVywat4O4sjXGI4C4Ao6A4-L07GysnF8Ax5-Ao_p279uv3UMUehC6F_1U0FBfaiGFqHtZrIOu8d41F9kJ5G2nhcS560XX95dGdLquCzMgx4Y3dV8LbIWsJEc5Y61bjp0m4tBw2iZjqzxZfrswISQaMgYLO81kw2kLcbPGA2L25ofcXs5pCdBwa0IMfwHRRHsaPgPyBvLt3B_I2wdb3UzIYo19iT3vqz96oeVF8nb4Z20mrmmulNsAxxP0KuXh3XdSEXA8JwqA4znUrwAAAP__cc3JZw">