Debian Codegraph @

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveCountBits.ll

raw
1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32v1.3-vulkan-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; CHECK-DAG: %[[#uint:]] = OpTypeInt 32 0
5 ; CHECK-DAG: %[[#ballot_type:]] = OpTypeVector %[[#uint]] 4
6 ; CHECK-DAG: %[[#bool:]] = OpTypeBool
7 ; CHECK-DAG: %[[#scope:]] = OpConstant %[[#uint]] 3
8
9 ; CHECK-LABEL: Begin function test_fun
10 ; CHECK: %[[#bexpr:]] = OpFunctionParameter %[[#bool]]
11 define i32 @test_fun(i1 %expr) {
12 entry:
13 ; CHECK: %[[#ballot:]] = OpGroupNonUniformBallot %[[#ballot_type]] %[[#scope]] %[[#bexpr]]
14 ; CHECK: %[[#ret:]] = OpGroupNonUniformBallotBitCount %[[#uint]] %[[#scope]] Reduce %[[#ballot]]
15 %0 = call i32 @llvm.spv.wave.active.countbits(i1 %expr)
16 ret i32 %0
17 }
18
19 declare i32 @llvm.dx.wave.active.countbits(i1)