[clang] [llvm] [HLSL] Implement WaveActiveAnyTrue intrinsic (PR #115902)

Finn Plummer via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 14:23:13 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 =
----------------
inbelic wrote:

The Function declaration/name were manually retrieved in `WaveReadLaneAt` due to the overloaded types. Since there are no overloads in this op I think you can just do:
`Intrinsic::getOrInsertDeclartion(&CGM.getModule(), CGM.getHLSLRuntime().getWaveActiveAnyTrueIntrinsic())`

https://github.com/llvm/llvm-project/pull/115902


More information about the cfe-commits mailing list