diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp | 32 | 
1 files changed, 20 insertions, 12 deletions
diff --git a/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp b/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp index 6e6eb7d7f13c..7b42850df968 100644 --- a/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp @@ -658,34 +658,42 @@ void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD,    GenOpenCLArgMetadata(FD, Fn, CGM, Context, Builder, getContext());    if (const VecTypeHintAttr *A = FD->getAttr<VecTypeHintAttr>()) { -    QualType hintQTy = A->getTypeHint(); -    const ExtVectorType *hintEltQTy = hintQTy->getAs<ExtVectorType>(); -    bool isSignedInteger = -        hintQTy->isSignedIntegerType() || -        (hintEltQTy && hintEltQTy->getElementType()->isSignedIntegerType()); -    llvm::Metadata *attrMDArgs[] = { +    QualType HintQTy = A->getTypeHint(); +    const ExtVectorType *HintEltQTy = HintQTy->getAs<ExtVectorType>(); +    bool IsSignedInteger = +        HintQTy->isSignedIntegerType() || +        (HintEltQTy && HintEltQTy->getElementType()->isSignedIntegerType()); +    llvm::Metadata *AttrMDArgs[] = {          llvm::ConstantAsMetadata::get(llvm::UndefValue::get(              CGM.getTypes().ConvertType(A->getTypeHint()))),          llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(              llvm::IntegerType::get(Context, 32), -            llvm::APInt(32, (uint64_t)(isSignedInteger ? 1 : 0))))}; -    Fn->setMetadata("vec_type_hint", llvm::MDNode::get(Context, attrMDArgs)); +            llvm::APInt(32, (uint64_t)(IsSignedInteger ? 1 : 0))))}; +    Fn->setMetadata("vec_type_hint", llvm::MDNode::get(Context, AttrMDArgs));    }    if (const WorkGroupSizeHintAttr *A = FD->getAttr<WorkGroupSizeHintAttr>()) { -    llvm::Metadata *attrMDArgs[] = { +    llvm::Metadata *AttrMDArgs[] = {          llvm::ConstantAsMetadata::get(Builder.getInt32(A->getXDim())),          llvm::ConstantAsMetadata::get(Builder.getInt32(A->getYDim())),          llvm::ConstantAsMetadata::get(Builder.getInt32(A->getZDim()))}; -    Fn->setMetadata("work_group_size_hint", llvm::MDNode::get(Context, attrMDArgs)); +    Fn->setMetadata("work_group_size_hint", llvm::MDNode::get(Context, AttrMDArgs));    }    if (const ReqdWorkGroupSizeAttr *A = FD->getAttr<ReqdWorkGroupSizeAttr>()) { -    llvm::Metadata *attrMDArgs[] = { +    llvm::Metadata *AttrMDArgs[] = {          llvm::ConstantAsMetadata::get(Builder.getInt32(A->getXDim())),          llvm::ConstantAsMetadata::get(Builder.getInt32(A->getYDim())),          llvm::ConstantAsMetadata::get(Builder.getInt32(A->getZDim()))}; -    Fn->setMetadata("reqd_work_group_size", llvm::MDNode::get(Context, attrMDArgs)); +    Fn->setMetadata("reqd_work_group_size", llvm::MDNode::get(Context, AttrMDArgs)); +  } + +  if (const OpenCLIntelReqdSubGroupSizeAttr *A = +          FD->getAttr<OpenCLIntelReqdSubGroupSizeAttr>()) { +    llvm::Metadata *AttrMDArgs[] = { +        llvm::ConstantAsMetadata::get(Builder.getInt32(A->getSubGroupSize()))}; +    Fn->setMetadata("intel_reqd_sub_group_size", +                    llvm::MDNode::get(Context, AttrMDArgs));    }  }  | 
