[clang] [llvm] [HLSL] Implement WaveActiveAnyTrue intrinsic (PR #115902)
Ashley Coleman via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 12 14:51:40 PST 2024
================
@@ -19108,6 +19108,21 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
/*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getStepIntrinsic(),
ArrayRef<Value *>{Op0, Op1}, nullptr, "hlsl.step");
}
+ case Builtin::BI__builtin_hlsl_wave_active_any_true: {
+ IntegerType *Int1Ty =
+ llvm::Type::getInt1Ty(CGM.getTypes().getLLVMContext());
+ Value *Op = EmitScalarExpr(E->getArg(0));
+ assert(Op->getType() == Int1Ty &&
+ "wave_active_any_true operand must be a bool");
+
+ llvm::FunctionType *FT =
----------------
V-FEXrt wrote:
I originally had something like this
```hlsl
case Builtin::BI__builtin_hlsl_wave_active_any_true: {
Value *Op = EmitScalarExpr(E->getArg(0));
return Builder.CreateIntrinsic(
Op->getType(),
CGM.getHLSLRuntime().getWaveActiveAnyTrueIntrinsic(),
Op, nullptr, "hlsl.wave.activeanytrue"
);
}
```
but that was failing with a convergence error `Cannot mix controlled and uncontrolled convergence in the same function.`. I also though I tried `Intrinsic::getOrInsertDeclaration` but I can't remember what happened with that. I'll give it another try
https://github.com/llvm/llvm-project/pull/115902
More information about the cfe-commits
mailing list