brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · 59410ec Raw
158 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; [numthreads(1, 1, 1)]6; void main() {7;   int val=0, i=0, j=0, k=0;8;9;   while (i < 10) {10;     val = val + i;11;     while (j < 20) {12;       while (k < 30) {13;         val = val + k;14;         ++k;15;       }16;17;       val = val * 2;18;       ++j;19;     }20;21;     ++i;22;   }23; }24 25; CHECK: %[[#func_12:]] = OpFunction %[[#void:]] DontInline %[[#]]26; CHECK:    %[[#bb39:]] = OpLabel27; CHECK:                  OpBranch %[[#bb40:]]28; CHECK:     %[[#bb40]] = OpLabel29; CHECK:                  OpLoopMerge %[[#bb41:]] %[[#bb42:]] None30; CHECK:                  OpBranchConditional %[[#]] %[[#bb43:]] %[[#bb41]]31; CHECK:     %[[#bb41]] = OpLabel32; CHECK:                  OpReturn33; CHECK:     %[[#bb43]] = OpLabel34; CHECK:                  OpBranch %[[#bb44:]]35; CHECK:     %[[#bb44]] = OpLabel36; CHECK:                  OpLoopMerge %[[#bb45:]] %[[#bb46:]] None37; CHECK:                  OpBranchConditional %[[#]] %[[#bb47:]] %[[#bb45]]38; CHECK:     %[[#bb45]] = OpLabel39; CHECK:                  OpBranch %[[#bb42]]40; CHECK:     %[[#bb42]] = OpLabel41; CHECK:                  OpBranch %[[#bb40]]42; CHECK:     %[[#bb47]] = OpLabel43; CHECK:                  OpLoopMerge %[[#bb48:]] %[[#bb49:]] None44; CHECK:                  OpBranchConditional %[[#]] %[[#bb49]] %[[#bb48]]45; CHECK:     %[[#bb48]] = OpLabel46; CHECK:                  OpBranch %[[#bb46]]47; CHECK:     %[[#bb46]] = OpLabel48; CHECK:                  OpBranch %[[#bb44]]49; CHECK:     %[[#bb49]] = OpLabel50; CHECK:                  OpBranch %[[#bb47]]51; CHECK:                  OpFunctionEnd52; CHECK: %[[#func_37:]] = OpFunction %[[#void:]] None %[[#]]53; CHECK:    %[[#bb50:]] = OpLabel54; CHECK:                  OpReturn55; CHECK:                  OpFunctionEnd56 57 58 59target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"60target triple = "spirv-unknown-vulkan1.3-compute"61 62; Function Attrs: convergent noinline norecurse nounwind optnone63define internal spir_func void @main() #0 {64entry:65  %0 = call token @llvm.experimental.convergence.entry()66  %val = alloca i32, align 467  %i = alloca i32, align 468  %j = alloca i32, align 469  %k = alloca i32, align 470  store i32 0, ptr %val, align 471  store i32 0, ptr %i, align 472  store i32 0, ptr %j, align 473  store i32 0, ptr %k, align 474  br label %while.cond75 76while.cond:                                       ; preds = %while.end9, %entry77  %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]78  %2 = load i32, ptr %i, align 479  %cmp = icmp slt i32 %2, 1080  br i1 %cmp, label %while.body, label %while.end1181 82while.body:                                       ; preds = %while.cond83  %3 = load i32, ptr %val, align 484  %4 = load i32, ptr %i, align 485  %add = add nsw i32 %3, %486  store i32 %add, ptr %val, align 487  br label %while.cond188 89while.cond1:                                      ; preds = %while.end, %while.body90  %5 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %1) ]91  %6 = load i32, ptr %j, align 492  %cmp2 = icmp slt i32 %6, 2093  br i1 %cmp2, label %while.body3, label %while.end994 95while.body3:                                      ; preds = %while.cond196  br label %while.cond497 98while.cond4:                                      ; preds = %while.body6, %while.body399  %7 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %5) ]100  %8 = load i32, ptr %k, align 4101  %cmp5 = icmp slt i32 %8, 30102  br i1 %cmp5, label %while.body6, label %while.end103 104while.body6:                                      ; preds = %while.cond4105  %9 = load i32, ptr %val, align 4106  %10 = load i32, ptr %k, align 4107  %add7 = add nsw i32 %9, %10108  store i32 %add7, ptr %val, align 4109  %11 = load i32, ptr %k, align 4110  %inc = add nsw i32 %11, 1111  store i32 %inc, ptr %k, align 4112  br label %while.cond4113 114while.end:                                        ; preds = %while.cond4115  %12 = load i32, ptr %val, align 4116  %mul = mul nsw i32 %12, 2117  store i32 %mul, ptr %val, align 4118  %13 = load i32, ptr %j, align 4119  %inc8 = add nsw i32 %13, 1120  store i32 %inc8, ptr %j, align 4121  br label %while.cond1122 123while.end9:                                       ; preds = %while.cond1124  %14 = load i32, ptr %i, align 4125  %inc10 = add nsw i32 %14, 1126  store i32 %inc10, ptr %i, align 4127  br label %while.cond128 129while.end11:                                      ; preds = %while.cond130  ret void131}132 133; Function Attrs: convergent norecurse134define void @main.1() #1 {135entry:136  call void @main()137  ret void138}139 140; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)141declare token @llvm.experimental.convergence.entry() #2142 143; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)144declare token @llvm.experimental.convergence.loop() #2145 146attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }147attributes #1 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }148attributes #2 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }149 150!llvm.module.flags = !{!0, !1, !2}151 152 153!0 = !{i32 1, !"wchar_size", i32 4}154!1 = !{i32 4, !"dx.disable_optimizations", i32 1}155!2 = !{i32 7, !"frame-pointer", i32 2}156 157 158