1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
3 ; CHECK-DAG: OpName [[EQ:%.*]] "test_eq"
4 ; CHECK-DAG: OpName [[NE:%.*]] "test_ne"
5 ; CHECK-DAG: OpName [[ULT:%.*]] "test_ult"
6 ; CHECK-DAG: OpName [[SLT:%.*]] "test_slt"
7 ; CHECK-DAG: OpName [[ULE:%.*]] "test_ule"
8 ; CHECK-DAG: OpName [[SLE:%.*]] "test_sle"
9 ; CHECK-DAG: OpName [[UGT:%.*]] "test_ugt"
10 ; CHECK-DAG: OpName [[SGT:%.*]] "test_sgt"
11 ; CHECK-DAG: OpName [[UGE:%.*]] "test_uge"
12 ; CHECK-DAG: OpName [[SGE:%.*]] "test_sge"
14 ;; FIXME: Translator uses OpIEqual/OpINotEqual for test_eq/test_ne cases
15 ; CHECK: [[EQ]] = OpFunction
16 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
17 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
19 ; CHECK-NEXT: [[R:%.*]] = OpPtrEqual {{%.+}} [[A]] [[B]]
20 ; CHECK-NEXT: OpReturnValue [[R]]
21 ; CHECK-NEXT: OpFunctionEnd
22 define i1 @test_eq(i16* %a, i16* %b) {
23 %r = icmp eq i16* %a, %b
27 ; CHECK: [[NE]] = OpFunction
28 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
29 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
31 ; CHECK-NEXT: [[R:%.*]] = OpPtrNotEqual {{%.+}} [[A]] [[B]]
32 ; CHECK-NEXT: OpReturnValue [[R]]
33 ; CHECK-NEXT: OpFunctionEnd
34 define i1 @test_ne(i16* %a, i16* %b) {
35 %r = icmp ne i16* %a, %b
39 ; CHECK: [[SLT]] = OpFunction
40 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
41 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
43 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
44 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
45 ; CHECK: [[R:%.*]] = OpSLessThan {{%.+}} [[AI]] [[BI]]
46 ; CHECK-NEXT: OpReturnValue [[R]]
47 ; CHECK-NEXT: OpFunctionEnd
48 define i1 @test_slt(i16* %a, i16* %b) {
49 %r = icmp slt i16* %a, %b
53 ; CHECK: [[ULT]] = OpFunction
54 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
55 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
57 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
58 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
59 ; CHECK: [[R:%.*]] = OpULessThan {{%.+}} [[AI]] [[BI]]
60 ; CHECK-NEXT: OpReturnValue [[R]]
61 ; CHECK-NEXT: OpFunctionEnd
62 define i1 @test_ult(i16* %a, i16* %b) {
63 %r = icmp ult i16* %a, %b
67 ; CHECK: [[ULE]] = OpFunction
68 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
69 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
71 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
72 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
73 ; CHECK: [[R:%.*]] = OpULessThanEqual {{%.+}} [[AI]] [[BI]]
74 ; CHECK-NEXT: OpReturnValue [[R]]
75 ; CHECK-NEXT: OpFunctionEnd
76 define i1 @test_ule(i16* %a, i16* %b) {
77 %r = icmp ule i16* %a, %b
81 ; CHECK: [[SLE]] = OpFunction
82 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
83 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
85 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
86 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
87 ; CHECK: [[R:%.*]] = OpSLessThanEqual {{%.+}} [[AI]] [[BI]]
88 ; CHECK-NEXT: OpReturnValue [[R]]
89 ; CHECK-NEXT: OpFunctionEnd
90 define i1 @test_sle(i16* %a, i16* %b) {
91 %r = icmp sle i16* %a, %b
95 ; CHECK: [[UGT]] = OpFunction
96 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
97 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
99 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
100 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
101 ; CHECK: [[R:%.*]] = OpUGreaterThan {{%.+}} [[AI]] [[BI]]
102 ; CHECK-NEXT: OpReturnValue [[R]]
103 ; CHECK-NEXT: OpFunctionEnd
104 define i1 @test_ugt(i16* %a, i16* %b) {
105 %r = icmp ugt i16* %a, %b
109 ; CHECK: [[SGT]] = OpFunction
110 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
111 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
112 ; CHECK-NEXT: OpLabel
113 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
114 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
115 ; CHECK: [[R:%.*]] = OpSGreaterThan {{%.+}} [[AI]] [[BI]]
116 ; CHECK-NEXT: OpReturnValue [[R]]
117 ; CHECK-NEXT: OpFunctionEnd
118 define i1 @test_sgt(i16* %a, i16* %b) {
119 %r = icmp sgt i16* %a, %b
123 ; CHECK: [[UGE]] = OpFunction
124 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
125 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
126 ; CHECK-NEXT: OpLabel
127 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
128 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
129 ; CHECK: [[R:%.*]] = OpUGreaterThanEqual {{%.+}} [[AI]] [[BI]]
130 ; CHECK-NEXT: OpReturnValue [[R]]
131 ; CHECK-NEXT: OpFunctionEnd
132 define i1 @test_uge(i16* %a, i16* %b) {
133 %r = icmp uge i16* %a, %b
137 ; CHECK: [[SGE]] = OpFunction
138 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
139 ; CHECK-NEXT: [[B:%.*]] = OpFunctionParameter
140 ; CHECK-NEXT: OpLabel
141 ; CHECK-NEXT: [[AI:%.*]] = OpConvertPtrToU {{%.+}} [[A]]
142 ; CHECK-NEXT: [[BI:%.*]] = OpConvertPtrToU {{%.+}} [[B]]
143 ; CHECK: [[R:%.*]] = OpSGreaterThanEqual {{%.+}} [[AI]] [[BI]]
144 ; CHECK-NEXT: OpReturnValue [[R]]
145 ; CHECK-NEXT: OpFunctionEnd
146 define i1 @test_sge(i16* %a, i16* %b) {
147 %r = icmp sge i16* %a, %b