1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s
5 define i32 @test_cmp_i8(i8 %a, i8 %b) {
6 %r = icmp ult i8 %a, %b
7 %res = zext i1 %r to i32
11 define i32 @test_cmp_i16(i16 %a, i16 %b) {
12 %r = icmp ult i16 %a, %b
13 %res = zext i1 %r to i32
17 define i32 @test_cmp_i32(i32 %a, i32 %b) {
18 %r = icmp ult i32 %a, %b
19 %res = zext i1 %r to i32
23 define i32 @test_cmp_i64(i64 %a, i64 %b) {
24 %r = icmp ult i64 %a, %b
25 %res = zext i1 %r to i32
29 define i32 @test_cmp_p0(ptr %a, ptr %b) {
30 %r = icmp ult ptr %a, %b
31 %res = zext i1 %r to i32
40 regBankSelected: false
50 ; CHECK-LABEL: name: test_cmp_i8
51 ; CHECK: liveins: $edi, $esi
53 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
54 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $sil
55 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s8), [[COPY1]]
56 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
57 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
58 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
59 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
60 ; CHECK-NEXT: RET 0, implicit $eax
63 %2(s1) = G_ICMP intpred(ult), %0(s8), %1
64 %3(s32) = G_ZEXT %2(s1)
73 regBankSelected: false
83 ; CHECK-LABEL: name: test_cmp_i16
84 ; CHECK: liveins: $edi, $esi
86 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $di
87 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s16) = COPY $si
88 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s16), [[COPY1]]
89 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
90 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
91 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
92 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
93 ; CHECK-NEXT: RET 0, implicit $eax
96 %2(s1) = G_ICMP intpred(ult), %0(s16), %1
97 %3(s32) = G_ZEXT %2(s1)
106 regBankSelected: false
108 - { id: 0, class: _ }
109 - { id: 1, class: _ }
110 - { id: 2, class: _ }
111 - { id: 3, class: _ }
116 ; CHECK-LABEL: name: test_cmp_i32
117 ; CHECK: liveins: $edi, $esi
119 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
120 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
121 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]]
122 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
123 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
124 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
125 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
126 ; CHECK-NEXT: RET 0, implicit $eax
129 %2(s1) = G_ICMP intpred(ult), %0(s32), %1
130 %3(s32) = G_ZEXT %2(s1)
139 regBankSelected: false
141 - { id: 0, class: _ }
142 - { id: 1, class: _ }
143 - { id: 2, class: _ }
144 - { id: 3, class: _ }
149 ; CHECK-LABEL: name: test_cmp_i64
150 ; CHECK: liveins: $rdi, $rsi
152 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
153 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
154 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s64), [[COPY1]]
155 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
156 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
157 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
158 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
159 ; CHECK-NEXT: RET 0, implicit $eax
162 %2(s1) = G_ICMP intpred(ult), %0(s64), %1
163 %3(s32) = G_ZEXT %2(s1)
172 regBankSelected: false
174 - { id: 0, class: _ }
175 - { id: 1, class: _ }
176 - { id: 2, class: _ }
177 - { id: 3, class: _ }
182 ; CHECK-LABEL: name: test_cmp_p0
183 ; CHECK: liveins: $rdi, $rsi
185 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
186 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
187 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](p0), [[COPY1]]
188 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
189 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
190 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
191 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
192 ; CHECK-NEXT: RET 0, implicit $eax
195 %2(s1) = G_ICMP intpred(ult), %0(p0), %1
196 %3(s32) = G_ZEXT %2(s1)