brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · 125e3f7 Raw
127 lines · plain
1; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}3 4;5; int process() {6;   int b = 0;7;   const int t = 50;8;9;   switch(int d = 5) {10;     case t:11;       b = t;12;     case 4:13;     case 5:14;       b = 5;15;       break;16;     default:17;       break;18;   }19;20;   return b;21; }22;23; [numthreads(1, 1, 1)]24; void main() {25;   process();26; }27 28; CHECK: %[[#func_13:]] = OpFunction %[[#uint:]] DontInline %[[#]]29; CHECK:    %[[#bb25:]] = OpLabel30; CHECK:                  OpSelectionMerge %[[#bb26:]] None31; CHECK:                  OpBranchConditional %[[#]] %[[#bb27:]] %[[#bb28:]]32; CHECK:    %[[#bb27:]] = OpLabel33; CHECK:                  OpSelectionMerge %[[#bb29:]] None34; CHECK:                  OpSwitch %[[#]] %[[#bb30:]] 50 %[[#bb31:]] 4 %[[#bb29:]] 5 %[[#bb32:]]35; CHECK:    %[[#bb28:]] = OpLabel36; CHECK:    %[[#bb30:]] = OpLabel37; CHECK:                  OpBranch %[[#bb29:]]38; CHECK:    %[[#bb31:]] = OpLabel39; CHECK:                  OpBranch %[[#bb29:]]40; CHECK:    %[[#bb32:]] = OpLabel41; CHECK:                  OpBranch %[[#bb29:]]42; CHECK:    %[[#bb29:]] = OpLabel43; CHECK:                  OpBranchConditional %[[#]] %[[#bb33:]] %[[#bb26:]]44; CHECK:    %[[#bb33:]] = OpLabel45; CHECK:                  OpBranch %[[#bb26:]]46; CHECK:    %[[#bb26:]] = OpLabel47; CHECK:                  OpReturnValue %[[#]]48; CHECK:                  OpFunctionEnd49; CHECK: %[[#func_21:]] = OpFunction %[[#void:]] DontInline %[[#]]50; CHECK:    %[[#bb34:]] = OpLabel51; CHECK:                  OpReturn52; CHECK:                  OpFunctionEnd53; CHECK: %[[#func_23:]] = OpFunction %[[#void:]] None %[[#]]54; CHECK:    %[[#bb35:]] = OpLabel55; CHECK:                  OpReturn56; CHECK:                  OpFunctionEnd57 58 59 60target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"61target triple = "spirv-unknown-vulkan1.3-compute"62 63; Function Attrs: convergent noinline norecurse nounwind optnone64define spir_func noundef i32 @_Z7processv() #0 {65entry:66  %0 = call token @llvm.experimental.convergence.entry()67  %b = alloca i32, align 468  %t = alloca i32, align 469  %d = alloca i32, align 470  store i32 0, ptr %b, align 471  store i32 50, ptr %t, align 472  store i32 5, ptr %d, align 473  %1 = load i32, ptr %d, align 474  switch i32 %1, label %sw.default [75    i32 50, label %sw.bb76    i32 4, label %sw.bb177    i32 5, label %sw.bb178  ]79 80sw.bb:                                            ; preds = %entry81  store i32 50, ptr %b, align 482  br label %sw.bb183 84sw.bb1:                                           ; preds = %entry, %entry, %sw.bb85  store i32 5, ptr %b, align 486  br label %sw.epilog87 88sw.default:                                       ; preds = %entry89  br label %sw.epilog90 91sw.epilog:                                        ; preds = %sw.default, %sw.bb192  %2 = load i32, ptr %b, align 493  ret i32 %294}95 96; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)97declare token @llvm.experimental.convergence.entry() #198 99; Function Attrs: convergent noinline norecurse nounwind optnone100define internal spir_func void @main() #0 {101entry:102  %0 = call token @llvm.experimental.convergence.entry()103  %call1 = call spir_func noundef i32 @_Z7processv() #3 [ "convergencectrl"(token %0) ]104  ret void105}106 107; Function Attrs: convergent norecurse108define void @main.1() #2 {109entry:110  call void @main()111  ret void112}113 114attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }115attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }116attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }117attributes #3 = { convergent }118 119!llvm.module.flags = !{!0, !1, !2}120 121 122!0 = !{i32 1, !"wchar_size", i32 4}123!1 = !{i32 4, !"dx.disable_optimizations", i32 1}124!2 = !{i32 7, !"frame-pointer", i32 2}125 126 127