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

    <tr>
        <th>Summary</th>
        <td>
            ARM: error in backend: Cannot select: intrinsic %llvm.arm.hint
        </td>
    </tr>

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

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

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

<pre>
    Reduced testcase for https://bugs.debian.org/1005871

```
$ cat test.c
void a() { __builtin_arm_sev(); }
$ clang -c --target=arm -mcpu=arm946e-s -mfloat-abi=soft test.c
fatal error: error in backend: Cannot select: intrinsic %llvm.arm.hint
...
```

The bug exists at least with LLVM versions 11-14 from Debian unstable (other versions were not tested).

Note that this is an armv5 CPU where the instruction in question does not exist, using `-mcpu=cortex-a9` instead works and emits the instruction.

https://developer.arm.com/documentation/101028/0012/7--Synchronization--barrier--and-hint-intrinsics
> The intrinsics in this section are available for all targets. They may be no-ops (i.e. generate no code, but possibly act as a code motion barrier in compilers) on targets where the relevant instructions do not exist.

The frontend is correct in accepting `__builtin_arm_sev()` despite the instruction not existing, but treating it as a no-op in the backend seems to go wrong or is not implemented.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVE1z4zYM_TXyBSONPix_HHRI4ua02-lst71mQBG22FCkSlL2ur--IGVvkm1761gj0aAIPLz3IGHltftCcu5JQiAfevQER-tgCGHyWfOQ1c98ifnkC0lCoSmsO3GkKst2t62y8pCVD7f7prxdy996DT2GlLbol9jZKgmY1bus3kO2fYSXFzErHZR5QTe-eDove1nzyNuHd4k0mhPkPeR5QHeikDUHPgH52E_zst6vN5R7jhy1xZCjUBz39vgRwREDaiDnrOPulgUoAwL7VzIyxp7QGBvAk6Y-xIAywSnjVQ9Z3Wp9HgsuVwwcXnIWRfHvDKT714GA-QP6pnzwwIxoQh_gosIAnz79_hnO5LyyxkNV5dUajs6OcEhkw2x8QKGJK-9sGMi9vXwhRxCBxvZIMmvF-7I_20AQhijAoDzwxekY97mFp19-g8sQj3NG7s4HN_eBk0Yi_pw5XVxLSz7lT8Cz-glmr1gEbu_Oem9doG857jmW8hBKuFj3GotJoFFxwz_U-ADyo8sknUnbiVzit7djjNl-HskEjGeT76oyWuS5LKuaH9s8__Vq-sFZo_5KL-W5QOcUuTxnEHmUKf-uoL9Vb36CrwnXPR5bT0R5WqhApgfPqHSiP44Eag2L-XwRT19hxCuIKEJuJx8lUgUVcCJDDkOMQ28lRerEHGCy3iuhr4B9AGSK0i6MNtW7gY44uPNJadY5Tglv3Yq-08yxN89owntiPSv2plfxowXZVSaww6MTWDfHbcZa2Pc0hZuu_zWNrK4kP6nwT8d8L8gp7o0GR5hSqlufiaCFYbpPGhNNI7vDwsnChcGdIE7iYjk1Tpqi7CSLlewauW_2uAoqaOoevnz-HyZ3NTvdfbTfiQdyFjffxZdvj3xy9o-YsH5W3vN48KLdtLtqNXRC4nEj2paIthtB22pfbmqU-_W2rEW7bldsH9K-y9rHrD2sVFeXdV1uK_4163pT7ATVDQrc7ORONE2ZrUsa2XRFAsuf2pXrEob4BeZNHb8hb5vIjjoZont-nMNgXfcgHX88HmfzukqIuwT3b9jB9S0">