================ @@ -10764,30 +10764,53 @@ SDValue PPCTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, return DAG.getRegister(PPC::R2, MVT::i32); case Intrinsic::ppc_rldimi: { + assert(Subtarget.isPPC64() && "rldimi is only available in 64-bit!"); + if (Op.getConstantOperandVal(4) == 0) + return Op.getOperand(2); uint64_t SH = Op.getConstantOperandVal(3); unsigned MB = 0, ME = 0; - if (!isRunOfOnes64(Op.getConstantOperandVal(4), MB, ME) || ME != 63 - SH) + if (!isRunOfOnes64(Op.getConstantOperandVal(4), MB, ME)) report_fatal_error("invalid rldimi mask!"); - return SDValue(DAG.getMachineNode( - PPC::RLDIMI, dl, MVT::i64, - {Op.getOperand(1), Op.getOperand(2), Op.getOperand(3), - DAG.getTargetConstant(MB, dl, MVT::i32)}), - 0); + + // For all-one mask, MB will be set to 0, adjust it next to 63-SH. ---------------- chenzheng1030 wrote:
For all-one mask, to improve the readability, is it better to just return the `Intrinsic::ppc_rldimi` as `ISD::ROTL (Op.getOperand(1), Op.getOperand(3))`? I think this would also benefit later optimizations as we are using a ISD node here. https://github.com/llvm/llvm-project/pull/85040 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits