spir-v writer support for subgroupBroadcast

Bug: tint:2041
Change-Id: Ib7e8da8bb73dae9e6254fde506601e0285bffa99
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/151582
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: David Neto <dneto@google.com>
diff --git a/src/tint/lang/spirv/writer/ast_printer/builder.cc b/src/tint/lang/spirv/writer/ast_printer/builder.cc
index 27fe8b4..9756664 100644
--- a/src/tint/lang/spirv/writer/ast_printer/builder.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/builder.cc
@@ -2574,6 +2574,19 @@
             }
             return result_id;
         }
+        case core::Function::kSubgroupBroadcast: {
+            module_.PushCapability(SpvCapabilityGroupNonUniformBallot);
+            auto first_param_id = get_arg_as_value_id(0);
+            auto second_param_id = get_arg_as_value_id(1);
+            if (!push_function_inst(
+                    spv::Op::OpGroupNonUniformBroadcast,
+                    {Operand(result_type_id), result,
+                     Operand(GenerateConstantIfNeeded(ScalarConstant::U32(SpvScopeSubgroup))),
+                     Operand(first_param_id), Operand(second_param_id)})) {
+                return 0;
+            }
+            return result_id;
+        }
         default: {
             auto inst_id = builtin_to_glsl_method(builtin);
             if (inst_id == 0) {
diff --git a/src/tint/lang/spirv/writer/builtin_test.cc b/src/tint/lang/spirv/writer/builtin_test.cc
index a725e1a..7e51a65 100644
--- a/src/tint/lang/spirv/writer/builtin_test.cc
+++ b/src/tint/lang/spirv/writer/builtin_test.cc
@@ -1786,6 +1786,45 @@
     EXPECT_INST("%result = OpGroupNonUniformBallot %v4uint %uint_3 %true");
 }
 
+TEST_F(SpirvWriterTest, Builtin_SubgroupBroadcastValueF32) {
+    auto* func = b.Function("foo", ty.f32());
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call(ty.f32(), core::Function::kSubgroupBroadcast, 1_f, 0_u);
+        mod.SetName(result, "result");
+        b.Return(func, result);
+    });
+
+    ASSERT_TRUE(Generate()) << Error() << output_;
+    EXPECT_INST("OpCapability GroupNonUniformBallot");
+    EXPECT_INST("%result = OpGroupNonUniformBroadcast %float %uint_3 %float_1 %uint_0");
+}
+
+TEST_F(SpirvWriterTest, Builtin_SubgroupBroadcastValueI32) {
+    auto* func = b.Function("foo", ty.i32());
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call(ty.i32(), core::Function::kSubgroupBroadcast, 1_i, 0_u);
+        mod.SetName(result, "result");
+        b.Return(func, result);
+    });
+
+    ASSERT_TRUE(Generate()) << Error() << output_;
+    EXPECT_INST("OpCapability GroupNonUniformBallot");
+    EXPECT_INST("%result = OpGroupNonUniformBroadcast %int %uint_3 %int_1 %uint_0");
+}
+
+TEST_F(SpirvWriterTest, Builtin_SubgroupBroadcastValueU32) {
+    auto* func = b.Function("foo", ty.u32());
+    b.Append(func->Block(), [&] {
+        auto* result = b.Call(ty.u32(), core::Function::kSubgroupBroadcast, 1_u, 0_u);
+        mod.SetName(result, "result");
+        b.Return(func, result);
+    });
+
+    ASSERT_TRUE(Generate()) << Error() << output_;
+    EXPECT_INST("OpCapability GroupNonUniformBallot");
+    EXPECT_INST("%result = OpGroupNonUniformBroadcast %uint %uint_3 %uint_1 %uint_0");
+}
+
 TEST_F(SpirvWriterTest, Builtin_ArrayLength) {
     auto* var = b.Var("var", ty.ptr(storage, ty.runtime_array(ty.i32())));
     var->SetBindingPoint(0, 0);
diff --git a/src/tint/lang/spirv/writer/printer/printer.cc b/src/tint/lang/spirv/writer/printer/printer.cc
index 2b882ee..5708fef 100644
--- a/src/tint/lang/spirv/writer/printer/printer.cc
+++ b/src/tint/lang/spirv/writer/printer/printer.cc
@@ -1402,6 +1402,11 @@
             operands.push_back(Constant(ir_->constant_values.Get(u32(spv::Scope::Subgroup))));
             operands.push_back(Constant(ir_->constant_values.Get(true)));
             break;
+        case core::Function::kSubgroupBroadcast:
+            module_.PushCapability(SpvCapabilityGroupNonUniformBallot);
+            op = spv::Op::OpGroupNonUniformBroadcast;
+            operands.push_back(Constant(ir_->constant_values.Get(u32(spv::Scope::Subgroup))));
+            break;
         case core::Function::kTan:
             glsl_ext_inst(GLSLstd450Tan);
             break;
diff --git a/test/tint/builtins/gen/literal/subgroupBroadcast/08beca.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/subgroupBroadcast/08beca.wgsl.expected.spvasm
index eed3359..ef0d6b0 100644
--- a/test/tint/builtins/gen/literal/subgroupBroadcast/08beca.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/subgroupBroadcast/08beca.wgsl.expected.spvasm
@@ -1,9 +1,49 @@
-SKIP: FAILED
-
-/build/dawn/src/tint/lang/spirv/writer/ast_printer/builder.cc:2580 internal compiler error: unknown method subgroupBroadcast
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+               OpCapability Shader
+               OpCapability GroupNonUniformBallot
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
+               OpName %subgroupBroadcast_08beca "subgroupBroadcast_08beca"
+               OpName %res "res"
+               OpName %compute_main "compute_main"
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
+      %float = OpTypeFloat 32
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+     %uint_3 = OpConstant %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+         %16 = OpConstantNull %float
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%subgroupBroadcast_08beca = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_float Function %16
+          %9 = OpGroupNonUniformBroadcast %float %uint_3 %float_1 %uint_1
+               OpStore %res %9
+         %19 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %20 = OpLoad %float %res
+               OpStore %19 %20
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %22 = OpLabel
+         %23 = OpFunctionCall %void %subgroupBroadcast_08beca
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/subgroupBroadcast/1d79c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/subgroupBroadcast/1d79c7.wgsl.expected.spvasm
index eed3359..23742d2 100644
--- a/test/tint/builtins/gen/literal/subgroupBroadcast/1d79c7.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/subgroupBroadcast/1d79c7.wgsl.expected.spvasm
@@ -1,9 +1,49 @@
-SKIP: FAILED
-
-/build/dawn/src/tint/lang/spirv/writer/ast_printer/builder.cc:2580 internal compiler error: unknown method subgroupBroadcast
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+               OpCapability Shader
+               OpCapability GroupNonUniformBallot
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
+               OpName %subgroupBroadcast_1d79c7 "subgroupBroadcast_1d79c7"
+               OpName %res "res"
+               OpName %compute_main "compute_main"
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
+        %int = OpTypeInt 32 1
+%prevent_dce_block = OpTypeStruct %int
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+      %int_1 = OpConstant %int 1
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+     %uint_3 = OpConstant %uint 3
+%_ptr_Function_int = OpTypePointer Function %int
+         %16 = OpConstantNull %int
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%subgroupBroadcast_1d79c7 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_int Function %16
+          %9 = OpGroupNonUniformBroadcast %int %uint_3 %int_1 %uint_1
+               OpStore %res %9
+         %19 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %20 = OpLoad %int %res
+               OpStore %19 %20
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %22 = OpLabel
+         %23 = OpFunctionCall %void %subgroupBroadcast_1d79c7
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/subgroupBroadcast/c36fe1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/subgroupBroadcast/c36fe1.wgsl.expected.spvasm
index eed3359..acfbb61 100644
--- a/test/tint/builtins/gen/literal/subgroupBroadcast/c36fe1.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/subgroupBroadcast/c36fe1.wgsl.expected.spvasm
@@ -1,9 +1,47 @@
-SKIP: FAILED
-
-/build/dawn/src/tint/lang/spirv/writer/ast_printer/builder.cc:2580 internal compiler error: unknown method subgroupBroadcast
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 22
+; Schema: 0
+               OpCapability Shader
+               OpCapability GroupNonUniformBallot
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
+               OpName %subgroupBroadcast_c36fe1 "subgroupBroadcast_c36fe1"
+               OpName %res "res"
+               OpName %compute_main "compute_main"
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
+       %uint = OpTypeInt 32 0
+%prevent_dce_block = OpTypeStruct %uint
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+     %uint_1 = OpConstant %uint 1
+     %uint_3 = OpConstant %uint 3
+%_ptr_Function_uint = OpTypePointer Function %uint
+         %14 = OpConstantNull %uint
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%subgroupBroadcast_c36fe1 = OpFunction %void None %5
+          %8 = OpLabel
+        %res = OpVariable %_ptr_Function_uint Function %14
+          %9 = OpGroupNonUniformBroadcast %uint %uint_3 %uint_1 %uint_1
+               OpStore %res %9
+         %17 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %18 = OpLoad %uint %res
+               OpStore %17 %18
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %20 = OpLabel
+         %21 = OpFunctionCall %void %subgroupBroadcast_c36fe1
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/subgroupBroadcast/08beca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/subgroupBroadcast/08beca.wgsl.expected.spvasm
index eed3359..73537ab 100644
--- a/test/tint/builtins/gen/var/subgroupBroadcast/08beca.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/subgroupBroadcast/08beca.wgsl.expected.spvasm
@@ -1,9 +1,53 @@
-SKIP: FAILED
-
-/build/dawn/src/tint/lang/spirv/writer/ast_printer/builder.cc:2580 internal compiler error: unknown method subgroupBroadcast
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+               OpCapability GroupNonUniformBallot
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
+               OpName %subgroupBroadcast_08beca "subgroupBroadcast_08beca"
+               OpName %arg_0 "arg_0"
+               OpName %res "res"
+               OpName %compute_main "compute_main"
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
+      %float = OpTypeFloat 32
+%prevent_dce_block = OpTypeStruct %float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+    %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+         %12 = OpConstantNull %float
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+     %uint_3 = OpConstant %uint 3
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+%subgroupBroadcast_08beca = OpFunction %void None %5
+          %8 = OpLabel
+      %arg_0 = OpVariable %_ptr_Function_float Function %12
+        %res = OpVariable %_ptr_Function_float Function %12
+               OpStore %arg_0 %float_1
+         %14 = OpLoad %float %arg_0
+         %13 = OpGroupNonUniformBroadcast %float %uint_3 %14 %uint_1
+               OpStore %res %13
+         %21 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+         %22 = OpLoad %float %res
+               OpStore %21 %22
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %subgroupBroadcast_08beca
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/subgroupBroadcast/1d79c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/subgroupBroadcast/1d79c7.wgsl.expected.spvasm
index eed3359..fae8d7d 100644
--- a/test/tint/builtins/gen/var/subgroupBroadcast/1d79c7.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/subgroupBroadcast/1d79c7.wgsl.expected.spvasm
@@ -1,9 +1,53 @@
-SKIP: FAILED
-
-/build/dawn/src/tint/lang/spirv/writer/ast_printer/builder.cc:2580 internal compiler error: unknown method subgroupBroadcast
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+               OpCapability Shader
+               OpCapability GroupNonUniformBallot
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
+               OpName %subgroupBroadcast_1d79c7 "subgroupBroadcast_1d79c7"
+               OpName %arg_0 "arg_0"
+               OpName %res "res"
+               OpName %compute_main "compute_main"
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
+        %int = OpTypeInt 32 1
+%prevent_dce_block = OpTypeStruct %int
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+      %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+         %12 = OpConstantNull %int
+       %uint = OpTypeInt 32 0
+     %uint_1 = OpConstant %uint 1
+     %uint_3 = OpConstant %uint 3
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%subgroupBroadcast_1d79c7 = OpFunction %void None %5
+          %8 = OpLabel
+      %arg_0 = OpVariable %_ptr_Function_int Function %12
+        %res = OpVariable %_ptr_Function_int Function %12
+               OpStore %arg_0 %int_1
+         %14 = OpLoad %int %arg_0
+         %13 = OpGroupNonUniformBroadcast %int %uint_3 %14 %uint_1
+               OpStore %res %13
+         %21 = OpAccessChain %_ptr_StorageBuffer_int %prevent_dce %uint_0
+         %22 = OpLoad %int %res
+               OpStore %21 %22
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %24 = OpLabel
+         %25 = OpFunctionCall %void %subgroupBroadcast_1d79c7
+               OpReturn
+               OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/subgroupBroadcast/c36fe1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/subgroupBroadcast/c36fe1.wgsl.expected.spvasm
index eed3359..265e766 100644
--- a/test/tint/builtins/gen/var/subgroupBroadcast/c36fe1.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/subgroupBroadcast/c36fe1.wgsl.expected.spvasm
@@ -1,9 +1,51 @@
-SKIP: FAILED
-
-/build/dawn/src/tint/lang/spirv/writer/ast_printer/builder.cc:2580 internal compiler error: unknown method subgroupBroadcast
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+               OpCapability Shader
+               OpCapability GroupNonUniformBallot
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint GLCompute %compute_main "compute_main"
+               OpExecutionMode %compute_main LocalSize 1 1 1
+               OpName %prevent_dce_block "prevent_dce_block"
+               OpMemberName %prevent_dce_block 0 "inner"
+               OpName %prevent_dce "prevent_dce"
+               OpName %subgroupBroadcast_c36fe1 "subgroupBroadcast_c36fe1"
+               OpName %arg_0 "arg_0"
+               OpName %res "res"
+               OpName %compute_main "compute_main"
+               OpDecorate %prevent_dce_block Block
+               OpMemberDecorate %prevent_dce_block 0 Offset 0
+               OpDecorate %prevent_dce DescriptorSet 2
+               OpDecorate %prevent_dce Binding 0
+       %uint = OpTypeInt 32 0
+%prevent_dce_block = OpTypeStruct %uint
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
+       %void = OpTypeVoid
+          %5 = OpTypeFunction %void
+     %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+         %12 = OpConstantNull %uint
+     %uint_3 = OpConstant %uint 3
+     %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%subgroupBroadcast_c36fe1 = OpFunction %void None %5
+          %8 = OpLabel
+      %arg_0 = OpVariable %_ptr_Function_uint Function %12
+        %res = OpVariable %_ptr_Function_uint Function %12
+               OpStore %arg_0 %uint_1
+         %14 = OpLoad %uint %arg_0
+         %13 = OpGroupNonUniformBroadcast %uint %uint_3 %14 %uint_1
+               OpStore %res %13
+         %19 = OpAccessChain %_ptr_StorageBuffer_uint %prevent_dce %uint_0
+         %20 = OpLoad %uint %res
+               OpStore %19 %20
+               OpReturn
+               OpFunctionEnd
+%compute_main = OpFunction %void None %5
+         %22 = OpLabel
+         %23 = OpFunctionCall %void %subgroupBroadcast_c36fe1
+               OpReturn
+               OpFunctionEnd