brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · 64fc651 Raw
163 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;6; int process() {7;   int c1 = 0;8;   int c2 = 1;9;   int c3 = 0;10;   int c4 = 1;11;   int val = 0;12;13;   if (c1) {14;     if (c2)15;       val = 1;16;   } else {17;     if (c3) {18;       val = 2;19;     } else {20;       if (c4) {21;         val = 3;22;       }23;     }24;   }25;   return val;26; }27;28; [numthreads(1, 1, 1)]29; void main() {30;   process();31; }32 33; CHECK: %[[#func_11:]] = OpFunction %[[#uint:]] DontInline %[[#]]34; CHECK:    %[[#bb30:]] = OpLabel35; CHECK:                  OpSelectionMerge %[[#bb31:]] None36; CHECK:                  OpBranchConditional %[[#]] %[[#bb32:]] %[[#bb33:]]37; CHECK:     %[[#bb33]] = OpLabel38; CHECK:                  OpSelectionMerge %[[#bb34:]] None39; CHECK:                  OpBranchConditional %[[#]] %[[#bb35:]] %[[#bb36:]]40; CHECK:     %[[#bb36]] = OpLabel41; CHECK:                  OpSelectionMerge %[[#bb37:]] None42; CHECK:                  OpBranchConditional %[[#]] %[[#bb38:]] %[[#bb37]]43; CHECK:     %[[#bb38]] = OpLabel44; CHECK:                  OpBranch %[[#bb37]]45; CHECK:     %[[#bb37]] = OpLabel46; CHECK:                  OpBranch %[[#bb34]]47; CHECK:     %[[#bb35]] = OpLabel48; CHECK:                  OpBranch %[[#bb34]]49; CHECK:     %[[#bb34]] = OpLabel50; CHECK:                  OpBranch %[[#bb31]]51; CHECK:     %[[#bb32]] = OpLabel52; CHECK:                  OpSelectionMerge %[[#bb39:]] None53; CHECK:                  OpBranchConditional %[[#]] %[[#bb40:]] %[[#bb39]]54; CHECK:     %[[#bb40]] = OpLabel55; CHECK:                  OpBranch %[[#bb39]]56; CHECK:     %[[#bb39]] = OpLabel57; CHECK:                  OpBranch %[[#bb31]]58; CHECK:     %[[#bb31]] = OpLabel59; CHECK:                  OpReturnValue %[[#]]60; CHECK:                  OpFunctionEnd61; CHECK: %[[#func_26:]] = OpFunction %[[#void:]] DontInline %[[#]]62; CHECK:    %[[#bb41:]] = OpLabel63; CHECK:                  OpReturn64; CHECK:                  OpFunctionEnd65; CHECK: %[[#func_28:]] = OpFunction %[[#void]] None %[[#]]66; CHECK:    %[[#bb42:]] = OpLabel67; CHECK:                  OpReturn68; CHECK:                  OpFunctionEnd69 70target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"71target triple = "spirv-unknown-vulkan1.3-compute"72 73; Function Attrs: convergent noinline norecurse nounwind optnone74define spir_func noundef i32 @_Z7processv() #0 {75entry:76  %0 = call token @llvm.experimental.convergence.entry()77  %c1 = alloca i32, align 478  %c2 = alloca i32, align 479  %c3 = alloca i32, align 480  %c4 = alloca i32, align 481  %val = alloca i32, align 482  store i32 0, ptr %c1, align 483  store i32 1, ptr %c2, align 484  store i32 0, ptr %c3, align 485  store i32 1, ptr %c4, align 486  store i32 0, ptr %val, align 487  %1 = load i32, ptr %c1, align 488  %tobool = icmp ne i32 %1, 089  br i1 %tobool, label %if.then, label %if.else90 91if.then:                                          ; preds = %entry92  %2 = load i32, ptr %c2, align 493  %tobool1 = icmp ne i32 %2, 094  br i1 %tobool1, label %if.then2, label %if.end95 96if.then2:                                         ; preds = %if.then97  store i32 1, ptr %val, align 498  br label %if.end99 100if.end:                                           ; preds = %if.then2, %if.then101  br label %if.end10102 103if.else:                                          ; preds = %entry104  %3 = load i32, ptr %c3, align 4105  %tobool3 = icmp ne i32 %3, 0106  br i1 %tobool3, label %if.then4, label %if.else5107 108if.then4:                                         ; preds = %if.else109  store i32 2, ptr %val, align 4110  br label %if.end9111 112if.else5:                                         ; preds = %if.else113  %4 = load i32, ptr %c4, align 4114  %tobool6 = icmp ne i32 %4, 0115  br i1 %tobool6, label %if.then7, label %if.end8116 117if.then7:                                         ; preds = %if.else5118  store i32 3, ptr %val, align 4119  br label %if.end8120 121if.end8:                                          ; preds = %if.then7, %if.else5122  br label %if.end9123 124if.end9:                                          ; preds = %if.end8, %if.then4125  br label %if.end10126 127if.end10:                                         ; preds = %if.end9, %if.end128  %5 = load i32, ptr %val, align 4129  ret i32 %5130}131 132; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)133declare token @llvm.experimental.convergence.entry() #1134 135; Function Attrs: convergent noinline norecurse nounwind optnone136define internal spir_func void @main() #0 {137entry:138  %0 = call token @llvm.experimental.convergence.entry()139  %call1 = call spir_func noundef i32 @_Z7processv() #3 [ "convergencectrl"(token %0) ]140  ret void141}142 143; Function Attrs: convergent norecurse144define void @main.1() #2 {145entry:146  call void @main()147  ret void148}149 150attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }151attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }152attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }153attributes #3 = { convergent }154 155!llvm.module.flags = !{!0, !1, !2}156 157 158!0 = !{i32 1, !"wchar_size", i32 4}159!1 = !{i32 4, !"dx.disable_optimizations", i32 1}160!2 = !{i32 7, !"frame-pointer", i32 2}161 162 163