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

    <tr>
        <th>Summary</th>
        <td>
            [DirectX] Scalarize HLSL intrinsics into DXILOps
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:DirectX
      </td>
    </tr>

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

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

<pre>
    To support scalarization we need two sets of changes. First we need to know which subset of DXIL Ops should be scalarized. And then we need to  scalarize these DXilIOPs.

To do the first part we will look into labeling in `DXIL.td`  the goal will be to have a flag in  DxilOps or to create a subset of  LowerMap in `DXILOperation.inc` that we can look up intrinsics\CallInst against.

We  will then modify `lowerIntrinsic` in `llvm/lib/Target/DirectX/DXILOpLowering.cpp` to check for this flag set in order to replace an intrinsics with a set of DXILOps. In this case we do scalarization as part of DXIL lowering. Advantage to doing it this way is we are limiting the intrinsics to just those that map to DXIL Ops which means we don't have to check intrinsic scalarization across all CallInst.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxclEtv4zYQxz8NdRlUkOiHkoMO7hpGDaRIgQ3QXEfkSOKGJgUOFTf76QtSfu1ebIOcx2_m_6eR2QyOqBWbP4WUPYaf3lkhpdjsC5zj6EN7OSw6r7_aNw88T5MPEVihxWB-YjTewZnAEWmIZw9MkcH3oEZ0A3EJBxM43kM8fDh_hvNo1Ag8d0wxhe_fjy_wOjHw6GeroaNbD9Il7JyGOJJ7rHMPSFdMsH839vj6D5ei2otqt3y-edA-BUCfQSYMmeZsrAXr_QcYFz1Y7MgaN4BxILZVwimjFtsKcu7g0S4pHaXeI34SIPQWcwbs_zM20fuQblUgjOn-Ph-8-DOFv3F6aPA6UcgLLI1TqVUcMbMpdAvanMJjMI6NYrH59g2tPTqOgAMax_GXSf8lWBDzok5em_4rtbKp8_FaJvVZEKz9PAl5sKYT8vCGYaAo5GFvAqn4nn5lxMxt3FCqacqMHtRI6gP6NOtoeFlCGtM48EFTXkGgyaIiQPcwAZxNHNNa7pq_TlzC0S2VFDKl-bX_zWDIi25Xo9grFOz0J7qIQ1ZF-6xgXKqd8QvSFwEGAmtOJqbrJOcDUvTwY-aU4pkWBU44peObJRevnggdL3ROyCYuHrit41byd3QVPDOgtXBVryx0u9LPq2csqK0bua6b7eapKca2ltuueyat5bruO6WrflXVvZZY4bbGpitMKyu5rp5kVTebrWxKrJ_0umqoQey6zVqJdUUnNLZM6pY-DIVhnqmtq03dPBXZ5nx58R2qD3JarHY30fPbD21K_qObBxbryhqOfC8XTbT5L-Oas9nD99tD_Ovl-8vjdvPbuuhczMG2Y4wTi9VOyIOQh8HEce5K5bMRL35Mvafgf5BKfsz4LOThMsFnK_8PAAD__0_tm4g">