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

    <tr>
        <th>Summary</th>
        <td>
            `compiler-rt` fails to compile on rv32: no u128
        </td>
    </tr>

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

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

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

<pre>
    Initially posted on https://discourse.llvm.org/t/int-types-h-in-compiler-rt-for-riscv32/66401

When compiling libstd for Rust, I discovered that `compiler-rt` does not compile on 32-bit RISC-V targets. I believe this is due to a macro guard that enables u128 support when `__riscv` is defined. This is the case for both 64-bit variants (which support u128) as well as 32-bit variants (which do not).

My workaround is to delete line 68 at https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/builtins/int_types.h#L68, which results in a successful compile.

I believe this guard should be expanded so that it does not trigger on 32-bit targets, which may be detected in a number of ways such as checking if `(__riscv_xlen == 32)`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVE2PmzAQ_TVwGYHAEJYcOKS7qrRSe9lW7TEyeAB3HRv5I9n8-45Jmma7p0oOA4z95s28R3ojzt2zll5ypc6wGOdRgNEwe7-4pNol7DMtId1ggnWYK3U85MZO9NLTT2qf-fOCLpszqbPBHBap0GbWZ6OhQOeOFaONTVMXZVI8JcXucv05o4bLfqknULJ3XgAdgpfgCPoRnmEte0RLlPzMPSRNcVeBnkAYdKCNvyJhpF6xrJceXp6_PWY_wHM7oXc5wfWoJB6RsKQDWiLQvQEOBz5YA1Pg9loINe8VIYeSteDCshjr4RQZU9H9fm0rlo8gOEqNIofvV1Q_Iwzc4dpLb_wMTb0SOnIrufYOEtaeZjnMN-RYJmFb4A5OqFSM1yY-nhEm9ku78_tpfj3DydhXbk3QYmVhiJlCjzRZjdC0QG29F3WSfg59TpOjh6jrNWSLNb9wiPL2yvQUDlxqCvezp60ypvoglZfaXbywX72QzwmrvjRtFPFC2qILirqQmqbtwjCgc2NQf1R718o_Ol1UcbMJSlAG8G3hWpAjnLloRVO6ucBbOU1o71xwlf8vlQM_RxhBoxmi11dKOhz6eGyEEz-7yHCOIgwzDq_RnXKMwpMGV-33byp6oXqiBdHfW0rnKXZl0zw0Zcu2bSq6SmyrLU-99Aq7j94duVSrUHfetfFrqXbUzGqKNFjV_bdq0rmAUZFN27ImnbsHsa0H3GyKoR_rclu3ragemlaUoq7EwDBVnGbuumTzKWFM4wlWCLpPNk-p7FjBWFkWm6Iq27LNy3ooaja2m6IZsS-bpC6QLKJufw6p7VZKfZgcJZV09AHektw5OWnEtRzh8-BnY7s307t0rdutvH8Dt52FRQ">