[clang] [llvm] [HLSL] Handle WaveActiveBallot struct return type appropriately (PR #175105)

Finn Plummer via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 15 15:32:06 PST 2026


================
@@ -1,10 +1,22 @@
 ; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-compute %s | FileCheck %s
 
-define noundef <4 x i32> @wave_ballot_simple(i1 noundef %p1) {
+%dx.types.fouri32 = type { i32, i32, i32, i32 }
+
+define <4 x i32> @wave_ballot_simple(i1 noundef %p1) {
 entry:
-; CHECK: call <4 x i32> @dx.op.waveBallot.void(i32 118, i1 %p1)
-  %ret = call <4 x i32> @llvm.dx.wave.ballot(i1 %p1)
-  ret <4 x i32> %ret
+; CHECK: call %dx.types.fouri32 @dx.op.waveActiveBallot(i32 116, i1 %p1)
+; CHECK-NOT: ret %dx.types.fouri32
+; CHECK: ret <4 x i32>
----------------
inbelic wrote:

I see. I think I was confused here because I thought the extract/insert were being generated when lowering the llvm intrinsic -> dxil op, but I understand now that they are part of the test function and that only occurs during the hlsl builtin -> llvm intrinsic. Got it.

I think it might still be worth it to have a test case with the scalarizer to make sure it works as expected.


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


More information about the cfe-commits mailing list