llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
// Check that it is a SLOI (Shift Left Ones Immediate). A PatFrag has already
// determined it has the right structure:
//
//  (OR (SHL RS1, VC2), VC1)
//
// Check that VC1, the mask used to fill with ones, is compatible
// with VC2, the shamt:
//
//  VC1 == maskTrailingOnes(VC2)
//
Check that it is a SLOI (Shift Left Ones Immediate). A PatFrag has already
determined it has the right structure.



Check that VC1, the mask used to fill with ones, is compatible
with VC2, the shamt.


Check that it is a SLOI ( Shift Left Ones Immediate ) . A PatFrag has already determined it has the right structure . Check that VC1 the mask used to fill with ones is compatible with VC2 the shamt .
bool RISCVDAGToDAGISel::MatchSLOI(SDNode *N) const {
  assert(N->getOpcode() == ISD::OR);
  assert(N->getOperand(0).getOpcode() == ISD::SHL);
  assert(isa<ConstantSDNode>(N->getOperand(1)));
  assert(isa<ConstantSDNode>(N->getOperand(0).getOperand(1)));
  SDValue Shl = N->getOperand(0);
  if (Subtarget->is64Bit()) {
    uint64_t VC1 = N->getConstantOperandVal(1);
    uint64_t VC2 = Shl.getConstantOperandVal(1);
    return VC1 == maskTrailingOnes<uint64_t>(VC2);
  }
  uint32_t VC1 = N->getConstantOperandVal(1);
  uint32_t VC2 = Shl.getConstantOperandVal(1);
  return VC1 == maskTrailingOnes<uint32_t>(VC2);
}
bool RISCVDAGToDAGISel :: MatchSLOI ( SDNode * N ) const { assert ( N -> getOpcode ( ) == ISD :: OR ) ; assert ( N -> getOperand ( 0 ) . getOpcode ( ) == ISD :: SHL ) ; assert ( isa < ConstantSDNode > ( N -> getOperand ( 1 ) ) ) ; assert ( isa < ConstantSDNode > ( N -> getOperand ( 0 ) . getOperand ( 1 ) ) ) ; SDValue Shl = N -> getOperand ( 0 ) ; if ( Subtarget -> is64Bit ( ) ) { uint64_t VC1 = N -> getConstantOperandVal ( 1 ) ; uint64_t VC2 = Shl . getConstantOperandVal ( 1 ) ; return VC1 == maskTrailingOnes < uint64_t > ( VC2 ) ; } uint32_t VC1 = N -> getConstantOperandVal ( 1 ) ; uint32_t VC2 = Shl . getConstantOperandVal ( 1 ) ; return VC1 == maskTrailingOnes < uint32_t > ( VC2 ) ; }
Check that it is a SLOI (Shift Left Ones Immediate).
Check that it is a SLOI ( Shift Left Ones Immediate ) .