From 11284ea499c5f2f1ef81b162503e5b4928d152f7 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 31 Aug 2008 01:13:31 +0000 Subject: Another situation where ROTR is cheaper than ROTL. llvm-svn: 55577 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2521609f5b6..e414fdfa7ab 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2044,10 +2044,10 @@ SDNode *DAGCombiner::MatchRotate(SDValue LHS, SDValue RHS) { if (ConstantSDNode *SUBC = dyn_cast(LHSShiftAmt.getOperand(0))) { if (SUBC->getAPIntValue() == OpSizeInBits) { - if (HasROTL) - return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).getNode(); - else + if (HasROTR) return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt).getNode(); + else + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).getNode(); } } } -- cgit v1.2.3