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

    <tr>
        <th>Summary</th>
        <td>
            About division on amdgpu backend
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          0oyyo0
      </td>
    </tr>
</table>

<pre>
    I'm looking for information on the AMD GPU backend's support for integer division. I haven't found any instructions related to integer division in the ISA documentation, and the code I see for division, such as in AMDGPUCodeGenPrepare.cpp and SIISelLowering.cpp, uses other methods for calculation, e.g. (a/b---->a*(1/b)) . Therefore, I'd like to understand the AMD GPU hardware's support for division and why it's converted to other methods. I suspect it's because division is time-consuming.

One conversion method is as follows:
<img width="1138" height="1061" alt="Image" src="https://github.com/user-attachments/assets/cc106d72-af97-475d-997b-acb3151667db" />
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U9uOozgU_BrzcgSCQwjJAw_ZzqQVaUfbUu98gLFPsLeNjXxJlL9fmU6m9yLNE6hcVS6XfXgIerJEA-t-Y92x4Ckq54fa3e-uLkYn78OZYT-Dce5D2wkuzoO2F-dnHrWz4CxERXD4foTXtx8wcvFBVjLsA4S0LM7HhyTSRB6kvuqgna3gDIpfyTLsMyNZCdzeQdsQfRLZOoAnwyNJiO5_etCf-57fDyCdSDPZuAZi-ALcynVROElwhkC0ZnhqMyUkoYCHbHP4fnx9-_HiJL2SffO0cE-VWJbV5v18fifzu7uR13bKcFanQAFcVORhpqicDOsGghuRzM8YVE0VMNxxhqexLMuStd84wwPDXZMhhnuGe6jgT0WeLs5TVuW6JRj9QfncyUryIT5P9KxZcS9vPAv-0_PPfrLipu6g48oRzl7JP8r8V_J8EyGFhUR8kkcSPAX6R9kBop6pFM6GNOciWH1g9eEPSw_nlfbpmNk8F2KMuwXWZiJrX_Q8wU3LqFh7ZIhN0-4YIijSk4oPrN42GePmAZxnPlFGghefiIpxWT3xxPA06ajSWAk3MzylQL7kMXKh8msIDE88BFp_hGjqreyx5Jd9X276Tpb7fT-WXIxt0zXbbS_HvE-2bb8Vcmjlvt3zgoam77qm3WKNhRpaUW_22HFed4i79nKR1Pebyyi3zbjjYiz0gDV29a7Z1E1X11i13UUKKXnDhZA9EdvUNHNtKmOuc-X8VOgQEg1N13bYFIaPZMI6jIiWbrCuMsQ8m37IonJMU2Cb2ugQw5dN1NHQcBhdil_3lt_BLKclPeeySN4Mv-gw2z0-5eLdXyQiw9MaItf4SHkd8O8AAAD__0MaYbI">