<s> uint64_t TSFlags = MII . get ( Inst . getOpcode ( ) ) . TSFlags ; if ( ( TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; auto Opcode = Inst . getOpcode ( ) ; auto OpNum = <STR_LIT> ( Opcode , <STR_LIT> :: offset ) ; if ( OpNum == - <NUM_LIT> ) return true ; const auto & Op = Inst . getOperand ( OpNum ) ; if ( ! Op . isImm ( ) ) return true ; uint64_t Offset = Op . getImm ( ) ; bool IsBuffer = <STR_LIT> ( Opcode ) ; if ( <STR_LIT> ( getSTI ( ) , Offset ) || <STR_LIT> ( getSTI ( ) , Offset , IsBuffer ) ) return true ; Error ( getSMEMOffsetLoc ( Operands ) , ( isVI ( ) || IsBuffer ) ? <STR_LIT> : <STR_LIT> )


<s> const int Src1Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src1 ) ; const int OpIndices [ ] = { Src0Idx , Src1Idx } ; unsigned NumExprs = <NUM_LIT> ; unsigned NumLiterals = <NUM_LIT> ; uint32_t LiteralValue ; for ( int OpIdx : OpIndices ) { if ( OpIdx == - <NUM_LIT> ) break ; const MCOperand & MO = Inst . getOperand ( OpIdx ) ; if ( <STR_LIT> ( Desc , OpIdx ) ) { if ( MO . isImm ( ) && ! isInlineConstant ( Inst , OpIdx ) ) { uint32_t Value = static_cast < uint32_t > ( MO .


<s> const int Src1Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src1 ) ; const int OpIndices [ ] = { Src0Idx , Src1Idx } ; unsigned NumExprs = <NUM_LIT> ; unsigned NumLiterals = <NUM_LIT> ; uint32_t LiteralValue ; for ( int OpIdx : OpIndices ) { if ( OpIdx == - <NUM_LIT> ) break ; const MCOperand & MO = Inst . getOperand ( OpIdx ) ; if ( <STR_LIT> ( Desc , OpIdx ) ) { if ( MO . isImm ( ) && ! isInlineConstant ( Inst , OpIdx ) ) { uint32_t Value = static_cast < uint32_t > ( MO . getImm ( ) ) ; if ( NumLiterals == <NUM_LIT> || LiteralValue != Value ) { LiteralValue = Value ; ++ NumLiterals ; } } else if ( MO . isExpr ( ) ) { ++ NumExprs ; } } } return NumLiterals + NumExprs <=


<s> return Operand . isSSrcB32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcF32 : return Operand . isSSrcF32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SoppBrTarget : return Operand . isSoppBrTarget ( ) ? Match_Success : Match_InvalidOperand ; case MCK_VReg32OrOff : return Operand . isVReg32OrOff ( ) ? Match_Success : Match_InvalidOperand ; case MCK_InterpSlot : return Operand . isInterpSlot ( ) ? Match_Success : Match_InvalidOperand ; case MCK_Attr : return Operand . isInterpAttr ( ) ? Match_Success : Match_InvalidOperand ; case MCK_AttrChan : return Operand . isAttrChan ( ) ? Match_Success :


<s> case MCK_addr64 : return Operand . isAddr64 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_gds : return Operand . isGDS ( ) ? Match_Success : Match_InvalidOperand ; case MCK_lds : return Operand . isLDS ( ) ? Match_Success : Match_InvalidOperand ; case MCK_idxen : return Operand . isIdxen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_offen : return Operand . isOffen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcB32 : return Operand . isSSrcB32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcF32 : return Operand . isSSrcF32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SoppBrTarget : return Operand . isSoppBrTarget ( ) ? Match_Success : Match_InvalidOperand ; case MCK_VReg32OrOff : return Operand . isVReg32OrOff ( ) ? Match_Success : Match_InvalidOperand ; case MCK_InterpSlot : return Operand . isInterpSlot ( ) ? Match_Success : Match_InvalidOperand ; case MCK_Attr : return Operand . isInterpAttr ( ) ? Match_Success


<s> return ( FB [ <STR_LIT> ] && Reg == <STR_LIT> ) || ( FB [ <STR_LIT>


<s> const MCRegisterInfo * MRI = getMRI ( ) ; const MCRegisterClass & VGPR32 = MRI -> getRegClass ( <STR_LIT> ) ; const MCRegisterClass & AGPR32 = MRI -> getRegClass ( <STR_LIT> ) ; for ( unsigned I = <NUM_LIT> , E = Inst . getNumOperands ( ) ; I != E ; ++ I ) { const MCOperand & Op = Inst . getOperand ( I ) ; if ( ! Op . isReg ( ) ) continue ; unsigned Sub = MRI -> getSubReg ( Op . getReg (


<s> } if ( MO . isImm ( ) && ! isInlineConstant ( Inst , OpIdx ) ) { uint32_t Value = static_cast < uint32_t > ( MO . getImm ( ) ) ; if ( NumLiterals == <NUM_LIT> || LiteralValue != Value ) { LiteralValue = Value ; ++ NumLiterals ; } } else if ( MO . isExpr ( ) ) { ++ NumExprs ; } } NumLiterals += NumExprs ; if ( ! NumLiterals ) return true ; if ( ImmIdx == - <NUM_LIT> && ! getFeatureBits ( ) [ <STR_LIT> ] ) { Error ( getLitLoc ( Operands ) , <STR_LIT> ) ; return false ; } if ( NumLiterals > <NUM_LIT> ) { Error ( getLitLoc ( Operands ) , <STR_LIT> ) ; return


<s> const MCInstrDesc & Desc = MII . get ( Opcode ) ; const int ImmIdx = <STR_LIT> ( Opcode , <STR_LIT> :: imm ) ; if ( ! ( Desc . TSFlags & ( <STR_LIT> | <STR_LIT> ) ) && ImmIdx == - <NUM_LIT> ) return true ; const int Src0Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src0 ) ; const int Src1Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src1 ) ; const int Src2Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src2 ) ; const int OpIndices [ ] = { Src0Idx , Src1Idx , Src2Idx , ImmIdx } ; unsigned NumExprs = <NUM_LIT> ; unsigned NumLiterals = <NUM_LIT> ; uint32_t LiteralValue ; for ( int OpIdx : OpIndices ) { if ( OpIdx == - <NUM_LIT> ) continue ; const MCOperand & MO = Inst . getOperand ( OpIdx ) ; if ( ! MO . isImm ( ) && ! MO . isExpr ( ) ) continue ; if ( ! <STR_LIT> ( Desc , OpIdx ) ) continue ; if ( OpIdx == Src2Idx && ( Desc . TSFlags & <STR_LIT> ) && getFeatureBits ( ) [ <STR_LIT> ] ) { Error ( getConstLoc ( Operands ) , <STR_LIT> ) ; return false ; } if ( MO . isImm ( ) && ! isInlineConstant ( Inst , OpIdx ) ) { uint32_t Value = static_cast < uint32_t > ( MO . getImm ( ) ) ; if ( NumLiterals == <NUM_LIT> || LiteralValue != Value ) { LiteralValue = Value ; ++ NumLiterals ; } } else if ( MO . isExpr ( ) ) { ++ NumExprs ; } } NumLiterals += NumExprs ; if ( ! NumLiterals ) return true ; if ( ImmIdx == - <NUM_LIT> && ! getFeatureBits ( ) [ <STR_LIT> ] ) { Error ( getLitLoc ( Operands ) , <STR_LIT> ) ; return false ; } if ( NumLiterals >


<s> if ( AsmParser -> isVI ( ) ) return isVReg


<s> for ( auto Variant : getMatchedVariants ( ) ) { uint64_t EI ; auto R = MatchInstructionImpl ( Operands , Inst , EI , MatchingInlineAsm , Variant ) ; if ( ( R == Match_Success ) || ( R == Match_PreferE32 ) || ( R == Match_MissingFeature && Result != Match_PreferE32 ) || ( R == Match_InvalidOperand && Result != Match_MissingFeature && Result != Match_PreferE32 ) || ( R == Match_MnemonicFail && Result != Match_InvalidOperand && Result != Match_MissingFeature && Result != Match_PreferE32 ) ) { Result = R ; ErrorInfo = EI ; } if ( R == Match_Success ) break ; } switch ( Result ) { default : break ; case Match_Success : if ( ! validateInstruction ( Inst , IDLoc ) ) { return true ; } Inst . setLoc ( IDLoc ) ; Out . EmitInstruction ( Inst ,


<s> case ImmTyOffen : OS << <STR_LIT> ; break ; case ImmTyIdxen : OS << <STR_LIT> ; break ; case ImmTyAddr64 : OS << <STR_LIT> ; break ; case ImmTyOffset : OS << <STR_LIT> ; break ; case ImmTyOffset0 : OS << <STR_LIT> ; break ; case ImmTyOffset1 : OS << <STR_LIT> ; break ; case ImmTyGLC : OS << <STR_LIT> ; break ; case ImmTySLC : OS << <STR_LIT> ; break ; case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyDFMT : OS << <STR_LIT> ; break ; case ImmTyNFMT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ;


<s> case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT>


<s> bool <ISA_LIT>AsmParser :: validateInstruction ( const MCInst & Inst , const SMLoc & IDLoc ) { if ( ! validateConstantBusLimitations ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateEarlyClobberLimitations ( Inst ) ) { Error ( IDLoc , <STR_LIT> )


<s> unsigned OpSelHi = <NUM_LIT> ; unsigned NegLo = <NUM_LIT> ; unsigned NegHi = <NUM_LIT> ; if ( OpSelHiIdx != - <NUM_LIT> ) { OpSelHi = Inst . getOperand ( OpSelHiIdx ) . getImm ( ) ; } if ( NegLoIdx != - <NUM_LIT> ) { int NegHiIdx = <STR_LIT> ( Opc , <STR_LIT> :: neg_hi ) ; NegLo = Inst . getOperand ( NegLoIdx ) . getImm ( ) ; NegHi = Inst . getOperand ( NegHiIdx ) . getImm ( ) ; } for ( int J = <NUM_LIT> ; J < <NUM_LIT> ; ++ J ) { int OpIdx = <STR_LIT> ( Opc , Ops [ J ] ) ; if ( OpIdx == - <NUM_LIT> ) break ; uint32_t ModVal = <NUM_LIT> ; if ( ( OpSel & ( <NUM_LIT> << J ) ) != <NUM_LIT> ) ModVal |= <STR_LIT> ; if ( ( OpSelHi & ( <NUM_LIT> << J


<s> void <ISA_LIT>AsmParser :: cvtD<ISA_LIT>mpl ( MCInst & Inst , const OperandVector & Operands , bool IsGdsHardcoded ) { OptionalImmIndexMap OptionalIdx ; for ( unsigned i = <NUM_LIT> , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) && Op . getToken ( ) == <STR_LIT> ) { IsGdsHardcoded = true ; continue ; } OptionalIdx [ Op . getImmTy ( ) ] = i ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; if ( ! IsGdsHardcoded ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGDS ) ; } Inst . addOperand ( MCOperand :: createReg (


<s> if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyExpTgt ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) && Op . getToken ( ) == <STR_LIT> ) continue ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyExpVM ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx ,


<s> ++ SrcIdx ; continue ; } if ( Op . isOff ( ) ) { ++ SrcIdx ; Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ) ) ; continue ; } if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyExpTgt ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) && Op . getToken ( ) == <STR_LIT> ) continue ; OptionalIdx [ Op . getImmTy ( ) ] =


<s> } if ( isForcedDPP ( ) ) { static const unsigned Variants [ ] = { <ISA_LIT>AsmVariants :: DPP } ; return makeArrayRef ( Variants ) ; } static const unsigned Variants [ ] = { <ISA_LIT>AsmVariants :: DEFAULT , <ISA_LIT>AsmVariants :: VOP3 , <ISA_LIT>AsmVariants

:: SDWA , <ISA_LIT>AsmVariants :: DPP } ;


<s> if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectVersion ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectISA ( ) ; if ( IDVal == <STR_LIT> :: MetadataAssemblerDirectiveBegin ) return ParseDirectiveCodeObjectMetadata ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDKernelCodeT ( ) ; if ( IDVal == <STR_LIT> ) return ParseSectionDirectiveHSAText ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> )

return ParseDirective<ISA_LIT>HsaModuleGlobal ( ) ;


<s> case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS <<


<s> bool <ISA_LIT>AsmParser :: usesConstantBus ( const MCInst & Inst , unsigned OpIdx ) { const MCOperand & MO = Inst . getOperand ( OpIdx ) ; if ( MO .


<s> bool isR128 ( ) const { return isImmTy (


<s> case ImmTyDFMT : OS << <STR_LIT> ; break ; case ImmTyNFMT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ; break ; case ImmTyExpVM : OS << <STR_LIT> ; break ; case ImmTyHwreg : OS << <STR_LIT> ; break ; case ImmTySendMsg : OS << <STR_LIT> ; break ; case ImmTyInterpSlot : OS << <STR_LIT> ; break ; case ImmTyInterpAttr : OS << <STR_LIT> ; break ; case ImmTyAttrChan : OS << <STR_LIT> ; break ; case ImmTyOpSel : OS << <STR_LIT> ; break ; case ImmTyOpSelHi : OS << <STR_LIT> ; break ; case ImmTyNegLo : OS << <STR_LIT>


<s> case ImmTyIdxen : OS << <STR_LIT> ; break ; case ImmTyAddr64 : OS << <STR_LIT> ; break ; case ImmTyOffset : OS << <STR_LIT> ; break ; case ImmTyInstOffset : OS << <STR_LIT> ; break ; case ImmTyOffset0 : OS << <STR_LIT> ; break ; case ImmTyOffset1 : OS << <STR_LIT> ; break ; case ImmTyGLC : OS << <STR_LIT> ; break ; case ImmTySLC : OS << <STR_LIT> ; break ; case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyD16 : OS << <STR_LIT> ; break ; case ImmTyDFMT : OS << <STR_LIT> ; break ; case ImmTyNFMT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT>


<s> } if ( ! validateMIMGR128 ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGD16 ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } return


<s> const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; return ! isCI ( ) &&


<s> const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; if ( Desc . TSFlags & <STR_LIT> ) return true ; int VDataIdx = <STR_LIT> ( Opc , <STR_LIT> :: vdata ) ; int DMaskIdx = <STR_LIT> ( Opc , <STR_LIT> :: dmask ) ; int TFEIdx = <STR_LIT> ( Opc , <STR_LIT> :: tfe ) ; assert ( VDataIdx != - <NUM_LIT> ) ; assert ( DMaskIdx != - <NUM_LIT> ) ; assert ( TFEIdx != - <NUM_LIT> ) ; unsigned VDataSize = <STR_LIT> ( getMRI ( ) , Desc , VDataIdx ) ; unsigned TFESize = Inst . getOperand ( TFEIdx ) . getImm ( )


<s> bool <ISA_LIT>AsmParser :: validateMIMGDataSize ( const MCInst & Inst ) { const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; if ( Desc . TSFlags & <STR_LIT> ) return true ; int VDataIdx = <STR_LIT> ( Opc , <STR_LIT> :: vdata ) ; int DMaskIdx = <STR_LIT> ( Opc , <STR_LIT> :: dmask ) ; int TFEIdx = <STR_LIT> ( Opc , <STR_LIT> :: tfe ) ; assert ( VDataIdx != - <NUM_LIT> ) ; assert ( DMaskIdx != - <NUM_LIT> ) ; assert ( TFEIdx != - <NUM_LIT> ) ; unsigned VDataSize = <STR_LIT> ( getMRI ( ) , Desc , VDataIdx ) ; unsigned TFESize = Inst . getOperand ( TFEIdx ) . getImm ( ) ? <NUM_LIT> : <NUM_LIT> ; unsigned DMask = Inst . getOperand ( DMaskIdx ) . getImm ( ) & <NUM_LIT> ; if ( DMask == <NUM_LIT> ) DMask = <NUM_LIT> ; unsigned DataSize = countPopulation ( DMask ) ; if ( ( Desc . TSFlags & <STR_LIT> ) != <NUM_LIT> && hasPackedD16 ( ) ) { DataSize = ( DataSize + <NUM_LIT> )


<s> if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; int Idx = <STR_LIT> ( Opc , <STR_LIT> :: r128 ) ; assert ( Idx != - <NUM_LIT> ) ; bool R128 = ( Inst . getOperand ( Idx ) . getImm ( ) != <NUM_LIT> ) ; return ! R128 || hasMIMG_R128 (


<s> unsigned <ISA_LIT>AsmParser :: validateTargetOperandClass ( MCParsedAsmOperand & Op , unsigned Kind ) { <ISA_LIT>Operand & Operand = ( <ISA_LIT>Operand & ) Op ; switch ( Kind ) { case MCK_addr64 : return Operand . isAddr64 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_gds : return Operand . isGDS ( ) ? Match_Success : Match_InvalidOperand ; case MCK_lds : return Operand . isLDS ( ) ? Match_Success : Match_InvalidOperand ; case MCK_glc : return Operand . isGLC ( ) ? Match_Success : Match_InvalidOperand ; case MCK_d16 : return Operand . isD16 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_idxen : return Operand . isIdxen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_offen : return Operand . isOffen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcB32 : return Operand . isSSrcB32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcF32 : return Operand . isSSrcF32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SoppBrTarget : return Operand . isSoppBrTarget (


<s> case MCK_glc : return Operand . isGLC ( ) ? Match_Success : Match_InvalidOperand ; case MCK_d16 : return Operand . isD16 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_idxen : return Operand . isIdxen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_offen : return Operand . isOffen ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcB32 : return Operand . isSSrcB32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SSrcF32 : return Operand . isSSrcF32 ( ) ? Match_Success : Match_InvalidOperand ; case MCK_SoppBrTarget : return Operand . isSoppBrTarget ( ) ? Match_Success : Match_InvalidOperand ; case MCK_VReg32OrOff : return Operand . isVReg32OrOff ( ) ? Match_Success : Match_InvalidOperand ; case MCK_InterpSlot


<s> return false ; } if ( ! validateEarlyClobberLimitations ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateIntClampSupported ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGD16 ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDataSize ( Inst )


<s> if ( ! validateMIMGD16 ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst )


<s> case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyD16 : OS << <STR_LIT> ; break ; case ImmTyDFMT : OS << <STR_LIT> ; break ; case ImmTyNFMT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ; break ; case ImmTyExpVM : OS << <STR_LIT> ; break ; case ImmTyHwreg : OS << <STR_LIT> ; break ; case ImmTySendMsg : OS << <STR_LIT> ; break ; case ImmTyInterpSlot : OS << <STR_LIT> ; break ; case ImmTyInterpAttr : OS << <STR_LIT> ; break ; case ImmTyAttrChan : OS << <STR_LIT>


<s> Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; } else { MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA .


<s> IsaInfo :: IsaVersion Version = IsaInfo :: getIsaVersion ( Features ) ; unsigned NumVGPRs = NextFreeVGPR ; unsigned NumSGPRs = NextFreeSGPR ; unsigned MaxAddressableNumSGPRs = IsaInfo :: getAddressableNumSGPRs ( Features ) ; if ( Version . Major >= <NUM_LIT> && ! Features . test ( FeatureSGPRInitBug ) && NumSGPRs > MaxAddressableNumSGPRs ) return OutOfRangeError ( SGPRRange ) ; NumSGPRs += IsaInfo :: getNumExtraSGPRs ( Features , VCCUsed , FlatScrUsed , XNACKUsed ) ; if ( ( Version . Major <= <NUM_LIT> || Features . test ( FeatureSGPRInitBug ) ) && NumSGPRs > MaxAddressableNumSGPRs ) return OutOfRangeError ( SGPRRange ) ; if ( Features . test ( FeatureSGPRInitBug ) ) NumSGPRs = IsaInfo :: FIXED_NUM_SGPRS_FOR_INIT_BUG ; VGPRBlocks = IsaInfo :: getNumVGPRBlocks ( Features , NumVGPRs ) ; SGPRBlocks = IsaInfo :: getNumSGPRBlocks (


<s> const MCInstrDesc & Desc = MII . get ( Inst . getOpcode ( ) ) ; for ( unsigned J = <NUM_LIT> ; J < Desc . getNumDefs ( ) ; ++ J ) { ( ( <ISA_LIT>Operand & ) * Operands [ I ++ ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } if ( IsAtomic ) { assert ( Desc . getNumDefs ( ) == <NUM_LIT> ) ; ( ( <ISA_LIT>Operand & ) * Operands [ I - <NUM_LIT> ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } OptionalImmIndexMap OptionalIdx ; for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> )


<s> bool <ISA_LIT>AsmParser :: ParseDirective ( AsmToken DirectiveID ) { StringRef IDVal = DirectiveID . getString ( ) ; if ( <STR_LIT> :: hasCodeObjectV3 ( & getSTI ( ) ) ) { if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDGCNTarget ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDHSAKernel ( ) ; } else { if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectVersion ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectISA ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDKernelCodeT ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveISAVersion


<s> case ImmTyOffset1 : OS << <STR_LIT> ; break ; case ImmTyGLC : OS << <STR_LIT> ; break ; case ImmTySLC : OS << <STR_LIT> ; break ; case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyD16 : OS << <STR_LIT> ; break ; case ImmTyFORMAT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ; break ; case ImmTyExpVM : OS << <STR_LIT> ; break ; case ImmTyHwreg : OS << <STR_LIT> ; break ; case ImmTySendMsg : OS << <STR_LIT> ; break ; case ImmTyInterpSlot : OS << <STR_LIT> ; break


<s> if ( <STR_LIT> :: getIsaVersion ( getFeatureBits ( ) ) . Major < <NUM_LIT> ) return true ; auto SymbolName = getGprCountSymbolName ( RegKind ) ; if ( ! SymbolName ) return true ; MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( * SymbolName ) ; int64_t NewMax = DwordRegIndex + RegWidth


<s> int64_t NewMax = DwordRegIndex + RegWidth - <NUM_LIT> ; int64_t OldCount ; if ( ! Sym -> isVariable ( ) ) return ! Error ( getParser ( ) . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; if ( ! Sym -> getVariableValue ( false ) -> evaluateAsAbsolute ( OldCount ) ) return ! Error ( getParser ( ) . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; if ( OldCount <= NewMax ) Sym -> setVariableValue ( MCConstantExpr :: create ( NewMax + <NUM_LIT>


<s> Val = - Val ; } } if ( <STR_LIT> ( AsmParser -> getMII ( ) -> get ( Inst . getOpcode ( ) ) , Inst . getNumOperands ( ) ) ) { addLiteralImmOperand ( Inst , Val ) ; } else { Inst . addOperand ( MCOperand ::


<s> { <STR_LIT> Isa = <STR_LIT> ( getSTI ( ) . getFeatureBits ( ) ) ; MCContext & Ctx = getContext ( ) ; MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( Isa . Stepping


<s> static <ISA_LIT>Operand :: Ptr CreateImm ( const <ISA_LIT>AsmParser * AsmParser , int64_t Val , SMLoc Loc , enum ImmTy Type = ImmTyNone , bool IsFPImm = false ) { auto Op = llvm :: make_unique < <ISA_LIT>Operand > ( Immediate , AsmParser ) ; Op -> Imm . Val = Val ; Op -> Imm . IsFPImm = IsFPImm ; Op -> Imm . Type


<s> llvm_unreachable ( <STR_LIT> ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> ) ; if ( Inst . getOpcode ( ) == <STR_LIT> || Inst . getOpcode ( ) == <STR_LIT> || Inst . getOpcode ( ) == <STR_LIT> ) { auto it = Inst . begin ( ) ; std :: advance ( it , <STR_LIT> ( Inst . getOpcode ( ) == <STR_LIT> ? <STR_LIT> : <STR_LIT> , <STR_LIT> :: src2_modifiers ) ) ; it = Inst . insert ( it , MCOperand :: createImm ( <NUM_LIT>


<s> if ( type . getScalarSizeInBits ( ) == <NUM_LIT> ) { return <STR_LIT> ( static_cast < int32_t > ( FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ) , AsmParser -> hasInv2PiInlineImm ( ) ) ; } return <STR_LIT> ( static_cast < int32_t > ( FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ) , AsmParser -> hasInv2PiInlineImm ( ) ) ; } if ( type == <STR_LIT> || type == <STR_LIT> ) { return <STR_LIT> ( Imm . Val , AsmParser -> hasInv2PiInlineImm ( ) ) ; } if ( type . getScalarSizeInBits ( ) == <NUM_LIT> ) { return <STR_LIT> ( static_cast < int16_t > ( Literal . getLoBits ( <NUM_LIT> ) . getSExtValue ( ) ) , AsmParser -> hasInv2PiInlineImm ( ) ) ; } return <STR_LIT> ( static_cast < int32_t > ( Literal . getLoBits ( <NUM_LIT> )


<s> return <STR_LIT> ( static_cast < int32_t > ( FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ) , AsmParser -> hasInv2PiInlineImm ( ) ) ; } return <STR_LIT> ( static_cast < int32_t > ( FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ) , AsmParser -> hasInv2PiInlineImm ( ) ) ; } if ( type == <STR_LIT> || type == <STR_LIT> ) { return <STR_LIT> ( Imm . Val , AsmParser -> hasInv2PiInlineImm ( ) ) ; } if ( type . getScalarSizeInBits ( ) == <NUM_LIT> ) { return <STR_LIT> ( static_cast < int16_t > ( Literal . getLoBits ( <NUM_LIT> ) . getSExtValue ( ) ) , AsmParser -> hasInv2PiInlineImm ( ) ) ; } return <STR_LIT> ( static_cast < int32_t > ( Literal . getLoBits ( <NUM_LIT> ) . getZExtValue ( )


<s> int64_t CntVal ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: LParen ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( CntVal ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken


<s> bool <ISA_LIT>AsmParser :: ParseDirective ( AsmToken DirectiveID ) { StringRef IDVal = DirectiveID . getString ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectVersion ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectISA ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveRuntimeMetadata ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDKernelCodeT ( ) ; if ( IDVal == <STR_LIT> ) return ParseSectionDirectiveHSAText ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaModuleGlobal ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaProgramGlobal ( ) ; if ( IDVal == <STR_LIT> ) return ParseSectionDirectiveHSADataGlobalAgent ( ) ; if ( IDVal == <STR_LIT> ) return


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseNamedBit ( const char * Name , OperandVector & Operands , enum <ISA_LIT>Operand :: ImmTy ImmTy ) { int64_t Bit = <NUM_LIT> ; SMLoc S = Parser . getTok ( ) . getLoc ( ) ; if ( getLexer ( ) . isNot ( AsmToken


<s> case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ; break ; case ImmTyExpVM : OS << <STR_LIT> ; break ; case ImmTyHwreg : OS << <STR_LIT> ; break ; case ImmTySendMsg : OS << <STR_LIT> ; break ; case ImmTyInterpSlot : OS << <STR_LIT> ; break ; case ImmTyInterpAttr : OS << <STR_LIT> ; break ; case ImmTyAttrChan : OS <<


<s> case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ; break ; case ImmTyExpVM : OS << <STR_LIT> ; break ; case ImmTyHwreg : OS << <STR_LIT> ; break ; case ImmTySendMsg : OS << <STR_LIT> ; break ; case ImmTyInterpSlot : OS << <STR_LIT> ;


<s> SMLoc EndLoc = Tok . getEndLoc ( ) ; RegisterKind RegKind ; unsigned Reg , RegNum , RegWidth ; if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) { Error ( StartLoc , <STR_LIT> ) ; return nullptr ; } if ( <STR_LIT> :: hasCodeObjectV3 ( & getSTI ( ) ) ) { if ( ! updateGprCountSymbols ( RegKind , RegNum , RegWidth ) ) return nullptr ; } else KernelScope . usesRegister ( RegKind , RegNum ,


<s> RegisterKind RegKind ; unsigned Reg , RegNum , RegWidth ; if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) { Error ( StartLoc , <STR_LIT> ) ; return nullptr ; } if ( <STR_LIT> :: hasCodeObjectV3 ( & getSTI (


<s> unsigned NextReg , NextRegNum , NextRegWidth ; if ( ! Parse<ISA_LIT>Register ( NextRegKind , NextReg , NextRegNum , NextRegWidth , Tokens ) ) return <STR_LIT> ; if ( NextRegWidth != <NUM_LIT> ) return <STR_LIT> ; if ( NextRegKind != RegKind ) return <STR_LIT> ; if ( ! AddNextRegisterToList ( Reg , RegWidth , RegKind , NextReg ) ) return <STR_LIT> ; } if ( ! trySkipToken ( AsmToken :: RBrac ) ) return <STR_LIT> ; if ( isRegularReg ( RegKind ) ) Reg = getRegularReg ( RegKind , RegNum , RegWidth ) ; return Reg


<s> assert ( isToken ( AsmToken :: Identifier ) ) ; StringRef RegName = getTokenStr ( ) ; const RegInfo * RI = getRegularRegInfo ( RegName ) ; if ( ! RI ) return <STR_LIT> ; Tokens . push_back ( getToken ( ) ) ; lex ( ) ; RegKind = RI -> Kind ; StringRef RegSuffix = RegName . substr ( RI -> Name . size ( ) ) ; if ( ! RegSuffix . empty ( ) ) { if ( ! getRegNum ( RegSuffix , RegNum ) ) return <STR_LIT> ; RegWidth = <NUM_LIT> ; } else { if ( ! ParseRegRange ( RegNum


<s> const_cast < <ISA_LIT>AsmParser * > ( AsmParser ) -> Warning ( Inst . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; } Inst . addOperand ( MCOperand :: createImm ( Literal . lshr ( <NUM_LIT> ) . getZExtValue ( ) ) ) ; setImmKindLiteral ( ) ; return ; } llvm_unreachable ( <STR_LIT> ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : { bool lost ; APFloat FPLiteral ( APFloat :: IEEEdouble ( ) , Literal ) ; FPLiteral . convert ( * getOpFltSemantics ( OpTy ) , APFloat :: rmNearestTiesToEven , & lost ) ; uint64_t ImmVal = FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ; Inst . addOperand ( MCOperand :: createImm ( ImmVal ) ) ; setImmKindLiteral ( ) ; return ; } default : llvm_unreachable ( <STR_LIT> ) ; } return ; } switch ( OpTy ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( isSafeTruncation ( Val , <NUM_LIT> ) && <STR_LIT> ( static_cast < int32_t > ( Val ) , AsmParser -> hasInv2PiInlineImm ( ) ) ) { Inst . addOperand ( MCOperand :: createImm ( Val ) ) ; setImmKindConst ( ) ; return ; } Inst . addOperand ( MCOperand :: createImm ( Val & <NUM_LIT> ) ) ; setImmKindLiteral ( ) ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( <STR_LIT> ( Val , AsmParser -> hasInv2PiInlineImm ( ) ) ) { Inst . addOperand ( MCOperand :: createImm ( Val ) ) ; setImmKindConst ( ) ; return ; } Inst . addOperand ( MCOperand :: createImm ( Lo_32 ( Val ) ) ) ; setImmKindLiteral ( ) ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT>


<s> ( ( <ISA_LIT>Operand & ) * Operands [ I - <NUM_LIT> ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } OptionalImmIndexMap OptionalIdx ; for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else if ( ! Op . isToken ( ) ) { llvm_unreachable ( <STR_LIT> ) ; } } bool IsGFX10Plus = isGFX10Plus ( ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDMask ) ; if ( IsGFX10Plus ) addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDim , - <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyUNorm ) ; if ( IsGFX10Plus ) addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand


<s> if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyNone ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } HasLdsModifier |= Op . isLDS ( ) ; if ( Op . isToken ( ) ) { continue ; } assert ( Op . isImm ( ) ) ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } if ( IsLdsOpcode && ! HasLdsModifier ) { int NoLdsOpcode = <STR_LIT> ( Inst . getOpcode ( ) ) ; if ( NoLdsOpcode != - <NUM_LIT> ) { Inst . setOpcode ( NoLdsOpcode ) ; IsLdsOpcode = false ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand ::


<s> const MCInstrDesc & Desc = MII . get ( Inst . getOpcode ( ) ) ; for ( unsigned J = <NUM_LIT> ; J < Desc . getNumDefs ( ) ; ++ J ) { ( ( <ISA_LIT>Operand & ) * Operands [ I ++ ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } if ( <STR_LIT> ( Opc , <STR_LIT> :: src0_modifiers ) != - <NUM_LIT> ) { for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( isRegOrImmWithInputMods ( Desc , Inst . getNumOperands ( ) ) ) { Op . addRegOrImmWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else if ( Op . isRegOrImm ( ) ) { Op . addRegOrImmOperands ( Inst , <NUM_LIT> ) ; } else { llvm_unreachable ( <STR_LIT> ) ; } } } else { for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isMod (


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultGLC_1 ( )


<s> bool isGLC_1 ( ) const { return isImmTy ( ImmTyGLC


<s> bool <ISA_LIT>AsmParser :: isSupportedDPPCtrl ( StringRef Ctrl , const OperandVector & Operands ) { if ( Ctrl == <STR_LIT> || Ctrl == <STR_LIT> ) return isGFX10Plus ( ) ; if ( Ctrl == <STR_LIT> || Ctrl == <STR_LIT> || Ctrl == <STR_LIT> || Ctrl == <STR_LIT> || Ctrl == <STR_LIT> ) return isVI ( ) || isGFX9 ( ) ; return Ctrl == <STR_LIT> || Ctrl == <STR_LIT> || Ctrl == <STR_LIT> || Ctrl == <STR_LIT> || Ctrl == <STR_LIT> ||


<s> if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDHSAKernel ( ) ; if ( IDVal == <STR_LIT> :: V3 :: AssemblerDirectiveBegin ) return ParseDirectiveHSAMetadata ( ) ; } else { if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectVersion ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveHSACodeObjectISA ( ) ; if ( IDVal == <STR_LIT>

) return ParseDirectiveAMDKernelCodeT ( ) ;


<s> raw_string_ostream ExpectedTargetOS ( ExpectedTarget ) ; IsaInfo :: streamIsaVersion ( & getSTI ( ) , ExpectedTargetOS ) ; if ( Target != ExpectedTargetOS . str ( ) ) return Error ( TargetRange . Start , <STR_LIT> , TargetRange ) ; getTargetStreamer ( ) . EmitDirectiveAMDGCNTarget


<s> if ( ParseAsAbsoluteExpression ( Stepping ) ) return TokError ( <STR_LIT> ) ; if ( ! trySkipToken ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; if ( ! parseString ( VendorName , <STR_LIT> ) ) return true ; if ( ! trySkipToken ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; if ( ! parseString ( ArchName , <STR_LIT> ) )


<s> uint32_t Major ; uint32_t Minor ; uint32_t Stepping ; StringRef VendorName ; StringRef ArchName ; if ( isToken ( AsmToken :: EndOfStatement ) ) { <STR_LIT> ISA = <STR_LIT> ( getSTI ( ) . getCPU ( ) ) ; getTargetStreamer ( ) . EmitDirectiveHSACodeObjectISA ( ISA . Major , ISA . Minor , ISA . Stepping , <STR_LIT> , <STR_LIT> ) ; return false ; } if ( ParseDirectiveMajorMinor ( Major , Minor ) ) return


<s> bool <ISA_LIT>AsmParser :: ParseDirectiveISAVersion ( ) { if ( getSTI ( ) . getTargetTriple ( ) . getArch ( ) != Triple :: amdgcn ) { return Error ( getLoc ( ) , <STR_LIT> <STR_LIT> ) ; } auto ISAVersionStringFromASM = getToken ( ) . getStringContents ( ) ; std :: string ISAVersionStringFromSTI ; raw_string_ostream ISAVersionStreamFromSTI ( ISAVersionStringFromSTI ) ; IsaInfo :: streamIsaVersion ( & getSTI ( ) , ISAVersionStreamFromSTI ) ; if ( ISAVersionStringFromASM != ISAVersionStreamFromSTI . str ( )


<s> } ; DppCtrlCheck Check = StringSwitch < DppCtrlCheck > ( Ctrl ) . Case ( <STR_LIT> , { DppCtrl :: WAVE_SHL1 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: WAVE_ROL1 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: WAVE_SHR1 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: WAVE_ROR1 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: ROW_SHL0 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: ROW_SHR0 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: ROW_ROR0 , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: ROW_SHARE_FIRST , <NUM_LIT> , <NUM_LIT> } ) . Case ( <STR_LIT> , { DppCtrl :: ROW_XMASK_FIRST , <NUM_LIT> , <NUM_LIT> } ) . Default ( { - <NUM_LIT> , <NUM_LIT> , <NUM_LIT> } ) ; bool Valid ; if ( Check . Ctrl == - <NUM_LIT> ) { Valid = ( Ctrl == <STR_LIT> && ( Val == <NUM_LIT> || Val == <NUM_LIT> ) ) ; Val = ( Val == <NUM_LIT> ) ? DppCtrl :: BCAST15 : DppCtrl :: BCAST31 ; } else


<s> Name = parseMnemonicSuffix ( Name ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateToken ( this , Name , NameLoc ) ) ; bool IsMIMG = Name . startswith ( <STR_LIT> ) ; while ( ! trySkipToken ( AsmToken :: EndOfStatement ) ) { OperandMode Mode = OperandMode_Default ; if ( IsMIMG && isGFX10Plus ( ) && Operands . size ( ) == <NUM_LIT> ) Mode = OperandMode_NSA ; OperandMatchResultTy Res = parseOperand ( Operands , Name , Mode ) ; trySkipToken ( AsmToken :: Comma ) ; if ( Res != MatchOperand_Success ) { checkUnsupportedInstruction ( Name , NameLoc ) ; if ( ! Parser . hasPendingError ( ) ) { StringRef Msg = ( Res == MatchOperand_ParseFail ) ? <STR_LIT> : <STR_LIT> ; Error ( getLoc ( ) , Msg ) ; } while ( ! trySkipToken ( AsmToken :: EndOfStatement ) ) { lex ( ) ; } return true ; } } return false


<s> switch ( getTokenKind ( ) ) { case AsmToken :: Identifier : { StringRef Tok = getTokenStr ( ) ; if ( Tok == Name ) { if ( Tok == <STR_LIT> && ! hasMIMG_R128 ( ) ) Error ( S , <STR_LIT> ) ; if ( Tok == <STR_LIT> && ! isGFX9 ( ) && ! hasGFX10A16 ( ) ) Error ( S , <STR_LIT> ) ; Bit = <NUM_LIT> ; Parser . Lex ( ) ; } else if ( Tok . startswith ( <STR_LIT> ) && Tok . endswith ( Name ) ) { Bit = <NUM_LIT> ; Parser . Lex ( ) ; } else { return


<s> unsigned Reg , RegNum , RegWidth ; if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) { return nullptr ; } if ( isHsaAbiVersion3 ( & getSTI ( ) ) ) { if ( ! updateGprCountSymbols ( RegKind , RegNum , RegWidth ) ) return nullptr ; } else KernelScope . usesRegister ( RegKind , RegNum , RegWidth ) ; return <ISA_LIT>Operand :: CreateReg ( this , Reg , StartLoc ,


<s> if ( ! updateGprCountSymbols ( RegKind , RegNum , RegWidth ) ) return nullptr ; } else KernelScope . usesRegister ( RegKind , RegNum , RegWidth ) ; return <ISA_LIT>Operand :: CreateReg ( this , Reg , StartLoc ,


<s> case <STR_LIT> : case <STR_LIT> : return isGFX9Plus ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ! isGFX9Plus ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ( isVI ( ) || isGFX9 ( ) ) && hasXNACK ( ) ; case <STR_LIT> : return isGFX10Plus ( ) ; default : break ; } if ( isCI ( ) ) return true ; if ( is<ISA_LIT> ( ) || isGFX10Plus ( ) ) { switch ( RegNo ) { case <STR_LIT>


<s> bool <ISA_LIT>AsmParser :: validateCoherencyBits ( const MCInst & Inst , const OperandVector & Operands , const SMLoc & IDLoc ) { int GLCPos = <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: glc1 ) ; if ( GLCPos != - <NUM_LIT> ) { if ( Inst . getOperand ( GLCPos ) . getImm ( ) == - <NUM_LIT> ) { Error ( IDLoc , <STR_LIT> ) ; return


<s> auto OpNum = <STR_LIT> ( Opcode , <STR_LIT> :: offset ) ; assert ( OpNum != - <NUM_LIT> ) ; const auto & Op = Inst . getOperand ( OpNum ) ; if ( ! hasFlatOffsets ( ) && Op . getImm ( ) != <NUM_LIT> ) { Error ( getFlatOffsetLoc ( Operands ) , <STR_LIT> ) ; return false ; } if ( TSFlags & ( <STR_LIT> | <STR_LIT> ) ) { unsigned OffsetSize = <STR_LIT> ( getSTI ( ) , true ) ; if ( ! isIntN ( OffsetSize , Op . getImm ( ) ) ) { Error ( getFlatOffsetLoc ( Operands ) , Twine ( <STR_LIT> ) + Twine ( OffsetSize ) + <STR_LIT> ) ; return false ; } } else { unsigned OffsetSize = <STR_LIT> ( getSTI ( ) , false ) ; if ( ! isUIntN ( OffsetSize , Op . getImm ( ) ) ) { Error ( getFlatOffsetLoc ( Operands ) , Twine ( <STR_LIT> ) + Twine ( OffsetSize ) + <STR_LIT> ) ; return false ; } } return true


<s> if ( ! hasFlatOffsets ( ) && Op . getImm ( ) != <NUM_LIT> ) { Error ( getFlatOffsetLoc ( Operands ) , <STR_LIT> ) ; return false ; } if ( TSFlags & ( <STR_LIT> | <STR_LIT> ) ) { unsigned OffsetSize = <STR_LIT> ( getSTI ( ) , true ) ; if ( ! isIntN ( OffsetSize , Op . getImm ( ) ) ) { Error ( getFlatOffsetLoc ( Operands ) , Twine ( <STR_LIT> ) + Twine ( OffsetSize ) + <STR_LIT> ) ; return false ; } } else { unsigned OffsetSize = <STR_LIT> ( getSTI ( ) , false ) ; if ( ! isUIntN ( OffsetSize , Op . getImm ( ) ) ) { Error ( getFlatOffsetLoc ( Operands ) , Twine ( <STR_LIT> ) + Twine ( OffsetSize ) + <STR_LIT> ) ; return false ; } } return true


<s> Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyD16 , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDim ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAddrSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMovrels ( Inst , Operands ) ) { return false


<s> const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> || ! isGFX10Plus ( ) ) return true ; const <STR_LIT> * Info = <STR_LIT> ( Opc ) ; const <STR_LIT> * BaseOpcode = <STR_LIT> ( Info -> BaseOpcode ) ; int VAddr0Idx = <STR_LIT> ( Opc , <STR_LIT> :: vaddr0 ) ; int SrsrcIdx = <STR_LIT> ( Opc , <STR_LIT> :: srsrc ) ; int DimIdx = <STR_LIT> ( Opc , <STR_LIT> :: dim ) ; assert ( VAddr0Idx != - <NUM_LIT> ) ; assert ( SrsrcIdx != - <NUM_LIT> ) ; assert ( SrsrcIdx > VAddr0Idx ) ; if ( DimIdx == - <NUM_LIT> ) return true ; unsigned Dim = Inst . getOperand ( DimIdx ) . getImm ( ) ; const <STR_LIT> * DimInfo = <STR_LIT> ( Dim ) ; bool IsNSA = SrsrcIdx - VAddr0Idx > <NUM_LIT> ; unsigned VAddrSize = IsNSA ? SrsrcIdx - VAddr0Idx : <STR_LIT> ( getMRI ( ) , Desc , VAddr0Idx ) / <NUM_LIT> ; unsigned AddrSize = BaseOpcode -> NumExtraArgs + ( BaseOpcode -> Gradients ? DimInfo -> NumGradients : <NUM_LIT> ) + ( BaseOpcode -> Coordinates ? DimInfo -> NumCoords : <NUM_LIT> ) + ( BaseOpcode -> LodOrClampOrMip


<s> if ( ! isValidMsgId ( Msg . Id , getSTI ( ) , Strict ) ) { Error ( Msg . Loc , <STR_LIT> ) ; return false ; } if ( Strict && ( msgRequiresOp ( Msg . Id ) != Op . IsDefined ) ) { if ( Op . IsDefined ) { Error ( Op . Loc , <STR_LIT> ) ; } else { Error ( Msg . Loc , <STR_LIT> ) ; } return false ; } if ( ! isValidMsgOp ( Msg . Id , Op . Id , Strict ) ) { Error ( Op . Loc , <STR_LIT> ) ; return false ; } if ( Strict && ! msgSupportsStream ( Msg . Id , Op . Id ) && Stream . IsDefined ) { Error ( Stream . Loc , <STR_LIT> ) ; return false ; } if ( ! isValidMsgStream ( Msg . Id , Op . Id , Stream . Id , Strict


<s> unsigned Sub = MRI -> getSubReg ( Op . getReg ( ) , <STR_LIT> ) ; auto Reg = Sub ? Sub : Op . getReg ( ) ; const MCRegisterClass & AGRP32 = MRI ->


<s> bool <ISA_LIT>AsmParser :: validateGWS ( const MCInst & Inst , const OperandVector & Operands ) { if ( ! getFeatureBits ( ) [ <STR_LIT> ] ) return true ; int Opc = Inst . getOpcode ( ) ; if ( Opc != <STR_LIT> && Opc != <STR_LIT> && Opc != <STR_LIT> ) return true ; const MCRegisterInfo * MRI =


<s> int Opc = Inst . getOpcode ( ) ; if ( Opc != <STR_LIT> && Opc != <STR_LIT> && Opc != <STR_LIT> ) return true ; const MCRegisterInfo * MRI = getMRI ( ) ; const MCRegisterClass & VGRP32 = MRI -> getRegClass ( <STR_LIT> ) ; int Data0Pos = <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: data0 ) ; assert ( Data0Pos != - <NUM_LIT> ) ; auto Reg = Inst . getOperand ( Data0Pos ) .


<s> const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> || ! isGFX10Plus ( ) ) return true ; const <STR_LIT> * Info = <STR_LIT> ( Opc ) ; const <STR_LIT> * BaseOpcode = <STR_LIT> ( Info -> BaseOpcode ) ; int VAddr0Idx = <STR_LIT> ( Opc , <STR_LIT> :: vaddr0 ) ; int SrsrcIdx = <STR_LIT> ( Opc , <STR_LIT> :: srsrc ) ; int DimIdx = <STR_LIT> ( Opc , <STR_LIT> :: dim ) ; int A16Idx = <STR_LIT> ( Opc , <STR_LIT> :: a16 ) ; assert ( VAddr0Idx != - <NUM_LIT> ) ; assert ( SrsrcIdx != - <NUM_LIT> ) ; assert ( SrsrcIdx > VAddr0Idx ) ; if ( DimIdx == - <NUM_LIT> ) return true ; unsigned Dim = Inst . getOperand ( DimIdx ) . getImm ( ) ; const <STR_LIT> * DimInfo = <STR_LIT> ( Dim ) ; bool IsNSA = SrsrcIdx - VAddr0Idx > <NUM_LIT> ; unsigned VAddrSize = IsNSA ? SrsrcIdx - VAddr0Idx : <STR_LIT> ( getMRI ( ) , Desc , VAddr0Idx ) / <NUM_LIT> ; bool IsA16 = ( A16Idx != - <NUM_LIT> && Inst . getOperand ( A16Idx ) .


<s> const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> || ! isGFX10Plus ( ) ) return true ; const <STR_LIT> * Info = <STR_LIT> ( Opc ) ; const <STR_LIT> * BaseOpcode = <STR_LIT> ( Info -> BaseOpcode ) ; int VAddr0Idx = <STR_LIT> ( Opc , <STR_LIT> :: vaddr0 ) ; int SrsrcIdx = <STR_LIT> ( Opc , <STR_LIT> :: srsrc ) ; int DimIdx = <STR_LIT> ( Opc , <STR_LIT> :: dim ) ; int A16Idx = <STR_LIT> ( Opc , <STR_LIT> :: a16 ) ; assert ( VAddr0Idx != - <NUM_LIT> ) ; assert ( SrsrcIdx != - <NUM_LIT> ) ; assert ( SrsrcIdx > VAddr0Idx ) ; if ( DimIdx == - <NUM_LIT> ) return true ; unsigned Dim = Inst . getOperand ( DimIdx ) . getImm ( ) ; const <STR_LIT> * DimInfo = <STR_LIT> ( Dim ) ; bool IsNSA = SrsrcIdx - VAddr0Idx > <NUM_LIT> ; unsigned VAddrSize = IsNSA ? SrsrcIdx - VAddr0Idx : <STR_LIT> ( getMRI ( ) , Desc , VAddr0Idx ) / <NUM_LIT> ; bool IsA16 = ( A16Idx != - <NUM_LIT> && Inst . getOperand ( A16Idx ) . getImm ( ) ) ; unsigned AddrSize = <STR_LIT> ( BaseOpcode , DimInfo , IsA16 , hasG16 ( ) ) ; if ( ! IsNSA ) { if ( AddrSize > <NUM_LIT> ) AddrSize


<s> const MCRegisterInfo * MRI = getMRI ( ) ; const MCRegisterClass & VGRP32 = MRI -> getRegClass ( <STR_LIT> ) ; const MCRegisterClass & AGRP32 = MRI -> getRegClass ( <STR_LIT> ) ; for ( unsigned I = <NUM_LIT> , E = Inst . getNumOperands ( ) ; I != E ; ++ I ) { const MCOperand & Op = Inst . getOperand ( I ) ; if ( ! Op . isReg ( ) ) continue ; unsigned Sub = MRI -> getSubReg ( Op . getReg ( ) , <STR_LIT> ) ; if ( ! Sub ) continue ; if ( VGRP32 . contains ( Sub ) && ( ( Sub - <STR_LIT> ) & <NUM_LIT> ) ) return false ; if ( AGRP32 . contains ( Sub ) && ( ( Sub - <STR_LIT> ) & <NUM_LIT>


<s> auto FB = getFeatureBits ( ) ; if ( ! FB [ <STR_LIT> ] ) return true ; const MCRegisterInfo * MRI = getMRI ( ) ; const MCRegisterClass & VGRP32 = MRI -> getRegClass ( <STR_LIT> ) ; const MCRegisterClass & AGRP32 = MRI -> getRegClass ( <STR_LIT> ) ; for ( unsigned I = <NUM_LIT> , E = Inst . getNumOperands ( ) ; I != E ; ++ I ) { const MCOperand & Op = Inst . getOperand ( I ) ; if ( ! Op . isReg ( ) ) continue ; unsigned Sub = MRI -> getSubReg ( Op . getReg ( ) , <STR_LIT> ) ; if ( ! Sub )


<s> auto OpNum = Inst . getNumOperands ( ) ; assert ( <STR_LIT> ( InstDesc , OpNum ) ) ; if ( ApplyModifiers ) { assert ( <STR_LIT> ( InstDesc , OpNum ) ) ; const unsigned Size = Imm . IsFPImm ? sizeof ( double ) : getOperandSize ( InstDesc , OpNum ) ; Val = applyInputFPModifiers ( Val , Size ) ; } APInt Literal ( <NUM_LIT> , Val ) ; uint8_t OpTy = InstDesc . OpInfo [ OpNum ] . OperandType ; if ( Imm . IsFPImm ) { switch ( OpTy ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( <STR_LIT> ( Literal . getZExtValue ( ) , AsmParser -> hasInv2PiInlineImm ( ) ) ) { Inst . addOperand ( MCOperand :: createImm ( Literal . getZExtValue ( ) ) ) ; return ; } if ( <STR_LIT> ( InstDesc , OpNum ) ) { if ( Literal . getLoBits ( <NUM_LIT> ) != <NUM_LIT> ) { const_cast < <ISA_LIT>AsmParser * > ( AsmParser ) -> Warning ( Inst . getLoc ( ) , <STR_LIT> <STR_LIT> ) ; } Inst . addOperand ( MCOperand :: createImm ( Literal . lshr ( <NUM_LIT> ) . getZExtValue ( ) ) ) ; return ; } llvm_unreachable ( <STR_LIT> ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : { bool lost ; APFloat FPLiteral ( APFloat :: IEEEdouble ( ) , Literal ) ; FPLiteral . convert ( * getOpFltSemantics ( OpTy ) , APFloat :: rmNearestTiesToEven , & lost ) ; uint64_t ImmVal = FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ; Inst . addOperand ( MCOperand :: createImm ( ImmVal ) ) ; return ; } default : llvm_unreachable ( <STR_LIT> ) ; } return ; } switch ( OpTy ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( isSafeTruncation ( Val , <NUM_LIT> ) && <STR_LIT> ( static_cast < int32_t > ( Val ) , AsmParser -> hasInv2PiInlineImm ( ) ) ) { Inst . addOperand ( MCOperand :: createImm ( Val ) ) ; return ; } Inst . addOperand ( MCOperand :: createImm ( Val & <NUM_LIT> ) ) ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( <STR_LIT> ( Val , AsmParser -> hasInv2PiInlineImm ( ) ) ) { Inst . addOperand ( MCOperand :: createImm ( Val ) ) ; return ; } Inst . addOperand ( MCOperand :: createImm ( Lo_32 ( Val ) ) ) ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( isSafeTruncation ( Val , <NUM_LIT> ) && <STR_LIT> ( static_cast < int16_t > ( Val ) , AsmParser -> hasInv2PiInlineImm


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return & APFloat :: IEEEdouble ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return & APFloat :: IEEEhalf


<s> case <STR_LIT> : return & APFloat :: IEEEsingle ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return & APFloat :: IEEEdouble ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT>


<s> } const MCOperand & MO = Inst . getOperand ( OpIdx ) ; int64_t Val = MO . getImm ( ) ; auto OpSize = <STR_LIT> ( Desc , OpIdx ) ; switch ( OpSize ) { case <NUM_LIT> : return <STR_LIT> ( Val , hasInv2PiInlineImm ( ) ) ; case <NUM_LIT> : return <STR_LIT> ( Val , hasInv2PiInlineImm


<s> if ( ( R == Match_Success ) || ( R == Match_PreferE32 ) || ( R == Match_MissingFeature && Result != Match_PreferE32 ) || ( R == Match_InvalidOperand && Result != Match_MissingFeature && Result != Match_PreferE32 ) || ( R == Match_MnemonicFail && Result != Match_InvalidOperand && Result != Match_MissingFeature && Result != Match_PreferE32 ) ) { Result = R ; ErrorInfo = EI ; } if ( R == Match_Success ) break ; } switch ( Result ) { default : break ; case Match_Success : if ( ! validateInstruction ( Inst , IDLoc ) ) { return true ; } Inst . setLoc ( IDLoc ) ; Out . EmitInstruction ( Inst , getSTI ( ) ) ; return false ; case Match_MissingFeature : return Error ( IDLoc , <STR_LIT> ) ; case Match_MnemonicFail : { FeatureBitset FBS = ComputeAvailableFeatures ( getSTI ( ) . getFeatureBits ( ) ) ; std :: string Suggestion = <ISA_LIT>MnemonicSpellCheck ( ( ( <ISA_LIT>Operand & ) * Operands [ <NUM_LIT> ] ) . getToken ( ) , FBS ) ; return Error ( IDLoc , <STR_LIT> + Suggestion , ( ( <ISA_LIT>Operand & ) * Operands [ <NUM_LIT> ] ) . getLocRange ( ) ) ; } case Match_InvalidOperand :


<s> switch ( getLexer ( ) . getKind ( ) ) { case AsmToken :: Identifier : { StringRef Tok = Parser . getTok ( ) . getString ( ) ; if ( Tok == Name ) { if ( Tok == <STR_LIT> && isGFX9 ( ) ) Error ( S , <STR_LIT> ) ; if ( Tok == <STR_LIT> && ! isGFX9 ( ) ) Error ( S , <STR_LIT> ) ; Bit = <NUM_LIT> ; Parser . Lex ( ) ; } else if ( Tok . startswith ( <STR_LIT> ) && Tok . endswith ( Name ) ) { Bit = <NUM_LIT> ; Parser . Lex ( ) ; } else { return MatchOperand_NoMatch ; } break ; } default : return MatchOperand_NoMatch ; } } if ( ! isGFX10 ( ) && ImmTy == <ISA_LIT>Operand :: ImmTyDLC )


<s> Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateSOPLiteral ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateVOP3Literal ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateConstantBusLimitations ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateEarlyClobberLimitations ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateIntClampSupported ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateOpSel ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGD16 ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDim ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAddrSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } return


<s> Error ( Loc , Twine ( DepCtrName , <STR_LIT> ) ) ; return ; case OPR_ID_DUPLICATE : Error ( Loc , Twine ( <STR_LIT> , DepCtrName ) ) ; return ; case OPR_VAL_INVALID


<s> bool <ISA_LIT>Operand :: isDepCtr ( ) const { return isS16Imm


<s> if ( ! skipToken ( AsmToken :: Identifier , <STR_LIT> ) || ! skipToken ( AsmToken :: LParen , <STR_LIT> ) ) return false ; int64_t ExprVal ; if ( ! parseExpr ( ExprVal ) ) return false ; unsigned PrevOprMask = UsedOprMask ; int CntVal = encodeDepCtr ( DepCtrName , ExprVal , UsedOprMask , getSTI ( ) ) ; if ( CntVal <


<s> MCContext & Ctx = getContext ( ) ; MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Stepping ,


<s> MCContext & Ctx = getContext ( ) ; MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor ,


<s> SMLoc S = Parser . getTok ( ) . getLoc ( ) ; switch ( getLexer ( ) . getKind ( ) ) { default : return MatchOperand_ParseFail ; case AsmToken :: Integer : if ( getParser ( ) . parseAbsoluteExpression ( Waitcnt ) ) return MatchOperand_ParseFail ; break ; case AsmToken :: Identifier : do { if ( parseCnt ( Waitcnt ) ) return MatchOperand_ParseFail ; } while ( getLexer ( ) . isNot ( AsmToken :: EndOfStatement ) ) ; break ; } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Waitcnt , S ) ) ; return


<s> unsigned <ISA_LIT>AsmParser :: getConstantBusLimit ( unsigned Opcode ) const { if ( ! isGFX10Plus ( ) ) return <NUM_LIT> ; switch ( Opcode ) { case <STR_LIT> : case <STR_LIT>


<s> if ( getLexer ( ) . isNot ( AsmToken :: Identifier ) ) return MatchOperand_NoMatch ; if ( getLexer ( ) . getTok ( ) . getString ( ) != <STR_LIT> ) return MatchOperand_NoMatch ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Colon ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; std :: string Token ; if ( getLexer ( ) . is ( AsmToken :: Integer ) ) { SMLoc Loc = getLexer ( ) . getTok ( ) . getEndLoc ( ) ; Token = std :: string ( getLexer ( ) . getTok ( ) . getString ( ) ) ; Parser . Lex ( ) ; if ( getLexer ( ) . getTok ( ) . getLoc ( ) != Loc


<s> std :: string Token ; if ( getLexer ( ) . is ( AsmToken :: Integer ) ) { SMLoc Loc = getLexer ( ) . getTok ( ) . getEndLoc ( ) ; Token = std :: string ( getLexer ( ) . getTok ( ) . getString ( ) ) ; Parser . Lex ( ) ; if ( getLexer ( ) . getTok ( ) . getLoc ( ) != Loc ) return MatchOperand_ParseFail ; } if ( getLexer ( ) . isNot ( AsmToken :: Identifier ) ) return MatchOperand_ParseFail ; Token += getLexer ( ) . getTok ( ) . getString ( ) ; StringRef DimId = Token ; if ( DimId . startswith ( <STR_LIT> ) ) DimId =


<s> std :: string HSAMetadataString ; if ( ParseToEndDirective ( AssemblerDirectiveBegin , AssemblerDirectiveEnd , HSAMetadataString ) ) return true ; if ( isHsaAbiVersion3 ( & getSTI ( ) ) ) { if ( ! getTargetStreamer ( ) . EmitHSAMetadataV3 ( HSAMetadataString ) ) return Error ( getParser ( ) . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } else { if ( ! getTargetStreamer ( ) . EmitHSAMetadataV2 ( HSAMetadataString ) ) return Error ( getParser ( ) . getTok (


<s> Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: LBrac ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Sels [ <NUM_LIT> ] ) ) return MatchOperand_ParseFail ; if ( <NUM_LIT> > Sels [ <NUM_LIT> ] || <NUM_LIT> < Sels [ <NUM_LIT> ] ) return MatchOperand_ParseFail ; for ( size_t i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Sels [ i ]


<s> uint8_t Val ; auto Res = parseExpTgtImpl ( getTokenStr ( ) , Val ) ; if ( Res != MatchOperand_Success ) { Error ( S , <STR_LIT> ) ; return Res ; } Parser . Lex (


<s> StringRef Msg = ( Res == MatchOperand_ParseFail ) ? <STR_LIT> : <STR_LIT> ; Error ( getLexer ( ) . getLoc ( ) , Msg ) ; } while ( ! getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) { Parser . Lex ( ) ; } Parser . Lex ( ) ; return true ; } } Parser . Lex ( ) ; return false


<s> std :: unique_ptr < <ISA_LIT>Operand > <ISA_LIT>AsmParser :: parseRegister ( bool RestoreOnFailure ) { const auto & Tok = Parser . getTok ( ) ; SMLoc StartLoc = Tok . getLoc ( ) ; SMLoc EndLoc = Tok . getEndLoc ( ) ; RegisterKind RegKind ; unsigned Reg , RegNum , RegWidth ; if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) { return nullptr ; } if ( isHsaAbiVersion3 ( & getSTI ( ) ) ) { if ( ! updateGprCountSymbols ( RegKind , RegNum , RegWidth ) ) return nullptr ; } else KernelScope . usesRegister ( RegKind , RegNum , RegWidth ) ; return <ISA_LIT>Operand :: CreateReg ( this , Reg , StartLoc ,


<s> } if ( ! isUInt < <NUM_LIT> > ( Imm ) ) { Error ( OffsetLoc , <STR_LIT> ) ; return false ; } return true


<s> bool <ISA_LIT>AsmParser :: parseSwizzleOperand ( int64_t & Op , const unsigned MinVal , const unsigned MaxVal , const StringRef ErrMsg , SMLoc & Loc ) { if ( ! skipToken ( AsmToken :: Comma , <STR_LIT> ) ) { return false ; } Loc = Parser . getTok ( ) .


<s> } if ( Reg == <STR_LIT> && Reg1 == <STR_LIT> ) { Reg = <STR_LIT> ; RegWidth = <NUM_LIT> ; return true ; } if ( Reg == <STR_LIT> && Reg1 == <STR_LIT> ) { Reg = <STR_LIT> ; RegWidth = <NUM_LIT> ; return true ; } Error ( Loc , <STR_LIT> ) ; return false ; case IS_VGPR : case IS_SGPR : case IS_AGPR : case IS_TTMP : if ( Reg1 != Reg + RegWidth / <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return false ; } RegWidth += <NUM_LIT> ; return true


<s> if ( getFeatureBits ( ) . none ( ) ) { copySTI ( ) . ToggleFeature ( <STR_LIT> ) ; } setAvailableFeatures ( ComputeAvailableFeatures ( getFeatureBits ( ) ) ) ; { <STR_LIT> ISA = <STR_LIT> ( getSTI ( ) . getCPU ( ) ) ; MCContext & Ctx = getContext ( ) ; if ( ISA . Major >= <NUM_LIT> && isHsaAbiVersion3AndAbove ( & getSTI ( ) ) ) { MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Stepping , Ctx ) ) ; } else { MCSymbol * Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Major , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( ISA . Minor , Ctx ) ) ; Sym = Ctx . getOrCreateSymbol ( Twine ( <STR_LIT>


<s> } } else if ( Is == IS_SGPR ) { switch ( RegWidth ) { default : return - <NUM_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; } } else if ( Is == IS_AGPR ) { switch ( RegWidth ) { default : return - <NUM_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return


<s> case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; } } else if ( Is == IS_SGPR ) { switch ( RegWidth ) { default : return - <NUM_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; } } else if ( Is == IS_AGPR ) { switch ( RegWidth ) { default : return - <NUM_LIT> ; case <NUM_LIT> : return <STR_LIT> ; case


<s> const MCRegisterInfo * TRI = getContext ( ) . getRegisterInfo ( ) ; const MCRegisterClass RC = TRI -> getRegClass ( RCID ) ; if ( RegIdx >= RC . getNumRegs ( ) ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ; } return RC . getRegister ( RegIdx )


<s> usesSgprAt ( SgprIndexUnusedMin = - <NUM_LIT> ) ; usesVgprAt ( VgprIndexUnusedMin = - <NUM_LIT> ) ; if ( hasMAIInsts ( * MSTI ) ) { usesAgprAt ( AgprIndexUnusedMin =


<s> return isRegOrInline ( RCID , type ) || isLiteralImm (


<s> return isRegOrInline ( RCID , type ) ||


<s> bool isRegOrInline ( unsigned RCID , MVT type ) const { return isRegClass ( RCID ) || isInlinableImm (


<s> bool isRegOrInlineNoMods ( unsigned RCID , MVT type ) const { return isRegOrInline ( RCID , type ) && ! hasModifiers


<s> return isRegOrInline ( RCID , type ) && !


<s> void <ISA_LIT>AsmParser :: onBeginOfFile ( ) { if ( ! getParser ( ) . getStreamer ( ) . getTargetStreamer ( ) || getSTI ( ) . getTargetTriple ( ) . getArch ( ) == Triple :: r600 ) return ; if ( ! getTargetStreamer ( ) . getTargetID ( ) ) getTargetStreamer ( ) . initializeTargetID ( getSTI ( ) , getSTI ( ) . getFeatureString ( ) ) ; if ( isHsaAbiVersion3AndAbove ( & getSTI ( ) ) ) getTargetStreamer ( ) . EmitDirectiveAMDGCNTarget


<s> if ( ! getParser ( ) . getStreamer ( ) . getTargetStreamer ( ) || getSTI (

) . getTargetTriple ( ) . getArch ( ) == Triple :: r600 ) return ;


<s> else if ( trySkipId ( <STR_LIT> ) ) CPolOn = <STR_LIT> :: SLC ; else if ( trySkipId ( <STR_LIT> ) ) CPolOff = <STR_LIT> :: SLC ; else if ( trySkipId ( <STR_LIT> ) ) CPolOn = <STR_LIT> :: DLC ; else if ( trySkipId ( <STR_LIT> ) ) CPolOff = <STR_LIT> :: DLC ; else if ( trySkipId ( <STR_LIT> ) ) CPolOn = <STR_LIT> :: SCC ; else if ( trySkipId ( <STR_LIT> ) ) CPolOff = <STR_LIT> :: SCC ; else return MatchOperand_NoMatch ; if ( ! isGFX10Plus ( ) && ( ( CPolOn | CPolOff ) & <STR_LIT> :: DLC ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( ! isGFX90A ( ) && ( ( CPolOn | CPolOff ) & <STR_LIT> :: SCC ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( CPolSeen & ( CPolOn | CPolOff ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } CPolSeen |= ( CPolOn | CPolOff ) ; for ( unsigned I = <NUM_LIT> ; I != Operands . size ( ) ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands


<s> const char * AssemblerDirectiveEnd ; std :: tie ( AssemblerDirectiveBegin , AssemblerDirectiveEnd ) = isHsaAbiVersion3AndAbove ( & getSTI ( ) ) ? std :: make_tuple ( HSAMD :: V3 :: AssemblerDirectiveBegin , HSAMD :: V3 :: AssemblerDirectiveEnd ) : std :: make_tuple ( HSAMD :: AssemblerDirectiveBegin , HSAMD :: AssemblerDirectiveEnd ) ; if ( getSTI ( ) . getTargetTriple ( ) . getOS ( ) != Triple :: AMDHSA ) { return Error ( getLoc ( ) , ( Twine ( AssemblerDirectiveBegin ) + Twine ( <STR_LIT> <STR_LIT> ) ) . str ( ) ) ; } std :: string HSAMetadataString ; if ( ParseToEndDirective ( AssemblerDirectiveBegin , AssemblerDirectiveEnd , HSAMetadataString ) ) return true ; if ( isHsaAbiVersion3AndAbove ( & getSTI ( ) ) ) { if ( ! getTargetStreamer ( ) . EmitHSAMetadataV3 ( HSAMetadataString ) ) return


<s> if ( getSTI ( ) . getTargetTriple ( ) . getOS ( ) != Triple :: AMDHSA ) { return Error ( getLoc ( ) , ( Twine ( AssemblerDirectiveBegin ) + Twine ( <STR_LIT> <STR_LIT> ) ) . str ( ) ) ; } std :: string HSAMetadataString ; if ( ParseToEndDirective ( AssemblerDirectiveBegin , AssemblerDirectiveEnd , HSAMetadataString ) )


<s> OperandInfoTy Width ( WIDTH_DEFAULT_ ) ; if ( parseHwregBody ( HwReg , Offset , Width ) && validateHwreg ( HwReg , Offset , Width ) ) { ImmVal = encodeHwreg ( HwReg . Id , Offset . Id , Width . Id ) ; } else { return MatchOperand_ParseFail ; } } else if ( parseExpr ( ImmVal , <STR_LIT> ) ) { if ( ImmVal < <NUM_LIT> || ! isUInt < <NUM_LIT> > ( ImmVal ) ) { Error ( Loc ,


<s> if ( isToken ( AsmToken :: Identifier ) && ( HwReg . Id = getHwregId ( getTokenStr ( ) , getSTI ( ) ) ) != OPR_ID_UNKNOWN ) { HwReg . IsSymbolic = true ; lex ( ) ; } else if ( ! parseExpr ( HwReg . Id , <STR_LIT> ) ) { return


<s> bool <ISA_LIT>AsmParser :: parseHwregBody ( OperandInfoTy & HwReg , OperandInfoTy & Offset , OperandInfoTy & Width ) { using namespace llvm :: <STR_LIT> ; HwReg . Loc = getLoc ( ) ; if ( isToken ( AsmToken :: Identifier ) && ( HwReg . Id = getHwregId ( getTokenStr ( ) , getSTI ( ) ) ) != OPR_ID_UNKNOWN ) { HwReg . IsSymbolic = true ; lex ( ) ; } else if ( ! parseExpr ( HwReg . Id


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseOptionalOpr ( OperandVector & Operands ) { OperandMatchResultTy res ; for ( const OptionalOperand & Op : <ISA_LIT>OptionalOperandTable ) { if ( Op . IsBit ) { res = parseNamedBit ( Op . Name , Operands , Op . Type ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> ) { res = parseOModOperand ( Operands ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTySdwaDstSel || Op . Type == <ISA_LIT>Operand :: ImmTySdwaSrc0Sel || Op . Type == <ISA_LIT>Operand :: ImmTySdwaSrc1Sel ) { res = parseSDWASel ( Operands , Op . Name , Op . Type ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTySdwaDstUnused ) { res = parseSDWADstUnused ( Operands ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTyOpSel || Op . Type == <ISA_LIT>Operand :: ImmTyOpSelHi || Op . Type == <ISA_LIT>Operand :: ImmTyNegLo || Op . Type == <ISA_LIT>Operand :: ImmTyNegHi ) { res = parseOperandArrayWithPrefix ( Op . Name , Operands , Op . Type , Op . ConvertResult ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTyDim ) { res = parseDim ( Operands ) ; } else if ( Op . Type == <ISA_LIT>Operand :: ImmTyCPol ) { res = parseCPol ( Operands ) ; } else { res = parseIntWithPrefix ( Op . Name , Operands , Op . Type , Op . ConvertResult ) ; if ( Op . Type == <ISA_LIT>Operand :: ImmTyBLGP && res


<s> if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) { return nullptr ; } if ( isHsaAbiVersion3AndAbove ( & getSTI ( ) ) ) { if ( ! updateGprCountSymbols ( RegKind , RegNum , RegWidth ) ) return nullptr ; } else KernelScope . usesRegister ( RegKind , RegNum , RegWidth ) ; return <ISA_LIT>Operand :: CreateReg ( this , Reg


<s> auto Loc = getLoc ( ) ; if ( ! Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth ) ) return <STR_LIT> ; if ( RegWidth != <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ; } for ( ; trySkipToken ( AsmToken :: Comma ) ; ) { RegisterKind NextRegKind ; unsigned NextReg , NextRegNum , NextRegWidth ; Loc = getLoc ( ) ; if ( ! Parse<ISA_LIT>Register ( NextRegKind , NextReg , NextRegNum , NextRegWidth , Tokens ) ) { return <STR_LIT> ; } if ( NextRegWidth != <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ; } if ( NextRegKind != RegKind


<s> if ( ! skipToken ( AsmToken :: LBrac , <STR_LIT> ) ) return false ; SMLoc FirstIdxLoc = getLoc ( ) ; SMLoc SecondIdxLoc ; if ( ! parseExpr ( RegLo ) ) return false ; if ( trySkipToken ( AsmToken :: Colon ) ) { SecondIdxLoc = getLoc ( ) ; if ( ! parseExpr ( RegHi ) ) return false ; } else { RegHi = RegLo ; } if ( ! skipToken ( AsmToken :: RBrac , <STR_LIT> ) ) return false ; if ( ! isUInt < <NUM_LIT> > ( RegLo ) ) { Error ( FirstIdxLoc ,


<s> } else if ( ! parseExpr ( Msg . Id , <STR_LIT> ) ) { return false ; } if ( trySkipToken ( AsmToken :: Comma ) ) { Op . IsDefined = true ; Op . Loc = getLoc ( ) ; if ( isToken ( AsmToken :: Identifier ) && ( Op . Id = getMsgOpId ( Msg . Id , getTokenStr ( ) ) )


<s> if ( Reg ) { RegNum = <NUM_LIT> ; RegWidth = <NUM_LIT> ; RegKind = IS_SPECIAL ; Tokens . push_back ( getToken ( ) ) ; lex (


<s> case <STR_LIT> : return isGFX9Plus ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ! isGFX9Plus ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ( isVI ( ) || isGFX9 ( ) ) && getTargetStreamer ( ) . getTargetID ( ) -> isXnackSupported ( ) ; case <STR_LIT> : return isGFX10Plus ( ) ; default : break ; } if ( isCI ( ) ) return true ; if ( is<ISA_LIT> ( ) || isGFX10Plus ( ) ) { switch ( RegNo ) { case <STR_LIT> : case <STR_LIT>


<s> bool <ISA_LIT>AsmParser :: updateGprCountSymbols ( RegisterKind RegKind , unsigned DwordRegIndex , unsigned RegWidth ) { if ( <STR_LIT> ( getSTI ( ) . getCPU ( ) ) . Major < <NUM_LIT> ) return true ; auto SymbolName = getGprCountSymbolName ( RegKind ) ; if ( ! SymbolName ) return true ; MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( * SymbolName ) ; int64_t NewMax = DwordRegIndex + divideCeil (


<s> MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( * SymbolName ) ; int64_t NewMax = DwordRegIndex + divideCeil ( RegWidth , <NUM_LIT> ) - <NUM_LIT> ; int64_t OldCount ; if ( ! Sym -> isVariable ( ) ) return ! Error (


<s> MCSymbol * const Sym = Ctx -> getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( AgprIndexUnusedMin , * Ctx ) ) ; MCSymbol * const vSym = Ctx -> getOrCreateSymbol (


<s> unsigned CPol = Inst . getOperand ( CPolPos ) . getImm ( ) ; uint64_t TSFlags = MII . get ( Inst . getOpcode ( ) ) . TSFlags ; if ( ( TSFlags & ( <STR_LIT> ) ) && ( CPol & ~ ( <STR_LIT> :: GLC | <STR_LIT> :: DLC ) ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( isGFX90A ( ) && ! isGFX940 ( ) && ( CPol & CPol :: SCC ) ) { SMLoc S = getImmLoc ( <ISA_LIT>Operand :: ImmTyCPol , Operands ) ; StringRef CStr ( S . getPointer ( ) ) ; S = SMLoc :: getFromPointer ( & CStr . data ( ) [ CStr . find ( <STR_LIT> ) ] ) ; Error ( S , <STR_LIT> ) ; return false ; } if ( ! ( TSFlags & ( <STR_LIT> | <STR_LIT> ) ) ) return true ; if ( TSFlags & <STR_LIT> ) { if ( ! ( TSFlags & <STR_LIT> ) && ! ( CPol & CPol :: GLC ) ) { Error ( IDLoc , isGFX940 ( ) ? <STR_LIT> : <STR_LIT> ) ; return false ; } } else { if ( CPol & CPol :: GLC ) { SMLoc S = getImmLoc ( <ISA_LIT>Operand :: ImmTyCPol , Operands ) ; StringRef CStr ( S . getPointer ( ) ) ; S = SMLoc :: getFromPointer ( & CStr . data ( ) [ CStr . find ( <STR_LIT> ) ] ) ; Error ( S , isGFX940 ( ) ? <STR_LIT> :


<s> const unsigned Opcode = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opcode ) ; const int DstIdx = <STR_LIT> ( Opcode , <STR_LIT> :: vdst ) ; if ( DstIdx == - <NUM_LIT> || Desc . getOperandConstraint ( DstIdx , MCOI :: EARLY_CLOBBER ) == - <NUM_LIT> ) { return true ; } const MCRegisterInfo * TRI = getContext ( ) . getRegisterInfo ( ) ; const int Src0Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src0 ) ; const int Src1Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src1 ) ; const int Src2Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src2 ) ; assert ( DstIdx != - <NUM_LIT> ) ; const MCOperand & Dst = Inst . getOperand ( DstIdx ) ; assert ( Dst . isReg ( ) ) ; const int SrcIndices [ ] = { Src0Idx , Src1Idx , Src2Idx } ; for ( int SrcIdx : SrcIndices ) { if ( SrcIdx == - <NUM_LIT> ) break ; const MCOperand & Src = Inst . getOperand ( SrcIdx ) ; if ( Src . isReg ( ) ) { if ( TRI -> regsOverlap ( Dst . getReg ( ) , Src . getReg ( ) ) ) { const unsigned SrcReg = mc2PseudoReg ( Src . getReg ( ) ) ; Error ( getRegLoc ( SrcReg , Operands ) , <STR_LIT> ) ; return


<s> Error ( HwReg . Loc , <STR_LIT> ) ; return false ; } } if ( ! isValidHwregOffset ( Offset . Id ) ) { Error ( Offset . Loc , <STR_LIT> ) ; return false ; } if ( ! isValidHwregWidth ( Width . Id ) ) { Error ( Width . Loc , <STR_LIT> ) ; return false ; } return true


<s> } if ( ! validateSOPLiteral ( Inst ) ) { Error ( getLitLoc ( Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateVOPLiteral ( Inst , Operands ) ) { return false ; } if ( ! validateConstantBusLimitations ( Inst , Operands ) ) { return false ; } if ( ! validateEarlyClobberLimitations ( Inst , Operands ) ) { return false ; } if ( ! validateIntClampSupported ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateOpSel ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyOpSel , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateDPP ( Inst , Operands ) ) { return false ; } if ( ! validateMIMGD16 ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyD16 , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDim ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGMSAA ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDim , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAddrSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMovrels ( Inst , Operands ) ) { return false ; } if ( ! validateFlatOffset ( Inst , Operands ) ) { return false ; } if ( ! validateSMEMOffset ( Inst , Operands ) ) { return false ; } if ( ! validateMAIAccWrite ( Inst , Operands ) ) { return false ; } if ( ! validateMFMA ( Inst , Operands ) ) { return false ; } if ( ! validateCoherencyBits ( Inst , Operands , IDLoc ) ) { return false ; } if ( ! validateAGPRLdSt ( Inst ) ) { Error ( IDLoc , getFeatureBits ( ) [ <STR_LIT> ] ? <STR_LIT> : <STR_LIT> ) ; return false ; } if ( ! validateVGPRAlign (


<s> bool <ISA_LIT>AsmParser :: validateMFMA ( const MCInst & Inst , const OperandVector & Operands ) { const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; const int Src2Idx = <STR_LIT> ( Opc , <STR_LIT> :: src2 ) ; if ( Src2Idx == - <NUM_LIT> ) return true ; const MCOperand & Src2 = Inst . getOperand ( Src2Idx ) ; if ( ! Src2 . isReg ( ) ) return true ; MCRegister Src2Reg = Src2 . getReg ( ) ; MCRegister DstReg = Inst . getOperand ( <NUM_LIT> ) . getReg ( ) ; if ( Src2Reg == DstReg ) return true ; const MCRegisterInfo * TRI = getContext ( ) . getRegisterInfo ( ) ; if ( TRI -> getRegClass ( Desc . OpInfo [ <NUM_LIT> ] . RegClass ) . getSizeInBits ( ) <= <NUM_LIT> ) return true ; if ( TRI -> regsOverlap (


<s> bool <ISA_LIT>AsmParser :: validateOpSel ( const MCInst & Inst ) { const unsigned Opc = Inst . getOpcode ( ) ; if ( Opc == <STR_LIT> || Opc == <STR_LIT> ) { int OpSelIdx = <STR_LIT> ( Opc , <STR_LIT> :: op_sel ) ; unsigned OpSel = Inst . getOperand ( OpSelIdx ) . getImm ( ) ; if ( OpSel & ~ <NUM_LIT> ) return false ; } if ( isGFX940 ( ) && ( MII . get ( Opc ) . TSFlags & <STR_LIT> ) ) { int OpSelIdx = <STR_LIT> ( Opc , <STR_LIT> :: op_sel ) ; if ( OpSelIdx != - <NUM_LIT> ) { if ( Inst . getOperand ( OpSelIdx ) . getImm ( ) != <NUM_LIT> ) return false ; } int OpSelHiIdx = <STR_LIT> ( Opc


<s> if ( Msg . Id == OPR_ID_UNSUPPORTED ) { Error ( Msg . Loc , <STR_LIT> ) ; return false ; } } else { if ( ! isValidMsgId ( Msg . Id ) ) { Error ( Msg . Loc , <STR_LIT> ) ; return false ; } } if ( Strict && ( msgRequiresOp ( Msg . Id ) != Op . IsDefined ) ) { if ( Op . IsDefined ) { Error ( Op . Loc , <STR_LIT> ) ; } else { Error ( Msg . Loc , <STR_LIT> ) ; } return false ; } if ( ! isValidMsgOp ( Msg . Id , Op . Id , getSTI ( ) , Strict ) ) { Error ( Op . Loc , <STR_LIT> ) ; return false ; } if ( Strict && ! msgSupportsStream ( Msg . Id , Op . Id ) && Stream . IsDefined ) { Error ( Stream . Loc


<s> if ( Op . isOff ( ) ) { assert ( SrcIdx < <NUM_LIT> ) ; OperandIdx [ SrcIdx ] = Inst . size ( ) ; Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ) ) ; ++ SrcIdx ; continue ; } if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyExpTgt ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) && ( Op . getToken ( ) == <STR_LIT> || Op . getToken ( ) == <STR_LIT> ) ) continue ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } assert ( SrcIdx == <NUM_LIT> ) ; bool Compr = false ; if ( OptionalIdx . find ( <ISA_LIT>Operand :: ImmTyExpCompr ) != OptionalIdx . end ( ) ) { Compr = true ; Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) = Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) ; Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) . setReg ( <STR_LIT> ) ; Inst . getOperand ( OperandIdx [ <NUM_LIT>


<s> if ( OptionalIdx . find ( <ISA_LIT>Operand :: ImmTyExpCompr ) != OptionalIdx . end ( ) ) { Compr = true ; Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) = Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) ; Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) . setReg ( <STR_LIT> ) ; Inst . getOperand ( OperandIdx [ <NUM_LIT> ] ) . setReg ( <STR_LIT> ) ; } for ( auto i = <NUM_LIT> ; i < SrcIdx ; ++ i ) { if ( Inst . getOperand ( OperandIdx [ i ] ) . getReg ( ) != <STR_LIT> ) { EnMask |= Compr ? ( <NUM_LIT> << i * <NUM_LIT> ) : ( <NUM_LIT> << i ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyExpVM ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyExpCompr ) ; Inst . addOperand ( MCOperand ::


<s> for ( unsigned i = FirstOperandIdx , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; if ( IsAtomicReturn && i == FirstOperandIdx ) Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyNone ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) ) { continue ; } assert ( Op . isImm ( ) ) ; OptionalIdx [ Op . getImmTy (


<s> unsigned Opc = Inst . getOpcode ( ) ; unsigned I = <NUM_LIT> ; const MCInstrDesc & Desc = MII . get ( Inst . getOpcode ( ) ) ; for ( unsigned J = <NUM_LIT> ; J < Desc . getNumDefs ( ) ; ++ J ) { ( ( <ISA_LIT>Operand & ) * Operands [ I ++ ] ) . addRegOperands ( Inst , <NUM_LIT> ) ; } for ( unsigned E = Operands . size ( ) ; I != E ; ++ I ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( isRegOrImmWithInputMods ( Desc , Inst . getNumOperands ( ) ) ) { Op . addRegOrImmWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> ) ; int OpSelIdx = <STR_LIT> ( Opc , <STR_LIT> :: op_sel ) ; if ( OpSelIdx != - <NUM_LIT> ) addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOpSel ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyWaitEXP


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser ::


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultWaitVDST ( )


<s> bool isGFX11Plus ( ) const { return <STR_LIT> ( getSTI


<s> bool <ISA_LIT>Operand :: isSDelayAlu ( ) const { return isImm ( )


<s> bool <ISA_LIT>Operand :: isSMEMOffset ( ) const { return isImmTy ( ImmTyNone ) || isImmTy ( ImmTyOffset


<s> bool <ISA_LIT>Operand :: isWaitEXP ( ) const { return isImmTy ( ImmTyWaitEXP ) && isUInt <


<s> if ( ! skipToken ( AsmToken :: Identifier , <STR_LIT> ) || ! skipToken ( AsmToken :: LParen , <STR_LIT> ) ) return false ; SMLoc ValueLoc = getLoc ( ) ; StringRef ValueName = getTokenStr ( ) ; if ( ! skipToken ( AsmToken :: Identifier , <STR_LIT> ) || ! skipToken ( AsmToken :: RParen , <STR_LIT> ) ) return false ; unsigned Shift ; if ( FieldName == <STR_LIT> ) { Shift = <NUM_LIT> ; } else if ( FieldName == <STR_LIT> ) { Shift = <NUM_LIT> ; } else if ( FieldName == <STR_LIT> ) { Shift = <NUM_LIT> ; } else { Error ( FieldLoc , <STR_LIT> + FieldName ) ; return false ; } int Value ; if ( Shift == <NUM_LIT> ) { Value = StringSwitch < int > ( ValueName ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Default ( - <NUM_LIT> ) ; } else { Value = StringSwitch < int > ( ValueName ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Case ( <STR_LIT> , <NUM_LIT> ) . Default ( - <NUM_LIT> ) ; } if ( Value < <NUM_LIT> ) { Error ( ValueLoc , <STR_LIT> + ValueName ) ; return false ; } Delay |= Value << Shift ; return true


<s> bool IsMIMG = Name . startswith ( <STR_LIT> ) ; while ( ! trySkipToken ( AsmToken :: EndOfStatement ) ) { OperandMode Mode = OperandMode_Default ; if ( IsMIMG && isGFX10Plus ( ) && Operands . size ( ) == <NUM_LIT> ) Mode = OperandMode_NSA ; CPolSeen = <NUM_LIT> ; OperandMatchResultTy Res = parseOperand ( Operands , Name , Mode ) ; if ( Res != MatchOperand_Success ) { checkUnsupportedInstruction ( Name , NameLoc ) ; if ( ! Parser . hasPendingError ( ) ) { StringRef Msg = ( Res == MatchOperand_ParseFail ) ? <STR_LIT> : <STR_LIT> ; Error ( getLoc ( ) , Msg


<s> int64_t Delay = <NUM_LIT> ; SMLoc S = getLoc ( ) ; if ( isToken ( AsmToken :: Identifier ) && peekToken ( ) . is ( AsmToken ::


<s> } } Dfmt = ( Dfmt == DFMT_UNDEF ) ? DFMT_DEFAULT : Dfmt ; Nfmt = ( Nfmt == NFMT_UNDEF ) ? NFMT_DEFAULT : Nfmt ; if ( isGFX10Plus ( ) ) { auto Ufmt = convertDfmtNfmt2Ufmt ( Dfmt , Nfmt , getSTI ( ) ) ; if ( Ufmt == UFMT_UNDEF ) { Error ( FormatLoc , <STR_LIT> ) ; return MatchOperand_ParseFail ; } Format = Ufmt ; }


<s> using namespace llvm :: <STR_LIT> ; auto Id = getUnifiedFormat ( FormatStr , getSTI ( ) ) ; if ( Id == UFMT_UNDEF ) return MatchOperand_NoMatch ; if ( ! isGFX10Plus (


<s> case ImmTySWZ : OS << <STR_LIT> ; break ; case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyD16 : OS << <STR_LIT> ; break ; case ImmTyFORMAT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDPP8 : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTyDppFi : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ; case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ; case ImmTyDMask : OS << <STR_LIT> ; break ; case ImmTyDim : OS << <STR_LIT> ; break ; case ImmTyUNorm : OS << <STR_LIT> ; break ; case ImmTyDA : OS << <STR_LIT> ; break ; case ImmTyR128A16 : OS << <STR_LIT> ; break ; case ImmTyA16 : OS << <STR_LIT> ; break ; case ImmTyLWE : OS << <STR_LIT> ; break ; case ImmTyOff : OS << <STR_LIT> ; break ; case ImmTyExpTgt : OS << <STR_LIT> ; break ; case ImmTyExpCompr : OS << <STR_LIT> ; break ; case ImmTyExpVM : OS << <STR_LIT> ; break ; case ImmTyHwreg : OS << <STR_LIT> ; break ; case ImmTySendMsg : OS << <STR_LIT> ;


<s> if ( isGFX940 ( ) ) return true ; uint64_t TSFlags = MII . get ( Inst . getOpcode ( ) ) . TSFlags ; if ( ( TSFlags & ( <STR_LIT> | <STR_LIT> ) ) != ( <STR_LIT> | <STR_LIT> )


<s> if ( auto ErrMsg = validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , * ErrMsg ) ; return false ; } if ( ! validateMIMGAddrSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMovrels ( Inst , Operands ) ) { return false ; } if ( ! validateFlatOffset ( Inst , Operands ) ) { return false ; } if ( ! validateSMEMOffset ( Inst , Operands ) ) { return false ; } if ( ! validateMAIAccWrite ( Inst , Operands ) ) { return false ; } if ( ! validateMFMA ( Inst , Operands ) ) { return false ; } if ( ! validateCoherencyBits ( Inst , Operands , IDLoc ) ) { return


<s> } if ( ! validateOpSel ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyOpSel , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateDPP ( Inst , Operands ) ) { return false ; } if ( ! validateMIMGD16 ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyD16 , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGDim ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGMSAA ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDim , Operands ) , <STR_LIT> ) ; return false ; } if ( auto ErrMsg = validateMIMGDataSize ( Inst ) ) { Error ( IDLoc , * ErrMsg ) ; return false ; } if ( ! validateMIMGAddrSize ( Inst ) ) { Error ( IDLoc , <STR_LIT> ) ; return false ; } if ( ! validateMIMGAtomicDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) , <STR_LIT> ) ; return false ; } if ( ! validateMIMGGatherDMask ( Inst ) ) { Error ( getImmLoc ( <ISA_LIT>Operand :: ImmTyDMask , Operands ) ,


<s> using namespace <ISA_LIT>InstrFlags ; const unsigned Opcode = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opcode ) ; const auto Enc = VOP1 | VOP2 | VOP3 | VOPC | VOP3P | <STR_LIT> ; if ( ( Desc . TSFlags & Enc ) == <NUM_LIT> ) return None ; for ( auto SrcName : { OpName :: src0 , OpName :: src1 , OpName :: src2 } ) { auto SrcIdx = getNamedOperandIdx ( Opcode , SrcName ) ; if ( SrcIdx == - <NUM_LIT>


<s> const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return None ; int VDataIdx = <STR_LIT> ( Opc , <STR_LIT> :: vdata ) ; int DMaskIdx = <STR_LIT> ( Opc , <STR_LIT> :: dmask ) ; int TFEIdx = <STR_LIT> ( Opc , <STR_LIT> :: tfe ) ; assert ( VDataIdx != - <NUM_LIT> ) ; if ( DMaskIdx == - <NUM_LIT> || TFEIdx == - <NUM_LIT> ) return None ; unsigned VDataSize = <STR_LIT> ( getMRI ( ) , Desc , VDataIdx ) ; unsigned TFESize = ( TFEIdx != - <NUM_LIT> && Inst . getOperand ( TFEIdx ) . getImm


<s> if ( ! isValidMsgId ( Msg . Id , getSTI ( ) ) ) { Error ( Msg . Loc , <STR_LIT> ) ; return false ; } } if ( Strict && ( msgRequiresOp ( Msg . Id , getSTI ( ) ) != Op . IsDefined ) ) { if ( Op . IsDefined ) { Error ( Op . Loc , <STR_LIT> ) ; } else { Error ( Msg . Loc , <STR_LIT> ) ; } return false ; } if ( ! isValidMsgOp ( Msg . Id , Op . Id , getSTI ( ) , Strict ) ) { Error ( Op . Loc , <STR_LIT> ) ; return false ; } if ( Strict && ! msgSupportsStream ( Msg . Id , Op . Id , getSTI ( ) ) && Stream . IsDefined ) { Error ( Stream . Loc , <STR_LIT> ) ; return false ; } if ( ! isValidMsgStream ( Msg . Id , Op . Id ,


<s> using namespace llvm :: <STR_LIT> ; int64_t Format = getDefaultFormatEncoding ( getSTI ( ) ) ; OperandMatchResultTy Res ; SMLoc Loc = getLoc ( ) ; Res = isGFX10 ( ) ? parseUfmt ( Format ) : parseDfmtNfmt ( Format ) ; if ( Res == MatchOperand_ParseFail ) return Res ; bool FormatFound = ( Res == MatchOperand_Success ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Format , Loc , <ISA_LIT>Operand :: ImmTyFORMAT ) ) ; if ( FormatFound ) trySkipToken ( AsmToken :: Comma ) ; if ( isToken ( AsmToken


<s> auto Res = parseSymbolicUnifiedFormat ( FormatStr , Loc , Format ) ; if ( Res == MatchOperand_NoMatch ) Res = parseSymbolicSplitFormat ( FormatStr , Loc , Format ) ; if ( Res != MatchOperand_Success


<s> int64_t Dfmt = DFMT_UNDEF ; int64_t Nfmt = NFMT_UNDEF ; if ( ! matchDfmtNfmt ( Dfmt , Nfmt , FormatStr , FormatLoc ) ) return MatchOperand_ParseFail ; if ( trySkipToken ( AsmToken :: Comma ) ) { StringRef Str ; SMLoc Loc = getLoc ( ) ; if ( ! parseId ( Str , <STR_LIT> ) || ! matchDfmtNfmt ( Dfmt , Nfmt , Str , Loc ) ) { return MatchOperand_ParseFail ; } if ( Dfmt == DFMT_UNDEF ) { Error ( Loc , <STR_LIT> ) ; } else if ( Nfmt == NFMT_UNDEF ) { Error ( Loc , <STR_LIT> ) ; } } Dfmt = ( Dfmt == DFMT_UNDEF ) ? DFMT_DEFAULT : Dfmt ; Nfmt = ( Nfmt == NFMT_UNDEF ) ? NFMT_DEFAULT : Nfmt ; if ( isGFX10 ( ) ) { auto Ufmt = convertDfmtNfmt2Ufmt ( Dfmt , Nfmt ) ; if ( Ufmt == UFMT_UNDEF ) Error (


<s> if ( Desc . TSFlags & ( <STR_LIT> | <STR_LIT> | <STR_LIT> | <STR_LIT> | <STR_LIT> | <STR_LIT> ) ) { if ( <STR_LIT> ( Opcode , <STR_LIT> :: imm ) != - <NUM_LIT> ) { ++ ConstantBusUseCount ; } SmallDenseSet < unsigned > SGPRsUsed ; unsigned SGPRUsed = findImplicitSGPRReadInVOP ( Inst ) ; if ( SGPRUsed != <STR_LIT> ) { SGPRsUsed . insert ( SGPRUsed ) ; ++ ConstantBusUseCount ; } const int Src0Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src0 ) ; const int Src1Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src1 ) ; const int Src2Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src2 ) ; const int OpIndices [ ] = { Src0Idx , Src1Idx , Src2Idx } ; for ( int OpIdx : OpIndices ) { if ( OpIdx == - <NUM_LIT> ) break ; const MCOperand & MO = Inst . getOperand ( OpIdx ) ; if ( usesConstantBus ( Inst , OpIdx ) ) { if ( MO .


<s> } const int Ops [ ] = { <STR_LIT> :: src0 , <STR_LIT> :: src1 , <STR_LIT> :: src2 } ; const int ModOps [ ] = { <STR_LIT> :: src0_modifiers , <STR_LIT> :: src1_modifiers , <STR_LIT> :: src2_modifiers } ; int OpSelIdx = <STR_LIT> ( Opc , <STR_LIT> :: op_sel ) ; int OpSelHiIdx = <STR_LIT> ( Opc , <STR_LIT> :: op_sel_hi ) ; unsigned OpSel = Inst . getOperand ( OpSelIdx ) . getImm ( ) ; unsigned OpSelHi = Inst . getOperand ( OpSelHiIdx ) . getImm ( ) ; unsigned NegLo = <NUM_LIT> ; unsigned NegHi = <NUM_LIT> ; if ( NegLoIdx != - <NUM_LIT> ) { int NegHiIdx = <STR_LIT> ( Opc , <STR_LIT> :: neg_hi ) ; NegLo = Inst . getOperand ( NegLoIdx ) . getImm ( ) ; NegHi = Inst . getOperand ( NegHiIdx ) . getImm ( ) ; } for ( int J = <NUM_LIT> ; J <


<s> bool Abs = Imm . Modifiers & <NUM_LIT> ; if ( Imm . IsFPImm ) { APFloat F ( BitsToFloat ( Val ) ) ; if ( Abs ) { F . clearSign ( ) ; } if ( Negate ) { F . changeSign ( ) ; } Val = F . bitcastToAPInt ( ) . getZExtValue ( ) ; } else


<s> void addRegOrImmOperands ( MCInst & Inst , unsigned N ) const { if ( isRegKind ( ) ) addRegOperands ( Inst , N ) ; else addImmOperands ( Inst ,


<s> static <ISA_LIT>Operand :: Ptr CreateImm ( int64_t Val , SMLoc Loc , enum ImmTy Type = ImmTyNone , bool IsFPImm = false ) { auto Op = llvm :: make_unique < <ISA_LIT>Operand > ( Immediate ) ; Op -> Imm . Val = Val ; Op -> Imm . IsFPImm


<s> auto Op = llvm :: make_unique < <ISA_LIT>Operand > ( Register ) ; Op -> Reg . RegNo = RegNo ; Op -> Reg . TRI = TRI ; Op -> Reg . STI = STI ; Op -> Reg . Modifiers = <NUM_LIT> ; Op -> Reg . IsForcedVOP3 = ForceVOP3 ; Op -> StartLoc = S ; Op -> EndLoc


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser ::


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultHwreg ( ) const { return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc (


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) , <ISA_LIT>Operand


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultMubufOffset ( ) const { return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) , <ISA_LIT>Operand


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultOMod<ISA_LIT> ( )


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc ( ) ,

<ISA_LIT>Operand :: ImmTySdwaDstUnused ) ;


<s> return <ISA_LIT>Operand :: CreateImm ( <NUM_LIT> , SMLoc (

) , <ISA_LIT>Operand :: ImmTySdwaSel ) ;


<s> bool hasModifiers ( ) const { assert ( isRegKind ( ) || isImm (


<s> return ( Imm . Val <= <NUM_LIT> && Imm . Val >= - <NUM_LIT> ) || ( F == <NUM_LIT> || F == <NUM_LIT> || F == - <NUM_LIT> || F == <NUM_LIT> || F == - <NUM_LIT> || F ==


<s> return isImmTy ( ImmTyOffset ) && isUInt <


<s> return isImmTy ( ImmTyOffset ) && isUInt < <NUM_LIT> > ( getImm ( )


<s> return Kind == Register && Reg . Modifiers ==


<s> bool isRegOrImmWithInputMods ( ) const { return Kind == Register ||


<s> bool isSDWASel ( ) const { return isImmTy ( ImmTySdwaSel )