brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 81fecf3 Raw
70 lines · plain
1; RUN: %if spirv-tools %{ spirv-as --target-env spv1.0 %s -o - | mlir-translate --deserialize-spirv - -o - | FileCheck %s %}2 3; This test is analogous to selection.spv but tests switch op.4 5; CHECK:      spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {6; CHECK-NEXT:   spirv.func @switch({{%.*}}: si32) "None" {7; CHECK:          {{%.*}} = spirv.Constant 1.000000e+00 : f328; CHECK-NEXT:     {{%.*}} = spirv.Undef : vector<3xf32>9; CHECK-NEXT:     {{%.*}} = spirv.CompositeInsert {{%.*}}, {{%.*}}[0 : i32] : f32 into vector<3xf32>10; CHECK-NEXT:     spirv.Branch ^[[bb:.+]]11; CHECK-NEXT:   ^[[bb:.+]]:12; CHECK-NEXT:     {{%.*}} = spirv.mlir.selection -> vector<3xf32> {13; CHECK-NEXT:     spirv.Switch {{%.*}} : si32, [14; CHECK-NEXT:       default: ^[[bb:.+]]({{%.*}}: vector<3xf32>),15; CHECK-NEXT:       0: ^[[bb:.+]]({{%.*}}: vector<3xf32>),16; CHECK-NEXT:       1: ^[[bb:.+]]({{%.*}}: vector<3xf32>)17; CHECK:          ^[[bb:.+]]({{%.*}}: vector<3xf32>):18; CHECK:            spirv.Branch ^[[bb:.+]]({{%.*}}: vector<3xf32>)19; CHECK-NEXT:     ^[[bb:.+]]({{%.*}}: vector<3xf32>):20; CHECK:            spirv.Branch ^[[bb:.+]]({{%.*}}: vector<3xf32>)21; CHECK-NEXT:     ^[[bb:.+]]({{%.*}}: vector<3xf32>):22; CHECK-NEXT:       spirv.mlir.merge %8 : vector<3xf32>23; CHECK-NEXT      }24; CHECK:          spirv.Return25; CHECK-NEXT:   }26; CHECK:      }27 28               OpCapability Shader29               OpMemoryModel Logical GLSL45030               OpEntryPoint GLCompute %main "main"31               OpExecutionMode %main LocalSize 1 1 132               OpName %switch "switch"33               OpName %main "main"34       %void = OpTypeVoid35        %int = OpTypeInt 32 136          %1 = OpTypeFunction %void %int37      %float = OpTypeFloat 3238    %float_1 = OpConstant %float 139    %v3float = OpTypeVector %float 340          %9 = OpUndef %v3float41    %float_3 = OpConstant %float 342    %float_4 = OpConstant %float 443    %float_2 = OpConstant %float 244         %25 = OpTypeFunction %void45     %switch = OpFunction %void None %146          %5 = OpFunctionParameter %int47          %6 = OpLabel48               OpBranch %1249         %12 = OpLabel50         %11 = OpCompositeInsert %v3float %float_1 %9 051               OpSelectionMerge %15 None52               OpSwitch %5 %15 0 %13 1 %1453         %13 = OpLabel54         %16 = OpPhi %v3float %11 %1255         %18 = OpCompositeInsert %v3float %float_3 %16 156               OpBranch %1557         %14 = OpLabel58         %19 = OpPhi %v3float %11 %1259         %21 = OpCompositeInsert %v3float %float_4 %19 160               OpBranch %1561         %15 = OpLabel62         %22 = OpPhi %v3float %21 %14 %18 %13 %11 %1263         %24 = OpCompositeInsert %v3float %float_2 %22 264               OpReturn65               OpFunctionEnd66       %main = OpFunction %void None %2567         %27 = OpLabel68               OpReturn69               OpFunctionEnd70