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: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
52 ; CHECK: [[COPY1:%[0-9]+]]:_(s8) = COPY $sil
53 ; CHECK: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s8), [[COPY1]]
54 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
55 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
56 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
57 ; CHECK: $eax = COPY [[AND]](s32)
58 ; CHECK: RET 0, implicit $eax
61 %2(s1) = G_ICMP intpred(ult), %0(s8), %1
62 %3(s32) = G_ZEXT %2(s1)
71 regBankSelected: false
81 ; CHECK-LABEL: name: test_cmp_i16
82 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
83 ; CHECK: [[COPY1:%[0-9]+]]:_(s16) = COPY $si
84 ; CHECK: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s16), [[COPY1]]
85 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
86 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
87 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
88 ; CHECK: $eax = COPY [[AND]](s32)
89 ; CHECK: RET 0, implicit $eax
92 %2(s1) = G_ICMP intpred(ult), %0(s16), %1
93 %3(s32) = G_ZEXT %2(s1)
102 regBankSelected: false
104 - { id: 0, class: _ }
105 - { id: 1, class: _ }
106 - { id: 2, class: _ }
107 - { id: 3, class: _ }
112 ; CHECK-LABEL: name: test_cmp_i32
113 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
114 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
115 ; CHECK: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]]
116 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
117 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
118 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
119 ; CHECK: $eax = COPY [[AND]](s32)
120 ; CHECK: RET 0, implicit $eax
123 %2(s1) = G_ICMP intpred(ult), %0(s32), %1
124 %3(s32) = G_ZEXT %2(s1)
133 regBankSelected: false
135 - { id: 0, class: _ }
136 - { id: 1, class: _ }
137 - { id: 2, class: _ }
138 - { id: 3, class: _ }
143 ; CHECK-LABEL: name: test_cmp_i64
144 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
145 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
146 ; CHECK: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](s64), [[COPY1]]
147 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
148 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
149 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
150 ; CHECK: $eax = COPY [[AND]](s32)
151 ; CHECK: RET 0, implicit $eax
154 %2(s1) = G_ICMP intpred(ult), %0(s64), %1
155 %3(s32) = G_ZEXT %2(s1)
164 regBankSelected: false
166 - { id: 0, class: _ }
167 - { id: 1, class: _ }
168 - { id: 2, class: _ }
169 - { id: 3, class: _ }
174 ; CHECK-LABEL: name: test_cmp_p0
175 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
176 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
177 ; CHECK: [[ICMP:%[0-9]+]]:_(s8) = G_ICMP intpred(ult), [[COPY]](p0), [[COPY1]]
178 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
179 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s8)
180 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
181 ; CHECK: $eax = COPY [[AND]](s32)
182 ; CHECK: RET 0, implicit $eax
185 %2(s1) = G_ICMP intpred(ult), %0(p0), %1
186 %3(s32) = G_ZEXT %2(s1)