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

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 25 08:22:13 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)) {
----------------
AZero13 wrote:

Actually I think I should just say it: custom doesn't make sense here anyway; this is meant for archs with a rotr instruction. 

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


More information about the llvm-commits mailing list