<s> 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> : { bool lost ; APFloat FPLiteral ( APFloat :: IEEEdouble ( ) , Literal ) ; FPLiteral . convert ( * getOpFltSemantics ( OpTy ) , APFloat :: rmNearestTiesToEven , & lost ) ; uint64_t ImmVal = FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ; if ( OpTy == <STR_LIT> || OpTy == <STR_LIT> ) { ImmVal |= ( ImmVal << <NUM_LIT> ) ; } Inst . addOperand ( MCOperand :: createImm ( ImmVal ) ) ; return ; } default : llvm_unreachable ( <STR_LIT> ) ; } return ; } switch ( OpTy ) { case <STR_LIT>


<s> 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 ( ) ; if ( OpTy == <STR_LIT> || OpTy == <STR_LIT> ) { ImmVal |= ( ImmVal << <NUM_LIT> ) ; } 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> : if ( isInt < <NUM_LIT> > ( Val ) && <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>


<s> return true ; } 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 ; } return false ; case IS_VGPR : case IS_SGPR : case IS_TTMP : if ( Reg1 != Reg + RegWidth ) { return false ; } RegWidth ++ ; return true ; default : llvm_unreachable ( <STR_LIT> )


<s> setAvailableFeatures ( ComputeAvailableFeatures ( getFeatureBits ( ) ) ) ; { <STR_LIT> :: IsaVersion ISA = <STR_LIT> :: getIsaVersion ( 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 , Ctx )


<s> addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDMask ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyUNorm ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyR128 ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyTFE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyLWE ) ; 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 ( 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


<s> assert ( Op . isImm ( ) ) ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDFMT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyNFMT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand


<s> } assert ( Op . isImm ( ) ) ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDFMT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyNFMT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand


<s> 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


<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 (


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


<s> static unsigned getSpecialRegForName ( StringRef RegName ) { return StringSwitch < unsigned > ( RegName ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case (

<STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Default ( <NUM_LIT> ) ;


<s> return StringSwitch < unsigned > ( RegName ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> )

. Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Default ( <NUM_LIT> ) ;


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


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


<s> return isImmTy ( ImmTyNFMT ) && isUInt < <NUM_LIT> >


<s> bool isOffsetS13 ( ) const { return ( isImmTy ( ImmTyOffset ) || isImmTy ( ImmTyInstOffset ) ) && isInt < <NUM_LIT> > ( getImm


<s> if ( AsmParser -> isVI ( ) ) return isVReg ( ) ; else if ( AsmParser -> isGFX9 ( ) ) return isRegKind ( ) || isInlinableImm (


<s> if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveISAVersion ( ) ; if ( IDVal == <STR_LIT> :: AssemblerDirectiveBegin )


<s> if ( getSTI ( ) . getTargetTriple ( ) . getOS ( ) != Triple :: AMDPAL ) { return Error ( getParser ( ) . getTok ( ) . getLoc ( ) , ( Twine ( PALMD :: AssemblerDirective ) + Twine ( <STR_LIT> <STR_LIT> ) ) . str ( ) ) ; } PALMD :: Metadata PALMetadata ; for ( ; ; )


<s> if ( getLexer ( ) . is ( AsmToken :: RParen ) ) { Parser . Lex ( ) ; return false ; } if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( Offset ) ) return true ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return true ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return true ; if ( getParser ( ) . parseAbsoluteExpression ( Width


<s> if ( getLexer ( ) . isNot ( AsmToken :: Colon ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; bool IsMinus = false ; if ( getLexer ( ) . getKind ( ) == AsmToken :: Minus ) { Parser . Lex ( ) ; IsMinus = true


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseOperand ( OperandVector & Operands , StringRef Mnemonic ) { OperandMatchResultTy ResTy = MatchOperandParserImpl ( Operands , Mnemonic ) ; if ( ResTy == MatchOperand_Success || ResTy == MatchOperand_ParseFail || getLexer ( ) . is ( AsmToken :: EndOfStatement ) ) return ResTy ; ResTy = parseRegOrImm (


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseOperandArrayWithPrefix ( const char * Prefix , OperandVector & Operands , <ISA_LIT>Operand :: ImmTy ImmTy , bool ( * ConvertResult ) ( int64_t & ) ) { StringRef Name = Parser . getTok ( ) . getString ( ) ; if ( ! Name . equals ( Prefix ) ) return MatchOperand_NoMatch ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken :: Colon ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; if ( getLexer ( ) . isNot ( AsmToken

:: LBrac ) ) return MatchOperand_ParseFail ;


<s> if ( getLexer ( ) . isNot ( AsmToken :: LBrac ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; unsigned Val = <NUM_LIT> ; SMLoc S = Parser . getTok ( ) . getLoc ( ) ; for ( int I = <NUM_LIT> ; I < <NUM_LIT> ; ++ I ) { if ( I != <NUM_LIT> ) { if ( getLexer ( ) . is ( AsmToken :: RBrac ) ) break ; if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; } if ( getLexer ( ) . isNot ( AsmToken :: Integer ) ) return MatchOperand_ParseFail ; int64_t


<s> 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 ,


<s> 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> ; break ; case ImmTyNegHi : OS << <STR_LIT>


<s> 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> ; break ; case ImmTyNegHi : OS << <STR_LIT> ; break ; case ImmTySwizzle : OS << <STR_LIT> ; break ; case ImmTyHigh : OS << <STR_LIT> ; break


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ! isGFX9 ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ! isCI ( ) && ! is<ISA_LIT> ( ) && hasXNACK ( ) ; default : break ; } if ( isCI ( ) ) return true ; if ( is<ISA_LIT> ( ) ) { switch ( RegNo ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return false ; default : return true ; } } for ( MCRegAliasIterator R ( <STR_LIT> , & MRI , true ) ; R . isValid ( ) ; ++ R ) { if ( * R == RegNo )


<s> switch ( RegNo ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ! isGFX9 ( ) ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return ! isCI ( ) && ! is<ISA_LIT> ( ) && hasXNACK ( ) ; default : break ; } if ( isCI ( ) ) return true ; if ( is<ISA_LIT> ( ) ) { switch ( RegNo ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return false ; default : return true ; } } for ( MCRegAliasIterator R ( <STR_LIT> , & MRI


<s> 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 (


<s> const MCInstrDesc & Desc = MII . get ( Opcode ) ; unsigned ConstantBusUseCount = <NUM_LIT> ; 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 ; } unsigned SGPRUsed = findImplicitSGPRReadInVOP ( Inst ) ; if ( SGPRUsed != <STR_LIT> ) { ++ ConstantBusUseCount ; } const int Src0Idx = <STR_LIT> ( Opcode , <STR_LIT> :: src0 ) ; const int Src1Idx = <STR_LIT> ( Opcode , <STR_LIT> ::


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


<s> 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 ( & getSTI ( ) , NumVGPRs ) ; SGPRBlocks = IsaInfo :: getNumSGPRBlocks ( & getSTI ( ) , NumSGPRs ) ; return


<s> 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 ) { auto TiedTo = Desc . getOperandConstraint ( Inst . getNumOperands ( ) , MCOI :: TIED_TO ) ; if ( TiedTo != - <NUM_LIT> ) { assert ( ( unsigned ) TiedTo < Inst . getNumOperands ( ) ) ; Inst . addOperand ( Inst . getOperand ( TiedTo ) ) ; } <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ I ] ) ; if ( Op . isReg ( ) && Op . Reg . RegNo == <STR_LIT> ) { continue ; } if ( isRegOrImmWithInputMods ( Desc , Inst . getNumOperands ( ) ) ) { Op . addRegWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isDPPCtrl ( ) ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImm ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> ) ; } } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDppRowMask , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDppBankMask ,


<s> Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) ) { continue ; } assert ( Op . isImm ( ) ) ; OptionalIdx [ Op . getImmTy ( ) ] = i ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyFORMAT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand


<s> continue ; } 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 ; } } if ( IsAtomicReturn ) { MCInst :: iterator I = Inst . begin ( ) ; Inst . insert ( I , * I ) ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; if ( ! IsAtomic ) { addOptionalImmOperand ( Inst , Operands ,

OptionalIdx , <ISA_LIT>Operand :: ImmTyGLC ) ;


<s> 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 ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { Op . addRegOrImmOperands ( Inst , <NUM_LIT> ) ; } } } if ( <STR_LIT> ( Opc , <STR_LIT> :: clamp ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> ) ; } if ( <STR_LIT> ( Opc , <STR_LIT> :: omod ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> ) ; } if ( Opc == <STR_LIT> || Opc == <STR_LIT> || Opc == <STR_LIT> || Opc


<s> if ( ID == <STR_LIT> ) { Parser . eatToEndOfStatement ( ) ; return false ; } SmallString < <NUM_LIT> > ErrStr ; raw_svector_ostream Err ( ErrStr ) ; if ( ! parseAmdKernelCodeField ( ID , getParser ( ) , Header , Err ) ) { return TokError ( Err . str


<s> if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDGCNTarget ( ) ; 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 ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>HsaKernel ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirectiveISAVersion ( ) ; if ( IDVal == <STR_LIT> :: AssemblerDirectiveBegin ) return ParseDirectiveHSAMetadata ( ) ; } if ( IDVal == PALMD :: AssemblerDirective ) return ParseDirectivePALMetadata ( ) ; return


<s> } } YamlStream << Parser . parseStringToEndOfStatement ( ) << getContext ( ) . getAsmInfo ( ) -> getSeparatorString ( ) ; Parser . eatToEndOfStatement ( ) ; } getLexer ( ) . setSkipSpace ( true ) ; if ( getLexer ( ) . is ( AsmToken :: Eof ) && ! FoundEnd ) { return TokError ( Twine ( <STR_LIT> ) + Twine ( HSAMD :: AssemblerDirectiveEnd ) + Twine ( <STR_LIT> ) ) ; } YamlStream . flush ( ) ; if ( IsaInfo :: hasCodeObjectV3 ( & getSTI ( ) ) ) { if ( ! getTargetStreamer ( ) . EmitHSAMetadataV3 ( HSAMetadataString ) ) return Error ( getParser ( ) . getTok ( )


<s> bool FoundEnd = false ; while ( ! getLexer ( ) . is ( AsmToken :: Eof ) ) { while ( getLexer ( ) . is ( AsmToken :: Space ) ) { YamlStream << getLexer ( ) . getTok ( ) . getString ( ) ; Lex ( ) ; } if ( getLexer ( ) . is ( AsmToken :: Identifier ) ) { StringRef ID = getLexer ( ) . getTok ( ) . getIdentifier ( ) ; if ( ID == AssemblerDirectiveEnd ) { Lex ( ) ; FoundEnd = true ; break ; } } YamlStream << Parser . parseStringToEndOfStatement ( ) << getContext ( ) . getAsmInfo ( ) -> getSeparatorString ( ) ; Parser . eatToEndOfStatement ( ) ; } getLexer ( ) . setSkipSpace ( true ) ; if ( getLexer ( ) . is ( AsmToken :: Eof ) && ! FoundEnd ) { return TokError ( Twine ( <STR_LIT> ) + Twine ( HSAMD :: AssemblerDirectiveEnd ) + Twine ( <STR_LIT> ) ) ; } YamlStream . flush ( ) ; if ( IsaInfo :: hasCodeObjectV3 ( & getSTI ( ) ) ) { if ( ! getTargetStreamer ( ) . EmitHSAMetadataV3 ( HSAMetadataString ) ) return Error ( getParser ( ) . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } else { if ( ! getTargetStreamer ( ) . EmitHSAMetadataV2 ( HSAMetadataString ) ) return Error ( getParser ( ) . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; } return


<s> if ( getLexer ( ) . isNot ( AsmToken :: LBrac ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Int ) || ! ( <NUM_LIT> <= Int && Int <= <NUM_LIT> ) ) return MatchOperand_ParseFail ; for ( int i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; int64_t Temp ; if ( getParser ( ) . parseAbsoluteExpression ( Temp ) || ! ( <NUM_LIT> <= Temp && Temp <= <NUM_LIT> ) ) return MatchOperand_ParseFail ; const int shift = i * <NUM_LIT> + <NUM_LIT> ; Int += ( Temp << shift ) ; } if ( getLexer ( ) . isNot ( AsmToken :: RBrac ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; } else { Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Int ) ) return MatchOperand_ParseFail ; if ( Prefix == <STR_LIT> && <NUM_LIT> <= Int && Int <= <NUM_LIT> ) { Int |= DppCtrl :: ROW_SHL0 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> <= Int && Int <= <NUM_LIT> ) { Int |= DppCtrl :: ROW_SHR0 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> <= Int && Int <= <NUM_LIT> ) { Int |= DppCtrl :: ROW_ROR0 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_SHL1 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_ROL1 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_SHR1 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_ROR1 ; } else if ( Prefix == <STR_LIT> ) { if ( Int == <NUM_LIT> ) { Int = DppCtrl :: BCAST15 ; } else if ( Int == <NUM_LIT> ) { Int = DppCtrl :: BCAST31 ; } else { return MatchOperand_ParseFail ; } } else { return


<s> Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Int ) || ! ( <NUM_LIT> <= Int && Int <= <NUM_LIT> ) ) return MatchOperand_ParseFail ; for ( int i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { if ( getLexer ( ) . isNot ( AsmToken :: Comma ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; int64_t Temp ; if ( getParser ( ) . parseAbsoluteExpression ( Temp ) || ! ( <NUM_LIT> <= Temp && Temp <= <NUM_LIT> ) ) return MatchOperand_ParseFail ; const int shift = i * <NUM_LIT> + <NUM_LIT> ; Int += ( Temp << shift ) ; } if ( getLexer ( ) . isNot ( AsmToken :: RBrac ) ) return MatchOperand_ParseFail ; Parser . Lex ( ) ; } else { Parser . Lex ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Int ) ) return MatchOperand_ParseFail ; if ( Prefix == <STR_LIT> && <NUM_LIT> <= Int && Int <= <NUM_LIT> ) { Int |= DppCtrl :: ROW_SHL0 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> <= Int && Int <= <NUM_LIT> ) { Int |= DppCtrl :: ROW_SHR0 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> <= Int && Int <= <NUM_LIT> ) { Int |= DppCtrl :: ROW_ROR0 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_SHL1 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_ROL1 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_SHR1 ; } else if ( Prefix == <STR_LIT> && <NUM_LIT> == Int ) { Int = DppCtrl :: WAVE_ROR1 ; } else if ( Prefix == <STR_LIT> ) { if ( Int == <NUM_LIT> ) { Int = DppCtrl :: BCAST15 ; } else if ( Int == <NUM_LIT> ) { Int = DppCtrl :: BCAST31 ; } else { return MatchOperand_ParseFail ; } } else


<s> } 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 :: ImmTyFORMAT ) { res = parseDfmtNfmt ( Operands ) ; } else { res = parseIntWithPrefix ( Op . Name , Operands , Op . Type , Op . ConvertResult ) ; } if ( res != MatchOperand_NoMatch ) { return


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


<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 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 ImmTyR128A16 : 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> 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


<s> void addBoolRegOperands ( MCInst & Inst ,


<s> void addKImmFP32Operands ( MCInst & Inst , unsigned N )


<s> void addKImmFP32Operands ( MCInst & Inst , unsigned


<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 ; } 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 ; } 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


<s> Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ( getReg ( ) , AsmParser -> getSTI ( )


<s> void <ISA_LIT>Operand :: addRegOperands ( MCInst & Inst , unsigned N


<s> void addRegOrImmWithInputModsOperands ( MCInst & Inst , unsigned N ) const { Modifiers Mods = getModifiers ( ) ; Inst . addOperand ( MCOperand :: createImm ( Mods . getModifiersOperand ( ) ) ) ; if ( isRegKind (


<s> assert ( ! hasFPModifiers ( ) ) ; addRegOrImmWithInputModsOperands ( Inst


<s> void addRegWithFPInputModsOperands ( MCInst & Inst , unsigned N ) const { assert ( ! hasIntModifiers ( ) ) ; addRegWithInputModsOperands ( Inst , N )


<s> Inst . addOperand ( MCOperand :: createImm ( Mods . getModifiersOperand ( ) ) ) ; assert ( isRegKind ( ) ) ; addRegOperands ( Inst


<s> void addRegWithIntInputModsOperands ( MCInst & Inst , unsigned N ) const { assert ( ! hasFPModifiers ( ) ) ; addRegWithInputModsOperands ( Inst


<s> void addRegWithIntInputModsOperands ( MCInst & Inst ,


<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> && isHsaAbiVersion3Or4 ( & 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


<s> assert ( isImmTy ( ImmTyNone ) && Imm . Mods . hasFPModifiers ( ) ) ; assert ( Size == <NUM_LIT> || Size == <NUM_LIT> || Size == <NUM_LIT> ) ; const uint64_t FpSignMask = ( <NUM_LIT> << ( Size * <NUM_LIT> - <NUM_LIT> ) ) ; if ( Imm . Mods .


<s> if ( Version . Major >= <NUM_LIT> && ! Features . test ( FeatureSGPRInitBug ) && NumSGPRs > MaxAddressableNumSGPRs ) return OutOfRangeError ( SGPRRange ) ; NumSGPRs += IsaInfo :: getNumExtraSGPRs ( & getSTI ( ) , 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 ( & getSTI ( ) , NumVGPRs , EnableWavefrontSize32 ) ; SGPRBlocks = IsaInfo :: getNumSGPRBlocks ( & getSTI ( ) , NumSGPRs ) ; return false


<s> APFloat :: opStatus Status = FPLiteral . convert ( * getFltSemantics ( VT ) , APFloat :: rmNearestTiesToEven , & Lost ) ; if ( Status != APFloat :: opOK && Lost && ( ( Status & APFloat :: opOverflow ) != <NUM_LIT> || ( Status & APFloat :: opUnderflow ) != <NUM_LIT> ) ) { return


<s> unsigned <ISA_LIT>AsmParser :: checkTargetMatchPredicate ( MCInst & Inst ) { uint64_t TSFlags = MII . get ( Inst . getOpcode ( ) ) . TSFlags ; if ( ( getForcedEncodingSize ( ) == <NUM_LIT> && ( TSFlags & <STR_LIT> ) ) || ( getForcedEncodingSize ( ) == <NUM_LIT> && ! ( TSFlags & <STR_LIT> ) ) || ( isForcedDPP ( ) && ! ( TSFlags & <STR_LIT> ) ) || ( isForcedSDWA ( ) && ! ( TSFlags & <STR_LIT> ) ) ) return Match_InvalidOperand ; if ( ( TSFlags & <STR_LIT> ) && ( TSFlags & <STR_LIT> ) && getForcedEncodingSize ( ) != <NUM_LIT> ) return Match_PreferE32 ; if ( Inst . getOpcode ( ) == <STR_LIT> || Inst . getOpcode ( ) == <STR_LIT> ) { auto OpNum = <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: dst_sel


<s> BoundCtrl = <NUM_LIT> ; return true ; } return


<s> Op -> Expr = Expr ; Op -> StartLoc = S ; Op -> EndLoc = S ; return


<s> Op -> Imm . Val = Val ; Op -> Imm . IsFPImm = IsFPImm ; Op -> Imm . Kind = ImmKindTyNone ; Op -> Imm . Type = Type ; Op -> Imm . Mods = Modifiers ( ) ; Op -> StartLoc = Loc ; Op -> EndLoc = Loc ; return Op


<s> auto Op = std :: make_unique < <ISA_LIT>Operand > ( Register , AsmParser ) ; Op -> Reg . RegNo = RegNo ; Op -> Reg . Mods = Modifiers ( ) ; Op -> StartLoc = S ; Op -> EndLoc = E ; return


<s> if ( Op . isReg ( ) && validateVccOperand ( Op . getReg ( ) ) ) { continue ; } if ( IsDPP8 ) { if ( Op . isDPP8 ( ) ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; } else if ( HasModifiers && isRegOrImmWithInputMods ( Desc , Inst . getNumOperands ( ) ) ) { Op . addRegWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isFI ( ) ) { Fi = Op . getImm ( ) ; } else if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; } else { llvm_unreachable ( <STR_LIT> ) ; } } else { if ( HasModifiers && isRegOrImmWithInputMods ( Desc , Inst . getNumOperands ( ) ) ) { Op . addRegWithFPInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isDPPCtrl (


<s> void cvtDPP8 ( MCInst & Inst , const OperandVector & Operands ) { cvtDPP ( Inst , Operands , true )


<s> void cvtDS ( MCInst & Inst , const OperandVector &


<s> <ISA_LIT>Operand :: ImmTy OffsetType = ( Inst . getOpcode ( ) == <STR_LIT> || Inst . getOpcode ( ) == <STR_LIT> || Inst . getOpcode ( ) == <STR_LIT> ) ? <ISA_LIT>Operand :: ImmTySwizzle : <ISA_LIT>Operand :: ImmTyOffset ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , OffsetType ) ; if ( ! IsGdsHardcoded ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx


<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 if ( ! Op . isToken ( ) ) { llvm_unreachable ( <STR_LIT> ) ; } } bool IsGFX10Plus =


<s> void <ISA_LIT>AsmParser :: cvtMIMGAtomic ( MCInst & Inst , const OperandVector & Operands ) { cvtMIMG ( Inst , Operands , true


<s> addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyFORMAT ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyCPol , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyTFE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySWZ


<s> if ( NewOpc != - <NUM_LIT> ) Inst . setOpcode ( NewOpc ) ; } IsAtomicReturn = MII . get ( Inst . getOpcode ( ) ) . TSFlags & <STR_LIT> ; } 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 ; } 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 =


<s> void cvtMubufLds ( MCInst & Inst , const OperandVector & Operands ) { cvtMubufImpl ( Inst , Operands ,


<s> void cvtMubufLds ( MCInst & Inst , const OperandVector & Operands


<s> SkippedVcc = true ; continue ; } else if ( BasicInstType == <STR_LIT> && Inst . getNumOperands ( ) == <NUM_LIT> ) { SkippedVcc = true ; continue ; } } if ( isRegOrImmWithInputMods ( Desc , Inst . getNumOperands ( ) ) ) { Op . addRegOrImmWithInputModsOperands ( Inst , <NUM_LIT> ) ; } else if ( Op . isImm ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> ) ; } SkippedVcc = false ; } if ( Inst . getOpcode ( ) != <STR_LIT> && Inst . getOpcode ( ) != <STR_LIT> && Inst . getOpcode ( ) != <STR_LIT> ) { switch ( BasicInstType ) { case <STR_LIT> : addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , <NUM_LIT> ) ; if ( <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: omod ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> , <NUM_LIT> ) ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstSel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstUnused , DstUnused :: UNUSED_PRESERVE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc0Sel , SdwaSel :: DWORD ) ; break ; case <STR_LIT> : addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , <NUM_LIT> ) ; if ( <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: omod ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> , <NUM_LIT> ) ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstSel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstUnused , DstUnused :: UNUSED_PRESERVE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc0Sel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc1Sel ,


<s> SkippedVcc = false ; } if ( Inst . getOpcode ( ) != <STR_LIT> && Inst . getOpcode ( ) != <STR_LIT> && Inst . getOpcode ( ) != <STR_LIT> ) { switch ( BasicInstType ) { case <STR_LIT> : addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , <NUM_LIT> ) ; if ( <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: omod ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> , <NUM_LIT> ) ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstSel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstUnused , DstUnused :: UNUSED_PRESERVE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc0Sel , SdwaSel :: DWORD ) ; break ; case <STR_LIT> : addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , <NUM_LIT> ) ; if ( <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: omod ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOMod<ISA_LIT> , <NUM_LIT> ) ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstSel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaDstUnused , DstUnused :: UNUSED_PRESERVE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc0Sel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc1Sel , SdwaSel :: DWORD ) ; break ; case <STR_LIT> : if ( <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: clamp ) != - <NUM_LIT> ) addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyClamp<ISA_LIT> , <NUM_LIT> ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc0Sel , SdwaSel :: DWORD ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTySdwaSrc1Sel , SdwaSel :: DWORD ) ; break ; default : llvm_unreachable ( <STR_LIT>


<s> void <ISA_LIT>AsmParser :: cvtSdwaVOP2 ( MCInst & Inst , const OperandVector & Operands ) { cvtSDWA ( Inst ,


<s> cvtSDWA ( Inst , Operands , <STR_LIT> , true


<s> void <ISA_LIT>AsmParser :: cvtSdwaVOP2b ( MCInst & Inst , const OperandVector &


<s> cvtSDWA ( Inst , Operands , <STR_LIT> , false ,


<s> void <ISA_LIT>AsmParser :: cvtSdwaVOPC ( MCInst & Inst , const OperandVector & Operands ) { cvtSDWA ( Inst , Operands , <STR_LIT> , isVI


<s> cvtVOP3 ( Inst , Operands , OptionalIdx


<s> 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 .


<s> SrcNum < <NUM_LIT> && <STR_LIT> ( Opc , Ops [ SrcNum ] ) != - <NUM_LIT> ; ++ SrcNum ) ; assert ( SrcNum > <NUM_LIT> ) ; int OpSelIdx = <STR_LIT> ( Opc , <STR_LIT> :: op_sel ) ; unsigned OpSel = Inst . getOperand ( OpSelIdx ) . getImm ( ) ; if ( ( OpSel & ( <NUM_LIT> <<


<s> void <ISA_LIT>AsmParser :: cvtVOP3P ( MCInst & Inst , const OperandVector & Operands ) { OptionalImmIndexMap OptIdx


<s> OptionalImmIndexMap OptIdx ; cvtVOP3 ( Inst , Operands ,


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


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


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


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


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


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


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

( ) , <ISA_LIT>Operand :: ImmTyDppFi ) ;


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


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


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


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


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

SMLoc ( ) , <ISA_LIT>Operand :: ImmTyOffset ) ;


<s> LLVM_READNONE static unsigned encodeBitmaskPerm ( const unsigned AndMask , const unsigned OrMask , const unsigned XorMask ) { using namespace llvm :: <STR_LIT> ; return BITMASK_PERM_ENC | ( AndMask << BITMASK_AND_SHIFT ) | (

OrMask << BITMASK_OR_SHIFT ) | ( XorMask << BITMASK_XOR_SHIFT ) ;


<s> if ( CntVal != decode ( ISA , IntVal ) ) { if ( Saturate ) { IntVal = encode ( ISA , IntVal , - <NUM_LIT> ) ; } else { Failed = true


<s> unsigned <ISA_LIT>AsmParser :: findImplicitSGPRReadInVOP ( const MCInst & Inst ) const { const MCInstrDesc & Desc = MII . get ( Inst . getOpcode ( ) ) ; const unsigned Num = Desc . getNumImplicitUses ( ) ; for ( unsigned i = <NUM_LIT> ; i < Num ; ++ i ) { unsigned Reg = Desc . ImplicitUses [ i ] ; switch ( Reg ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return Reg


<s> static const unsigned Variants [ ] = { <ISA_LIT>AsmVariants :: DEFAULT , <ISA_LIT>AsmVariants :: VOP3 , <ISA_LIT>AsmVariants :: SDWA ,

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


<s> SMLoc <ISA_LIT>AsmParser :: getConstLoc ( const OperandVector & Operands ) const { auto Test = [ ] ( const <ISA_LIT>Operand & Op ) { return Op . isImmKindConst ( )


<s> const FeatureBitset & getFeatureBits ( )


<s> static const fltSemantics * getFltSemantics


<s> return getFltSemantics ( VT . getSizeInBits ( )


<s> int64_t Operand = <NUM_LIT> ; Operand |= Abs ? <STR_LIT>


<s> SMLoc <ISA_LIT>AsmParser :: getImmLoc ( <ISA_LIT>Operand :: ImmTy Type , const OperandVector &


<s> auto Test = [ = ] ( const <ISA_LIT>Operand & Op ) { return Op . isImmTy ( Type ) ; } ; return getOperandLoc ( Test


<s> ImmTy getImmTy ( ) const { assert ( isImm


<s> int64_t getIntModifiersOperand ( ) const { int64_t Operand = <NUM_LIT> ; Operand |= Sext ? <STR_LIT>


<s> return Op . IsImmKindLiteral ( ) || Op . isExpr ( ) ; } ; return getOperandLoc ( Test


<s> if ( isForcedVOP3 ( ) ) return <STR_LIT> ; if ( isForcedSDWA ( ) ) return


<s> return const_cast < <ISA_LIT>AsmParser * > ( this ) -> getContext ( ) . getRegisterInfo


<s> for ( unsigned i = Operands . size ( ) - <NUM_LIT> ; i > <NUM_LIT> ; -- i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Test ( Op ) ) return Op . getStartLoc ( ) ; } return ( ( <ISA_LIT>Operand & ) * Operands [ <NUM_LIT> ] ) .


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : return & APFloat :: IEEEsingle ( ) ; case <STR_LIT> : 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> : case <STR_LIT> : case <STR_LIT> : case


<s> assert ( isRegKind ( ) ) ; return Reg .


<s> 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 <STR_LIT> ; case <NUM_LIT> : return <STR_LIT> ; } } return -


<s> SMLoc <ISA_LIT>AsmParser :: getRegLoc ( unsigned Reg , const OperandVector & Operands ) const { auto Test = [ = ] ( const <ISA_LIT>Operand & Op ) { return Op . isRegKind ( ) && Op . getReg ( ) == Reg ; } ; return getOperandLoc ( Test


<s> if ( RegNum % AlignSize != <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ; } unsigned RegIdx = RegNum / AlignSize ; int RCID = getRegClass ( RegKind , RegWidth ) ; if ( RCID == - <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ; } const MCRegisterInfo * TRI = getContext ( ) . getRegisterInfo ( ) ; const MCRegisterClass RC = TRI -> getRegClass ( RCID ) ; if ( RegIdx >= RC . getNumRegs ( ) ) { Error ( Loc , <STR_LIT>


<s> for ( const RegInfo & Reg : RegularRegisters ) if ( Str . startswith ( Reg .


<s> for ( unsigned i = <NUM_LIT> , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isSMEMOffset ( ) ) return Op . getStartLoc


<s> static unsigned getSpecialRegForName ( StringRef RegName ) { return StringSwitch < unsigned > ( RegName ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case (

<STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Case ( <STR_LIT> , <STR_LIT> ) . Default ( <STR_LIT> ) ;


<s> AsmToken :: TokenKind <ISA_LIT>AsmParser :: getTokenKind ( ) const { return getLexer ( )


<s> bool hasFPModifiers ( ) const { return getModifiers ( )


<s> bool hasIntClamp ( ) const { return getFeatureBits ( ) [ <STR_LIT>


<s> bool hasIntModifiers ( ) const { return getModifiers ( ) .


<s> bool hasInv2PiInlineImm ( ) const { return getFeatureBits ( ) [


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


<s> return getModifiers ( ) . hasModifiers


<s> bool hasSGPR102_SGPR103 ( ) const { return ! isVI ( ) && ! isGFX9


<s> return isImm ( ) && getImmTy ( ) == ImmTyABID && isUInt < <NUM_LIT> >


<s> bool <ISA_LIT>Operand :: isABID ( ) const { return isImm ( ) && getImmTy ( ) == ImmTyABID && isUInt < <NUM_LIT>


<s> bool isAddr64 ( ) const { return isImmTy ( ImmTyAddr64


<s> bool isAISrcB16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT>


<s> return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> bool isAISrcB32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> bool isAISrcF16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT> )


<s> bool isAISrcF32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> return isRegOrInlineNoMods ( <STR_LIT>


<s> bool isAISrc_128B16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> ,


<s> bool isAISrc_128V2F16 ( ) const { return isAISrc_128F16 ( ) ||


<s> bool isAISrc_256B64 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> bool isAISrc_256F64 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> ,


<s> bool isAISrc_512F32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT>


<s> return isAISrc_512F16 ( ) || isAISrc_512B32 (


<s> bool isAISrc_64F64 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


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


<s> return isImm ( ) && getImmTy ( ) == ImmTyBLGP && isUInt < <NUM_LIT> > ( getImm


<s> return isReg ( ) && ( ( FB [ <STR_LIT> ] && isSCSrcB64 ( ) ) || ( FB [ <STR_LIT> ]


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


<s> bool <ISA_LIT>Operand :: isCBSZ ( ) const { return isImm ( ) && getImmTy ( ) == ImmTyCBSZ && isUInt <


<s> return isImm ( ) && getImmTy ( ) == ImmTyCBSZ && isUInt < <NUM_LIT> > ( getImm (


<s> bool isDA ( ) const { return isImmTy ( ImmTyDA


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


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


<s> bool <ISA_LIT>Operand :: isEndpgm ( )


<s> bool <ISA_LIT>Operand :: isEndpgm ( ) const { return isImmTy ( ImmTyEndpgm


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


<s> bool isFI ( ) const { return isImmTy ( ImmTyDppFi


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


<s> return isImmTy ( ImmTyOffset ) || isImmTy


<s> return isImmTy ( ImmTyFORMAT ) && isUInt < <NUM_LIT> >


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


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


<s> bool isHigh ( ) const { return isImmTy ( ImmTyHigh


<s> bool <ISA_LIT>AsmParser :: isId ( const


<s> bool <ISA_LIT>AsmParser :: isId ( const StringRef Id )


<s> bool IsImmKindLiteral ( ) const { return isImm ( ) && Imm . Kind


<s> static bool isInlineableLiteralOp16 ( int64_t Val , MVT VT , bool HasInv2Pi ) { if ( VT . getScalarType ( ) ==


<s> return isInlinableIntLiteral ( Val ) ; } return <STR_LIT> ( Val , HasInv2Pi )


<s> return <STR_LIT> ( Val , hasInv2PiInlineImm ( ) ) ; case <NUM_LIT> : { const unsigned OperandType = Desc . OpInfo [ OpIdx ] . OperandType ; if ( OperandType == <STR_LIT> || OperandType == <STR_LIT> || OperandType == <STR_LIT> ) return <STR_LIT> ( Val ) ; if ( OperandType == <STR_LIT> || OperandType == <STR_LIT> || OperandType == <STR_LIT> ) return <STR_LIT> ( Val ) ; if ( OperandType == <STR_LIT> || OperandType == <STR_LIT> || OperandType == <STR_LIT> ) return <STR_LIT> ( Val , hasInv2PiInlineImm ( ) ) ; return <STR_LIT> ( Val , hasInv2PiInlineImm (


<s> return isRegKind ( ) && :: isInlineValue ( getReg ( )


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


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


<s> peekTokens ( NextToken ) ; return isOperandModifier ( Tok , NextToken [ <NUM_LIT> ] ) || ( Tok . is ( AsmToken :: Minus ) && isRegOrOperandModifier ( NextToken [ <NUM_LIT> ] , NextToken [

<NUM_LIT> ] ) ) || isOpcodeModifierWithVal ( Tok , NextToken [ <NUM_LIT> ] ) ;


<s> static bool IsMovrelsSDWAOpcode ( const unsigned Opcode ) { switch ( Opcode


<s> if ( Token . is ( AsmToken :: Identifier ) && NextToken . is ( AsmToken :: LParen ) ) { const auto & str = Token . getString ( ) ; return str == <STR_LIT> || str == <STR_LIT> || str


<s> return isRegKind ( ) && getReg ( ) ==


<s> bool isOffset ( ) const { return isImmTy ( ImmTyOffset ) && isUInt < <NUM_LIT> > ( getImm (


<s> return isImmTy ( ImmTyOffset0 ) && isUInt < <NUM_LIT> >


<s> return isImmTy ( ImmTyOffset1 ) && isUInt < <NUM_LIT>


<s> bool <ISA_LIT>AsmParser :: isOperandModifier ( const AsmToken & Token , const AsmToken & NextToken


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


<s> bool isReg ( ) const override { return isRegKind ( ) && !


<s> bool isReg ( ) const override { return isRegKind ( ) && ! hasModifiers


<s> return isRegKind ( ) && AsmParser -> getMRI ( ) -> getRegClass ( RCID


<s> bool <ISA_LIT>Operand :: isRegClass ( unsigned RCID ) const { return isRegKind ( ) && AsmParser -> getMRI ( ) -> getRegClass ( RCID ) .


<s> return isRegister ( getToken ( ) , peekToken


<s> bool isRegOrImmWithInt16InputMods ( ) const { return isRegOrImmWithInputMods ( <STR_LIT> , <STR_LIT>


<s> bool isRegOrImmWithInt16InputMods ( )


<s> return isRegOrImmWithInputMods ( <STR_LIT>


<s> return isRegOrImmWithInputMods ( <STR_LIT> , <STR_LIT>


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


<s> return ( isRegClass ( RCID ) || isInlinableImm ( type ) )


<s> return isRegister ( Token , NextToken ) || isOperandModifier


<s> return isRegister ( Token , NextToken ) || isOperandModifier (


<s> return Kind == IS_VGPR || Kind == IS_SGPR || Kind == IS_TTMP || Kind


<s> static bool isRegularReg ( RegisterKind Kind


<s> return isImm ( ) && ( isInt < <NUM_LIT> > ( getImm ( )

) || isUInt < <NUM_LIT> > ( getImm ( ) ) ) ;


<s> return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> return isRegOrInlineNoMods ( <STR_LIT>


<s> bool isSCSrcF32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> ,


<s> return isRegOrInlineNoMods ( <STR_LIT> ,


<s> llvm_unreachable ( <STR_LIT> ) ; return isSCSrcF32 ( )


<s> bool isSCSrcV2INT32 ( ) const { llvm_unreachable ( <STR_LIT> )


<s> bool <ISA_LIT>Operand :: isSDWAFP16Operand ( ) const { return isSDWAOperand (


<s> bool <ISA_LIT>Operand :: isSDWAFP32Operand ( ) const { return isSDWAOperand (


<s> bool <ISA_LIT>Operand :: isSDWAInt16Operand ( ) const { return isSDWAOperand (


<s> else if ( AsmParser -> isGFX9Plus ( ) ) return isRegClass ( <STR_LIT> ) ||


<s> bool isSDWASrc0Sel ( ) const { return isImmTy ( ImmTySdwaSrc0Sel )


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


<s> bool <ISA_LIT>Operand :: isSMEMOffset


<s> bool <ISA_LIT>Operand :: isSMRDOffset8 ( )


<s> bool <ISA_LIT>Operand :: isSMRDOffset8 ( ) const { return isImm ( ) && isUInt < <NUM_LIT> > ( getImm ( )


<s> return isSCSrcB32 ( ) || isLiteralImm ( <STR_LIT> ) || isExpr


<s> bool isSSrcF32 ( ) const { return isSCSrcB32 ( ) || isLiteralImm (


<s> bool isSSrcOrLdsB32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT> ) || isLiteralImm ( <STR_LIT> ) || isExpr


<s> bool isSSrcOrLdsB32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT> ) || isLiteralImm (


<s> bool isSSrcV2F16 ( ) const { llvm_unreachable ( <STR_LIT>


<s> bool isSSrcV2INT32 ( ) const { llvm_unreachable ( <STR_LIT>


<s> bool <ISA_LIT>Operand :: isSwizzle ( ) const { return isImmTy ( ImmTySwizzle )


<s> bool isSWZ ( ) const { return isImmTy ( ImmTySWZ


<s> return isExpr ( ) && Expr && isa < MCSymbolRefExpr >


<s> bool <ISA_LIT>AsmParser :: isToken ( const AsmToken :: TokenKind


<s> bool <ISA_LIT>Operand :: isU16Imm ( ) const { return isImm ( ) && isUInt < <NUM_LIT>


<s> return isRegOrInlineNoMods ( <STR_LIT>


<s> bool isVCSrcB16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT>


<s> bool isVCSrcB64 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> bool isVCSrcF16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> bool isVCSrcV2INT32 ( ) const { return isVCSrcB64 ( )


<s> bool isVISrcB32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> return isRegOrInlineNoMods ( <STR_LIT> ,


<s> bool isVISrcV2F16 ( ) const { return isVISrcF16 ( ) || isVISrcB32


<s> bool isVISrc_1024B16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT>


<s> bool isVISrc_1024B16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> ,


<s> bool isVISrc_128B32 ( ) const { return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT>


<s> bool isVISrc_128F16 ( ) const { return isRegOrInlineNoMods ( <STR_LIT>


<s> return isVISrc_128F16 ( ) || isVISrc_128B32


<s> bool isVISrc_256B64 ( ) const { return isRegOrInlineNoMods ( <STR_LIT>


<s> bool isVISrc_512V2B16 ( ) const { return isVISrc_512B16 (


<s> bool isVISrc_512V2F16 ( ) const { return isVISrc_512F16 ( ) || isVISrc_512B32 (


<s> return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT> )


<s> return isRegOrInlineNoMods ( <STR_LIT>


<s> return isRegClass ( <STR_LIT> ) || isRegClass ( <STR_LIT> ) || isRegClass ( <STR_LIT> ) || isRegClass ( <STR_LIT> ) || isRegClass ( <STR_LIT> ) || isRegClass

( <STR_LIT> ) || isRegClass ( <STR_LIT> ) || isRegClass ( <STR_LIT> ) || isRegClass ( <STR_LIT> ) ;


<s> bool isVReg32 ( ) const { return isRegClass ( <STR_LIT> )


<s> bool isVSrcB32 ( ) const { return isVCSrcF32 ( ) || isLiteralImm ( <STR_LIT>


<s> return isVCSrcF32 ( ) || isLiteralImm ( <STR_LIT>


<s> return isVCSrcF64 ( ) || isLiteralImm ( <STR_LIT>


<s> bool isVSrcV2B16 ( ) const { return isVSrcB16 ( ) || isLiteralImm (


<s> return isVSrcF16 ( ) || isLiteralImm (


<s> bool isVSrcV2FP32 ( ) const { return isVSrcF64 ( ) || isLiteralImm (


<s> bool isVSrcV2INT32 ( ) const { return isVSrcB64 ( ) || isLiteralImm (


<s> void <ISA_LIT>AsmParser :: lex ( ) { Parser . Lex (


<s> } Format = getNfmt ( FormatStr , getSTI ( ) ) ; if ( Format != NFMT_UNDEF ) { Nfmt = Format ; return true ; } Error ( Loc , <STR_LIT>


<s> using namespace llvm :: <STR_LIT> ; int64_t Format ; Format = getDfmt ( FormatStr ) ; if ( Format != DFMT_UNDEF ) { Dfmt = Format ; return true ; } Format = getNfmt ( FormatStr , getSTI ( )


<s> if ( ! getTargetStreamer ( ) . getTargetID ( ) ) getTargetStreamer ( ) . initializeTargetID ( getSTI ( ) , getSTI ( ) . getFeatureString ( ) ) ; if ( isHsaAbiVersion3Or4 ( & getSTI ( ) ) ) getTargetStreamer ( )


<s> return Error ( Range . Start , <STR_LIT>


<s> SmallVector < AsmToken , <NUM_LIT> > Tokens ; if ( Parse<ISA_LIT>Register ( RegKind , Reg , RegNum , RegWidth , Tokens ) ) { if ( RestoreOnFailure ) { while ( ! Tokens . empty ( ) ) { getLexer ( ) . UnLex ( Tokens . pop_back_val ( ) ) ; } } return true


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseBoolReg ( OperandVector & Operands ) { return parseReg ( Operands


<s> int64_t CntVal ; SMLoc ValLoc = getLoc ( ) ; if ( ! parseExpr ( CntVal ) ) return false ; <STR_LIT> ISA = <STR_LIT> ( getSTI ( ) . getCPU ( ) ) ; bool Failed = true ; bool Sat = CntName . endswith ( <STR_LIT> ) ; if ( CntName == <STR_LIT> || CntName == <STR_LIT> ) { Failed = encodeCnt ( ISA , IntVal , CntVal , Sat , encodeVmcnt , decodeVmcnt ) ; } else if ( CntName == <STR_LIT> || CntName == <STR_LIT> ) { Failed = encodeCnt ( ISA , IntVal , CntVal , Sat ,


<s> bool Failed = true ; bool Sat = CntName . endswith ( <STR_LIT> ) ; if ( CntName == <STR_LIT> || CntName == <STR_LIT> ) { Failed = encodeCnt ( ISA , IntVal , CntVal , Sat , encodeVmcnt , decodeVmcnt ) ; } else if ( CntName == <STR_LIT> || CntName == <STR_LIT> ) { Failed = encodeCnt ( ISA , IntVal , CntVal , Sat , encodeExpcnt , decodeExpcnt ) ; } else if ( CntName == <STR_LIT> || CntName == <STR_LIT> ) { Failed = encodeCnt ( ISA , IntVal , CntVal , Sat , encodeLgkmcnt , decodeLgkmcnt ) ; }


<s> 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


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseDim ( OperandVector & Operands ) { if ( ! isGFX10Plus ( ) ) return MatchOperand_NoMatch ; SMLoc S = getLoc ( ) ; if ( ! trySkipId ( <STR_LIT> , AsmToken :: Colon ) ) return MatchOperand_NoMatch ; unsigned Encoding ; SMLoc Loc = getLoc ( ) ; if ( ! parseDimId ( Encoding ) ) { Error ( Loc , <STR_LIT> ) ; return MatchOperand_ParseFail


<s> Token = std :: string ( getTokenStr ( ) ) ; lex ( ) ; if ( getLoc ( ) != Loc ) return false ; } StringRef Suffix ; if ( ! parseId ( Suffix ) ) return false ; Token += Suffix


<s> bool <ISA_LIT>AsmParser :: ParseDirective ( AsmToken DirectiveID ) { StringRef IDVal = DirectiveID . getString ( ) ; if ( isHsaAbiVersion3Or4 ( & getSTI ( ) ) ) { 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


<s> 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 ( ) ; if ( IDVal == <STR_LIT> :: AssemblerDirectiveBegin ) return ParseDirectiveHSAMetadata ( ) ; } if ( IDVal == <STR_LIT> ) return ParseDirectiveAMDGCNTarget ( ) ; if ( IDVal == <STR_LIT> ) return ParseDirective<ISA_LIT>LDS ( ) ; if ( IDVal == PALMD :: AssemblerDirectiveBegin ) return ParseDirectivePALMetadataBegin ( ) ; if ( IDVal == PALMD :: AssemblerDirective ) return ParseDirectivePALMetadata ( ) ; return true


<s> if ( getTargetStreamer ( ) . getTargetID ( ) -> toString ( ) != TargetIDDirective ) return getParser ( ) . Error ( TargetRange . Start , ( Twine ( <STR_LIT> ) + Twine ( TargetIDDirective ) + Twine ( <STR_LIT> ) + Twine ( getTargetStreamer (

) . getTargetID ( ) -> toString ( ) ) ) . str ( ) ) ;


<s> StringRef KernelName ; if ( ! parseId ( KernelName , <STR_LIT> ) ) return true ; getTargetStreamer ( ) . Emit<ISA_LIT>SymbolType ( KernelName , ELF :: STT_<ISA_LIT>_HSA_KERNEL ) ; KernelScope . initialize ( getContext (


<s> if ( getParser ( ) . checkForValidSection ( ) ) return true ; StringRef Name ; SMLoc NameLoc = getLoc ( ) ; if ( getParser ( ) . parseIdentifier ( Name ) ) return TokError ( <STR_LIT> ) ; MCSymbol * Symbol = getContext ( ) . getOrCreateSymbol ( Name ) ; if ( parseToken ( AsmToken :: Comma , <STR_LIT> ) ) return true ; unsigned LocalMemorySize = <STR_LIT> :: getLocalMemorySize ( & getSTI ( ) ) ; int64_t


<s> bool <ISA_LIT>AsmParser :: ParseDirectiveAMDKernelCodeT ( ) { amd_kernel_code_t Header ; <STR_LIT> ( Header , & getSTI ( ) ) ; while ( true ) { while ( trySkipToken ( AsmToken :: EndOfStatement ) ) ; StringRef ID ; if ( ! parseId ( ID , <STR_LIT> ) ) return true ; if ( ID == <STR_LIT> ) break ; if ( ParseAMDKernelCodeTValue ( ID ,


<s> if ( ! trySkipToken ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; 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> ) ) return true ; getTargetStreamer ( ) . EmitDirectiveHSACodeObjectISAV2 ( Major ,

Minor , Stepping , VendorName , ArchName ) ;


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


<s> if ( getSTI ( ) . getTargetTriple ( ) . getArch ( ) != Triple :: amdgcn ) { return Error ( getLoc ( ) , <STR_LIT> <STR_LIT> ) ; } auto TargetIDDirective = getLexer ( ) . getTok ( ) . getStringContents ( ) ; if ( getTargetStreamer ( ) . getTargetID ( ) -> toString ( ) != TargetIDDirective ) return Error ( getParser ( ) . getTok ( ) . getLoc ( ) , <STR_LIT> ) ; getTargetStreamer ( ) . EmitISAVersion ( ) ; Lex ( ) ; return false


<s> if ( ! trySkipToken ( AsmToken :: Comma ) ) return TokError ( <STR_LIT> ) ; if ( ParseAsAbsoluteExpression ( Minor ) ) return TokError


<s> if ( getSTI ( ) . getTargetTriple ( ) . getOS ( ) != Triple :: AMDPAL ) { return Error ( getLoc ( ) , ( Twine ( PALMD :: AssemblerDirective ) + Twine ( <STR_LIT> <STR_LIT> ) ) . str ( ) ) ; } auto PALMetadata = getTargetStreamer ( ) . getPALMetadata ( ) ; PALMetadata -> setLegacy ( ) ; for ( ; ; ) { uint32_t Key , Value ; if ( ParseAsAbsoluteExpression ( Key ) ) { return TokError ( Twine ( <STR_LIT> ) + Twine ( PALMD ::


<s> return TokError ( Twine ( <STR_LIT> ) + Twine ( PALMD :: AssemblerDirective ) ) ; } if ( ! trySkipToken ( AsmToken :: Comma ) ) { return TokError ( Twine ( <STR_LIT> ) + Twine ( PALMD :: AssemblerDirective ) ) ; } if ( ParseAsAbsoluteExpression ( Value ) ) { return TokError ( Twine ( <STR_LIT> ) + Twine ( PALMD :: AssemblerDirective ) ) ; } PALMetadata -> setRegister ( Key , Value ) ; if ( ! trySkipToken ( AsmToken ::


<s> if ( ! PALMetadata -> setFromString ( String ) ) return Error ( getLoc ( ) , <STR_LIT> ) ; return


<s> using namespace <STR_LIT> ; if ( ! isToken ( AsmToken :: Identifier ) || ! isSupportedDPPCtrl ( getTokenStr ( ) , Operands ) ) return MatchOperand_NoMatch ; SMLoc S = getLoc ( ) ; int64_t Val = - <NUM_LIT> ; StringRef Ctrl ; parseId ( Ctrl ) ; if ( Ctrl == <STR_LIT> ) { Val = DppCtrl :: ROW_MIRROR ; } else if ( Ctrl == <STR_LIT> ) { Val = DppCtrl :: ROW_HALF_MIRROR ; } else { if ( skipToken ( AsmToken ::


<s> if ( getParser ( ) . parseAbsoluteExpression ( Temp ) ) return - <NUM_LIT> ; if ( Temp < <NUM_LIT> || Temp > <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return - <NUM_LIT> ; } Val += ( Temp << i * <NUM_LIT> ) ; } if ( ! skipToken ( AsmToken :: RBrac , <STR_LIT> ) ) return - <NUM_LIT> ; return


<s> if ( getParser ( ) . parseAbsoluteExpression ( Val ) ) return - <NUM_LIT> ; struct DppCtrlCheck { int64_t Ctrl ; int Lo ; int Hi ; } ; 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> } ) . Case ( <STR_LIT> , { DppCtrl :: ROW_NEWBCAST_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 { Valid = Check . Lo <= Val && Val <= Check . Hi ; Val = ( Check . Lo == Check . Hi ) ? Check . Ctrl : ( Check . Ctrl | Val ) ; } if ( ! Valid ) { Error ( Loc , Twine ( <STR_LIT> , Ctrl ) + Twine ( <STR_LIT> ) ) ; return -


<s> SMLoc S = getLoc ( ) ; const MCExpr * Expr ; if ( Parser . parseExpression ( Expr ) ) return false ; int64_t


<s> if ( ! parseId ( Str ) ) return MatchOperand_NoMatch ; unsigned Id = getTgtId ( Str ) ; if ( Id == ET_INVALID || ! isSupportedTgtId (


<s> SMLoc Loc = getLoc ( ) ; Res = isGFX10Plus ( ) ? 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 :: EndOfStatement ) ) { return MatchOperand_Success ; } Res = parseRegOrImm ( Operands ) ; if ( Res != MatchOperand_Success ) return Res ; trySkipToken ( AsmToken :: Comma ) ; if ( ! FormatFound ) { Res = parseSymbolicOrNumericFormat ( Format ) ; if ( Res == MatchOperand_ParseFail ) return Res ; if ( Res == MatchOperand_Success ) { auto Size = Operands . size


<s> while ( true ) { unsigned Mode = <NUM_LIT> ; SMLoc S = getLoc ( ) ; for ( unsigned ModeId = ID_MIN ; ModeId <= ID_MAX ; ++ ModeId ) { if ( trySkipId ( IdSymbolic [ ModeId ] ) ) { Mode = <NUM_LIT> << ModeId ; break ; } } if ( Mode == <NUM_LIT> ) { Error ( S , ( Imm == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ) ; return UNDEF


<s> int64_t <ISA_LIT>AsmParser :: parseGPRIdxMacro ( ) { using namespace llvm :: <STR_LIT> ; if ( trySkipToken ( AsmToken :: RParen ) ) { return OFF ; } int64_t Imm = <NUM_LIT> ; while ( true ) { unsigned Mode = <NUM_LIT> ; SMLoc S = getLoc ( ) ; for ( unsigned ModeId = ID_MIN ; ModeId <= ID_MAX ; ++ ModeId ) { if ( trySkipId ( IdSymbolic [ ModeId ] ) ) { Mode = <NUM_LIT> << ModeId ; break ; } } if ( Mode == <NUM_LIT> ) { Error ( S , ( Imm == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ) ; return UNDEF ; } if ( Imm & Mode ) { Error ( S , <STR_LIT> ) ; return UNDEF ; } Imm |= Mode ; if ( trySkipToken ( AsmToken :: RParen )


<s> int64_t ImmVal = <NUM_LIT> ; SMLoc Loc = getLoc ( ) ; if ( trySkipId ( <STR_LIT> , AsmToken :: LParen ) ) { OperandInfoTy HwReg ( ID_UNKNOWN_ ) ; OperandInfoTy Offset ( OFFSET_DEFAULT_ ) ; OperandInfoTy Width ( WIDTH_DEFAULT_ ) ; if ( parseHwregBody ( HwReg , Offset , Width ) && validateHwreg ( HwReg , Offset , Width ) ) { ImmVal = encodeHwreg ( HwReg . Id ,


<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 (


<s> lex ( ) ; } else if ( ! parseExpr ( HwReg . Id , <STR_LIT> ) ) { return false ; } if ( trySkipToken ( AsmToken :: RParen ) ) return true ; if ( ! skipToken ( AsmToken :: Comma , <STR_LIT> ) ) return false ; Offset . Loc = getLoc


<s> if ( isToken ( AsmToken :: Identifier ) ) { Val = getTokenStr ( ) ; lex ( ) ; return true ; } else { if ( ! ErrMsg . empty ( ) ) Error ( getLoc ( )


<s> assert ( ! isRegister ( ) ) ; assert ( ! isModifier ( ) ) ; const auto & Tok = getToken ( ) ; const auto & NextTok = peekToken ( ) ; bool IsReal = Tok . is ( AsmToken :: Real ) ; SMLoc S = getLoc ( ) ; bool Negate = false ; if ( ! IsReal && Tok . is ( AsmToken :: Minus ) && NextTok . is ( AsmToken :: Real ) ) { lex ( ) ; IsReal = true ; Negate = true ; } if ( IsReal ) { StringRef Num = getTokenStr ( ) ; lex ( ) ; APFloat RealVal ( APFloat :: IEEEdouble ( ) ) ; auto roundMode = APFloat :: rmNearestTiesToEven ; if ( errorToBool ( RealVal . convertFromString ( Num , roundMode ) . takeError ( ) ) ) { return MatchOperand_ParseFail ; } if ( Negate ) RealVal . changeSign ( ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , RealVal . bitcastToAPInt ( ) . getZExtValue ( ) , S , <ISA_LIT>Operand :: ImmTyNone , true ) ) ; return MatchOperand_Success ; } else { int64_t


<s> 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 ) ; } while ( ! trySkipToken ( AsmToken :: EndOfStatement ) ) { lex ( ) ; } return true ; } trySkipToken ( AsmToken ::


<s> if ( AttrChan == - <NUM_LIT> ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } Str = Str . drop_back ( <NUM_LIT> ) . drop_front ( <NUM_LIT> ) ; uint8_t Attr ; if ( Str . getAsInteger ( <NUM_LIT> , Attr ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( Attr > <NUM_LIT> ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } SMLoc SChan = SMLoc :: getFromPointer ( Chan . data ( ) ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Attr , S , <ISA_LIT>Operand :: ImmTyInterpAttr ) ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , AttrChan , SChan , <ISA_LIT>Operand :: ImmTyAttrChan ) ) ; return MatchOperand_Success


<s> if ( Slot == - <NUM_LIT> ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Slot , S , <ISA_LIT>Operand :: ImmTyInterpSlot ) ) ; return MatchOperand_Success


<s> if ( Name . endswith ( <STR_LIT> ) ) { setForcedEncodingSize ( <NUM_LIT> ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } else if ( Name . endswith ( <STR_LIT> ) ) { setForcedEncodingSize ( <NUM_LIT> ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } else if ( Name . endswith ( <STR_LIT> ) ) { setForcedDPP ( true ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } else if ( Name .


<s> setForcedEncodingSize ( <NUM_LIT> ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } else if ( Name . endswith ( <STR_LIT> ) ) { setForcedEncodingSize ( <NUM_LIT> ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } else if ( Name . endswith ( <STR_LIT> ) ) { setForcedDPP ( true ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } else if ( Name . endswith ( <STR_LIT> ) ) { setForcedSDWA ( true ) ; return Name . substr ( <NUM_LIT> , Name . size ( ) - <NUM_LIT> ) ; } return Name


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseNamedBit ( StringRef Name , OperandVector & Operands , <ISA_LIT>Operand :: ImmTy ImmTy ) { int64_t Bit ; SMLoc S = getLoc ( ) ; if ( trySkipId ( Name ) ) { Bit = <NUM_LIT> ; } else if ( trySkipId ( <STR_LIT> , Name ) ) { Bit = <NUM_LIT> ; }


<s> Bit = <NUM_LIT> ; } else if ( trySkipId ( <STR_LIT> , Name ) ) { Bit = <NUM_LIT> ; } else { return MatchOperand_NoMatch ; } if ( Name == <STR_LIT> && ! hasMIMG_R128 ( ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( Name == <STR_LIT> && ! isGFX9 ( ) && ! hasGFX10A16 ( ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( isGFX9 ( ) && ImmTy == <ISA_LIT>Operand :: ImmTyA16 ) ImmTy = <ISA_LIT>Operand :: ImmTyR128A16 ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Bit , S ,


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseNumericFormat ( int64_t & Format ) { using namespace llvm :: <STR_LIT> ; SMLoc Loc = getLoc ( ) ; if ( ! parseExpr ( Format ) ) return MatchOperand_ParseFail ; if ( ! isValidFormatEncoding ( Format , getSTI ( ) ) ) { Error ( Loc , <STR_LIT> ) ; return


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseNumericFormat ( int64_t & Format ) { using namespace llvm :: <STR_LIT> ; SMLoc Loc = getLoc ( ) ; if ( ! parseExpr ( Format ) ) return MatchOperand_ParseFail ; if ( ! isValidFormatEncoding ( Format , getSTI ( ) )


<s> } if ( Name == <STR_LIT> ) { return parseIntWithPrefix ( <STR_LIT> , Operands , <ISA_LIT>Operand

:: ImmTyOMod<ISA_LIT> , ConvertOmodDiv ) ;


<s> SMLoc RBraceLoc ; SMLoc LBraceLoc = getLoc ( ) ; if ( Mode == OperandMode_NSA && trySkipToken ( AsmToken :: LBrac ) ) { unsigned Prefix = Operands . size ( ) ; for ( ; ; ) { auto Loc = getLoc ( ) ; ResTy = parseReg ( Operands ) ; if ( ResTy == MatchOperand_NoMatch ) Error ( Loc , <STR_LIT> ) ; if ( ResTy != MatchOperand_Success ) return MatchOperand_ParseFail ; RBraceLoc = getLoc ( ) ; if ( trySkipToken ( AsmToken :: RBrac ) ) break ; if ( ! skipToken ( AsmToken :: Comma , <STR_LIT> ) ) { return MatchOperand_ParseFail


<s> for ( unsigned i = <NUM_LIT> ; i < MAX_OPR_LOOKAHEAD ; ++ i ) { if ( res != MatchOperand_Success || isToken ( AsmToken :: EndOfStatement ) ) break ; trySkipToken ( AsmToken :: Comma ) ; res = parseOptionalOpr ( Operands ) ; } return


<s> 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


<s> if ( auto R = parseRegister ( ) ) { assert ( R -> isReg ( ) ) ; Operands . push_back ( std :: move ( R ) ) ; return MatchOperand_Success ; } return MatchOperand_ParseFail


<s> assert ( R -> isReg ( ) ) ; Operands . push_back ( std :: move ( R ) ) ; return MatchOperand_Success ; } return MatchOperand_ParseFail


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


<s> OperandMatchResultTy Res ; if ( AllowImm ) { Res = parseRegOrImm ( Operands , SP3Abs ) ; } else { Res = parseReg ( Operands ) ; } if ( Res != MatchOperand_Success ) { return ( SP3Neg || Neg || SP3Abs || Abs ) ? MatchOperand_ParseFail : Res ; } if ( SP3Abs && ! skipToken ( AsmToken :: Pipe , <STR_LIT> ) ) return MatchOperand_ParseFail ; if ( Abs && ! skipToken ( AsmToken :: RParen , <STR_LIT> ) ) return MatchOperand_ParseFail ; if ( Neg && ! skipToken ( AsmToken :: RParen , <STR_LIT> ) ) return MatchOperand_ParseFail ; <ISA_LIT>Operand :: Modifiers Mods ; Mods . Abs = Abs


<s> if ( Neg && SP3Neg ) { Error ( Loc , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( Neg && ! skipToken ( AsmToken :: LParen , <STR_LIT> ) ) return MatchOperand_ParseFail ; Abs = trySkipId ( <STR_LIT> ) ; if ( Abs && ! skipToken ( AsmToken :: LParen , <STR_LIT> ) ) return MatchOperand_ParseFail ; Loc = getLoc ( ) ; SP3Abs = trySkipToken ( AsmToken :: Pipe ) ; if ( Abs && SP3Abs ) { Error ( Loc , <STR_LIT> ) ; return MatchOperand_ParseFail ; } OperandMatchResultTy Res ; if ( AllowImm ) { Res = parseRegOrImm ( Operands , SP3Abs ) ; } else { Res = parseReg ( Operands ) ; } if ( Res != MatchOperand_Success ) { return ( SP3Neg || Neg || SP3Abs || Abs ) ? MatchOperand_ParseFail : Res ; } if ( SP3Abs && ! skipToken ( AsmToken :: Pipe , <STR_LIT> ) ) return MatchOperand_ParseFail ; if ( Abs && ! skipToken ( AsmToken :: RParen , <STR_LIT> ) ) return MatchOperand_ParseFail ; if ( Neg && ! skipToken ( AsmToken :: RParen , <STR_LIT> ) ) return MatchOperand_ParseFail ; <ISA_LIT>Operand :: Modifiers Mods ; Mods . Abs = Abs || SP3Abs ; Mods . Neg =


<s> 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> > (


<s> StringRef RegSuffix = RegName . substr ( RI -> Name . size ( ) ) ; if ( ! RegSuffix . empty ( ) ) { if ( ! getRegNum ( RegSuffix , RegNum ) ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ; } RegWidth = <NUM_LIT> ; } else { if ( ! ParseRegRange ( RegNum , RegWidth ) ) return


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseRegWithFPInputMods ( OperandVector & Operands ) { return parseRegOrImmWithFPInputMods ( Operands ,


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseRegWithFPInputMods ( OperandVector & Operands ) { return parseRegOrImmWithFPInputMods ( Operands , false )


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseRegWithIntInputMods ( OperandVector & Operands ) { return parseRegOrImmWithIntInputMods ( Operands , false


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseRegWithIntInputMods ( OperandVector


<s> if ( res != MatchOperand_Success ) { return res ; } int64_t Int ; Int = StringSwitch < int64_t > ( Value ) . Case ( <STR_LIT> , DstUnused :: UNUSED_PAD ) . Case ( <STR_LIT> , DstUnused :: UNUSED_SEXT ) . Case ( <STR_LIT> , DstUnused :: UNUSED_PRESERVE ) . Default ( <NUM_LIT> ) ; if ( Int == <NUM_LIT> ) { Error ( StringLoc , <STR_LIT> ) ; return MatchOperand_ParseFail ; } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Int ,

S , <ISA_LIT>Operand :: ImmTySdwaDstUnused ) ) ;


<s> SMLoc S = getLoc ( ) ; StringRef Value ; OperandMatchResultTy res ; SMLoc StringLoc ; res = parseStringWithPrefix ( Prefix , Value , StringLoc ) ; if ( res != MatchOperand_Success ) { return res ; } int64_t Int ; Int = StringSwitch < int64_t > ( Value ) . Case ( <STR_LIT> , SdwaSel :: BYTE_0 ) . Case ( <STR_LIT> , SdwaSel :: BYTE_1 ) . Case ( <STR_LIT> , SdwaSel :: BYTE_2 ) . Case ( <STR_LIT> , SdwaSel :: BYTE_3 ) . Case ( <STR_LIT> , SdwaSel :: WORD_0 ) . Case ( <STR_LIT> , SdwaSel :: WORD_1 ) . Case ( <STR_LIT> , SdwaSel :: DWORD ) . Default ( <NUM_LIT> ) ; if ( Int == <NUM_LIT>


<s> Msg . Loc = getLoc ( ) ; if ( isToken ( AsmToken :: Identifier ) && ( Msg . Id = getMsgId ( getTokenStr ( ) ) ) >= <NUM_LIT> ) { Msg . IsSymbolic = true ; lex ( ) ; } 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 ( ) ) ) >= <NUM_LIT> ) {


<s> int64_t ImmVal = <NUM_LIT> ; SMLoc Loc = getLoc ( ) ; if ( trySkipId ( <STR_LIT> , AsmToken :: LParen ) ) { OperandInfoTy Msg ( ID_UNKNOWN_ ) ; OperandInfoTy Op ( OP_NONE_ ) ; OperandInfoTy Stream ( STREAM_ID_NONE_ ) ; if ( parseSendMsgBody ( Msg , Op , Stream ) && validateSendMsg ( Msg , Op , Stream ) ) { ImmVal = encodeMsg ( Msg . Id , Op . Id ,


<s> if ( Opr . isExpr ( ) && ! Opr . isSymbolRefExpr ( ) ) { Error ( Loc , <STR_LIT> ) ; } else if ( Opr . isImm ( ) && ! Opr . isS16Imm ( ) ) { Error ( Loc , <STR_LIT> ) ; } return


<s> peekTokens ( NextToken ) ; if ( isToken ( AsmToken :: Minus ) && ( isRegister ( NextToken [ <NUM_LIT> ] , NextToken [ <NUM_LIT> ] ) || NextToken [ <NUM_LIT> ] . is (

AsmToken :: Pipe ) || isId ( NextToken [ <NUM_LIT> ] , <STR_LIT> ) ) ) {


<s> if ( isToken ( AsmToken :: Minus ) && ( isRegister ( NextToken [ <NUM_LIT> ] , NextToken [ <NUM_LIT> ] ) || NextToken [ <NUM_LIT> ] . is ( AsmToken :: Pipe ) || isId ( NextToken [ <NUM_LIT> ] , <STR_LIT> ) ) ) { lex ( ) ; return


<s> unsigned <ISA_LIT>AsmParser :: ParseSpecialReg ( RegisterKind & RegKind , unsigned & RegNum , unsigned & RegWidth , SmallVectorImpl < AsmToken > & Tokens ) { assert ( isToken ( AsmToken :: Identifier ) ) ; unsigned Reg = getSpecialRegForName ( getTokenStr ( ) ) ; if ( Reg


<s> } if ( Ctl . size ( ) != BITMASK_WIDTH ) { Error ( StrLoc , <STR_LIT> ) ; return false ; } unsigned AndMask = <NUM_LIT> ; unsigned OrMask = <NUM_LIT> ; unsigned XorMask = <NUM_LIT> ; for ( size_t i = <NUM_LIT> ; i < Ctl . size ( ) ; ++ i ) { unsigned Mask = <NUM_LIT> << ( BITMASK_WIDTH - <NUM_LIT> - i ) ; switch ( Ctl [ i ] ) { default : Error ( StrLoc , <STR_LIT> ) ; return false ; case '0' : break ; case '1' : OrMask |= Mask


<s> bool <ISA_LIT>AsmParser :: parseSwizzleOffset ( int64_t & Imm ) { SMLoc OffsetLoc = getLoc ( ) ; if ( ! parseExpr ( Imm , <STR_LIT> ) ) { return false ; } if ( ! isUInt < <NUM_LIT> > ( Imm ) ) { Error ( OffsetLoc


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


<s> Ok = parseSwizzleOffset ( Imm ) ; } } Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , Imm , S , <ISA_LIT>Operand :: ImmTySwizzle ) ) ; return Ok ? MatchOperand_Success


<s> if ( ! skipToken ( AsmToken :: Comma , <STR_LIT> ) ) { return false ; } Loc = getLoc ( ) ; if ( ! parseExpr ( Op ) ) { return false ; } if ( Op < MinVal


<s> SMLoc Loc ; for ( unsigned i = <NUM_LIT> ; i < OpNum ; ++ i ) { if ( ! parseSwizzleOperand ( Op [ i ] , MinVal , MaxVal , ErrMsg


<s> if ( ! parseSwizzleOperand ( Op [ i ] , MinVal , MaxVal , ErrMsg


<s> using namespace llvm :: <STR_LIT> ; int64_t Lane [ LANE_NUM ] ; if ( parseSwizzleOperands ( LANE_NUM , Lane , <NUM_LIT> , LANE_MAX , <STR_LIT> ) ) { Imm =


<s> using namespace llvm :: <STR_LIT> ; SMLoc Loc ; int64_t GroupSize ; if ( ! parseSwizzleOperand ( GroupSize , <NUM_LIT> , <NUM_LIT> , <STR_LIT> , Loc ) ) { return false ; } if ( ! isPowerOf2_64 ( GroupSize ) ) { Error ( Loc , <STR_LIT> ) ; return false


<s> } if ( ! isPowerOf2_64 ( GroupSize ) ) { Error ( Loc , <STR_LIT> ) ; return false ; } Imm = encodeBitmaskPerm ( BITMASK_MAX , <NUM_LIT> ,


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseSymbolicOrNumericFormat ( int64_t & Format ) { using namespace llvm :: <STR_LIT> ; if ( ! trySkipId ( <STR_LIT> , AsmToken :: Colon ) ) return MatchOperand_NoMatch ; if ( trySkipToken ( AsmToken :: LBrac ) ) { StringRef FormatStr ; SMLoc Loc = getLoc ( ) ; if ( ! parseId ( FormatStr , <STR_LIT> ) ) return MatchOperand_ParseFail ; auto Res = parseSymbolicUnifiedFormat ( FormatStr , Loc , Format ) ; if ( Res == MatchOperand_NoMatch ) Res = parseSymbolicSplitFormat ( FormatStr , Loc , Format ) ; if ( Res != MatchOperand_Success ) return Res ; if ( ! skipToken ( AsmToken :: RBrac , <STR_LIT> ) ) return MatchOperand_ParseFail ; return


<s> auto Res = parseSymbolicUnifiedFormat ( FormatStr , Loc , Format ) ; if ( Res == MatchOperand_NoMatch ) Res = parseSymbolicSplitFormat ( FormatStr , Loc , Format ) ; if ( Res != MatchOperand_Success ) return Res ; if ( ! skipToken ( AsmToken :: RBrac , <STR_LIT> ) ) return MatchOperand_ParseFail ; return MatchOperand_Success


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


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseSymbolicUnifiedFormat ( StringRef FormatStr , SMLoc Loc , int64_t & Format ) { using namespace llvm ::


<s> int64_t Fmt = UFMT_UNDEF ; if ( ! tryParseFmt ( <STR_LIT> , UFMT_MAX , Fmt ) ) return MatchOperand_ParseFail ; if ( Fmt == UFMT_UNDEF )


<s> int64_t Fmt = UFMT_UNDEF ; if ( ! tryParseFmt ( <STR_LIT> , UFMT_MAX , Fmt ) ) return MatchOperand_ParseFail ; if ( Fmt == UFMT_UNDEF ) return MatchOperand_NoMatch ; Format = Fmt ; return MatchOperand_Success


<s> std :: unique_ptr < <ISA_LIT>Operand > Reg = parseRegister ( ) ; if ( Reg ) { Operands . push_back ( std :: move ( Reg ) ) ; return MatchOperand_Success ; } return MatchOperand_ParseFail


<s> AsmToken <ISA_LIT>AsmParser :: peekToken ( ) { return isToken ( AsmToken :: EndOfStatement ) ? getToken ( ) :


<s> void print ( raw_ostream & OS ) const override { switch ( Kind ) { case Register : OS << <STR_LIT> << getReg ( ) << <STR_LIT> << Reg . Mods << '>' ; break ; case Immediate : OS << '<' << getImm ( ) ; if ( getImmTy ( ) != ImmTyNone ) { OS << <STR_LIT> ; printImmTy ( OS , getImmTy ( ) ) ; } OS << <STR_LIT> << Imm


<s> void setForcedSDWA ( bool ForceSDWA_


<s> assert ( isImm ( ) ) ; Imm . Val = Val


<s> void setImmKindConst ( ) const { assert ( isImm ( ) ) ; Imm . Kind


<s> void setImmKindLiteral ( ) const { assert ( isImm (


<s> if ( ! trySkipToken ( Kind ) ) { Error ( getLoc ( ) , ErrMsg ) ; return false ; } return


<s> 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> : case <STR_LIT> : return false ; default : return true ; } } for ( MCRegAliasIterator R ( <STR_LIT> , & MRI , true ) ; R . isValid ( ) ; ++ R ) { if ( * R == RegNo ) return


<s> SMLoc Loc = getLoc ( ) ; auto Res = parseIntWithPrefix ( Pref , Val ) ; if ( Res == MatchOperand_ParseFail ) return false ; if ( Res == MatchOperand_NoMatch ) return true ; if ( Val < <NUM_LIT> || Val > MaxVal ) { Error ( Loc , Twine ( <STR_LIT> , StringRef ( Pref ) ) ) ; return false ; } Fmt =


<s> bool Result = ParseRegister ( RegNo , StartLoc , EndLoc , true ) ; bool PendingErrors = getParser ( ) .


<s> bool <ISA_LIT>AsmParser :: trySkipId ( const StringRef Id , const AsmToken :: TokenKind Kind ) { if ( isId ( Id ) && peekToken ( ) .


<s> if ( isToken ( Kind ) ) { lex ( ) ; return true ; } return


<s> switch ( RegKind ) { case IS_SGPR : usesSgprAt ( DwordRegIndex + RegWidth - <NUM_LIT> ) ; break ; case


<s> if ( Ctx ) { MCSymbol * const Sym = Ctx ->

getOrCreateSymbol ( Twine ( <STR_LIT> ) ) ;


<s> unsigned LiteralSize ; if ( Desc . TSFlags & ( <STR_LIT> | <STR_LIT> | <STR_LIT> | <STR_LIT> | <STR_LIT> | <STR_LIT> ) ) { if ( <STR_LIT> ( Opcode , <STR_LIT> :: imm ) != - <NUM_LIT> ) { ++ NumLiterals ; LiteralSize = <NUM_LIT> ; } 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 . isReg ( ) ) { LastSGPR = mc2PseudoReg ( MO . getReg ( ) ) ; if ( ! SGPRsUsed . count ( LastSGPR ) ) { SGPRsUsed . insert ( LastSGPR ) ; ++ ConstantBusUseCount ; } } else { if ( Desc . OpInfo [ OpIdx ] . OperandType == MCOI :: OPERAND_IMMEDIATE ) continue ; unsigned Size = <STR_LIT> ( Desc , OpIdx ) ; if ( Size < <NUM_LIT> ) Size = <NUM_LIT> ; if ( NumLiterals == <NUM_LIT> ) { NumLiterals =


<s> int Data0Pos = <STR_LIT> ( Inst . getOpcode ( ) , <STR_LIT> :: data0 ) ; assert ( Data0Pos != - <NUM_LIT> ) ; auto Reg = Inst . getOperand ( Data0Pos ) . getReg ( ) ; auto RegIdx = Reg - ( VGPR32 . contains ( Reg ) ? <STR_LIT> : <STR_LIT> ) ; if ( RegIdx


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


<s> const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) != <NUM_LIT> && ! hasIntClamp ( ) ) { int ClampIdx = <STR_LIT> ( Opc , <STR_LIT> :: clamp ) ; assert ( ClampIdx != - <NUM_LIT> ) ; return Inst . getOperand ( ClampIdx ) . getImm ( )


<s> bool <ISA_LIT>AsmParser :: validateIntClampSupported ( const MCInst & Inst ) { const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII


<s> const unsigned Opc = Inst . getOpcode ( ) ; if ( Opc != <STR_LIT> ) return true ; const int Src0Idx = <STR_LIT> ( Opc , <STR_LIT> :: src0 ) ; assert ( Src0Idx != - <NUM_LIT> ) ; const MCOperand & Src0 = Inst . getOperand


<s> unsigned Dim = Inst . getOperand ( DimIdx ) . getImm ( ) ; const <STR_LIT> * DimInfo = <STR_LIT> ( Dim ) ; bool IsNSA = SrsrcIdx - VAddr0Idx > <NUM_LIT> ; unsigned ActualAddrSize = IsNSA ? SrsrcIdx - VAddr0Idx : <STR_LIT> ( getMRI ( ) , Desc , VAddr0Idx ) / <NUM_LIT> ; bool IsA16 = ( A16Idx != - <NUM_LIT> && Inst . getOperand ( A16Idx ) . getImm ( ) ) ; unsigned ExpectedAddrSize = <STR_LIT> ( BaseOpcode , DimInfo , IsA16 , hasG16 ( ) ) ; if ( ! IsNSA


<s> if ( ! Desc . mayLoad ( ) || ! Desc . mayStore ( ) ) return true ; int DMaskIdx = <STR_LIT> ( Opc , <STR_LIT> :: dmask ) ; unsigned DMask = Inst . getOperand ( DMaskIdx ) . getImm (


<s> if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_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> ) ; if ( DMaskIdx == - <NUM_LIT> || TFEIdx == - <NUM_LIT> ) return true ; unsigned VDataSize = <STR_LIT> ( getMRI ( ) , Desc , VDataIdx ) ; unsigned TFESize = ( TFEIdx != - <NUM_LIT> && Inst . getOperand ( TFEIdx )

. getImm ( ) ) ? <NUM_LIT> : <NUM_LIT> ;


<s> int DimIdx = <STR_LIT> ( Opc , <STR_LIT> :: dim ) ; if ( DimIdx < <NUM_LIT> ) return true ; long Imm = Inst . getOperand ( DimIdx ) . getImm ( ) ; if ( Imm < <NUM_LIT> || Imm >= <NUM_LIT> ) return false ; return


<s> const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; int DimIdx = <STR_LIT> ( Opc , <STR_LIT> :: dim


<s> bool <ISA_LIT>AsmParser :: validateMIMGGatherDMask ( const MCInst & Inst ) { const unsigned Opc = Inst . getOpcode ( ) ; const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; int DMaskIdx = <STR_LIT> ( Opc , <STR_LIT> :: dmask ) ; unsigned DMask = Inst . getOperand ( DMaskIdx ) . getImm ( ) & <NUM_LIT> ; return DMask == <NUM_LIT> || DMask == <NUM_LIT> || DMask == <NUM_LIT> ||


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


<s> const MCInstrDesc & Desc = MII . get ( Opc ) ; if ( ( Desc . TSFlags & <STR_LIT> ) == <NUM_LIT> ) return true ; const <STR_LIT> * Info = <STR_LIT> ( Opc ) ; const <STR_LIT> * BaseOpcode = <STR_LIT> ( Info -> BaseOpcode ) ; if ( ! BaseOpcode -> MSAA ) return true ; int DimIdx = <STR_LIT> ( Opc , <STR_LIT> :: dim ) ; assert ( DimIdx != - <NUM_LIT> ) ; unsigned Dim = Inst . getOperand ( DimIdx ) . getImm


<s> if ( Src0 . isReg ( ) ) { auto Reg = mc2PseudoReg ( Src0 . getReg ( ) ) ; const MCRegisterInfo * TRI = getContext ( ) . getRegisterInfo ( ) ; if ( ! isSGPR ( Reg , TRI ) ) return true ; ErrLoc = getRegLoc ( Reg , Operands ) ; } else { ErrLoc = getConstLoc ( Operands


<s> const int Src0Idx = <STR_LIT> ( Opc , <STR_LIT> :: src0 ) ; assert ( Src0Idx != - <NUM_LIT> ) ; SMLoc ErrLoc ; const MCOperand & Src0 = Inst . getOperand ( Src0Idx ) ; if ( Src0 . isReg ( ) ) { auto Reg = mc2PseudoReg ( Src0 . getReg ( ) ) ; const MCRegisterInfo * TRI = getContext ( ) . getRegisterInfo ( ) ; if ( ! isSGPR ( Reg , TRI ) ) return true ; ErrLoc = getRegLoc ( Reg , Operands ) ; } else { ErrLoc = getConstLoc ( Operands ) ; } Error ( ErrLoc , <STR_LIT> ) ; return


<s> 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 , <STR_LIT> ) ; return false ; } if ( ! isValidMsgStream ( Msg . Id , Op . Id , Stream . Id , getSTI ( ) , Strict ) ) { Error ( Stream . Loc , <STR_LIT> ) ; return false ; } return true