================
@@ -1767,6 +1798,51 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned
BuiltinID,
CGM.getHLSLRuntime().getGroupMemoryBarrierWithGroupSyncIntrinsic();
return EmitIntrinsicCall(ID);
}
+ case Builtin::BI__builtin_hlsl_barrier: {
+ std::optional<llvm::APSInt> SemanticFlagsConstant =
+ E->getArg(1)->getIntegerConstantExpr(getContext());
+ assert(SemanticFlagsConstant && "expected constant semantic flags");
+ constexpr uint64_t GroupScope =
+ llvm::to_underlying(llvm::dxil::BarrierSemanticFlag::GroupScope);
+ constexpr uint64_t DeviceScope =
+ llvm::to_underlying(llvm::dxil::BarrierSemanticFlag::DeviceScope);
+ constexpr uint64_t ScopeMask = GroupScope | DeviceScope;
+ uint64_t SemanticFlagsValue = SemanticFlagsConstant->getZExtValue();
+ if ((SemanticFlagsValue & ScopeMask) == ScopeMask)
----------------
bob80905 wrote:
If the ScopeMask is set, then device scope and group scope are both on. device
scope covers group scope, so we can drop group scope here.
This could be clearer, so I'll add a comment.
https://github.com/llvm/llvm-project/pull/228277
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits