96 lines · plain
1; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s2 3; REQUIRES: asserts4 5; CHECK: %[[#bool:]] = OpTypeBool6; CHECK: %[[#true:]] = OpConstantTrue %[[#bool]]7; CHECK: OpBranchConditional %[[#true]]8 9%structtype = type { i32, i32, i8 addrspace(4)* }10%structtype.0 = type <{ i32, i32, i8 addrspace(4)* }>11 12@__block_literal_global = internal addrspace(1) constant %structtype { i32 16, i32 8, i8 addrspace(4)* addrspacecast (i8* null to i8 addrspace(4)*) }, align 813@__block_literal_global.1 = internal addrspace(1) constant %structtype { i32 16, i32 8, i8 addrspace(4)* addrspacecast (i8* null to i8 addrspace(4)*) }, align 814@__block_literal_global.2 = internal addrspace(1) constant %structtype { i32 16, i32 8, i8 addrspace(4)* addrspacecast (i8* null to i8 addrspace(4)*) }, align 815 16define spir_kernel void @block_typedef_mltpl_stmnt(i32 addrspace(1)* %res) {17entry:18 %0 = call spir_func <3 x i64> @BuiltInGlobalInvocationId()19 %call = extractelement <3 x i64> %0, i32 020 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %res, i64 %call21 store i32 -1, i32 addrspace(1)* %arrayidx, align 422 %1 = bitcast %structtype addrspace(1)* @__block_literal_global to i8 addrspace(1)*23 %2 = addrspacecast i8 addrspace(1)* %1 to i8 addrspace(4)*24 %3 = bitcast %structtype addrspace(1)* @__block_literal_global.1 to i8 addrspace(1)*25 %4 = addrspacecast i8 addrspace(1)* %3 to i8 addrspace(4)*26 %5 = bitcast %structtype addrspace(1)* @__block_literal_global.2 to i8 addrspace(1)*27 %6 = addrspacecast i8 addrspace(1)* %5 to i8 addrspace(4)*28 br label %do.body29 30do.body: ; preds = %do.cond, %entry31 %a.0 = phi i32 [ undef, %entry ], [ %a.1, %do.cond ]32 %call1 = call spir_func float @__block_typedef_mltpl_stmnt_block_invoke(i8 addrspace(4)* %2, float 0.000000e+00)33 %call2 = call spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_2(i8 addrspace(4)* %4, i32 0)34 %conv = sitofp i32 %call2 to float35 %sub = fsub float %call1, %conv36 %cmp = fcmp ogt float %sub, 0.000000e+0037 br i1 %cmp, label %if.then, label %if.end38 39if.then: ; preds = %do.body40 %call4 = call spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %6, i32 1)41 %call5 = call spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %6, i32 2)42 %add = add i32 %call4, %call543 br label %cleanup44 45if.end: ; preds = %do.body46 br label %cleanup47 48cleanup: ; preds = %if.end, %if.then49 %a.1 = phi i32 [ %add, %if.then ], [ %a.0, %if.end ]50 %cleanup.dest.slot.0 = phi i32 [ 2, %if.then ], [ 0, %if.end ]51 switch i32 %cleanup.dest.slot.0, label %unreachable [52 i32 0, label %cleanup.cont53 i32 2, label %do.end54 ]55 56cleanup.cont: ; preds = %cleanup57 br label %do.cond58 59do.cond: ; preds = %cleanup.cont60 br i1 true, label %do.body, label %do.end61 62do.end: ; preds = %do.cond, %cleanup63 %sub7 = sub nsw i32 %a.1, 1164 %arrayidx8 = getelementptr inbounds i32, i32 addrspace(1)* %res, i64 %call65 store i32 %sub7, i32 addrspace(1)* %arrayidx8, align 466 ret void67 68unreachable: ; preds = %cleanup69 unreachable70}71 72define internal spir_func float @__block_typedef_mltpl_stmnt_block_invoke(i8 addrspace(4)* %.block_descriptor, float %bi) {73entry:74 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)*75 %conv = fpext float %bi to double76 %add = fadd double %conv, 3.300000e+0077 %conv1 = fptrunc double %add to float78 ret float %conv179}80 81define internal spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_2(i8 addrspace(4)* %.block_descriptor, i32 %bi) {82entry:83 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)*84 %add = add nsw i32 %bi, 285 ret i32 %add86}87 88define internal spir_func i32 @__block_typedef_mltpl_stmnt_block_invoke_3(i8 addrspace(4)* %.block_descriptor, i32 %bi) {89entry:90 %block = bitcast i8 addrspace(4)* %.block_descriptor to %structtype.0 addrspace(4)*91 %add = add i32 %bi, 492 ret i32 %add93}94 95declare spir_func <3 x i64> @BuiltInGlobalInvocationId()96