1 ; RUN: llc -O0 -mtriple=spirv64v1.3-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64v1.3-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ;; kernel void test(int global *in, int global *in2) {
15 ; CHECK-SPIRV: OpConvertPtrToU
16 ; CHECK-SPIRV: OpConvertPtrToU
17 ; CHECK-SPIRV: OpINotEqual
18 ; CHECK-SPIRV: OpConvertPtrToU
19 ; CHECK-SPIRV: OpConvertPtrToU
20 ; CHECK-SPIRV: OpIEqual
21 ; CHECK-SPIRV: OpConvertPtrToU
22 ; CHECK-SPIRV: OpConvertPtrToU
23 ; CHECK-SPIRV: OpUGreaterThan
24 ; CHECK-SPIRV: OpConvertPtrToU
25 ; CHECK-SPIRV: OpConvertPtrToU
26 ; CHECK-SPIRV: OpULessThan
28 define dso_local spir_kernel void @test(i32 addrspace(1)* noundef %in, i32 addrspace(1)* noundef %in2) {
30 %in.addr = alloca i32 addrspace(1)*, align 8
31 %in2.addr = alloca i32 addrspace(1)*, align 8
32 store i32 addrspace(1)* %in, i32 addrspace(1)** %in.addr, align 8
33 store i32 addrspace(1)* %in2, i32 addrspace(1)** %in2.addr, align 8
34 %0 = load i32 addrspace(1)*, i32 addrspace(1)** %in.addr, align 8
35 %tobool = icmp ne i32 addrspace(1)* %0, null
36 br i1 %tobool, label %if.end, label %if.then
38 if.then: ; preds = %entry
41 if.end: ; preds = %entry
42 %1 = load i32 addrspace(1)*, i32 addrspace(1)** %in.addr, align 8
43 %cmp = icmp eq i32 addrspace(1)* %1, inttoptr (i64 1 to i32 addrspace(1)*)
44 br i1 %cmp, label %if.then1, label %if.end2
46 if.then1: ; preds = %if.end
49 if.end2: ; preds = %if.end
50 %2 = load i32 addrspace(1)*, i32 addrspace(1)** %in.addr, align 8
51 %3 = load i32 addrspace(1)*, i32 addrspace(1)** %in2.addr, align 8
52 %cmp3 = icmp ugt i32 addrspace(1)* %2, %3
53 br i1 %cmp3, label %if.then4, label %if.end5
55 if.then4: ; preds = %if.end2
58 if.end5: ; preds = %if.end2
59 %4 = load i32 addrspace(1)*, i32 addrspace(1)** %in.addr, align 8
60 %5 = load i32 addrspace(1)*, i32 addrspace(1)** %in2.addr, align 8
61 %cmp6 = icmp ult i32 addrspace(1)* %4, %5
62 br i1 %cmp6, label %if.then7, label %if.end8
64 if.then7: ; preds = %if.end5
67 if.end8: ; preds = %if.then, %if.then1, %if.then4, %if.then7, %if.end5