brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.2 KiB · 7f77b6d Raw
307 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 a, b;8;   while (a && b) {9;   }10;11;   while (a || b) {12;   }13;   while (a && ((a || b) && b)) {14;   }15;16;   while (a ? a : b) {17;   }18;19;   int x, y;20;   while (x + (x && y)) {21;   }22; }23 24; CHECK: %[[#func_11:]] = OpFunction %[[#void:]] DontInline %[[#]]25; CHECK:    %[[#bb87:]] = OpLabel26; CHECK:                  OpBranch %[[#bb88:]]27; CHECK:     %[[#bb88]] = OpLabel28; CHECK:                  OpLoopMerge %[[#bb89:]] %[[#bb90:]] None29; CHECK:                  OpBranch %[[#bb91:]]30; CHECK:     %[[#bb91]] = OpLabel31; CHECK:                  OpSelectionMerge %[[#bb92:]] None32; CHECK:                  OpBranchConditional %[[#]] %[[#bb93:]] %[[#bb94:]]33; CHECK:     %[[#bb94]] = OpLabel34; CHECK:                  OpBranch %[[#bb92]]35; CHECK:     %[[#bb93]] = OpLabel36; CHECK:                  OpBranch %[[#bb92]]37; CHECK:     %[[#bb92]] = OpLabel38; CHECK:                  OpBranchConditional %[[#]] %[[#bb90]] %[[#bb89]]39; CHECK:     %[[#bb89]] = OpLabel40; CHECK:                  OpBranch %[[#bb95:]]41; CHECK:     %[[#bb95]] = OpLabel42; CHECK:                  OpLoopMerge %[[#bb96:]] %[[#bb97:]] None43; CHECK:                  OpBranch %[[#bb98:]]44; CHECK:     %[[#bb98]] = OpLabel45; CHECK:                  OpSelectionMerge %[[#bb99:]] None46; CHECK:                  OpBranchConditional %[[#]] %[[#bb100:]] %[[#bb101:]]47; CHECK:    %[[#bb101]] = OpLabel48; CHECK:                  OpBranch %[[#bb99]]49; CHECK:    %[[#bb100]] = OpLabel50; CHECK:                  OpBranch %[[#bb99]]51; CHECK:     %[[#bb99]] = OpLabel52; CHECK:                  OpBranchConditional %[[#]] %[[#bb97]] %[[#bb96]]53; CHECK:     %[[#bb96]] = OpLabel54; CHECK:                  OpBranch %[[#bb102:]]55; CHECK:    %[[#bb102]] = OpLabel56; CHECK:                  OpLoopMerge %[[#bb103:]] %[[#bb104:]] None57; CHECK:                  OpBranch %[[#bb105:]]58; CHECK:    %[[#bb105]] = OpLabel59; CHECK:                  OpSelectionMerge %[[#bb106:]] None60; CHECK:                  OpBranchConditional %[[#]] %[[#bb107:]] %[[#bb108:]]61; CHECK:    %[[#bb108]] = OpLabel62; CHECK:                  OpBranch %[[#bb106]]63; CHECK:    %[[#bb107]] = OpLabel64; CHECK:                  OpSelectionMerge %[[#bb109:]] None65; CHECK:                  OpBranchConditional %[[#]] %[[#bb110:]] %[[#bb109]]66; CHECK:    %[[#bb110]] = OpLabel67; CHECK:                  OpSelectionMerge %[[#bb111:]] None68; CHECK:                  OpBranchConditional %[[#]] %[[#bb112:]] %[[#bb113:]]69; CHECK:    %[[#bb113]] = OpLabel70; CHECK:                  OpSelectionMerge %[[#bb114:]] None71; CHECK:                  OpBranchConditional %[[#]] %[[#bb114]] %[[#bb115:]]72; CHECK:    %[[#bb115]] = OpLabel73; CHECK:                  OpBranch %[[#bb114]]74; CHECK:    %[[#bb114]] = OpLabel75; CHECK:                  OpBranchConditional %[[#]] %[[#bb116:]] %[[#bb111]]76; CHECK:    %[[#bb116]] = OpLabel77; CHECK:                  OpBranch %[[#bb111]]78; CHECK:    %[[#bb112]] = OpLabel79; CHECK:                  OpBranch %[[#bb111]]80; CHECK:    %[[#bb111]] = OpLabel81; CHECK:                  OpBranchConditional %[[#]] %[[#bb109]] %[[#bb117:]]82; CHECK:    %[[#bb117]] = OpLabel83; CHECK:                  OpBranch %[[#bb109]]84; CHECK:    %[[#bb109]] = OpLabel85; CHECK:                  OpBranchConditional %[[#]] %[[#bb106]] %[[#bb118:]]86; CHECK:    %[[#bb118]] = OpLabel87; CHECK:                  OpBranch %[[#bb106]]88; CHECK:    %[[#bb106]] = OpLabel89; CHECK:                  OpSelectionMerge %[[#bb119:]] None90; CHECK:                  OpBranchConditional %[[#]] %[[#bb119]] %[[#bb120:]]91; CHECK:    %[[#bb120]] = OpLabel92; CHECK:    %[[#bb119]] = OpLabel93; CHECK:                  OpBranchConditional %[[#]] %[[#bb104]] %[[#bb103]]94; CHECK:    %[[#bb103]] = OpLabel95; CHECK:                  OpBranch %[[#bb121:]]96; CHECK:    %[[#bb121]] = OpLabel97; CHECK:                  OpLoopMerge %[[#bb122:]] %[[#bb123:]] None98; CHECK:                  OpBranch %[[#bb124:]]99; CHECK:    %[[#bb124]] = OpLabel100; CHECK:                  OpSelectionMerge %[[#bb125:]] None101; CHECK:                  OpBranchConditional %[[#]] %[[#bb126:]] %[[#bb127:]]102; CHECK:    %[[#bb127]] = OpLabel103; CHECK:                  OpBranch %[[#bb125]]104; CHECK:    %[[#bb126]] = OpLabel105; CHECK:                  OpBranch %[[#bb125]]106; CHECK:    %[[#bb125]] = OpLabel107; CHECK:                  OpBranchConditional %[[#]] %[[#bb123]] %[[#bb122]]108; CHECK:    %[[#bb122]] = OpLabel109; CHECK:                  OpBranch %[[#bb128:]]110; CHECK:    %[[#bb128]] = OpLabel111; CHECK:                  OpLoopMerge %[[#bb129:]] %[[#bb130:]] None112; CHECK:                  OpBranch %[[#bb131:]]113; CHECK:    %[[#bb131]] = OpLabel114; CHECK:                  OpSelectionMerge %[[#bb132:]] None115; CHECK:                  OpBranchConditional %[[#]] %[[#bb133:]] %[[#bb134:]]116; CHECK:    %[[#bb134]] = OpLabel117; CHECK:                  OpBranch %[[#bb132]]118; CHECK:    %[[#bb133]] = OpLabel119; CHECK:                  OpBranch %[[#bb132]]120; CHECK:    %[[#bb132]] = OpLabel121; CHECK:                  OpBranchConditional %[[#]] %[[#bb130]] %[[#bb129]]122; CHECK:    %[[#bb129]] = OpLabel123; CHECK:                  OpReturn124; CHECK:    %[[#bb130]] = OpLabel125; CHECK:                  OpBranch %[[#bb128]]126; CHECK:    %[[#bb123]] = OpLabel127; CHECK:                  OpBranch %[[#bb121]]128; CHECK:    %[[#bb104]] = OpLabel129; CHECK:                  OpBranch %[[#bb102]]130; CHECK:     %[[#bb97]] = OpLabel131; CHECK:                  OpBranch %[[#bb95]]132; CHECK:     %[[#bb90]] = OpLabel133; CHECK:                  OpBranch %[[#bb88]]134; CHECK:                  OpFunctionEnd135 136; CHECK: %[[#func_85:]] = OpFunction %[[#void]] None %[[#]]137; CHECK:   %[[#bb135:]] = OpLabel138; CHECK:                  OpReturn139; CHECK:                  OpFunctionEnd140 141target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"142target triple = "spirv-unknown-vulkan1.3-compute"143 144; Function Attrs: convergent noinline norecurse nounwind optnone145define internal spir_func void @main() #0 {146entry:147  %0 = call token @llvm.experimental.convergence.entry()148  %a = alloca i32, align 4149  %b = alloca i32, align 4150  %x = alloca i32, align 4151  %y = alloca i32, align 4152  br label %while.cond153 154while.cond:                                       ; preds = %while.body, %entry155  %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]156  %2 = load i32, ptr %a, align 4157  %tobool = icmp ne i32 %2, 0158  br i1 %tobool, label %land.rhs, label %land.end159 160land.rhs:                                         ; preds = %while.cond161  %3 = load i32, ptr %b, align 4162  %tobool1 = icmp ne i32 %3, 0163  br label %land.end164 165land.end:                                         ; preds = %land.rhs, %while.cond166  %4 = phi i1 [ false, %while.cond ], [ %tobool1, %land.rhs ]167  br i1 %4, label %while.body, label %while.end168 169while.body:                                       ; preds = %land.end170  br label %while.cond171 172while.end:                                        ; preds = %land.end173  br label %while.cond2174 175while.cond2:                                      ; preds = %while.body5, %while.end176  %5 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]177  %6 = load i32, ptr %a, align 4178  %tobool3 = icmp ne i32 %6, 0179  br i1 %tobool3, label %lor.end, label %lor.rhs180 181lor.rhs:                                          ; preds = %while.cond2182  %7 = load i32, ptr %b, align 4183  %tobool4 = icmp ne i32 %7, 0184  br label %lor.end185 186lor.end:                                          ; preds = %lor.rhs, %while.cond2187  %8 = phi i1 [ true, %while.cond2 ], [ %tobool4, %lor.rhs ]188  br i1 %8, label %while.body5, label %while.end6189 190while.body5:                                      ; preds = %lor.end191  br label %while.cond2192 193while.end6:                                       ; preds = %lor.end194  br label %while.cond7195 196while.cond7:                                      ; preds = %while.body16, %while.end6197  %9 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]198  %10 = load i32, ptr %a, align 4199  %tobool8 = icmp ne i32 %10, 0200  br i1 %tobool8, label %land.rhs9, label %land.end15201 202land.rhs9:                                        ; preds = %while.cond7203  %11 = load i32, ptr %a, align 4204  %tobool10 = icmp ne i32 %11, 0205  br i1 %tobool10, label %land.rhs12, label %lor.lhs.false206 207lor.lhs.false:                                    ; preds = %land.rhs9208  %12 = load i32, ptr %b, align 4209  %tobool11 = icmp ne i32 %12, 0210  br i1 %tobool11, label %land.rhs12, label %land.end14211 212land.rhs12:                                       ; preds = %lor.lhs.false, %land.rhs9213  %13 = load i32, ptr %b, align 4214  %tobool13 = icmp ne i32 %13, 0215  br label %land.end14216 217land.end14:                                       ; preds = %land.rhs12, %lor.lhs.false218  %14 = phi i1 [ false, %lor.lhs.false ], [ %tobool13, %land.rhs12 ]219  br label %land.end15220 221land.end15:                                       ; preds = %land.end14, %while.cond7222  %15 = phi i1 [ false, %while.cond7 ], [ %14, %land.end14 ]223  br i1 %15, label %while.body16, label %while.end17224 225while.body16:                                     ; preds = %land.end15226  br label %while.cond7227 228while.end17:                                      ; preds = %land.end15229  br label %while.cond18230 231while.cond18:                                     ; preds = %while.body21, %while.end17232  %16 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]233  %17 = load i32, ptr %a, align 4234  %tobool19 = icmp ne i32 %17, 0235  br i1 %tobool19, label %cond.true, label %cond.false236 237cond.true:                                        ; preds = %while.cond18238  %18 = load i32, ptr %a, align 4239  br label %cond.end240 241cond.false:                                       ; preds = %while.cond18242  %19 = load i32, ptr %b, align 4243  br label %cond.end244 245cond.end:                                         ; preds = %cond.false, %cond.true246  %cond = phi i32 [ %18, %cond.true ], [ %19, %cond.false ]247  %tobool20 = icmp ne i32 %cond, 0248  br i1 %tobool20, label %while.body21, label %while.end22249 250while.body21:                                     ; preds = %cond.end251  br label %while.cond18252 253while.end22:                                      ; preds = %cond.end254  br label %while.cond23255 256while.cond23:                                     ; preds = %while.body29, %while.end22257  %20 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]258  %21 = load i32, ptr %x, align 4259  %22 = load i32, ptr %x, align 4260  %tobool24 = icmp ne i32 %22, 0261  br i1 %tobool24, label %land.rhs25, label %land.end27262 263land.rhs25:                                       ; preds = %while.cond23264  %23 = load i32, ptr %y, align 4265  %tobool26 = icmp ne i32 %23, 0266  br label %land.end27267 268land.end27:                                       ; preds = %land.rhs25, %while.cond23269  %24 = phi i1 [ false, %while.cond23 ], [ %tobool26, %land.rhs25 ]270  %conv = zext i1 %24 to i32271  %add = add nsw i32 %21, %conv272  %tobool28 = icmp ne i32 %add, 0273  br i1 %tobool28, label %while.body29, label %while.end30274 275while.body29:                                     ; preds = %land.end27276  br label %while.cond23277 278while.end30:                                      ; preds = %land.end27279  ret void280}281 282; Function Attrs: convergent norecurse283define void @main.1() #1 {284entry:285  call void @main()286  ret void287}288 289; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)290declare token @llvm.experimental.convergence.entry() #2291 292; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)293declare token @llvm.experimental.convergence.loop() #2294 295attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }296attributes #1 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }297attributes #2 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }298 299!llvm.module.flags = !{!0, !1, !2}300 301 302!0 = !{i32 1, !"wchar_size", i32 4}303!1 = !{i32 4, !"dx.disable_optimizations", i32 1}304!2 = !{i32 7, !"frame-pointer", i32 2}305 306 307