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


<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 :: ImmTyTFE ) ;


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


<s> 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> ) { auto it = Inst . begin ( ) ; std :: advance ( it , <STR_LIT> ( Opc , <STR_LIT> :: src2_modifiers ) ) ; it = Inst . insert ( it , MCOperand :: createImm ( <NUM_LIT> ) ) ; ++ it ; Inst . insert ( it , Inst . getOperand ( <NUM_LIT> ) ) ; }


<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> bool isDFMT ( ) const { return isImmTy ( ImmTyDFMT ) && isUInt < <NUM_LIT> > ( getImm ( ) ) ;


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


return ( isImmTy ( ImmTyOffset ) || isImmTy ( ImmTyInstOffset ) ) && isInt < <NUM_LIT> > ( getImm ( ) ) ;


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


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

else if ( AsmParser -> isGFX9 ( ) ) return isRegKind ( ) || isInlinableImm ( type ) ;


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

if ( IDVal == <STR_LIT> :: AssemblerDirectiveBegin ) return ParseDirectiveHSAMetadata ( ) ;


<s> if ( getSTI ( ) . getTargetTriple ( ) . getOS ( ) != Triple :: AMDHSA ) { return Error ( getParser ( ) . getTok ( ) . getLoc ( ) , ( Twine ( HSAMD :: AssemblerDirectiveBegin ) + Twine ( <STR_LIT> <STR_LIT> ) ) . str ( ) ) ; } std :: string HSAMetadataString ; raw_string_ostream YamlStream ( HSAMetadataString ) ; getLexer ( ) . setSkipSpace ( false ) ; 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 == <STR_LIT> :: AssemblerDirectiveEnd ) { Lex ( ) ; FoundEnd = true ;


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


<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 ) ) return true ;


<s> if ( parseAbsoluteExpr ( IntVal , AbsMod ) ) return MatchOperand_ParseFail ; if ( Minus ) IntVal *= - <NUM_LIT> ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , IntVal , S ) ) ; return MatchOperand_Success ; } case AsmToken :: Real : { int64_t IntVal ; if ( parseAbsoluteExpr ( IntVal , AbsMod ) ) return MatchOperand_ParseFail ; APFloat F ( BitsToDouble ( IntVal ) ) ; if ( Minus ) F . changeSign ( ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( this , F . bitcastToAPInt ( ) . getZExtValue ( ) , S , <ISA_LIT>Operand :: ImmTyNone , true ) ) ; return MatchOperand_Success ;


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


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


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


<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 , Op . Type ) ;


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


<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 ) {


<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 , true ) ;


<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 ( OpIdx ) ;


<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> :: src1 ) ;


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

if ( ! validateEarlyClobberLimitations ( Inst ) ) {


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


<s> case AsmToken :: Integer : { SMLoc S = Parser . getTok ( ) . getLoc ( ) ; int64_t IntVal ; if ( getParser ( ) . parseAbsoluteExpression ( IntVal ) ) return MatchOperand_ParseFail ; if ( ! isInt < <NUM_LIT> > ( IntVal ) && ! isUInt < <NUM_LIT> > ( IntVal ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ; } if ( Negate ) IntVal *= - <NUM_LIT> ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( IntVal , S ) ) ; return MatchOperand_Success ; } case AsmToken :: Real : { SMLoc S = Parser . getTok ( ) . getLoc ( ) ; int64_t IntVal ; if ( getParser ( ) . parseAbsoluteExpression ( IntVal ) ) return MatchOperand_ParseFail ; APFloat F ( ( float ) BitsToDouble ( IntVal ) ) ; if ( Negate ) F . changeSign ( ) ; Operands . push_back ( <ISA_LIT>Operand :: CreateImm ( F . bitcastToAPInt ( ) . getZExtValue ( ) , S ) ) ; return MatchOperand_Success ;


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


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


<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 , <NUM_LIT> ) ;


<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 :: ImmTyR128A16 ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyTFE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyLWE ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyDA ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyD16 ) ;


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


<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 == <STR_LIT> ) {


<s> int64_t Imm = getImm ( ) ; return ( Imm >= DppCtrl :: QUAD_PERM_FIRST && Imm <= DppCtrl :: QUAD_PERM_LAST ) || ( Imm >= DppCtrl :: ROW_SHL_FIRST && Imm <= DppCtrl :: ROW_SHL_LAST ) || ( Imm >= DppCtrl :: ROW_SHR_FIRST && Imm <= DppCtrl :: ROW_SHR_LAST ) || ( Imm >= DppCtrl :: ROW_ROR_FIRST && Imm <= DppCtrl :: ROW_ROR_LAST ) || ( Imm == DppCtrl :: WAVE_SHL1 ) || ( Imm == DppCtrl :: WAVE_ROL1 ) || ( Imm == DppCtrl :: WAVE_SHR1 ) || ( Imm == DppCtrl :: WAVE_ROR1 ) || ( Imm == DppCtrl :: ROW_MIRROR ) || ( Imm == DppCtrl :: ROW_HALF_MIRROR ) || ( Imm == DppCtrl :: BCAST15 ) || ( Imm == DppCtrl :: BCAST31 ) ;


<s> using namespace <STR_LIT> ; bool result = isImm ( ) && getImmTy ( ) == ImmTyDppCtrl && isUInt < <NUM_LIT> > ( getImm ( ) ) ; if ( result ) { int64_t Imm = getImm ( ) ; return ( Imm >= DppCtrl :: QUAD_PERM_FIRST && Imm <= DppCtrl :: QUAD_PERM_LAST ) || ( Imm >= DppCtrl :: ROW_SHL_FIRST && Imm <= DppCtrl :: ROW_SHL_LAST ) || ( Imm >= DppCtrl :: ROW_SHR_FIRST && Imm <= DppCtrl :: ROW_SHR_LAST ) || ( Imm >= DppCtrl :: ROW_ROR_FIRST && Imm <= DppCtrl :: ROW_ROR_LAST ) || ( Imm == DppCtrl :: WAVE_SHL1 ) || ( Imm == DppCtrl :: WAVE_ROL1 ) || ( Imm == DppCtrl :: WAVE_SHR1 ) || ( Imm == DppCtrl :: WAVE_ROR1 ) || ( Imm == DppCtrl :: ROW_MIRROR ) || ( Imm == DppCtrl :: ROW_HALF_MIRROR ) || ( Imm == DppCtrl :: BCAST15 ) || ( Imm == DppCtrl :: BCAST31 ) ; } return false ;


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


<s> if ( getParser ( ) . parseAbsoluteExpression ( CntVal ) ) return true ; <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 , encodeExpcnt , decodeExpcnt ) ; } else if ( CntName == <STR_LIT> || CntName == <STR_LIT> ) { Failed = encodeCnt ( ISA , IntVal , CntVal , Sat , encodeLgkmcnt , decodeLgkmcnt ) ; } if ( Failed ) { Error ( ValLoc , <STR_LIT> + CntName ) ; return true ;


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


<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 ( ) . getLoc ( ) , <STR_LIT> ) ;


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


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


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


<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 ) {


<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 ) ) return nullptr ;


<s> SMLoc S = Parser . getTok ( ) . getLoc ( ) ; switch ( getLexer ( ) . getKind ( ) ) { default : return MatchOperand_ParseFail ; case AsmToken :: Integer : if ( getParser ( ) . parseAbsoluteExpression ( Waitcnt ) ) return MatchOperand_ParseFail ; break ; case AsmToken :: Identifier :


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


<s> case ImmTyOffset1 : OS << <STR_LIT> ; break ; case ImmTyGLC : OS << <STR_LIT> ; break ; case ImmTySLC : OS << <STR_LIT> ; break ; case ImmTyTFE : OS << <STR_LIT> ; break ; case ImmTyD16 : OS << <STR_LIT> ; break ; case ImmTyFORMAT : OS << <STR_LIT> ; break ; case ImmTyClamp<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyOMod<ISA_LIT> : OS << <STR_LIT> ; break ; case ImmTyDppCtrl : OS << <STR_LIT> ; break ; case ImmTyDppRowMask : OS << <STR_LIT> ; break ; case ImmTyDppBankMask : OS << <STR_LIT> ; break ; case ImmTyDppBoundCtrl : OS << <STR_LIT> ; break ; case ImmTySdwaDstSel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc0Sel : OS << <STR_LIT> ; break ; case ImmTySdwaSrc1Sel : OS << <STR_LIT> ; break ;

case ImmTySdwaDstUnused : OS << <STR_LIT> ; break ;


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


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


<s> assert ( ! isImmTy ( ImmTyNone ) || ! hasModifiers ( ) ) ; Inst . addOperand ( MCOperand :: createImm ( Imm . Val ) ) ; setImmKindNone ( ) ;


<s> addKImmFPOperands < <NUM_LIT> > ( Inst , N ) ;


<s> bool Lost ; APFloat FPLiteral ( APFloat :: IEEEdouble ( ) , Literal ) ; FPLiteral . convert ( * getFltSemantics ( Bitwidth / <NUM_LIT> ) , APFloat :: rmNearestTiesToEven , & Lost ) ; Inst . addOperand ( MCOperand :: createImm ( FPLiteral . bitcastToAPInt ( ) . getZExtValue ( ) ) ) ;


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


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


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


<s> ( ( <ISA_LIT>Operand & ) * Operands [ Idx ] ) . addImmOperands ( Inst , <NUM_LIT> ) ; } else { Inst . addOperand ( MCOperand :: createImm ( Default ) ) ; }


<s> assert ( ! hasIntModifiers ( ) ) ; addRegOrImmWithInputModsOperands ( Inst , N ) ;


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


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


addRegOrImmWithInputModsOperands ( Inst , N ) ;


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

addRegWithInputModsOperands ( Inst , N ) ;


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


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


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


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


<s> <ISA_LIT>Operand ( KindTy Kind_ , const <ISA_LIT>AsmParser * AsmParser_ ) : MCParsedAsmOperand ( ) , Kind ( Kind_ ) , AsmParser ( AsmParser_ ) {


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


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


<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> ) ) {


<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> FeatureBitset FBS = ComputeAvailableFeatures ( getSTI ( ) . getFeatureBits ( ) ) ; if ( isSupportedMnemo ( Mnemo , FBS , getMatchedVariants ( ) ) ) return false ; getParser ( ) . clearPendingErrors ( ) ; StringRef VariantName = getMatchedVariantName ( ) ; if ( ! VariantName . empty ( ) && isSupportedMnemo ( Mnemo , FBS ) ) { return Error ( IDLoc , Twine ( VariantName , <STR_LIT> ) ) ; } if ( isSupportedMnemo ( Mnemo , FeatureBitset ( ) . set ( ) ) ) { return Error ( IDLoc , <STR_LIT> ) ; } std :: string Suggestion = <ISA_LIT>MnemonicSpellCheck ( Mnemo , FBS ) ; return Error ( IDLoc , <STR_LIT> + Suggestion ) ;


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


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


<s> static <ISA_LIT>Operand :: Ptr CreateExpr ( const <ISA_LIT>AsmParser * AsmParser , const class MCExpr * Expr , SMLoc S ) { auto Op = std :: make_unique < <ISA_LIT>Operand > ( Expression , AsmParser ) ; Op -> Expr = Expr ; Op -> StartLoc = S ; Op -> EndLoc = S ; return Op ;


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


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


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


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


<s> void cvtDS ( MCInst & Inst , const OperandVector & Operands ) { cvtD<ISA_LIT>mpl ( Inst , Operands , false ) ;


<s> cvtD<ISA_LIT>mpl ( Inst , Operands , true ) ;


<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 , <ISA_LIT>Operand :: ImmTyGDS ) ;


<s> Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } OptionalIdx [ Op . getImmTy ( ) ] = i ; } addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset0 ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyOffset1 ) ; addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyGDS ) ; Inst . addOperand ( MCOperand :: createReg ( <STR_LIT> ) ) ;


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


<s> if ( Operand . isReg ( ) ) Operand . addRegOperands ( Inst , <NUM_LIT> ) ; } Inst . addOperand ( MCOperand :: createImm ( <NUM_LIT> ) ) ;


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


<s> cvtMIMG ( Inst , Operands , true ) ;


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


<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> cvtMubufImpl ( Inst , Operands , false ) ;


<s> cvtMubufImpl ( Inst , Operands , true ) ;


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


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

cvtMubufImpl ( Inst , Operands , false , true ) ;


<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 , SdwaSel :: DWORD ) ;


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


<s> cvtSDWA ( Inst , Operands , <STR_LIT> ) ;


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

cvtSDWA ( Inst , Operands , <STR_LIT> ) ;


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


<s> cvtSDWA ( Inst , Operands , <STR_LIT> , false , true ) ;


<s> cvtSDWA ( Inst , Operands , <STR_LIT> , isVI ( ) ) ;


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

cvtSDWA ( Inst , Operands , <STR_LIT> , isVI ( ) ) ;


<s> bool IsAtomicReturn = false ; for ( unsigned i = <NUM_LIT> , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( ! Op . isCPol ( ) ) continue ; IsAtomicReturn = Op . getImm ( ) & <STR_LIT> :: GLC ; break ; } if ( ! IsAtomicReturn ) { int NewOpc = <STR_LIT> ( Inst . getOpcode ( ) ) ; if ( NewOpc != - <NUM_LIT> ) Inst . setOpcode ( NewOpc ) ; } IsAtomicReturn = MII . get ( Inst . getOpcode ( ) ) . TSFlags & <STR_LIT> ; for ( unsigned i = <NUM_LIT> , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; if ( IsAtomicReturn && i == <NUM_LIT> ) Op . addRegOperands ( Inst , <NUM_LIT> ) ;


<s> if ( ! IsAtomicReturn ) { int NewOpc = <STR_LIT> ( Inst . getOpcode ( ) ) ; if ( NewOpc != - <NUM_LIT> ) Inst . setOpcode ( NewOpc ) ; } IsAtomicReturn = MII . get ( Inst . getOpcode ( ) ) . TSFlags & <STR_LIT> ; for ( unsigned i = <NUM_LIT> , e = Operands . size ( ) ; i != e ; ++ i ) { <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isReg ( ) ) { Op . addRegOperands ( Inst , <NUM_LIT> ) ; if ( IsAtomicReturn && i == <NUM_LIT> ) Op . addRegOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyNone ) { Op . addImmOperands ( Inst , <NUM_LIT> ) ; continue ; } if ( Op . isToken ( ) ) {


<s> void <ISA_LIT>AsmParser :: cvtVOP3 ( MCInst & Inst , const OperandVector & Operands ) { OptionalImmIndexMap OptionalIdx ; 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 . getNumOperands ( ) ) ) {


<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 . isInterpSlot ( ) || Op . isInterpAttr ( ) || Op . isAttrChan ( ) ) { Inst . addOperand ( MCOperand :: createImm ( Op . getImm ( ) ) ) ; } else if ( Op . isImmModifier ( ) ) { OptionalIdx [ Op . getImmTy ( ) ] = I ; } else { llvm_unreachable ( <STR_LIT> ) ; } } if ( <STR_LIT> ( Opc , <STR_LIT> :: high ) != - <NUM_LIT> ) { addOptionalImmOperand ( Inst , Operands , OptionalIdx , <ISA_LIT>Operand :: ImmTyHigh ) ;


<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> << SrcNum ) ) != <NUM_LIT> ) {


<s> for ( SrcNum = <NUM_LIT> ; 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> << SrcNum ) ) != <NUM_LIT> ) { int ModIdx = <STR_LIT> ( Opc , <STR_LIT> :: src0_modifiers ) ; uint32_t ModVal = Inst . getOperand ( ModIdx ) . getImm ( ) ; Inst . getOperand ( ModIdx ) . setImm ( ModVal | <STR_LIT> ) ; }


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


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


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


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


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultBLGP ( ) const {

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


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


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


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


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


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultFI ( ) const {

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


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


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultRowMask ( ) const {

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


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


<s> <ISA_LIT>Operand :: Ptr <ISA_LIT>AsmParser :: defaultSMEMOffset ( ) const {

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> 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> IntVal = encode ( ISA , IntVal , CntVal ) ; if ( CntVal != decode ( ISA , IntVal ) ) { if ( Saturate ) { IntVal = encode ( ISA , IntVal , - <NUM_LIT> ) ; } else { Failed = true ; }


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


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


<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> 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> : return <NUM_LIT> ;


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


<s> return Op . isImmKindConst ( ) ; } ; return getOperandLoc ( Test , Operands ) ;


<s> return S -> getSymbol ( ) . getName ( ) ;


<s> StringRef getExpressionAsToken ( ) const { assert ( isExpr ( ) ) ; const MCSymbolRefExpr * S = cast < MCSymbolRefExpr > ( Expr ) ; return S -> getSymbol ( ) . getName ( ) ;


<s> const FeatureBitset & getFeatureBits ( ) const { return getSTI ( ) . getFeatureBits ( ) ;


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


<s> <ISA_LIT>Operand & Op = ( ( <ISA_LIT>Operand & ) * Operands [ i ] ) ; if ( Op . isFlatOffset ( ) ) return Op . getStartLoc ( ) ;


Operand |= Abs ? <STR_LIT> : <NUM_LIT> ;


<s> return StringRef ( <STR_LIT> ) ; case IS_SGPR : return StringRef ( <STR_LIT> ) ; default : return None ;


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

return getOperandLoc ( Test , Operands ) ;


<s> Operand |= Sext ? <STR_LIT> : <NUM_LIT> ; return Operand ;


<s> int64_t getIntModifiersOperand ( ) const { int64_t Operand = <NUM_LIT> ;

Operand |= Sext ? <STR_LIT> : <NUM_LIT> ;


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


<s> SMRange getLocRange ( ) const { return SMRange ( StartLoc , EndLoc ) ;


<s> return SMRange ( StartLoc , EndLoc ) ;


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


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

if ( isForcedSDWA ( ) ) return <STR_LIT> ;


<s> return isRegKind ( ) ? Reg . Mods : Imm . Mods ;


<s> int64_t getModifiersOperand ( ) const { assert ( ! ( hasFPModifiers ( ) && hasIntModifiers ( ) ) && <STR_LIT> ) ; if ( hasFPModifiers ( ) ) { return getFPModifiersOperand ( ) ; } else if ( hasIntModifiers ( ) ) { return getIntModifiersOperand ( ) ; } else { return <NUM_LIT> ; }


<s> const MCRegisterInfo * getMRI ( ) const { 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> ] ) . getStartLoc ( ) ;


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


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


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


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


<s> auto Test = [ = ] ( const <ISA_LIT>Operand & Op ) { return Op . isRegKind ( ) && Op . getReg ( ) == Reg ;


<s> return ! Str . getAsInteger ( <NUM_LIT> , Num ) ;


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


<s> assert ( isRegularReg ( RegKind ) ) ; unsigned AlignSize = <NUM_LIT> ; if ( RegKind == IS_SGPR || RegKind == IS_TTMP ) { AlignSize = std :: min ( RegWidth , <NUM_LIT> ) ; } if ( RegNum % AlignSize != <NUM_LIT> ) { Error ( Loc , <STR_LIT> ) ; return <STR_LIT> ;


<s> static const RegInfo * getRegularRegInfo ( StringRef Str ) { for ( const RegInfo & Reg : RegularRegisters ) if ( Str . startswith ( Reg . Name ) ) return & Reg ; return nullptr ;


<s> SMLoc <ISA_LIT>AsmParser :: getSMEMOffsetLoc ( const OperandVector & Operands ) const { 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 ( ) ; } return getLoc ( ) ;


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


<s> return getToken ( ) . getString ( ) ;


<s> bool hasArchitectedFlatScratch ( ) const { return getFeatureBits ( ) [ <STR_LIT> ] ;


<s> bool hasFlatOffsets ( ) const { return getFeatureBits ( ) [ <STR_LIT> ] ;


<s> return getFeatureBits ( ) [ <STR_LIT> ] ;


return getModifiers ( ) . hasFPModifiers ( ) ;


<s> return getModifiers ( ) . hasFPModifiers ( ) ;


<s> bool hasGFX10A16 ( ) const { return <STR_LIT> ( getSTI ( ) ) ;


return getFeatureBits ( ) [ <STR_LIT> ] ;


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


return getModifiers ( ) . hasIntModifiers ( ) ;


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


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


<s> return getModifiers ( ) . hasModifiers ( ) ;


<s> Ctx = & Context ; usesSgprAt ( SgprIndexUnusedMin = - <NUM_LIT> ) ; usesVgprAt ( VgprIndexUnusedMin = - <NUM_LIT> ) ;


<s> MCSymbol * Sym = getContext ( ) . getOrCreateSymbol ( * SymbolName ) ; Sym -> setVariableValue ( MCConstantExpr :: create ( <NUM_LIT> , getContext ( ) ) ) ;


<s> bool <ISA_LIT>Operand :: isABID ( ) const {

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


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


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


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


<s> bool isAISrcV2B16 ( ) const { return isAISrcB16 ( ) ;


<s> return isAISrcF16 ( ) || isAISrcB32 ( ) ;


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


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


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


<s> bool isAISrc_1024V2B16 ( ) const { return isAISrc_1024B16 ( ) ;


<s> return isAISrc_1024F16 ( ) || isAISrc_1024B32 ( ) ;


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


<s> bool isAISrc_128V2B16 ( ) const { return isAISrc_128B16 ( ) ;


return isAISrc_128F16 ( ) || isAISrc_128B32 ( ) ;


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


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


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


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


<s> bool isAISrc_512V2B16 ( ) const { return isAISrc_512B16 ( ) ;


<s> bool isAISrc_512V2F16 ( ) const { return isAISrc_512F16 ( ) || isAISrc_512B32 ( ) ;


<s> bool isAttrChan ( ) const { return isImmTy ( ImmTyAttrChan ) ;


<s> bool <ISA_LIT>Operand :: isBLGP ( ) const { return isImm ( ) && getImmTy ( ) == ImmTyBLGP && isUInt < <NUM_LIT> > ( getImm ( ) ) ;


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


<s> bool <ISA_LIT>Operand :: isCBSZ ( ) const {

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


<s> if ( result ) { int64_t Imm = getImm ( ) ; return ( Imm >= DppCtrl :: QUAD_PERM_FIRST && Imm <= DppCtrl :: QUAD_PERM_LAST ) || ( Imm >= DppCtrl :: ROW_SHL_FIRST && Imm <= DppCtrl :: ROW_SHL_LAST ) || ( Imm >= DppCtrl :: ROW_SHR_FIRST && Imm <= DppCtrl :: ROW_SHR_LAST ) || ( Imm >= DppCtrl :: ROW_ROR_FIRST && Imm <= DppCtrl :: ROW_ROR_LAST ) || ( Imm == DppCtrl :: WAVE_SHL1 ) || ( Imm == DppCtrl :: WAVE_ROL1 ) || ( Imm == DppCtrl :: WAVE_SHR1 ) || ( Imm == DppCtrl :: WAVE_ROR1 ) || ( Imm == DppCtrl :: ROW_MIRROR ) || ( Imm == DppCtrl :: ROW_HALF_MIRROR ) || ( Imm == DppCtrl :: BCAST15 ) || ( Imm == DppCtrl :: BCAST31 ) || ( Imm >= DppCtrl :: ROW_SHARE_FIRST && Imm <= DppCtrl :: ROW_SHARE_LAST ) || ( Imm >= DppCtrl :: ROW_XMASK_FIRST && Imm <= DppCtrl :: ROW_XMASK_LAST ) ; } return false ;


<s> int64_t Imm = getImm ( ) ; return ( Imm >= DppCtrl :: QUAD_PERM_FIRST && Imm <= DppCtrl :: QUAD_PERM_LAST ) || ( Imm >= DppCtrl :: ROW_SHL_FIRST && Imm <= DppCtrl :: ROW_SHL_LAST ) || ( Imm >= DppCtrl :: ROW_SHR_FIRST && Imm <= DppCtrl :: ROW_SHR_LAST ) || ( Imm >= DppCtrl :: ROW_ROR_FIRST && Imm <= DppCtrl :: ROW_ROR_LAST ) || ( Imm == DppCtrl :: WAVE_SHL1 ) || ( Imm == DppCtrl :: WAVE_ROL1 ) || ( Imm == DppCtrl :: WAVE_SHR1 ) || ( Imm == DppCtrl :: WAVE_ROR1 ) || ( Imm == DppCtrl :: ROW_MIRROR ) || ( Imm == DppCtrl :: ROW_HALF_MIRROR ) || ( Imm == DppCtrl :: BCAST15 ) || ( Imm == DppCtrl :: BCAST31 ) || ( Imm >= DppCtrl :: ROW_SHARE_FIRST && Imm <= DppCtrl :: ROW_SHARE_LAST ) || ( Imm >= DppCtrl :: ROW_XMASK_FIRST && Imm <= DppCtrl :: ROW_XMASK_LAST ) ;


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


<s> bool isForcedDPP ( ) const { return ForcedDPP ;


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


<s> bool isGFX10A16 ( ) const { return isImmTy ( ImmTyA16 ) ;


<s> bool isGFX10_BEncoding ( ) const { return <STR_LIT> ( getSTI ( ) ) ;


<s> bool isGFX9 ( ) const { return <STR_LIT> ( getSTI ( ) ) ;


<s> bool isGFX90A ( ) const { return <STR_LIT> ( getSTI ( ) ) ;


<s> return isImmTy ( ImmTyGprIdxMode ) ;


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


<s> bool <ISA_LIT>Operand :: isHwreg ( ) const { return isImmTy ( ImmTyHwreg ) ;


<s> bool isIdxen ( ) const { return isImmTy ( ImmTyIdxen ) ;


<s> bool isImmKindConst ( ) const { return isImm ( ) && Imm . Kind == ImmKindTyConst ;


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


return isImm ( ) && Imm . Kind == ImmKindTyLiteral ;


<s> static bool isInlineableLiteralOp16 ( int64_t Val , MVT VT , bool HasInv2Pi ) {

if ( VT . getScalarType ( ) == <STR_LIT> ) {


<s> return isInlinableIntLiteral ( Val ) ; }


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


<s> case <NUM_LIT> : return <STR_LIT> ( Val , hasInv2PiInlineImm ( ) ) ; case <NUM_LIT> : 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 ( ) ) ; } default : llvm_unreachable ( <STR_LIT> ) ; }


<s> bool <ISA_LIT>Operand :: isInlineValue ( ) const { return isRegKind ( ) && :: isInlineValue ( getReg ( ) ) ;


<s> return isImmTy ( ImmTyInterpAttr ) ;


<s> } if ( type == <STR_LIT> ) { return true ; } if ( type == <STR_LIT> ) { return false ; } MVT ExpectedType = ( type == <STR_LIT> ) ? <STR_LIT> : ( type == <STR_LIT> ) ? <STR_LIT> : ( type == <STR_LIT> ) ? <STR_LIT> : type ; APFloat FPLiteral ( APFloat :: IEEEdouble ( ) , APInt ( <NUM_LIT> , Imm . Val ) ) ; return canLosslesslyConvertToFPType ( FPLiteral , ExpectedType ) ;


<s> bool isLWE ( ) const { return isImmTy ( ImmTyLWE ) ;


<s> return isClamp<ISA_LIT> ( ) || isOMod<ISA_LIT> ( ) ;


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


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 ) {


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


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

return str == <STR_LIT> || str == <STR_LIT> || str == <STR_LIT> ;


<s> bool isNegHi ( ) const { return isImmTy ( ImmTyNegHi ) ;


<s> bool isOffen ( ) const { return isImmTy ( ImmTyOffen ) ;


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


<s> bool isOffset1 ( ) const { return isImmTy ( ImmTyOffset1 ) && isUInt < <NUM_LIT> > ( getImm ( ) ) ;


<s> return isImmTy ( ImmTyOMod<ISA_LIT> ) ;


<s> return Token . is ( AsmToken :: Identifier ) && NextToken . is ( AsmToken :: Colon ) ;


<s> return isNamedOperandModifier ( Token , NextToken ) || Token . is ( AsmToken :: Pipe ) ;


<s> bool isOpSel ( ) const { return isImmTy ( ImmTyOpSel ) ;


return isRegKind ( ) && ! hasModifiers ( ) ;


<s> bool <ISA_LIT>Operand :: isRegClass ( unsigned RCID ) const {

return isRegKind ( ) && AsmParser -> getMRI ( ) -> getRegClass ( RCID ) . contains ( getReg ( ) ) ;


<s> bool <ISA_LIT>AsmParser :: isRegister ( ) { return isRegister ( getToken ( ) , peekToken ( ) ) ;


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


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


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


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


<s> return Desc . OpInfo [ OpNum ] . OperandType == <STR_LIT> && Desc . NumOperands > ( OpNum + <NUM_LIT> ) && Desc . OpInfo [ OpNum + <NUM_LIT> ] . RegClass != - <NUM_LIT> && Desc . getOperandConstraint ( OpNum + <NUM_LIT> , MCOI :: OperandConstraint :: TIED_TO ) == - <NUM_LIT> ;


<s> bool isRegOrImmWithInt16InputMods ( ) const {

return isRegOrImmWithInputMods ( <STR_LIT> , <STR_LIT> ) ;


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


<s> bool isRegOrInlineNoMods ( unsigned RCID , MVT type ) const {

return ( isRegClass ( RCID ) || isInlinableImm ( type ) ) && ! hasModifiers ( ) ;


<s> return isImmTy ( ImmTyDppRowMask ) ;


<s> bool isRowMask ( ) const { return isImmTy ( ImmTyDppRowMask ) ;


<s> static bool isSafeTruncation ( int64_t Val , unsigned Size ) { return isUIntN ( Size , Val ) || isIntN ( Size , Val ) ;


<s> return isUIntN ( Size , Val ) || isIntN ( Size , Val ) ;


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


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


<s> bool isSCSrcV2F16 ( ) const { return isSCSrcF16 ( ) ;


<s> return isImmTy ( ImmTySdwaDstSel ) ;


<s> bool isSDWADstUnused ( ) const { return isImmTy ( ImmTySdwaDstUnused ) ;


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


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


<s> return isSDWAOperand ( <STR_LIT> ) ;


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


<s> bool <ISA_LIT>Operand :: isSDWAInt32Operand ( ) const { return isSDWAOperand ( <STR_LIT> ) ;


<s> if ( AsmParser -> isVI ( ) ) return isVReg32 ( ) ; else if ( AsmParser -> isGFX9Plus ( ) ) return isRegClass ( <STR_LIT> ) || isInlinableImm ( type ) ; else return false ;


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

return isImm ( ) && isUInt < <NUM_LIT> > ( getImm ( ) ) ;


<s> return isSCSrcB16 ( ) || isLiteralImm ( <STR_LIT> ) ;


<s> bool isSSrcB32 ( ) const { return isSCSrcB32 ( ) || isLiteralImm ( <STR_LIT> ) || isExpr ( ) ;


<s> return isSCSrcB64 ( ) || isLiteralImm ( <STR_LIT> ) ;


<s> bool isSSrcF16 ( ) const { return isSCSrcB16 ( ) || isLiteralImm ( <STR_LIT> ) ;


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


<s> bool isSSrcF64 ( ) const { return isSCSrcB64 ( ) || isLiteralImm ( <STR_LIT> ) ;


return isRegOrInlineNoMods ( <STR_LIT> , <STR_LIT> ) || isLiteralImm ( <STR_LIT> ) || isExpr ( ) ;


<s> bool isSSrcV2B16 ( ) const { llvm_unreachable ( <STR_LIT> ) ; return isSSrcB16 ( ) ;


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


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


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


<s> bool <ISA_LIT>AsmParser :: isSupportedMnemo ( StringRef Mnemo , const FeatureBitset & FBS , ArrayRef < unsigned > Variants ) { for ( auto Variant : Variants ) { if ( <ISA_LIT>CheckMnemonic ( Mnemo , FBS , Variant ) ) return true ; } return false ;


<s> if ( <ISA_LIT>CheckMnemonic ( Mnemo , FBS , Variant ) ) return true ;


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


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


<s> bool <ISA_LIT>Operand :: isU16Imm ( ) const {


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


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


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


<s> bool isVCSrcV2FP32 ( ) const { return isVCSrcF64 ( ) ;


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


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


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


<s> bool isVISrcV2B16 ( ) const { return isVISrcB16 ( ) ;


return isVISrcF16 ( ) || isVISrcB32 ( ) ;


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


<s> bool isVISrc_1024V2B16 ( ) const { return isVISrc_1024B16 ( ) ;


<s> bool isVISrc_1024V2F16 ( ) const { return isVISrc_1024F16 ( ) || isVISrc_1024B32 ( ) ;


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


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


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


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


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


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


return isVISrc_512F16 ( ) || isVISrc_512B32 ( ) ;


<s> return isVISrc_512F16 ( ) || isVISrc_512B32 ( ) ;


<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> return isRegClass ( <STR_LIT> ) || ( isRegClass ( <STR_LIT> ) && AsmParser -> getFeatureBits ( ) [ <STR_LIT> ] ) ;


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


return isVCSrcF32 ( ) || isLiteralImm ( <STR_LIT> ) || isExpr ( ) ;


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


<s> bool isVSrcF16 ( ) const { return isVCSrcF16 ( ) || isLiteralImm ( <STR_LIT> ) ;


return isVSrcB16 ( ) || isLiteralImm ( <STR_LIT> ) ;


<s> return isVSrcF16 ( ) || isLiteralImm ( <STR_LIT> ) ;


return isVSrcF64 ( ) || isLiteralImm ( <STR_LIT> ) ;


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


return isVSrcB64 ( ) || isLiteralImm ( <STR_LIT> ) ;


<s> void <ISA_LIT>AsmParser :: lex ( ) {


<s> RegisterMCAsmParser < <ISA_LIT>AsmParser > A ( getThe<ISA_LIT>Target ( ) ) ; RegisterMCAsmParser < <ISA_LIT>AsmParser > B ( getTheGCNTarget ( ) ) ;


<s> LLVM_EXTERNAL_VI<ISA_LIT>BILITY void LLVMInitialize<ISA_LIT>AsmParser ( ) { RegisterMCAsmParser < <ISA_LIT>AsmParser > A ( getThe<ISA_LIT>Target ( ) ) ; RegisterMCAsmParser < <ISA_LIT>AsmParser > B ( getTheGCNTarget ( ) ) ;


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


<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 ( ) . EmitDirectiveAMDGCNTarget ( ) ;


<s> OperandInfoTy ( int64_t Id_ ) : Id ( Id_ ) {


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


<s> if ( getParser ( ) . parseAbsoluteExpression ( Tmp ) ) { return true ; } Ret = static_cast < uint32_t > ( Tmp ) ; return false ;


<s> int64_t Tmp = - <NUM_LIT> ; if ( ! isToken ( AsmToken :: Integer ) && ! isToken ( AsmToken :: Identifier ) ) { return true ; } if ( getParser ( ) . parseAbsoluteExpression ( Tmp ) ) { return true ;


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


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseBoolReg ( OperandVector & 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 , encodeExpcnt , decodeExpcnt ) ;


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


<s> } if ( Dfmt == DFMT_UNDEF && Nfmt == NFMT_UNDEF ) return MatchOperand_NoMatch ; Dfmt = ( Dfmt == DFMT_UNDEF ) ? DFMT_DEFAULT : Dfmt ; Nfmt = ( Nfmt == NFMT_UNDEF ) ? NFMT_DEFAULT : Nfmt ; Format = encodeDfmtNfmt ( Dfmt , Nfmt ) ; return MatchOperand_Success ;


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


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


<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 ParseDirectiveAMDKernelCodeT ( ) ;


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


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


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


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


<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 , Header ) ) return true ;


<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 ) ) return true ;


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


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


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

if ( ParseAsAbsoluteExpression ( Minor ) ) return TokError ( <STR_LIT> ) ;


<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 :: AssemblerDirective ) ) ;


<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 :: Comma ) ) break ;


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


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseDPP8 ( OperandVector & Operands ) { SMLoc S = getLoc ( ) ; if ( ! isGFX10Plus ( ) || ! trySkipId ( <STR_LIT> , AsmToken :: Colon ) ) return MatchOperand_NoMatch ; int64_t Sels [ <NUM_LIT> ] ; if ( ! skipToken ( AsmToken :: LBrac , <STR_LIT> ) ) return MatchOperand_ParseFail ; for ( size_t i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { if ( i > <NUM_LIT> && ! skipToken ( AsmToken :: Comma , <STR_LIT> ) ) return MatchOperand_ParseFail ; SMLoc Loc = getLoc ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Sels [ i ] ) ) return MatchOperand_ParseFail ; if ( <NUM_LIT> > Sels [ i ] || <NUM_LIT> < Sels [ i ] ) { Error ( Loc , <STR_LIT> ) ; return MatchOperand_ParseFail ;


<s> SMLoc S = getLoc ( ) ; if ( ! isGFX10Plus ( ) || ! trySkipId ( <STR_LIT> , AsmToken :: Colon ) ) return MatchOperand_NoMatch ; int64_t Sels [ <NUM_LIT> ] ; if ( ! skipToken ( AsmToken :: LBrac , <STR_LIT> ) ) return MatchOperand_ParseFail ; for ( size_t i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { if ( i > <NUM_LIT> && ! skipToken ( AsmToken :: Comma , <STR_LIT> ) ) return MatchOperand_ParseFail ; SMLoc Loc = getLoc ( ) ; if ( getParser ( ) . parseAbsoluteExpression ( Sels [ i ] ) ) return MatchOperand_ParseFail ; if ( <NUM_LIT> > Sels [ i ] || <NUM_LIT> < Sels [ i ] ) { Error ( Loc , <STR_LIT> ) ; return MatchOperand_ParseFail ; }


<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 :: Colon , <STR_LIT> ) ) {


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


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


<s> OperandMatchResultTy <ISA_LIT>AsmParser :: parseEndpgmOp ( OperandVector & Operands ) { SMLoc S = getLoc ( ) ; int64_t Imm = <NUM_LIT> ; if ( ! parseExpr ( Imm ) ) { Imm = <NUM_LIT> ; } if ( ! isUInt < <NUM_LIT> > ( Imm ) ) { Error ( S , <STR_LIT> ) ; return MatchOperand_ParseFail ;


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


<s> using namespace llvm :: <STR_LIT> ; StringRef Str ; SMLoc S = getLoc ( ) ; if ( ! parseId ( Str ) ) return MatchOperand_NoMatch ; unsigned Id = getTgtId ( Str ) ; if ( Id == ET_INVALID || ! isSupportedTgtId ( Id , getSTI ( ) ) ) { Error ( S , ( Id == ET_INVALID ) ? <STR_LIT> : <STR_LIT> ) ; return MatchOperand_ParseFail ;


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

if ( Id == ET_INVALID || ! isSupportedTgtId ( Id , getSTI ( ) ) ) {


<s> if ( ! FormatFound ) { Res = parseSymbolicOrNumericFormat ( Format ) ; if ( Res == MatchOperand_ParseFail ) return Res ; if ( Res == MatchOperand_Success ) { auto Size = Operands . size ( ) ; <ISA_LIT>Operand & Op = static_cast < <ISA_LIT>Operand & > ( * Operands [ Size - <NUM_LIT> ] ) ; assert ( Op . isImm ( ) && Op . getImmTy ( ) == <ISA_LIT>Operand :: ImmTyFORMAT ) ; Op . setImm ( Format ) ;


<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 ) {