[clang] [llvm] [HLSL] Add wave prefix count bits function (PR #178059)
Tex Riddell via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 26 16:54:19 PST 2026
================
@@ -864,6 +898,19 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
CGM.getHLSLRuntime().getSaturateIntrinsic(), ArrayRef<Value *>{Op0},
nullptr, "hlsl.saturate");
}
+ case Builtin::BI__builtin_hlsl_wave_prefix_count_bits: {
+ Value *Op = EmitScalarExpr(E->getArg(0));
+ assert(Op->getType()->isIntegerTy(1) &&
+ "WavePrefixBitCount operand must be a boolean type");
+
+ Intrinsic::ID IID = getPrefixOpIntrinsic(
+ /* OpKind */ 136, getTarget().getTriple().getArch(),
+ CGM.getHLSLRuntime(), E->getArg(0)->getType());
----------------
tex3d wrote:
I think we should have an independent code path for the bit count operation instead of passing a hard-coded DXIL OpCode as if it's an `OpKind` enumeration for the `WavePrefixOp`.
https://github.com/llvm/llvm-project/pull/178059
More information about the cfe-commits
mailing list