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

    <tr>
        <th>Summary</th>
        <td>
            Move unregistered intrinsic logic to ModuleImport
        </td>
    </tr>

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

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

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

<pre>
    Interface can do the following:
- Try to convert intrinsics to registered intrinsics in one of the dialects.
- Return failure if it couldn't convert the intrinsic.
(no handling for unregistered intrinsics at all)

The module import could then:
- Try to convert the intrinsic to an operation using the interface (except of course your new flag is set).
- If the conversion fails instead of emitting en error just translate to llvm intrinsic call.

I would expect that this works quite smoothly except there is some issue with the error handling. I coming back to it bcs the interface should usually do the dialect specific stuff while the import itself contains most of the LLVM IR specific stuff. 

_Originally posted by @gysit in https://github.com/llvm/llvm-project/issues/130685#issuecomment-2715445986_
 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyklMGO2zgMhp9GuRAT2HI8iQ8-dFEECNDBAkWx10KWaVutLHpFatK8_UKOZ3ZmsXPqxQJE6-fHn5QMsxsDYqvqP5TWnTWxJyZPC7LSWtWfdybJRLF9F9p11N_aSxCMg7EI1gToCWRCGMh7urowquqTKj6r4tMDfIs3EAJL4RmjgAsSXWBnOe9GHB0LRuzfBlwACgg0rKK9Mx6t8P5F8StKigEG43yKCG4AJ2Ap-T4ofZTXVPnwq-p2WulTIJhM6L0LIwwUIYX_pzACxnulm-3k-v02IczUJ4_g5oXiljjnCh8X_Y4kB0wAWjAacRQgcUbZ_tlMVfqEvywukl2wlCIj3ChFCHiFwZsRHAOjKN28-nK5-3VPylk5W5TtZEHTZyWcnUjOhgEwRorwI7GARBPYG8HM5v3z_IbWGu_3by24wHUtGX8taHNtJn8cw5XiT4a_kxMEnolk8jfYqpAJc6sYmOa8ckK4OplW4jvJS1P2cAFLc6bsjP2ZkZxAlwfmnUU8rRiJk_H-9jKC27QAL2jd4CywpGGA6-Q83gXubXPC6LO1QYwLDDOxvEzcly9_PcHl63809vDWhe9_Rje6sKZeiAV76G6gDsV4Y5fHHCaRhfNM6LPS59HJlLq9pVnpc7Z4Wx6WSD_QitLn1RVW-lxWxeOpVrpadyzNMwZ50MeyPhzq5vT4_Y4Au76t-qZqzA7b8ngom7LWRbOb2tqcStOVZa_7x2OlD82hr7BsmqI86do-mp1rdaHroioPRamLotkfi-bUFfpUDl1RWdOoQ4GzcX6fGfcUx93K0pZVqety502HnreHI4_kGt0ejdiuhXVpZHUovGPhf2XEicf2iZ7xg4sHnsb7JXla79ll7dcuRd_-jqMr9nOr_wkAAP__XxmxCA">