brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 784bd38 Raw
105 lines · plain
1; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s --match-full-lines2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}3 4target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"5target triple = "spirv-unknown-vulkan-compute"6 7define internal spir_func void @main() #0 {8 9; CHECK-DAG:                  OpName %[[#idx:]] "idx"10; CHECK-DAG:                  OpName %[[#reg_0:]] "reg"11; CHECK-DAG:                  OpDecorate %[[#builtin:]] BuiltIn SubgroupLocalInvocationId12; CHECK-DAG:  %[[#int_ty:]] = OpTypeInt 32 013; CHECK-DAG: %[[#bool_ty:]] = OpTypeBool14; CHECK-DAG:   %[[#int_0:]] = OpConstant %[[#int_ty]] 015; CHECK-DAG:   %[[#int_1:]] = OpConstant %[[#int_ty]] 116; CHECK-DAG:   %[[#int_2:]] = OpConstant %[[#int_ty]] 217; CHECK-DAG:  %[[#int_10:]] = OpConstant %[[#int_ty]] 1018 19; CHECK:   %[[#entry:]] = OpLabel20; CHECK:      %[[#idx]] = OpVariable %[[#]] Function21; CHECK:                  OpStore %[[#idx]] %[[#int_0]] Aligned 422; CHECK:                  OpBranch %[[#while_cond:]]23entry:24  %0 = call token @llvm.experimental.convergence.entry()25  %idx = alloca i32, align 426  store i32 0, ptr %idx, align 427  br label %while.cond28 29; CHECK:   %[[#while_cond]] = OpLabel30; CHECK:                      OpStore %[[#reg_0]] %[[#]] Aligned 431; CHECK:         %[[#tmp:]] = OpLoad %[[#int_ty]] %[[#idx]] Aligned 432; CHECK:         %[[#cmp:]] = OpINotEqual %[[#bool_ty]] %[[#tmp]] %[[#int_10]]33; CHECK:                      OpLoopMerge %[[#new_end:]] %[[#if_end2:]] None34; CHECK:                      OpBranchConditional %[[#cmp]] %[[#while_body:]] %[[#new_end]]35while.cond:36  %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]37  %2 = load i32, ptr %idx, align 438  %cmp = icmp ne i32 %2, 1039  br i1 %cmp, label %while.body, label %while.end40 41; CHECK:   %[[#while_body]] = OpLabel42; CHECK:                      OpStore %[[#reg_0]] %[[#]] Aligned 443; CHECK:         %[[#tmp:]] = OpLoad %[[#]] %[[#builtin]] Aligned 144; CHECK:                      OpStore %[[#idx]] %[[#tmp]] Aligned 445; CHECK:         %[[#tmp:]] = OpLoad %[[#int_ty]] %[[#idx]] Aligned 446; CHECK:        %[[#cmp1:]] = OpIEqual %[[#bool_ty]] %[[#tmp]] %[[#int_0]]47; CHECK:                      OpBranchConditional %[[#cmp1]] %[[#new_end]] %[[#if_end:]]48while.body:49  %3 = call i32 @__hlsl_wave_get_lane_index() [ "convergencectrl"(token %1) ]50  store i32 %3, ptr %idx, align 451  %4 = load i32, ptr %idx, align 452  %cmp1 = icmp eq i32 %4, 053  br i1 %cmp1, label %if.then, label %if.end54 55; CHECK:               %[[#if_end]] = OpLabel56; CHECK:                              OpStore %[[#reg_0]] %[[#]] Aligned 457; CHECK:                 %[[#tmp:]] = OpLoad %[[#int_ty]] %[[#builtin]] Aligned 158; CHECK:                              OpStore %[[#idx]] %[[#tmp]] Aligned 459; CHECK:                 %[[#tmp:]] = OpLoad %[[#int_ty]] %[[#idx]] Aligned 460; CHECK:                %[[#cmp2:]] = OpIEqual %[[#bool_ty]] %[[#tmp]] %[[#int_0]]61; CHECK:                              OpBranchConditional %[[#cmp2]] %[[#new_end]] %[[#if_end2]]62if.end:63  %5 = call i32 @__hlsl_wave_get_lane_index() [ "convergencectrl"(token %1) ]64  store i32 %5, ptr %idx, align 465  %6 = load i32, ptr %idx, align 466  %cmp2 = icmp eq i32 %6, 067  br i1 %cmp2, label %if.then2, label %if.end268 69; CHECK:   %[[#if_end2]] = OpLabel70; CHECK:                   OpBranch %[[#while_cond]]71 72; TODO: this OpSwitch is useless. Improve the "remove useless branches" step of the structurizer to73;       cleanup those.74; CHECK:   %[[#new_end]] = OpLabel75; CHECK:    %[[#route:]] = OpLoad %[[#]] %[[#reg_0]] Aligned 476; CHECK:                   OpSwitch %[[#route]] %[[#while_end:]] 1 %[[#while_end:]] 2 %[[#while_end:]]77 78if.end2:79  br label %while.cond80 81; CHECK: %[[#while_end]] = OpLabel82; CHECK:                   OpReturn83while.end:84  ret void85 86; Those blocks are removed by the structurizer.87if.then:88  br label %while.end89 90if.then2:91  br label %while.end92}93 94declare token @llvm.experimental.convergence.entry() #195declare token @llvm.experimental.convergence.loop() #196declare i32 @__hlsl_wave_get_lane_index() convergent97 98attributes #0 = { convergent noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }99attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }100 101!llvm.module.flags = !{!0, !1}102 103!0 = !{i32 1, !"wchar_size", i32 4}104!1 = !{i32 4, !"dx.disable_optimizations", i32 1}105