[clang] [llvm] [HLSL][DXIL] InterlockedOr and InterlockedOr64 builtins (PR #180804)
Alexander Johnston via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 12 08:25:16 PDT 2026
================
@@ -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;
----------------
Alexander-Johnston wrote:
Condensed down into a series of helpers. Adds an isTexture helper to the HLSLAttributedResourceType, similar to isRaw and isStructured
https://github.com/llvm/llvm-project/pull/180804
More information about the cfe-commits
mailing list