| ; SPIR-V |
| ; Version: 1.3 |
| ; Generator: Google Tint Compiler; 0 |
| ; Bound: 50 |
| ; Schema: 0 |
| OpCapability Shader |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint Fragment %foo "foo" %value |
| OpExecutionMode %foo OriginUpperLeft |
| OpName %tint_discarded "tint_discarded" |
| OpName %value "value" |
| OpName %a_block "a_block" |
| OpMemberName %a_block 0 "inner" |
| OpName %a "a" |
| OpName %foo_inner "foo_inner" |
| OpName %x "x" |
| OpName %__atomic_compare_exchange_result_i32 "__atomic_compare_exchange_result_i32" |
| OpMemberName %__atomic_compare_exchange_result_i32 0 "old_value" |
| OpMemberName %__atomic_compare_exchange_result_i32 1 "exchanged" |
| OpName %tint_symbol "tint_symbol" |
| OpName %foo "foo" |
| OpDecorate %value Location 0 |
| OpDecorate %a_block Block |
| OpMemberDecorate %a_block 0 Offset 0 |
| OpDecorate %a DescriptorSet 0 |
| OpDecorate %a Binding 0 |
| OpMemberDecorate %__atomic_compare_exchange_result_i32 0 Offset 0 |
| OpMemberDecorate %__atomic_compare_exchange_result_i32 1 Offset 4 |
| %bool = OpTypeBool |
| %2 = OpConstantNull %bool |
| %_ptr_Private_bool = OpTypePointer Private %bool |
| %tint_discarded = OpVariable %_ptr_Private_bool Private %2 |
| %int = OpTypeInt 32 1 |
| %_ptr_Output_int = OpTypePointer Output %int |
| %8 = OpConstantNull %int |
| %value = OpVariable %_ptr_Output_int Output %8 |
| %a_block = OpTypeStruct %int |
| %_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block |
| %a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer |
| %12 = OpTypeFunction %int |
| %true = OpConstantTrue %bool |
| %_ptr_Function_int = OpTypePointer Function %int |
| %__atomic_compare_exchange_result_i32 = OpTypeStruct %int %bool |
| %_ptr_Function___atomic_compare_exchange_result_i32 = OpTypePointer Function %__atomic_compare_exchange_result_i32 |
| %21 = OpConstantNull %__atomic_compare_exchange_result_i32 |
| %uint = OpTypeInt 32 0 |
| %uint_1 = OpConstant %uint 1 |
| %uint_0 = OpConstant %uint 0 |
| %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int |
| %int_1 = OpConstant %int 1 |
| %void = OpTypeVoid |
| %42 = OpTypeFunction %void |
| %foo_inner = OpFunction %int None %12 |
| %14 = OpLabel |
| %x = OpVariable %_ptr_Function_int Function %8 |
| %tint_symbol = OpVariable %_ptr_Function___atomic_compare_exchange_result_i32 Function %21 |
| OpStore %tint_discarded %true |
| OpStore %x %8 |
| %23 = OpLoad %bool %tint_discarded |
| %22 = OpLogicalNot %bool %23 |
| OpSelectionMerge %24 None |
| OpBranchConditional %22 %25 %24 |
| %25 = OpLabel |
| %32 = OpAccessChain %_ptr_StorageBuffer_int %a %uint_0 |
| %34 = OpAtomicCompareExchange %int %32 %uint_1 %uint_0 %uint_0 %int_1 %8 |
| %35 = OpIEqual %bool %34 %8 |
| %26 = OpCompositeConstruct %__atomic_compare_exchange_result_i32 %34 %35 |
| OpStore %tint_symbol %26 |
| OpBranch %24 |
| %24 = OpLabel |
| %36 = OpLoad %__atomic_compare_exchange_result_i32 %tint_symbol |
| %37 = OpCompositeExtract %bool %36 1 |
| OpSelectionMerge %38 None |
| OpBranchConditional %37 %39 %38 |
| %39 = OpLabel |
| %40 = OpCompositeExtract %int %36 0 |
| OpStore %x %40 |
| OpBranch %38 |
| %38 = OpLabel |
| %41 = OpLoad %int %x |
| OpReturnValue %41 |
| OpFunctionEnd |
| %foo = OpFunction %void None %42 |
| %45 = OpLabel |
| %46 = OpFunctionCall %int %foo_inner |
| OpStore %value %46 |
| %47 = OpLoad %bool %tint_discarded |
| OpSelectionMerge %48 None |
| OpBranchConditional %47 %49 %48 |
| %49 = OpLabel |
| OpKill |
| %48 = OpLabel |
| OpReturn |
| OpFunctionEnd |