[llvm] [DAGCombine] Improve bswap lowering for machines that support bit rotates (PR #164848)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 06:13:07 PDT 2025


================
@@ -9899,6 +9899,18 @@ SDValue TargetLowering::expandBSWAP(SDNode *N, SelectionDAG &DAG) const {
     // Use a rotate by 8. This can be further expanded if necessary.
     return DAG.getNode(ISD::ROTL, dl, VT, Op, DAG.getConstant(8, dl, SHVT));
   case MVT::i32:
+    if (isOperationLegal(ISD::ROTR, VT)) {
----------------
arsenm wrote:

legal or custom? 

https://github.com/llvm/llvm-project/pull/164848


More information about the llvm-commits mailing list