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

    <tr>
        <th>Summary</th>
        <td>
            [mlir][SPIR-V] Question: How to lower math.isFinite to SPIR-V?
        </td>
    </tr>

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

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

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

<pre>
    Hi, I'm working on a project that involves lowering math.isFinite to SPIR-V. I've noticed a few things and would like to confirm whether the current infrastructure supports this, and how best to proceed.

Current observations:
1. math.isFinite is already supported and lowered to the LLVM and NVVM dialects.

2. However, I couldn't find any existing support for lowering math.isFinite to the SPIR-V dialect.

3. The SPIR-V dialect itself does not define an equivalent operation (e.g., spirv.IsFinite), but the SPIR-V specification does include the OpIsFinite instruction.

My questions:
1. Is it expected that math.isFinite should eventually lower to a SPIR-V operation like OpIsFinite?

2. If so, should a new spirv.IsFinite op be introduced in the SPIR-V dialect to support this?

3. Or is there a recommended workaround for this case (e.g. combine isinf/isnan with boolean logic)?

I'm currently exploring the feasibility of this lowering and not yet planning to submit a patch. I’d appreciate any guidance on the intended direction for this feature.

Thanks!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VE1z2zYQ_TXQZcccCrS-Djw4cTXRTNy0acZ3EFiKW4MAA4CU9e87C1J2k36cNCNi97197-2qGOnsEGux-SA2jys1ps6H-qu6tq921XhzrT-RkB_hJOSuh4sPL-TO4B0oGIL_E3WC1KkE5CZvJ4xg_QUDv-lV6gqKR3KUEJKHP347fb17LnKrCcH5RBoNKGjxAqkjd46gnIGLH60BSy-5SnvXUujh0mHqMEDqEPQYAjoGbYOKKYw6jQEhjsPgQ4rcLDJp7tb5CzQYE_cagteIphDlgygfPi5dfBMxTCqRd1FU_GVd_MSeIigbUJnrDYSJOzNPi4abM7HPn5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