<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/116695>116695</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[NVPTX] Port code to `llvm/lib/CodeGen/SelectionDAG/*`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue,
backend:NVPTX
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
justinfargnoli
</td>
</tr>
</table>
<pre>
Some of NVPTX's custom operation lowering and custom DAG combines do not rely on [`NVPTXISD` nodes](https://github.com/llvm/llvm-project/blob/6dceb0e34ed3dd4be72d211abb8c9c447bd57735/llvm/lib/Target/NVPTX/NVPTXISelLowering.h#L22). A majority of these operation lowerings and DAG combines can be ported to live in [`LegalizeDAG.cpp`](https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp) or [`DAGCombiner.cpp`](https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp) respectively.
This will increase the coverage we have on this code and enable other targets to benefit from the work we've done.
For example,
- Custom Lowering
- [bitcast](https://github.com/llvm/llvm-project/blob/f8d1905a24c16bf6db42d428672401156ef6a473/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp#L2373-L2395)
- [concat_vector](https://github.com/llvm/llvm-project/blob/f8d1905a24c16bf6db42d428672401156ef6a473/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp#L2351-L2371)
- [int -> fp / fp -> int](https://github.com/llvm/llvm-project/blob/f8d1905a24c16bf6db42d428672401156ef6a473/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp#L2777-L2806)
- Custom DAG Combines
- [rem](https://github.com/llvm/llvm-project/blob/f8d1905a24c16bf6db42d428672401156ef6a473/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp#L5744-L5773)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlc2O4zYMx59GuRAJLNqW44MPaVIPCgTFAjMoeiv0QTualaVAUjKdPn1hJ4PdHfTQdoHFXGJEHyR_f1KkTMmOnqhj9U-sPqzkJZ9C7J4vKVs_yDj64OxKBfPaPYaJIAzw62-fnn5n2CTQl5TDBOFMUWYbPLjwQtH6EaQ3b7uH3QPoMCnrKYEJ4EOGSO4VgofZqSgWg788HpgowAdDidUHhttTzufEyh3DnmE_2ny6qI0OE8PeuevbZ32O4Zl0ZtgrFxTDXhhNqqCyIlMaUylq0CDnUqmtbnVVNcrUTVPWX9mx870nGUea7dwB-3tc5I53rM2JYXlEZNhuYAeTfA7R5tdZlHyiRP-gRFqk-EYDLT0ognOImQzkAM5eCeybGkcapbN_0WH3sNHnMxPF98kxSevfo-6DoQealx_JkZ4jPuweGPbvnWMLId4DO-we9jeG-OMDe-8cW4iUzvORK7nXDbDiwIrd7ffpZBO8WOfAeh1JJprzAzpcKcqR4IXgJK80V2Cej-pgaMkTeakcQcgnipCXekhzhhR5GmyGIYZpMfUS4md4IYbNlcAET98G0IcI9Keczo4Y7u9ba9jfXsRbOd2WAdazwMpmLVP-PkmHreFtUUusNBdqEEZVaCrcigargvNa0CBk1ZT_o_QX0csjlk25PmLZ1gzbO8ASvw5ey_zHlXQO8eNT1HymaPg7CuszrFn5MwxnYNjPn-Wv9R8_M03TrI-4LcTXTPsvTfj-ftJb2d2II00fnaxuqmp9nHs2w3ZlutK0ZStX1PGm5K0QTVmvTp0yQiou28oMOFRYlbqupRFFZQquxBZXtsMCK875FnmNvN6QaXjJByELUwmuNasKmqR1mznOTYjjyqZ0oY5zIdp65aQil5ZBiTiGYGCwMWVYDrF5KuwZopL6M3nDyt2dC-exGrtFPHUZE6sKZ1NOX7xkm90ygG836gN8CjHfulIOwETx73okwx0TxeoSXfefk7lAJIb9Hfba4d8BAAD__6bchV0">