================
@@ -4004,6 +4020,170 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned
BuiltinID, CallExpr *TheCall) {
getASTContext().UnsignedIntTy);
break;
}
+ case Builtin::BI__builtin_hlsl_interlocked_or: {
+ if (SemaRef.checkArgCountRange(TheCall, 3, 4))
+ return true;
+ auto checkResTy = [this](const HLSLAttributedResourceType *ResTy) -> bool {
+ bool IsValid = false;
+ const ASTContext &AST = SemaRef.getASTContext();
+ // The resource handle must be either
+ // RWByteAddressBuffer or RWStructuredBuffer
+ IsValid |= ResTy->getAttrs().ResourceClass == ResourceClass::UAV &&
+ ResTy->isRaw() && ResTy->hasContainedType();
+ // RWBuffer<int> or RWBuffer<uint>
+ IsValid |= ResTy->getAttrs().ResourceClass == ResourceClass::UAV &&
+ !ResTy->isRaw() && ResTy->hasContainedType() &&
+ (ResTy->getContainedType() == AST.IntTy ||
+ ResTy->getContainedType() == AST.UnsignedIntTy);
+ // RWTexture<int> or RWTexture<uint> (any dimension)
+ IsValid |= ResTy->getAttrs().ResourceClass == ResourceClass::UAV &&
+ !ResTy->isRaw() &&
+ ResTy->getAttrs().ResourceDimension !=
+ llvm::dxil::ResourceDimension::Unknown &&
+ (ResTy->getContainedType() == AST.IntTy ||
+ ResTy->getContainedType() == AST.UnsignedIntTy);
+ return !IsValid;
----------------
farzonl wrote:
Also before you do my suggestion are you sure there are no helpers for these?
https://github.com/llvm/llvm-project/pull/180804
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits