xref: /llvm-project/llvm/test/CodeGen/SPIRV/branching/if-non-merging.ll (revision 42633cf27bd2cfb44e9f332c33cfd6750b9d7be4)
1*42633cf2SVyacheslav Levytskyy; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2b8e1544bSIlia Diachkov
3b8e1544bSIlia Diachkov; CHECK-DAG: [[I32:%.+]] = OpTypeInt 32
4b8e1544bSIlia Diachkov; CHECK-DAG: [[BOOL:%.+]] = OpTypeBool
5b8e1544bSIlia Diachkov; CHECK-DAG: [[TRUE:%.+]] = OpConstantTrue
6b8e1544bSIlia Diachkov; CHECK-DAG: [[FALSE:%.+]] = OpConstantFalse
7b8e1544bSIlia Diachkov
8b8e1544bSIlia Diachkovdefine i1 @test_if(i32 %a, i32 %b) {
9b8e1544bSIlia Diachkoventry:
10b8e1544bSIlia Diachkov  %cond = icmp eq i32 %a, %b
11b8e1544bSIlia Diachkov  br i1 %cond, label %true_label, label %false_label
12b8e1544bSIlia Diachkovtrue_label:
13b8e1544bSIlia Diachkov  ret i1 true
14b8e1544bSIlia Diachkovfalse_label:
15b8e1544bSIlia Diachkov  ret i1 false
16b8e1544bSIlia Diachkov}
17b8e1544bSIlia Diachkov
18b8e1544bSIlia Diachkov; CHECK: OpFunction
19b8e1544bSIlia Diachkov; CHECK: [[A:%.+]] = OpFunctionParameter [[I32]]
20b8e1544bSIlia Diachkov; CHECK: [[B:%.+]] = OpFunctionParameter [[I32]]
21b8e1544bSIlia Diachkov; CHECK: [[ENTRY:%.+]] = OpLabel
22b8e1544bSIlia Diachkov; CHECK: [[COND:%.+]] = OpIEqual [[BOOL]] [[A]] [[B]]
23b8e1544bSIlia Diachkov; CHECK: OpBranchConditional [[COND]] [[TRUE_LABEL:%.+]] [[FALSE_LABEL:%.+]]
2453326ee0SNathan Gauër
251ed65febSNathan Gauër; CHECK: [[FALSE_LABEL]] = OpLabel
261ed65febSNathan Gauër; CHECK: OpReturnValue [[FALSE]]
2753326ee0SNathan Gauër
2853326ee0SNathan Gauër; CHECK: [[TRUE_LABEL]] = OpLabel
2953326ee0SNathan Gauër; CHECK: OpReturnValue [[TRUE]]
30