72 lines · plain
1; RUN: %if spirv-tools %{ spirv-as --target-env spv1.0 %s -o - | mlir-translate --deserialize-spirv - -o - | FileCheck %s %}2 3; COM: The purpose of this test is to check that in the case where two selections4; COM: regions share a header / merge block, this block is split and the selection5; COM: regions are not incorrectly nested.6 7; CHECK: spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {8; CHECK: spirv.func @main() "None" {9; CHECK: spirv.mlir.selection {10; CHECK-NEXT: spirv.BranchConditional {{.*}}, ^[[bb:.+]], ^[[bb:.+]]11; CHECK-NEXT: ^[[bb:.+]]12; CHECK: spirv.Branch ^[[bb:.+]]13; CHECK-NEXT: ^[[bb:.+]]:14; CHECK-NEXT: spirv.mlir.merge15; CHECK-NEXT: }16; CHECK: spirv.mlir.selection {17; CHECK-NEXT: spirv.BranchConditional {{.*}}, ^[[bb:.+]], ^[[bb:.+]]18; CHECK-NEXT: ^[[bb:.+]]19; CHECK: spirv.Branch ^[[bb:.+]]20; CHECK-NEXT: ^[[bb:.+]]:21; CHECK-NEXT: spirv.mlir.merge22; CHECK-NEXT: }23; CHECK: spirv.Return24; CHECK-NEXT: }25; CHECK: }26 27 OpCapability Shader28 %2 = OpExtInstImport "GLSL.std.450"29 OpMemoryModel Logical GLSL45030 OpEntryPoint Fragment %main "main" %colorOut31 OpExecutionMode %main OriginUpperLeft32 OpDecorate %colorOut Location 033 %void = OpTypeVoid34 %4 = OpTypeFunction %void35 %float = OpTypeFloat 3236 %v4float = OpTypeVector %float 437%fun_v4float = OpTypePointer Function %v4float38 %float_1 = OpConstant %float 139 %float_0 = OpConstant %float 040 %13 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_141%out_v4float = OpTypePointer Output %v4float42 %colorOut = OpVariable %out_v4float Output 43 %uint = OpTypeInt 32 044 %uint_0 = OpConstant %uint 045 %out_float = OpTypePointer Output %float46 %bool = OpTypeBool47 %25 = OpConstantComposite %v4float %float_1 %float_1 %float_0 %float_148 %main = OpFunction %void None %449 %6 = OpLabel50 %color = OpVariable %fun_v4float Function51 OpStore %color %1352 %19 = OpAccessChain %out_float %colorOut %uint_053 %20 = OpLoad %float %1954 %22 = OpFOrdEqual %bool %20 %float_155 OpSelectionMerge %24 None56 OpBranchConditional %22 %23 %2457 %23 = OpLabel58 OpStore %color %2559 OpBranch %2460 %24 = OpLabel61 %30 = OpFOrdEqual %bool %20 %float_162 OpSelectionMerge %32 None63 OpBranchConditional %30 %31 %3264 %31 = OpLabel65 OpStore %color %2566 OpBranch %3267 %32 = OpLabel68 %26 = OpLoad %v4float %color69 OpStore %colorOut %2670 OpReturn71 OpFunctionEnd72