<s> Function * Caller = CB . getCaller ( ) ; Function * Callee = CB . getCalledFunction ( ) ; bool InlineHint = Callee && ! Callee -> isDeclaration ( ) && Callee -> hasFnAttribute ( Attribute :: InlineHint ) ; if ( InlineHint && Params . HintThreshold && Params . HintThreshold > Thres && ! Caller -> hasFnAttribute ( Attribute :: MinSize ) ) Thres = Params . HintThreshold . getValue ( ) * TTIWP -> getTTI ( * Callee ) . getInliningThresholdMultiplier ( ) ; const DataLayout & DL = Caller -> getParent ( ) -> getDataLayout ( ) ; if ( ! Callee ) return ( unsigned ) Thres ; uint64_t AllocaSize = <NUM_LIT> ; SmallPtrSet < const AllocaInst * , <NUM_LIT> > AIVisited ; for ( Value * PtrArg : CB . args ( ) ) { PointerType * Ty = dyn_cast < PointerType > ( PtrArg -> getType ( ) ) ;

if ( ! Ty || ( Ty -> getAddressSpace ( ) != <ISA_LIT>AS :: PRIVATE_ADDRESS && Ty -> getAddressSpace ( ) != <ISA_LIT>AS :: FLAT_ADDRESS ) ) continue ;


<s> Function * Callee = CB . getCalledFunction ( ) ; if ( ! Callee || Callee -> size ( ) != <NUM_LIT> ) return false ;

const BasicBlock & BB = Callee -> getEntryBlock ( ) ;


<s> Function * Callee = CB . getCalledFunction ( ) ; if ( ! Callee || Callee -> size ( ) != <NUM_LIT> ) return false ; const BasicBlock & BB = Callee -> getEntryBlock ( ) ; if ( const Instruction * I = BB . getFirstNonPHI ( ) ) {


<s> Function * Callee = CS . getCalledFunction ( ) ; Function * Caller = CS . getCaller ( ) ; TargetTransformInfo & TTI = TTIWP -> getTTI ( * Callee ) ; if ( ! Callee || Callee -> isDeclaration ( ) || CS . isNoInline ( ) || ! TTI . areInlineCompatible ( Caller , Callee ) ) return llvm :: InlineCost :: getNever ( ) ; if ( CS . hasFnAttr ( Attribute :: AlwaysInline ) ) { if ( isInlineViable ( * Callee ) ) return llvm :: InlineCost :: getAlways ( ) ; return llvm :: InlineCost :: getNever ( ) ; } if ( isWrapperOnlyCall ( CS ) ) return llvm :: InlineCost :: getAlways ( ) ; InlineParams LocalParams = Params ; LocalParams . DefaultThreshold = ( int ) getInlineThreshold ( CS ) ; bool RemarksEnabled = false ; const auto & BBs = Caller -> getBasicBlockList ( ) ; if ( ! BBs . empty ( ) ) { auto DI = OptimizationRemark ( DEBUG_TYPE , <STR_LIT> , DebugLoc ( ) , & BBs . front ( ) ) ; if ( DI . isEnabled ( ) ) RemarksEnabled = true ; }

OptimizationRemarkEmitter ORE ( Caller ) ;


<s> Function * Caller = CS . getCaller ( ) ; Function * Callee = CS . getCalledFunction ( ) ; bool InlineHint = Callee && ! Callee -> isDeclaration ( ) && Callee -> hasFnAttribute ( Attribute :: InlineHint ) ; if ( InlineHint && Params . HintThreshold && Params . HintThreshold > Thres && ! Caller -> hasFnAttribute ( Attribute :: MinSize ) ) Thres = Params . HintThreshold . getValue ( ) ; const DataLayout & DL = Caller -> getParent ( ) -> getDataLayout ( ) ; if ( ! Callee ) return ( unsigned ) Thres ;

const <ISA_LIT>AS AS = <STR_LIT> ( * Caller -> getParent ( ) ) ;


<s> Function * Callee = CS . getCalledFunction ( ) ; if ( ! Callee || Callee -> size ( ) != <NUM_LIT> ) return false ; const BasicBlock & BB = Callee -> getEntryBlock ( ) ; if ( const Instruction * I = BB . getFirstNonPHI ( ) ) { if ( ! isa < CallInst > ( I ) ) { return false ; } if ( isa < ReturnInst > ( * std :: next ( I -> getIterator ( ) ) ) ) { DEBUG ( dbgs ( ) << <STR_LIT> << Callee -> getName ( ) << '\n' ) ; return true ; }


<s> Function * Callee = CS . getCalledFunction ( ) ; Function * Caller = CS . getCaller ( ) ; if ( ! Callee || Callee -> isDeclaration ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . isNoInline ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; TargetTransformInfo & TTI = TTIWP -> getTTI ( * Callee ) ; if ( ! TTI . areInlineCompatible ( Caller , Callee ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . hasFnAttr ( Attribute :: AlwaysInline ) ) { auto IsViable = isInlineViable ( * Callee ) ; if ( IsViable ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; return llvm :: InlineCost :: getNever ( IsViable . message ) ; } if ( isWrapperOnlyCall ( CS ) ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; InlineParams LocalParams = Params ; LocalParams . DefaultThreshold = ( int ) getInlineThreshold ( CS ) ; bool RemarksEnabled = false ; const auto & BBs = Caller -> getBasicBlockList ( ) ;


<s> if ( ! Callee || Callee -> isDeclaration ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . isNoInline ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; TargetTransformInfo & TTI = TTIWP -> getTTI ( * Callee ) ; if ( ! TTI . areInlineCompatible ( Caller , Callee ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . hasFnAttr ( Attribute :: AlwaysInline ) ) { auto IsViable = isInlineViable ( * Callee ) ; if ( IsViable ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; return llvm :: InlineCost :: getNever ( IsViable . message ) ;


<s> Function * Caller = CS . getCaller ( ) ; if ( ! Callee || Callee -> isDeclaration ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . isNoInline ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; TargetTransformInfo & TTI = TTIWP -> getTTI ( * Callee ) ; if ( ! TTI . areInlineCompatible ( Caller , Callee ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . hasFnAttr ( Attribute :: AlwaysInline ) ) { auto IsViable = isInlineViable ( * Callee ) ; if ( IsViable . isSuccess ( ) ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; return llvm :: InlineCost :: getNever ( IsViable . getFailureReason ( ) ) ; } if ( isWrapperOnlyCall ( CS ) ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ;


<s> InlineParams LocalParams = Params ; LocalParams . DefaultThreshold = ( int ) getInlineThreshold ( CB ) ; bool RemarksEnabled = false ; const auto & BBs = Caller -> getBasicBlockList ( ) ; if ( ! BBs . empty ( ) ) { auto DI = OptimizationRemark ( DEBUG_TYPE , <STR_LIT> , DebugLoc ( ) , & BBs . front ( ) ) ; if ( DI . isEnabled ( ) ) RemarksEnabled = true ; } OptimizationRemarkEmitter ORE ( Caller ) ; auto GetAssumptionCache = [ this ] ( Function & F ) -> AssumptionCache & { return ACT -> getAssumptionCache ( F ) ; } ; auto IC = llvm :: getInlineCost ( CB , Callee , LocalParams , TTI , GetAssumptionCache , GetTLI , nullptr , P<ISA_LIT> , RemarksEnabled ? & ORE : nullptr ) ; if ( IC && ! IC . isAlways ( ) && ! Callee -> hasFnAttribute ( Attribute :: InlineHint ) ) { size_t Size = Caller -> size ( ) + Callee -> size ( ) - <NUM_LIT> ;

if ( MaxBB && Size > MaxBB ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ;


<s> return llvm :: InlineCost :: getNever ( IsViable . getFailureReason ( ) ) ; } if ( isWrapperOnlyCall ( CB ) ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; InlineParams LocalParams = Params ; LocalParams . DefaultThreshold = ( int ) getInlineThreshold ( CB ) ; bool RemarksEnabled = false ; const auto & BBs = Caller -> getBasicBlockList ( ) ; if ( ! BBs . empty ( ) ) { auto DI = OptimizationRemark ( DEBUG_TYPE , <STR_LIT> , DebugLoc ( ) , & BBs . front ( ) ) ; if ( DI . isEnabled ( ) ) RemarksEnabled = true ; } OptimizationRemarkEmitter ORE ( Caller ) ; auto GetAssumptionCache = [ this ] ( Function & F ) -> AssumptionCache & { return ACT -> getAssumptionCache ( F ) ; } ; auto IC = llvm :: getInlineCost ( CB , Callee , LocalParams , TTI , GetAssumptionCache , GetTLI , nullptr , P<ISA_LIT> , RemarksEnabled ? & ORE : nullptr ) ; if ( IC && ! IC . isAlways ( ) && ! Callee -> hasFnAttribute ( Attribute :: InlineHint ) ) {

size_t Size = Caller -> size ( ) + Callee -> size ( ) - <NUM_LIT> ;


<s> if ( ! Callee ) return ( unsigned ) Thres ; uint64_t AllocaSize = <NUM_LIT> ; SmallPtrSet < const AllocaInst * , <NUM_LIT> > AIVisited ; for ( Value * PtrArg : CB . args ( ) ) { PointerType * Ty = dyn_cast < PointerType > ( PtrArg -> getType ( ) ) ; if ( ! Ty || ( Ty -> getAddressSpace ( ) != <ISA_LIT>AS :: PRIVATE_ADDRESS && Ty -> getAddressSpace ( ) != <ISA_LIT>AS :: FLAT_ADDRESS ) ) continue ; PtrArg = getUnderlyingObject ( PtrArg ) ; if ( const AllocaInst * AI = dyn_cast < AllocaInst > ( PtrArg ) ) { if ( ! AI -> isStaticAlloca ( ) || ! AIVisited . insert ( AI ) . second ) continue ; AllocaSize += DL . getTypeAllocSize ( AI -> getAllocatedType ( ) ) ; if ( AllocaSize > ArgAllocaCutoff ) {


<s> if ( ! Callee || Callee -> isDeclaration ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . isNoInline ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( ! TTI . areInlineCompatible ( Caller , Callee ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . hasFnAttr ( Attribute :: AlwaysInline ) ) { auto IsViable = isInlineViable ( * Callee ) ; if ( IsViable ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; return llvm :: InlineCost :: getNever ( IsViable . message ) ; } if ( isWrapperOnlyCall ( CS ) ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; InlineParams LocalParams = Params ; LocalParams . DefaultThreshold = ( int ) getInlineThreshold ( CS ) ; bool RemarksEnabled = false ; const auto & BBs = Caller -> getBasicBlockList ( ) ;


<s> LocalParams . DefaultThreshold = ( int ) getInlineThreshold ( CS ) ; bool RemarksEnabled = false ; const auto & BBs = Caller -> getBasicBlockList ( ) ; if ( ! BBs . empty ( ) ) { auto DI = OptimizationRemark ( DEBUG_TYPE , <STR_LIT> , DebugLoc ( ) , & BBs . front ( ) ) ; if ( DI . isEnabled ( ) ) RemarksEnabled = true ; } OptimizationRemarkEmitter ORE ( Caller ) ; std :: function < AssumptionCache & ( Function & ) > GetAssumptionCache = [ this ] ( Function & F ) -> AssumptionCache & { return ACT -> getAssumptionCache ( F ) ;


<s> <ISA_LIT>Inliner ( ) : LegacyInlinerBase ( ID ) { initialize<ISA_LIT>InlinerPass ( * PassRegistry :: getPassRegistry ( ) ) ; Params = getInlineParams ( ) ;


<s> initialize<ISA_LIT>InlinerPass ( * PassRegistry :: getPassRegistry ( ) ) ;


<s> AU . addRequired < TargetTransformInfoWrapperPass > ( ) ; LegacyInlinerBase :: getAnalysisUsage ( AU ) ;


<s> void <ISA_LIT>Inliner :: getAnalysisUsage ( AnalysisUsage & AU ) const { AU . addRequired < TargetTransformInfoWrapperPass > ( ) ;

LegacyInlinerBase :: getAnalysisUsage ( AU ) ;


<s> if ( ! Callee || Callee -> isDeclaration ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . isNoInline ( ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( ! TTI . areInlineCompatible ( Caller , Callee ) ) return llvm :: InlineCost :: getNever ( <STR_LIT> ) ; if ( CS . hasFnAttr ( Attribute :: AlwaysInline ) ) { if ( isInlineViable ( * Callee ) ) return llvm :: InlineCost :: getAlways ( <STR_LIT> ) ; return llvm :: InlineCost :: getNever ( <STR_LIT> ) ;


<s> const DataLayout & DL = Caller -> getParent ( ) -> getDataLayout ( ) ; if ( ! Callee ) return ( unsigned ) Thres ; uint64_t AllocaSize = <NUM_LIT> ; SmallPtrSet < const AllocaInst * , <NUM_LIT> > AIVisited ; for ( Value * PtrArg : CS . args ( ) ) { Type * Ty = PtrArg -> getType ( ) ; if ( ! Ty -> isPointerTy ( ) || Ty -> getPointerAddressSpace ( ) != <ISA_LIT>AS :: PRIVATE_ADDRESS ) continue ;

PtrArg = GetUnderlyingObject ( PtrArg , DL ) ;


<s> Function * Callee = CS . getCalledFunction ( ) ; bool InlineHint = Callee && ! Callee -> isDeclaration ( ) && Callee -> hasFnAttribute ( Attribute :: InlineHint ) ; if ( InlineHint && Params . HintThreshold && Params . HintThreshold > Thres && ! Caller -> hasFnAttribute ( Attribute :: MinSize ) ) Thres = Params . HintThreshold . getValue ( ) ; const DataLayout & DL = Caller -> getParent ( ) -> getDataLayout ( ) ; if ( ! Callee ) return ( unsigned ) Thres ; uint64_t AllocaSize = <NUM_LIT> ; SmallPtrSet < const AllocaInst * , <NUM_LIT> > AIVisited ; for ( Value * PtrArg : CS . args ( ) ) { Type * Ty = PtrArg -> getType ( ) ; if ( ! Ty -> isPointerTy ( ) || Ty -> getPointerAddressSpace ( ) != <ISA_LIT>AS :: PRIVATE_ADDRESS ) continue ; PtrArg = GetUnderlyingObject ( PtrArg , DL ) ; if ( const AllocaInst * AI = dyn_cast < AllocaInst > ( PtrArg ) ) { if ( ! AI -> isStaticAlloca ( ) || ! AIVisited . insert ( AI ) . second ) continue ; AllocaSize += DL . getTypeAllocSize ( AI -> getAllocatedType ( ) ) ; if ( AllocaSize > ArgAllocaCutoff ) { AllocaSize = <NUM_LIT> ;


<s> Function * Callee = CS . getCalledFunction ( ) ; if ( ! Callee || Callee -> size ( ) != <NUM_LIT> ) return false ; const BasicBlock & BB = Callee -> getEntryBlock ( ) ; if ( const Instruction * I = BB . getFirstNonPHI ( ) ) { if ( ! isa < CallInst > ( I ) ) { return false ; } if ( isa < ReturnInst > ( * std :: next ( I -> getIterator ( ) ) ) ) { LLVM_DEBUG ( dbgs ( ) << <STR_LIT> << Callee -> getName ( ) << '\n' ) ; return true ; }


<s> TTIWP = & getAnalysis < TargetTransformInfoWrapperPass > ( ) ; return LegacyInlinerBase :: runOnSCC ( SCC ) ;


<s> if ( ConstantInt * ConstInt = dyn_cast < ConstantInt > ( & V ) ) { APInt IntValue ( ConstInt -> getValue ( ) ) ; return IntValue . getActiveBits ( ) <= <NUM_LIT> ; } } Value * CastSrc ; bool IsExt = IsFloat ? match ( & V , m_FPExt ( PatternMatch :: m_Value ( CastSrc ) ) ) : match ( & V , m_ZExt ( PatternMatch :: m_Value ( CastSrc ) ) ) ; if ( IsExt ) { Type * CastSrcTy = CastSrc -> getType ( ) ; if ( CastSrcTy -> isHalfTy ( ) || CastSrcTy -> isIntegerTy ( <NUM_LIT> ) ) return true ;


<s> } } else { if ( ConstantInt * ConstInt = dyn_cast < ConstantInt > ( & V ) ) { APInt IntValue ( ConstInt -> getValue ( ) ) ; return IntValue . getActiveBits ( ) <= <NUM_LIT> ; } } Value * CastSrc ; bool IsExt = IsFloat ? match ( & V , m_FPExt ( PatternMatch :: m_Value ( CastSrc ) ) ) : match ( & V , m_ZExt ( PatternMatch :: m_Value ( CastSrc ) ) ) ; if ( IsExt ) {

Type * CastSrcTy = CastSrc -> getType ( ) ;


<s> return true ; } auto * TLI = & IC . getTargetLibraryInfo ( ) ; if ( isKnownNeverInfinity ( Op0 , TLI ) && isKnownNeverNaN ( Op0 , TLI ) && isKnownNeverInfinity ( Op1 , TLI ) && isKnownNeverNaN ( Op1 , TLI ) ) { return true ; }


<s> auto * TLI = & IC . getTargetLibraryInfo ( ) ; if ( isKnownNeverInfinity ( Op0 , TLI ) && isKnownNeverNaN ( Op0 , TLI ) && isKnownNeverInfinity ( Op1 , TLI ) && isKnownNeverNaN ( Op1 , TLI ) ) {


<s> if ( VTy -> isIntegerTy ( ) ) return Builder . CreateIntCast ( & V , Type :: getInt16Ty ( V . getContext ( ) ) , false ) ; if ( VTy -> isFloatingPointTy ( ) ) return Builder . CreateFPCast ( & V , Type :: getHalfTy ( V . getContext ( ) ) ) ;


<s> if ( Cmp0 == APFloat :: cmpEqual ) return maxnum ( Src1 , Src2 ) ; APFloat :: cmpResult Cmp1 = Max3 . compare ( Src1 ) ; assert ( Cmp1 != APFloat :: cmpUnordered && <STR_LIT> ) ; if ( Cmp1 == APFloat :: cmpEqual ) return maxnum ( Src0 , Src2 ) ; return maxnum ( Src0 , Src1 ) ;


<s> if ( Cmp0 == APFloat :: cmpEqual ) return maxnum ( Src1 , Src2 ) ; APFloat :: cmpResult Cmp1 = Max3 . compare ( Src1 ) ; assert ( Cmp1 != APFloat :: cmpUnordered && <STR_LIT> ) ; if ( Cmp1 == APFloat :: cmpEqual ) return maxnum ( Src0 , Src2 ) ;


<s> SmallVector < Value * , <NUM_LIT> > Args ( OldIntr . args ( ) ) ; Func ( Args , ArgTys ) ; Function * I = <STR_LIT> ( OldIntr . getModule ( ) , NewIntr , ArgTys ) ; CallInst * NewCall = IC . Builder . CreateCall ( I , Args ) ; NewCall -> takeName ( & OldIntr ) ; NewCall -> copyMetadata ( OldIntr ) ;

if ( isa < FPMathOperator > ( NewCall ) ) NewCall -> copyFastMathFlags ( & OldIntr ) ;


<s> break ; default : OffsetIdx = InvalidOffsetIdx ; break ; } if ( OffsetIdx != InvalidOffsetIdx ) { DemandedElts &= ~ ( ( <NUM_LIT> << UnusedComponentsAtFront ) - <NUM_LIT> ) ; auto * Offset = II . getArgOperand ( OffsetIdx ) ; unsigned SingleComponentSizeInBits = IC . getDataLayout ( ) . getTypeSizeInBits ( II . getType ( ) -> getScalarType ( ) ) ; unsigned OffsetAdd = UnusedComponentsAtFront * SingleComponentSizeInBits / <NUM_LIT> ; auto * OffsetAddVal = ConstantInt :: get ( Offset -> getType ( ) , OffsetAdd ) ; Args [ OffsetIdx ] = IC . Builder . CreateAdd ( Offset , OffsetAddVal ) ; } } } else { ConstantInt * DMask = cast < ConstantInt > ( II . getArgOperand ( DMaskIdx ) ) ; unsigned DMaskVal = DMask -> getZExtValue ( ) & <NUM_LIT> ; DemandedElts &= ( <NUM_LIT> << countPopulation ( DMaskVal ) ) - <NUM_LIT> ; unsigned NewDMaskVal = <NUM_LIT> ; unsigned OrigLoadIdx = <NUM_LIT> ; for ( unsigned SrcIdx = <NUM_LIT> ; SrcIdx < <NUM_LIT> ; ++ SrcIdx ) { const unsigned Bit = <NUM_LIT> << SrcIdx ; if ( ! ! ( DMaskVal & Bit ) ) { if ( ! ! DemandedElts [ OrigLoadIdx ] ) NewDMaskVal |= Bit ; OrigLoadIdx ++ ; } } if ( DMaskVal != NewDMaskVal ) Args [ DMaskIdx ] = ConstantInt :: get ( DMask -> getType ( ) , NewDMaskVal ) ; } unsigned NewNumElts = DemandedElts . countPopulation ( ) ; if ( ! NewNumElts ) return UndefValue :: get ( II . getType ( ) ) ; if ( NewNumElts >= VWidth && DemandedElts . isMask ( ) ) {

if ( DMaskIdx >= <NUM_LIT> ) II . setArgOperand ( DMaskIdx , Args [ DMaskIdx ] ) ;


<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 simplifyAMDGCNMemoryIntrinsicDemanded ( IC , II , DemandedElts ) ; default : {

if ( get<ISA_LIT>ImageDMaskIntrinsic ( II . getIntrinsicID ( ) ) ) {


<s> static Optional < Instruction * > simplifyAMDGCNImageIntrinsic ( const GCNSubtarget * ST , const <STR_LIT> * ImageDimIntr , IntrinsicInst & II , InstCombiner & IC ) { if ( ! ST -> hasA16 ( ) && ! ST -> hasG16 ( ) ) return None ; bool FloatCoord = false ; bool OnlyDerivatives = false ; for ( unsigned OperandIndex = ImageDimIntr -> GradientStart ; OperandIndex < ImageDimIntr -> VAddrEnd ; OperandIndex ++ ) { Value * Coord = II . getOperand ( OperandIndex ) ; if ( ! canSafelyConvertTo16Bit ( * Coord ) ) { if ( OperandIndex < ImageDimIntr -> CoordStart || ImageDimIntr -> GradientStart == ImageDimIntr -> CoordStart ) { return None ; } OnlyDerivatives = true ; break ; } assert ( OperandIndex == ImageDimIntr -> GradientStart || FloatCoord == Coord -> getType ( ) -> isFloatingPointTy ( ) ) ; FloatCoord = Coord -> getType ( ) -> isFloatingPointTy ( ) ; } if ( OnlyDerivatives ) { if ( ! ST -> hasG16 ( ) ) return None ;


<s> Function * I = <STR_LIT> ( II . getModule ( ) , NewIntr , ArgTys ) ; CallInst * NewCall = IC . Builder . CreateCall ( I , Args ) ; NewCall -> takeName ( & II ) ; NewCall -> copyMetadata ( II ) ; if ( isa < FPMathOperator > ( NewCall ) ) NewCall -> copyFastMathFlags ( & II ) ; if ( ! II . getType ( ) -> isVoidTy ( ) ) IC . replaceInstUsesWith ( II , NewCall ) ;

return IC . eraseInstFromFunction ( II ) ;


<s> if ( auto * ConstantMip = dyn_cast < ConstantInt > ( II . getOperand ( ImageDimIntr -> MipIndex ) ) ) { if ( ConstantMip -> isZero ( ) ) { const <STR_LIT> * NewImageDimIntr = <STR_LIT> ( MIPMappingInfo -> NONMIP , ImageDimIntr -> Dim ) ; return modifyIntrinsicCall ( II , NewImageDimIntr -> Intr , IC , [ & ] ( auto & Args , auto & ArgTys ) { Args . erase ( Args . begin ( ) + ImageDimIntr -> MipIndex ) ; } ) ; } } } if ( const auto * BiasMappingInfo = <STR_LIT> ( ImageDimIntr -> BaseOpcode ) ) { if ( auto * ConstantBias = dyn_cast < ConstantFP > ( II . getOperand ( ImageDimIntr -> BiasIndex ) ) ) { if ( ConstantBias -> isZero ( ) ) { const <STR_LIT> * NewImageDimIntr = <STR_LIT> ( BiasMappingInfo -> NoBias , ImageDimIntr -> Dim ) ; return modifyIntrinsicCall ( II , NewImageDimIntr -> Intr , IC , [ & ] ( auto & Args , auto & ArgTys ) { Args . erase ( Args . begin ( ) + ImageDimIntr -> BiasIndex ) ; ArgTys . erase ( ArgTys . begin ( ) + ImageDimIntr -> BiasTyArg ) ; } ) ; } } } if ( const auto * OffsetMappingInfo = <STR_LIT> ( ImageDimIntr -> BaseOpcode ) ) { if ( auto * ConstantOffset = dyn_cast < ConstantInt > ( II . getOperand ( ImageDimIntr -> OffsetIndex ) ) ) { if ( ConstantOffset -> isZero ( ) ) { const <STR_LIT> * NewImageDimIntr = <STR_LIT> ( OffsetMappingInfo -> NoOffset , ImageDimIntr -> Dim ) ; return modifyIntrinsicCall ( II , NewImageDimIntr -> Intr , IC , [ & ] ( auto & Args , auto & ArgTys ) { Args . erase ( Args . begin ( ) + ImageDimIntr -> OffsetIndex ) ; } ) ; } } } if ( ! ST -> hasA16 ( ) && ! ST -> hasG16 ( ) ) return None ; bool HasSampler = <STR_LIT> ( ImageDimIntr -> BaseOpcode ) -> Sampler ; bool FloatCoord = false ; bool OnlyDerivatives = false ; for ( unsigned OperandIndex = ImageDimIntr -> GradientStart ; OperandIndex < ImageDimIntr -> VAddrEnd ; OperandIndex ++ ) { Value * Coord = II . getOperand ( OperandIndex ) ; if ( ! canSafelyConvertTo16Bit ( * Coord , HasSampler ) ) { if ( OperandIndex < ImageDimIntr -> CoordStart || ImageDimIntr -> GradientStart == ImageDimIntr -> CoordStart ) { return None ; } OnlyDerivatives = true ; break ;


<s> break ; } if ( OffsetIdx != InvalidOffsetIdx ) { DemandedElts &= ~ ( ( <NUM_LIT> << UnusedComponentsAtFront ) - <NUM_LIT> ) ; auto * Offset = II . getArgOperand ( OffsetIdx ) ; unsigned SingleComponentSizeInBits = IC . getDataLayout ( ) . getTypeSizeInBits ( II . getType ( ) -> getScalarType ( ) ) ; unsigned OffsetAdd = UnusedComponentsAtFront * SingleComponentSizeInBits / <NUM_LIT> ; auto * OffsetAddVal = ConstantInt :: get ( Offset -> getType ( ) , OffsetAdd ) ; Args [ OffsetIdx ] = IC . Builder . CreateAdd ( Offset , OffsetAddVal ) ; } } } else { ConstantInt * DMask = cast < ConstantInt > ( II . getArgOperand ( DMaskIdx ) ) ; unsigned DMaskVal = DMask -> getZExtValue ( ) & <NUM_LIT> ; DemandedElts &= ( <NUM_LIT> << countPopulation ( DMaskVal ) ) - <NUM_LIT> ; unsigned NewDMaskVal = <NUM_LIT> ; unsigned OrigLoadIdx = <NUM_LIT> ; for ( unsigned SrcIdx = <NUM_LIT> ; SrcIdx < <NUM_LIT> ; ++ SrcIdx ) { const unsigned Bit = <NUM_LIT> << SrcIdx ; if ( ! ! ( DMaskVal & Bit ) ) { if ( ! ! DemandedElts [ OrigLoadIdx ] ) NewDMaskVal |= Bit ; OrigLoadIdx ++ ; } } if ( DMaskVal != NewDMaskVal ) Args [ DMaskIdx ] = ConstantInt :: get ( DMask -> getType ( ) , NewDMaskVal ) ; } unsigned NewNumElts = DemandedElts . countPopulation ( ) ; if ( ! NewNumElts ) return UndefValue :: get ( II . getType ( ) ) ; if ( NewNumElts >= VWidth && DemandedElts . isMask ( ) ) { if ( DMaskIdx >= <NUM_LIT> ) II . setArgOperand ( DMaskIdx , Args [ DMaskIdx ] ) ; return nullptr ; } SmallVector < Type * , <NUM_LIT> > OverloadTys ;

if ( ! <STR_LIT> ( II . getCalledFunction ( ) , OverloadTys ) ) return nullptr ;


<s> unsigned NewDMaskVal = <NUM_LIT> ; unsigned OrigLoadIdx = <NUM_LIT> ; for ( unsigned SrcIdx = <NUM_LIT> ; SrcIdx < <NUM_LIT> ; ++ SrcIdx ) { const unsigned Bit = <NUM_LIT> << SrcIdx ; if ( ! ! ( DMaskVal & Bit ) ) { if ( ! ! DemandedElts [ OrigLoadIdx ] ) NewDMaskVal |= Bit ; OrigLoadIdx ++ ; } } if ( DMaskVal != NewDMaskVal ) Args [ DMaskIdx ] = ConstantInt :: get ( DMask -> getType ( ) , NewDMaskVal ) ; } unsigned NewNumElts = DemandedElts . countPopulation ( ) ; if ( ! NewNumElts ) return UndefValue :: get ( II . getType ( ) ) ; if ( II . getType ( ) -> getScalarSizeInBits ( ) == <NUM_LIT> && NewNumElts == <NUM_LIT> ) return nullptr ; if ( NewNumElts >= VWidth && DemandedElts . isMask ( ) ) { if ( DMaskIdx >= <NUM_LIT> ) II . setArgOperand ( DMaskIdx , Args [ DMaskIdx ] ) ; return nullptr ; } SmallVector < Type * , <NUM_LIT> > OverloadTys ; if ( ! <STR_LIT> ( II . getCalledFunction ( ) , OverloadTys ) ) return nullptr ; Module * M = II . getParent ( ) -> getParent ( ) -> getParent ( ) ; Type * EltTy = IIVTy -> getElementType ( ) ; Type * NewTy = ( NewNumElts == <NUM_LIT> ) ? EltTy : FixedVectorType :: get ( EltTy , NewNumElts ) ; OverloadTys [ <NUM_LIT> ] = NewTy ;

Function * NewIntrin = <STR_LIT> ( M , II . getIntrinsicID ( ) , OverloadTys ) ;


<s> OffsetIdx = <NUM_LIT> ; break ; case <STR_LIT> : if ( ActiveBits == <NUM_LIT> && UnusedComponentsAtFront == <NUM_LIT> ) OffsetIdx = InvalidOffsetIdx ; else OffsetIdx = <NUM_LIT> ; break ; case <STR_LIT> : OffsetIdx = <NUM_LIT> ; break ; default : OffsetIdx = InvalidOffsetIdx ; break ; } if ( OffsetIdx != InvalidOffsetIdx ) { DemandedElts &= ~ ( ( <NUM_LIT> << UnusedComponentsAtFront ) - <NUM_LIT> ) ; auto * Offset = II . getArgOperand ( OffsetIdx ) ; unsigned SingleComponentSizeInBits = IC . getDataLayout ( ) . getTypeSizeInBits ( II . getType ( ) -> getScalarType ( ) ) ; unsigned OffsetAdd = UnusedComponentsAtFront * SingleComponentSizeInBits / <NUM_LIT> ; auto * OffsetAddVal = ConstantInt :: get ( Offset -> getType ( ) , OffsetAdd ) ; Args [ OffsetIdx ] = IC . Builder . CreateAdd ( Offset , OffsetAddVal ) ; } } } else { ConstantInt * DMask = cast < ConstantInt > ( II . getArgOperand ( DMaskIdx ) ) ; unsigned DMaskVal = DMask -> getZExtValue ( ) & <NUM_LIT> ; DemandedElts &= ( <NUM_LIT> << countPopulation ( DMaskVal ) ) - <NUM_LIT> ; unsigned NewDMaskVal = <NUM_LIT> ; unsigned OrigLoadIdx = <NUM_LIT> ; for ( unsigned SrcIdx = <NUM_LIT> ; SrcIdx < <NUM_LIT> ; ++ SrcIdx ) { const unsigned Bit = <NUM_LIT> << SrcIdx ; if ( ! ! ( DMaskVal & Bit ) ) { if ( ! ! DemandedElts [ OrigLoadIdx ] ) NewDMaskVal |= Bit ; OrigLoadIdx ++ ; } } if ( DMaskVal != NewDMaskVal ) Args [ DMaskIdx ] = ConstantInt :: get ( DMask -> getType ( ) , NewDMaskVal ) ; } unsigned NewNumElts = DemandedElts . countPopulation ( ) ; if ( ! NewNumElts ) return UndefValue :: get ( II . getType ( ) ) ; if ( II . getType ( ) -> getScalarSizeInBits ( ) == <NUM_LIT> && NewNumElts == <NUM_LIT> ) return nullptr ; if ( NewNumElts >= VWidth && DemandedElts . isMask ( ) ) { if ( DMaskIdx >= <NUM_LIT> ) II . setArgOperand ( DMaskIdx , Args [ DMaskIdx ] ) ; return nullptr ; }

SmallVector < Type * , <NUM_LIT> > OverloadTys ;


<s> Value * convertTo16Bit ( Value & V , InstCombiner :: BuilderTy & Builder ) { Type * VTy = V . getType ( ) ; if ( isa < FPExtInst > ( & V ) || isa < SExtInst > ( & V ) || isa < ZExtInst > ( & V ) ) return cast < Instruction > ( & V ) -> getOperand ( <NUM_LIT> ) ; if ( VTy -> isIntegerTy ( ) ) return Builder . CreateIntCast ( & V , Type :: getInt16Ty ( V . getContext ( ) ) , false ) ;

if ( VTy -> isFloatingPointTy ( ) ) return Builder . CreateFPCast ( & V , Type :: getHalfTy ( V . getContext ( ) ) ) ;


<s> if ( VTy -> isIntegerTy ( ) ) return Builder . CreateIntCast ( & V , Type :: getInt16Ty ( V . getContext ( ) ) , false ) ;


<s> } Value * CastSrc ; if ( match ( & V , m_FPExt ( PatternMatch :: m_Value ( CastSrc ) ) ) || match ( & V , m_SExt ( PatternMatch :: m_Value ( CastSrc ) ) ) || match ( & V , m_ZExt ( PatternMatch :: m_Value ( CastSrc ) ) ) ) { Type * CastSrcTy = CastSrc -> getType ( ) ; if ( CastSrcTy -> isHalfTy ( ) || CastSrcTy -> isIntegerTy ( <NUM_LIT> ) ) return true ; } return false ;


<s> } if ( OnlyDerivatives ) { if ( ! ST -> hasG16 ( ) ) return None ; } else { if ( ! ST -> hasA16 ( ) ) OnlyDerivatives = true ; } Type * CoordType = FloatCoord ? Type :: getHalfTy ( II . getContext ( ) ) : Type :: getInt16Ty ( II . getContext ( ) ) ; SmallVector < Type * , <NUM_LIT> > ArgTys ; if ( ! <STR_LIT> ( II . getCalledFunction ( ) , ArgTys ) ) return None ; ArgTys [ ImageDimIntr -> GradientTyArg ] = CoordType ; if ( ! OnlyDerivatives ) ArgTys [ ImageDimIntr -> CoordTyArg ] = CoordType ; Function * I = <STR_LIT> ( II . getModule ( ) , II . getIntrinsicID ( ) , ArgTys ) ;

SmallVector < Value * , <NUM_LIT> > Args ( II . args ( ) ) ;


<s> <ISA_LIT>InstPrinter ( const MCAsmInfo & MAI , const MCInstrInfo & MII , const MCRegisterInfo & MRI ) : MCInstPrinter ( MAI , MII , MRI ) {


<s> printU4ImmOperand ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printBankMaskOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { O << <STR_LIT> ; printU4ImmOperand ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printBoundCtrlOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm ) { O << <STR_LIT> ; }


<s> } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( Imm == <NUM_LIT> ) {


<s> } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) {


<s> void <ISA_LIT>InstPrinter :: printGLC ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {

printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printGLC ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> int64_t <ISA_LIT>mm = static_cast < int64_t > ( Imm ) ; if ( <ISA_LIT>mm >= - <NUM_LIT> && <ISA_LIT>mm <= <NUM_LIT> ) { O << <ISA_LIT>mm ; return ; } if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else {

assert ( isUInt < <NUM_LIT> > ( Imm ) ) ;


<s> void <ISA_LIT>InstPrinter :: printLWE ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> if ( MI -> getOperand ( OpNo ) . getImm ( ) ) {


<s> void <ISA_LIT>InstPrinter :: printR128 ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> O << <STR_LIT> ; printU4ImmOperand ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printTFE ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printU4ImmOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { O << formatHex ( MI -> getOperand ( OpNo ) . getImm ( ) & <NUM_LIT> ) ;


<s> O << formatHex ( MI -> getOperand ( OpNo ) . getImm ( ) & <NUM_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printUNorm ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ;

else if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printVOPDst ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ; else if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ;


<s> <ISA_LIT>InstPrinter ( const MCAsmInfo & MAI , const MCInstrInfo & MII , const MCRegisterInfo & MRI ) : MCInstPrinter ( MAI , MII , MRI ) {


<s> static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printAbs ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printAbs ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printAbs ( MI , OpNo , O ) ;


<s> static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printBankSwizzle ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printClamp ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printClamp ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printCT ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printCT ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printDFMT ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

if ( MI -> getOperand ( OpNo ) . getImm ( ) ) {


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm <= <NUM_LIT> ) { O << <STR_LIT> ; O << formatDec ( Imm & <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ']' ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= <NUM_LIT> ) && ( Imm <= <NUM_LIT> ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) { O << <STR_LIT> ; } else if ( Imm == <NUM_LIT> ) {


<s> void <ISA_LIT>InstPrinter :: printImmediate64 ( uint64_t Imm , const MCSubtargetInfo & STI , raw_ostream & O ) { int64_t <ISA_LIT>mm = static_cast < int64_t > ( Imm ) ; if ( <ISA_LIT>mm >= - <NUM_LIT> && <ISA_LIT>mm <= <NUM_LIT> ) { O << <ISA_LIT>mm ; return ; } if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ;


<s> O << <ISA_LIT>mm ; return ; } if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printKCache ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printKCache ( MI , OpNo , O ) ;


<s> static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printLast ( MI , OpNo , O ) ;


<s> static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printLiteral ( MI , OpNo , O ) ;


<s> } printOperand ( MI , OpNo , STI , O ) ; O << <STR_LIT> ; printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ;


<s> return ; } printOperand ( MI , OpNo , STI , O ) ; O << <STR_LIT> ;

printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printNeg ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printNeg ( MI , OpNo , O ) ;


<s> static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printNeg ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printNFMT ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( MI -> getOperand ( OpNo ) . getImm ( ) ) { O << <STR_LIT> ;

printU8ImmDecOperand ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printOMOD ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printOMOD ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printOMOD ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printOMOD ( MI , OpNo , O ) ;


<s> } else if ( Op . isImm ( ) ) { O << Op . getImm ( ) ; } else if ( Op . isFPImm ( ) ) { if ( Op . getFPImm ( ) == <NUM_LIT> ) O << <STR_LIT> ; else { O << Op . getFPImm ( ) ; } } else if ( Op . isExpr ( ) ) { const MCExpr * Exp = Op . getExpr ( ) ;


<s> void <ISA_LIT>InstPrinter :: printR128 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> void <ISA_LIT>InstPrinter :: printRel ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printRel ( MI , OpNo , O ) ;


<s> static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printRSel ( MI , OpNo , O ) ;


<s>
<STR_LIT>
::
IsaVersion
ISA
=
<STR_LIT>
::
getIsaVersion
(
STI
.
getFeatureBits
(
)
)
;
unsigned
<ISA_LIT>mm16
=
MI
->
getOperand
(
OpNo
)
.
getImm
(
)
;
unsigned
Vmcnt
,
Expcnt
,
Lgkmcnt
;
decodeWaitcnt
(
ISA
,
<ISA_LIT>mm16
,
Vmcnt
,
Expcnt
,
Lgkmcnt
)
;
bool
NeedSpace
=
false
;
if
(
Vmcnt
!=
getVmcntBitMask
(
ISA
)
)
{
O
<<
<STR_LIT>
<<
Vmcnt
<<
')'
;
NeedSpace
=
true
;
}
if
(
Expcnt
!=
getExpcntBitMask
(
ISA
)
)
{
if
(
NeedSpace
)
O
<<
' '
;
O
<<
<STR_LIT>
<<
Expcnt
<<
')'
;


<s> unsigned <ISA_LIT>mm16 = MI -> getOperand ( OpNo ) . getImm ( ) ; unsigned Vmcnt , Expcnt , Lgkmcnt ; decodeWaitcnt ( ISA , <ISA_LIT>mm16 , Vmcnt , Expcnt , Lgkmcnt ) ; bool NeedSpace = false ; if ( Vmcnt != getVmcntBitMask ( ISA ) ) { O << <STR_LIT> << Vmcnt << ')' ; NeedSpace = true ; }

if ( Expcnt != getExpcntBitMask ( ISA ) ) {


<s> void <ISA_LIT>InstPrinter :: printWrite ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printWrite ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printWrite ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { static_cast < <ISA_LIT>InstPrinter * > ( this ) -> printWrite ( MI , OpNo , O ) ;


<s> <ISA_LIT>InstPrinter ( const MCAsmInfo & MAI , const MCInstrInfo & MII , const MCRegisterInfo & MRI ) : <ISA_LIT>InstPrinter ( MAI , MII , MRI ) {


<s> void <ISA_LIT>InstPrinter :: printABID ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ;


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( ! Imm ) return ;


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( ! Imm ) return ; O << <STR_LIT> << Imm ;


<s> void <ISA_LIT>InstPrinter :: printCBSZ ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ;


<s> printRegOperand ( STI . getFeatureBits ( ) [ <STR_LIT> ] ? <STR_LIT> : <STR_LIT> , O , MRI ) ; if ( OpNo == <NUM_LIT> ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printDim ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { unsigned Dim = MI -> getOperand ( OpNo ) . getImm ( ) ;


<s> if ( <STR_LIT> ( STI ) ) printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printDLC ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

if ( <STR_LIT> ( STI ) ) printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; O << <STR_LIT> << formatDec ( Imm & <NUM_LIT> ) ;

for ( size_t i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) {


<s> O << <STR_LIT> ; O << formatDec ( Imm & <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ']' ; } else if ( ( Imm >= DppCtrl :: ROW_SHL_FIRST ) && ( Imm <= DppCtrl :: ROW_SHL_LAST ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= DppCtrl :: ROW_SHR_FIRST ) && ( Imm <= DppCtrl :: ROW_SHR_LAST ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= DppCtrl :: ROW_ROR_FIRST ) && ( Imm <= DppCtrl :: ROW_ROR_LAST ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( Imm == DppCtrl :: WAVE_SHL1 ) { if ( ! <STR_LIT> ( STI ) && ! <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_ROL1 ) { if ( ! <STR_LIT> ( STI ) && ! <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_SHR1 ) { if ( ! <STR_LIT> ( STI ) && ! <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_ROR1 ) { if ( ! <STR_LIT> ( STI ) && ! <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: ROW_MIRROR ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: ROW_HALF_MIRROR ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: BCAST15 ) {


<s> void <ISA_LIT>InstPrinter :: printExpTgt ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { uint32_t Tgt = MI -> getOperand ( OpNo ) . getImm ( ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; if ( Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt ; else if ( Tgt == <NUM_LIT> ) O << <STR_LIT> ; else if ( Tgt == <NUM_LIT> ) O << <STR_LIT> ; else if ( ( Tgt >= <NUM_LIT> && Tgt <= <NUM_LIT> ) || ( Tgt == <NUM_LIT> && <STR_LIT> ( STI ) ) ) O << <STR_LIT> << Tgt - <NUM_LIT> ; else if ( <STR_LIT> ( STI ) && Tgt == <NUM_LIT> ) O << <STR_LIT> ; else if ( Tgt >= <NUM_LIT> && Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt - <NUM_LIT> ; else { O << <STR_LIT> << Tgt ; }


<s> void <ISA_LIT>InstPrinter :: printFI ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { using namespace llvm :: <STR_LIT> ;


<s> using namespace llvm :: <STR_LIT> ; unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm == DPP_FI_1 || Imm == DPP8_FI_1 ) { O << <STR_LIT> ;


<s> if ( <STR_LIT> ( STI ) ) { O << formatDec ( SignExtend32 < <NUM_LIT> > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ; } else { O << formatDec ( SignExtend32 < <NUM_LIT> > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ;


<s> void <ISA_LIT>InstPrinter :: printFORMAT ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( unsigned Val = MI -> getOperand ( OpNo ) . getImm ( ) ) { if ( <STR_LIT> ( STI ) ) O << <STR_LIT> << Val ; else { O << <STR_LIT> << ( Val & <NUM_LIT> ) ; O << <STR_LIT> << ( Val >> <NUM_LIT> ) ;


<s> O << <STR_LIT> ; if ( ! HwRegName . empty ( ) ) { O << HwRegName ; } else { O << Id ; } if ( Width != WIDTH_DEFAULT_ || Offset != OFFSET_DEFAULT_ ) {

O << <STR_LIT> << Offset << <STR_LIT> << Width ;


<s> } const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . isReg ( ) ) { printRegOperand ( Op . getReg ( ) , O , MRI ) ; } else if ( Op . isImm ( ) ) { switch ( Desc . OpInfo [ OpNo ] . OperandType ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case MCOI :: OPERAND_IMMEDIATE : printImmediate32 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate64 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate16 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( ! isUInt < <NUM_LIT> > ( Op . getImm ( ) ) && STI . getFeatureBits ( ) [ <STR_LIT> ] ) { printImmediate32 ( Op . getImm ( ) , STI , O ) ; break ; } LLVM_FALLTHROUGH ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediateV216 ( Op . getImm ( ) , STI , O ) ; break ; case MCOI :: OPERAND_UNKNOWN : case MCOI :: OPERAND_PCREL : O << formatDec ( Op . getImm ( ) ) ; break ; case MCOI :: OPERAND_REGISTER : O << <STR_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isFPImm ( ) ) { if ( Op . getFPImm ( ) == <NUM_LIT> ) O << <STR_LIT> ; else { const MCInstrDesc & Desc = MII . get ( MI -> getOpcode ( ) ) ; int RCID = Desc . OpInfo [ OpNo ] . RegClass ; unsigned RCBits = <STR_LIT> ( MRI . getRegClass ( RCID ) ) ; if ( RCBits == <NUM_LIT> ) printImmediate32 ( FloatToBits ( Op . getFPImm ( ) ) , STI , O ) ; else if ( RCBits == <NUM_LIT> ) printImmediate64 ( DoubleToBits ( Op . getFPImm ( ) ) , STI , O ) ; else llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isExpr ( ) ) { const MCExpr * Exp = Op . getExpr ( ) ; Exp -> print ( O , & MAI ) ; } else { O << <STR_LIT> ; } switch ( MI -> getOpcode ( ) ) {


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate64 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate16 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( ! isUInt < <NUM_LIT> > ( Op . getImm ( ) ) && STI . getFeatureBits ( ) [ <STR_LIT> ] ) { printImmediate32 ( Op . getImm ( ) , STI , O ) ; break ; } LLVM_FALLTHROUGH ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediateV216 ( Op . getImm ( ) , STI , O ) ; break ; case MCOI :: OPERAND_UNKNOWN : case MCOI :: OPERAND_PCREL : O << formatDec ( Op . getImm ( ) ) ; break ; case MCOI :: OPERAND_REGISTER : O << <STR_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isFPImm ( ) ) { if ( Op . getFPImm ( ) == <NUM_LIT> ) O << <STR_LIT> ; else { const MCInstrDesc & Desc = MII . get ( MI -> getOpcode ( ) ) ; int RCID = Desc . OpInfo [ OpNo ] . RegClass ; unsigned RCBits = <STR_LIT> ( MRI . getRegClass ( RCID ) ) ; if ( RCBits == <NUM_LIT> ) printImmediate32 ( FloatToBits ( Op . getFPImm ( ) ) , STI , O ) ; else if ( RCBits == <NUM_LIT> ) printImmediate64 ( DoubleToBits ( Op . getFPImm ( ) ) , STI , O ) ; else llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isExpr ( ) ) { const MCExpr * Exp = Op . getExpr ( ) ; Exp -> print ( O , & MAI ) ; } else { O << <STR_LIT> ; } switch ( MI -> getOpcode ( ) ) { default : break ;


<s> unsigned InputModifiers = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( InputModifiers & <STR_LIT> ) O << <STR_LIT> ; printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ; if ( InputModifiers & <STR_LIT> ) O << ')' ; switch ( MI -> getOpcode ( ) ) { default : break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( ( int ) OpNo + <NUM_LIT> == <STR_LIT> ( MI -> getOpcode ( ) , <STR_LIT> :: src1 ) ) printDefaultVccOperand ( OpNo , STI , O ) ; break ; }


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( ( int ) OpNo + <NUM_LIT> == <STR_LIT> ( MI -> getOpcode ( ) , <STR_LIT> :: src1 ) ) printDefaultVccOperand ( OpNo , STI , O ) ;


<s> llvm_unreachable ( <STR_LIT> ) ; case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; }


<s> if ( msgSupportsStream ( MsgId , OpId ) ) { O << <STR_LIT> << StreamId ; } } O << ')' ; } else if ( encodeMsg ( MsgId , OpId , StreamId ) == Imm16 ) { O << <STR_LIT> << MsgId << <STR_LIT> << OpId << <STR_LIT> << StreamId << ')' ; } else { O << Imm16 ; }


<s> if ( isValidMsgId ( MsgId , STI ) && isValidMsgOp ( MsgId , OpId ) && isValidMsgStream ( MsgId , OpId , StreamId ) ) { O << <STR_LIT> << getMsgName ( MsgId ) ; if ( msgRequiresOp ( MsgId ) ) { O << <STR_LIT> << getMsgOpName ( MsgId , OpId ) ; if ( msgSupportsStream ( MsgId , OpId ) ) { O << <STR_LIT> << StreamId ; } } O << ')' ;

} else if ( encodeMsg ( MsgId , OpId , StreamId ) == Imm16 ) {


<s> using namespace llvm :: <STR_LIT> ; uint16_t Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm == <NUM_LIT> ) { return ; } O << <STR_LIT> ; if ( ( Imm & QUAD_PERM_ENC_MASK ) == QUAD_PERM_ENC ) { O << <STR_LIT> << IdSymbolic [ ID_QUAD_PERM ] ; for ( unsigned I = <NUM_LIT> ; I < LANE_NUM ; ++ I ) { O << <STR_LIT> ; O << formatDec ( Imm & LANE_MASK ) ; Imm >>= LANE_SHIFT ; } O << <STR_LIT> ; } else if ( ( Imm & BITMASK_PERM_ENC_MASK ) == BITMASK_PERM_ENC ) { uint16_t AndMask = ( Imm >> BITMASK_AND_SHIFT ) & BITMASK_MASK ; uint16_t OrMask = ( Imm >> BITMASK_OR_SHIFT ) & BITMASK_MASK ; uint16_t XorMask = ( Imm >> BITMASK_XOR_SHIFT ) & BITMASK_MASK ; if ( AndMask == BITMASK_MAX && OrMask == <NUM_LIT> && countPopulation ( XorMask ) == <NUM_LIT> ) { O << <STR_LIT> << IdSymbolic [ ID_SWAP ] ; O << <STR_LIT> ; O << formatDec ( XorMask ) ; O << <STR_LIT> ; } else if ( AndMask == BITMASK_MAX && OrMask == <NUM_LIT> && XorMask > <NUM_LIT> && isPowerOf2_64 ( XorMask + <NUM_LIT> ) ) { O << <STR_LIT> << IdSymbolic [ ID_REVERSE ] ; O << <STR_LIT> ; O << formatDec ( XorMask + <NUM_LIT> ) ; O << <STR_LIT> ; } else { uint16_t GroupSize = BITMASK_MAX - AndMask + <NUM_LIT> ; if ( GroupSize > <NUM_LIT> && isPowerOf2_64 ( GroupSize ) && OrMask < GroupSize && XorMask == <NUM_LIT> ) { O << <STR_LIT> << IdSymbolic [ ID_BROADCAST ] ; O << <STR_LIT> ; O << formatDec ( GroupSize ) ; O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printSWZ ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> if ( ( Val & ~ ENABLE_MASK ) != <NUM_LIT> ) { O << <STR_LIT> << formatHex ( static_cast < uint64_t > ( Val ) ) ; } else { O << <STR_LIT> ; bool NeedComma = false ; for ( unsigned ModeId = ID_MIN ; ModeId <= ID_MAX ; ++ ModeId ) { if ( Val & ( <NUM_LIT> << ModeId ) ) {


<s> else if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ; else if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ; else O << <STR_LIT> ; } printOperand ( MI , OpNo , STI , O ) ; switch ( MI -> getOpcode ( ) ) { default : break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> :


<s> if ( ! ! ( Ops [ I ] & Mod ) != DefaultValue ) return false ; } return true ;


<s> if ( ! ! ( Ops [ I ] & Mod ) != DefaultValue ) return false ; }


<s> void <ISA_LIT>InstPrinter :: printAbs ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> :


<s> void <ISA_LIT>InstPrinter :: printClamp ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printClamp ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> using namespace llvm :: <STR_LIT> ; unsigned <ISA_LIT>mm16 = MI -> getOperand ( OpNo ) . getImm ( ) ; const unsigned Id = ( <ISA_LIT>mm16 & ID_MASK_ ) >> ID_SHIFT_ ; const unsigned Offset = ( <ISA_LIT>mm16 & OFFSET_MASK_ ) >> OFFSET_SHIFT_ ; const unsigned Width = ( ( <ISA_LIT>mm16 & WIDTH_M1_MASK_ ) >> WIDTH_M1_SHIFT_ ) + <NUM_LIT> ;


<s> using namespace llvm :: <STR_LIT> ; unsigned <ISA_LIT>mm16 = MI -> getOperand ( OpNo ) . getImm ( ) ; const unsigned Id = ( <ISA_LIT>mm16 & ID_MASK_ ) >> ID_SHIFT_ ; const unsigned Offset = ( <ISA_LIT>mm16 & OFFSET_MASK_ ) >> OFFSET_SHIFT_ ; const unsigned Width = ( ( <ISA_LIT>mm16 & WIDTH_M1_MASK_ ) >> WIDTH_M1_SHIFT_ ) + <NUM_LIT> ; O << <STR_LIT> ; if ( ID_SYMBOLIC_FIRST_ <= Id && Id < ID_SYMBOLIC_LAST_ ) { O << IdSymbolic [ Id ] ; } else { O << Id ; } if ( Width != WIDTH_M1_DEFAULT_ + <NUM_LIT> || Offset != OFFSET_DEFAULT_ ) { O << <STR_LIT> << Offset << <STR_LIT> << Width ;


<s> assert ( Lo16 == static_cast < uint16_t > ( Imm >> <NUM_LIT> ) ) ; printImmediate16 ( Lo16 , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printKCache ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { int KCacheMode = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( KCacheMode > <NUM_LIT> ) { int KCacheBank = MI -> getOperand ( OpNo - <NUM_LIT> ) . getImm ( ) ; O << <STR_LIT> << KCacheBank << ':' ; int KCacheAddr = MI -> getOperand ( OpNo + <NUM_LIT> ) . getImm ( ) ; int LineSize = ( KCacheMode == <NUM_LIT> ) ? <NUM_LIT> : <NUM_LIT> ; O << KCacheAddr * <NUM_LIT> << '-' << KCacheAddr * <NUM_LIT> + LineSize ; }


<s> int KCacheAddr = MI -> getOperand ( OpNo + <NUM_LIT> ) . getImm ( ) ; int LineSize = ( KCacheMode == <NUM_LIT> ) ? <NUM_LIT> : <NUM_LIT> ; O << KCacheAddr * <NUM_LIT> << '-' << KCacheAddr * <NUM_LIT> + LineSize ; }


<s> printIfSet ( MI , OpNo , O , <STR_LIT> , <STR_LIT> ) ;


<s> if ( Op . isImm ( ) ) { int64_t Imm = Op . getImm ( ) ; O << Imm << '(' << BitsToFloat ( Imm ) << ')' ; } if ( Op . isExpr ( ) ) { Op . getExpr ( ) -> print ( O << '@' , & MAI ) ; }


<s> void <ISA_LIT>InstPrinter :: printLiteral ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

const MCOperand & Op = MI -> getOperand ( OpNo ) ;


<s> void <ISA_LIT>InstPrinter :: printNeg ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> printIfSet ( MI , OpNo , O , '-' ) ;


<s> switch ( MI -> getOperand ( OpNo ) . getImm ( ) ) { default : break ; case <NUM_LIT> : O << <STR_LIT> ;


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate64 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate16 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : printImmediateV216 ( Op . getImm ( ) , STI , O ) ; break ; case MCOI :: OPERAND_UNKNOWN : case MCOI :: OPERAND_PCREL : O << formatDec ( Op . getImm ( ) ) ; break ; case MCOI :: OPERAND_REGISTER : O << <STR_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isFPImm ( ) ) { if ( Op . getFPImm ( ) == <NUM_LIT> ) O << <STR_LIT> ; else { const MCInstrDesc & Desc = MII . get ( MI -> getOpcode ( ) ) ; int RCID = Desc . OpInfo [ OpNo ] . RegClass ; unsigned RCBits = <STR_LIT> ( MRI . getRegClass ( RCID ) ) ; if ( RCBits == <NUM_LIT> ) printImmediate32 ( FloatToBits ( Op . getFPImm ( ) ) , STI , O ) ; else if ( RCBits == <NUM_LIT> ) printImmediate64 ( DoubleToBits ( Op . getFPImm ( ) ) , STI , O ) ; else llvm_unreachable ( <STR_LIT> ) ;


<s> case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; default : break ; } unsigned RegIdx = MRI . getEncodingValue ( RegNo ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; unsigned NumRegs ; if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) {


<s> printIfSet ( MI , OpNo , O , '+' ) ;


<s> void <ISA_LIT>InstPrinter :: printRel ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printIfSet ( MI , OpNo , O , '+' ) ;


<s> switch ( Sel ) { case <NUM_LIT> : O << 'X' ; break ; case <NUM_LIT> : O << 'Y' ; break ; case <NUM_LIT> : O << 'Z' ; break ; case <NUM_LIT> :


<s> void <ISA_LIT>InstPrinter :: printUpdateExecMask ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> void <ISA_LIT>InstPrinter :: printUpdateExecMask ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printUpdatePred ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> if ( Op . getImm ( ) == <NUM_LIT> ) { O << <STR_LIT> ;


<s> const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . getImm ( ) == <NUM_LIT> ) { O << <STR_LIT> ;


<s> case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case MCOI :: OPERAND_IMMEDIATE : printImmediate32 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate64 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediate16 ( Op . getImm ( ) , STI , O ) ; break ; case <STR_LIT> : case <STR_LIT> : if ( ! isUInt < <NUM_LIT> > ( Op . getImm ( ) ) && STI . getFeatureBits ( ) [ <STR_LIT> ] ) { printImmediate32 ( Op . getImm ( ) , STI , O ) ; break ; } LLVM_FALLTHROUGH ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : printImmediateV216 ( Op . getImm ( ) , STI , O ) ; break ; case MCOI :: OPERAND_UNKNOWN : case MCOI :: OPERAND_PCREL : O << formatDec ( Op . getImm ( ) ) ; break ; case MCOI :: OPERAND_REGISTER : O << <STR_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isFPImm ( ) ) { if ( Op . getFPImm ( ) == <NUM_LIT> ) O << <STR_LIT> ; else { const MCInstrDesc & Desc = MII . get ( MI -> getOpcode ( ) ) ; int RCID = Desc . OpInfo [ OpNo ] . RegClass ; unsigned RCBits = <STR_LIT> ( MRI . getRegClass ( RCID ) ) ; if ( RCBits == <NUM_LIT> ) printImmediate32 ( FloatToBits ( Op . getFPImm ( ) ) , STI , O ) ; else if ( RCBits == <NUM_LIT> ) printImmediate64 ( DoubleToBits ( Op . getFPImm ( ) ) , STI , O ) ; else llvm_unreachable ( <STR_LIT> ) ; } } else if ( Op . isExpr ( ) ) { const MCExpr * Exp = Op . getExpr ( ) ; Exp -> print ( O , & MAI ) ; } else { O << <STR_LIT> ; } switch ( MI -> getOpcode ( ) ) { default : break ; 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> void <ISA_LIT>InstPrinter :: printOperandAndIntInputMods ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { unsigned InputModifiers = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( InputModifiers & <STR_LIT> ) O << <STR_LIT> ; printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ; if ( InputModifiers & <STR_LIT> ) O << ')' ; switch ( MI -> getOpcode ( ) ) { default : break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> :

if ( ( int ) OpNo + <NUM_LIT> == <STR_LIT> ( MI -> getOpcode ( ) , <STR_LIT> :: src1 ) ) printDefaultVccOperand ( OpNo , STI , O ) ;


<s> default : break ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : if ( ( int ) OpNo + <NUM_LIT> == <STR_LIT> ( MI -> getOpcode ( ) , <STR_LIT> :: src1 ) ) printDefaultVccOperand ( OpNo , STI , O ) ; break ;


<s> NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'a' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'a' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'a' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'a' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'a' ; NumRegs = <NUM_LIT> ; } else { O << getRegisterName ( RegNo ) ; return ; } if ( NumRegs == <NUM_LIT> ) { O << RegIdx ;


<s> return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; } unsigned RegIdx = MRI . getEncodingValue ( RegNo ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; unsigned NumRegs ; if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ;


<s> O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; } unsigned RegIdx = MRI . getEncodingValue ( RegNo ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; unsigned NumRegs ; if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ;


<s> if ( ! ! ( Ops [ I ] & Mod ) != DefaultValue ) return false ; } if ( HasDstSel && ( Ops [ <NUM_LIT> ] & <STR_LIT> ) != <NUM_LIT> ) return false ; return true ;


<s> if ( ! ! ( Ops [ I ] & Mod ) != DefaultValue ) return false ; }

if ( HasDstSel && ( Ops [ <NUM_LIT> ] & <STR_LIT> ) != <NUM_LIT> ) return false ;


<s> uint16_t Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm != <NUM_LIT> ) { O << ( ( OpNo == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ) ; printS16ImmDecOperand ( MI , OpNo , O ) ;


<s> Ops [ NumOps ++ ] = MI -> getOperand ( Idx ) . getImm ( ) ; } const bool HasDstSel = NumOps > <NUM_LIT> && Mod == <STR_LIT> && MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ; if ( allOpsDefaultValue ( Ops , NumOps , Mod , HasDstSel ) ) return ; O << Name ;

for ( int I = <NUM_LIT> ; I < NumOps ; ++ I ) {


<s> case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; } unsigned RegIdx = MRI . getEncodingValue ( RegNo ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; unsigned NumRegs ; if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ;


<s> O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; } unsigned RegIdx = MRI . getEncodingValue ( RegNo ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; unsigned NumRegs ; if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) {


<s> O << formatDec ( static_cast < int16_t > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ;


<s> if ( ! ! ( Ops [ I ] & Mod ) != DefaultValue ) return false ; } if ( HasDstSel && ( Ops [ <NUM_LIT> ] & <STR_LIT> ) != <NUM_LIT> ) return false ;


<s> <ISA_LIT>InstPrinter :: printIfSet ( MI , OpNo , O , '|' ) ;


<s> void <ISA_LIT>InstPrinter :: printAbs ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {

<ISA_LIT>InstPrinter :: printIfSet ( MI , OpNo , O , '|' ) ;


<s> void <ISA_LIT>InstPrinter :: printAddr64 ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


printU4ImmOperand ( MI , OpNo , STI , O ) ;


<s> printU4ImmOperand ( MI , OpNo , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printBankSwizzle ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { int BankSwizzle = MI -> getOperand ( OpNo ) . getImm ( ) ; switch ( BankSwizzle ) { case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; default : break ;


<s> void <ISA_LIT>InstPrinter :: printBoundCtrl ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ;


<s> void <ISA_LIT>InstPrinter :: printClamp ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {

<ISA_LIT>InstPrinter :: printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> unsigned CT = MI -> getOperand ( OpNo ) . getImm ( ) ; switch ( CT ) { case <NUM_LIT> : O << 'U' ; break ; case <NUM_LIT> : O << 'N' ;


<s> void <ISA_LIT>InstPrinter :: printD16 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> if ( MI -> getOperand ( OpNo ) . getImm ( ) ) {


<s> void <ISA_LIT>InstPrinter :: printDMask ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( MI -> getOperand ( OpNo ) . getImm ( ) ) { O << <STR_LIT> ; printU16ImmOperand ( MI , OpNo , STI , O ) ; }


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm <= DppCtrl :: QUAD_PERM_LAST ) { O << <STR_LIT> ; O << formatDec ( Imm & <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ',' ; O << formatDec ( ( Imm & <NUM_LIT> ) >> <NUM_LIT> ) << ']' ; } else if ( ( Imm >= DppCtrl :: ROW_SHL_FIRST ) && ( Imm <= DppCtrl :: ROW_SHL_LAST ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= DppCtrl :: ROW_SHR_FIRST ) && ( Imm <= DppCtrl :: ROW_SHR_LAST ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( ( Imm >= DppCtrl :: ROW_ROR_FIRST ) && ( Imm <= DppCtrl :: ROW_ROR_LAST ) ) { O << <STR_LIT> ; printU4ImmDecOperand ( MI , OpNo , O ) ; } else if ( Imm == DppCtrl :: WAVE_SHL1 ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_ROL1 ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_SHR1 ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_ROR1 ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: ROW_MIRROR ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: ROW_HALF_MIRROR ) {


<s> void <ISA_LIT>InstPrinter :: printExpCompr ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( MI -> getOperand ( OpNo ) . getImm ( ) ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc0 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printExpSrcN < <NUM_LIT> > ( MI , OpNo , STI , O ) ;


<s> printExpSrcN < <NUM_LIT> > ( MI , OpNo , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc1 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printExpSrcN < <NUM_LIT> > ( MI , OpNo , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc1 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printExpSrcN < <NUM_LIT> > ( MI , OpNo , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc2 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printExpSrcN < <NUM_LIT> > ( MI , OpNo , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc3 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> int EnIdx = <STR_LIT> ( Opc , <STR_LIT> :: en ) ; unsigned En = MI -> getOperand ( EnIdx ) . getImm ( ) ; int ComprIdx = <STR_LIT> ( Opc , <STR_LIT> :: compr ) ; if ( MI -> getOperand ( ComprIdx ) . getImm ( ) ) { if ( N == <NUM_LIT> || N == <NUM_LIT> ) -- OpNo ; else if ( N == <NUM_LIT> ) OpNo -= <NUM_LIT> ; } if ( En & ( <NUM_LIT> << N ) ) printRegOperand ( MI -> getOperand ( OpNo ) . getReg ( ) , O , MRI ) ; else O << <STR_LIT> ;


<s> else if ( Tgt == <NUM_LIT> ) O << <STR_LIT> ; else if ( Tgt >= <NUM_LIT> && Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt - <NUM_LIT> ; else if ( Tgt >= <NUM_LIT> && Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt - <NUM_LIT> ; else {


<s> if ( Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt ; else if ( Tgt == <NUM_LIT> ) O << <STR_LIT> ; else if ( Tgt == <NUM_LIT> ) O << <STR_LIT> ; else if ( Tgt >= <NUM_LIT> && Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt - <NUM_LIT> ; else if ( Tgt >= <NUM_LIT> && Tgt <= <NUM_LIT> ) O << <STR_LIT> << Tgt - <NUM_LIT> ; else { O << <STR_LIT> << Tgt ; }


<s> void <ISA_LIT>InstPrinter :: printGDS ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> if ( MI -> getOperand ( OpNo ) . getImm ( ) ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printHigh ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

if ( MI -> getOperand ( OpNo ) . getImm ( ) ) O << <STR_LIT> ;


<s> unsigned <ISA_LIT>mm16 = MI -> getOperand ( OpNo ) . getImm ( ) ; const unsigned Id = ( <ISA_LIT>mm16 & ID_MASK_ ) >> ID_SHIFT_ ; const unsigned Offset = ( <ISA_LIT>mm16 & OFFSET_MASK_ ) >> OFFSET_SHIFT_ ; const unsigned Width = ( ( <ISA_LIT>mm16 & WIDTH_M1_MASK_ ) >> WIDTH_M1_SHIFT_ ) + <NUM_LIT> ; O << <STR_LIT> ; unsigned Last = ID_SYMBOLIC_LAST_ ; if ( <STR_LIT> ( STI ) || <STR_LIT> ( STI ) || <STR_LIT> ( STI ) ) Last = ID_SYMBOLIC_FIRST_GFX9_ ; if ( ID_SYMBOLIC_FIRST_ <= Id && Id < Last && IdSymbolic [ Id ] ) { O << IdSymbolic [ Id ] ; } else { O << Id ; } if ( Width != WIDTH_M1_DEFAULT_ + <NUM_LIT> || Offset != OFFSET_DEFAULT_ ) { O << <STR_LIT> << Offset << <STR_LIT> << Width ; } O << ')' ;


<s> void <ISA_LIT>InstPrinter :: printIdxen ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printIfSet ( const MCInst * MI , unsigned OpNo , raw_ostream & O , char Asm ) { const MCOperand & Op = MI -> getOperand ( OpNo ) ;


<s> else if ( Imm == <NUM_LIT> ) O << <STR_LIT> ; else if ( Imm == <NUM_LIT> ) O << <STR_LIT> ; else if ( Imm == <NUM_LIT> ) O << <STR_LIT> ; else if ( Imm == <NUM_LIT> ) O << <STR_LIT> ; else if ( Imm == <NUM_LIT> ) O << <STR_LIT> ; else if ( Imm == <NUM_LIT> ) O << <STR_LIT> ;


<s> else if ( Imm == FloatToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == FloatToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == FloatToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == <NUM_LIT> && STI . getFeatureBits ( ) [ <STR_LIT> ] ) O << <STR_LIT> ;

else O << formatHex ( static_cast < uint64_t > ( Imm ) ) ;


<s> int64_t <ISA_LIT>mm = static_cast < int64_t > ( Imm ) ; if ( <ISA_LIT>mm >= - <NUM_LIT> && <ISA_LIT>mm <= <NUM_LIT> ) { O << <ISA_LIT>mm ; return ; } if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( <NUM_LIT> ) ) O << <STR_LIT> ; else if ( Imm == DoubleToBits ( - <NUM_LIT> ) ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printImmediateV216 ( uint32_t Imm , const MCSubtargetInfo & STI , raw_ostream & O ) { uint16_t Lo16 = static_cast < uint16_t > ( Imm ) ; printImmediate16 ( Lo16 , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printInst ( const MCInst * MI , raw_ostream & O , StringRef Annot , const MCSubtargetInfo & STI ) { O . flush ( ) ; printInstruction ( MI , O ) ;


<s> unsigned Attr = MI -> getOperand ( OpNum ) . getImm ( ) ; O << <STR_LIT> << Attr ;


<s> unsigned Chan = MI -> getOperand ( OpNum ) . getImm ( ) ;

O << '.' << <STR_LIT> [ Chan & <NUM_LIT> ] ;


<s> void <ISA_LIT>InstPrinter :: printInterpAttrChan ( const MCInst * MI , unsigned OpNum , const MCSubtargetInfo & STI , raw_ostream & O ) {

unsigned Chan = MI -> getOperand ( OpNum ) . getImm ( ) ;


<s> O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ; default : O << <STR_LIT> << Imm ; }


<s> if ( KCacheMode > <NUM_LIT> ) { int KCacheBank = MI -> getOperand ( OpNo - <NUM_LIT> ) . getImm ( ) ; O << <STR_LIT> << KCacheBank << ':' ; int KCacheAddr = MI -> getOperand ( OpNo + <NUM_LIT> ) . getImm ( ) ; int LineSize = ( KCacheMode == <NUM_LIT> ) ? <NUM_LIT> : <NUM_LIT> ; O << KCacheAddr * <NUM_LIT> << '-' << KCacheAddr * <NUM_LIT> + LineSize ; }


<s> int64_t Imm = Op . getImm ( ) ; O << Imm << '(' << BitsToFloat ( Imm ) << ')' ; }


<s> void <ISA_LIT>InstPrinter :: printMemOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {


<s>
void
<ISA_LIT>InstPrinter
::
printNamedBit
(
const
MCInst
*
MI
,
unsigned
OpNo
,
raw_ostream
&
O
,
StringRef
BitName
)
{
if
(
MI
->
getOperand
(
OpNo
)
.
getImm
(
)
)
{
O
<<
' '
<<
BitName
;
}


<s> void <ISA_LIT>InstPrinter :: printNamedBit ( const MCInst * MI , unsigned OpNo , raw_ostream & O , StringRef BitName ) { if ( MI -> getOperand ( OpNo ) . getImm ( ) ) {


<s> void <ISA_LIT>InstPrinter :: printNegHi ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printPackedModifier ( MI , <STR_LIT> , <STR_LIT> , O ) ;


<s> void <ISA_LIT>InstPrinter :: printNegLo ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printPackedModifier ( MI , <STR_LIT> , <STR_LIT> , O ) ;


<s> printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printOffset ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

uint16_t Imm = MI -> getOperand ( OpNo ) . getImm ( ) ;


<s> void <ISA_LIT>InstPrinter :: printOffset0 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( MI -> getOperand ( OpNo ) . getImm ( ) ) { O << <STR_LIT> ; printU8ImmDecOperand ( MI , OpNo , O ) ;


<s> if ( MI -> getOperand ( OpNo ) . getImm ( ) ) { O << <STR_LIT> ; printU8ImmDecOperand ( MI , OpNo , O ) ;


<s> if ( MI -> getOperand ( OpNo ) . getImm ( ) ) { O << <STR_LIT> ;

printU8ImmDecOperand ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printOffset1 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( MI -> getOperand ( OpNo ) . getImm ( ) ) { O << <STR_LIT> ;


<s> O << ( ( OpNo == <NUM_LIT> ) ? <STR_LIT> : <STR_LIT> ) ;

printS13ImmDecOperand ( MI , OpNo , O ) ;


<s> break ; case <NUM_LIT> : O << <STR_LIT> ; break ; case <NUM_LIT> : O << <STR_LIT> ; break ;


<s> void <ISA_LIT>InstPrinter :: printOMod<ISA_LIT> ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { int Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm == <STR_LIT> ) O << <STR_LIT> ;

else if ( Imm == <STR_LIT> ) O << <STR_LIT> ;


<s> const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . isReg ( ) ) { switch ( Op . getReg ( ) ) { case <STR_LIT> : break ; default : O << getRegisterName ( Op . getReg ( ) ) ; break ; } } else if ( Op . isImm ( ) ) { O << Op . getImm ( ) ;


<s> NegMnemo = Op . isImm ( ) || Op . isFPImm ( ) ; } if ( NegMnemo ) { O << <STR_LIT> ; } else { O << '-' ; } } if ( InputModifiers & <STR_LIT> ) O << '|' ; printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ; if ( InputModifiers & <STR_LIT> ) O << '|' ;


<s> unsigned InputModifiers = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( InputModifiers & <STR_LIT> ) O << <STR_LIT> ; printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ;

if ( InputModifiers & <STR_LIT> ) O << ')' ;


<s> printPackedModifier ( MI , <STR_LIT> , <STR_LIT> , O ) ;


<s> Ops [ NumOps ++ ] = MI -> getOperand ( Idx ) . getImm ( ) ; } const bool HasDstSel = NumOps > <NUM_LIT> && Mod == <STR_LIT> && MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ; const bool IsPacked = MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ; if ( allOpsDefaultValue ( Ops , NumOps , Mod , IsPacked , HasDstSel ) ) return ; O << Name ; for ( int I = <NUM_LIT> ; I < NumOps ; ++ I ) { if ( I != <NUM_LIT> ) O << ',' ; O << ! ! ( Ops [ I ] & Mod ) ; } if ( HasDstSel ) { O << ',' << ! ! ( Ops [ <NUM_LIT> ] & <STR_LIT> ) ; }


<s> if ( STI . hasFeature ( <STR_LIT> ) ) printNamedBit ( MI , OpNo , O , <STR_LIT> ) ; else printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : O << <STR_LIT> ; return ; case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; } unsigned RegIdx = MRI . getEncodingValue ( RegNo ) & ( ( <NUM_LIT> << <NUM_LIT> ) - <NUM_LIT> ) ; unsigned NumRegs ; if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 'v' ; NumRegs = <NUM_LIT> ; } else if ( MRI . getRegClass ( <STR_LIT> ) . contains ( RegNo ) ) { O << 's' ; NumRegs = <NUM_LIT> ; } else { O << getRegisterName ( RegNo ) ; return ; } if ( NumRegs == <NUM_LIT> ) { O << RegIdx ;


<s> void <ISA_LIT>InstPrinter :: printRel ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { <ISA_LIT>InstPrinter :: printIfSet ( MI , OpNo , O , '+' ) ;


<s> O << <STR_LIT> ; printU4ImmOperand ( MI , OpNo , STI , O ) ;


<s> unsigned Sel = MI -> getOperand ( OpNo ) . getImm ( ) ; switch ( Sel ) { case <NUM_LIT> : O << 'X' ; break ; case <NUM_LIT> : O << 'Y' ; break ; case <NUM_LIT> : O << 'Z' ; break ; case <NUM_LIT> : O << 'W' ; break ; case <NUM_LIT> : O << '0' ; break ; case <NUM_LIT> : O << '1' ; break ; case <NUM_LIT> : O << '_' ; break ; default : break ;


<s> void <ISA_LIT>InstPrinter :: printS13ImmDecOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {

O << formatDec ( SignExtend32 < <NUM_LIT> > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ;


<s> void <ISA_LIT>InstPrinter :: printS13ImmDecOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { O << formatDec ( SignExtend32 < <NUM_LIT> > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ;


<s> void <ISA_LIT>InstPrinter :: printSDWADstSel ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; switch ( Imm ) {

case DstUnused :: UNUSED_PAD : O << <STR_LIT> ; break ;


<s> case SdwaSel :: WORD_0 : O << <STR_LIT> ; break ; case SdwaSel :: WORD_1 : O << <STR_LIT> ; break ; case SdwaSel :: DWORD : O << <STR_LIT> ; break ; default : llvm_unreachable ( <STR_LIT> ) ; }


<s> using namespace llvm :: <STR_LIT> ; unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; switch ( Imm ) { case SdwaSel :: BYTE_0 : O << <STR_LIT> ; break ; case SdwaSel :: BYTE_1 : O << <STR_LIT> ; break ;

case SdwaSel :: BYTE_2 : O << <STR_LIT> ; break ;


<s> O << <STR_LIT> ; printSDWASel ( MI , OpNo , O ) ;


<s> void <ISA_LIT>InstPrinter :: printSDWASrc1Sel ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printSDWASrc1Sel ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { O << <STR_LIT> ; printSDWASel ( MI , OpNo , O ) ;


<s> if ( ( <ISA_LIT>mm16 & ~ ( ID_MASK_ | OP_GS_MASK_ | STREAM_ID_MASK_ ) ) != <NUM_LIT> ) break ; const unsigned OpGs = ( <ISA_LIT>mm16 & OP_GS_MASK_ ) >> OP_SHIFT_ ; const unsigned StreamId = ( <ISA_LIT>mm16 & STREAM_ID_MASK_ ) >> STREAM_ID_SHIFT_ ; if ( OpGs == OP_GS_NOP && Id != ID_GS_DONE ) break ; if ( OpGs == OP_GS_NOP && StreamId != <NUM_LIT> ) break ; O << <STR_LIT> << IdSymbolic [ Id ] << <STR_LIT> << OpGsSymbolic [ OpGs ] ; if ( OpGs != OP_GS_NOP ) { O << <STR_LIT> << StreamId ; } O << ')' ; return ;


<s> do { if ( Id == ID_INTERRUPT ) { if ( ( <ISA_LIT>mm16 & ~ ID_MASK_ ) != <NUM_LIT> ) break ; O << <STR_LIT> << IdSymbolic [ Id ] << ')' ; return ; } if ( Id == ID_GS || Id == ID_GS_DONE ) { if ( ( <ISA_LIT>mm16 & ~ ( ID_MASK_ | OP_GS_MASK_ | STREAM_ID_MASK_ ) ) != <NUM_LIT> ) break ; const unsigned OpGs = ( <ISA_LIT>mm16 & OP_GS_MASK_ ) >> OP_SHIFT_ ; const unsigned StreamId = ( <ISA_LIT>mm16 & STREAM_ID_MASK_ ) >> STREAM_ID_SHIFT_ ; if ( OpGs == OP_GS_NOP && Id != ID_GS_DONE ) break ; if ( OpGs == OP_GS_NOP && StreamId != <NUM_LIT> ) break ; O << <STR_LIT> << IdSymbolic [ Id ] << <STR_LIT> << OpGsSymbolic [ OpGs ] ; if ( OpGs != OP_GS_NOP ) { O << <STR_LIT> << StreamId ; } O << ')' ; return ; }


<s> void <ISA_LIT>InstPrinter :: printSMRDOffset8 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printU32ImmOperand ( MI , OpNo , STI , O ) ;


<s> void <ISA_LIT>InstPrinter :: printSMRDOffset8 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printU32ImmOperand ( MI , OpNo , STI , O ) ;


<s> uint16_t OrMask = ( Imm >> BITMASK_OR_SHIFT ) & BITMASK_MASK ; uint16_t XorMask = ( Imm >> BITMASK_XOR_SHIFT ) & BITMASK_MASK ; if ( AndMask == BITMASK_MAX && OrMask == <NUM_LIT> && countPopulation ( XorMask ) == <NUM_LIT> ) { O << <STR_LIT> << IdSymbolic [ ID_SWAP ] ; O << <STR_LIT> ; O << formatDec ( XorMask ) ; O << <STR_LIT> ; } else if ( AndMask == BITMASK_MAX && OrMask == <NUM_LIT> && XorMask > <NUM_LIT> && isPowerOf2_64 ( XorMask + <NUM_LIT> ) ) { O << <STR_LIT> << IdSymbolic [ ID_REVERSE ] ; O << <STR_LIT> ; O << formatDec ( XorMask + <NUM_LIT> ) ; O << <STR_LIT> ; } else { uint16_t GroupSize = BITMASK_MAX - AndMask + <NUM_LIT> ; if ( GroupSize > <NUM_LIT> && isPowerOf2_64 ( GroupSize ) && OrMask < GroupSize && XorMask == <NUM_LIT> ) { O << <STR_LIT> << IdSymbolic [ ID_BROADCAST ] ; O << <STR_LIT> ; O << formatDec ( GroupSize ) ; O << <STR_LIT> ; O << formatDec ( OrMask ) ; O << <STR_LIT> ; } else { O << <STR_LIT> << IdSymbolic [ ID_BITMASK_PERM ] ;


<s> using namespace llvm :: <STR_LIT> ; uint16_t Probe0 = ( ( <NUM_LIT> & AndMask ) | OrMask ) ^ XorMask ; uint16_t Probe1 = ( ( BITMASK_MASK & AndMask ) | OrMask ) ^ XorMask ; O << <STR_LIT> ; for ( unsigned Mask = <NUM_LIT> << ( BITMASK_WIDTH - <NUM_LIT> ) ; Mask > <NUM_LIT> ; Mask >>= <NUM_LIT> ) { uint16_t p0 = Probe0 & Mask ; uint16_t p1 = Probe1 & Mask ; if ( p0 == p1 ) { if ( p0 == <NUM_LIT> ) { O << <STR_LIT> ; } else { O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printTFE ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printTFE ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printU16ImmOperand ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { int64_t Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( isInt < <NUM_LIT> > ( Imm ) || isUInt < <NUM_LIT> > ( Imm ) ) O << formatHex ( static_cast < uint64_t > ( Imm & <NUM_LIT> ) ) ;

else printU32ImmOperand ( MI , OpNo , STI , O ) ;


<s> O << formatHex ( MI -> getOperand ( OpNo ) . getImm ( ) & <NUM_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printU4ImmDecOperand ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { O << formatDec ( MI -> getOperand ( OpNo ) . getImm ( ) & <NUM_LIT> ) ;


<s> printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printUpdateExecMask ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {

<ISA_LIT>InstPrinter :: printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printUpdateExecMask ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { <ISA_LIT>InstPrinter :: printIfSet ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printUpdatePred ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) {


<s> void <ISA_LIT>InstPrinter :: printVGPRIndexMode ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { unsigned Val = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Val == <NUM_LIT> ) { O << <STR_LIT> ; return ; } if ( Val & VGPRIndexMode :: DST_ENABLE ) O << <STR_LIT> ; if ( Val & VGPRIndexMode :: SRC0_ENABLE ) O << <STR_LIT> ; if ( Val & VGPRIndexMode :: SRC1_ENABLE ) O << <STR_LIT> ; if ( Val & VGPRIndexMode :: SRC2_ENABLE ) O << <STR_LIT> ;


<s> unsigned Val = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Val == <NUM_LIT> ) { O << <STR_LIT> ; return ; } if ( Val & VGPRIndexMode :: DST_ENABLE ) O << <STR_LIT> ; if ( Val & VGPRIndexMode :: SRC0_ENABLE ) O << <STR_LIT> ;

if ( Val & VGPRIndexMode :: SRC1_ENABLE ) O << <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printVOPDst ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ; else if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ; else if ( MII . get ( MI -> getOpcode ( ) ) . TSFlags & <STR_LIT> ) O << <STR_LIT> ;


<s>
<STR_LIT>
ISA
=
<STR_LIT>
(
STI
.
getCPU
(
)
)
;
unsigned
<ISA_LIT>mm16
=
MI
->
getOperand
(
OpNo
)
.
getImm
(
)
;
unsigned
Vmcnt
,
Expcnt
,
Lgkmcnt
;
decodeWaitcnt
(
ISA
,
<ISA_LIT>mm16
,
Vmcnt
,
Expcnt
,
Lgkmcnt
)
;
bool
NeedSpace
=
false
;
if
(
Vmcnt
!=
getVmcntBitMask
(
ISA
)
)
{
O
<<
<STR_LIT>
<<
Vmcnt
<<
')'
;
NeedSpace
=
true
;
}
if
(
Expcnt
!=
getExpcntBitMask
(
ISA
)
)
{
if
(
NeedSpace
)
O
<<
' '
;
O
<<
<STR_LIT>
<<
Expcnt
<<
')'
;
NeedSpace
=
true
;
}
if
(
Lgkmcnt
!=
getLgkmcntBitMask
(
ISA
)
)
{
if
(
NeedSpace
)
O
<<
' '
;


<s>
unsigned
Vmcnt
,
Expcnt
,
Lgkmcnt
;
decodeWaitcnt
(
ISA
,
<ISA_LIT>mm16
,
Vmcnt
,
Expcnt
,
Lgkmcnt
)
;
bool
NeedSpace
=
false
;
if
(
Vmcnt
!=
getVmcntBitMask
(
ISA
)
)
{
O
<<
<STR_LIT>
<<
Vmcnt
<<
')'
;
NeedSpace
=
true
;
}
if
(
Expcnt
!=
getExpcntBitMask
(
ISA
)
)
{
if
(
NeedSpace
)
O
<<
' '
;
O
<<
<STR_LIT>
<<
Expcnt
<<
')'
;


<s> void <ISA_LIT>InstPrinter :: printWrite ( const MCInst * MI , unsigned OpNo , raw_ostream & O ) { const MCOperand & Op = MI -> getOperand ( OpNo ) ; if ( Op . getImm ( ) == <NUM_LIT> ) { O << <STR_LIT> ; }


<s> void <ISA_LIT>InstPrinter :: printGFX10A16 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printRegName ( raw_ostream & OS , unsigned RegNo ) const { OS << RegNo ;


<s> void <ISA_LIT>InstPrinter :: printRegName ( raw_ostream & OS , unsigned RegNo ) const {


<s> case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; case <STR_LIT> : llvm_unreachable ( <STR_LIT> ) ; default : break ; } StringRef RegName ( getRegisterName ( RegNo ) ) ;

if ( ! Keep16BitSuffixes ) if ( ! RegName . consume_back ( <STR_LIT> ) ) RegName . consume_back ( <STR_LIT> ) ;


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( ! Imm ) return ; if ( <STR_LIT> ( STI ) ) { switch ( MI -> getOpcode ( ) ) { case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : case <STR_LIT> : O << <STR_LIT> << ( Imm & <NUM_LIT> ) << ',' << ( ( Imm >> <NUM_LIT> ) & <NUM_LIT> ) << ',' << ( ( Imm >> <NUM_LIT> ) & <NUM_LIT> ) << ']' ; return ; } } O << <STR_LIT> << Imm ;


<s> unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( Imm ) { O << <STR_LIT> ;


<s> O << <STR_LIT> << formatDec ( Imm & <NUM_LIT> ) ; for ( size_t i = <NUM_LIT> ; i < <NUM_LIT> ; ++ i ) { O << ',' << formatDec ( ( Imm >> ( <NUM_LIT> * i ) ) & <NUM_LIT> ) ; }


<s> void <ISA_LIT>InstPrinter :: printDPP8 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { if ( ! <STR_LIT> ( STI ) ) llvm_unreachable ( <STR_LIT> ) ; unsigned Imm = MI -> getOperand ( OpNo ) . getImm ( ) ;

O << <STR_LIT> << formatDec ( Imm & <NUM_LIT> ) ;


<s> if ( <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: WAVE_ROR1 ) { if ( <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: ROW_MIRROR ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: ROW_HALF_MIRROR ) { O << <STR_LIT> ; } else if ( Imm == DppCtrl :: BCAST15 ) { if ( <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( Imm == DppCtrl :: BCAST31 ) { if ( <STR_LIT> ( STI ) ) { O << <STR_LIT> ; return ; } O << <STR_LIT> ; } else if ( ( Imm >= DppCtrl :: ROW_SHARE_FIRST ) && ( Imm <= DppCtrl :: ROW_SHARE_LAST ) ) { if ( <STR_LIT> ( STI ) ) { O << <STR_LIT> ; } else if ( <STR_LIT> ( STI ) ) { O << <STR_LIT> ; } else { O << <STR_LIT> <STR_LIT> ;


<s> void <ISA_LIT>InstPrinter :: printExpCompr ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> printNamedBit ( MI , OpNo , O , <STR_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc1 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {

printExpSrcN ( MI , OpNo , STI , O , <NUM_LIT> ) ;


<s> void <ISA_LIT>InstPrinter :: printExpSrc3 ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { printExpSrcN ( MI , OpNo , STI , O , <NUM_LIT> ) ;


<s> unsigned Opc = MI -> getOpcode ( ) ; int EnIdx = <STR_LIT> ( Opc , <STR_LIT> :: en ) ; unsigned En = MI -> getOperand ( EnIdx ) . getImm ( ) ; int ComprIdx = <STR_LIT> ( Opc , <STR_LIT> :: compr ) ; if ( MI -> getOperand ( ComprIdx ) . getImm ( ) ) OpNo = OpNo - N + N / <NUM_LIT> ;

if ( En & ( <NUM_LIT> << N ) ) printRegOperand ( MI -> getOperand ( OpNo ) . getReg ( ) , O , MRI ) ;


<s>
using
namespace
llvm
::
<STR_LIT>
;
unsigned
Id
=
MI
->
getOperand
(
OpNo
)
.
getImm
(
)
&
(
(
<NUM_LIT>
<<
<NUM_LIT>
)
<NUM_LIT>
)
;
int
Index
;
StringRef
TgtName
;
if
(
getTgtName
(
Id
,
TgtName
,
Index
)
&&
isSupportedTgtId
(
Id
,
STI
)
)
{
O
<<
' '
<<
TgtName
;
if
(
Index
>=
<NUM_LIT>
)
O
<<
Index
;
}
else
{
O
<<
<STR_LIT>
<<
Id
;
}


<s>
unsigned
Id
=
MI
->
getOperand
(
OpNo
)
.
getImm
(
)
&
(
(
<NUM_LIT>
<<
<NUM_LIT>
)
<NUM_LIT>
)
;
int
Index
;
StringRef
TgtName
;
if
(
getTgtName
(
Id
,
TgtName
,
Index
)
&&
isSupportedTgtId
(
Id
,
STI
)
)
{
O
<<
' '
<<
TgtName
;
if
(
Index
>=
<NUM_LIT>
)
O
<<
Index
;


<s> if ( IsFlatSeg ) { printU16ImmDecOperand ( MI , OpNo , O ) ; } else { if ( <STR_LIT> ( STI ) ) { O << formatDec ( SignExtend32 < <NUM_LIT> > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ; } else { O << formatDec ( SignExtend32 < <NUM_LIT> > ( MI -> getOperand ( OpNo ) . getImm ( ) ) ) ; }


<s> void <ISA_LIT>InstPrinter :: printFORMAT ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) {


<s> void <ISA_LIT>InstPrinter :: printImmediateInt16 ( uint32_t Imm , const MCSubtargetInfo & STI , raw_ostream & O ) { int16_t <ISA_LIT>mm = static_cast < int16_t > ( Imm ) ; if ( isInlinableIntLiteral ( <ISA_LIT>mm ) ) { O << <ISA_LIT>mm ; } else {


<s> if ( isInlinableIntLiteral ( <ISA_LIT>mm ) ) { O << <ISA_LIT>mm ; } else { uint64_t Imm16 = static_cast < uint16_t > ( Imm ) ; O << formatHex ( Imm16 ) ; }


<s> void <ISA_LIT>InstPrinter :: printOffset ( const MCInst * MI , unsigned OpNo , const MCSubtargetInfo & STI , raw_ostream & O ) { uint16_t Imm = MI -> getOperand ( OpNo ) . getImm ( ) ;


<s> const MCOperand & Op = MI -> getOperand ( OpNo + <NUM_LIT> ) ; NegMnemo = Op . isImm ( ) || Op . isDFPImm ( ) ; } if ( NegMnemo ) { O << <STR_LIT> ; } else { O << '-' ; } } if ( InputModifiers & <STR_LIT> ) O << '|' ; printOperand ( MI , OpNo + <NUM_LIT> , STI , O ) ; if ( InputModifiers & <STR_LIT> ) O << '|' ; if ( NegMnemo ) { O << ')' ;


<s> if ( InputModifiers & <STR_LIT> ) { if ( OpNo + <NUM_LIT> < MI -> getNumOperands ( ) && ( InputModifiers & <STR_LIT> ) == <NUM_LIT> ) { const MCOperand & Op = MI -> getOperand ( OpNo + <NUM_LIT> ) ; NegMnemo = Op . isImm ( ) || Op . isDFPImm ( ) ; } if ( NegMnemo ) { O << <STR_LIT> ;


<s> if ( ! MsgName . empty ( ) && isValidMsgOp ( MsgId , OpId , STI ) && isValidMsgStream ( MsgId , OpId , StreamId , STI ) ) { O << <STR_LIT> << MsgName ; if ( msgRequiresOp ( MsgId ) ) { O << <STR_LIT> << getMsgOpName ( MsgId , OpId ) ; if ( msgSupportsStream ( MsgId , OpId ) ) { O << <STR_LIT> << StreamId ; } } O << ')' ; } else if ( encodeMsg ( MsgId , OpId , StreamId ) == Imm16 ) {

O << <STR_LIT> << MsgId << <STR_LIT> << OpId << <STR_LIT> << StreamId << ')' ;


<s> void <ISA_LIT>InstPrinter :: printSymbolicFormat ( const MCInst * MI , const MCSubtargetInfo & STI , raw_ostream & O ) { using namespace llvm :: <STR_LIT> ; int OpNo = <STR_LIT> ( MI -> getOpcode ( ) , <STR_LIT> :: format ) ; assert ( OpNo != - <NUM_LIT> ) ; unsigned Val = MI -> getOperand ( OpNo ) . getImm ( ) ; if ( <STR_LIT> ( STI ) ) { if ( Val == UFMT_DEFAULT ) return ;


<s> O << <STR_LIT> ; bool NeedComma = false ; for ( unsigned ModeId = ID_MIN ; ModeId <= ID_MAX ; ++ ModeId ) { if ( Val & ( <NUM_LIT> << ModeId ) ) { if ( NeedComma ) O << ',' ; O << IdSymbolic [ ModeId ] ; NeedComma = true ;


<s>
unsigned
<ISA_LIT>mm16
=
MI
->
getOperand
(
OpNo
)
.
getImm
(
)
;
unsigned
Vmcnt
,
Expcnt
,
Lgkmcnt
;
decodeWaitcnt
(
ISA
,
<ISA_LIT>mm16
,
Vmcnt
,
Expcnt
,
Lgkmcnt
)
;
bool
IsDefaultVmcnt
=
Vmcnt
==
getVmcntBitMask
(
ISA
)
;
bool
IsDefaultExpcnt
=
Expcnt
==
getExpcntBitMask
(
ISA
)
;
bool
IsDefaultLgkmcnt
=
Lgkmcnt
==
getLgkmcntBitMask
(
ISA
)
;
bool
PrintAll
=
IsDefaultVmcnt
&&
IsDefaultExpcnt
&&
IsDefaultLgkmcnt
;
bool
NeedSpace
=
false
;
if
(
!
IsDefaultVmcnt
||
PrintAll
)
{
O
<<
<STR_LIT>
<<
Vmcnt
<<
')'
;
NeedSpace
=
true
;
}
if
(
!
IsDefaultExpcnt
||
PrintAll
)
{
if
(
NeedSpace
)
O
<<
' '
;
O
<<
<STR_LIT>
<<
Expcnt
<<
')'
;
NeedSpace
=
true
;
}
if
(
!
IsDefaultLgkmcnt
||
PrintAll
)
{
if
(
NeedSpace
)
O
<<
' '
;
O
<<
<STR_LIT>
<<
Lgkmcnt
<<
')'
;


<s> unsigned <ISA_LIT>mm16 = MI -> getOperand ( OpNo ) . getImm ( ) ; unsigned Vmcnt , Expcnt , Lgkmcnt ; decodeWaitcnt ( ISA , <ISA_LIT>mm16 , Vmcnt , Expcnt , Lgkmcnt ) ; bool IsDefaultVmcnt = Vmcnt == getVmcntBitMask ( ISA ) ; bool IsDefaultExpcnt = Expcnt == getExpcntBitMask ( ISA ) ; bool IsDefaultLgkmcnt = Lgkmcnt == getLgkmcntBitMask ( ISA ) ; bool PrintAll = IsDefaultVmcnt && IsDefaultExpcnt && IsDefaultLgkmcnt ; bool NeedSpace = false ; if ( ! IsDefaultVmcnt || PrintAll ) {


<s> if ( ( Imm & CPol :: DLC ) && <STR_LIT> ( STI ) ) O << <STR_LIT> ; if ( ( Imm & CPol :: SCC ) && <STR_LIT> ( STI ) ) O << <STR_LIT> ;

if ( Imm & ~ CPol :: ALL ) O << <STR_LIT> ;


<s> if ( ( Imm & CPol :: DLC ) && <STR_LIT> ( STI ) ) O << <STR_LIT> ; if ( ( Imm & CPol :: SCC ) && <STR_LIT> ( STI ) ) O << <STR_LIT> ; if ( Imm & ~ CPol :: ALL ) O << <STR_LIT> ;